Diffstat (limited to 'frontend/delta/js/Clipperz/PM/DataModel/DirectLoginFormValue.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/delta/js/Clipperz/PM/DataModel/DirectLoginFormValue.js | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/frontend/delta/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/delta/js/Clipperz/PM/DataModel/DirectLoginFormValue.js new file mode 100644 index 0000000..2429f88 --- a/dev/null +++ b/frontend/delta/js/Clipperz/PM/DataModel/DirectLoginFormValue.js | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | ||
27 | |||
28 | |||
29 | //############################################################################# | ||
30 | |||
31 | Clipperz.PM.DataModel.DirectLoginFormValue = function(aDirectLogin, args) { | ||
32 | args = args || {}; | ||
33 | |||
34 | this._directLogin = aDirectLogin|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
35 | |||
36 | this._key = args.key || Clipperz.Base.exception.raise('MandatoryParameter'); | ||
37 | this._fieldOptions = args.fieldOptions|| Clipperz.Base.exception.raise('MandatoryParameter'); | ||
38 | this._value = args.value || null; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null, { | ||
44 | |||
45 | 'toString': function() { | ||
46 | return "DirectLoginFormValue (" + this.key() + ", " + this.value() + ")"; | ||
47 | }, | ||
48 | |||
49 | //------------------------------------------------------------------------- | ||
50 | |||
51 | 'directLogin': function () { | ||
52 | return this._directLogin; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'key': function() { | ||
58 | return this._key; | ||
59 | }, | ||
60 | |||
61 | //------------------------------------------------------------------------- | ||
62 | |||
63 | 'fieldOptions': function() { | ||
64 | return this._fieldOptions; | ||
65 | }, | ||
66 | |||
67 | //------------------------------------------------------------------------- | ||
68 | |||
69 | 'type': function () { | ||
70 | return this.fieldOptions()['type']; | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | |||
75 | 'value': function() { | ||
76 | varresult; | ||
77 | |||
78 | result = this._value; | ||
79 | |||
80 | // if ((result == null) && (this.type() == 'checkbox')) { | ||
81 | // result = false; | ||
82 | // }; | ||
83 | |||
84 | return result; | ||
85 | }, | ||
86 | |||
87 | 'setValue': function (aValue) { | ||
88 | this._value = aValue; | ||
89 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); | ||
90 | }, | ||
91 | |||
92 | //------------------------------------------------------------------------- | ||
93 | /* | ||
94 | 'serializedData': function() { | ||
95 | return this.value(); | ||
96 | }, | ||
97 | */ | ||
98 | //------------------------------------------------------------------------- | ||
99 | __syntaxFix__: "syntax fix" | ||
100 | }); | ||
101 | |||