1 line
25 KiB
Plaintext
1 line
25 KiB
Plaintext
{"version":3,"sources":["../../taoBackOfficeCss/list!css","../controller/list/index.js","../controller/routes.js","../treeRender.js","../controller/tree/view.js","onLayerEnd0.js","module-create.js"],"names":[],"mappings":"AACA,MAAA,CAAA,2BAAA,CAAA,EAAA,CAAA,UAAA,CAAA,CAAA,C,CCgBA,MAAA,CAAA,qCAAA,CAAA,CACA,QADA,CAEA,MAFA,CAGA,KAHA,CAIA,UAJA,CAKA,aALA,CAMA,mBANA,CAOA,gBAPA,CAQA,2BARA,CAAA,CASA,SAAA,CAAA,CAAA,EAAA,CAAA,GAAA,CAAA,OAAA,CAAA,QAAA,CAAA,aAAA,CAAA,OAAA,CAAA,CACA,aAEA,QAAA,CAAA,iBAAA,CAAA,GAAA,CAAA,CACA,MAAA,CAAA,CAAA,sBAAA,GAAA,EACA,CAEA,QAAA,CAAA,QAAA,CAAA,KAAA,CAAA,CACA,MAAA,CAAA,KAAA,CAAA,OAAA,CAAA,uBAAA,CAAA,EAAA,CACA,CAEA,QAAA,CAAA,qBAAA,CAAA,EAAA,CAAA,IACA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,CAAA,CACA,IADA,CACA,MADA,CACA,UADA,EAEA,IAFA,CAEA,IAFA,CAEA,EAFA,EAGA,MAHA,CAGA,6BAHA,CADA,CAMA,MAAA,CAAA,CAAA,CAAA,SAAA,CAAA,CACA,IADA,CACA,KADA,CACA,EADA,EAEA,IAFA,CAEA,EAAA,CAAA,UAAA,CAFA,CANA,CAUA,MAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CACA,QADA,CACA,cADA,EAEA,MAFA,CAEA,SAFA,CAEA,MAFA,CAGA,CAEA,QAAA,CAAA,YAAA,CAAA,KAAA,CAAA,IAAA,CAAA,YAAA,CAAA,IAAA,CAAA,QAAA,wDAAA,KAAA,CACA,IAAA,CAAA,CAAA,CAAA,UAAA,CAAA,CACA,+BAAA,QAAA,kBAAA,IAAA,CADA,CAEA,KAAA,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AAA,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAA,UAAA,CAAA,CAAA,CAAA,oBAAA,CAAA,MAAA,EAAA,CAAA,cAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,CAAA,WAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,cAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACA,osCADA,C,CCAA,MAAA,CAAA,2CAAA,CAAA,UAAA,CAAA,CAAA,C","sourcesContent":["\ndefine('css!taoBackOfficeCss/list',[],function(){});\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) 2019 (original work) Open Assessment Technologies SA;\n */\ndefine('taoBackOffice/controller/list/index',[\n 'jquery',\n 'i18n',\n 'uri',\n 'util/url',\n 'ui/feedback',\n 'ui/dialog/confirm',\n 'layout/section',\n 'css!taoBackOfficeCss/list'\n], function ($, __, Uri, urlUtil, feedback, dialogConfirm, section) {\n 'use strict';\n\n function findListContainer(uri) {\n return $(`#list-data_${uri}`);\n }\n\n function clearUri(value) {\n return value.replace(/^list-element_[0-9]+_/, '');\n }\n\n function createEditUriCheckbox(id) {\n const $checkbox = $('<input>')\n .attr('type', 'checkbox')\n .attr('id', id)\n .change(handleEditCheckboxStateChange);\n\n const $label = $('<label>')\n .attr('for', id)\n .text(__('Edit URI'));\n\n return $('<span>')\n .addClass('lft edit-uri')\n .append($checkbox, $label);\n }\n\n function addSquareBtn(title, icon, $listToolBar, position='rgt') {\n const $btn = $('<button>', {\n 'class': `btn-info small ${position} icon-${icon}`,\n title: __(title) }\n );\n $listToolBar.append($btn);\n\n return $btn;\n }\n\n function transformListElement($element) {\n return createListElement($element.attr('id'), $element.text());\n }\n\n function createNewListElement(elementId) {\n return createListElement(`list-element_${elementId}_`);\n }\n\n function createListElement(name, value = '') {\n return $(`<div class='list-element'>\n <div class='list-element'>\n <div class='list-element__input-container'>\n <input type='text' name='${name}' value='${value}' />\n <div class='list-element__input-container__uri'>\n <label for='uri_${name}' class='title'>URI</label>\n <input id='uri_${name}' type='text' name='uri_${name}' value='${Uri.decode(clearUri(name))}'>\n </div>\n </div>\n <span class='icon-checkbox-crossed list-element-delete-btn'>\n </div>\n </div>`);\n }\n\n function handleEditCheckboxStateChange() {\n findListContainer($(this).attr('id')).toggleClass('with-uri');\n }\n\n return {\n\n /**\n * The list controller entrypoint\n */\n start() {\n\n const saveUrl = urlUtil.route('saveLists', 'Lists', 'taoBackOffice');\n const delListUrl = urlUtil.route('removeList', 'Lists', 'taoBackOffice');\n const reloadListUrl = urlUtil.route('reloadRemoteList', 'Lists', 'taoBackOffice');\n const delEltUrl = urlUtil.route('removeListElement', 'Lists', 'taoBackOffice');\n\n $('.list-edit-btn').click(function () {\n const uri = $(this).data('uri');\n const $listContainer = findListContainer(uri);\n\n let $listForm = $listContainer.find('form');\n const $listTitleBar = $listContainer.find('.container-title h6');\n const $listToolBar = $listContainer.find('.data-container-footer').empty();\n let $listSaveBtn;\n let $listNewBtn;\n\n if (!$listForm.length) {\n let nextElementId;\n\n $listForm = $('<form>');\n $listContainer.wrapInner($listForm);\n $listContainer.find('form').append(`<input type='hidden' name='uri' value='${uri}' />`);\n\n const $labelEdit = $(`<input type='text' name='label' value=''/>`).val($listTitleBar.text());\n $listTitleBar.closest('.container-title').html($labelEdit);\n\n nextElementId = $listContainer.find('.list-element')\n .replaceWith(function () {\n return transformListElement($(this));\n })\n .length;\n\n $listSaveBtn = addSquareBtn(__('Save list'), 'save', $listToolBar);\n $listSaveBtn.on('click', function () {\n $.postJson(\n saveUrl,\n $(this).closest('form').serializeArray(),\n response => {\n if (response.saved) {\n feedback().success(__('List saved'));\n section.get('taoBo_list').loadContentBlock(urlUtil.route('index', 'Lists', 'taoBackOffice'));\n } else {\n const errors = (response.errors || []).length\n ? `<ul><li>${response.errors.join('</li><li>')}</li></ul>`\n : '';\n\n feedback().error(\n `${__('List not saved')}${errors}`,\n {encodeHtml: false}\n );\n }\n }\n );\n return false;\n });\n\n $listNewBtn = addSquareBtn('New element', 'add', $listToolBar);\n $listNewBtn.click(function () {\n const $list = $(this).closest('form').find('ol');\n\n $list.append($('<li>').append(createNewListElement(nextElementId++)))\n .closest('.container-content').scrollTop($list.height());\n\n return false;\n });\n\n $listToolBar.append(createEditUriCheckbox(uri));\n\n $listToolBar.append();\n }\n\n $listContainer.on('click', '.list-element-delete-btn', function () {\n const $element = $(this).closest('li');\n const $input = $element.find('input:text');\n const eltUri = clearUri($input.attr('name'));\n\n const deleteLocalElement = () => {\n $element.remove();\n feedback().success(__('Element deleted'));\n };\n\n const deleteServerAndLocalElement = () => {\n $.postJson(\n delEltUrl,\n { uri : eltUri },\n response => {\n if (response.deleted) {\n deleteLocalElement();\n } else {\n feedback().error(__('Element not deleted'));\n }\n }\n );\n };\n\n const deleteElement = () => {\n if (eltUri) {\n deleteServerAndLocalElement();\n } else {\n deleteLocalElement();\n }\n };\n\n if ($input.val() === '') {\n deleteElement();\n } else {\n dialogConfirm(\n __('Please confirm you want to delete this list element.'),\n deleteElement\n );\n }\n });\n });\n\n $('.list-delete-btn').click(function () {\n const $btn = $(this);\n dialogConfirm(\n __('Please confirm you want to delete this list. This operation cannot be undone.'),\n function accept() {\n const uri = $btn.data('uri');\n const $list = $btn.parents('.data-container');\n $.postJson(\n delListUrl,\n { uri },\n response => {\n if (response.deleted) {\n feedback().success(__('List deleted'));\n $list.remove();\n } else {\n feedback().error(__('List not deleted'));\n }\n }\n );\n }\n );\n });\n\n $('.list-reload-btn').click(function () {\n const uri = $(this).data('uri');\n\n $.postJson(\n reloadListUrl,\n { uri },\n response => {\n if (response.saved) {\n feedback().success(__('List reloaded'));\n section.get('taoBo_remotelist').loadContentBlock(urlUtil.route('remote', 'Lists', 'taoBackOffice'));\n } else {\n feedback().error(__('List failed to be reloaded'));\n }\n }\n );\n });\n }\n };\n});\n\n","define('taoBackOffice/controller/routes',[],function () {\n 'use strict';\n\n return {\n 'Lists' : {\n 'actions' : {\n 'index' : 'controller/list/index',\n 'remote' : 'controller/list/index'\n }\n },\n 'Trees': {\n 'actions': {\n 'viewTree': 'controller/tree/view'\n }\n }\n };\n});\n\n","define('taoBackOffice/treeRender',[\n 'jquery',\n 'lodash',\n 'taoBackOffice/lib/vis/vis',\n 'css!taoBackOffice/lib/vis/vis'\n], function ($, _, vis) {\n 'use strict';\n\n var network = null;\n var treeContainer = null;\n var settings = null;\n var data = null;\n\n /**\n * @private\n */\n function destroy() {\n if (network !== null) {\n network.destroy();\n network = null;\n }\n }\n\n var treeRender = {\n\n /**\n *\n * @param {Element} container\n * @param {Object} [treeData]\n * @param {Object} [options]\n */\n init: function (container, treeData, options) {\n\n if (!container instanceof Element) {\n throw new TypeError(\"tree container must be specified\");\n }\n\n treeContainer = container;\n options = options || {};\n treeData = treeData || {nodes: [], edges: []};\n\n\n settings = {\n layout: {\n hierarchical: {\n sortMethod: 'directed',\n \"levelSeparation\": 200\n }\n },\n nodes: {\n shape: 'box',\n \"color\": {\n \"border\": \"#222\",\n \"background\": \"#f2f0ee\",\n\n \"highlight\": {\n \"border\": \"#222\",\n \"background\": \"#f2f0ee\"\n }\n },\n\n \"font\": {\n \"face\": \"'Franklin Gothic', 'Franklin Gothic Medium', 'Source Sans Pro', sans-serif\",\n \"color\": \"#222\"\n }\n\n },\n edges: {\n smooth: false,\n width: 0.2,\n color: {\n color: \"#222\"\n },\n arrows: {to: true},\n \"physics\": false,\n \"scaling\": {\n \"label\": false\n }\n }\n };\n\n $.extend(settings, options);\n\n // create a network\n data = {\n nodes: treeData.nodes ? treeData.nodes : [],\n edges: treeData.edges ? treeData.edges : []\n };\n\n },\n\n run: function () {\n destroy();\n\n network = new vis.Network(treeContainer, data, settings);\n\n network.once('initRedraw', function () {\n\n if (data.nodes.length > 100) {\n network.setOptions($.extend(settings, {\n physics: {\n hierarchicalRepulsion: {\n nodeDistance: 200\n },\n stabilization: {\n fit: false\n }\n }\n }));\n\n network.fit({\n nodes: [data.nodes[0].id, data.nodes[1].id], animation: {\n duration: 400,\n easingFunction: 'linear'\n }\n });\n }\n\n });\n }\n };\n\n return treeRender;\n});\n\n","define('taoBackOffice/controller/tree/view',[\n 'layout/actions/binder',\n 'uri',\n 'jquery',\n 'context',\n 'helpers',\n 'taoBackOffice/treeRender'\n], function (binder, uri, $, context, helpers, treeRender) {\n 'use strict';\n\n /**\n *\n * @type {{start: Function}}\n */\n var itemRunnerController = {\n\n //the controller initialization\n start: function () {\n \t\n \t$('.tree-container').each(function(i, obj) {\n \t\tvar $container = $(obj);\n var uri = $container.data('id');\n\n $.post(helpers._url('getTree', 'Trees', 'taoBackOffice'), {uri: uri}, function (treeData) {\n\n var $parent = $container.closest('.content-block');\n\n var resizeContainer = function () {\n $container.height($parent.height() - $parent.find('.panel').eq(0).outerHeight());\n $container.width($parent.width());\n };\n\n $(window).on('resize', resizeContainer);\n\n resizeContainer();\n treeRender.init($container[0], treeData);\n treeRender.run();\n\n });\n \t});\n }\n };\n\n // the controller is exposed\n return itemRunnerController;\n});\n","\n(function(c){var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[i]?s[i].cssText=c:s[a](d.createTextNode(c));})\n('.list-container .container-content .list-element{display:flex;width:100%}.list-container .container-content .list-element-delete-btn{font-size:2em;cursor:pointer;margin-left:4px}.list-container .container-content .list-element__input-container{flex:1}.list-container .container-content .list-element__input-container__uri{display:none;align-items:center;margin-top:2px;margin-bottom:10px;background:#e1e2e3}.list-container .container-content .list-element .title{color:#222;border:1px #ccc solid;border-top-left-radius:2px;border-bottom-left-radius:2px;margin:0;padding:3px}.list-container .container-content .list-element .title ~ input{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none}.list-container .container-content .list-element input{width:100%}.list-container .edit-uri{display:flex;color:initial;font-family:\\\"Source Sans Pro\\\",sans-serif}.section-container .content-block .data-container-wrapper .list-container form{background-color:#f3f1ef}.section-container .content-block .data-container-wrapper .list-container form .data-container-footer{border-top:0 !important}.with-uri .container-content .list-element__input-container__uri{display:flex}\\n\\n/*# sourceMappingURL=../../../taoBackOffice/views/css/list.css.map */');\n","\ndefine(\"taoBackOffice/loader/taoBackOffice.bundle\", function(){});\n"]} |