diff --git a/bin/Controls/backend/BrickList.css b/bin/Controls/backend/BrickList.css new file mode 100644 index 0000000000000000000000000000000000000000..1b69962fdbb2efecdb7837c8550ac985e164bafe --- /dev/null +++ b/bin/Controls/backend/BrickList.css @@ -0,0 +1,4 @@ +.quiqqer-bricks-brickList { + display: flex; + flex-direction: column; +} diff --git a/bin/Controls/backend/BrickList.js b/bin/Controls/backend/BrickList.js new file mode 100644 index 0000000000000000000000000000000000000000..382b482b7b3fc894e4d1766dca552e97e966f93f --- /dev/null +++ b/bin/Controls/backend/BrickList.js @@ -0,0 +1,181 @@ +/** + * @module package/quiqqer/bricks/bin/Controls/backend/BrickList + * @author www.pcsg.de (Henning Leutz) + */ +define('package/quiqqer/bricks/bin/Controls/backend/BrickList', [ + + 'qui/QUI', + 'qui/controls/Control', + 'controls/projects/Select', + 'controls/grid/Grid', + 'Locale', + 'Projects', + 'Ajax', + 'package/quiqqer/bricks/bin/Bricks', + + 'css!package/quiqqer/bricks/bin/Controls/backend/BrickList.css' + +], function (QUI, QUIControl, ProjectSelect, Grid, QUILocale, Projects, QUIAjax, Bricks) { + "use strict"; + + var lg = 'quiqqer/bricks'; + + return new Class({ + + Extends: QUIControl, + Type : 'package/quiqqer/bricks/bin/Controls/backend/BrickList', + + Binds: [ + '$onCreate', + '$onInject', + '$onDblClick', + 'refresh' + ], + + options: { + project : false, + lang : false, + styles : false, + multiple: true + }, + + initialize: function (options) { + this.parent(options); + + this.$isLoaded = false; + this.$Container = null; + + this.addEvents({ + onInject: this.$onInject + }); + }, + + create: function () { + var Elm = this.parent(); + + Elm.set({ + 'data-quiid': this.getId(), + 'data-qui' : 'package/quiqqer/bricks/bin/Controls/backend/BrickList' + }); + + Elm.addClass('quiqqer-bricks-brickList'); + + if (this.getAttribute('styles')) { + Elm.setStyles(this.getAttribute('styles')); + } + + this.$ProjectSelect = new ProjectSelect({ + styles: { + marginBottom: 10, + width : '100%' + }, + events: { + onChange: this.refresh + } + }); + + if (this.getAttribute('project')) { + this.$ProjectSelect.setAttribute('project', this.getAttribute('project')); + } + + if (this.getAttribute('lang')) { + this.$ProjectSelect.setAttribute('lang', this.getAttribute('lang')); + } + + this.$ProjectSelect.inject(Elm); + + this.$Container = new Element('div').inject(Elm); + + if (this.getAttribute('styles')) { + this.$Container.setStyles(this.getAttribute('styles')); + } + + this.$Grid = new Grid(this.$Container, { + columnModel : [{ + header : QUILocale.get('quiqqer/quiqqer', 'id'), + dataIndex: 'id', + dataType : 'integer', + width : 40 + }, { + header : QUILocale.get('quiqqer/quiqqer', 'title'), + dataIndex: 'title', + dataType : 'string', + width : 140 + }, { + header : QUILocale.get('quiqqer/quiqqer', 'description'), + dataIndex: 'description', + dataType : 'string', + width : 300 + }, { + header : QUILocale.get(lg, 'brick.type'), + dataIndex: 'type', + dataType : 'string', + width : 200 + }], + multipleSelection: this.getAttribute('multiple'), + pagination : true + }); + + this.$Grid.addEvents({ + onRefresh : this.refresh, + onDblClick: this.$onDblClick + }); + + this.$isLoaded = true; + + return Elm; + }, + + $onInject: function () { + this.$Grid.setHeight(this.$Container.getSize().y); + this.refresh(); + }, + + /** + * Refresh the panel data + */ + refresh: function () { + if (!this.$isLoaded) { + return Promise.resolve(); + } + + if (!this.$Elm) { + return Promise.resolve(); + } + + var self = this, + value = this.$ProjectSelect.getValue().split(','); + + + this.$ProjectSelect.disable(); + this.$Grid.showLoader(); + + return Bricks.getBricksFromProject(value[0], value[1]).then(function (result) { + var options = self.$Grid.options, + page = parseInt(options.page), + perPage = parseInt(options.perPage), + start = (page - 1) * perPage; + + self.$Grid.setData({ + data : result.slice(start, start + perPage), + page : page, + total: result.length + }); + + self.$ProjectSelect.enable(); + self.$Grid.hideLoader(); + }); + }, + + /** + * @return {Object} + */ + getValue: function () { + return this.$Grid.getSelectedData(); + }, + + $onDblClick: function () { + this.fireEvent('dblClick', [this]); + } + }); +}); diff --git a/bin/Controls/backend/BrickSelectWindow.js b/bin/Controls/backend/BrickSelectWindow.js new file mode 100644 index 0000000000000000000000000000000000000000..20f42a3644ae4917fb43fa22c7018c8e3f066b3b --- /dev/null +++ b/bin/Controls/backend/BrickSelectWindow.js @@ -0,0 +1,90 @@ +/** + * @module package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow + * @author www.pcsg.de (Henning Leutz) + */ +define('package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow', [ + + 'qui/QUI', + 'qui/controls/windows/Confirm', + 'Locale' + +], function (QUI, QUIConfirm, QUILocale) { + "use strict"; + + var lg = 'quiqqer/bricks'; + + return new Class({ + + Extends: QUIConfirm, + Type : 'package/quiqqer/bricks/bin/Controls/backend/BrickSelectWindow', + + Binds: [ + '$onOpen' + ], + + options: { + project: false, + lang : false + }, + + initialize: function (options) { + // defaults + this.setAttributes({ + maxHeight: 800, + maxWidth : 800, + icon : 'fa fa-cubes', + title : QUILocale.get(lg, 'window.brick.select.title') + }); + + this.parent(options); + this.$BricksSelect = null; + + this.addEvents({ + onOpen: this.$onOpen + }); + }, + + /** + * event: on open + * + * @param Win + */ + $onOpen: function (Win) { + var self = this; + + Win.Loader.show(); + Win.getContent().set('html', ''); + + require([ + 'package/quiqqer/bricks/bin/Controls/backend/BrickList' + ], function (BrickList) { + self.$BricksSelect = new BrickList({ + project : self.getAttribute('project'), + lang : self.getAttribute('lang'), + multiple: self.getAttribute('multiple'), + styles : { + height: '100%' + }, + events : { + onDblClick: function () { + self.submit(); + } + } + }).inject(Win.getContent()); + + Win.Loader.hide(); + }); + }, + + /** + * submit, fires onSubmit + */ + submit: function () { + this.fireEvent('submit', [this, this.$BricksSelect.getValue()]); + + if (this.getAttribute('autoclose')) { + this.close(); + } + } + }); +}); diff --git a/bin/Manager.js b/bin/Manager.js index 45a51b6a9866b53f975a3f4cd54556bd8021de75..d497c578dbce8f21bbf97ca3af1ddee8a683d320 100644 --- a/bin/Manager.js +++ b/bin/Manager.js @@ -238,17 +238,17 @@ define('package/quiqqer/bricks/bin/Manager', [ this.$Grid = new Grid(Container, { columnModel : [{ - header : QUILocale.get('quiqqer/system', 'id'), + header : QUILocale.get('quiqqer/quiqqer', 'id'), dataIndex: 'id', dataType : 'integer', width : 40 }, { - header : QUILocale.get('quiqqer/system', 'title'), + header : QUILocale.get('quiqqer/quiqqer', 'title'), dataIndex: 'title', dataType : 'string', width : 140 }, { - header : QUILocale.get('quiqqer/system', 'description'), + header : QUILocale.get('quiqqer/quiqqer', 'description'), dataIndex: 'description', dataType : 'string', width : 300 diff --git a/locale.xml b/locale.xml index 2a14cbee527a7e6584d94ffeae452aeb3c78deb2..79a93b3992df0cfae911fa83809eec8f03801b87 100644 --- a/locale.xml +++ b/locale.xml @@ -1197,6 +1197,11 @@ Möchten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de> <en><![CDATA[Continue]]></en> </locale> <!--</editor-fold>--> + + <locale name="window.brick.select.title"> + <de><![CDATA[Bausteinauswahl]]></de> + <en><![CDATA[Brick selection]]></en> + </locale> </groups> <groups name="quiqqer/bricks" datatype="js,php"> @@ -1462,7 +1467,8 @@ Möchten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de> <en><![CDATA[Bricks: Text with image in boxes]]></en> </locale> <locale name="bricks.BoxContentAdvanced.description"> - <de><![CDATA[Inhalte werden in Boxen nebeneinander gestellt und besitzen verschieden Templates und Einstellungsmöglichkeiten.]]></de> + <de> + <![CDATA[Inhalte werden in Boxen nebeneinander gestellt und besitzen verschieden Templates und Einstellungsmöglichkeiten.]]></de> <en><![CDATA[Show the contents in boxes next to each other. The brick has different templates..]]></en> </locale> <locale name="bricks.BoxContentAdvanced.template"> diff --git a/src/QUI/Bricks/Events.php b/src/QUI/Bricks/Events.php index 6bed20e0e40891b45afbd4944e6343c219b6425f..d711594cbf160810f70ab62d42387be2d8059ae4 100644 --- a/src/QUI/Bricks/Events.php +++ b/src/QUI/Bricks/Events.php @@ -287,19 +287,6 @@ public static function onPackageSetup(QUI\Package\Package $Package) QUI\System\Log::addInfo($Exception->getMessage()); } } - - // unique id patch - $php = 'php'; - - if (\defined('PHP_BINARY')) { - $php = PHP_BINARY; - } - - try { - \shell_exec($php.' '.OPT_DIR.'quiqqer/bricks/patches/uniqueIds.php'); - } catch (\Exception $Exception) { - QUI\System\Log::writeException($Exception); - } } //region output filter