From ac38f33178178fb06162384677fa10f21904e2c7 Mon Sep 17 00:00:00 2001 From: SilverSocmel Date: Thu, 30 Jan 2025 02:31:44 +0100 Subject: [PATCH 1/4] Update default.inc.php Lexicon for System setting --- core/components/collections/lexicon/en/default.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/components/collections/lexicon/en/default.inc.php b/core/components/collections/lexicon/en/default.inc.php index 90a32962..a491fcbf 100644 --- a/core/components/collections/lexicon/en/default.inc.php +++ b/core/components/collections/lexicon/en/default.inc.php @@ -31,6 +31,8 @@ $_lang['setting_collections.tree_tbar_collection_desc'] = 'Show "New Collection" button in Tree tool bar'; $_lang['setting_collections.tree_tbar_selection'] = 'Tree Tool Bar - Selection'; $_lang['setting_collections.tree_tbar_selection_desc'] = 'Show "New Selection" button in Tree tool bar'; +$_lang['setting_collections.mostra_cs_testata'] = 'Show Header for Collection/Selection'; +$_lang['setting_collections.mostra_cs_testata_desc'] = 'Decide if you want to show Header for Collection/Selection'; // System lexicons From 742fc451f8508393ef82388bc30829eab392b225 Mon Sep 17 00:00:00 2001 From: SilverSocmel Date: Thu, 30 Jan 2025 02:33:18 +0100 Subject: [PATCH 2/4] Add files via upload Add new processor --- .../src/Processors/Extra/Testata.php | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 core/components/collections/src/Processors/Extra/Testata.php diff --git a/core/components/collections/src/Processors/Extra/Testata.php b/core/components/collections/src/Processors/Extra/Testata.php new file mode 100644 index 00000000..3648c484 --- /dev/null +++ b/core/components/collections/src/Processors/Extra/Testata.php @@ -0,0 +1,64 @@ +getProperty('collection', 0); + $selection = (int)$this->getProperty('selection', 0); + + if ($collection <= 0) { + return $this->failure(); + } + $resource = $this->modx->getObject(modResource::class, $collection); + if (!$resource) { + return $this->failure(); + } + + //Discrimino a seconda che sia selezione oppure no per icona + $resource->published?$classPub ='pubblicata':$classPub ='ritirata'; + if($selection) + { + $icona =''; + }else{ + $icona =''; + } + + //Contesto + $contextKey = $resource->context_key; + $context = $this->modx->getContext( $contextKey ); + $contextName = $context->name; + + //Prima creo menu + //Prima parte del menu il contesto con la sua icona + $menu = ''.$contextName.''; + + $pids = $this->modx->getParentIds($collection, 10, array('context' => $contextKey)); + $gids = array_reverse($pids); + foreach($gids as $gid) + { + if($gid == 0){continue;} + + $genit = $this->modx->getObject(modResource::class, $gid); + if (!$genit){continue;} + $genit->published?$classPubGen ='pubblicata':$classPubGen ='ritirata'; + $genit->hidemenu?$classMenuGen ='nomenu':$classMenuGen ='simenu'; + $menu .= ''.$genit->pagetitle.''; + } + //Ultimo elemento del menu la sua icona + $menu .= ''.$icona.''; + + $RisAjax [] = $menu; + + //Adesso nome a cui aggiungo icona + $nome = $icona; + $nome .= $resource->pagetitle; + $RisAjax [] = $nome; + + return $this->outputArray($RisAjax); + } +} From 600654481072ac1408dc9b13f0ade952768ce285 Mon Sep 17 00:00:00 2001 From: SilverSocmel Date: Thu, 30 Jan 2025 02:37:45 +0100 Subject: [PATCH 3/4] Update collections.grid.resources.js Add Collection's Header --- .../category/collections.grid.resources.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/assets/components/collections/js/mgr/widgets/category/collections.grid.resources.js b/assets/components/collections/js/mgr/widgets/category/collections.grid.resources.js index 4390684f..6b59963a 100644 --- a/assets/components/collections/js/mgr/widgets/category/collections.grid.resources.js +++ b/assets/components/collections/js/mgr/widgets/category/collections.grid.resources.js @@ -51,6 +51,11 @@ collections.grid.ContainerCollections = function(config) { window.history.replaceState({}, '', window.location.href); + if(MODx.config.mostra_cs_testata == true) + { + this.getTestataCollection(config); + } + this.initBreadCrumbs(config); if (collections.template.allowDD) { @@ -1177,7 +1182,50 @@ Ext.extend(collections.grid.ContainerCollections,MODx.grid.Grid,{ }); this.getTopToolbar().add(this.bc); } + +,getTestataCollection: function(config) { + + var collection = parseInt(MODx.request.id); + MODx.Ajax.request({ + url: MODx.config.connector_url + ,params: { + action: 'Collections\\Processors\\Extra\\Testata' + ,collection: collection + ,selection: 0 + } + ,listeners: { + success: { + fn: function(r) { + this.printTestataCollection(r); + },scope: this + }, + failure: { + fn: function(){ + this.store.removeAll(); + this.currentFolder = collections.template.parent; + this.getStore().baseParams.parent = collections.template.parent; + this.getBottomToolbar().changePage(1); + }, + scope: this + } + } + }); + + + } + ,printTestataCollection: function(r) { + this.testata = ({ + items : [{ + html: '
'+r.results[1]+'
'+ + '' + ,bodyCssClass: 'contentTestataCS' + ,anchor: '100%' + }] + }); + this.getTopToolbar().insert(1,this.testata); + } + ,setPaginationState: function(start, limit) { var query = Ext.urlDecode(location.search.replace('?', '')); var folder = query.folder || collections.template.parent; From 46aa29d8bfa32c08ead3f968eabe5f17c7cd37ac Mon Sep 17 00:00:00 2001 From: SilverSocmel Date: Thu, 30 Jan 2025 02:40:06 +0100 Subject: [PATCH 4/4] Update collections.grid.selection.js Add Selection's Header --- .../category/collections.grid.selection.js | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/assets/components/collections/js/mgr/widgets/category/collections.grid.selection.js b/assets/components/collections/js/mgr/widgets/category/collections.grid.selection.js index fb6b15bf..180e3ae4 100644 --- a/assets/components/collections/js/mgr/widgets/category/collections.grid.selection.js +++ b/assets/components/collections/js/mgr/widgets/category/collections.grid.selection.js @@ -331,7 +331,38 @@ Ext.extend(collections.grid.ContainerSelection,collections.grid.ContainerCollect } } } - + + ,getTestataCollection: function(config) { + + var collection = parseInt(MODx.request.id); + + MODx.Ajax.request({ + url: MODx.config.connector_url + ,params: { + action: 'Collections\\Processors\\Extra\\Testata' + ,collection: collection + ,selection: 1 + } + ,listeners: { + success: { + fn: function(r) { + this.printTestataCollection(r); + },scope: this + }, + failure: { + fn: function(){ + this.store.removeAll(); + this.currentFolder = collections.template.parent; + this.getStore().baseParams.parent = collections.template.parent; + this.getBottomToolbar().changePage(1); + }, + scope: this + } + } + }); + + + } ,getDragDropText: function(){ if (this.config.baseParams.sort != 'menuindex') { if (this.store.sortInfo == undefined || this.store.sortInfo.field != 'menuindex') {