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

Merge branch 'dev'

Übergeordnete c2571da1 f3727044
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
1 Merge Request!63Update 'next-2.x' with latest changes from 'main'
......@@ -7,13 +7,6 @@
* @module qui/controls/desktop/Tasks
* @author www.pcsg.de (Henning Leutz)
*
* @require qui/QUI
* @require qui/controls/Control
* @require qui/controls/loader/Loader
* @require qui/controls/taskbar/Bar
* @require qui/controls/taskbar/Task
* @require css!qui/controls/desktop/Tasks.css
*
* @event onResize [this]
* @event onRefresh [this]
*/
......@@ -51,14 +44,31 @@ define('qui/controls/desktop/Tasks', [
options: {
name: 'taskpanel',
icon: 'icon-tasks fa fa-tasks',
icon: 'fa fa-tasks',
// header
header: true, // true to create a panel header when panel is created
title : 'Tasks' // the title inserted into the panel's header
header : true, // true to create a panel header when panel is created
title : 'Tasks', // the title inserted into the panel's header
limit : false,
'message.to.much.tasks': false
},
initialize: function (options) {
var limit = 50;
var message = 'Unfortunately, too many tasks are open. Some tasks have been closed.';
if (QUI.getAttribute('control-task-panel-limit')) {
limit = QUI.getAttribute('control-task-panel-limit');
}
if (QUI.getAttribute('control-task-panel-limit-message')) {
message = QUI.getAttribute('control-task-panel-limit-message');
}
options.limit = options.limit || limit;
options['message.to.much.tasks'] = options['message.to.much.tasks'] || message;
this.parent(options);
this.Loader = new Loader();
......@@ -319,9 +329,35 @@ define('qui/controls/desktop/Tasks', [
return this;
}
this.$Taskbar.appendChild(
this.instanceToTask(Instance)
);
var self = this,
Task = this.instanceToTask(Instance),
limit = this.getAttribute('limit');
if (this.$Taskbar && limit && limit <= this.$Taskbar.length()) {
var First = null,
children = this.$Taskbar.getChildren(),
iType = Instance.getType();
for (var i = 0, len = children.length; i < len; i++) {
if (children[i].getType() === iType) {
First = children[i];
}
}
if (First === null) {
First = children[0];
}
if (First) {
First.destroy();
}
QUI.getMessageHandler().then(function (MH) {
MH.addInformation(self.getAttribute('message.to.much.tasks'));
});
}
this.$Taskbar.appendChild(Task);
return this;
},
......
......@@ -113,23 +113,28 @@ define('qui/controls/messages/Message', [
Time = this.getAttribute('time');
var time = ('0' + Time.getDate()).slice(-2) + '.' +
('0' + (Time.getMonth() + 1)).slice(-2) + '.' +
Time.getFullYear();
('0' + (Time.getMonth() + 1)).slice(-2) + '.' +
Time.getFullYear();
var hours = ('0' + Time.getHours()).slice(-2);
var minutes = ('0' + Time.getMinutes()).slice(-2);
var message = this.getAttribute('message');
time = time + ' ' + hours + ':' + minutes;
if (typeOf(message) !== 'string') {
message = message.toString();
}
var Elm = new Element('div', {
'class': 'messages-message box',
html : '<div class="messages-message-header">' +
'<span class="messages-message-header-time">' + time + '</span>' +
'<span class="messages-message-destroy icon-remove-circle fa fa-close"></span>' +
'</div>' +
'<div class="messages-message-text">' +
this.getAttribute('message').replace(/\n/g, '<br />') +
'</div>',
'<span class="messages-message-header-time">' + time + '</span>' +
'<span class="messages-message-destroy icon-remove-circle fa fa-close"></span>' +
'</div>' +
'<div class="messages-message-text">' +
message.replace(/\n/g, '<br />') +
'</div>',
events : {
click: function () {
self.fireEvent('click', [self]);
......
......@@ -142,7 +142,7 @@ define('qui/controls/taskbar/Bar', [
self.appendChild(Task);
self.$unserializedTasks++;
if (self.$unserializedTasks == tasks.length) {
if (self.$unserializedTasks === tasks.length) {
self.fireEvent('unserializeFinish', [self]);
}
};
......@@ -175,8 +175,8 @@ define('qui/controls/taskbar/Bar', [
'class' : 'qui-taskbar qui-task-drop box',
'data-quiid': this.getId(),
html : '<div class="qui-taskbar-container">' +
'<div class="qui-taskbar-container-tasks"></div>' +
'</div>',
'<div class="qui-taskbar-container-tasks"></div>' +
'</div>',
events : {
contextmenu: this.$openContextMenu
}
......@@ -186,11 +186,11 @@ define('qui/controls/taskbar/Bar', [
this.$Elm.setStyles(this.getAttribute('styles'));
}
if (this.getAttribute('position') == 'bottom') {
if (this.getAttribute('position') === 'bottom') {
this.$Elm.addClass('qui-taskbar-bottom');
}
if (this.getAttribute('position') == 'top') {
if (this.getAttribute('position') === 'top') {
this.$Elm.addClass('qui-taskbar-top');
}
......@@ -348,6 +348,15 @@ define('qui/controls/taskbar/Bar', [
return this;
},
/**
* Return the number of the children tasks
*
* @return {Number}
*/
length: function () {
return this.$tasks.length;
},
/**
* Return the first task children
*
......@@ -441,7 +450,7 @@ define('qui/controls/taskbar/Bar', [
tid = Task.getId();
for (var i = 0, len = tasks.length; i < len; i++) {
if (tid != tasks[i].getId()) {
if (tid !== tasks[i].getId()) {
tasks[i].destroy();
}
}
......@@ -615,7 +624,7 @@ define('qui/controls/taskbar/Bar', [
// open other task
if (this.$LastTask &&
this.$LastTask.getId() == Task.getId()) {
this.$LastTask.getId() === Task.getId()) {
this.$LastTask = null;
}
......@@ -629,14 +638,14 @@ define('qui/controls/taskbar/Bar', [
this.$Active = null;
if (this.$LastTask &&
this.$LastTask.getId() != Task.getId()) {
this.$LastTask.getId() !== Task.getId()) {
this.$LastTask.click();
return;
}
var FirstTask = this.firstChild();
if (FirstTask && Task.getId() == FirstTask.getId()) {
if (FirstTask && Task.getId() === FirstTask.getId()) {
if (typeof this.$tasks[1] !== 'undefined') {
return this.$tasks[1].click();
}
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren