diff --git a/CHANGELOG.md b/CHANGELOG.md index b2a61c8..9d0f009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,46 +1,7 @@ # Changelog -## 1.4.0.0 (2021-11-11) - -#### Added -- add JSON export renderer -- add tpl block for easier extension -- enable controller based exception handling - -#### Changed -- change deprecated CSV export code -- show registered export renderers in admin submit without required tpl block extension -- force get translations from admin - --- -## 1.3.1.0 (2021-09-10) - -- installable in OXID 6.3.1 - ---- - -## 1.3.0.0 (2021-07-29) - -- can handle long task description text -- has more generic admin controller templates - ---- - -## 1.2.0.0 (2021-07-27) - -- adjustments for CLI extension -- fix OXID 6.1 incompatibilities - ---- - -## 1.1.0.0 (2021-06-25) - -- implement form builder -- fix key figures export - ---- - -## 1.0.0.0 (2021-06-22) +## 1.0.0.0 (2021-12-11) - initial implementation \ No newline at end of file diff --git a/IntelliSenseHelper.php b/IntelliSenseHelper.php index 434fa56..03525ca 100644 --- a/IntelliSenseHelper.php +++ b/IntelliSenseHelper.php @@ -1,5 +1,18 @@ + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + namespace D3\SortedMenus\Modules\Controller\Admin { use OxidEsales\Eshop\Application\Controller\Admin\NavigationTree; diff --git a/Modules/Controller/Admin/NavigationTreeSortedMenus.php b/Modules/Controller/Admin/NavigationTreeSortedMenus.php index 0b60660..b6bca1d 100644 --- a/Modules/Controller/Admin/NavigationTreeSortedMenus.php +++ b/Modules/Controller/Admin/NavigationTreeSortedMenus.php @@ -1,5 +1,18 @@ + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + namespace D3\SortedMenus\Modules\Controller\Admin; use DOMElement; @@ -44,6 +57,7 @@ class NavigationTreeSortedMenus extends NavigationTreeSortedMenus_parent $remainingUnsortedElements = []; $sortedElements = []; + // split current elements to "contained in sorted" and all others foreach ($unsortedElements as $element) { if (in_array($element->getAttribute('id'), $newOrder)) { $sortedElements[$element->getAttribute('id')] = $element; @@ -61,11 +75,11 @@ class NavigationTreeSortedMenus extends NavigationTreeSortedMenus_parent } $allSortedElements = array_merge($sortedElements, $remainingUnsortedElements); + // apply sorted elements for ($i = 0; $i < count($allSortedElements); $i++) { $keys = array_keys($allSortedElements); $elem = $unsortedElements->item($i); $searchElem = $elem->parentNode; - //$searchElem->removeChild($elem); $searchElem->appendChild($allSortedElements[$keys[$i]]); } } diff --git a/README.en.md b/README.en.md index 9169fcb..653c4db 100644 --- a/README.en.md +++ b/README.en.md @@ -1,50 +1,63 @@ [![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md) [![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md) -# D³ Data Wizard for OXID eShop +# D³ Sortable Menus für OXID eShop -The module `DataWizard` offers a framework for the simple integration of exports via the admin area of the OXID shop. +The module offers the possibility to sort the admin menus into a desired order. -The exports are defined via database queries or ready-made data lists. Various export formats are available. The generation is possible at any time and always recurring (within the system limits). These are offered as downloads in the browser. +The side menu on the left and the tabs in each individual area can be sorted. +The action links of the areas are also configured via the menu.xml, but are loaded in the template in a fixed order. -All exports and tasks are grouped together for better clarity. - -Sample exports are included in the package d3/datawizardtasks. These are intended to serve as an implementation reference for individual exports. - -![administration area](assets/administration_exports.jpg "administration area") +The entries can only be moved in the currently selected level. ## Installation In the console in the shop root (above source and vendor), execute the following command: ```bash -php composer require d3/datawizard +php composer require d3/sortedmenus ``` Activate the module in the admin area of the shop in "Extensions -> Modules". -## Extensibility +## Configuration -The module represents the technical basic framework of the exports and does not claim to be complete. In order to adapt the scope to individual requirements, the following extensions are prepared: +For the sake of simplicity, the configuration is done directly in the configuration file of the shop (`config.inc.php`). -- Add exports or tasks -- Use existing and new groups -- Add export formats +Insert the following configuration as an example: -Independently of this, all extension options are available that the OXID Shop provides for modules. +```php +$this->d3MenuSorting = [ + // mainmenu + 'move articles and order panels in front' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/MAINMENU", + 'order' => ['mxmanageprod', 'mxorders'] + ], + // submenu + 'move vouchers in shop settings to front' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/*[@id='mxshopsett']/SUBMENU", + 'order' => ['mxvouchers'] + ], + // tabs + 'show category picture tab as first' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/*[@id='mxmanageprod']/*[@id='mxcategories']/TAB", + 'order' => ['tbclcategory_pictures'] + ] +]; +``` -## Extension packages +Each entry defines a menu level with the xPath specification in which sorting can take place. The xPath can be determined in the respective menu.xml. Describe the xPath as precisely as possible (ideally using the unique ELement IDs), otherwise the elements to be moved could end up in the wrong area. -- `d3/datawizardtasks` - provides sample exports and their implementation reference -- `d3/datawizardcli` - provides the execution of exports or tasks via the command prompt (e.g. as cronjobs) -- `d3/datawizardlink` - provides URLs to generate exports from third party systems +In the order entry, the IDs of the contained entries are in the correct order. Entries that are not contained are automatically appended to the end of the sorted list in the previous sort order. + +After changing the sorting entries, the tmp folder must be emptied. ## Changelog See [CHANGELOG](CHANGELOG.md) for further informations. -## Licence of this software (d3/datawizard) -(status: 2021-05-06) +## Licence of this software (d3/sortedmenus) +(status: 2021-12-11) ``` Copyright (c) D3 Data Development (Inh. Thomas Dartsch) @@ -53,69 +66,3 @@ This software is distributed under the GNU GENERAL PUBLIC LICENSE version 3. ``` For full copyright and licensing information, please see the [LICENSE](LICENSE.md) file distributed with this source code. - -## Further licences and terms of use - -### background gradients on src/Application/views/admin/tpl/ templates -(https://www.gradientmagic.com/licensing - status: 07.05.2021) - -``` -Image courtesy of gradientmagic.com - -Free Gradients - -Gradients available on the site are free to use on personal and commercial projects, with attribution. -``` - -------------------------------------------------------------------------------- - -The following software packages are not part of this module. However, they are required for use. The linked packages are under the following licences: - -### league/csv [MIT] -(https://github.com/thephpleague/csv - status: 2021-05-06) - -``` -Copyright (c) 2013-2017 ignace nyamagana butera - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -``` - -### mathieuviossat/arraytotexttable [MIT] -(https://github.com/viossat/arraytotexttable - status: 2021-05-06) - -``` -Copyright (c) 2015 Mathieu Viossat - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -``` diff --git a/README.md b/README.md index d1f3119..ed04d8f 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,16 @@ [![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md) [![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md) -# D³ Sortable Menus für OXID eShop +# D³ Sortierbare Menüs für OXID eShop -Das Modul bietet die Möglichkeit, die Adminmenüs in eine gewünschte Reihenfolge zubringen. +Das Modul bietet die Möglichkeit, die Adminmenüs in eine gewünschte Reihenfolge zu bringen. -Sortiert werden kann das Seitenmenü auf der linken Seite sowie die Tabs in jedem einzelnen Bereich. +Sortiert werden kann das Seitenmenü auf der linken Seite sowie die Tabs in jedem einzelnen Bereich. +Die Aktionslinks der Bereiche werden zwar ebenfalls über die menu.xml konfiguriert, werden aber im Template in fester Reihenfolge geladen. Die Einträge können ausschließlich in der aktuell ausgewählten Ebene verschoben werden. -## Konfiguration - -Die Konfiguration erfolgt der Einfachheit halber direkt in der Konfiguration des Shops (`config.inc.php`). - -Fügen Sie beispielhaft folgende Konfiguration ein: - -```php -$this->d3MenuSorting = [ - // Tabs - [ - 'xpath' => "//OX/*[@id='d3mxd3modules']/*[@id='d3mximporter']/*[@id='d3mxarticleimport']/TAB", - 'order' => ['d3tbclimporter_category', 'd3tbclimporter_selectlist', 'd3tbclimporter_main'] - ], - // mainmenu - [ - 'xpath' => "//OX/*[@id='d3mxd3modules']/MAINMENU", - 'order' => ['d3konfigurator', 'abcdef', 'd3mxordermanager'] - ], - // mainmenu with unvalid item - [ - 'xpath' => "//OX/*[@id='d3mxd4modules']/MAINMENU", - 'order' => ['d3konfigurator', 'abcdef', 'd3mxordermanager'] - ], - // Tabs - [ - 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/*[@id='mxmanageprod']/*[@id='mxcategories']/TAB", - 'order' => ['tbclcategory_pictures'] - ] - // can't sort buttons -]; -``` - -Jeder Eintrage definiert mit der xPath-Angabe eine Menüebene, in der sortiert werden kann. Der xPath kann in der jeweiligen menu.xml ermittelt werden. - -Im order-Eintrag stehen die IDs der enthaltenen Einträge in der richtigen Reihenfolge. Nicht enthaltene Einträge werden in der bisherigen Sortierung automatisch an das Ende der sortierten Liste angehängt. - -Nach dem Ändern der Sortiereinträage muss der tmp-Ordner geleert werden. - -## Schnellinstallation +## Installation Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl ausführen: @@ -57,11 +20,43 @@ php composer require d3/sortedmenus Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module". +## Konfiguration + +Die Konfiguration erfolgt der Einfachheit halber direkt in der Konfigurationsdatei des Shops (`config.inc.php`). + +Fügen Sie beispielhaft folgende Konfiguration ein: + +```php +$this->d3MenuSorting = [ + // mainmenu + 'move articles and order panels in front' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/MAINMENU", + 'order' => ['mxmanageprod', 'mxorders'] + ], + // submenu + 'move vouchers in shop settings to front' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/*[@id='mxshopsett']/SUBMENU", + 'order' => ['mxvouchers'] + ], + // tabs + 'show category picture tab as first' => [ + 'xpath' => "//OX/*[@id='NAVIGATION_ESHOPADMIN']/*[@id='mxmanageprod']/*[@id='mxcategories']/TAB", + 'order' => ['tbclcategory_pictures'] + ] +]; +``` + +Jeder Eintrage definiert mit der xPath-Angabe eine Menüebene, in der sortiert werden kann. Der xPath kann in der jeweiligen menu.xml ermittelt werden. Beschreiben Sie den xPath möglichst genau (idealerweise anhand der eindeutigen Element-IDs), da sonst die zu verschiebenden Elemente im falschen Bereich landen könnten. + +Im order-Eintrag stehen die IDs der enthaltenen Einträge in der richtigen Reihenfolge. Nicht enthaltene Einträge werden in der bisherigen Sortierung automatisch an das Ende der sortierten Liste angehängt. + +Nach dem Ändern der Sortiereinträge muss der tmp-Ordner geleert werden. + ## Changelog Siehe [CHANGELOG](CHANGELOG.md) für weitere Informationen. -## Lizenz dieser Software (d3/datawizard) +## Lizenz dieser Software (d3/sortedmenus) (Stand: 11.12.2021) ``` diff --git a/metadata.php b/metadata.php index b9b99e2..af511e1 100644 --- a/metadata.php +++ b/metadata.php @@ -13,10 +13,6 @@ declare(strict_types=1); -/** - * Metadata version - */ - use D3\SortedMenus\Modules\Controller\Admin\NavigationTreeSortedMenus; use OxidEsales\Eshop\Application\Controller\Admin\NavigationTree;