Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js index 6e50f8e..dd35fc9 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
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 | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | 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 | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; | 27 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | Clipperz.PM.DataModel.Record.Version = function(args) { | 30 | Clipperz.PM.DataModel.Record.Version = function(args) { |
34 | //console.log(">>> Record.new"); | 31 | //console.log(">>> Record.new"); |
35 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); | 32 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); |
36 | 33 | ||
37 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._fields = null; | 35 | this._fields = null; |
39 | 36 | ||
40 | return this; | 37 | return this; |
41 | } | 38 | } |
42 | 39 | ||
43 | 40 | ||
44 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 41 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
45 | 42 | ||
46 | 'toString': function() { | 43 | 'toString': function() { |
47 | return "Record.Version (" + this.reference() + ")"; | 44 | return "Record.Version (" + this.reference() + ")"; |
48 | }, | 45 | }, |
49 | 46 | ||
50 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
51 | 48 | ||
52 | 'reference': function () { | 49 | 'reference': function () { |
53 | return this._reference; | 50 | return this._reference; |
54 | }, | 51 | }, |
55 | 52 | ||
56 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
57 | /* | 54 | /* |
58 | 'hasPendingChanges': function () { | 55 | 'hasPendingChanges': function () { |
59 | var deferredResult; | 56 | var deferredResult; |
60 | 57 | ||
61 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false}); | 58 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChanges", {trace:false}); |
62 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this)); | 59 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.hasPendingChanges, this)); |
63 | deferredResult.callback(); | 60 | deferredResult.callback(); |
64 | 61 | ||
65 | return deferredResult; | 62 | return deferredResult; |
66 | }, | 63 | }, |
67 | */ | 64 | */ |
68 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
69 | 66 | ||
70 | 67 | ||
71 | 'hasPendingChangesWhenBrandNew': function () { | 68 | 'hasPendingChangesWhenBrandNew': function () { |
72 | var deferredResult; | 69 | var deferredResult; |
73 | 70 | ||
74 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false}); | 71 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.hasPendingChangesWhenBrandNew", {trace:false}); |
75 | deferredResult.addMethod(this, 'fields'); | 72 | deferredResult.addMethod(this, 'fields'); |
76 | deferredResult.addCallback(MochiKit.Base.values); | 73 | deferredResult.addCallback(MochiKit.Base.values); |
77 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty')) | 74 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.methodcaller('isEmpty')) |
78 | deferredResult.addCallback(Clipperz.Async.collectAll); | 75 | deferredResult.addCallback(Clipperz.Async.collectAll); |
79 | deferredResult.addCallback(function(someValues) { | 76 | deferredResult.addCallback(function(someValues) { |
80 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); | 77 | return MochiKit.Iter.every(someValues, MochiKit.Base.operator.identity); |
81 | }); | 78 | }); |
82 | deferredResult.addCallback(MochiKit.Base.operator.lognot) | 79 | deferredResult.addCallback(MochiKit.Base.operator.lognot) |
83 | deferredResult.callback(); | 80 | deferredResult.callback(); |
84 | 81 | ||
85 | return deferredResult; | 82 | return deferredResult; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //========================================================================= | 85 | //========================================================================= |
89 | 86 | ||
90 | 'commitTransientState': function () { | 87 | 'commitTransientState': function () { |
91 | var deferredResult; | 88 | var deferredResult; |
92 | 89 | ||
93 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); | 90 | deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.Record.Version.commitTransientState", {trace:false}); |
94 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); | 91 | deferredResult.addCallback(MochiKit.Base.bind(Clipperz.PM.DataModel.Record.Version.superclass.commitTransientState, this)); |
95 | deferredResult.callback(); | 92 | deferredResult.callback(); |
96 | 93 | ||
97 | return deferredResult; | 94 | return deferredResult; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | //========================================================================= | 97 | //========================================================================= |
101 | 98 | ||
102 | 'unpackData': function (someData) { //++ | 99 | 'unpackData': function (someData) { //++ |
103 | varresult; | 100 | varresult; |
104 | 101 | ||
105 | //console.log("Record.Version - UNPACK DATA", this, someData); | 102 | //console.log("Record.Version - UNPACK DATA", this, someData); |
106 | result = someData; | 103 | result = someData; |
107 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { | 104 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { |
108 | varfields; | 105 | varfields; |
109 | var i,c; | 106 | var i,c; |
110 | 107 | ||
111 | fields = someData['fields']; | 108 | fields = someData['fields']; |
112 | delete someData['fields']; | 109 | delete someData['fields']; |
113 | 110 | ||
114 | someData['fields'] = {}; | 111 | someData['fields'] = {}; |
115 | c = fields.length; | 112 | c = fields.length; |
116 | for (i=0; i<c; i++) { | 113 | for (i=0; i<c; i++) { |
117 | someData['fields'][i] = fields[i]; | 114 | someData['fields'][i] = fields[i]; |
118 | } | 115 | } |
119 | } | 116 | } |
120 | 117 | ||