Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | 22 |
1 files changed, 10 insertions, 12 deletions
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 1010c9d..1268118 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,113 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._isDefault = args.isDefault|| false; | 33 | this._isDefault = args.isDefault|| false; |
36 | 34 | ||
37 | this.render(); | 35 | this.render(); |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | //============================================================================= | 40 | //============================================================================= |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, { |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'toString': function () { | 46 | 'toString': function () { |
49 | return "Clipperz.PM.UI.Common.Components.Button component"; | 47 | return "Clipperz.PM.UI.Common.Components.Button component"; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'text': function () { | 52 | 'text': function () { |
55 | return this._text; | 53 | return this._text; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | 'isDefault': function () { | 56 | 'isDefault': function () { |
59 | return this._isDefault; | 57 | return this._isDefault; |
60 | }, | 58 | }, |
61 | 59 | ||
62 | //------------------------------------------------------------------------- | 60 | //------------------------------------------------------------------------- |
63 | 61 | ||
64 | 'renderSelf': function () { | 62 | 'renderSelf': function () { |
65 | /* | 63 | /* |
66 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ | 64 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[ |
67 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ | 65 | {tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[ |
68 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ | 66 | {tag:'div', id:this.getId('body'), cls:'button_body', children:[ |
69 | {tag:'span', html:this.text()} | 67 | {tag:'span', html:this.text()} |
70 | ]}, | 68 | ]}, |
71 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} | 69 | {tag:'div', id:this.getId('footer'), cls:'button_footer'} |
72 | ]} | 70 | ]} |
73 | ]}); | 71 | ]}); |
74 | */ | 72 | */ |
75 | /* | 73 | /* |
76 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ | 74 | this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[ |
77 | {tag:'span', html:this.text()} | 75 | {tag:'span', html:this.text()} |
78 | ]}); | 76 | ]}); |
79 | */ | 77 | */ |
80 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); | 78 | this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()}); |
81 | 79 | ||
82 | if (this.isDefault()) { | 80 | if (this.isDefault()) { |
83 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); | 81 | MochiKit.DOM.addElementClass(this.getId('button'), 'default'); |
84 | } | 82 | } |
85 | 83 | ||
86 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); | 84 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseenter',this, 'handleOnMouseEnter'); |
87 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); | 85 | // MochiKit.Signal.connect(this.getId('button'), 'onmouseleave',this, 'handleOnMouseLeave'); |
88 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); | 86 | // MochiKit.Signal.connect(this.getId('button'), 'onmousedown',this, 'handleOnMouseDown'); |
89 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); | 87 | MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick'); |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //------------------------------------------------------------------------- | 90 | //------------------------------------------------------------------------- |
93 | /* | 91 | /* |
94 | 'handleOnMouseEnter': function (anEvent) { | 92 | 'handleOnMouseEnter': function (anEvent) { |
95 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); | 93 | MochiKit.DOM.addElementClass(this.getId('button'), 'hover'); |
96 | }, | 94 | }, |
97 | 95 | ||
98 | 'handleOnMouseLeave': function (anEvent) { | 96 | 'handleOnMouseLeave': function (anEvent) { |
99 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); | 97 | MochiKit.DOM.removeElementClass(this.getId('button'), 'hover'); |
100 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); | 98 | MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked'); |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'handleOnMouseDown': function (anEvent) { | 101 | 'handleOnMouseDown': function (anEvent) { |
104 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); | 102 | MochiKit.DOM.addElementClass(this.getId('button'), 'clicked'); |
105 | }, | 103 | }, |
106 | */ | 104 | */ |
107 | 'handleOnClick': function (anEvent) { | 105 | 'handleOnClick': function (anEvent) { |
108 | MochiKit.Signal.signal(this, 'onclick', anEvent); | 106 | MochiKit.Signal.signal(this, 'onclick', anEvent); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | __syntaxFix__: "syntax fix" | 110 | __syntaxFix__: "syntax fix" |
113 | }); | 111 | }); |