author | Giulio Cesare Solaroli <giulio.cesare@solaroli.it> | 2011-10-03 16:04:12 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@solaroli.it> | 2011-10-03 16:04:12 (UTC) |
commit | 541bb378ddece2eab135a8066a16994e94436dea (patch) (unidiff) | |
tree | ff160ea3e26f7fe07fcfd401387c5a0232ca715e /frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js | |
parent | 1bf431fd3d45cbdf4afa3e12afefe5d24f4d3bc7 (diff) | |
parent | ecad5e895831337216544e81f1a467e0c68c4a6a (diff) | |
download | clipperz-541bb378ddece2eab135a8066a16994e94436dea.zip clipperz-541bb378ddece2eab135a8066a16994e94436dea.tar.gz clipperz-541bb378ddece2eab135a8066a16994e94436dea.tar.bz2 |
Merge pull request #1 from gcsolaroli/master
First version of the restructured repository
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js new file mode 100644 index 0000000..28401a2 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js | |||
@@ -0,0 +1,145 @@ | |||
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 | /* | ||
30 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | ||
31 | |||
32 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { | ||
33 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); | ||
34 | |||
35 | return this; | ||
36 | }; | ||
37 | |||
38 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, { | ||
39 | |||
40 | 'createGrid': function () { | ||
41 | return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ | ||
42 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ | ||
43 | 'name': 'DirectLogins.favicon', | ||
44 | 'selector': MochiKit.Base.methodcaller('favicon'), | ||
45 | 'cssClass': 'favicon' | ||
46 | }), | ||
47 | // new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | ||
48 | new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({ | ||
49 | 'name': 'DirectLogins.title', | ||
50 | 'selector': MochiKit.Base.methodcaller('label'), | ||
51 | 'label': 'title', | ||
52 | 'cssClass': 'title', | ||
53 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | ||
54 | 'sortable': true, | ||
55 | 'sorted': 'ASCENDING', | ||
56 | 'actionMethod': MochiKit.Base.methodcaller('runDirectLogin') | ||
57 | }), | ||
58 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager | ||
59 | // 'label':'strength', | ||
60 | // 'cssClass':'title', | ||
61 | // 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function | ||
62 | // }), | ||
63 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | ||
64 | 'name': 'DirectLogins.cardTitle', | ||
65 | 'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')), | ||
66 | 'label': 'card', | ||
67 | 'cssClass': 'cardTitle', | ||
68 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | ||
69 | 'sortable': true, | ||
70 | 'sorted': 'UNSORTED', | ||
71 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') | ||
72 | }), | ||
73 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager | ||
74 | // 'label':'last access', | ||
75 | // 'cssClass':'title', | ||
76 | // 'selector': MochiKit.Base.methodcaller('label') | ||
77 | // // 'sortable': true, | ||
78 | // // 'sorted': 'UNSORTED' | ||
79 | // }), | ||
80 | // new Clipperz.PM.UI.Web.Components.TextColumnManager({ | ||
81 | // 'label':'commands', | ||
82 | // 'cssClass':'title', | ||
83 | // 'selector': MochiKit.Base.methodcaller('label'), //should be a function for commands display | ||
84 | // }), | ||
85 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ | ||
86 | 'name': 'DirectLogins.delete', | ||
87 | 'selector': MochiKit.Base.noop, | ||
88 | 'cssClass': 'delete', | ||
89 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteDirectLogin', {objectData:anObject, element:anEvent.src()})} | ||
90 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteDirectLogin') | ||
91 | }) | ||
92 | ]}); | ||
93 | |||
94 | }, | ||
95 | |||
96 | //----------------------------------------------------------------------------- | ||
97 | |||
98 | 'getRows': function () { | ||
99 | //TODO: relying on user() in GridController, bad code smell :| | ||
100 | return this.user().getDirectLogins(); | ||
101 | }, | ||
102 | |||
103 | //----------------------------------------------------------------------------- | ||
104 | |||
105 | 'handleShowCard': function (anObject, anEvent) { | ||
106 | var cardDialogController; | ||
107 | |||
108 | cardDialogController = new Clipperz.PM.UI.Web.Controllers.CardDialogController({record:anObject.record()}) | ||
109 | cardDialogController.run(anEvent.src()); | ||
110 | }, | ||
111 | |||
112 | //----------------------------------------------------------------------------- | ||
113 | |||
114 | 'handleDeleteDirectLogin': function (anObject, anEvent) { | ||
115 | var deferredResult; | ||
116 | var confirmationDialog; | ||
117 | |||
118 | confirmationDialog = new Clipperz.PM.UI.Common.Components.SimpleMessagePanel({ | ||
119 | title:"Delete DirectLogin", | ||
120 | text:"Do you want to delete …", | ||
121 | type:'ALERT', | ||
122 | buttons: [ | ||
123 | {text:"Cancel",result:'CANCEL', isDefault:true}, | ||
124 | {text:"Delete", result:'OK'} | ||
125 | ] | ||
126 | }); | ||
127 | |||
128 | deferredResult = new Clipperz.Async.Deferred("AppController.handleDeleteCard", {trace:false}); | ||
129 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | ||
130 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | ||
131 | 'openFromElement': anEvent.src(), | ||
132 | 'onOkCloseToElement': null, //MochiKit.DOM.currentDocument().body, | ||
133 | 'onCancelCloseToElement':anEvent.src() | ||
134 | }); | ||
135 | deferredResult.addCallback(function () { Clipperz.log("DELETE: " + anObject.toString(), anObject); }); | ||
136 | deferredResult.addErrbackPass(function () { Clipperz.log("skip deletion: " + anObject.toString(), anObject); }); | ||
137 | deferredResult.callback(); | ||
138 | |||
139 | return deferredResult; | ||
140 | }, | ||
141 | |||
142 | //----------------------------------------------------------------------------- | ||
143 | __syntaxFix__: "syntax fix" | ||
144 | }); | ||
145 | */ \ No newline at end of file | ||