Skip to content
Code-Schnipsel Gruppen Projekte
Commit 441db911 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: Bricks Select Window - #124

Übergeordneter f66e9cf8
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
.quiqqer-bricks-brickList {
display: flex;
flex-direction: column;
}
/**
* @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]);
}
});
});
/**
* @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();
}
}
});
});
......@@ -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
......
......@@ -1197,6 +1197,11 @@ M&ouml;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&ouml;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">
......
......@@ -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
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren