You need to sign in or sign up before continuing.
Newer
Older
* @author www.pcsg.de (Henning Leutz)
*/
'qui/QUI',
'qui/controls/desktop/Panel',
'qui/controls/buttons/Select',
'qui/controls/buttons/Button',
'controls/grid/Grid',
'Locale',
'Projects',
'text!package/quiqqer/bricks/bin/Manager.Copy.html',
'css!package/quiqqer/bricks/bin/Manager.Copy.css',
], function (QUI, QUIPanel, QUISelect, QUIButton, QUISeparator, QUIConfirm, Grid, QUILocale, Projects, Ajax,
Extends: QUIPanel,
Type : 'package/quiqqer/bricks/bin/Manager',
'$onClick',
'$onInject',
'$onDestroy'
onCreate : this.$onCreate,
onResize : this.$onResize,
onInject : this.$onInject,
onDestroy: this.$onDestroy
var self = this,
project = this.$ProjectSelect.getValue(),
lang = this.$ProjectLangs.getValue();
Bricks.getBricksFromProject(project, lang).then(function (result) {
var options = self.$Grid.options,
page = parseInt(options.page),
perPage = parseInt(options.perPage),
data : result.slice(start, start + perPage),
page : page,
total: result.length
var selected = this.$Grid.getSelectedData(),
AddButton = this.getButtons('brick-add'),
EditButton = this.getButtons('brick-edit'),
CopyButton = this.getButtons('brick-copy'),
DelButton = this.getButtons('brick-delete');
return;
}
AddButton.enable();
DelButton.enable();
EditButton.disable();
CopyButton.disable();
var self = this;
// Buttons
this.$ProjectSelect = new QUISelect({
name : 'projects-name',
events: {
onChange: this.$refreshProjectLanguages
}
});
this.$ProjectLangs = new QUISelect({
name : 'projects-langs',
events: {
onChange: this.refresh
this.addButton(this.$ProjectSelect);
this.addButton(this.$ProjectLangs);
textimage: 'fa fa-plus',
text : QUILocale.get(lg, 'manager.button.add'),
title : QUILocale.get(lg, 'manager.button.add'),
name : 'brick-add',
disabled : true,
events : {
text : QUILocale.get(lg, 'manager.button.edit.text'),
title : QUILocale.get(lg, 'manager.button.edit.title'),
name : 'brick-edit',
disabled : true,
events : {
onClick: function () {
self.editBrick(
self.$Grid.getSelectedData()[0].id
}
}
})
);
this.addButton(
new QUIButton({
textimage: 'fa fa-copy',
text : QUILocale.get(lg, 'manager.button.copy.text'),
title : QUILocale.get(lg, 'manager.button.copy.title'),
name : 'brick-copy',
disabled : true,
events : {
onClick: function () {
var data = self.$Grid.getSelectedData();
if (data.length === 1) {
self.$openCopyDialog(data[0].id);
}
}
}
})
);
this.addButton(
new QUIButton({
icon : 'fa fa-trash',
title : QUILocale.get(lg, 'manager.button.delete'),
// Grid
var Container = new Element('div').inject(
this.getContent()
);
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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
}
],
onRefresh : this.refresh,
onDblClick: this.$onDblClick,
onClick : this.$onClick
Projects.getList(function (projects) {
for (var project in projects) {
continue;
}
self.$ProjectSelect.appendChild(
);
}
self.$ProjectSelect.setValue(
/**
* event: on inject
*/
$onInject: function () {
Bricks.addEvents({
onBrickDelete: this.refresh,
onBrickSave : this.refresh,
onBrickCopy : this.refresh,
onBrickCreate: this.refresh
});
},
/**
* event: on destroy
*/
$onDestroy: function () {
Bricks.removeEvents({
onBrickDelete: this.refresh,
onBrickSave : this.refresh,
onBrickCopy : this.refresh,
onBrickCreate: this.refresh
});
},
return;
}
var Body = this.getContent();
return;
}
var size = Body.getSize();
this.$Grid.setHeight(size.y - 40);
this.$Grid.setWidth(size.x - 40);
var self = this,
activeProject = this.$ProjectSelect.getValue();
Projects.getList(function (projects) {
for (var project in projects) {
if (!projects.hasOwnProperty(project)) {
);
}
self.$ProjectLangs.setValue(
maxHeight: 300,
maxWidth : 400,
autoclose: false,
events : {
onOpen: function (Win) {

Henning Leutz
committed
' <input type="text" name="title" required="required" />' +
' </span>' +
' <select name="type"></select>' +
'</label>'
);
Bricks.getAvailableBricks().then(function (bricklist) {
var Select = Body.getElement('select'),
Title = Body.getElement('[name="title"]');
for (i = 0, len = bricklist.length; i < len; i++) {
title = bricklist[i].title;
group = title.group;
val = title[1];
}
text = QUILocale.get(group, val);
if (bricklist[i].deprecated) {
text = text + ' (deprecated)';
Title = Body.getElement('[name="title"]'),
Type = Body.getElement('[name="type"]');
if (Title.value === '') {
QUI.getMessageHandler(function (MH) {

Henning Leutz
committed
MH.addError(

Henning Leutz
committed
Title
);
});
Title.focus();
Win.Loader.hide();
var project = self.$ProjectSelect.getValue(),
lang = self.$ProjectLangs.getValue(),
data = {
title: Title.value,
type : Type.value
};
Bricks.createBrick(project, lang, data).then(function (brickId) {
brickIds = this.$Grid.getSelectedData().map(function (brick) {
maxHeight: 300,
maxWidth : 600,
autoclose: false,
title : QUILocale.get(lg, 'manager.window.delete.title'),
events : {
onOpen: function (Win) {
self.$Grid.getSelectedData().each(function (brick) {
lists = lists + '<li>' + brick.id + ' - ' + brick.title + '</li>';
QUILocale.get(lg, 'manager.window.delete.information', {
list: lists
Bricks.deleteBricks(brickIds).then(function () {
Win.close();
});
}
}
}).open();
},
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
/**
* opens the copy dialog
*/
$openCopyDialog: function (brickId) {
var self = this;
new QUIConfirm({
title : QUILocale.get(lg, 'dialog.copy.title', {
id: brickId
}),
icon : 'fa fa-copy',
maxHeight: 600,
maxWidth : 800,
autoclose: false,
events: {
onOpen: function (Win) {
Win.Loader.show();
var Content = Win.getContent(),
project = self.$ProjectSelect.getValue(),
lang = self.$ProjectLangs.getValue(),
Project = Projects.get(project);
Content.set('html', Mustache.render(templateCopy, {
text: QUILocale.get(lg, 'dialog.copy.message')
}));
Project.getConfig().then(function (config) {
var Select = new QUISelect({
name: 'language-select'
});
var langs = config.langs.split(',');
for (var i = 0, len = langs.length; i < len; i++) {
Select.appendChild(
QUILocale.get('quiqqer/quiqqer', 'language.' + langs[i]),
langs[i],
URL_BIN_DIR + '16x16/flags/' + langs[i] + '.png'
);
}
Select.inject(Content.getElement('.dialog-bricks-copy-languages'));
Select.getElm().setStyle('width', '100%');
Select.getElm().setStyle('border', 0);
Select.setValue(lang);
Bricks.getBrick(brickId).then(function (data) {
var Form = Content.getElement('form');
Form.elements.title.value = data.attributes.title;
Form.elements.description.value = data.attributes.description;
Win.Loader.hide();
});
});
},
onSubmit: function (Win) {
Win.Loader.show();
var Content = Win.getContent(),
Form = Content.getElement('form');
var Select = Content.getElement('.dialog-bricks-copy-languages [data-quiid]');
var Language = QUI.Controls.getById(Select.get('data-quiid'));
Bricks.copyBrick(brickId, {
'lang' : Language.getValue(),
'title' : Form.elements.title.value,
'description': Form.elements.description.value
}).then(function (data) {
});
}
}
}).open();
},
require([
'package/quiqqer/bricks/bin/BrickEdit',
'utils/Panels'
PanelUtils.openPanelInTasks(
new BrickEdit({
id : brickId,
projectName: this.$ProjectSelect.getValue(),
projectLang: this.$ProjectLangs.getValue()