From 191448afc5fd01ada62fd90c8f71bdafd3d2f936 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 13 Aug 2020 19:04:51 +0200 Subject: [PATCH] MDL-68975 contentbank: add author field to file details view --- contentbank/amd/build/selectors.min.js | 2 +- contentbank/amd/build/selectors.min.js.map | 2 +- contentbank/amd/build/sort.min.js | 2 +- contentbank/amd/build/sort.min.js.map | 2 +- contentbank/amd/src/selectors.js | 3 +- contentbank/amd/src/sort.js | 11 ++++-- contentbank/classes/output/bankcontent.php | 4 ++- contentbank/templates/bankcontent.mustache | 21 +++++++++-- contentbank/tests/behat/sort_content.feature | 37 +++++++++++++++----- theme/boost/scss/moodle/contentbank.scss | 14 ++++---- theme/boost/style/moodle.css | 14 ++++---- theme/classic/style/moodle.css | 14 ++++---- 12 files changed, 89 insertions(+), 37 deletions(-) diff --git a/contentbank/amd/build/selectors.min.js b/contentbank/amd/build/selectors.min.js index 35b476aa378..26786ecc15c 100644 --- a/contentbank/amd/build/selectors.min.js +++ b/contentbank/amd/build/selectors.min.js @@ -1,2 +1,2 @@ -define ("core_contentbank/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={regions:{cbcontentname:b("region","cb-content-name"),contentbank:b("region","contentbank"),filearea:b("region","filearea")},actions:{search:b("action","searchcontent"),clearSearch:b("action","clearsearchcontent"),viewgrid:b("action","viewgrid"),viewlist:b("action","viewlist"),sortname:b("action","sortname"),sortdate:b("action","sortdate"),sortsize:b("action","sortsize"),sorttype:b("action","sorttype")},elements:{listitem:".cb-listitem",cbnavbarbreadcrumb:".cb-navbar-breadbrumb",cbnavbartotalsearch:".cb-navbar-totalsearch",clearsearch:".input-group-append .clear-icon",searchicon:".input-group-append .search-icon",searchinput:"#searchinput",sortbutton:".cb-btnsort"}};a.default=c;return a.default}); +define ("core_contentbank/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={regions:{cbcontentname:b("region","cb-content-name"),contentbank:b("region","contentbank"),filearea:b("region","filearea")},actions:{search:b("action","searchcontent"),clearSearch:b("action","clearsearchcontent"),viewgrid:b("action","viewgrid"),viewlist:b("action","viewlist"),sortname:b("action","sortname"),sortdate:b("action","sortdate"),sortsize:b("action","sortsize"),sorttype:b("action","sorttype"),sortauthor:b("action","sortauthor")},elements:{listitem:".cb-listitem",cbnavbarbreadcrumb:".cb-navbar-breadbrumb",cbnavbartotalsearch:".cb-navbar-totalsearch",clearsearch:".input-group-append .clear-icon",searchicon:".input-group-append .search-icon",searchinput:"#searchinput",sortbutton:".cb-btnsort"}};a.default=c;return a.default}); //# sourceMappingURL=selectors.min.js.map diff --git a/contentbank/amd/build/selectors.min.js.map b/contentbank/amd/build/selectors.min.js.map index 36d959f5167..2efa6a5ed18 100644 --- a/contentbank/amd/build/selectors.min.js.map +++ b/contentbank/amd/build/selectors.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","clearsearch","searchicon","searchinput","sortbutton"],"mappings":"+IAgCMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,oBAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CANE,CAgBXgB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,iCAJP,CAKNC,UAAU,CAAE,kCALN,CAMNC,WAAW,CAAE,cANP,CAONC,UAAU,CAAE,aAPN,CAhBC,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle 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 Moodle. If not, see .\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @package core_contentbank\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearchcontent'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype')\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n clearsearch: '.input-group-append .clear-icon',\n searchicon: '.input-group-append .search-icon',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","sortauthor","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","clearsearch","searchicon","searchinput","sortbutton"],"mappings":"+IAgCMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,oBAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CASLgB,UAAU,CAAEhB,CAAe,CAAC,QAAD,CAAW,YAAX,CATtB,CANE,CAiBXiB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,iCAJP,CAKNC,UAAU,CAAE,kCALN,CAMNC,WAAW,CAAE,cANP,CAONC,UAAU,CAAE,aAPN,CAjBC,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle 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 Moodle. If not, see .\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @package core_contentbank\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearchcontent'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype'),\n sortauthor: getDataSelector('action', 'sortauthor'),\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n clearsearch: '.input-group-append .clear-icon',\n searchicon: '.input-group-append .search-icon',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"} \ No newline at end of file diff --git a/contentbank/amd/build/sort.min.js b/contentbank/amd/build/sort.min.js index d8222cab695..2fd33174901 100644 --- a/contentbank/amd/build/sort.min.js +++ b/contentbank/amd/build/sort.min.js @@ -1,2 +1,2 @@ -define ("core_contentbank/sort",["exports","./selectors","core/str","core/prefetch","core/ajax","core/notification"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=g(b);d=g(d);e=g(e);f=g(f);function g(a){return a&&a.__esModule?a:{default:a}}var h=function(){var a=document.querySelector(b.default.regions.contentbank);d.default.prefetchStrings("contentbank",["contentname","lastmodified","size","type"]);d.default.prefetchStrings("moodle",["sortbyx","sortbyxreverse"]);i(a)};a.init=h;var i=function(a){var c=document.querySelector(b.default.regions.filearea),d=c.querySelectorAll(b.default.elements.listitem),e=a.querySelector(b.default.actions.viewgrid),f=a.querySelector(b.default.actions.viewlist);e.addEventListener("click",function(){a.classList.remove("view-list");a.classList.add("view-grid");e.classList.add("active");f.classList.remove("active");j(!1)});f.addEventListener("click",function(){a.classList.remove("view-grid");a.classList.add("view-list");f.classList.add("active");e.classList.remove("active");j(!0)});var g=a.querySelector(b.default.actions.sortname);g.addEventListener("click",function(){var b=k(a,g);m(c,d,"data-file",b)});var h=a.querySelector(b.default.actions.sortdate);h.addEventListener("click",function(){var b=k(a,h);m(c,d,"data-timemodified",b)});var i=a.querySelector(b.default.actions.sortsize);i.addEventListener("click",function(){var b=k(a,i);m(c,d,"data-bytes",b)});var l=a.querySelector(b.default.actions.sorttype);l.addEventListener("click",function(){var b=k(a,l);m(c,d,"data-type",b)})},j=function(a){if(!1===a){a=null}var b={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"core_contentbank_view_list",value:a}]}};return e.default.call([b])[0].catch(f.default.exception)},k=function(a,c){var d=a.querySelectorAll(b.default.elements.sortbutton);d.forEach(function(a){if(a!==c){a.classList.remove("dir-asc");a.classList.remove("dir-desc");a.classList.add("dir-none");l(a,!1)}});var e=!0;if(c.classList.contains("dir-none")){c.classList.remove("dir-none");c.classList.add("dir-asc")}else if(c.classList.contains("dir-asc")){c.classList.remove("dir-asc");c.classList.add("dir-desc");e=!1}else if(c.classList.contains("dir-desc")){c.classList.remove("dir-desc");c.classList.add("dir-asc")}l(c,e);return e},l=function(a,b){var d=b?"sortbyxreverse":"sortbyx";return(0,c.get_string)(a.dataset.string,"contentbank").then(function(a){return(0,c.get_string)(d,"core",a)}).then(function(b){a.setAttribute("title",b);return b}).catch()},m=function(a,b,c,d){var e=[].slice.call(b).sort(function(e,a){var b=e.getAttribute(c),f=a.getAttribute(c);if(!isNaN(b)){b=parseInt(b);f=parseInt(f)}if(d){return b>f?1:-1}else{return bf?1:-1}else{return b.\n\n/**\n * Content bank UI actions.\n *\n * @module core_contentbank/sort\n * @package core_contentbank\n * @copyright 2020 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport selectors from './selectors';\nimport {get_string as getString} from 'core/str';\nimport Prefetch from 'core/prefetch';\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set up the contentbank views.\n *\n * @method init\n */\nexport const init = () => {\n const contentBank = document.querySelector(selectors.regions.contentbank);\n Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type']);\n Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']);\n registerListenerEvents(contentBank);\n};\n\n/**\n * Register contentbank related event listeners.\n *\n * @method registerListenerEvents\n * @param {HTMLElement} contentBank The DOM node of the content bank\n */\nconst registerListenerEvents = (contentBank) => {\n\n // The search.\n const fileArea = document.querySelector(selectors.regions.filearea);\n const shownItems = fileArea.querySelectorAll(selectors.elements.listitem);\n\n // The view buttons.\n const viewGrid = contentBank.querySelector(selectors.actions.viewgrid);\n const viewList = contentBank.querySelector(selectors.actions.viewlist);\n\n viewGrid.addEventListener('click', () => {\n contentBank.classList.remove('view-list');\n contentBank.classList.add('view-grid');\n viewGrid.classList.add('active');\n viewList.classList.remove('active');\n setViewListPreference(false);\n });\n\n viewList.addEventListener('click', () => {\n contentBank.classList.remove('view-grid');\n contentBank.classList.add('view-list');\n viewList.classList.add('active');\n viewGrid.classList.remove('active');\n setViewListPreference(true);\n });\n\n // Sort by file name alphabetical\n const sortByName = contentBank.querySelector(selectors.actions.sortname);\n sortByName.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByName);\n updateSortOrder(fileArea, shownItems, 'data-file', ascending);\n });\n\n // Sort by date.\n const sortByDate = contentBank.querySelector(selectors.actions.sortdate);\n sortByDate.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByDate);\n updateSortOrder(fileArea, shownItems, 'data-timemodified', ascending);\n });\n\n // Sort by size.\n const sortBySize = contentBank.querySelector(selectors.actions.sortsize);\n sortBySize.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortBySize);\n updateSortOrder(fileArea, shownItems, 'data-bytes', ascending);\n });\n\n // Sort by type\n const sortByType = contentBank.querySelector(selectors.actions.sorttype);\n sortByType.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByType);\n updateSortOrder(fileArea, shownItems, 'data-type', ascending);\n });\n};\n\n\n/**\n * Set the contentbank user preference in list view\n *\n * @param {Bool} viewList view ContentBank as list.\n * @return {Promise} Repository promise.\n */\nconst setViewListPreference = function(viewList) {\n\n // If the given status is not hidden, the preference has to be deleted with a null value.\n if (viewList === false) {\n viewList = null;\n }\n\n const request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: 'core_contentbank_view_list',\n value: viewList\n }\n ]\n }\n };\n\n return Ajax.call([request])[0].catch(Notification.exception);\n};\n\n/**\n * Update the sort button view.\n *\n * @method updateSortButtons\n * @param {HTMLElement} contentBank The DOM node of the contentbank button\n * @param {HTMLElement} sortButton The DOM node of the sort button\n * @return {Bool} sort ascending\n */\nconst updateSortButtons = (contentBank, sortButton) => {\n const sortButtons = contentBank.querySelectorAll(selectors.elements.sortbutton);\n\n sortButtons.forEach((button) => {\n if (button !== sortButton) {\n button.classList.remove('dir-asc');\n button.classList.remove('dir-desc');\n button.classList.add('dir-none');\n\n updateButtonTitle(button, false);\n }\n });\n\n let ascending = true;\n\n if (sortButton.classList.contains('dir-none')) {\n sortButton.classList.remove('dir-none');\n sortButton.classList.add('dir-asc');\n } else if (sortButton.classList.contains('dir-asc')) {\n sortButton.classList.remove('dir-asc');\n sortButton.classList.add('dir-desc');\n ascending = false;\n } else if (sortButton.classList.contains('dir-desc')) {\n sortButton.classList.remove('dir-desc');\n sortButton.classList.add('dir-asc');\n }\n\n updateButtonTitle(sortButton, ascending);\n\n return ascending;\n};\n\n/**\n * Update the button title.\n *\n * @method updateButtonTitle\n * @param {HTMLElement} button Button to update\n * @param {Bool} ascending Sort direction\n * @return {Promise} string promise\n */\nconst updateButtonTitle = (button, ascending) => {\n\n const sortString = (ascending ? 'sortbyxreverse' : 'sortbyx');\n\n return getString(button.dataset.string, 'contentbank')\n .then(columnName => {\n return getString(sortString, 'core', columnName);\n })\n .then(sortByString => {\n button.setAttribute('title', sortByString);\n return sortByString;\n })\n .catch();\n};\n\n/**\n * Update the sort order of the itemlist and update the DOM\n *\n * @method updateSortOrder\n * @param {HTMLElement} fileArea the Dom container for the itemlist\n * @param {Array} itemList Nodelist of Dom elements\n * @param {String} attribute, the attribut to sort on\n * @param {Bool} ascending, Sort Ascending\n */\nconst updateSortOrder = (fileArea, itemList, attribute, ascending) => {\n const sortList = [].slice.call(itemList).sort(function(a, b) {\n\n let aa = a.getAttribute(attribute);\n let bb = b.getAttribute(attribute);\n if (!isNaN(aa)) {\n aa = parseInt(aa);\n bb = parseInt(bb);\n }\n\n if (ascending) {\n return aa > bb ? 1 : -1;\n } else {\n return aa < bb ? 1 : -1;\n }\n });\n sortList.forEach(listItem => fileArea.appendChild(listItem));\n};\n"],"file":"sort.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/sort.js"],"names":["init","contentBank","document","querySelector","selectors","regions","contentbank","Prefetch","prefetchStrings","registerListenerEvents","fileArea","filearea","shownItems","querySelectorAll","elements","listitem","viewGrid","actions","viewgrid","viewList","viewlist","addEventListener","classList","remove","add","setViewListPreference","sortByName","sortname","ascending","updateSortButtons","updateSortOrder","sortByDate","sortdate","sortBySize","sortsize","sortByType","sorttype","sortByAuthor","sortauthor","request","methodname","args","preferences","type","value","Ajax","call","catch","Notification","exception","sortButton","sortButtons","sortbutton","forEach","button","updateButtonTitle","contains","sortString","dataset","string","then","columnName","sortByString","setAttribute","itemList","attribute","sortList","slice","sort","a","b","aa","getAttribute","bb","isNaN","parseInt","listItem","appendChild"],"mappings":"uNAwBA,OAEA,OACA,OACA,O,mDAOO,GAAMA,CAAAA,CAAI,CAAG,UAAM,CACtB,GAAMC,CAAAA,CAAW,CAAGC,QAAQ,CAACC,aAAT,CAAuBC,UAAUC,OAAV,CAAkBC,WAAzC,CAApB,CACAC,UAASC,eAAT,CAAyB,aAAzB,CAAwC,CAAC,aAAD,CAAgB,cAAhB,CAAgC,MAAhC,CAAwC,MAAxC,CAAgD,QAAhD,CAAxC,EACAD,UAASC,eAAT,CAAyB,QAAzB,CAA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CAAeP,CAAf,CAFgD,CAGrDQ,CAAE,CAAGH,CAAC,CAACE,YAAF,CAAeP,CAAf,CAHgD,CAIzD,GAAI,CAACS,KAAK,CAACH,CAAD,CAAV,CAAgB,CACbA,CAAE,CAAGI,QAAQ,CAACJ,CAAD,CAAb,CACAE,CAAE,CAAGE,QAAQ,CAACF,CAAD,CACf,CAED,GAAI7C,CAAJ,CAAe,CACX,MAAO2C,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CAFD,IAEO,CACH,MAAOF,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CACJ,CAdgB,CAAjB,CAeAP,CAAQ,CAACb,OAAT,CAAiB,SAAAuB,CAAQ,QAAIlE,CAAAA,CAAQ,CAACmE,WAAT,CAAqBD,CAArB,CAAJ,CAAzB,CACH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle 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 Moodle. If not, see .\n\n/**\n * Content bank UI actions.\n *\n * @module core_contentbank/sort\n * @package core_contentbank\n * @copyright 2020 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport selectors from './selectors';\nimport {get_string as getString} from 'core/str';\nimport Prefetch from 'core/prefetch';\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set up the contentbank views.\n *\n * @method init\n */\nexport const init = () => {\n const contentBank = document.querySelector(selectors.regions.contentbank);\n Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type', 'author']);\n Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']);\n registerListenerEvents(contentBank);\n};\n\n/**\n * Register contentbank related event listeners.\n *\n * @method registerListenerEvents\n * @param {HTMLElement} contentBank The DOM node of the content bank\n */\nconst registerListenerEvents = (contentBank) => {\n\n // The search.\n const fileArea = document.querySelector(selectors.regions.filearea);\n const shownItems = fileArea.querySelectorAll(selectors.elements.listitem);\n\n // The view buttons.\n const viewGrid = contentBank.querySelector(selectors.actions.viewgrid);\n const viewList = contentBank.querySelector(selectors.actions.viewlist);\n\n viewGrid.addEventListener('click', () => {\n contentBank.classList.remove('view-list');\n contentBank.classList.add('view-grid');\n viewGrid.classList.add('active');\n viewList.classList.remove('active');\n setViewListPreference(false);\n });\n\n viewList.addEventListener('click', () => {\n contentBank.classList.remove('view-grid');\n contentBank.classList.add('view-list');\n viewList.classList.add('active');\n viewGrid.classList.remove('active');\n setViewListPreference(true);\n });\n\n // Sort by file name alphabetical\n const sortByName = contentBank.querySelector(selectors.actions.sortname);\n sortByName.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByName);\n updateSortOrder(fileArea, shownItems, 'data-file', ascending);\n });\n\n // Sort by date.\n const sortByDate = contentBank.querySelector(selectors.actions.sortdate);\n sortByDate.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByDate);\n updateSortOrder(fileArea, shownItems, 'data-timemodified', ascending);\n });\n\n // Sort by size.\n const sortBySize = contentBank.querySelector(selectors.actions.sortsize);\n sortBySize.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortBySize);\n updateSortOrder(fileArea, shownItems, 'data-bytes', ascending);\n });\n\n // Sort by type.\n const sortByType = contentBank.querySelector(selectors.actions.sorttype);\n sortByType.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByType);\n updateSortOrder(fileArea, shownItems, 'data-type', ascending);\n });\n\n // Sort by author.\n const sortByAuthor = contentBank.querySelector(selectors.actions.sortauthor);\n sortByAuthor.addEventListener('click', () => {\n const ascending = updateSortButtons(contentBank, sortByAuthor);\n updateSortOrder(fileArea, shownItems, 'data-author', ascending);\n });\n};\n\n\n/**\n * Set the contentbank user preference in list view\n *\n * @param {Bool} viewList view ContentBank as list.\n * @return {Promise} Repository promise.\n */\nconst setViewListPreference = function(viewList) {\n\n // If the given status is not hidden, the preference has to be deleted with a null value.\n if (viewList === false) {\n viewList = null;\n }\n\n const request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: 'core_contentbank_view_list',\n value: viewList\n }\n ]\n }\n };\n\n return Ajax.call([request])[0].catch(Notification.exception);\n};\n\n/**\n * Update the sort button view.\n *\n * @method updateSortButtons\n * @param {HTMLElement} contentBank The DOM node of the contentbank button\n * @param {HTMLElement} sortButton The DOM node of the sort button\n * @return {Bool} sort ascending\n */\nconst updateSortButtons = (contentBank, sortButton) => {\n const sortButtons = contentBank.querySelectorAll(selectors.elements.sortbutton);\n\n sortButtons.forEach((button) => {\n if (button !== sortButton) {\n button.classList.remove('dir-asc');\n button.classList.remove('dir-desc');\n button.classList.add('dir-none');\n\n updateButtonTitle(button, false);\n }\n });\n\n let ascending = true;\n\n if (sortButton.classList.contains('dir-none')) {\n sortButton.classList.remove('dir-none');\n sortButton.classList.add('dir-asc');\n } else if (sortButton.classList.contains('dir-asc')) {\n sortButton.classList.remove('dir-asc');\n sortButton.classList.add('dir-desc');\n ascending = false;\n } else if (sortButton.classList.contains('dir-desc')) {\n sortButton.classList.remove('dir-desc');\n sortButton.classList.add('dir-asc');\n }\n\n updateButtonTitle(sortButton, ascending);\n\n return ascending;\n};\n\n/**\n * Update the button title.\n *\n * @method updateButtonTitle\n * @param {HTMLElement} button Button to update\n * @param {Bool} ascending Sort direction\n * @return {Promise} string promise\n */\nconst updateButtonTitle = (button, ascending) => {\n\n const sortString = (ascending ? 'sortbyxreverse' : 'sortbyx');\n\n return getString(button.dataset.string, 'contentbank')\n .then(columnName => {\n return getString(sortString, 'core', columnName);\n })\n .then(sortByString => {\n button.setAttribute('title', sortByString);\n return sortByString;\n })\n .catch();\n};\n\n/**\n * Update the sort order of the itemlist and update the DOM\n *\n * @method updateSortOrder\n * @param {HTMLElement} fileArea the Dom container for the itemlist\n * @param {Array} itemList Nodelist of Dom elements\n * @param {String} attribute, the attribut to sort on\n * @param {Bool} ascending, Sort Ascending\n */\nconst updateSortOrder = (fileArea, itemList, attribute, ascending) => {\n const sortList = [].slice.call(itemList).sort(function(a, b) {\n\n let aa = a.getAttribute(attribute);\n let bb = b.getAttribute(attribute);\n if (!isNaN(aa)) {\n aa = parseInt(aa);\n bb = parseInt(bb);\n }\n\n if (ascending) {\n return aa > bb ? 1 : -1;\n } else {\n return aa < bb ? 1 : -1;\n }\n });\n sortList.forEach(listItem => fileArea.appendChild(listItem));\n};\n"],"file":"sort.min.js"} \ No newline at end of file diff --git a/contentbank/amd/src/selectors.js b/contentbank/amd/src/selectors.js index b8ca6a6875e..60fe955b91d 100644 --- a/contentbank/amd/src/selectors.js +++ b/contentbank/amd/src/selectors.js @@ -48,7 +48,8 @@ export default { sortname: getDataSelector('action', 'sortname'), sortdate: getDataSelector('action', 'sortdate'), sortsize: getDataSelector('action', 'sortsize'), - sorttype: getDataSelector('action', 'sorttype') + sorttype: getDataSelector('action', 'sorttype'), + sortauthor: getDataSelector('action', 'sortauthor'), }, elements: { listitem: '.cb-listitem', diff --git a/contentbank/amd/src/sort.js b/contentbank/amd/src/sort.js index 94c1a249cc6..34c282b85e5 100644 --- a/contentbank/amd/src/sort.js +++ b/contentbank/amd/src/sort.js @@ -35,7 +35,7 @@ import Notification from 'core/notification'; */ export const init = () => { const contentBank = document.querySelector(selectors.regions.contentbank); - Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type']); + Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type', 'author']); Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']); registerListenerEvents(contentBank); }; @@ -93,12 +93,19 @@ const registerListenerEvents = (contentBank) => { updateSortOrder(fileArea, shownItems, 'data-bytes', ascending); }); - // Sort by type + // Sort by type. const sortByType = contentBank.querySelector(selectors.actions.sorttype); sortByType.addEventListener('click', () => { const ascending = updateSortButtons(contentBank, sortByType); updateSortOrder(fileArea, shownItems, 'data-type', ascending); }); + + // Sort by author. + const sortByAuthor = contentBank.querySelector(selectors.actions.sortauthor); + sortByAuthor.addEventListener('click', () => { + const ascending = updateSortButtons(contentBank, sortByAuthor); + updateSortOrder(fileArea, shownItems, 'data-author', ascending); + }); }; diff --git a/contentbank/classes/output/bankcontent.php b/contentbank/classes/output/bankcontent.php index 5549392f569..6c799df38e3 100644 --- a/contentbank/classes/output/bankcontent.php +++ b/contentbank/classes/output/bankcontent.php @@ -86,6 +86,7 @@ class bankcontent implements renderable, templatable { $contenttypeclass = $content->get_content_type().'\\contenttype'; $contenttype = new $contenttypeclass($this->context); $name = $content->get_name(); + $author = \core_user::get_user($content->get_content()->usercreated); $contentdata[] = array( 'name' => $name, 'title' => strtolower($name), @@ -94,7 +95,8 @@ class bankcontent implements renderable, templatable { 'timemodified' => $content->get_timemodified(), 'bytes' => $filesize, 'size' => display_size($filesize), - 'type' => $mimetype + 'type' => $mimetype, + 'author' => fullname($author), ); } $data->viewlist = get_user_preferences('core_contentbank_view_list'); diff --git a/contentbank/templates/bankcontent.mustache b/contentbank/templates/bankcontent.mustache index 6819447040f..a62beff2f5f 100644 --- a/contentbank/templates/bankcontent.mustache +++ b/contentbank/templates/bankcontent.mustache @@ -27,6 +27,7 @@ "size": "699.3KB", "bytes": 716126, "type": "Archive (H5P)", + "author": "Admin user", "link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p", "icon" : "http://something/theme/image.php/boost/core/1581597850/f/h5p-64" }, @@ -37,6 +38,7 @@ "size": "699.3KB", "bytes": 716126, "type": "Archive (PDF)", + "author": "Admin user", "icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64" } ], @@ -122,7 +124,7 @@ data-region="contentbank"> {{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}} -
+
{{#str}} type, contentbank {{/str}}
+
+
{{#str}} author, contentbank {{/str}}
+ +
{{#contents}}
data-name="{{{ name }}}" data-bytes="{{ bytes }}" data-timemodified="{{ timemodified }}" - data-type="{{{ type }}}"> + data-type="{{{ type }}}" + data-author="{{{ author }}}">
diff --git a/contentbank/tests/behat/sort_content.feature b/contentbank/tests/behat/sort_content.feature index 6abcf9548c4..242c2279180 100644 --- a/contentbank/tests/behat/sort_content.feature +++ b/contentbank/tests/behat/sort_content.feature @@ -5,14 +5,20 @@ Feature: Sort content in the content bank I need to be able to sort the content bank in various ways Background: - Given the following "contentbank content" exist: - | contextlevel | reference | contenttype | user | contentname | - | System | | contenttype_h5p | admin | Dragon_santjordi.h5p | - | System | | contenttype_h5p | admin | mathsbook.h5p | - | System | | contenttype_h5p | admin | historybook.h5p | - | System | | contenttype_h5p | admin | santjordi.h5p | - | System | | contenttype_h5p | admin | santjordi_rose.h5p | - | System | | contenttype_h5p | admin | SantJordi_book | + Given the following "users" exist: + | username | firstname | lastname | email | + | manager | Max | Manager | man@example.com | + And the following "role assigns" exist: + | user | role | contextlevel | reference | + | manager | manager | System | | + And the following "contentbank content" exist: + | contextlevel | reference | contenttype | user | contentname | + | System | | contenttype_h5p | admin | Dragon_santjordi.h5p | + | System | | contenttype_h5p | admin | mathsbook.h5p | + | System | | contenttype_h5p | manager | historybook.h5p | + | System | | contenttype_h5p | admin | santjordi.h5p | + | System | | contenttype_h5p | admin | santjordi_rose.h5p | + | System | | contenttype_h5p | admin | SantJordi_book | Scenario: Admins can order content in the content bank Given I log in as "admin" @@ -30,3 +36,18 @@ Feature: Sort content in the content bank And "historybook.h5p" "text" should appear before "Dragon_santjordi.h5p" "text" And "mathsbook.h5p" "text" should appear before "historybook.h5p" "text" Then "santjordi_rose.h5p" "text" should appear before "SantJordi_book" "text" + + Scenario: Admins can order content depending on the author + Given I log in as "admin" + And I am on site homepage + And I turn editing mode on + And I add the "Navigation" block if not present + And I expand "Site pages" node + And I click on "Content bank" "link" + When I click on "Display content bank with file details" "button" + Then I click on "Sort by Author ascending" "button" + And "Dragon_santjordi.h5p" "text" should appear before "historybook.h5p" "text" + And "santjordi_rose.h5p" "text" should appear before "historybook" "text" + And I click on "Sort by Author descending" "button" + And "historybook.h5p" "text" should appear before "Dragon_santjordi.h5p" "text" + And "historybook.h5p" "text" should appear before "santjordi_rose" "text" diff --git a/theme/boost/scss/moodle/contentbank.scss b/theme/boost/scss/moodle/contentbank.scss index a7bfc641d35..8bed4e2a49a 100644 --- a/theme/boost/scss/moodle/contentbank.scss +++ b/theme/boost/scss/moodle/contentbank.scss @@ -47,7 +47,8 @@ .cb-heading, .cb-date, .cb-size, - .cb-type { + .cb-type, + .cb-author { display: none; } } @@ -94,13 +95,14 @@ z-index: 1; } - .cb-file, - .cb-date { - flex: 0 0 35%; - max-width: 35%; + .cb-file { + flex: 0 0 40%; + max-width: 40%; } + .cb-date, .cb-size, - .cb-type { + .cb-type, + .cb-author { flex: 0 0 15%; max-width: 15%; } diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index cbdfb38144d..f760244f59b 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -13048,7 +13048,8 @@ table.calendartable caption { .content-bank-container.view-grid .cb-heading, .content-bank-container.view-grid .cb-date, .content-bank-container.view-grid .cb-size, -.content-bank-container.view-grid .cb-type { +.content-bank-container.view-grid .cb-type, +.content-bank-container.view-grid .cb-author { display: none; } .content-bank-container.view-list .cb-content-wrapper { @@ -13083,12 +13084,13 @@ table.calendartable caption { position: sticky; top: 0; z-index: 1; } - .content-bank-container.view-list .cb-file, - .content-bank-container.view-list .cb-date { - flex: 0 0 35%; - max-width: 35%; } + .content-bank-container.view-list .cb-file { + flex: 0 0 40%; + max-width: 40%; } + .content-bank-container.view-list .cb-date, .content-bank-container.view-list .cb-size, - .content-bank-container.view-list .cb-type { + .content-bank-container.view-list .cb-type, + .content-bank-container.view-list .cb-author { flex: 0 0 15%; max-width: 15%; } .content-bank-container.view-list .cb-column.last { diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index d673dfc990c..ecdabf340e8 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -13262,7 +13262,8 @@ table.calendartable caption { .content-bank-container.view-grid .cb-heading, .content-bank-container.view-grid .cb-date, .content-bank-container.view-grid .cb-size, -.content-bank-container.view-grid .cb-type { +.content-bank-container.view-grid .cb-type, +.content-bank-container.view-grid .cb-author { display: none; } .content-bank-container.view-list .cb-content-wrapper { @@ -13297,12 +13298,13 @@ table.calendartable caption { position: sticky; top: 0; z-index: 1; } - .content-bank-container.view-list .cb-file, - .content-bank-container.view-list .cb-date { - flex: 0 0 35%; - max-width: 35%; } + .content-bank-container.view-list .cb-file { + flex: 0 0 40%; + max-width: 40%; } + .content-bank-container.view-list .cb-date, .content-bank-container.view-list .cb-size, - .content-bank-container.view-list .cb-type { + .content-bank-container.view-list .cb-type, + .content-bank-container.view-list .cb-author { flex: 0 0 15%; max-width: 15%; } .content-bank-container.view-list .cb-column.last {