diff --git a/locales/pt-BR/messages.po b/locales/pt-BR/messages.po index 953167e09..ae46065f8 100644 --- a/locales/pt-BR/messages.po +++ b/locales/pt-BR/messages.po @@ -4,9 +4,9 @@ msgstr "" "PO-Revision-Date: 2023-04-21 15:46\n" "Last-Translator: TAO Translation Team \n" "MIME-Version: 1.0\n" -"Language: pt\n" +"Language: pt-BR\n" "sourceLanguage: en-US\n" -"targetLanguage: en-US\n" +"targetLanguage: pt-BR\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Basepath: ../../\n" diff --git a/locales/pt-BR/taomedia.rdf.po b/locales/pt-BR/taomedia.rdf.po index 827403218..3d68d1c04 100644 --- a/locales/pt-BR/taomedia.rdf.po +++ b/locales/pt-BR/taomedia.rdf.po @@ -4,9 +4,9 @@ msgstr "" "PO-Revision-Date: 2023-04-21 15:46\n" "Last-Translator: TAO Translation Team \n" "MIME-Version: 1.0\n" -"Language: pt\n" +"Language: pt-BR\n" "sourceLanguage: en-US\n" -"targetLanguage: en-US\n" +"targetLanguage: pt-BR\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" diff --git a/views/css/media.css b/views/css/media.css index df068fc01..02970bdd5 100644 --- a/views/css/media.css +++ b/views/css/media.css @@ -1,3 +1,3 @@ -.previewer{position:relative}.previewer iframe{min-height:400px;width:100%}.previewer .previewer-component{background-color:white;text-align:initial}.previewer .previewer-component .item-previewer-scope{height:calc(100vh - 250px)}.previewer .previewer-component .item-previewer-scope .action-bar,.previewer .previewer-component .item-previewer-scope .test-sidebar{display:none}.previewer.no-background{background:none}#item-editor-scope .left-bar .tool-group ._accordion{display:none}#item-editor-scope .focus-border{box-shadow:1px 1px 3px 2px #3e7da7}#item-editor-scope .qti-itemBody.item-editor-drop-area{margin-top:0}#item-editor-scope .qti-item{padding:20px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller,#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-larger{background:none;color:black;height:21px;width:20px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller{margin-left:30px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller:before{font-size:1.2rem}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-larger:before{font-size:1.8rem}#item-editor-scope .item-editor-sidebar .item-editor-color-picker .color-trigger{background:none}#item-editor-scope .item-editor-sidebar .item-editor-color-picker .reset-button{top:0}#item-editor-scope .item-editor-sidebar .reset-group .reset-button{background:none;color:black}#item-editor-scope .item-editor-sidebar #style-sheet-toggler .file-label{cursor:default}#item-editor-scope .item-editor-sidebar #style-sheet-toggler .file-label:hover{color:inherit}#item-editor-scope .item-editor-sidebar #style-sheet-toggler [data-custom-css="custom-css"] span:last-child{cursor:default}#mediaManager .stylesheets .file-selector ul{display:flex;flex-direction:column-reverse;justify-content:flex-end}#mediaManager .stylesheets .file-selector li{order:2;box-sizing:initial;margin:0 0 5px 0}#mediaManager .stylesheets .file-selector li .actions{text-align:right}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"]{order:1;margin:5px 0}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"]:before{border-top:1px solid #DDDDDD;width:100%;left:0;text-indent:8px;top:-5px;line-height:2.8}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"] .actions a.tlb-button-off{display:none}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"] .actions a.download{display:block}#mediaManager .stylesheets .file-selector .files>li[data-file="/tao-user-styles.css"]:only-child:before{border:none}#mediaManager .stylesheets .file-preview h2[data-toggle*=".actions"]{display:none}#mediaManager .stylesheets .file-preview h2[data-toggle*=".actions"]+.actions{display:none}div.item-editor-item{border-color:transparent} +.previewer{position:relative}.previewer iframe{min-height:400px;width:100%}.previewer .previewer-component{background-color:#fff;text-align:initial}.previewer .previewer-component .item-previewer-scope{height:calc(100vh - 250px)}.previewer .previewer-component .item-previewer-scope .action-bar,.previewer .previewer-component .item-previewer-scope .test-sidebar{display:none}.previewer.no-background{background:none}#item-editor-scope .left-bar .tool-group ._accordion{display:none}#item-editor-scope .focus-border{box-shadow:1px 1px 3px 2px #3e7da7}#item-editor-scope .qti-itemBody.item-editor-drop-area{margin-top:0}#item-editor-scope .qti-item{padding:20px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller,#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-larger{background:none;color:#000;height:21px;width:20px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller{margin-left:30px}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-smaller:before{font-size:1.2rem}#item-editor-scope .item-editor-sidebar #item-editor-font-size-changer .icon-larger:before{font-size:1.8rem}#item-editor-scope .item-editor-sidebar .item-editor-color-picker .color-trigger{background:none}#item-editor-scope .item-editor-sidebar .item-editor-color-picker .reset-button{top:0}#item-editor-scope .item-editor-sidebar .reset-group .reset-button{background:none;color:#000}#item-editor-scope .item-editor-sidebar #style-sheet-toggler .file-label{cursor:default}#item-editor-scope .item-editor-sidebar #style-sheet-toggler .file-label:hover{color:inherit}#item-editor-scope .item-editor-sidebar #style-sheet-toggler [data-custom-css=custom-css] span:last-child{cursor:default}#mediaManager .stylesheets .file-selector ul{display:flex;flex-direction:column-reverse;justify-content:flex-end}#mediaManager .stylesheets .file-selector li{order:2;box-sizing:initial;margin:0 0 5px 0}#mediaManager .stylesheets .file-selector li .actions{text-align:right}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"]{order:1;margin:5px 0}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"]:before{border-top:1px solid #ddd;width:100%;left:0;text-indent:8px;top:-5px;line-height:2.8}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"] .actions a.tlb-button-off{display:none}#mediaManager .stylesheets .file-selector li[data-file="/tao-user-styles.css"] .actions a.download{display:block}#mediaManager .stylesheets .file-selector .files>li[data-file="/tao-user-styles.css"]:only-child:before{border:none}#mediaManager .stylesheets .file-preview h2[data-toggle*=".actions"]{display:none}#mediaManager .stylesheets .file-preview h2[data-toggle*=".actions"]+.actions{display:none}div.item-editor-item{border-color:rgba(0,0,0,0)} /*# sourceMappingURL=media.css.map */ \ No newline at end of file diff --git a/views/css/media.css.map b/views/css/media.css.map index 80d0e8abc..2972c495d 100644 --- a/views/css/media.css.map +++ b/views/css/media.css.map @@ -1,14 +1 @@ -{ - "version": 3, - "file": "media.css", - "sources": [ - "../scss/media.scss", - "../../../tao/views/node_modules/@oat-sa/tao-core-ui/scss/inc/_bootstrap.scss", - "../../../tao/views/node_modules/@oat-sa/tao-core-ui/scss/inc/_variables.scss", - "../../../tao/views/node_modules/@oat-sa/tao-core-ui/scss/inc/_functions.scss", - "../../../tao/views/node_modules/@oat-sa/tao-core-ui/scss/inc/_colors.scss", - "../../../tao/views/scss/inc/fonts/_tao-icon-vars.scss" - ], - "names": [], - "mappings": "AAEA,AAAA,UAAU,AAAC,CACP,QAAQ,CAAE,QAAQ,CAmBrB,AApBD,AAEI,UAFM,CAEN,MAAM,AAAC,CACH,UAAU,CAAE,KAAK,CACjB,KAAK,CAAE,IAAI,CACd,AALL,AAMI,UANM,CAMN,oBAAoB,AAAC,CACjB,gBAAgB,CAAE,KAAK,CACvB,UAAU,CAAE,OAAO,CAQtB,AAhBL,AASQ,UATE,CAMN,oBAAoB,CAGhB,qBAAqB,AAAC,CAClB,MAAM,CAAE,mBAAmB,CAK9B,AAfT,AAWY,UAXF,CAMN,oBAAoB,CAGhB,qBAAqB,CAEjB,WAAW,CAXvB,UAAU,CAMN,oBAAoB,CAGhB,qBAAqB,CAGjB,aAAa,AAAC,CACV,OAAO,CAAE,IAAI,CAChB,AAdb,AAiBI,UAjBM,AAiBL,cAAc,AAAC,CACZ,UAAU,CAAE,IAAI,CACnB,AAGL,AAGY,kBAHM,CACd,SAAS,C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,sBAAsB,AAAhC,EAaC,QAAQ,CACJ,CAAC,AAAA,eAAe,AAAC,CACb,OAAO,CAAE,IAAI,CAChB,AAnCrB,AAoCoB,aApCP,CACT,YAAY,CACR,cAAc,CAiBV,EAAE,CAAA,AAAA,SAAC,CAAU,sBAAsB,AAAhC,EAaC,QAAQ,CAIJ,CAAC,AAAA,SAAS,AAAC,CACP,OAAO,CAAE,KAAK,CACjB,AAtCrB,AA2CgB,aA3CH,CACT,YAAY,CACR,cAAc,CAwCV,MAAM,CAAG,EAAE,CAAA,AAAA,SAAC,CAAU,sBAAsB,AAAhC,CAAiC,WAAW,AACnD,OAAO,AAAC,CACL,MAAM,CAAE,IAAI,CACf,AA7CjB,AAiDY,aAjDC,CACT,YAAY,CA+CR,aAAa,CACT,EAAE,CAAA,AAAA,WAAC,EAAa,UAAU,AAAvB,CAAyB,CACxB,OAAO,CAAE,IAAI,CAIhB,AAtDb,AAmDgB,aAnDH,CACT,YAAY,CA+CR,aAAa,CACT,EAAE,CAAA,AAAA,WAAC,EAAa,UAAU,AAAvB,EAEK,QAAQ,AAAC,CACT,OAAO,CAAE,IAAI,CAChB,AAMjB,AAAA,GAAG,AAAA,iBAAiB,AAAC,CACjB,YAAY,CAAE,WAAW,CAC5B" -} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/media.scss"],"names":[],"mappings":"AAEA,WACI,kBACA,kBACI,iBACA,WAEJ,gCACI,sBACA,mBACA,sDACI,2BACA,sIAEI,aAIZ,yBACI,gBAOI,qDACI,aAIZ,iCACI,mCAEJ,uDACI,aAEJ,6BACI,aAII,yKACI,gBACA,WACA,YACA,WAEJ,qFACI,iBACA,4FACI,iBAKJ,2FACI,iBAKR,iFACI,gBAEJ,gFACI,MAIJ,mEACI,gBACA,WAIJ,yEACI,eACA,+EACI,cAGR,0GACI,eAUJ,6CACI,aACA,8BACA,yBAEJ,6CACI,QACA,mBACA,iBAEA,sDACI,iBAIR,+EACI,QACA,aAEA,sFACI,0BACA,WACA,OACA,gBACA,SACA,gBAIA,yGACI,aAEJ,mGACI,cAMR,wGACI,YAKR,qEACI,aACA,8EACI,aAOpB,qBACI","file":"media.css"} \ No newline at end of file diff --git a/views/js/loader/injectStylesInItemData.min.js.map b/views/js/loader/injectStylesInItemData.min.js.map index 042c2ac8e..0a99c9ec6 100644 --- a/views/js/loader/injectStylesInItemData.min.js.map +++ b/views/js/loader/injectStylesInItemData.min.js.map @@ -1 +1 @@ -{"version":3,"mappings":"AAsBA,YACA,gBAIAA,oDACAC,mDACAC,gDAEAC,4CACAC,sBACAC,4DACAC,gDACA,IACAF,oCACA,YACAA,oBACA,CACAG,qDACA,+CACAA,iBACAA,kBACAC,oCAEA,EACAC,iEACA,kCACAC,iBAEA,EACA,EAGAH,sCAGAA,qBAGAA,iBAOAA,iDACAI,oBACAA,uCACAA,4CACA,oEACA,GACAC,2BACAD,+BACAJ,sBACA,GACAJ,gBACA,EACA,GAGAD,8CACAK,6BAEAJ,gBAEA,EACA,KAEAU,wCC1EAA,yDACA,SACA,aACA,aAEA,sCAEAC,0CACAC,gBAEA,iBAEAC,kDACAC,sDAGAC,8CACA,iBASA,WARAA,yBACA,oIACAC,eACAC,+CAEAC,0BAEA,GAEA,KAGAC,yCACAC,0DACA,uBAQA,WAPAA,uCACAC,uDACAC,4HACAA,sBACAL,oDAEA,GAKA,wDACA,0BAOA,WANAM,qCACA,4EACAC,yBACAP,uDAEA,EAGA,CACA,CAEA,mCAKA,uBACAQ,0BAEAC,UACAC,2CACAF,+BACA,EAIA,CAEA,+CAKA,uBACAA,0BACAG,iEAGAC,uFAEA,6BACAF,2CACAF,+BACA,GACA,0CACAE,mCACAF,8BACA,EACA,CAGA,CAUA,4EACA,aACA,SAGAK,sBACAA,mCAGA,sDAGA,sBACA,SACA,KAOAC,sEACAC,6CAEAC,mBAEA,yCAEA,+DACA,SAIA,gBACA,4BACA,uCACAC,iDACA,cACAJ,wBAEAI,8CACA,mCACAJ,oBACA,CACAK,aAMA,4BACAD,kDACAA,8CACAA,2CAGAE,sCACAH,+DAEAA,wCAEA,OAEAA,wBACA,kDAEA,EACA,GAEA,wDACA,CAhFA,CAkFA,OACAI,oBACA,CACA,GCrLA3B,8CACA,SACA,SACA,MACA,WACA,4BACA,iDACA,gDACA,aAOA,wGACA4B,YAyBA,MAxBAC,sDACA,qEAEAA,mDACAA,+BACAD,0DACA,EACA,GAEAC,oDACA,kCACAD,2CAEAA,gEAEA,EAEA,GACAE,eACAF,kEAEAE,iBACAF,oEAEAA,QACA,CAOA,0GACAA,YAIA,MAHAG,uEACAH,gFAEAA,QACA,CAQA,yLACAI,aACAC,eA4CA,MA3CAJ,gCACA,uCACA,oDAEA,gFACAI,mCACAA,6BACAD,cACAE,mFACAC,cACA,GACAC,gBACAC,+CACA,+FACAF,eACAG,0BACA,GACA,+CAEA,SAEA,yCACAP,2CACAQ,sBACAC,YACAC,oBACAC,YACAC,SACAC,gBACAC,8CACA,EACAC,MACA,EACAf,6EACAA,+EACAgB,0CACA,EACA,GACAC,QACA,CAEA,CACA,GACAC,wCACA,CAOA,iHACA,8CACA,gDACA,iDACA,wDACA,CACA,gCACA,CAEA,OACAC,uBACAC,wBACAC,+BACAC,8BACA,CACA,GCpIArD,sHACA,aACA,6CACA,GCpBAA","names":["loaderScript","configUrl","bundle","loadController","controllerOptions","controllerPath","params","window","controller","document","startController","bundles","require","define","path","linkTag","stylesheetUrl","rdf_styles","assets","assetClassName","_formatStyles","_hideStyles","stylesheetSerial","passagesItem","passageWrapper","passageItemClassName","passagesPreview","passagePreviewClassName","CSSStyleSheet","cssRules","Object","classNameFormated","scopedCssRules","replacementSelector","rulesInBrackets","selectors","scopedSelectors","singleSelectorText","numRepeat","scopeSelector","handleStylesheetLoad","includes","_","element","itemData","requests","passageUris","request","uri","then","response","stylesheet","qtiClass","attributes","href","media","title","type","onload","serial","elem","catch","Promise","getPassagesFromElement","getPassagesFromItemData","injectPassagesStylesInItemData","checkAndInjectStylesInItemData"],"sources":["../../loader/bootstrap.js","../qtiCreator/helper/formatStyles.js","../richPassage/helpers.js","../richPassage/injectStylesInItemData.js","module-create.js"],"sourcesContent":["/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2018 (original work) Open Assessment Technologies SA ;\n */\n\n/**\n * Bootstrap the app, start the entry controller\n * @author Bertrand Chevrier \n */\n(function(){\n 'use strict';\n\n\n\n var loaderScript = document.getElementById('amd-loader');\n var configUrl = loaderScript.getAttribute('data-config');\n var bundle = loaderScript.getAttribute('data-bundle');\n\n var loadController = function loadController(){\n var controllerOptions = {};\n var controllerPath = loaderScript.getAttribute('data-controller');\n var params = loaderScript.getAttribute('data-params');\n try{\n controllerOptions = JSON.parse(params);\n } catch(err){\n controllerOptions = {};\n }\n window.require([controllerPath], function(controller) {\n var startController = function startController(){\n if(!window.started){\n window.started = true;\n controller.start(controllerOptions);\n }\n };\n document.addEventListener('readystatechange', startController, false);\n if (document.readyState === 'complete') {\n startController();\n }\n });\n };\n\n //always start to load the config\n window.require([configUrl], function() {\n\n //define the global loading mechanism\n if(!window.loadBundles){\n //keep tracl of loaded bundles, even if require does it,\n //this prevent some unecessary cycles\n window.loaded = {};\n\n /**\n * Loading entry point for inter bundle dependency,\n * always take the bundles from the params and window.bundles\n * @param {String[]} [bundles] - an optional list of bundle to load\n */\n window.loadBundles = function loadBundles(bundles){\n bundles = bundles || [];\n bundles = bundles.concat(window.bundles)\n bundles = bundles.filter( function(item, index){\n return item && bundles.indexOf(item) === index && window.loaded[item] !== true;\n });\n require(bundles, function(){\n bundles.forEach( function( item ) {\n window.loaded[item] = true;\n });\n loadController();\n });\n }\n }\n\n if(bundle || (window.bundles && window.bundles.length)) {\n window.loadBundles([bundle]);\n } else {\n loadController();\n }\n });\n})();\n\ndefine(\"loader/bootstrap\", function(){});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2022 (original work) Open Assessment Technologies SA ;\n */\ndefine('taoMediaManager/qtiCreator/helper/formatStyles',[\n 'jquery'\n], function ($) {\n 'use strict';\n\n function handleStylesheetLoad(e) {\n // get cssRules from owner link tag, referenced in load event\n const path = e && e.composedPath && e.composedPath();\n const linkTag = path[0];\n\n if (linkTag) {\n\n const stylesheetUrl = linkTag.href.split('&stylesheet=');\n const rdf_styles = stylesheetUrl[0].split('%23').reverse()[0];\n\n // Asset & Asset Preview\n const assets = $(`[data-identifier='${rdf_styles}']`);\n if (assets.length) {\n assets.each((h, asset) => {\n const assetClassName = asset.children[0].className.match(/[\\w-]*tao-[\\w-]*/g) || asset.children[1].className.match(/[\\w-]*tao-[\\w-]*/g);\n if (assetClassName) {\n _formatStyles(linkTag.sheet, assetClassName[0]);\n } else {\n _hideStyles(linkTag.sheet);\n }\n });\n return;\n }\n\n // Passage on Item\n const stylesheetSerial = linkTag.dataset.serial;\n const passagesItem = $(`div[data-serial*='${stylesheetSerial}']`);\n if (passagesItem.length) {\n passagesItem.each((h, passages) => {\n const passageWrapper = $(passages).find('.qti-include > div');\n const passageItemClassName = passageWrapper[0] && passageWrapper[0].className && passageWrapper[0].className.match(/[\\w-]*tao-[\\w-]*/g);\n if (passageItemClassName) {\n _formatStyles(linkTag.sheet, passageItemClassName[0]);\n }\n });\n return;\n }\n\n // Item Preview\n const passagesPreview = $(`[data-href*='${rdf_styles}']`);\n if (passagesPreview.length) {\n passagesPreview.each((h, passages) => {\n const passagePreviewClassName = passages.className.match(/[\\w-]*tao-[\\w-]*/g);\n if (passagePreviewClassName) {\n _formatStyles(linkTag.sheet, passagePreviewClassName[0]);\n }\n });\n return;\n }\n }\n }\n\n function _hideStyles(linkTag) {\n /**\n * @type {CSSRuleList}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList\n */\n const { cssRules } = linkTag || {};\n const CSSStyleSheet = linkTag || {};\n\n if (cssRules) {\n Object.values(cssRules).map((index, rule) => {\n CSSStyleSheet.deleteRule(index);\n });\n }\n\n return;\n }\n\n function _formatStyles(linkTag, className) {\n /**\n * @type {CSSRuleList}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList\n */\n const { cssRules } = linkTag || {};\n const CSSStyleSheet = linkTag || {};\n const classNameFormated = className && className.length ? `.${className}` : '';\n\n // prefix rules\n const scopedCssRules = _scopeStyles(cssRules, classNameFormated, ['body', 'html', 'div.qti-item']);\n\n if (cssRules && scopedCssRules) {\n Object.values(cssRules).map((index, rule) => {\n CSSStyleSheet.deleteRule(index);\n });\n const newRules = scopedCssRules.split('\\n');\n Object.values(newRules).map(rule => {\n CSSStyleSheet.insertRule(rule);\n });\n }\n\n return;\n };\n\n /**\n * Apply selector replacement and scope prefixing to a set of style rules\n * @param {CSSRuleList} cssRules\n * @param {String} scopeSelector - applied as prefix; also used as replacementSelector if none specified\n * @param {String[]} toReplace - list of selectors to be replaced by replacementSelector\n * @param {String} replacementSelector\n * @returns {String} styles, with scopeSelector prefix applied\n */\n function _scopeStyles (cssRules, scopeSelector, toReplace, replacementSelector) {\n if (!cssRules) {\n return '';\n }\n\n if (!replacementSelector) {\n replacementSelector = scopeSelector;\n }\n\n const scopedStyles = Object.values(cssRules).map(rule => {\n // avoid @import, @media, @keyframes etc\n\n if (!rule.selectorText) {\n return '';\n }\n\n /**\n * Need to split selectorList apart from rules, before splitting it by comma\n * @example CSS:\n * selector1, selector2 { rules; }\n */\n const rulesInBrackets = rule.cssText.substr(rule.selectorText.length).trim();\n const selectors = rule.selectorText.split(/\\s*,\\s*/);\n\n const scopedSelectors = [];\n\n for (let singleSelectorText of selectors) {\n // avoid the most obvious top level single selectors that won't work even if scoped\n if (['html', 'body', 'div.qti-item'].includes(singleSelectorText)) {\n continue;\n }\n\n // make the replacements\n let numRepeat = 0;\n if (scopeSelector && toReplace) {\n for (let toReplaceSelector of toReplace) {\n if (singleSelectorText.includes(toReplaceSelector)) {\n if (numRepeat > 0) {\n replacementSelector = '';\n }\n singleSelectorText = singleSelectorText.replace(\n new RegExp(toReplaceSelector, 'ig'),\n replacementSelector\n );\n numRepeat++;\n }\n }\n }\n\n // has desired scoping been applied to the rule?\n const containsScopeSelector =\n singleSelectorText.includes(`${scopeSelector} `) ||\n singleSelectorText.startsWith(scopeSelector) ||\n singleSelectorText.endsWith(scopeSelector);\n\n // scope unscoped rule by the scope selector\n if (scopeSelector && !containsScopeSelector) {\n scopedSelectors.push(`${scopeSelector} ${singleSelectorText}`);\n } else {\n scopedSelectors.push(singleSelectorText);\n }\n }\n\n if (scopedSelectors.length) {\n return `${scopedSelectors.join(',')} ${rulesInBrackets}`;\n }\n return '';\n });\n\n return scopedStyles.filter(str => str.length > 0).join('\\n');\n }\n\n return {\n handleStylesheetLoad\n };\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\n\ndefine('taoMediaManager/richPassage/helpers',[\n 'jquery',\n 'lodash',\n 'uri',\n 'util/url',\n 'core/dataProvider/request',\n 'taoMediaManager/qtiCreator/helper/formatStyles'\n], function ($, _, uri, urlUtil, request, formatStyles) {\n 'use strict';\n\n /**\n * Get all passage elements qtiClass: 'include' presents in Element\n * @param {Object} element\n * @returns {Array} array of include elements\n */\n function getPassagesFromElement(element = {}) {\n let includes = {};\n _.forEach(['elements', 'choices'], elementCollection => {\n if (elementCollection === 'choices' && _.isArray(element[elementCollection])) {\n // in MatchInterection choices is Array of match sets\n _.forEach(element[elementCollection], choiceMatch => {\n _.forEach(choiceMatch, choice => {\n includes = _.extend(includes, getPassagesFromElement(choice));\n });\n });\n } else {\n _.forEach(element[elementCollection], childElement => {\n if (childElement.qtiClass === 'include') {\n includes[childElement.serial] = childElement;\n } else {\n includes = _.extend(includes, getPassagesFromElement(childElement));\n }\n });\n }\n });\n if (element.body) {\n includes = _.extend(includes, getPassagesFromElement(element.body));\n }\n if (element.prompt) {\n includes = _.extend(includes, getPassagesFromElement(element.prompt));\n }\n return includes;\n }\n\n /**\n * Get all passage elements qtiClass: 'include' presents in item\n * @param {Object} itemData\n * @returns {Array} array of include elements\n */\n function getPassagesFromItemData(itemData = {}) {\n let includes = {};\n if (itemData.content && itemData.content.data && itemData.content.data.body) {\n includes = _.extend(includes, getPassagesFromElement(itemData.content.data.body));\n }\n return includes;\n }\n\n /**\n * Check all passage elements and inject passage styles in itemData with absolute href\n * @param {Object | Array} elements\n * @param {Object} itemData\n * @returns {Promise}\n */\n function injectPassagesStylesInItemData(elements = {}, itemData = {}) {\n const requests = [];\n const passageUris = [];\n _.forEach(elements, (elem, id) => {\n const passageHref = elem.attributes.href;\n if (/taomedia:\\/\\/mediamanager\\//.test(passageHref)) {\n // only rich passages from Assets\n const passageUri = uri.decode(passageHref.replace('taomedia://mediamanager/', ''));\n if (!passageUris.includes(passageUri)) {\n passageUris.push(passageUri);\n requests.push(\n request(urlUtil.route('getStylesheets', 'SharedStimulusStyling', 'taoMediaManager'), {\n uri: passageUri\n })\n .then(response => {\n response.children.forEach((stylesheet, index) => {\n const stylesheetHref = urlUtil.route('loadStylesheet', 'SharedStimulusStyling', 'taoMediaManager', {\n uri: passageUri,\n stylesheet: stylesheet.name\n });\n if ($(`link[href*='${stylesheetHref}']`).length) {\n //avoid load repeated CSS files on Item authoring Preview\n return false;\n }\n const serial = `stylesheet_${id}_${index}`;\n itemData.content.data.stylesheets[serial] = {\n qtiClass: 'stylesheet',\n attributes: {\n href: stylesheetHref,\n media: 'all',\n title: '',\n type: 'text/css',\n onload: (e => formatStyles.handleStylesheetLoad(e))\n },\n serial\n };\n itemData.content.data.stylesheets[serial].attributes.includeHref = passageHref;\n itemData.content.data.stylesheets[serial].attributes.includeSerial = elem.serial;\n elem.stylesheets = {[serial]: stylesheetHref};\n });\n })\n .catch()\n );\n }\n }\n });\n return Promise.all(requests).then(() => itemData);\n }\n\n /**\n * Check all passage elements and inject rich passage styles in itemData\n * @param {Object} itemData\n * @returns {Promise}\n */\n function checkAndInjectStylesInItemData(itemData = {}) {\n const itemDataString = JSON.stringify(itemData);\n if (/\"qtiClass\":\"include\"/.test(itemDataString)) {\n const elements = getPassagesFromItemData(itemData);\n return injectPassagesStylesInItemData(elements, itemData);\n }\n return Promise.resolve(itemData);\n }\n\n return {\n getPassagesFromElement,\n getPassagesFromItemData,\n injectPassagesStylesInItemData,\n checkAndInjectStylesInItemData\n };\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\n\ndefine('taoMediaManager/richPassage/injectStylesInItemData',['taoMediaManager/richPassage/helpers'], function (helpers) {\n 'use strict';\n return helpers.checkAndInjectStylesInItemData;\n});\n\n","\ndefine(\"taoMediaManager/loader/injectStylesInItemData.bundle\", function(){});\n"]} \ No newline at end of file +{"version":3,"names":["loaderScript","document","getElementById","configUrl","getAttribute","bundle","loadController","controllerOptions","controllerPath","params","JSON","parse","err","window","require","controller","startController","started","start","addEventListener","readyState","loadBundles","loaded","bundles","concat","filter","item","index","indexOf","forEach","length","define","$","handleStylesheetLoad","e","path","composedPath","linkTag","stylesheetUrl","href","split","rdf_styles","reverse","assets","each","h","asset","assetClassName","children","className","match","_formatStyles","sheet","_hideStyles","stylesheetSerial","dataset","serial","passagesItem","passages","passageWrapper","find","passageItemClassName","passagesPreview","passagePreviewClassName","cssRules","CSSStyleSheet","Object","values","map","rule","deleteRule","classNameFormated","scopedCssRules","_scopeStyles","newRules","insertRule","scopeSelector","toReplace","replacementSelector","scopedStyles","selectorText","rulesInBrackets","cssText","substr","trim","selectors","scopedSelectors","singleSelectorText","includes","numRepeat","toReplaceSelector","replace","RegExp","containsScopeSelector","startsWith","endsWith","push","join","str","_","uri","urlUtil","request","formatStyles","getPassagesFromElement","element","arguments","elementCollection","isArray","choiceMatch","choice","extend","childElement","qtiClass","body","prompt","getPassagesFromItemData","itemData","content","data","injectPassagesStylesInItemData","elements","requests","passageUris","elem","id","passageHref","attributes","test","passageUri","decode","route","then","response","stylesheet","stylesheetHref","name","stylesheets","media","title","type","onload","includeHref","includeSerial","catch","Promise","all","checkAndInjectStylesInItemData","itemDataString","stringify","resolve","helpers"],"sources":["../../loader/bootstrap.js","../qtiCreator/helper/formatStyles.js","../richPassage/helpers.js","../richPassage/injectStylesInItemData.js","module-create.js"],"sourcesContent":["/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2016-2018 (original work) Open Assessment Technologies SA ;\n */\n\n/**\n * Bootstrap the app, start the entry controller\n * @author Bertrand Chevrier \n */\n(function(){\n 'use strict';\n\n\n\n var loaderScript = document.getElementById('amd-loader');\n var configUrl = loaderScript.getAttribute('data-config');\n var bundle = loaderScript.getAttribute('data-bundle');\n\n var loadController = function loadController(){\n var controllerOptions = {};\n var controllerPath = loaderScript.getAttribute('data-controller');\n var params = loaderScript.getAttribute('data-params');\n try{\n controllerOptions = JSON.parse(params);\n } catch(err){\n controllerOptions = {};\n }\n window.require([controllerPath], function(controller) {\n var startController = function startController(){\n if(!window.started){\n window.started = true;\n controller.start(controllerOptions);\n }\n };\n document.addEventListener('readystatechange', startController, false);\n if (document.readyState === 'complete') {\n startController();\n }\n });\n };\n\n //always start to load the config\n window.require([configUrl], function() {\n\n //define the global loading mechanism\n if(!window.loadBundles){\n //keep tracl of loaded bundles, even if require does it,\n //this prevent some unecessary cycles\n window.loaded = {};\n\n /**\n * Loading entry point for inter bundle dependency,\n * always take the bundles from the params and window.bundles\n * @param {String[]} [bundles] - an optional list of bundle to load\n */\n window.loadBundles = function loadBundles(bundles){\n bundles = bundles || [];\n bundles = bundles.concat(window.bundles)\n bundles = bundles.filter( function(item, index){\n return item && bundles.indexOf(item) === index && window.loaded[item] !== true;\n });\n require(bundles, function(){\n bundles.forEach( function( item ) {\n window.loaded[item] = true;\n });\n loadController();\n });\n }\n }\n\n if(bundle || (window.bundles && window.bundles.length)) {\n window.loadBundles([bundle]);\n } else {\n loadController();\n }\n });\n})();\n\ndefine(\"loader/bootstrap\", function(){});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2022 (original work) Open Assessment Technologies SA ;\n */\ndefine('taoMediaManager/qtiCreator/helper/formatStyles',[\n 'jquery'\n], function ($) {\n 'use strict';\n\n function handleStylesheetLoad(e) {\n // get cssRules from owner link tag, referenced in load event\n const path = e && e.composedPath && e.composedPath();\n const linkTag = path[0];\n\n if (linkTag) {\n\n const stylesheetUrl = linkTag.href.split('&stylesheet=');\n const rdf_styles = stylesheetUrl[0].split('%23').reverse()[0];\n\n // Asset & Asset Preview\n const assets = $(`[data-identifier='${rdf_styles}']`);\n if (assets.length) {\n assets.each((h, asset) => {\n const assetClassName = asset.children[0].className.match(/[\\w-]*tao-[\\w-]*/g) || asset.children[1].className.match(/[\\w-]*tao-[\\w-]*/g);\n if (assetClassName) {\n _formatStyles(linkTag.sheet, assetClassName[0]);\n } else {\n _hideStyles(linkTag.sheet);\n }\n });\n return;\n }\n\n // Passage on Item\n const stylesheetSerial = linkTag.dataset.serial;\n const passagesItem = $(`div[data-serial*='${stylesheetSerial}']`);\n if (passagesItem.length) {\n passagesItem.each((h, passages) => {\n const passageWrapper = $(passages).find('.qti-include > div');\n const passageItemClassName = passageWrapper[0] && passageWrapper[0].className && passageWrapper[0].className.match(/[\\w-]*tao-[\\w-]*/g);\n if (passageItemClassName) {\n _formatStyles(linkTag.sheet, passageItemClassName[0]);\n }\n });\n return;\n }\n\n // Item Preview\n const passagesPreview = $(`[data-href*='${rdf_styles}']`);\n if (passagesPreview.length) {\n passagesPreview.each((h, passages) => {\n const passagePreviewClassName = passages.className.match(/[\\w-]*tao-[\\w-]*/g);\n if (passagePreviewClassName) {\n _formatStyles(linkTag.sheet, passagePreviewClassName[0]);\n }\n });\n return;\n }\n }\n }\n\n function _hideStyles(linkTag) {\n /**\n * @type {CSSRuleList}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList\n */\n const { cssRules } = linkTag || {};\n const CSSStyleSheet = linkTag || {};\n\n if (cssRules) {\n Object.values(cssRules).map((index, rule) => {\n CSSStyleSheet.deleteRule(index);\n });\n }\n\n return;\n }\n\n function _formatStyles(linkTag, className) {\n /**\n * @type {CSSRuleList}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList\n */\n const { cssRules } = linkTag || {};\n const CSSStyleSheet = linkTag || {};\n const classNameFormated = className && className.length ? `.${className}` : '';\n\n // prefix rules\n const scopedCssRules = _scopeStyles(cssRules, classNameFormated, ['body', 'html', 'div.qti-item']);\n\n if (cssRules && scopedCssRules) {\n Object.values(cssRules).map((index, rule) => {\n CSSStyleSheet.deleteRule(index);\n });\n const newRules = scopedCssRules.split('\\n');\n Object.values(newRules).map(rule => {\n CSSStyleSheet.insertRule(rule);\n });\n }\n\n return;\n };\n\n /**\n * Apply selector replacement and scope prefixing to a set of style rules\n * @param {CSSRuleList} cssRules\n * @param {String} scopeSelector - applied as prefix; also used as replacementSelector if none specified\n * @param {String[]} toReplace - list of selectors to be replaced by replacementSelector\n * @param {String} replacementSelector\n * @returns {String} styles, with scopeSelector prefix applied\n */\n function _scopeStyles (cssRules, scopeSelector, toReplace, replacementSelector) {\n if (!cssRules) {\n return '';\n }\n\n if (!replacementSelector) {\n replacementSelector = scopeSelector;\n }\n\n const scopedStyles = Object.values(cssRules).map(rule => {\n // avoid @import, @media, @keyframes etc\n\n if (!rule.selectorText) {\n return '';\n }\n\n /**\n * Need to split selectorList apart from rules, before splitting it by comma\n * @example CSS:\n * selector1, selector2 { rules; }\n */\n const rulesInBrackets = rule.cssText.substr(rule.selectorText.length).trim();\n const selectors = rule.selectorText.split(/\\s*,\\s*/);\n\n const scopedSelectors = [];\n\n for (let singleSelectorText of selectors) {\n // avoid the most obvious top level single selectors that won't work even if scoped\n if (['html', 'body', 'div.qti-item'].includes(singleSelectorText)) {\n continue;\n }\n\n // make the replacements\n let numRepeat = 0;\n if (scopeSelector && toReplace) {\n for (let toReplaceSelector of toReplace) {\n if (singleSelectorText.includes(toReplaceSelector)) {\n if (numRepeat > 0) {\n replacementSelector = '';\n }\n singleSelectorText = singleSelectorText.replace(\n new RegExp(toReplaceSelector, 'ig'),\n replacementSelector\n );\n numRepeat++;\n }\n }\n }\n\n // has desired scoping been applied to the rule?\n const containsScopeSelector =\n singleSelectorText.includes(`${scopeSelector} `) ||\n singleSelectorText.startsWith(scopeSelector) ||\n singleSelectorText.endsWith(scopeSelector);\n\n // scope unscoped rule by the scope selector\n if (scopeSelector && !containsScopeSelector) {\n scopedSelectors.push(`${scopeSelector} ${singleSelectorText}`);\n } else {\n scopedSelectors.push(singleSelectorText);\n }\n }\n\n if (scopedSelectors.length) {\n return `${scopedSelectors.join(',')} ${rulesInBrackets}`;\n }\n return '';\n });\n\n return scopedStyles.filter(str => str.length > 0).join('\\n');\n }\n\n return {\n handleStylesheetLoad\n };\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\n\ndefine('taoMediaManager/richPassage/helpers',[\n 'jquery',\n 'lodash',\n 'uri',\n 'util/url',\n 'core/dataProvider/request',\n 'taoMediaManager/qtiCreator/helper/formatStyles'\n], function ($, _, uri, urlUtil, request, formatStyles) {\n 'use strict';\n\n /**\n * Get all passage elements qtiClass: 'include' presents in Element\n * @param {Object} element\n * @returns {Array} array of include elements\n */\n function getPassagesFromElement(element = {}) {\n let includes = {};\n _.forEach(['elements', 'choices'], elementCollection => {\n if (elementCollection === 'choices' && _.isArray(element[elementCollection])) {\n // in MatchInterection choices is Array of match sets\n _.forEach(element[elementCollection], choiceMatch => {\n _.forEach(choiceMatch, choice => {\n includes = _.extend(includes, getPassagesFromElement(choice));\n });\n });\n } else {\n _.forEach(element[elementCollection], childElement => {\n if (childElement.qtiClass === 'include') {\n includes[childElement.serial] = childElement;\n } else {\n includes = _.extend(includes, getPassagesFromElement(childElement));\n }\n });\n }\n });\n if (element.body) {\n includes = _.extend(includes, getPassagesFromElement(element.body));\n }\n if (element.prompt) {\n includes = _.extend(includes, getPassagesFromElement(element.prompt));\n }\n return includes;\n }\n\n /**\n * Get all passage elements qtiClass: 'include' presents in item\n * @param {Object} itemData\n * @returns {Array} array of include elements\n */\n function getPassagesFromItemData(itemData = {}) {\n let includes = {};\n if (itemData.content && itemData.content.data && itemData.content.data.body) {\n includes = _.extend(includes, getPassagesFromElement(itemData.content.data.body));\n }\n return includes;\n }\n\n /**\n * Check all passage elements and inject passage styles in itemData with absolute href\n * @param {Object | Array} elements\n * @param {Object} itemData\n * @returns {Promise}\n */\n function injectPassagesStylesInItemData(elements = {}, itemData = {}) {\n const requests = [];\n const passageUris = [];\n _.forEach(elements, (elem, id) => {\n const passageHref = elem.attributes.href;\n if (/taomedia:\\/\\/mediamanager\\//.test(passageHref)) {\n // only rich passages from Assets\n const passageUri = uri.decode(passageHref.replace('taomedia://mediamanager/', ''));\n if (!passageUris.includes(passageUri)) {\n passageUris.push(passageUri);\n requests.push(\n request(urlUtil.route('getStylesheets', 'SharedStimulusStyling', 'taoMediaManager'), {\n uri: passageUri\n })\n .then(response => {\n response.children.forEach((stylesheet, index) => {\n const stylesheetHref = urlUtil.route('loadStylesheet', 'SharedStimulusStyling', 'taoMediaManager', {\n uri: passageUri,\n stylesheet: stylesheet.name\n });\n if ($(`link[href*='${stylesheetHref}']`).length) {\n //avoid load repeated CSS files on Item authoring Preview\n return false;\n }\n const serial = `stylesheet_${id}_${index}`;\n itemData.content.data.stylesheets[serial] = {\n qtiClass: 'stylesheet',\n attributes: {\n href: stylesheetHref,\n media: 'all',\n title: '',\n type: 'text/css',\n onload: (e => formatStyles.handleStylesheetLoad(e))\n },\n serial\n };\n itemData.content.data.stylesheets[serial].attributes.includeHref = passageHref;\n itemData.content.data.stylesheets[serial].attributes.includeSerial = elem.serial;\n elem.stylesheets = {[serial]: stylesheetHref};\n });\n })\n .catch()\n );\n }\n }\n });\n return Promise.all(requests).then(() => itemData);\n }\n\n /**\n * Check all passage elements and inject rich passage styles in itemData\n * @param {Object} itemData\n * @returns {Promise}\n */\n function checkAndInjectStylesInItemData(itemData = {}) {\n const itemDataString = JSON.stringify(itemData);\n if (/\"qtiClass\":\"include\"/.test(itemDataString)) {\n const elements = getPassagesFromItemData(itemData);\n return injectPassagesStylesInItemData(elements, itemData);\n }\n return Promise.resolve(itemData);\n }\n\n return {\n getPassagesFromElement,\n getPassagesFromItemData,\n injectPassagesStylesInItemData,\n checkAndInjectStylesInItemData\n };\n});\n\n","/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2021 (original work) Open Assessment Technologies SA;\n */\n\ndefine('taoMediaManager/richPassage/injectStylesInItemData',['taoMediaManager/richPassage/helpers'], function (helpers) {\n 'use strict';\n return helpers.checkAndInjectStylesInItemData;\n});\n\n","\ndefine(\"taoMediaManager/loader/injectStylesInItemData.bundle\", function(){});\n"],"mappings":"AAsBA,YACA,gBAIA,CAAAA,YAAA,CAAAC,QAAA,CAAAC,cAAA,eACAC,SAAA,CAAAH,YAAA,CAAAI,YAAA,gBACAC,MAAA,CAAAL,YAAA,CAAAI,YAAA,gBAEAE,cAAA,UAAAA,eAAA,KACA,CAAAC,iBAAA,IACAC,cAAA,CAAAR,YAAA,CAAAI,YAAA,oBACAK,MAAA,CAAAT,YAAA,CAAAI,YAAA,gBACA,IACAG,iBAAA,CAAAG,IAAA,CAAAC,KAAA,CAAAF,MAAA,CACA,OAAAG,GAAA,EACAL,iBAAA,GACA,CACAM,MAAA,CAAAC,OAAA,EAAAN,cAAA,WAAAO,UAAA,EACA,IAAAC,eAAA,UAAAA,gBAAA,EACAH,MAAA,CAAAI,OAAA,GACAJ,MAAA,CAAAI,OAAA,IACAF,UAAA,CAAAG,KAAA,CAAAX,iBAAA,EAEA,EACAN,QAAA,CAAAkB,gBAAA,oBAAAH,eAAA,KACA,aAAAf,QAAA,CAAAmB,UAAA,EACAJ,eAAA,EAEA,EACA,EAGAH,MAAA,CAAAC,OAAA,EAAAX,SAAA,aAGAU,MAAA,CAAAQ,WAAA,GAGAR,MAAA,CAAAS,MAAA,IAOAT,MAAA,CAAAQ,WAAA,UAAAA,YAAAE,OAAA,EACAA,OAAA,CAAAA,OAAA,KACAA,OAAA,CAAAA,OAAA,CAAAC,MAAA,CAAAX,MAAA,CAAAU,OAAA,EACAA,OAAA,CAAAA,OAAA,CAAAE,MAAA,UAAAC,IAAA,CAAAC,KAAA,EACA,OAAA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CpBApH,MAAA"} \ No newline at end of file diff --git a/views/js/loader/taoMediaManager.min.js b/views/js/loader/taoMediaManager.min.js index 1b748cc83..c5d501518 100644 --- a/views/js/loader/taoMediaManager.min.js +++ b/views/js/loader/taoMediaManager.min.js @@ -1,2 +1,2 @@ -define("tpl!taoMediaManager/qtiCreator/tpl/relatedItemsPopup",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+="
  • "+escapeExpression((stack1=depth0&&depth0.label,"function"===typeof stack1?stack1.apply(depth0):stack1))+"
  • ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return(helper=helpers.inUsageMessage)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.inUsageMessage,stack1="function"===typeof helper?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n
      \n",stack1=helpers.each.call(depth0,depth0&&depth0.items,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    \n",(helper=helpers.confirmationMessage)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.confirmationMessage,stack1="function"===typeof helper?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1),buffer})}),define("tpl!taoMediaManager/qtiCreator/tpl/relatedItemsClassPopup",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,functionType="function";return buffer+=""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Warning",options):helperMissing.call(depth0,"__","Warning",options)))+"

    \n"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"You are about to delete the class",options):helperMissing.call(depth0,"__","You are about to delete the class",options)))+" ",(helper=helpers.name)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.name,stack1="function"===typeof helper?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+", "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"which contains assets that are in use elsewhere.",options):helperMissing.call(depth0,"__","which contains assets that are in use elsewhere.",options)))+"\n"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Deleting this class will break the items and the tests that are currently using them.",options):helperMissing.call(depth0,"__","Deleting this class will break the items and the tests that are currently using them.",options)))+"

    \n"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Are you sure you want to delete this class and all of its content?",options):helperMissing.call(depth0,"__","Are you sure you want to delete this class and all of its content?",options))),buffer})}),define("tpl!taoMediaManager/qtiCreator/tpl/forbiddenClassAction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,functionType="function";return buffer+=""+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Forbidden action",options):helperMissing.call(depth0,"__","Forbidden action",options)))+"

    \n"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"The class",options):helperMissing.call(depth0,"__","The class",options)))+" ",(helper=helpers.name)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.name,stack1="function"===typeof helper?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"you are trying to delete is too large and contains too many subclasses.",options):helperMissing.call(depth0,"__","you are trying to delete is too large and contains too many subclasses.",options)))+"
    \n"+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Please delete the subclasses before.",options):helperMissing.call(depth0,"__","Please delete the subclasses before.",options))),buffer})}),define("css!taoMediaManagerCss/media",[],function(){}),define("taoMediaManager/controller/actions",["lodash","jquery","i18n","layout/actions/binder","uri","layout/section","core/request","core/router","core/logger","ui/feedback","ui/dialog/confirm","ui/dialog/alert","util/url","tpl!taoMediaManager/qtiCreator/tpl/relatedItemsPopup","tpl!taoMediaManager/qtiCreator/tpl/relatedItemsClassPopup","tpl!taoMediaManager/qtiCreator/tpl/forbiddenClassAction","css!taoMediaManagerCss/media.css"],function(_,$,__,binder,uri,section,request,router,loggerFactory,feedback,confirmDialog,alertDialog,urlUtil,relatedItemsPopupTpl,relatedItemsClassPopupTpl,forbiddenClassActionTpl){"use strict";function callConfirmModal(actionContext,message,url,data,resolve,reject){confirmDialog(message,()=>accept(actionContext,url,data,resolve,reject),()=>cancel(reject))}function callAlertModal(actionContext,message,reject){alertDialog(message,()=>cancel(reject))}function accept(actionContext,url,data,resolve,reject){return request({url:url,method:"POST",data:data,dataType:"json"}).then(function(response){return response.success&&response.deleted?(feedback().success(response.message||__("Resource deleted")),actionContext.tree&&$(actionContext.tree).trigger("removenode.taotree",[{id:actionContext.uri||actionContext.classUri}]),resolve({uri:actionContext.uri||actionContext.classUri})):void(response.success&&!response.deleted&&($(actionContext.tree).trigger("refresh.taotree"),reject(response.msg||response.message||__("Unable to delete the selected resource because you do not have the required rights to delete part of its content."))),reject(response.msg||response.message||__("Unable to delete the selected resource")))})}function cancel(reject){reject({cancel:!0})}const logger=loggerFactory("taoMediaManager/manageMedia");binder.register("newSharedStimulus",function instanciate(actionContext){const self=this,classUri=uri.decode(actionContext.classUri);return request({url:self.url,data:JSON.stringify({classUri:classUri}),method:"POST"}).then(function(response){return actionContext.tree&&$(actionContext.tree).trigger("addnode.taotree",[{uri:uri.decode(response.data.id),label:response.data.name,parent:uri.decode(actionContext.classUri),cssClass:"node-instance"}]),{uri:uri.decode(response.data.id),label:response.data.name,classUri:uri.decode(actionContext.classUri),type:"instance"}}).catch(err=>{_.isUndefined(err.message)||feedback().error(err.message),logger.error(err)})}),binder.register("sharedStimulusAuthoring",function sharedStimulusAuthoring(actionContext){section.updateContentBlock("").create({id:"authoring",name:__("Authoring"),url:this.url,content:" ",visible:!1}).show();const $panel=$("#panel-authoring");$panel.attr("data-id",actionContext.id),$panel.attr("data-uri",actionContext.uri),router.dispatch(`${this.url}?id=${actionContext.id}`)}),binder.register("deleteSharedStimulus",function remove(actionContext){const self=this;let data={},mediaRelationsData={type:"media"};return"instance"===actionContext.context[0]?mediaRelationsData.sourceId=actionContext.id:mediaRelationsData.classId=actionContext.id,data.uri=uri.decode(actionContext.uri),data.classUri=uri.decode(actionContext.classUri),data.id=actionContext.id,data.signature=actionContext.signature,new Promise(function(resolve,reject){request({url:urlUtil.route("index","ResourceRelations","tao"),data:mediaRelationsData,method:"GET",noToken:!0}).then(function(responseRelated){let message;const haveItemReferences=responseRelated.data.relations,name=$("a.clicked",actionContext.tree).text().trim();"instance"===actionContext.context[0]?0===haveItemReferences.length?message=`${__("Are you sure you want to delete this")} ${name}?`:message=relatedItemsPopupTpl({name,inUsageMessage:__("This \"%s\" is currently used in %d item(s)",name,haveItemReferences.length),confirmationMessage:__("Are you sure you want to delete this \"%s\"?",name),items:haveItemReferences}):"instance"!==actionContext.context[0]&&(0===haveItemReferences.length?message=`${__("Are you sure you want to delete this class and all of its content?")}`:0!==haveItemReferences.length&&(message=relatedItemsClassPopupTpl({name,number:haveItemReferences.length,items:haveItemReferences}))),callConfirmModal(actionContext,message,self.url,data,resolve,reject)}).catch(errorObject=>{let message;"class"===actionContext.context[0]&&999===errorObject.response.code&&(message=forbiddenClassActionTpl()),callAlertModal(actionContext,message,reject)})})})}),define("taoMediaManager/qtiCreator/helper/createDummyItemData",["taoQtiItem/qtiCreator/model/Item"],function(Item){"use strict";const _generateIdentifier=function _generateIdentifier(uri){const pos=uri.lastIndexOf("#");return uri.substr(pos+1)},creatorDummyItemData=function(sharedStimulusData){const newItem=new Item().id(_generateIdentifier(sharedStimulusData.id)).attr("title",sharedStimulusData.name);newItem.data("new",!0),newItem.data("dummy",!0);const itemData=Object.assign({},newItem);return delete itemData.bdy,delete itemData.rootElement,itemData.body=sharedStimulusData.body.body,itemData.qtiClass="assessmentItem",itemData.responseProcessing={attributes:{},qtiClass:"responseProcessing",responseRules:[],serial:`response_${sharedStimulusData.body.serial}`},itemData.response={},sharedStimulusData.body.attributes["xml:lang"]&&(itemData.attributes["xml:lang"]=sharedStimulusData.body.attributes["xml:lang"]),sharedStimulusData.body.attributes.class&&(itemData.attributes.class=sharedStimulusData.body.attributes.class),itemData};return creatorDummyItemData}),define("taoMediaManager/qtiCreator/helper/formatStyles",["jquery"],function($){"use strict";function handleStylesheetLoad(e){const path=e&&e.composedPath&&e.composedPath(),linkTag=path[0];if(linkTag){const stylesheetUrl=linkTag.href.split("&stylesheet="),rdf_styles=stylesheetUrl[0].split("%23").reverse()[0],assets=$(`[data-identifier='${rdf_styles}']`);if(assets.length)return void assets.each((h,asset)=>{const assetClassName=asset.children[0].className.match(/[\w-]*tao-[\w-]*/g)||asset.children[1].className.match(/[\w-]*tao-[\w-]*/g);assetClassName?_formatStyles(linkTag.sheet,assetClassName[0]):_hideStyles(linkTag.sheet)});const stylesheetSerial=linkTag.dataset.serial,passagesItem=$(`div[data-serial*='${stylesheetSerial}']`);if(passagesItem.length)return void passagesItem.each((h,passages)=>{const passageWrapper=$(passages).find(".qti-include > div"),passageItemClassName=passageWrapper[0]&&passageWrapper[0].className&&passageWrapper[0].className.match(/[\w-]*tao-[\w-]*/g);passageItemClassName&&_formatStyles(linkTag.sheet,passageItemClassName[0])});const passagesPreview=$(`[data-href*='${rdf_styles}']`);if(passagesPreview.length)return void passagesPreview.each((h,passages)=>{const passagePreviewClassName=passages.className.match(/[\w-]*tao-[\w-]*/g);passagePreviewClassName&&_formatStyles(linkTag.sheet,passagePreviewClassName[0])})}}function _hideStyles(linkTag){const{cssRules}=linkTag||{},CSSStyleSheet=linkTag||{};cssRules&&Object.values(cssRules).map((index,rule)=>{CSSStyleSheet.deleteRule(index)})}function _formatStyles(linkTag,className){const{cssRules}=linkTag||{},CSSStyleSheet=linkTag||{},classNameFormated=className&&className.length?`.${className}`:"",scopedCssRules=_scopeStyles(cssRules,classNameFormated,["body","html","div.qti-item"]);if(cssRules&&scopedCssRules){Object.values(cssRules).map((index,rule)=>{CSSStyleSheet.deleteRule(index)});const newRules=scopedCssRules.split("\n");Object.values(newRules).map(rule=>{CSSStyleSheet.insertRule(rule)})}}function _scopeStyles(cssRules,scopeSelector,toReplace,replacementSelector){if(!cssRules)return"";replacementSelector||(replacementSelector=scopeSelector);const scopedStyles=Object.values(cssRules).map(rule=>{if(!rule.selectorText)return"";const rulesInBrackets=rule.cssText.substr(rule.selectorText.length).trim(),selectors=rule.selectorText.split(/\s*,\s*/),scopedSelectors=[];for(let singleSelectorText of selectors){if(["html","body","div.qti-item"].includes(singleSelectorText))continue;let numRepeat=0;if(scopeSelector&&toReplace)for(let toReplaceSelector of toReplace)singleSelectorText.includes(toReplaceSelector)&&(00{let loader,itemData;itemData=creatorDummyItemData(values[1]),values[2].children.length&&values[2].children.forEach((stylesheet,index)=>{if("tao-user-styles.css"!==stylesheet.name){const serial=`creator_${index}`,link=urlUtil.route("loadStylesheet","SharedStimulusStyling","taoMediaManager",{uri:config.id,stylesheet:stylesheet.name});itemData.stylesheets[serial]={qtiClass:"stylesheet",attributes:{href:link,media:"all",title:stylesheet.name,type:"text/css",onload:e=>formatStyles.handleStylesheetLoad(e)},serial,getComposingElements:()=>({})}}}),loader=new Loader().setClassesLocation(qtiClasses),loader.loadItemData(itemData,function(loadedItem){let namespaces;namespaces=loadedItem.getNamespaces(),namespaces[""]=qtiNamespace,loadedItem.setNamespaces(namespaces),loadedItem.setSchemaLocations(qtiSchemaLocation),languagesList&&loadedItem.data("languagesList",values[0]),callback(loadedItem,this.getLoadedClasses())})})}}};return creatorLoader}),define("taoMediaManager/qtiCreator/renderers/config",["lodash","taoQtiItem/qtiCommonRenderer/renderers/config","taoItems/assets/manager","taoItems/assets/strategies"],function(_,commonRenderConfig,assetManagerFactory,assetStrategies){"use strict";const assetManager=assetManagerFactory([assetStrategies.taomedia,assetStrategies.external,assetStrategies.base64,assetStrategies.baseUrl],{baseUrl:""}),locations=_.defaults({_container:"taoQtiItem/qtiCreator/renderers/Container",_tooltip:"taoQtiItem/qtiCreator/renderers/Tooltip",assessmentItem:"taoMediaManager/qtiCreator/renderers/Item",figure:"taoMediaManager/qtiCreator/renderers/Figure",img:"taoMediaManager/qtiCreator/renderers/Img",figcaption:"taoMediaManager/qtiCreator/renderers/Figcaption",math:"taoQtiItem/qtiCreator/renderers/Math",object:"taoMediaManager/qtiCreator/renderers/Object",table:"taoMediaManager/qtiCreator/renderers/Table"},commonRenderConfig.locations);return{name:"creatorRenderer",locations:locations,options:{assetManager:assetManager}}}),define("taoMediaManager/qtiCreator/renderers/Renderer",["taoQtiItem/qtiRunner/core/Renderer","taoMediaManager/qtiCreator/renderers/config"],function(Renderer,config){"use strict";return Renderer.build(config.locations,config.name,config.options)}),define("taoMediaManager/qtiCreator/helper/creatorRenderer",["jquery","lodash","taoMediaManager/qtiCreator/renderers/Renderer","taoItems/assets/manager","taoItems/assets/strategies","util/dom"],function($,_,Renderer,assetManagerFactory,assetStrategies,dom){"use strict";let creatorRenderer=null;const get=function(reset,config,areaBroker){let $bodyEltForm;return config=config||{},config.properties=config.properties||{},(!creatorRenderer||reset)&&($bodyEltForm=creatorRenderer?creatorRenderer.getOption("bodyElementOptionForm"):null,(reset||!$bodyEltForm||!$bodyEltForm.length||!dom.contains($bodyEltForm))&&(creatorRenderer=new Renderer({lang:"",uri:"",shuffleChoices:!1,itemOptionForm:$("#item-editor-item-property-bar #sidebar-right-passage-properties .panel"),bodyElementOptionForm:areaBroker.getElementPropertyPanelArea(),textOptionForm:$("#item-editor-text-property-bar #sidebar-right-text-block-properties .panel"),mediaManager:{appendContainer:"#mediaManager",browseUrl:config.properties.getFilesUrl,uploadUrl:config.properties.fileUploadUrl,deleteUrl:config.properties.fileDeleteUrl,downloadUrl:config.properties.fileDownloadUrl,fileExistsUrl:config.properties.fileExistsUrl,path:config.properties.path,root:config.properties.root},qtiCreatorContext:config.qtiCreatorContext,locations:config.properties.locations}),creatorRenderer.getAssetManager().setData({baseUrl:config.properties.baseUrl||""}),creatorRenderer.setAreaBroker(areaBroker),_.assign(creatorRenderer,{getCreatorContext:function getCreatorContext(){return this.getOption("qtiCreatorContext")}}))),creatorRenderer};return{get:get,setOption:function(name,value){return get().setOption(name,value)},setOptions:function(options){return get().setOptions(options)},load:function(qtiClasses,done){return get().load(function(){if(_.isFunction(done)){for(var _len=arguments.length,rest=Array(_len),_key=0;_key<_len;_key++)rest[_key]=arguments[_key];done.apply(this,rest)}},qtiClasses)}}}),define("tpl!taoMediaManager/qtiCreator/tpl/toolbars/cssToggler",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression;return buffer+="
  • \n \n ",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===typeof helper?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n \n \n \n
  • ",buffer})}),define("taoMediaManager/qtiCreator/editor/styleEditor/styleEditor",["jquery","lodash","i18n","util/urlParser","core/dataProvider/request","tpl!taoMediaManager/qtiCreator/tpl/toolbars/cssToggler","taoMediaManager/qtiCreator/helper/formatStyles","util/url","services/features","jquery.fileDownload"],function($,_,__,UrlParser,request,cssTpl,formatStyles,urlUtil,featuresService){"use strict";const styleSheetManagerVisibilityKey="taoMediaManager/creator/StyleSheetManager";let itemConfig,globalConfig;const _getUri=function(action){return globalConfig[`${action}CssUrl`]},_basename=function(path){return path.substring(path.lastIndexOf("/")+1)},mainClassSelector="mainClass",hashClassSelector="hashClass",taoHashClassPrefix="tao-";let currentItem,hashClass="",mainClass="",style={},customStylesheet="";const $styleElem=function(){let styleElem=$("#item-editor-user-styles");return styleElem.length?styleElem.empty():(styleElem=$("