Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js index f51bbc2..986db40 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.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 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { |
31 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.Field.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._recordVersion = args.recordVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
34 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); | 32 | this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { | 38 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, { |
41 | 39 | ||
42 | 'toString': function() { | 40 | 'toString': function() { |
43 | return "Record.Version.Field (" + this.reference() + ")"; | 41 | return "Record.Version.Field (" + this.reference() + ")"; |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'recordVersion': function () { | 46 | 'recordVersion': function () { |
49 | return this._recordVersion; | 47 | return this._recordVersion; |
50 | }, | 48 | }, |
51 | 49 | ||
52 | //------------------------------------------------------------------------- | 50 | //------------------------------------------------------------------------- |
53 | 51 | ||
54 | 'reference': function () { | 52 | 'reference': function () { |
55 | return this._reference; | 53 | return this._reference; |
56 | }, | 54 | }, |
57 | 55 | ||
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'getItem': function (aKey) { | 58 | 'getItem': function (aKey) { |
61 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ | 59 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ |
62 | MochiKit.Base.method(this, 'recordVersion'), | 60 | MochiKit.Base.method(this, 'recordVersion'), |
63 | MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey) | 61 | MochiKit.Base.methodcaller('getValue', 'fields' + '.' + this.reference() + '.' + aKey) |
64 | ], {trace:false}); | 62 | ], {trace:false}); |
65 | }, | 63 | }, |
66 | 64 | ||
67 | 'setItem': function (aKey, aValue) { | 65 | 'setItem': function (aKey, aValue) { |
68 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ | 66 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.getItem", [ |
69 | MochiKit.Base.method(this, 'recordVersion'), | 67 | MochiKit.Base.method(this, 'recordVersion'), |
70 | MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue) | 68 | MochiKit.Base.methodcaller('setValue', 'fields' + '.' + this.reference() + '.' + aKey, aValue) |
71 | ], {trace:false}); | 69 | ], {trace:false}); |
72 | }, | 70 | }, |
73 | 71 | ||
74 | //------------------------------------------------------------------------- | 72 | //------------------------------------------------------------------------- |
75 | 73 | ||
76 | 'label': function () { | 74 | 'label': function () { |
77 | return this.getItem('label'); | 75 | return this.getItem('label'); |
78 | }, | 76 | }, |
79 | 77 | ||
80 | 'setLabel': function (aValue) { | 78 | 'setLabel': function (aValue) { |
81 | return this.setItem('label', aValue); | 79 | return this.setItem('label', aValue); |
82 | }, | 80 | }, |
83 | 81 | ||
84 | //------------------------------------------------------------------------- | 82 | //------------------------------------------------------------------------- |
85 | 83 | ||
86 | 'value': function () { | 84 | 'value': function () { |
87 | return this.getItem('value'); | 85 | return this.getItem('value'); |
88 | }, | 86 | }, |
89 | 87 | ||
90 | 'setValue': function (aValue) { | 88 | 'setValue': function (aValue) { |
91 | return this.setItem('value', aValue); | 89 | return this.setItem('value', aValue); |
92 | }, | 90 | }, |
93 | 91 | ||
94 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
95 | 93 | ||
96 | 'actionType': function () { | 94 | 'actionType': function () { |
97 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [ | 95 | return Clipperz.Async.callbacks("Clipperz.PM.DataModel.Record.Version.Field.actionType", [ |
98 | Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", { | 96 | Clipperz.Async.collectResults("Clipperz.PM.DataModel.Record.Version.Field.actionType [collect results]", { |
99 | 'isHidden':MochiKit.Base.method(this, 'isHidden'), | 97 | 'isHidden':MochiKit.Base.method(this, 'isHidden'), |
100 | 'value':MochiKit.Base.method(this, 'value') | 98 | 'value':MochiKit.Base.method(this, 'value') |
101 | }, {trace:false}), | 99 | }, {trace:false}), |
102 | function (someValues) { | 100 | function (someValues) { |
103 | var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD' | 101 | var result; //'NONE', 'URL', 'EMAIL', 'PASSWORD' |
104 | 102 | ||
105 | result = 'NONE'; | 103 | result = 'NONE'; |
106 | 104 | ||
107 | if (someValues['isHidden']) { | 105 | if (someValues['isHidden']) { |
108 | result = 'PASSWORD'; | 106 | result = 'PASSWORD'; |
109 | } else if (Clipperz.Base.isUrl(someValues['value'])) { | 107 | } else if (Clipperz.Base.isUrl(someValues['value'])) { |
110 | result = 'URL' | 108 | result = 'URL' |
111 | } else if (Clipperz.Base.isEmail(someValues['value'])) { | 109 | } else if (Clipperz.Base.isEmail(someValues['value'])) { |
112 | result = 'EMAIL' | 110 | result = 'EMAIL' |
113 | }; | 111 | }; |
114 | 112 | ||
115 | return result; | 113 | return result; |
116 | } | 114 | } |
117 | ], {trace:false}); | 115 | ], {trace:false}); |
118 | }, | 116 | }, |