Diffstat (limited to 'frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js index 0e2b7ad..e5e9ad5 100644 --- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js +++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js | |||
@@ -1,118 +1,116 @@ | |||
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 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | //############################################################################# | 28 | //############################################################################# |
31 | 29 | ||
32 | Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) { | 30 | Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) { |
33 | args = args || {}; | 31 | args = args || {}; |
34 | 32 | ||
35 | //console.log(">>> new DirectLoginInput - args: %o" + args); | 33 | //console.log(">>> new DirectLoginInput - args: %o" + args); |
36 | this._directLogin = aDirectLogin; | 34 | this._directLogin = aDirectLogin; |
37 | this._args = args; | 35 | this._args = args; |
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | 40 | Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { |
43 | 41 | ||
44 | 'directLogin': function() { | 42 | 'directLogin': function() { |
45 | return this._directLogin; | 43 | return this._directLogin; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'args': function() { | 48 | 'args': function() { |
51 | return this._args; | 49 | return this._args; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | 53 | ||
56 | 'name': function() { | 54 | 'name': function() { |
57 | return this.args()['name']; | 55 | return this.args()['name']; |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'type': function() { | 60 | 'type': function() { |
63 | var result; | 61 | var result; |
64 | 62 | ||
65 | result = this.args()['type']; | 63 | result = this.args()['type']; |
66 | 64 | ||
67 | if (result != null) { | 65 | if (result != null) { |
68 | result = result.toLowerCase(); | 66 | result = result.toLowerCase(); |
69 | } | 67 | } |
70 | return result; | 68 | return result; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'value': function() { | 73 | 'value': function() { |
76 | return this.args()['value']; | 74 | return this.args()['value']; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //------------------------------------------------------------------------- | 77 | //------------------------------------------------------------------------- |
80 | 78 | ||
81 | 'formConfiguration': function() { | 79 | 'formConfiguration': function() { |
82 | var result; | 80 | var result; |
83 | 81 | ||
84 | //MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name()); | 82 | //MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name()); |
85 | if (this.shouldSetValue()) { | 83 | if (this.shouldSetValue()) { |
86 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1"); | 84 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1"); |
87 | switch (this.type()) { | 85 | switch (this.type()) { |
88 | case 'select': | 86 | case 'select': |
89 | var currentValue; | 87 | var currentValue; |
90 | var options; | 88 | var options; |
91 | 89 | ||
92 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2"); | 90 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2"); |
93 | currentValue = this.directLogin().formValues()[this.name()]; | 91 | currentValue = this.directLogin().formValues()[this.name()]; |
94 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1"); | 92 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1"); |
95 | options = this.args()['options']; | 93 | options = this.args()['options']; |
96 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2"); | 94 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2"); |
97 | 95 | ||
98 | result = MochiKit.DOM.SELECT({name:this.name()}, | 96 | result = MochiKit.DOM.SELECT({name:this.name()}, |
99 | MochiKit.Base.map(function(anOption) { | 97 | MochiKit.Base.map(function(anOption) { |
100 | var options; | 98 | var options; |
101 | 99 | ||
102 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3"); | 100 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3"); |
103 | //TODO: remove the value: field and replace it with element.dom.value = <some value> | 101 | //TODO: remove the value: field and replace it with element.dom.value = <some value> |
104 | options = {value:anOption['value']}; | 102 | options = {value:anOption['value']}; |
105 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4"); | 103 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4"); |
106 | if (currentValue == anOption['value']) { | 104 | if (currentValue == anOption['value']) { |
107 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5"); | 105 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5"); |
108 | options.selected = true; | 106 | options.selected = true; |
109 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6"); | 107 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6"); |
110 | } | 108 | } |
111 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7"); | 109 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7"); |
112 | 110 | ||
113 | return MochiKit.DOM.OPTION(options, anOption['label']) | 111 | return MochiKit.DOM.OPTION(options, anOption['label']) |
114 | }, options) | 112 | }, options) |
115 | ) | 113 | ) |
116 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8"); | 114 | //MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8"); |
117 | break; | 115 | break; |
118 | case 'checkbox': | 116 | case 'checkbox': |