summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js39
1 files changed, 11 insertions, 28 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
index f77ea80..5681f70 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js
@@ -1,41 +1,38 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) {
throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!";
}
if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; }
Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) {
Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments);
-//console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args);
this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({
'name': 'recordsData',
'retrieveKeyFunction': args.retrieveKeyFunction,
'remoteData': {
'data': args.recordsData['data'],
'version': args.encryptedDataVersion,
@@ -115,13 +112,12 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, {
}
return this._transientState;
},
'resetTransientState': function (isCommitting) {
-//console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState));
if (this._transientState != null) {
this._transientState.removeAllData();
}
this._transientState = null;
},
@@ -155,21 +151,19 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, {
'getDirectLoginIndexData': function (aDirectLoginReference) {
return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]);
},
'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) {
-//console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey);
//if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) {
// throw "PIPPO";
//}
return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue);
},
'addDirectLoginIndexData': function (aDirectLoginReference) {
-//console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]);
return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {});
},
'removeDirectLoginIndexData': function (aDirectLoginReference) {
return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference])
},
@@ -258,18 +252,13 @@ Clipperz.log("SKIPPING record " + reference + " as there are no stas associated
// directLogin = new Clipperz.PM.DataModel.DirectLogin({
new Clipperz.PM.DataModel.DirectLogin({
'reference': reference,
'record': record
});
} else {
-Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
-//console.log("direct login data", someData['directLogins']);
-//console.log("current direct login data", someData['directLogins'][indexReference])
-//console.log("reference", reference);
-//console.log("record index", this.recordsIndex());
-//console.log("record inverted index", recordsInvertedIndex);
+ Clipperz.logWarning("WARNING: DIRECT LOGIN without a matching RECORD!!");
}
}
return this._records;
}, this));
innerDeferredResult.callback();
@@ -302,13 +291,12 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
//.........................................................................
'createNewRecord': function () {
var deferredResult;
var newRecord;
-//console.log("#### new Clipperz.PM.DataModel.Record [4]");
newRecord = new Clipperz.PM.DataModel.Record({
'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'),
'retrieveRemoteDataFunction': this.retrieveRecordDetailFunction(),
'retrieveIndexDataFunction': MochiKit.Base.method(this, 'getRecordIndexData'),
'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'),
@@ -383,15 +371,13 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord});
newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1;
this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin);
-//console.log("UserHeaderRecordIndex.createNewDirectLogin [1]", newDirectLogin.reference(), newDirectLoginIndexValue);
this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue;
-//console.log("UserHeaderRecordIndex.createNewDirectLogin [2]", newDirectLogin.reference(), this.directLoginsIndex()[newDirectLogin.reference()]);
this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]});
return newDirectLogin;
},
//=========================================================================
@@ -428,13 +414,12 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
// MochiKit.Base.method(this, 'records'),
// MochiKit.Base.values,
// MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')),
// Clipperz.Async.collectAll
// ]
});
-//deferredResult.addCallback(function (aValue) { console.log("USER.Header.RecordIndex.hasAnyCleanTextData", aValue); return aValue});
// deferredResult.addCallback(MochiKit.Base.values);
// deferredResult.addCallback(MochiKit.Base.flattenArguments);
// deferredResult.addCallback(function(someValues) {
// return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
// });
@@ -458,13 +443,12 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
],
'directLoginsData': [
MochiKit.Base.method(this, 'directLoginsData'),
MochiKit.Base.methodcaller('hasPendingChanges')
]
});
-//deferredResult.addCallback(function (aValue) { console.log("UserHeaderIndex.hasPendingResults", aValue); return aValue; });
deferredResult.addCallback(Clipperz.Async.or);
// deferredResult.addCallback(MochiKit.Base.values);
// deferredResult.addCallback(MochiKit.Base.flattenArguments);
// deferredResult.addCallback(function(someValues) {
// return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity);
// });
@@ -567,13 +551,12 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!");
// "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x"
// },
var deferredResult;
var result;
-//console.log("recordsIndex", this.recordsIndex());
result = {};
deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false});
deferredResult.collectResults({
'index': MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()),
'data': [