summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Common/Components
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js4
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js32
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js34
3 files changed, 50 insertions, 20 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
index 2a03fdf..b9d7adf 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
@@ -361,96 +361,100 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Compo
361 for (slotName in this.slotComponents()) { 361 for (slotName in this.slotComponents()) {
362 this.slotComponents()[slotName].remove(); 362 this.slotComponents()[slotName].remove();
363 delete this.slotComponents()[slotName]; 363 delete this.slotComponents()[slotName];
364 } 364 }
365 365
366 for (componentId in this.components()) { 366 for (componentId in this.components()) {
367 this.components()[componentId].remove(); 367 this.components()[componentId].remove();
368 delete this.components()[componentId]; 368 delete this.components()[componentId];
369 } 369 }
370 370
371 this.clear(); 371 this.clear();
372 MochiKit.Signal.disconnectAll(this); 372 MochiKit.Signal.disconnectAll(this);
373 }, 373 },
374 374
375 'append': function(aNode, aValue) { 375 'append': function(aNode, aValue) {
376 return Clipperz.DOM.Helper.append(aNode, aValue); 376 return Clipperz.DOM.Helper.append(aNode, aValue);
377 }, 377 },
378 378
379 'insertBefore': function (aNode, aValue) { 379 'insertBefore': function (aNode, aValue) {
380 return Clipperz.DOM.Helper.insertBefore(aNode, aValue); 380 return Clipperz.DOM.Helper.insertBefore(aNode, aValue);
381 }, 381 },
382 382
383 'insertAfter': function (aNode, aValue) { 383 'insertAfter': function (aNode, aValue) {
384 return Clipperz.DOM.Helper.insertAfter(aNode, aValue); 384 return Clipperz.DOM.Helper.insertAfter(aNode, aValue);
385 }, 385 },
386 386
387 //------------------------------------------------------------------------- 387 //-------------------------------------------------------------------------
388 388
389 'getId': function(aValue) { 389 'getId': function(aValue) {
390 varresult; 390 varresult;
391 391
392 if (typeof(aValue) != 'undefined') { 392 if (typeof(aValue) != 'undefined') {
393 result = this._ids[aValue]; 393 result = this._ids[aValue];
394 394
395 if (typeof(result) == 'undefined') { 395 if (typeof(result) == 'undefined') {
396 _Clipperz_PM_Components_base_id_ ++; 396 _Clipperz_PM_Components_base_id_ ++;
397 397
398 result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_; 398 result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_;
399 this._ids[aValue] = result; 399 this._ids[aValue] = result;
400 } 400 }
401 } else { 401 } else {
402 // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this); 402 // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this);
403 throw "call to BaseComponent.getId with an undefined value"; 403 throw "call to BaseComponent.getId with an undefined value";
404 } 404 }
405 405
406 return result; 406 return result;
407 }, 407 },
408 408
409 'getAnchor': function (aValue) {
410 return '#' + this.getId(aValue);
411 },
412
409 //------------------------------------------------------------------------- 413 //-------------------------------------------------------------------------
410 414
411 'getElement': function(aValue) { 415 'getElement': function(aValue) {
412 return Clipperz.DOM.get(this.getId(aValue)); 416 return Clipperz.DOM.get(this.getId(aValue));
413 }, 417 },
414 418
415 //------------------------------------------------------------------------- 419 //-------------------------------------------------------------------------
416 420
417 'hideElement': function(anElementName) { 421 'hideElement': function(anElementName) {
418 MochiKit.Style.hideElement(this.getElement(anElementName)); 422 MochiKit.Style.hideElement(this.getElement(anElementName));
419 }, 423 },
420 424
421 'showElement': function(anElementName) { 425 'showElement': function(anElementName) {
422 MochiKit.Style.showElement(this.getElement(anElementName)); 426 MochiKit.Style.showElement(this.getElement(anElementName));
423 }, 427 },
424 428
425 //------------------------------------------------------------------------- 429 //-------------------------------------------------------------------------
426 430
427 'activate': function () { 431 'activate': function () {
428 this._isActive = true; 432 this._isActive = true;
429 }, 433 },
430 434
431 'deactivate': function () { 435 'deactivate': function () {
432 this._isActive = false; 436 this._isActive = false;
433 }, 437 },
434 438
435 'isActive': function () { 439 'isActive': function () {
436 return this._isActive; 440 return this._isActive;
437 }, 441 },
438 442
439 //------------------------------------------------------------------------- 443 //-------------------------------------------------------------------------
440 444
441 'hideSlot': function(aSlotName) { 445 'hideSlot': function(aSlotName) {
442 if (this.componentForSlotNamed(aSlotName)) { 446 if (this.componentForSlotNamed(aSlotName)) {
443 this.componentForSlotNamed(aSlotName).deactivate(); 447 this.componentForSlotNamed(aSlotName).deactivate();
444 } 448 }
445 MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName)); 449 MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName));
446 }, 450 },
447 451
448 'showSlot': function(aSlotName) { 452 'showSlot': function(aSlotName) {
449 if (this.componentForSlotNamed(aSlotName)) { 453 if (this.componentForSlotNamed(aSlotName)) {
450 this.componentForSlotNamed(aSlotName).activate(); 454 this.componentForSlotNamed(aSlotName).activate();
451 } 455 }
452 MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName)); 456 MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName));
453 }, 457 },
454 458
455 //------------------------------------------------------------------------- 459 //-------------------------------------------------------------------------
456 460
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
index 716d851..1010c9d 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
@@ -17,89 +17,97 @@ refer to http://www.clipperz.com.
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
19 19
20* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 21 License along with Clipperz Community Edition. If not, see
22 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
23 23
24*/ 24*/
25 25
26Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); 26Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
27 27
28Clipperz.PM.UI.Common.Components.Button = function(args) { 28Clipperz.PM.UI.Common.Components.Button = function(args) {
29 args = args || {}; 29 args = args || {};
30 30
31 Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); 31 Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments);
32 32
33 this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); 33 this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter');
34 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); 34 this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
35 this._isDefault = args.isDefault|| false; 35 this._isDefault = args.isDefault|| false;
36 36
37 this.render(); 37 this.render();
38 38
39 return this; 39 return this;
40} 40}
41 41
42//============================================================================= 42//=============================================================================
43 43
44Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { 44Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, {
45 45
46 //------------------------------------------------------------------------- 46 //-------------------------------------------------------------------------
47 47
48 'toString': function () { 48 'toString': function () {
49 return "Clipperz.PM.UI.Common.Components.Button component"; 49 return "Clipperz.PM.UI.Common.Components.Button component";
50 }, 50 },
51 51
52 //------------------------------------------------------------------------- 52 //-------------------------------------------------------------------------
53 53
54 'text': function () { 54 'text': function () {
55 return this._text; 55 return this._text;
56 }, 56 },
57 57
58 'isDefault': function () { 58 'isDefault': function () {
59 return this._isDefault; 59 return this._isDefault;
60 }, 60 },
61 61
62 //------------------------------------------------------------------------- 62 //-------------------------------------------------------------------------
63 63
64 'renderSelf': function () { 64 'renderSelf': function () {
65 this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[ 65/*
66 this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[
66 {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ 67 {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[
67 {tag:'div', id:this.getId('body'), cls:'button_body', children:[ 68 {tag:'div', id:this.getId('body'), cls:'button_body', children:[
68 {tag:'span', html:this.text()} 69 {tag:'span', html:this.text()}
69 ]}, 70 ]},
70 {tag:'div', id:this.getId('footer'), cls:'button_footer'} 71 {tag:'div', id:this.getId('footer'), cls:'button_footer'}
71 ]} 72 ]}
72 ]}); 73 ]});
74*/
75/*
76 this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[
77 {tag:'span', html:this.text()}
78 ]});
79*/
80 this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()});
73 81
74 if (this.isDefault()) { 82 if (this.isDefault()) {
75 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default'); 83 MochiKit.DOM.addElementClass(this.getId('button'), 'default');
76 } 84 }
77 85
78 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter',this, 'handleOnMouseEnter'); 86 // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter');
79 MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave',this, 'handleOnMouseLeave'); 87 // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave');
80 MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown',this, 'handleOnMouseDown'); 88 // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown');
81 MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick'); 89 MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick');
82 }, 90 },
83 91
84 //------------------------------------------------------------------------- 92 //-------------------------------------------------------------------------
85 93/*
86 'handleOnMouseEnter': function (anEvent) { 94 'handleOnMouseEnter': function (anEvent) {
87 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover'); 95 MochiKit.DOM.addElementClass(this.getId('button'), 'hover');
88 }, 96 },
89 97
90 'handleOnMouseLeave': function (anEvent) { 98 'handleOnMouseLeave': function (anEvent) {
91 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover'); 99 MochiKit.DOM.removeElementClass(this.getId('button'), 'hover');
92 MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked'); 100 MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked');
93 }, 101 },
94 102
95 'handleOnMouseDown': function (anEvent) { 103 'handleOnMouseDown': function (anEvent) {
96 MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked'); 104 MochiKit.DOM.addElementClass(this.getId('button'), 'clicked');
97 }, 105 },
98 106 */
99 'handleOnClick': function (anEvent) { 107 'handleOnClick': function (anEvent) {
100 MochiKit.Signal.signal(this, 'onclick', anEvent); 108 MochiKit.Signal.signal(this, 'onclick', anEvent);
101 }, 109 },
102 110
103 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
104 __syntaxFix__: "syntax fix" 112 __syntaxFix__: "syntax fix"
105}); 113});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
index 1992154..1d816a9 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
@@ -53,141 +53,159 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe
53 return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component"; 53 return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component";
54 }, 54 },
55 55
56 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
57 57
58 'deferred': function() { 58 'deferred': function() {
59 if (this._deferred == null) { 59 if (this._deferred == null) {
60 this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false}); 60 this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false});
61 } 61 }
62 62
63 return this._deferred; 63 return this._deferred;
64 }, 64 },
65 65
66 //------------------------------------------------------------------------- 66 //-------------------------------------------------------------------------
67 67
68 'title': function () { 68 'title': function () {
69 return this._title; 69 return this._title;
70 }, 70 },
71 71
72 'setTitle': function (aValue) { 72 'setTitle': function (aValue) {
73 this._title = aValue; 73 this._title = aValue;
74 74
75 if (this.getElement('title') != null) { 75 if (this.getElement('title') != null) {
76 this.getElement('title').innerHTML = aValue; 76 this.getElement('title').innerHTML = aValue;
77 } 77 }
78 }, 78 },
79 79
80 //------------------------------------------------------------------------- 80 //-------------------------------------------------------------------------
81 81
82 'text': function () { 82 'text': function () {
83 return this._text; 83 return this._text;
84 }, 84 },
85 85
86 'setText': function (aValue) { 86 'setText': function (aValue) {
87 this._text = aValue; 87 this._text = aValue;
88 88
89 if (this.getElement('text') != null) { 89 if (this.getElement('text') != null) {
90 this.getElement('text').innerHTML = aValue; 90 this.getElement('text').innerHTML = aValue;
91 } 91 }
92 }, 92 },
93 93
94 //------------------------------------------------------------------------- 94 //-------------------------------------------------------------------------
95 95
96 'type': function () { 96 'type': function () {
97 return this._type; 97 return this._type;
98 }, 98 },
99 99
100 'setType': function (aValue) { 100 'setType': function (aValue) {
101 if (this.getElement('icon') != null) { 101 // if (this.getElement('icon') != null) {
102 MochiKit.DOM.removeElementClass(this.getId('icon'), this._type); 102 // MochiKit.DOM.removeElementClass(this.getId('icon'), this._type);
103 MochiKit.DOM.addElementClass(this.getId('icon'), aValue); 103 // MochiKit.DOM.addElementClass(this.getId('icon'), aValue);
104 } 104 // }
105 105
106 this._type = aValue; 106 this._type = aValue;
107 }, 107 },
108 108
109 'icon': function () {
110 var type = this.type();
111 var result;
112
113 if (type == 'ALERT') {
114 result = '!';
115 } else if (type == 'INFO') {
116 result = 'i';
117 } else if (type == 'ERROR') {
118 result = '!';
119 }
120
121 return result;
122 },
123
109 //------------------------------------------------------------------------- 124 //-------------------------------------------------------------------------
110 125
111 'buttons': function () { 126 'buttons': function () {
112 return this._buttons; 127 return this._buttons;
113 }, 128 },
114 129
115 'setButtons': function (someValues) { 130 'setButtons': function (someValues) {
116 MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear')); 131 MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear'));
117 132
118 this._buttons = someValues; 133 this._buttons = someValues;
119 134
120 if (this.getElement('buttonArea') != null) { 135 if (this.getElement('buttonArea') != null) {
121 this.renderButtons(); 136 this.renderButtons();
122 } 137 }
123 }, 138 },
124 139
125 //......................................................................... 140 //.........................................................................
126 141
127 'buttonComponents': function () { 142 'buttonComponents': function () {
128 return this._buttonComponents; 143 return this._buttonComponents;
129 }, 144 },
130 145
131 //------------------------------------------------------------------------- 146 //-------------------------------------------------------------------------
132 147
133 'renderSelf': function() { 148 'renderSelf': function() {
134 this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [ 149 this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [
135 {tag:'div', cls:'header', children:[]}, 150 // {tag:'div', cls:'header', children:[]},
136 {tag:'div', cls:'body', children:[ 151 {tag:'div', cls:'body', children:[
137 {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]}, 152 // {tag:'div', id:this.getId('icon'),cls:'img ' + this.type(), children:[{tag:'div'}]},
153 {tag:'div', /*id:this.getId('icon'),*/cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]},
138 {tag:'h3', id:this.getId('title'),html:this.title()}, 154 {tag:'h3', id:this.getId('title'),html:this.title()},
139 {tag:'p', id:this.getId('text'),html:this.text()}, 155 {tag:'p', id:this.getId('text'),html:this.text()},
140 {tag:'div', id:this.getId('container')}, 156 {tag:'div', id:this.getId('container')},
141 {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]} 157 {tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]}
142 ]}, 158 ]}
143 {tag:'div', cls:'footer', children:[]} 159 // {tag:'div', cls:'footer', children:[]}
144 ]}); 160 ]});
145 161
162 Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff");
163
146 MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler'); 164 MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler');
147 165
148 this.renderButtons(); 166 this.renderButtons();
149 }, 167 },
150 168
151 //------------------------------------------------------------------------- 169 //-------------------------------------------------------------------------
152 170
153 'renderButtons': function () { 171 'renderButtons': function () {
154 this.getElement('buttonArea').innerHTML = ''; 172 this.getElement('buttonArea').innerHTML = '';
155 173
156 MochiKit.Base.map(MochiKit.Base.bind(function (aButton) { 174 MochiKit.Base.map(MochiKit.Base.bind(function (aButton) {
157 var buttonElement; 175 var buttonElement;
158 var buttonComponent; 176 var buttonComponent;
159 177
160 // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[ 178 // element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[
161 // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']} 179 // {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']}
162 // ]}); 180 // ]});
163 181
164 buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'}); 182 buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'});
165 buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']}); 183 buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']});
166 this.buttonComponents().push(buttonComponent); 184 this.buttonComponents().push(buttonComponent);
167 185
168 MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton)); 186 MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton));
169 }, this), MochiKit.Iter.reversed(this.buttons())); 187 }, this), MochiKit.Iter.reversed(this.buttons()));
170 }, 188 },
171 189
172 //------------------------------------------------------------------------- 190 //-------------------------------------------------------------------------
173 191
174 'displayElement': function() { 192 'displayElement': function() {
175 return this.getElement('panel'); 193 return this.getElement('panel');
176 }, 194 },
177 195
178 //------------------------------------------------------------------------- 196 //-------------------------------------------------------------------------
179 197
180 'closeOk': function () { 198 'closeOk': function () {
181 this.deferred().callback(); 199 this.deferred().callback();
182 this._deferred = null; 200 this._deferred = null;
183 }, 201 },
184 202
185 'closeCancel': function () { 203 'closeCancel': function () {
186 this.deferred().cancel(); 204 this.deferred().cancel();
187 this._deferred = null; 205 this._deferred = null;
188 }, 206 },
189 207
190 'closeError': function () { 208 'closeError': function () {
191 this.deferred().errback(); 209 this.deferred().errback();
192 this._deferred = null; 210 this._deferred = null;
193 }, 211 },