Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js new file mode 100644 index 0000000..e833190 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | //############################################################################# | ||
32 | |||
33 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { | ||
34 | args = args || {}; | ||
35 | Clipperz.PM.UI.Web.Components.LinkColumnManager.superclass.constructor.call(this, args); | ||
36 | |||
37 | this._actionMethod = args.actionMethod || null; | ||
38 | |||
39 | return this; | ||
40 | } | ||
41 | |||
42 | //============================================================================= | ||
43 | |||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LinkColumnManager, Clipperz.PM.UI.Web.Components.ColumnManager, { | ||
45 | |||
46 | 'toString': function () { | ||
47 | return "Clipperz.PM.UI.Web.Components.DateColumnManager component"; | ||
48 | }, | ||
49 | |||
50 | //------------------------------------------------------------------------- | ||
51 | |||
52 | 'actionMethod': function () { | ||
53 | return this._actionMethod; | ||
54 | }, | ||
55 | |||
56 | //------------------------------------------------------------------------- | ||
57 | |||
58 | 'renderCell': function(aRowElement, anObject) { | ||
59 | vartdElement; | ||
60 | varlinkElement; | ||
61 | |||
62 | tdElement = Clipperz.DOM.Helper.append(aRowElement, {tag:'td', cls:this.cssClass(), children:[ | ||
63 | {tag:'span', children:[ | ||
64 | {tag:'a', href:'#', html:anObject[this.name()]} | ||
65 | ]} | ||
66 | ]}); | ||
67 | |||
68 | linkElement = MochiKit.DOM.getFirstElementByTagAndClassName('a', null, tdElement); | ||
69 | // MochiKit.Signal.connect(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
70 | this.connectEvent(linkElement, 'onclick', MochiKit.Base.method(this, 'handleLinkClick', anObject['_rowObject'])); | ||
71 | }, | ||
72 | |||
73 | //----------------------------------------------------- | ||
74 | |||
75 | 'handleLinkClick': function (anObject, anEvent) { | ||
76 | anEvent.preventDefault(); | ||
77 | |||
78 | if (this.actionMethod() != null) { | ||
79 | var deferredResult; | ||
80 | |||
81 | deferredResult = new Clipperz.Async.Deferred("LinkColumnManager.handleLinkClick", {trace:false}); | ||
82 | // deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'selectRow', anObject); | ||
83 | deferredResult.addCallback(this.actionMethod(), anObject, anEvent); | ||
84 | // deferredResult.addBothPass(MochiKit.Signal.signal, this, 'unselectRow', anObject); | ||
85 | deferredResult.callback(); | ||
86 | } | ||
87 | }, | ||
88 | |||
89 | //----------------------------------------------------- | ||
90 | '__syntax_fix__' : 'syntax fix' | ||
91 | }); | ||
92 | |||