summaryrefslogtreecommitdiff
path: root/frontend/gamma/js
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/Async.js4
-rw-r--r--frontend/gamma/js/Clipperz/Base.js5
-rw-r--r--frontend/gamma/js/Clipperz/PM/Connection.js34
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/User.js20
-rw-r--r--frontend/gamma/js/Clipperz/PM/PIN.js134
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js65
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js4
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js34
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js34
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js299
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js (renamed from frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js)111
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js356
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js393
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js17
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js18
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js14
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js8
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js31
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js163
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js178
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js369
-rw-r--r--frontend/gamma/js/main.mobile.js (renamed from frontend/gamma/js/main_iPhone.js)13
22 files changed, 1501 insertions, 803 deletions
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js
index 97d8ecf..f7a9517 100644
--- a/frontend/gamma/js/Clipperz/Async.js
+++ b/frontend/gamma/js/Clipperz/Async.js
@@ -132,580 +132,580 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
'addCallbackPass': function() {
var passFunction;
passFunction = MochiKit.Base.partial.apply(null, arguments);
this.addCallback(function() {
var result;
result = arguments[arguments.length -1];
passFunction();
return result;
});
},
//-----------------------------------------------------------------------------
'addErrbackPass': function() {
var passFunction;
passFunction = MochiKit.Base.partial.apply(null, arguments);
this.addErrback(function() {
var result;
result = arguments[arguments.length -1];
passFunction();
return result;
});
},
//-----------------------------------------------------------------------------
'addBothPass': function() {
var passFunction;
passFunction = MochiKit.Base.partial.apply(null, arguments);
this.addBoth(function() {
var result;
result = arguments[arguments.length -1];
passFunction();
return result;
});
},
//-----------------------------------------------------------------------------
'addIf': function (aThenBlock, anElseBlock) {
this.addCallback(MochiKit.Base.bind(function (aValue) {
var deferredResult;
if (!MochiKit.Base.isUndefinedOrNull(aValue) && aValue) {
deferredResult = Clipperz.Async.callbacks(this._name + " <then>", aThenBlock, null, aValue);
} else {
deferredResult = Clipperz.Async.callbacks(this._name + " <else>", anElseBlock, null, aValue);
}
return deferredResult;
}))
},
//-----------------------------------------------------------------------------
'addMethod': function () {
this.addCallback(MochiKit.Base.method.apply(this, arguments));
},
//-----------------------------------------------------------------------------
'addMethodcaller': function () {
this.addCallback(MochiKit.Base.methodcaller.apply(this, arguments));
},
//=============================================================================
'addLog': function (aLog) {
if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) {
this.addBothPass(function(res) {Clipperz.log(aLog + " ", res);});
// this.addBothPass(function(res) {console.log(aLog + " ", res);});
}
},
//=============================================================================
'acquireLock': function (aLock) {
// this.addCallback(function (aResult) {
// return Clipperz.Async.callbacks("Clipperz.Async.acquireLock", [
// MochiKit.Base.method(aLock, 'acquire'),
// MochiKit.Base.partial(MochiKit.Async.succeed, aResult)
// ], {trace:false});
// });
this.addCallback(MochiKit.Base.method(aLock, 'acquire'));
},
'releaseLock': function (aLock) {
// this.addCallback(function (aResult) {
// return Clipperz.Async.callbacks("Clipperz.Async.release <ok>", [
// MochiKit.Base.method(aLock, 'release'),
// MochiKit.Base.partial(MochiKit.Async.succeed, aResult)
// ], {trace:false});
// });
// this.addErrback(function (aResult) {
///console.log("releaseLock.addErrback:", aResult);
// return Clipperz.Async.callbacks("Clipperz.Async.release <fail>", [
// MochiKit.Base.method(aLock, 'release'),
// MochiKit.Base.partial(MochiKit.Async.fail, aResult)
// ], {trace:false});
// });
// this.addBothPass(MochiKit.Base.method(aLock, 'release'));
this.addCallbackPass(MochiKit.Base.method(aLock, 'release'));
this.addErrback(function (anError) {
aLock.release();
return anError;
});
},
//=============================================================================
'collectResults': function (someRequests) {
this.addCallback(Clipperz.Async.collectResults(this._name + " <collect results>", someRequests, this._args));
},
'addCallbackList': function (aRequestList) {
this.addCallback(Clipperz.Async.callbacks, this._name + " <callback list>", aRequestList, this._args);
},
//=============================================================================
'vars': function () {
if (this._vars == null) {
this._vars = {}
}
return this._vars;
},
'setValue': function (aKey) {
this.addCallback(MochiKit.Base.bind(function (aValue) {
this.vars()[aKey] = aValue;
return aValue;
}, this));
},
'getValue': function (aKey) {
this.addCallback(MochiKit.Base.bind(function () {
return this.vars()[aKey];
}, this));
},
//=============================================================================
__syntaxFix__: "syntax fix"
});
//#############################################################################
Clipperz.Async.DeferredSynchronizer = function(aName, someMethods) {
this._name = aName || "Anonymous deferred Synchronizer";
this._methods = someMethods;
this._numberOfMethodsDone = 0;
this._methodResults = [];
this._result = new Clipperz.Async.Deferred("Clipperz.Async.DeferredSynchronizer # " + this.name(), {trace:false});
this._result.addMethod(this, 'methodResults');
this._result.addCallback(function(someResults) {
var cancels;
var errors;
var result;
cancels = MochiKit.Base.filter(function(aResult) { return (aResult instanceof MochiKit.Async.CancelledError)}, someResults);
if (cancels.length == 0) {
errors = MochiKit.Base.filter(function(aResult) { return (aResult instanceof Error)}, someResults);
if (errors.length == 0) {
// result = MochiKit.Async.succeed(someResults);
result = someResults;
} else {
result = MochiKit.Async.fail(someResults);
}
} else {
result = MochiKit.Async.fail(cancels[0]);
}
return result;
}/*, this._methodResults */);
return this;
}
MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, {
//-----------------------------------------------------------------------------
'name': function() {
return this._name;
},
//-----------------------------------------------------------------------------
'methods': function() {
return this._methods;
},
'methodResults': function() {
return this._methodResults;
},
//-----------------------------------------------------------------------------
'result': function() {
return this._result;
},
//-----------------------------------------------------------------------------
'numberOfMethodsDone':function() {
return this._numberOfMethodsDone;
},
'incrementNumberOfMethodsDone': function() {
this._numberOfMethodsDone ++;
},
//-----------------------------------------------------------------------------
'run': function(args, aValue) {
var deferredResults;
var i, c;
deferredResults = [];
args = args || {};
c = this.methods().length;
for (i=0; i<c; i++) {
var deferredResult;
var methodCalls;
var ii, cc;
//console.log("TYPEOF", typeof(this.methods()[i]));
if (typeof(this.methods()[i]) == 'function') {
methodCalls = [ this.methods()[i] ];
} else {
methodCalls = this.methods()[i];
}
cc = methodCalls.length;
deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.DeferredSynchronizer.run => " + this.name() + "[" + i + "]", args);
for (ii=0; ii<cc; ii++) {
deferredResult.addCallback(methodCalls[ii]);
}
deferredResult.addBoth(MochiKit.Base.method(this, 'handleMethodCallDone', i));
deferredResults.push(deferredResult);
}
for (i=0; i<c; i++) {
deferredResults[i].callback(aValue);
}
return this.result();
},
//-----------------------------------------------------------------------------
'handleMethodCallDone': function(anIndexValue, aResult) {
this.incrementNumberOfMethodsDone();
this.methodResults()[anIndexValue] = aResult;
if (this.numberOfMethodsDone() < this.methods().length) {
// nothing to do here other than possibly log something
} else if (this.numberOfMethodsDone() == this.methods().length) {
this.result().callback();
} else if (this.numberOfMethodsDone() > this.methods().length) {
alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!");
// WTF!!! :(
}
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
//#############################################################################
MochiKit.Base.update(Clipperz.Async, {
'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) {
var deferredResult;
var i, c;
deferredResult = new Clipperz.Async.Deferred(aName, someArguments);
c = someFunctions.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(someFunctions[i]);
}
deferredResult.callback(aCallbackValue);
return deferredResult;
},
//-------------------------------------------------------------------------
'forkAndJoin': function (aName, someMethods, args) {
return MochiKit.Base.partial(function (aName, someMethods, args, aValue) {
var synchronizer;
var result;
args = args || {};
synchronizer = new Clipperz.Async.DeferredSynchronizer(aName, someMethods);
result = synchronizer.run(args, aValue);
return result;
}, aName, someMethods, args);
},
//-------------------------------------------------------------------------
'collectResults': function(aName, someRequests, args) {
return MochiKit.Base.partial(function(aName, someRequests, args, aValue) {
var deferredResult;
var requestKeys;
var methods;
requestKeys = MochiKit.Base.keys(someRequests);
methods = MochiKit.Base.values(someRequests);
deferredResult = new Clipperz.Async.Deferred(aName, args);
deferredResult.addCallback(Clipperz.Async.forkAndJoin(aName + " [inner forkAndJoin]", methods, args));
deferredResult.addBoth(function(someResults) {
var returnFunction;
var results;
var i,c;
var result;
if (someResults instanceof MochiKit.Async.CancelledError) {
returnFunction = MochiKit.Async.fail;
result = someResults;
} else {
if (someResults instanceof Error) {
returnFunction = MochiKit.Async.fail;
results = someResults['message'];
} else {
returnFunction = MochiKit.Async.succeed;
results = someResults;
}
result = {};
c = requestKeys.length;
for (i=0; i<c; i++) {
result[requestKeys[i]] = results[i];
}
}
return returnFunction.call(null, result);
});
deferredResult.callback(aValue);
return deferredResult;
}, aName, someRequests, args);
},
//-------------------------------------------------------------------------
'collectAll': function (someDeferredObjects) {
var deferredResult;
deferredResult = new MochiKit.Async.DeferredList(someDeferredObjects, false, false, false);
deferredResult.addCallback(function (aResultList) {
return MochiKit.Base.map(function (aResult) {
if (aResult[0]) {
return aResult[1];
- } else {
+ } else {
throw aResult[1];
- }
+ }
}, aResultList);
});
return deferredResult;
},
//-------------------------------------------------------------------------
'setItem': function (anObject, aKey, aValue) {
anObject[aKey] = aValue;
return anObject;
},
'setItemOnObject': function (aKey, aValue, anObject) {
anObject[aKey] = aValue;
return anObject;
},
'setDeferredItemOnObject': function (aKey, aDeferredFunction, anObject) {
return Clipperz.Async.callbacks("Clipperz.Async.setDeferredItemOnObject", [
aDeferredFunction,
MochiKit.Base.partial(Clipperz.Async.setItem, anObject, aKey)
], {trace:false}, anObject);
},
//-------------------------------------------------------------------------
'deferredIf': function (aName, aThenBlock, anElseBlock) {
return function (aValue) {
var deferredResult;
if (!MochiKit.Base.isUndefinedOrNull(aValue) && aValue) {
deferredResult = Clipperz.Async.callbacks(aName + " <then>", aThenBlock, null, aValue);
} else {
deferredResult = Clipperz.Async.callbacks(aName + " <else>", anElseBlock, null, aValue);
}
return deferredResult;
}
},
//-------------------------------------------------------------------------
'log': function(aMessage, aResult) {
if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) {
Clipperz.log(aMessage + " ", aResult);
}
return aResult;
},
//=========================================================================
'deferredCompare': function (aComparator, aDeferred, bDeferred) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredCompare", {trace:false});
deferredResult.addCallback(Clipperz.Async.collectAll, [aDeferred, bDeferred]);
deferredResult.addCallback(function (someResults) {
var result;
if (aComparator(someResults[0], someResults[1]) > 0) {
result = MochiKit.Async.succeed();
} else {
result = MochiKit.Async.fail();
};
return result;
});
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'insertIntoSortedArray': function (anObject, aDeferredComparator, aSortedResult) {
var deferredResult;
var i, c;
if (aSortedResult.length == 0) {
deferredResult = MochiKit.Async.succeed([anObject]);
} else {
deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.insertIntoSortedArray", {trace:false});
c = aSortedResult.length + 1;
for (i=0; i<c; i++) {
deferredResult.addCallback(function (aDeferredComparator, aObject, bObject, aContext) {
var innerDeferredResult;
innerDeferredResult = new Clipperz.Async.Deferred("Clipperz.Async.insertIntoSortedArray <inner compare>", {trace:false});
innerDeferredResult.addCallback(aDeferredComparator, aObject, bObject);
innerDeferredResult.addErrback(MochiKit.Async.fail, aContext);
innerDeferredResult.callback();
return innerDeferredResult;
}, aDeferredComparator, anObject, aSortedResult[i], i);
}
deferredResult.addMethod(aSortedResult, 'push', anObject);
deferredResult.addErrback(function (anError) {
aSortedResult.splice(anError.message, 0, anObject);
})
deferredResult.addBoth(MochiKit.Async.succeed, aSortedResult);
deferredResult.callback();
}
return deferredResult;
},
//-------------------------------------------------------------------------
'deferredSort': function (aDeferredComparator, someObjects) {
var deferredResult;
var i, c;
deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredSort", {trace:false});
c = someObjects.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(Clipperz.Async.insertIntoSortedArray, someObjects[i], aDeferredComparator);
if ((i % 50) == 0) {
// console.log("######### sort wait ##########");
deferredResult.addCallback(MochiKit.Async.wait, 0.5);
}
}
deferredResult.callback([]);
return deferredResult;
},
//=========================================================================
'deferredFilter': function (aFunction, someObjects) {
var deferredResult;
var i, c;
deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredFilter", {trace:false});
c = someObjects.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(function (aFunction, anObject, anIndex, aResult) {
var innerDeferredResult;
innerDeferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredFilter <inner - " + anIndex + ">", {trace:false});
innerDeferredResult.addCallback(aFunction, anObject);
innerDeferredResult.addCallback(function (aFilterResult) {
if (aFilterResult) {
aResult.push(anObject);
};
});
innerDeferredResult.addBoth(MochiKit.Async.succeed, aResult);
innerDeferredResult.callback();
return innerDeferredResult;
}, aFunction, someObjects[i], i);
}
deferredResult.callback([]);
return deferredResult;
},
'forEach': function (aFunction) {
return MochiKit.Base.partial(function (aFunction, anIterable) {
MochiKit.Iter.forEach(anIterable, aFunction);
}, aFunction);
},
//=========================================================================
'or': function (someValues) {
return Clipperz.Async.callbacks("Clipperz.Async.or", [
MochiKit.Base.values,
MochiKit.Base.flattenArguments,
//function (aValue) { console.log("Record.hasAnyCleanTextData - flatten", aValue); return aValue; },
function(someInnerValues) {
return MochiKit.Iter.some(someInnerValues, MochiKit.Base.operator.identity);
}
], {trace:false}, someValues);
},
//=========================================================================
'clearResult': function () {},
//=========================================================================
__syntaxFix__: "syntax fix"
});
//#############################################################################
CLIPPERZ_DEFERRED_LOGGING_ENABLED = true;
CLIPPERZ_DEFERRED_TRACING_ENABLED = false;
CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED = false;
diff --git a/frontend/gamma/js/Clipperz/Base.js b/frontend/gamma/js/Clipperz/Base.js
index 76b2c3f..9d399d9 100644
--- a/frontend/gamma/js/Clipperz/Base.js
+++ b/frontend/gamma/js/Clipperz/Base.js
@@ -1,463 +1,468 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.Base) == 'undefined') { Clipperz.Base = {}; }
Clipperz.Base.VERSION = "0.2";
Clipperz.Base.NAME = "Clipperz.Base";
MochiKit.Base.update(Clipperz.Base, {
//-------------------------------------------------------------------------
'__repr__': function () {
return "[" + this.NAME + " " + this.VERSION + "]";
},
//-------------------------------------------------------------------------
'toString': function () {
return this.__repr__();
},
//-------------------------------------------------------------------------
'itemgetter': function (aKeyPath) {
// return MochiKit.Base.compose.apply(null, [MochiKit.Base.itemgetter('key3')]);
return MochiKit.Base.compose.apply(null,
MochiKit.Base.map(
MochiKit.Base.itemgetter,
MochiKit.Iter.reversed(
aKeyPath.split('.')
)
)
);
},
//-------------------------------------------------------------------------
'isUrl': function (aValue) {
return (MochiKit.Base.urlRegExp.test(aValue));
},
'isEmail': function (aValue) {
return (MochiKit.Base.emailRegExp.test(aValue));
},
//-------------------------------------------------------------------------
'caseInsensitiveCompare': function (a, b) {
return MochiKit.Base.compare(a.toLowerCase(), b.toLowerCase());
},
'reverseComparator': function (aComparator) {
return MochiKit.Base.compose(function(aResult) { return -aResult; }, aComparator);
},
+ 'caseInsensitiveKeyComparator': function (aKey) {
+ return function (a, b) {
+ return MochiKit.Base.compare(a[aKey].toLowerCase(), b[aKey].toLowerCase());
+ }
+ },
//-------------------------------------------------------------------------
/*
'dependsOn': function(module, deps) {
if (!(module in Clipperz)) {
MochiKit[module] = {};
}
if (typeof(dojo) != 'undefined') {
dojo.provide('Clipperz.' + module);
}
for (var i = 0; i < deps.length; i++) {
if (typeof(dojo) != 'undefined') {
dojo.require('Clipperz.' + deps[i]);
}
if (typeof(JSAN) != 'undefined') {
JSAN.use('Clipperz.' + deps[i], []);
}
if (!(deps[i] in Clipperz)) {
throw 'Clipperz.' + module + ' depends on Clipperz.' + deps[i] + '!'
}
}
},
*/
//-------------------------------------------------------------------------
'trim': function (aValue) {
return aValue.replace(/^\s+|\s+$/g, "");
},
//-------------------------------------------------------------------------
'stringToByteArray': function (aValue) {
var result;
var i, c;
result = [];
c = aValue.length;
for (i=0; i<c; i++) {
result[i] = aValue.charCodeAt(i);
}
return result;
},
//.........................................................................
'byteArrayToString': function (anArrayOfBytes) {
var result;
var i, c;
result = "";
c = anArrayOfBytes.length;
for (i=0; i<c; i++) {
result += String.fromCharCode(anArrayOfBytes[i]);
}
return result;
},
//-------------------------------------------------------------------------
'getValueForKeyInFormContent': function (aFormContent, aKey) {
return aFormContent[1][MochiKit.Base.find(aFormContent[0], aKey)];
},
//-------------------------------------------------------------------------
'indexOfObjectInArray': function(anObject, anArray) {
var result;
var i, c;
result = -1;
c = anArray.length;
for (i=0; ((i<c) && (result < 0)); i++) {
if (anArray[i] === anObject) {
result = i;
}
}
return result;
},
//-------------------------------------------------------------------------
'removeObjectAtIndexFromArray': function(anIndex, anArray) {
anArray.splice(anIndex, 1);
},
//-------------------------------------------------------------------------
'removeObjectFromArray': function(anObject, anArray) {
var objectIndex;
objectIndex = Clipperz.Base.indexOfObjectInArray(anObject, anArray);
if (objectIndex > -1) {
Clipperz.Base.removeObjectAtIndexFromArray(objectIndex, anArray);
} else {
Clipperz.log("Trying to remove an object not present in the array");
throw Clipperz.Base.exception.ObjectNotFound;
}
},
'removeFromArray': function(anArray, anObject) {
return Clipperz.Base.removeObjectFromArray(anObject, anArray);
},
//-------------------------------------------------------------------------
'splitStringAtFixedTokenSize': function(aString, aTokenSize) {
var result;
var stringToProcess;
stringToProcess = aString;
result = [];
if (stringToProcess != null) {
while (stringToProcess.length > aTokenSize) {
result.push(stringToProcess.substring(0, aTokenSize));
stringToProcess = stringToProcess.substring(aTokenSize);
}
result.push(stringToProcess);
}
return result;
},
//-------------------------------------------------------------------------
'objectType': function(anObject) {
var result;
if (anObject == null) {
result = null;
} else {
result = typeof(anObject);
if (result == "object") {
if (anObject instanceof Array) {
result = 'array'
} else if (anObject.constructor == Boolean) {
result = 'boolean'
} else if (anObject instanceof Date) {
result = 'date'
} else if (anObject instanceof Error) {
result = 'error'
} else if (anObject instanceof Function) {
result = 'function'
} else if (anObject.constructor == Number) {
result = 'number'
} else if (anObject.constructor == String) {
result = 'string'
} else if (anObject instanceof Object) {
result = 'object'
} else {
throw Clipperz.Base.exception.UnknownType;
}
}
}
return result;
},
//-------------------------------------------------------------------------
'escapeHTML': function(aValue) {
var result;
result = aValue;
result = result.replace(/</g, "&lt;");
result = result.replace(/>/g, "&gt;");
return result;
},
//-------------------------------------------------------------------------
'deepClone': function(anObject) {
var result;
result = Clipperz.Base.evalJSON(Clipperz.Base.serializeJSON(anObject));
return result;
},
//-------------------------------------------------------------------------
// 'deepCompare': function (aObject, bObject) {
// return (Clipperz.Base.serializeJSON(aObject) == Clipperz.Base.serializeJSON(bObject));
// },
//-------------------------------------------------------------------------
'evalJSON': function(aString) {
return JSON.parse(aString);
},
'serializeJSON': function(anObject) {
return JSON.stringify(anObject);
},
'formatJSON': function (anObject, sIndent) {
var realTypeOf = function (v) {
if (typeof(v) == "object") {
if (v === null) return "null";
if (v.constructor == (new Array).constructor) return "array";
if (v.constructor == (new Date).constructor) return "date";
if (v.constructor == (new RegExp).constructor) return "regex";
return "object";
}
return typeof(v);
};
// function FormatJSON(oData, sIndent) {
if (arguments.length < 2) {
var sIndent = "";
}
// var sIndentStyle = " ";
var sIndentStyle = " ";
var sDataType = realTypeOf(anObject);
// open object
if (sDataType == "array") {
if (anObject.length == 0) {
return "[]";
}
var sHTML = "[";
} else if (sDataType == "object") {
var sHTML = "{";
} else {
return "{}";
}
// } else {
// var iCount = 0;
// $.each(anObject, function() {
// iCount++;
// return;
// });
// if (iCount == 0) { // object is empty
// return "{}";
// }
// var sHTML = "{";
// }
// loop through items
var iCount = 0;
// $.each(anObject, function(sKey, vValue) {
MochiKit.Iter.forEach(MochiKit.Base.keys(anObject), function(sKey) {
var vValue = anObject[sKey];
if (iCount > 0) {
sHTML += ",";
}
if (sDataType == "array") {
sHTML += ("\n" + sIndent + sIndentStyle);
} else {
sHTML += ("\n" + sIndent + sIndentStyle + "\"" + sKey + "\"" + ": ");
}
// display relevant data type
switch (realTypeOf(vValue)) {
case "array":
case "object":
sHTML += Clipperz.Base.formatJSON(vValue, (sIndent + sIndentStyle));
break;
case "boolean":
case "number":
sHTML += vValue.toString();
break;
case "null":
sHTML += "null";
break;
case "string":
sHTML += ("\"" + vValue + "\"");
break;
default:
sHTML += ("TYPEOF: " + typeof(vValue));
}
// loop
iCount++;
});
// close object
if (sDataType == "array") {
sHTML += ("\n" + sIndent + "]");
} else {
sHTML += ("\n" + sIndent + "}");
}
// return
return sHTML;
},
//-------------------------------------------------------------------------
'mergeItems': function (anArrayOfValues) {
var result;
var i, c;
result = {};
c = anArrayOfValues.length;
for (i=0; i<c; i++) {
result[anArrayOfValues[i][0]] = anArrayOfValues[i][1];
}
return result;
},
//-------------------------------------------------------------------------
'map': function (fn, lstObj/*, lst... */) {
var result;
if (MochiKit.Base.isArrayLike(lstObj)) {
result = MochiKit.Base.map.apply(this, arguments);
} else {
var keys;
var values;
var computedValues;
keys = MochiKit.Base.keys(lstObj);
values = MochiKit.Base.values(lstObj);
computedValues = MochiKit.Base.map(fn, values);
result = Clipperz.Base.mergeItems(MochiKit.Base.zip(keys, computedValues));
}
return result;
},
//-------------------------------------------------------------------------
'sanitizeString': function(aValue) {
var result;
if (Clipperz.Base.objectType(aValue) == 'string') {
result = aValue;
result = result.replace(/</img,"&lt;");
result = result.replace(/>/img,"&gt;");
} else {
result = aValue;
}
return result;
},
//-------------------------------------------------------------------------
'module': function(aValue) {
// aValue = 'Clipperz.PM.Compact'
//
// if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
// if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
// if (typeof(Clipperz.PM.UI.Common.Components) == 'undefined') { Clipperz.PM.UI.Common.Components = {}; }
//console.log(">>> module: " + aValue);
var currentScope;
var pathElements;
var i,c;
currentScope = window;
pathElements = aValue.split('.');
c = pathElements.length;
for (i=0; i<c; i++) {
//console.log("--- current path element: " + pathElements[i]);
//console.log("--- current scope", currentScope);
if (typeof(currentScope[pathElements[i]]) == 'undefined') {
currentScope[pathElements[i]] = {};
}
currentScope = currentScope[pathElements[i]];
}
},
//-------------------------------------------------------------------------
'exception': {
'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"),
'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType"),
'VulnerabilityIssue': new MochiKit.Base.NamedError("Clipperz.Base.exception.VulnerabilityIssue"),
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js
index b4e8aaa..a05a310 100644
--- a/frontend/gamma/js/Clipperz/PM/Connection.js
+++ b/frontend/gamma/js/Clipperz/PM/Connection.js
@@ -1,616 +1,640 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
//-----------------------------------------------------------------------------
//
// Abstract C O N N E C T I O N class
//
//-----------------------------------------------------------------------------
Clipperz.PM.Connection = function (args) {
args = args || {};
this._proxy = args.proxy || Clipperz.PM.Proxy.defaultProxy;
this._getCredentialsFunction = args.getCredentialsFunction;
this._clipperz_pm_crypto_version = null;
this._connectionId = null;
this._sharedSecret = null;
+ this._serverLockValue = null;
return this;
}
Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Connection [" + this.version() + "]";
},
//=========================================================================
'version': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
'clipperz_pm_crypto_version': function() {
if (this._clipperz_pm_crypto_version == null) {
var connectionVersions;
var versions;
var version;
var i, c;
version = null;
connectionVersions = Clipperz.PM.Connection.communicationProtocol.versions;
versions = MochiKit.Base.keys(connectionVersions);
c = versions.length;
for (i=0; i<c; i++) {
if (! (versions[i] == 'current')) {
if (this instanceof connectionVersions[versions[i]]) {
version = versions[i];
};
}
}
this._clipperz_pm_crypto_version = version;
}
return this._clipperz_pm_crypto_version;
},
//-------------------------------------------------------------------------
'defaultErrorHandler': function(anErrorString, anException) {
MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")");
},
//-------------------------------------------------------------------------
'getCredentialsFunction': function () {
return this._getCredentialsFunction;
},
'normalizedCredentials': function(someValues) {
throw Clipperz.Base.exception.AbstractMethod;
},
//=========================================================================
'proxy': function () {
return this._proxy;
},
//=========================================================================
'register': function () {
throw Clipperz.Base.exception.AbstractMethod;
},
'login': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
//-------------------------------------------------------------------------
'message': function(someArguments, aCallback) {
throw Clipperz.Base.exception.AbstractMethod;
},
//-------------------------------------------------------------------------
'serverSideUserCredentials': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
//=========================================================================
'sharedSecret': function () {
return this._sharedSecret;
},
'setSharedSecret': function (aValue) {
this._sharedSecret = aValue;
},
//-------------------------------------------------------------------------
'connectionId': function() {
return this._connectionId;
},
'setConnectionId': function(aValue) {
this._connectionId = aValue;
},
+ //-------------------------------------------------------------------------
+
+ 'serverLockValue': function () {
+ return this._serverLockValue;
+ },
+
+ 'setServerLockValue': function (aValue) {
+ this._serverLockValue = aValue;
+ },
+
//=========================================================================
/*
// TODO: ?????
'oneTimePassword': function() {
return this._oneTimePassword;
},
'setOneTimePassword': function(aValue) {
this._oneTimePassword = aValue;
},
*/
//=========================================================================
'reset': function() {
this.setSharedSecret(null);
this.setConnectionId(null);
},
//=========================================================================
__syntaxFix__: "syntax fix"
}
);
if (typeof(Clipperz.PM.Connection.SRP) == 'undefined') { Clipperz.PM.Connection.SRP = {}; }
//-----------------------------------------------------------------------------
//
// S R P [ 1 . 0 ] C O N N E C T I O N class
//
//-----------------------------------------------------------------------------
Clipperz.PM.Connection.SRP['1.0'] = function (args) {
Clipperz.PM.Connection.call(this, args);
return this;
}
Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection(), {
'version': function() {
return '1.0';
},
//=========================================================================
'register': function (someUserData) {
var deferredResult;
var cryptoVersion;
var srpConnection;
cryptoVersion = this.clipperz_pm_crypto_version();
deferredResult = new Clipperz.Async.Deferred("Connection.registerWithVersion", {trace:false});
deferredResult.collectResults({
'credentials': [
this.getCredentialsFunction(),
MochiKit.Base.method(this, 'normalizedCredentials'),
MochiKit.Base.bind(function(someCredentials) {
var srpConnection;
var result;
srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
result = srpConnection.serverSideCredentials();
result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion;
return result;
}, this)
],
'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData),
'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Connection.communicationProtocol.currentVersion),
'message': MochiKit.Base.partial(MochiKit.Async.succeed, 'completeRegistration')
});
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addMethod(this.proxy(), 'registration');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'updateCredentials': function (aUsername, aPassphrase, someUserData) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("Connection.updateCredentials", {trace:false});
deferredResult.collectResults({
'credentials': [
MochiKit.Base.method(this, 'normalizedCredentials', {username:aUsername, password:aPassphrase}),
MochiKit.Base.bind(function(someCredentials) {
var srpConnection;
var result;
srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
result = srpConnection.serverSideCredentials();
result['version'] = Clipperz.PM.Connection.communicationProtocol.currentVersion;
return result;
}, this)
],
'user': MochiKit.Base.partial(MochiKit.Async.succeed, someUserData)
});
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addMethod(this, 'message', 'upgradeUserCredentials');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'redeemOneTimePassword': function (someParameters) {
//console.log("Connections.redeemOneTimePassword", someParameters['username'], someParameters['password']);
/*
//=========================================================================
// LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js)
deferredResult.addCallback(function(anUsername, aOneTimePassword) {
var args;
args = {
'message': 'oneTimePassword',
'version': Clipperz.PM.Crypto.communicationProtocol.currentVersion,
'parameters': {
'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(anUsername, aOneTimePassword),
'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(anUsername, aOneTimePassword)
}
}
return args;
}, anUsername, oneTimePassword);
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_loadingOTP');
deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Proxy.defaultProxy, 'handshake'));
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'OTP_login_extractingPassphrase');
deferredResult.addCallback(function(aResult) {
return Clipperz.PM.Crypto.deferredDecrypt(oneTimePassword, aResult['data'], aResult['version']);
});
deferredResult.addCallback(function(aResult) {
return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString();
});
deferredResult.addMethod(this, 'doLoginWithUsernameAndPassphrase', anUsername),
*/
var args;
var normalizedOTP;
normalizedOTP = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(someParameters['password']);
args = {
'message': 'oneTimePassword',
'version': Clipperz.PM.Connection.communicationProtocol.currentVersion,
'parameters': {
'oneTimePasswordKey': Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(someParameters['username'], normalizedOTP),
'oneTimePasswordKeyChecksum': Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(someParameters['username'], normalizedOTP)
}
}
return Clipperz.Async.callbacks("Connction.redeemOTP", [
MochiKit.Base.method(this.proxy(), 'handshake', args),
function(aResult) {
return Clipperz.PM.Crypto.deferredDecrypt({
value: aResult['data'],
key: normalizedOTP,
version:aResult['version']
});
},
function(aResult) {
return (new Clipperz.ByteArray().appendBase64String(aResult['passphrase'])).asString();
}
], {trace:false})
},
- 'login': function(/*anUsername, aPassphrase*/) {
+ 'login': function(isReconnecting) {
var deferredResult;
var cryptoVersion;
var srpConnection;
cryptoVersion = this.clipperz_pm_crypto_version();
-
deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false});
deferredResult.addCallback(this.getCredentialsFunction());
deferredResult.addMethod(this, 'normalizedCredentials');
// deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_sendingCredentials');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addCallback(MochiKit.Base.bind(function(someCredentials) {
srpConnection = new Clipperz.Crypto.SRP.Connection({ C:someCredentials['username'], P:someCredentials['password'], hash:this.hash() });
}, this));
deferredResult.addCallback(function() {
var result;
result = {
message: 'connect',
version: cryptoVersion,
parameters: {
C: srpConnection.C(),
A: srpConnection.A().asString(16)
// reconnecting: this.connectionId()
}
};
// TODO: ?????
// if (isReconnecting == true) {
// args.parameters['reconnecting'] = aConnection.connectionId();
// }
return result;
});
deferredResult.addMethod(this.proxy(), 'handshake');
// deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_credentialVerification');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addCallback(function(someParameters) {
var result;
srpConnection.set_s(new Clipperz.Crypto.BigInt(someParameters['s'], 16));
srpConnection.set_B(new Clipperz.Crypto.BigInt(someParameters['B'], 16));
// TODO: ?????
// if (typeof(someParameters['oneTimePassword']) != 'undefined') {
// this.setOneTimePassword(someParameters['oneTimePassword']);
// }
result = {
message: 'credentialCheck',
version: cryptoVersion,
parameters: {
M1: srpConnection.M1()
}
};
return result;
});
deferredResult.addMethod(this.proxy(), 'handshake');
deferredResult.addCallback(function(someParameters) {
var result;
if (someParameters['M2'] == srpConnection.M2()) {
result = MochiKit.Async.succeed(someParameters);
} else {
result = MochiKit.Async.fail(Clipperz.PM.Connection.exception.WrongChecksum);
}
return result;
});
deferredResult.addCallback(MochiKit.Base.bind(function(someParameters) {
this.setConnectionId(someParameters['connectionId']);
this.setSharedSecret(srpConnection.K());
// TODO: ?????
// if (this.oneTimePassword() != null) {
/// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword()));
// }
+
+ if ((isReconnecting == true) && (this.serverLockValue() != someParameters['lock'])) {
+ throw Clipperz.PM.Connection.exception.StaleData;
+ } else {
+ this.setServerLockValue(someParameters['lock']);
+ }
+
return someParameters;
}, this));
// deferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'updatedProgressState', 'connection_loggedIn');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addCallback(MochiKit.Async.succeed, {result:"done"});
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'logout': function() {
return Clipperz.Async.callbacks("Connection.logout", [
MochiKit.Base.method(this, 'setSharedSecret'),
MochiKit.Base.method(this.proxy(), 'logout', {})
], {trace:false});
},
//=========================================================================
'ping': function () {
// TODO: ping the server in order to have a valid session
},
//=========================================================================
'message': function(aMessageName, someParameters) {
var args;
+ var parameters;
+
+ parameters = someParameters || {};
+ if (typeof(parameters['user']) != 'undefined') {
+ parameters['user']['lock'] = this.serverLockValue();
+ }
//console.log(">>> Connection.message", aMessageName, someParameters);
args = {
message: aMessageName,
srpSharedSecret: this.sharedSecret(),
- parameters: (someParameters || {})
+// parameters: (someParameters || {})
+ parameters: parameters
}
return this.sendMessage(args);
},
//-------------------------------------------------------------------------
'sendMessage': function(someArguments) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("Connection.sendMessage", {trace:false});
deferredResult.addMethod(this.proxy(), 'message', someArguments);
deferredResult.addCallback(MochiKit.Base.bind(function(res) {
if (typeof(res['lock']) != 'undefined') {
-// TODO: ?????
-// ?? this.user().setLock(res['lock']);
+ this.setServerLockValue(res['lock']);
}
return res;
}, this));
deferredResult.addErrback(MochiKit.Base.method(this, 'messageExceptionHandler'), someArguments);
deferredResult.callback();
return deferredResult
},
//-------------------------------------------------------------------------
'messageExceptionHandler': function(anOriginalMessageArguments, anError) {
var result;
console.log(">>> Connection.messageExceptionHandler", anError, anError.message);
if (anError instanceof MochiKit.Async.CancelledError) {
result = anError;
} else {
if ((anError.message == 'Trying to communicate without an active connection') ||
(anError.message == 'No tollManager available for current session')
) {
result = this.reestablishConnection(anOriginalMessageArguments);
} else if (anError.message == 'Session with stale data') {
MochiKit.Signal.signal(this, 'EXCEPTION');
} else {
result = anError;
}
}
console.log("<<< Connection.messageExceptionHandler", anError)
return result;;
},
//=========================================================================
'reestablishConnection': function(anOriginalMessageArguments) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("Connection.reestablishConnection");
deferredResult.addMethod(this, 'reset');
deferredResult.addMethod(this, 'login', true);
deferredResult.addCallback(MochiKit.Base.bind(function(aMessage) {
aMessage['srpSharedSecret'] = this.sharedSecret();
return aMessage;
}, this), anOriginalMessageArguments);
deferredResult.addMethod(this, 'sendMessage');
deferredResult.addErrback(MochiKit.Signal.signal, this, 'EXCEPTION', null);
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'serverSideUserCredentials': function(aUsername, aPassword) {
var result;
var newSrpConnection;
var normalizedAttributes;
normalizedAttributes = this.normalizedCredentials({username:aUsername, password:aPassword});
newSrpConnection = new Clipperz.Crypto.SRP.Connection({ C:normalizedAttributes['username'], P:normalizedAttributes['password'], hash:this.hash() });
result = newSrpConnection.serverSideCredentials();
result['version'] = this.clipperz_pm_crypto_version();
return result;
},
//=========================================================================
'normalizedCredentials': function(someValues) {
var result;
result = {}
result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'])).toHexString().substring(2);
result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2);
return result;
},
//-----------------------------------------------------------------------------
'hash': function() {
return Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].hash;
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
//-----------------------------------------------------------------------------
//
// S R P [ 1 . 1 ] C O N N E C T I O N class
//
//-----------------------------------------------------------------------------
Clipperz.PM.Connection.SRP['1.1'] = function (args) {
Clipperz.PM.Connection.SRP['1.0'].call(this, args);
return this;
}
Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz.PM.Connection.SRP['1.0'](), {
'version': function() {
return '1.1';
},
//-----------------------------------------------------------------------------
'normalizedCredentials': function(someValues) {
var result;
result = {}
result['username'] = this.hash()(new Clipperz.ByteArray(someValues['username'] + someValues['password'])).toHexString().substring(2);
result['password'] = this.hash()(new Clipperz.ByteArray(someValues['password'] + someValues['username'])).toHexString().substring(2);
return result;
},
//-----------------------------------------------------------------------------
'hash': function() {
return Clipperz.PM.Crypto.encryptingFunctions.versions['0.2'].hash;
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
Clipperz.PM.Connection.exception = {
WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"),
+ StaleData: new MochiKit.Base.NamedError("Stale data"),
UnexpectedRequest: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest")
};
Clipperz.PM.Connection.communicationProtocol = {
'currentVersion': '0.2',
'versions': {
'0.1': Clipperz.PM.Connection.SRP['1.0'], //Clipperz.Crypto.SRP.versions['1.0'].Connection,
'0.2': Clipperz.PM.Connection.SRP['1.1'] //Clipperz.Crypto.SRP.versions['1.1'].Connection
},
'fallbackVersions': {
// 'current': '0.1',
'0.2': '0.1',
'0.1': null
}
};
MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.versions, {
'current': Clipperz.PM.Connection.communicationProtocol.versions[Clipperz.PM.Connection.communicationProtocol.currentVersion]
});
MochiKit.Base.update(Clipperz.PM.Connection.communicationProtocol.fallbackVersions, {
'current': Clipperz.PM.Connection.communicationProtocol.fallbackVersions[Clipperz.PM.Connection.communicationProtocol.currentVersion]
});
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
index 72d4006..646ce21 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js
@@ -1,814 +1,814 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.User = function (args) {
args = args || {};
Clipperz.PM.DataModel.User.superclass.constructor.apply(this, arguments);
this._username = args.username || null;
this._getPassphraseFunction = args.getPassphraseFunction || null;
this._data = null;
this._connection = null;
this._connectionVersion = 'current';
this._serverData = null;
- this._serverLockValue = null;
+// this._serverLockValue = null;
this._transientState = null;
this._deferredLocks = {
'passphrase': new MochiKit.Async.DeferredLock(),
'serverData': new MochiKit.Async.DeferredLock(),
// 'recordsIndex': new MochiKit.Async.DeferredLock(),
// 'directLoginsIndex': new MochiKit.Async.DeferredLock()
// 'preferences': new MochiKit.Async.DeferredLock()
// 'oneTimePasswords': new MochiKit.Async.DeferredLock()
'__syntaxFix__': 'syntax fix'
};
return this;
}
Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
'toString': function () {
return "Clipperz.PM.DataModel.User - " + this.username();
},
//-------------------------------------------------------------------------
'username': function () {
return this._username;
},
'setUsername': function (aValue) {
this._username = aValue;
},
//-------------------------------------------------------------------------
'displayName': function() {
return "" + this.username() + "";
},
//-------------------------------------------------------------------------
'data': function () {
if (this._data == null) {
this._data = new Clipperz.KeyValueObjectStore(/*{'name':'User.data [1]'}*/);
};
return this._data;
},
//-------------------------------------------------------------------------
-
+/*
'serverLockValue': function () {
return this._serverLockValue;
},
'setServerLockValue': function (aValue) {
this._serverLockValue = aValue;
},
-
+*/
//-------------------------------------------------------------------------
'transientState': function () {
if (this._transientState == null) {
this._transientState = {}
}
return this._transientState;
},
'resetTransientState': function (isCommitting) {
this._transientState = null;
},
//-------------------------------------------------------------------------
'deferredLockForSection': function(aSectionName) {
return this._deferredLocks[aSectionName];
},
//-------------------------------------------------------------------------
'getPassphrase': function() {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.getPassphrase", {trace:false});
deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', this.getPassphraseFunction());
deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
deferredResult.callback();
return deferredResult;
},
'getPassphraseFunction': function () {
return this._getPassphraseFunction;
},
//-------------------------------------------------------------------------
'getCredentials': function () {
return Clipperz.Async.collectResults("User; get username and passphrase", {
'username': MochiKit.Base.method(this, 'username'),
'password': MochiKit.Base.method(this, 'getPassphrase')
}, {trace:false})();
},
//-------------------------------------------------------------------------
'changePassphrase': function (aNewValue) {
return this.updateCredentials(this.username(), aNewValue);
},
//.........................................................................
'updateCredentials': function (aUsername, aPassphrase) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.updateCredentials", {trace:false});
// deferredResult.addMethod(this, 'getPassphrase');
// deferredResult.setValue('currentPassphrase');
deferredResult.addMethod(this.connection(), 'ping');
deferredResult.addMethod(this, 'setUsername', aUsername)
deferredResult.acquireLock(this.deferredLockForSection('passphrase'));
deferredResult.addMethod(this.data(), 'deferredGetOrSet', 'passphrase', aPassphrase);
deferredResult.releaseLock(this.deferredLockForSection('passphrase'));
// deferredResult.getValue('currentPassphrase');
deferredResult.addMethod(this, 'prepareRemoteDataWithKey', aPassphrase);
deferredResult.addMethod(this.connection(), 'updateCredentials', aUsername, aPassphrase);
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'initialSetupWithNoData': function () {
this._serverData = {
'version': '0.1',
'statistics': "",
'header': {
'data': null,
'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
'recordsIndex': new Clipperz.PM.DataModel.User.Header.RecordIndex({
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
'recordsData': {'data':null, 'index':{}},
'recordsStats': null,
'directLoginsData': {'data':null, 'index':{}},
'encryptedDataVersion': Clipperz.PM.Crypto.encryptingFunctions.currentVersion,
'retrieveRecordDetailFunction': MochiKit.Base.method(this, 'getRecordDetail')
}),
'preferences': new Clipperz.PM.DataModel.User.Header.Preferences({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
}),
'oneTimePasswords': new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
})
}
};
// this._serverLockValue = Clipperz.PM.Crypto.randomKey();
},
//.........................................................................
'registerAsNewAccount': function () {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.registerAsNewAccount", {trace:false});
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3});
deferredResult.addMethod(this, 'initialSetupWithNoData')
deferredResult.addMethod(this, 'getPassphrase');
deferredResult.addMethod(this, 'prepareRemoteDataWithKey');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addMethod(this.connection(), 'register');
- deferredResult.addCallback(MochiKit.Base.itemgetter('lock'));
- deferredResult.addMethod(this, 'setServerLockValue');
+// deferredResult.addCallback(MochiKit.Base.itemgetter('lock'));
+// deferredResult.addMethod(this, 'setServerLockValue');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userSuccessfullyRegistered');
// deferredResult.addErrback (MochiKit.Base.method(this, 'handleRegistrationFailure'));
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'login': function () {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.login", {trace:false});
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':3});
deferredResult.addMethod(this, 'getPassphrase');
deferredResult.addCallback(Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue);
deferredResult.addCallback(Clipperz.Async.deferredIf("Is the passphrase an OTP", [
MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'updateProgress', {'extraSteps':1}),
MochiKit.Base.method(this, 'getCredentials'),
MochiKit.Base.method(this.connection(), 'redeemOneTimePassword'),
MochiKit.Base.method(this.data(), 'setValue', 'passphrase')
], []));
deferredResult.addErrback(MochiKit.Base.method(this, 'getPassphrase'));
- deferredResult.addMethod(this.connection(), 'login');
+ deferredResult.addMethod(this.connection(), 'login', false);
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userSuccessfullyLoggedIn');
deferredResult.addErrback (MochiKit.Base.method(this, 'handleConnectionFallback'));
deferredResult.callback();
return deferredResult;
},
//.........................................................................
'handleConnectionFallback': function(aValue) {
var result;
if (aValue instanceof MochiKit.Async.CancelledError) {
result = aValue;
} else {
this.setConnectionVersion(Clipperz.PM.Connection.communicationProtocol.fallbackVersions[this.connectionVersion()]);
if (this.connectionVersion() != null) {
result = new Clipperz.Async.Deferred("User.handleConnectionFallback - retry");
result.addMethod(this, 'login');
result.callback();
} else {
result = Clipperz.Async.callbacks("User.handleConnectionFallback - failed", [
MochiKit.Base.method(this.data(), 'removeValue', 'passphrase'),
MochiKit.Base.method(this, 'setConnectionVersion', 'current'),
MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userLoginFailed'),
MochiKit.Base.partial(MochiKit.Async.fail, Clipperz.PM.DataModel.User.exception.LoginFailed)
], {trace:false});
}
}
return result;
},
//-------------------------------------------------------------------------
'lock': function () {
return Clipperz.Async.callbacks("User.lock", [
MochiKit.Base.method(this, 'deleteAllCleanTextData')
], {trace:false});
},
//-------------------------------------------------------------------------
'logout': function () {
return Clipperz.Async.callbacks("User.logout", [
MochiKit.Base.method(this, 'deleteAllCleanTextData'),
MochiKit.Base.method(this.connection(), 'logout')
], {trace:false});
},
//-------------------------------------------------------------------------
'headerFormatVersion': function(anHeader) {
var result;
if (anHeader.charAt(0) == '{') {
var headerData;
headerData = Clipperz.Base.evalJSON(anHeader);
result = headerData['version'];
} else {
result = 'LEGACY';
}
return result;
},
//-------------------------------------------------------------------------
'unpackServerData': function (someServerData) {
var unpackedData;
var headerVersion;
var recordsIndex;
var preferences;
var oneTimePasswords;
//console.log(">>> ***************** user.unpackServerData", someServerData);
- this.setServerLockValue(someServerData['lock']);
+// this.setServerLockValue(someServerData['lock']);
headerVersion = this.headerFormatVersion(someServerData['header']);
switch (headerVersion) {
case 'LEGACY':
var legacyHeader;
legacyHeader = new Clipperz.PM.DataModel.User.Header.Legacy({
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
'remoteData': {
'data': someServerData['header'],
'version': someServerData['version'],
'recordsStats': someServerData['recordsStats']
},
// 'encryptedDataKeypath': 'data',
// 'encryptedVersionKeypath': 'version',
'retrieveRecordDetailFunction': MochiKit.Base.method(this, 'getRecordDetail')
});
recordsIndex = legacyHeader;
preferences = legacyHeader;
oneTimePasswords = legacyHeader;
break;
case '0.1':
var headerData;
headerData = Clipperz.Base.evalJSON(someServerData['header']);
recordsIndex = new Clipperz.PM.DataModel.User.Header.RecordIndex({
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
'recordsData': headerData['records'],
'recordsStats': someServerData['recordsStats'],
'directLoginsData': headerData['directLogins'],
'encryptedDataVersion': someServerData['version'],
'retrieveRecordDetailFunction': MochiKit.Base.method(this, 'getRecordDetail')
});
// Still missing a test case that actually fais with the old version of the code, where the check for undefined was missing
if (typeof(headerData['preferences']) != 'undefined') {
preferences = new Clipperz.PM.DataModel.User.Header.Preferences({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
'remoteData': {
'data': headerData['preferences']['data'],
'version': someServerData['version']
}
});
} else {
preferences = new Clipperz.PM.DataModel.User.Header.Preferences({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
});
}
if (typeof(headerData['oneTimePasswords']) != 'undefined') {
oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase'),
'remoteData': {
'data': headerData['oneTimePasswords']['data'],
'version': someServerData['version']
}
});
} else {
oneTimePasswords = new Clipperz.PM.DataModel.User.Header.OneTimePasswords({
'name': 'preferences',
'retrieveKeyFunction': MochiKit.Base.method(this, 'getPassphrase')
});
}
break;
}
unpackedData = {
'version': someServerData['version'],
'statistics': someServerData['statistics'],
'header': {
'data': someServerData['header'],
'version': headerVersion,
'recordsIndex': recordsIndex,
'preferences': preferences,
'oneTimePasswords': oneTimePasswords
}
};
this._serverData = unpackedData;
//console.log("<<< ***************** user.unpackServerData", this._serverData);
return this._serverData;
},
//-------------------------------------------------------------------------
'getServerData': function() {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.getServerData", {trace:false});
deferredResult.acquireLock(this.deferredLockForSection('serverData'));
deferredResult.addCallback(MochiKit.Base.bind(function(aResult) {
var innerDeferredResult;
innerDeferredResult = new Clipperz.Async.Deferred("User.getUserDetails.innerDeferred", {trace:false});
if (this._serverData == null) {
innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadingUserDetails');
innerDeferredResult.addMethod(this.connection(), 'message', 'getUserDetails');
innerDeferredResult.addMethod(this, 'unpackServerData');
innerDeferredResult.addCallbackPass(MochiKit.Signal.signal, this, 'loadedUserDetails');
}
innerDeferredResult.addCallback(MochiKit.Base.bind(function () {
return this._serverData;
},this));
innerDeferredResult.callback();
return innerDeferredResult;
}, this));
deferredResult.releaseLock(this.deferredLockForSection('serverData'));
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'connectionVersion': function() {
return this._connectionVersion;
},
'setConnectionVersion': function(aValue) {
if (this._connectionVersion != aValue) {
this.resetConnection();
}
this._connectionVersion = aValue;
},
//-------------------------------------------------------------------------
'connection': function() {
if ((this._connection == null) && (this.connectionVersion() != null) ){
this._connection = new Clipperz.PM.Connection.communicationProtocol.versions[this.connectionVersion()]({
getCredentialsFunction: MochiKit.Base.method(this, 'getCredentials')
});
}
return this._connection;
},
'resetConnection': function(aValue) {
if (this._connection != null) {
this._connection.reset();
}
this._connection = null;
},
//=========================================================================
'getHeaderIndex': function (aKey) {
return Clipperz.Async.callbacks("User.getHeaderIndex", [
MochiKit.Base.method(this, 'getServerData'),
MochiKit.Base.itemgetter('header'),
MochiKit.Base.itemgetter(aKey)
], {trace:false})
},
//=========================================================================
'getRecords': function () {
return Clipperz.Async.callbacks("User.getRecords", [
MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
MochiKit.Base.methodcaller('records'),
MochiKit.Base.values
], {trace:false});
},
'recordWithLabel': function (aLabel) {
return Clipperz.Async.callbacks("User.recordWithLabel", [
MochiKit.Base.method(this, 'getRecords'),
MochiKit.Base.partial(Clipperz.Async.deferredFilter, function (aRecord) {
return Clipperz.Async.callbacks("User.recordWithLabel - check record label", [
MochiKit.Base.methodcaller('label'),
MochiKit.Base.partial(MochiKit.Base.operator.eq, aLabel)
], {trace:false}, aRecord);
}),
function (someFilteredResults) {
var result;
switch (someFilteredResults.length) {
case 0:
result = null;
break;
case 1:
result = someFilteredResults[0];
break;
default:
WTF = TODO;
break;
}
return result;
}
], {trace:false});
},
//-------------------------------------------------------------------------
'getRecord': function (aRecordReference) {
return Clipperz.Async.callbacks("User.getRecord", [
MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
MochiKit.Base.methodcaller('records'),
MochiKit.Base.itemgetter(aRecordReference),
Clipperz.Async.deferredIf("record != null", [
MochiKit.Base.operator.identity
], [
function () { throw "Record does not exists"}
])
], {trace:false});
},
//-------------------------------------------------------------------------
'getRecordDetail': function (aRecordReference) {
return this.connection().message('getRecordDetail', {reference: aRecordReference});
},
//-------------------------------------------------------------------------
'deleteRecord': function (aRecord) {
return Clipperz.Async.callbacks("User.deleteRecord", [
MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
MochiKit.Base.methodcaller('deleteRecord', aRecord)
], {trace:false});
},
//-------------------------------------------------------------------------
'createNewRecord': function () {
return Clipperz.Async.callbacks("User.createNewRecord", [
MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
MochiKit.Base.methodcaller('createNewRecord')
], {trace:false});
},
//=========================================================================
'getDirectLogins': function() {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.getDirectLogins", {trace:false});
deferredResult.addMethod(this, 'getRecords');
deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.compose(MochiKit.Base.values, MochiKit.Base.methodcaller('directLogins')));
deferredResult.addCallback(MochiKit.Base.flattenArray);
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'getOneTimePasswords': function () {
return Clipperz.Async.callbacks("User.getOneTimePasswords", [
MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'),
MochiKit.Base.methodcaller('oneTimePasswords'),
MochiKit.Base.values
], {trace:false});
},
//=========================================================================
'invokeMethodNamedOnHeader': function (aMethodName, aValue) {
return Clipperz.Async.collectResults("User.invokeMethodNamedOnHeader [" + aMethodName + "]", {
'recordIndex': [
MochiKit.Base.method(this, 'getHeaderIndex', 'recordsIndex'),
MochiKit.Base.methodcaller(aMethodName, aValue)
],
'preferences': [
MochiKit.Base.method(this, 'getHeaderIndex', 'preferences'),
MochiKit.Base.methodcaller(aMethodName, aValue)
],
'oneTimePasswords': [
MochiKit.Base.method(this, 'getHeaderIndex', 'oneTimePasswords'),
MochiKit.Base.methodcaller(aMethodName, aValue)
]//,
// 'statistics': [
// MochiKit.Base.method(this, 'getStatistics'),
// MochiKit.Base.methodcaller(aMethodName, aValue)
// ]
}, {trace:false})();
},
//-------------------------------------------------------------------------
'invokeMethodNamedOnRecords': function (aMethodName, aValue) {
return Clipperz.Async.callbacks("User.invokeMethodNamedOnRecords[" + aMethodName + "]", [
MochiKit.Base.method(this, 'getRecords'),
MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller(aMethodName, aValue)),
Clipperz.Async.collectAll
], {trace:false});
},
//=========================================================================
'hasPendingChanges': function () {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.hasPendingChanges", {trace:false});
deferredResult.collectResults({
'header': [
MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'hasPendingChanges'),
MochiKit.Base.values
],
'records': MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'hasPendingChanges')
});
deferredResult.addCallback(Clipperz.Async.or);
deferredResult.callback();
// recordsIndex = legacyHeader;
// preferences = legacyHeader;
// oneTimePasswords = legacyHeader;
return deferredResult;
},
//=========================================================================
'commitTransientState': function () {
return Clipperz.Async.callbacks("User.commitTransientState", [
MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'commitTransientState'),
MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'commitTransientState'),
MochiKit.Base.method(this, 'transientState'),
- MochiKit.Base.itemgetter('lock'),
- MochiKit.Base.method(this, 'setServerLockValue'),
+// MochiKit.Base.itemgetter('lock'),
+// MochiKit.Base.method(this, 'setServerLockValue'),
MochiKit.Base.method(this, 'resetTransientState', true)
], {trace:false});
},
//-------------------------------------------------------------------------
'revertChanges': function () {
return Clipperz.Async.callbacks("User.revertChanges", [
MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'revertChanges'),
MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'revertChanges'),
MochiKit.Base.method(this, 'resetTransientState', false)
], {trace:false});
},
//=========================================================================
'deleteAllCleanTextData': function () {
return Clipperz.Async.callbacks("User.deleteAllCleanTextData", [
MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'deleteAllCleanTextData'),
MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'deleteAllCleanTextData'),
MochiKit.Base.method(this.data(), 'removeAllData'),
MochiKit.Base.method(this, 'resetTransientState', false)
], {trace:false});
},
//-------------------------------------------------------------------------
'hasAnyCleanTextData': function () {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("User.hasAnyCleanTextData", {trace:false});
deferredResult.collectResults({
'header': [
MochiKit.Base.method(this, 'invokeMethodNamedOnHeader', 'hasAnyCleanTextData'),
MochiKit.Base.values
],
'records': MochiKit.Base.method(this, 'invokeMethodNamedOnRecords', 'hasAnyCleanTextData'),
'data': MochiKit.Base.bind(function () {
return MochiKit.Async.succeed(! this.data().isEmpty());
}, this),
'transientState': MochiKit.Base.bind(function () {
return MochiKit.Async.succeed(MochiKit.Base.keys(this.transientState()).length != 0);
}, this)
});
deferredResult.addCallback(Clipperz.Async.or);
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'prepareRemoteDataWithKey': function (aKey /*, aCurrentKey*/) {
var deferredResult;
var result;
result = {};
deferredResult = new Clipperz.Async.Deferred("User.prepareRemoteDataWithKey", {trace:false});
deferredResult.addMethod(this, 'invokeMethodNamedOnHeader', 'prepareRemoteDataWithKey', aKey /*, aCurrentKey*/);
deferredResult.addCallback(MochiKit.Base.bind(function (aResult, someHeaderPackedData) {
var header;
header = {};
header['records'] = someHeaderPackedData['recordIndex']['records'];
header['directLogins'] = someHeaderPackedData['recordIndex']['directLogins'];
header['preferences'] = {'data': someHeaderPackedData['preferences']['data']}; // this._serverData['header']['preferences']; // Clipperz.Base.evalJSON(this._serverData['header']['data'])['preferences']; // ???????????
header['oneTimePasswords'] = {'data': someHeaderPackedData['oneTimePasswords']['data']}; // this._serverData['header']['oneTimePasswords']; // Clipperz.Base.evalJSON(this._serverData['header']['data'])['oneTimePasswords']; // ???????????
header['version'] = '0.1';
aResult['header'] = Clipperz.Base.serializeJSON(header);
aResult['statistics'] = this._serverData['statistics']; // "someHeaderPackedData['statistics']['data']";
return aResult;
}, this), result);
deferredResult.addCallback(Clipperz.Async.setItem, result, 'version', Clipperz.PM.Crypto.encryptingFunctions.currentVersion);
- deferredResult.addCallback(Clipperz.Async.setItem, result, 'lock', this.serverLockValue());
+// deferredResult.addCallback(Clipperz.Async.setItem, result, 'lock', this.serverLockValue());
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'saveChanges': function () {
var deferredResult;
var messageParameters;
messageParameters = {};
deferredResult = new Clipperz.Async.Deferred("User.saveChangaes", {trace:false});
deferredResult.addMethod(this, 'getHeaderIndex', 'recordsIndex');
deferredResult.addCallback(MochiKit.Base.methodcaller('prepareRemoteDataForChangedRecords'));
deferredResult.addCallback(Clipperz.Async.setItem, messageParameters, 'records');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addMethod(this, 'getPassphrase');
deferredResult.addMethod(this, 'prepareRemoteDataWithKey');
deferredResult.addCallback(Clipperz.Async.setItem, messageParameters, 'user');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addCallback(MochiKit.Async.succeed, messageParameters);
deferredResult.addMethod(this.connection(), 'message', 'saveChanges');
deferredResult.addCallback(MochiKit.Base.update, this.transientState())
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addMethod(this, 'commitTransientState');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'advanceProgress');
deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved');
deferredResult.addErrbackPass(MochiKit.Base.method(this, 'revertChanges'));
deferredResult.addErrbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'failureWhileSavingUserData');
deferredResult.callback();
return deferredResult;
},
//=========================================================================
__syntaxFix__: "syntax fix"
});
//-----------------------------------------------------------------------------
Clipperz.PM.DataModel.User.registerNewAccount = function (anUsername, aPassphraseFunction) {
var deferredResult;
var user;
user = new Clipperz.PM.DataModel.User({'username':anUsername, 'getPassphraseFunction':aPassphraseFunction});
deferredResult = new Clipperz.Async.Deferred("Clipperz.PM.DataModel.User.registerNewAccount", {trace:false});
deferredResult.addMethod(user, 'registerAsNewAccount');
deferredResult.addMethod(user, 'login');
deferredResult.addCallback(MochiKit.Async.succeed, user);
deferredResult.callback();
return deferredResult;
}
//-----------------------------------------------------------------------------
Clipperz.PM.DataModel.User.exception = {
LoginFailed: new MochiKit.Base.NamedError("Clipperz.PM.DataModel.User.exception.LoginFailed"),
CredentialUpgradeFailed: new MochiKit.Base.NamedError("Clipperz.PM.DataModel.User.exception.CredentialUpgradeFailed")
};
//-----------------------------------------------------------------------------
diff --git a/frontend/gamma/js/Clipperz/PM/PIN.js b/frontend/gamma/js/Clipperz/PM/PIN.js
new file mode 100644
index 0000000..bc932b2
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/PIN.js
@@ -0,0 +1,134 @@
+/*
+
+Copyright 2008-2011 Clipperz Srl
+
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an 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 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.
+ 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/>.
+
+*/
+
+if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
+if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
+if (typeof(Clipperz.PM.PIN) == 'undefined') { Clipperz.PM.PIN = {}; }
+
+MochiKit.Base.update(Clipperz.PM.PIN, {
+
+ //-------------------------------------------------------------------------
+
+ '__repr__': function () {
+ return "[" + this.NAME + " " + this.VERSION + "]";
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'toString': function () {
+ return this.__repr__();
+ },
+
+ 'CREDENTIALS': 'CLIPPERZ.CREDENTIALS',
+ 'FAILURE_COUNT': 'CLIPPERZ.FAILED_LOGIN_COUNT',
+ 'ALLOWED_RETRY': 3,
+
+ //-------------------------------------------------------------------------
+
+ 'isSet': function () {
+ return (this.storedCredentials() != null);
+ },
+
+ 'storedCredentials': function () {
+ return localStorage[this.CREDENTIALS];
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'recordFailedAttempt': function () {
+ var failureCount;
+ var result;
+
+ failureCount = localStorage[this.FAILURE_COUNT];
+
+ if (failureCount == null) {
+ failureCount = 0
+ }
+
+ failureCount ++;
+
+ if (failureCount < this.ALLOWED_RETRY) {
+ localStorage[this.FAILURE_COUNT] = failureCount;
+ result = failureCount;
+ } else {
+ this.removeLocalCredentials();
+ result = -1;
+ }
+
+ return result;
+ },
+
+ 'resetFailedAttemptCount': function () {
+ localStorage.removeItem(this.FAILURE_COUNT);
+ },
+
+ 'failureCount': function () {
+ return localStorage[this.FAILURE_COUNT];
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'deriveKeyFromPin': function (aPIN) {
+ return Clipperz.Crypto.SHA.sha256(new Clipperz.ByteArray(aPIN));
+ },
+
+ 'credentialsWithPIN': function (aPIN) {
+ var byteArrayValue;
+ var decryptedValue;
+ var result;
+
+ byteArrayValue = (new Clipperz.ByteArray()).appendBase64String(localStorage[this.CREDENTIALS]);
+ decryptedValue = Clipperz.Crypto.AES.decrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).asString();
+ try {
+ result = Clipperz.Base.evalJSON(decryptedValue);
+ } catch (error) {
+ result = {'username':'fakeusername', 'passphrase':'fakepassphrase'};
+ }
+
+ return result;
+ },
+
+ 'setCredentialsWithPIN': function (aPIN, someCredentials) {
+ var encodedValue;
+ var byteArrayValue;
+ var encryptedValue;
+
+ encodedValue = Clipperz.Base.serializeJSON(someCredentials);
+ byteArrayValue = new Clipperz.ByteArray(encodedValue);
+ encryptedValue = Clipperz.Crypto.AES.encrypt(this.deriveKeyFromPin(aPIN), byteArrayValue).toBase64String();
+
+ localStorage[this.CREDENTIALS] = encryptedValue;
+ },
+
+ 'removeLocalCredentials': function () {
+ localStorage.removeItem(this.CREDENTIALS);
+ localStorage.removeItem(this.FAILURE_COUNT);
+ },
+
+ //-------------------------------------------------------------------------
+ __syntaxFix__: "syntax fix"
+
+});
+
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js
new file mode 100644
index 0000000..803c590
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js
@@ -0,0 +1,65 @@
+/*
+
+Copyright 2008-2011 Clipperz Srl
+
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an 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 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.
+ 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/>.
+
+*/
+
+if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
+if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
+
+//=============================================================================
+
+Clipperz.PM.Proxy.OfflineCache = function(args) {
+ args = args || {};
+
+ Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args);
+
+// this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args);
+
+ return this;
+}
+
+Clipperz.Base.extend(Clipperz.PM.Proxy.OfflineCache, Clipperz.PM.Proxy, {
+
+ 'toString': function () {
+ return "Clipperz.PM.Proxy.OfflineCache";
+ },
+
+ //-------------------------------------------------------------------------
+
+// 'dataStore': function () {
+// return this._dataStore;
+// },
+
+ //-------------------------------------------------------------------------
+
+ 'sendMessage': function(aFunctionName, someParameters) {
+ throw Clipperz.Base.exception.MethodNotImplementedYet;
+// return this.dataStore().processMessage(aFunctionName, someParameters);
+ },
+
+ //-------------------------------------------------------------------------
+
+ __syntaxFix__: "syntax fix"
+
+});
+
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
index 2a03fdf..b9d7adf 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js
@@ -25,584 +25,588 @@ refer to http://www.clipperz.com.
Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
//#############################################################################
var _Clipperz_PM_Components_base_id_ = 0;
//#############################################################################
Clipperz.PM.UI.Common.Components.BaseComponent = function(args) {
args = args || {};
Clipperz.PM.UI.Common.Components.BaseComponent.superclass.constructor.call(this, args);
this._element = args.element || null;
this._ids = {};
this._slots = {};
this._slotComponents = {};
this._components = {};
this._cachedSlots = {};
this._isModal = false;
this._isActive = false;
this._elementUsedToEnterModalState;
this._isFullyRendered = false;
this._renderingWaitingQueue = [];
// this._slots = {
// 'header': 'header',
// 'body': 'body',
// 'footer': 'footer'
// };
return this;
}
//=============================================================================
//TODO get back to MochiKit.Base.update as we are not extending anything
//MochiKit.Base.update(Clipperz.PM.UI.Common.Components.BaseComponent.prototype, {
Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Component*/ Object, {
'isClipperzPMComponent': true,
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Common.Components.BaseComponent component";
},
'componentId': function () {
return this.getId('_id_');
},
//-------------------------------------------------------------------------
/*
'slots': function() {
return this._slots;
},
*/
'slotComponents': function() {
return this._slotComponents;
},
//-------------------------------------------------------------------------
'components': function () {
return this._components;
},
'addComponent': function (aComponent) {
this.components()[aComponent.componentId()] = aComponent;
},
'removeComponent': function (aComponent) {
var componentId;
componentId = aComponent.componentId();
this.components()[componentId].remove();
delete this.components()[componentId];
},
//-------------------------------------------------------------------------
/*
'domHelper': function() {
return Clipperz.YUI.DomHelper;
},
*/
//-------------------------------------------------------------------------
/*
'domHelperAppend': function(aValue) {
Clipperz.YUI.DomHelper.append(this.element().dom, aValue);
},
*/
//-------------------------------------------------------------------------
'element': function() {
//MochiKit.Logging.logDebug(">>> BaseComponent.element");
return MochiKit.DOM.getElement(this._element);
},
'setElement': function(aNode) {
this._element = aNode;
},
//-----------------------------------------------------
'displayElement': function() {
return this.element();
},
//-------------------------------------------------------------------------
'renderInNode': function(aDomNode) {
this.setElement(aDomNode);
this.render();
},
'render': function() {
this.clear();
this.renderSelf();
this.renderComponents();
if (this.shouldShowTranslationHints()) {
this.renderTranslationHints();
}
if (this.shouldShowElementWhileRendering()) {
MochiKit.Style.showElement(this.displayElement());
};
this._isFullyRendered = true;
MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback'));
this.resetRenderingWaitingQueue();
},
'renderSelf': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
'renderComponents': function() {
var slotName;
for (slotName in this.slotComponents()) {
this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName));
}
},
//.........................................................................
'isFullyRendered': function () {
return this._isFullyRendered;
},
//.........................................................................
'renderingWaitingQueue': function () {
return this._renderingWaitingQueue;
},
'resetRenderingWaitingQueue': function () {
this._renderingWaitingQueue = [];
},
//.........................................................................
'waitUntilFullyRendered': function () {
var deferredResult;
if (this.isFullyRendered() == true) {
deferredResult = MochiKit.Async.succeed
} else {
deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false});
this.renderingWaitingQueue().push(deferredResult);
}
return deferredResult;
},
//-----------------------------------------------------
'renderTranslationHints': function () {
var translatableItems;
translatableItems = MochiKit.Selector.findChildElements(this.displayElement(), ['[stringID]']);
MochiKit.Iter.forEach(translatableItems, MochiKit.Base.method(this, 'enhanceTranslatableElement'))
},
'enhanceTranslatableElement': function (anElement) {
//Clipperz.log(">>> enhanceTranslatableElement", anElement);
// new Clipperz.PM.UI.Common.Components.TranslatorWidget({
// 'element': anElement
// });
MochiKit.Signal.connect(anElement, 'onmouseenter', MochiKit.Base.partial(Clipperz.PM.UI.Common.Components.TranslatorWidget.show, anElement, MochiKit.DOM.getNodeAttribute(anElement, 'stringID')));
MochiKit.Signal.connect(anElement, 'onmouseleave', Clipperz.PM.UI.Common.Components.TranslatorWidget.hide);
//Clipperz.log("<<< enhanceTranslatableElement");
},
//-----------------------------------------------------
'update': function(args) {
throw Clipperz.Base.exception.AbstractMethod;
},
'updateSelf': function(args) {
throw Clipperz.Base.exception.AbstractMethod;
},
'updateComponents': function(args) {
throw Clipperz.Base.exception.AbstractMethod;
},
//-----------------------------------------------------
'refresh': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
'refreshSelf': function() {
throw Clipperz.Base.exception.AbstractMethod;
},
'refreshComponents': function(args) {
throw Clipperz.Base.exception.AbstractMethod;
},
//-----------------------------------------------------
'checkSlotNamed': function(aSlotName) {
if (typeof(this._slots[aSlotName]) == 'undefined') {
throw new Error("undefined slot");
};
},
//-----------------------------------------------------
'cachedSlots': function() {
return this._cachedSlots;
},
'slotNamed': function(aSlotName) {
var result;
this.checkSlotNamed(aSlotName);
if (typeof(this.cachedSlots()[aSlotName]) == 'undefined') {
this.cachedSlots()[aSlotName] = new Clipperz.PM.UI.Common.Components.ComponentSlot(this,aSlotName);
}
result = this.cachedSlots()[aSlotName];
return result;
},
//-----------------------------------------------------
'elementForSlotNamed': function(aSlotName) {
return MochiKit.DOM.getElement(this._slots[aSlotName]);
},
//-----------------------------------------------------
'componentForSlotNamed': function(aSlotName) {
return this.slotComponents()[aSlotName];
},
'setComponentForSlotNamed': function(aComponent, aSlotName) {
var domNode;
this.checkSlotNamed(aSlotName);
if (this.slotComponents()[aSlotName] != null) {
this.slotComponents()[aSlotName].remove();
}
this.slotComponents()[aSlotName] = aComponent;
// domNode = MochiKit.DOM.getElement(this.slotNamed(aSlotName));
domNode = this.elementForSlotNamed(aSlotName);
if (domNode != null) {
aComponent.renderInNode(domNode);
}
},
//-----------------------------------------------------
/*
'purgeListeners': function() {
//MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]");
//MochiKit.Logging.logDebug("--- " + this + ".purgeListeners");
Clipperz.NotificationCenter.unregister(this);
MochiKit.Signal.disconnectAllTo(this);
//MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners");
},
*/
//-----------------------------------------------------
'clear': function() {
var slotName;
var componentId;
MochiKit.Signal.disconnectAllTo(this);
for (slotName in this.slotComponents()) {
this.slotComponents()[slotName].clear();
}
for (componentId in this.components()) {
this.components()[componentId].clear();
}
// if (this.element() != null) {
// this.element().innerHTML = "";
// }
if (this.displayElement() != null) {
if (this.element() != this.displayElement()) {
MochiKit.DOM.removeElement(this.displayElement());
} else {
this.displayElement().innerHTML = "";
}
}
if (this.isModal()) {
// TODO: cleanup when the closed element was shown modally.
}
},
'remove': function() {
var slotName;
var componentId;
for (slotName in this.slotComponents()) {
this.slotComponents()[slotName].remove();
delete this.slotComponents()[slotName];
}
for (componentId in this.components()) {
this.components()[componentId].remove();
delete this.components()[componentId];
}
this.clear();
MochiKit.Signal.disconnectAll(this);
},
'append': function(aNode, aValue) {
return Clipperz.DOM.Helper.append(aNode, aValue);
},
'insertBefore': function (aNode, aValue) {
return Clipperz.DOM.Helper.insertBefore(aNode, aValue);
},
'insertAfter': function (aNode, aValue) {
return Clipperz.DOM.Helper.insertAfter(aNode, aValue);
},
//-------------------------------------------------------------------------
'getId': function(aValue) {
var result;
if (typeof(aValue) != 'undefined') {
result = this._ids[aValue];
if (typeof(result) == 'undefined') {
_Clipperz_PM_Components_base_id_ ++;
result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_;
this._ids[aValue] = result;
}
} else {
// result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this);
throw "call to BaseComponent.getId with an undefined value";
}
return result;
},
+ 'getAnchor': function (aValue) {
+ return '#' + this.getId(aValue);
+ },
+
//-------------------------------------------------------------------------
'getElement': function(aValue) {
return Clipperz.DOM.get(this.getId(aValue));
},
//-------------------------------------------------------------------------
'hideElement': function(anElementName) {
MochiKit.Style.hideElement(this.getElement(anElementName));
},
'showElement': function(anElementName) {
MochiKit.Style.showElement(this.getElement(anElementName));
},
//-------------------------------------------------------------------------
'activate': function () {
this._isActive = true;
},
'deactivate': function () {
this._isActive = false;
},
'isActive': function () {
return this._isActive;
},
//-------------------------------------------------------------------------
'hideSlot': function(aSlotName) {
if (this.componentForSlotNamed(aSlotName)) {
this.componentForSlotNamed(aSlotName).deactivate();
}
MochiKit.Style.hideElement(this.elementForSlotNamed(aSlotName));
},
'showSlot': function(aSlotName) {
if (this.componentForSlotNamed(aSlotName)) {
this.componentForSlotNamed(aSlotName).activate();
}
MochiKit.Style.showElement(this.elementForSlotNamed(aSlotName));
},
//-------------------------------------------------------------------------
'shouldShowTranslationHints': function () {
return false;
},
'shouldShowElementWhileRendering': function() {
return true;
},
// 'shouldRemoveElementWhenClearningUp': function () {
// return true;
// },
//-------------------------------------------------------------------------
'isModal': function() {
return this._isModal;
},
'setIsModal': function(aValue) {
this._isModal = aValue;
},
//-------------------------------------------------------------------------
'elementUsedToEnterModalState': function () {
return this._elementUsedToEnterModalState;
},
'setElementUsedToEnterModalState': function (aValue) {
this._elementUsedToEnterModalState = aValue;
},
//-------------------------------------------------------------------------
'modalDialogMask': function () {
return 'modalDialogMask';
},
'modalDialog': function () {
return 'modalDialog';
},
'modalDialogFrame': function() {
return 'modalDialogFrame'
},
//-------------------------------------------------------------------------
'deferredShowModal': function(args) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredShowModal", {trace:false});
deferredResult.addMethod(this, 'setIsModal', true);
deferredResult.addCallback(MochiKit.Style.showElement, this.modalDialogMask());
deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
var result;
var duration;
var from;
var to;
duration = someArgs.duration || 0.4;
this.setElementUsedToEnterModalState(someArgs.openFromElement);
from = Clipperz.Style.getSizeAndPosition(someArgs.openFromElement);
this.renderInNode(this.modalDialog());
MochiKit.DOM.addElementClass(this.modalDialog(), 'fixed');
to = Clipperz.Style.getSizeAndPosition(this.displayElement());
Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = Clipperz.Base.deepClone(to);
MochiKit.Style.hideElement(this.displayElement());
MochiKit.Style.showElement(this.modalDialogFrame());
result = {from:from, to:to, duration:duration};
return result;
}, this, args));
deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame());
deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
MochiKit.Style.hideElement(this.modalDialogFrame());
MochiKit.Style.showElement(this.displayElement());
}, this));
deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]);
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
'deferredHideModal': function(args) {
var deferredResult;
args = args || {};
deferredResult = new Clipperz.Async.Deferred("BaseComponent.deferredHideModal", {trace:false});
deferredResult.addCallback(MochiKit.Base.bind(function(someArgs) {
var result;
var from;
var toElement;
var to;
var duration;
toElement = args.closeToElement || this.elementUsedToEnterModalState();
duration = someArgs.duration || 0.4;
from = Clipperz.Style.getSizeAndPosition(this.displayElement());
to = Clipperz.Style.getSizeAndPosition(toElement);
MochiKit.Style.hideElement(this.displayElement());
MochiKit.Style.showElement(this.modalDialogFrame());
result = {from:from, to:to, duration:duration};
return result;
}, this, args));
deferredResult.addCallback(Clipperz.Visual.deferredResize, this.modalDialogFrame());
deferredResult.addCallback(MochiKit.Base.bind(function() {
MochiKit.Style.hideElement(this.modalDialogFrame());
MochiKit.Style.hideElement(this.modalDialogMask());
}, this));
deferredResult.addMethod(this, 'setIsModal', false);
deferredResult.addMethod(this, 'clear'); // ##############
deferredResult.addCallback(MochiKit.Async.succeed, arguments[arguments.length - 1]);
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog = function() {
Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body,
{tag:'div', id:'modalDialogWrapper', cls:'modalDialogWrapper', children:[
{tag:'div', id:'modalDialogMask', cls:'modalDialogMask'},
{tag:'div', id:'modalDialogFrame', cls:'modalDialogFrame' /*, html:"modal dialog frame"*/},
{tag:'div', id:'modalDialog', cls:'modalDialog'}
// {tag:'div', id:'modalDialog', cls:'modalDialog', children:[{tag:'div'}]}
]}
);
// MochiKit.Style.hideElement('modalDialogWrapper');
MochiKit.Style.hideElement('modalDialogMask');
MochiKit.Style.hideElement('modalDialogFrame');
// MochiKit.Style.hideElement('modalDialog');
};
//Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition = {'x':'X', 'y':'Y'};
MochiKit.DOM.addLoadEvent(Clipperz.PM.UI.Common.Components.BaseComponent_modalDialog);
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
index 716d851..1010c9d 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js
@@ -1,105 +1,113 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Common.Components');
Clipperz.PM.UI.Common.Components.Button = function(args) {
args = args || {};
Clipperz.PM.UI.Common.Components.Button.superclass.constructor.apply(this, arguments);
this._element = args.element || Clipperz.Base.exception.raise('MandatoryParameter');
this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
this._isDefault = args.isDefault || false;
this.render();
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Common.Components.BaseComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Common.Components.Button component";
},
//-------------------------------------------------------------------------
'text': function () {
return this._text;
},
'isDefault': function () {
return this._isDefault;
},
//-------------------------------------------------------------------------
'renderSelf': function () {
- this.append(this.element(), {tag:'div', id:this.getId('wrapper'), cls:'button_wrapper', children:[
+/*
+ this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button_wrapper', children:[
{tag:'div', id:this.getId('bodyWrapper'), cls:'button_bodyWrapper', children:[
{tag:'div', id:this.getId('body'), cls:'button_body', children:[
{tag:'span', html:this.text()}
]},
{tag:'div', id:this.getId('footer'), cls:'button_footer'}
]}
]});
+*/
+/*
+ this.append(this.element(), {tag:'div', id:this.getId('button'), cls:'button', children:[
+ {tag:'span', html:this.text()}
+ ]});
+*/
+ this.append(this.element(), {tag:'a', id:this.getId('button'), cls:'button', html:this.text()});
if (this.isDefault()) {
- MochiKit.DOM.addElementClass(this.getId('wrapper'), 'default');
+ MochiKit.DOM.addElementClass(this.getId('button'), 'default');
}
- MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseenter', this, 'handleOnMouseEnter');
- MochiKit.Signal.connect(this.getId('wrapper'), 'onmouseleave', this, 'handleOnMouseLeave');
- MochiKit.Signal.connect(this.getId('wrapper'), 'onmousedown', this, 'handleOnMouseDown');
- MochiKit.Signal.connect(this.getId('wrapper'), 'onclick', this, 'handleOnClick');
+// MochiKit.Signal.connect(this.getId('button'), 'onmouseenter', this, 'handleOnMouseEnter');
+// MochiKit.Signal.connect(this.getId('button'), 'onmouseleave', this, 'handleOnMouseLeave');
+// MochiKit.Signal.connect(this.getId('button'), 'onmousedown', this, 'handleOnMouseDown');
+ MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'handleOnClick');
},
//-------------------------------------------------------------------------
-
+/*
'handleOnMouseEnter': function (anEvent) {
- MochiKit.DOM.addElementClass(this.getId('wrapper'), 'hover');
+ MochiKit.DOM.addElementClass(this.getId('button'), 'hover');
},
'handleOnMouseLeave': function (anEvent) {
- MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'hover');
- MochiKit.DOM.removeElementClass(this.getId('wrapper'), 'clicked');
+ MochiKit.DOM.removeElementClass(this.getId('button'), 'hover');
+ MochiKit.DOM.removeElementClass(this.getId('button'), 'clicked');
},
'handleOnMouseDown': function (anEvent) {
- MochiKit.DOM.addElementClass(this.getId('wrapper'), 'clicked');
+ MochiKit.DOM.addElementClass(this.getId('button'), 'clicked');
},
-
+*/
'handleOnClick': function (anEvent) {
MochiKit.Signal.signal(this, 'onclick', anEvent);
},
-
+
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
index 1992154..1d816a9 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js
@@ -1,279 +1,297 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) {
args = args || {};
Clipperz.PM.UI.Common.Components.SimpleMessagePanel.superclass.constructor.apply(this, arguments);
this._title = args.title || Clipperz.Base.exception.raise('MandatoryParameter');
this._text = args.text || Clipperz.Base.exception.raise('MandatoryParameter');
this._type = args.type || Clipperz.Base.exception.raise('MandatoryParameter'); // ALERT, INFO, ERROR
this._buttons = args.buttons || Clipperz.Base.exception.raise('MandatoryParameter');
this._buttonComponents = [];
this._deferred = null;
this.renderModalMask();
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clipperz.PM.UI.Common.Components.BaseComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Common.Components.SimpleMessagePanel component";
},
//-------------------------------------------------------------------------
'deferred': function() {
if (this._deferred == null) {
this._deferred = new Clipperz.Async.Deferred("SimpleMessagePanel.deferred", {trace:false});
}
return this._deferred;
},
//-------------------------------------------------------------------------
'title': function () {
return this._title;
},
'setTitle': function (aValue) {
this._title = aValue;
if (this.getElement('title') != null) {
this.getElement('title').innerHTML = aValue;
}
},
//-------------------------------------------------------------------------
'text': function () {
return this._text;
},
'setText': function (aValue) {
this._text = aValue;
if (this.getElement('text') != null) {
this.getElement('text').innerHTML = aValue;
}
},
//-------------------------------------------------------------------------
'type': function () {
return this._type;
},
'setType': function (aValue) {
- if (this.getElement('icon') != null) {
- MochiKit.DOM.removeElementClass(this.getId('icon'), this._type);
- MochiKit.DOM.addElementClass(this.getId('icon'), aValue);
- }
+// if (this.getElement('icon') != null) {
+// MochiKit.DOM.removeElementClass(this.getId('icon'), this._type);
+// MochiKit.DOM.addElementClass(this.getId('icon'), aValue);
+// }
this._type = aValue;
},
+ 'icon': function () {
+ var type = this.type();
+ var result;
+
+ if (type == 'ALERT') {
+ result = '!';
+ } else if (type == 'INFO') {
+ result = 'i';
+ } else if (type == 'ERROR') {
+ result = '!';
+ }
+
+ return result;
+ },
+
//-------------------------------------------------------------------------
'buttons': function () {
return this._buttons;
},
'setButtons': function (someValues) {
MochiKit.Iter.forEach(this.buttonComponents(), MochiKit.Base.methodcaller('clear'));
this._buttons = someValues;
if (this.getElement('buttonArea') != null) {
this.renderButtons();
}
},
//.........................................................................
'buttonComponents': function () {
return this._buttonComponents;
},
//-------------------------------------------------------------------------
'renderSelf': function() {
this.append(this.element(), {tag:'div', cls:'SimpleMessagePanel', id:this.getId('panel'), children: [
- {tag:'div', cls:'header', children:[]},
+// {tag:'div', cls:'header', children:[]},
{tag:'div', cls:'body', children:[
- {tag:'div', id:this.getId('icon'), cls:'img ' + this.type(), children:[{tag:'div'}]},
+// {tag:'div', id:this.getId('icon'), cls:'img ' + this.type(), children:[{tag:'div'}]},
+ {tag:'div', /*id:this.getId('icon'),*/ cls:'img ' + this.type(), children:[{tag:'canvas', id:this.getId('icon')}]},
{tag:'h3', id:this.getId('title'), html:this.title()},
{tag:'p', id:this.getId('text'), html:this.text()},
{tag:'div', id:this.getId('container')},
{tag:'div', id:this.getId('buttonArea'), cls:'buttonArea', children:[]}
- ]},
- {tag:'div', cls:'footer', children:[]}
+ ]}
+// {tag:'div', cls:'footer', children:[]}
]});
+ Clipperz.PM.UI.Canvas.marks[this.icon()](this.getElement('icon'), "#ffffff");
+
MochiKit.Signal.connect(this.getId('panel'), 'onkeydown', this, 'keyDownHandler');
this.renderButtons();
},
//-------------------------------------------------------------------------
'renderButtons': function () {
this.getElement('buttonArea').innerHTML = '';
MochiKit.Base.map(MochiKit.Base.bind(function (aButton) {
var buttonElement;
var buttonComponent;
// element = this.append(this.getElement('buttonArea'), {tag:'div', cls:'button' + (aButton['isDefault'] === true ? ' default' : ''), children:[
// {tag:'a', href:'#'/*, id:this.getId('buttonLink')*/, html:aButton['text']}
// ]});
buttonElement = this.append(this.getElement('buttonArea'), {tag:'div'});
buttonComponent = new Clipperz.PM.UI.Common.Components.Button({'element':buttonElement, 'text':aButton['text'], 'isDefault':aButton['isDefault']});
this.buttonComponents().push(buttonComponent);
MochiKit.Signal.connect(buttonComponent, 'onclick', MochiKit.Base.method(this, 'buttonEventHandler', aButton));
}, this), MochiKit.Iter.reversed(this.buttons()));
},
//-------------------------------------------------------------------------
'displayElement': function() {
return this.getElement('panel');
},
//-------------------------------------------------------------------------
'closeOk': function () {
this.deferred().callback();
this._deferred = null;
},
'closeCancel': function () {
this.deferred().cancel();
this._deferred = null;
},
'closeError': function () {
this.deferred().errback();
this._deferred = null;
},
//-------------------------------------------------------------------------
'buttonEventHandler': function(aButton, anEvent) {
anEvent.preventDefault();
// MochiKit.Signal.signal(this, 'cancelEvent');
switch (aButton['result']) {
case 'OK':
//console.log("==> OK");
this.closeOk();
break;
case 'CANCEL':
//console.log("==> CANCEL");
this.closeCancel();
break;
default:
//console.log("==> ????");
this.closeError();
break;
}
//console.log("<==");
},
//-------------------------------------------------------------------------
'deferredShow': function (someArgs, aResult) {
this.deferredShowModal(someArgs);
this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement });
this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement }));
this.deferred().addCallback(MochiKit.Async.succeed, aResult);
return this.deferred();
},
//-------------------------------------------------------------------------
'modalDialogMask': function () {
return this.getId('modalDialogMask');
},
'modalDialog': function () {
return this.getId('modalDialog');
},
'modalDialogFrame': function() {
return this.getId('modalDialogFrame');
},
//-------------------------------------------------------------------------
'renderModalMask': function () {
Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body,
{tag:'div', id:this.getId('modalDialogWrapper'), cls:'modalDialogWrapper simpleMessagePanelMask', children:[
{tag:'div', id:this.getId('modalDialogMask'), cls:'modalDialogMask simpleMessagePanelMask'},
{tag:'div', id:this.getId('modalDialogFrame'), cls:'modalDialogFrame simpleMessagePanelMask'},
{tag:'div', id:this.getId('modalDialog'), cls:'modalDialog simpleMessagePanelMask'}
]}
);
MochiKit.Style.hideElement(this.getId('modalDialogMask'));
MochiKit.Style.hideElement(this.getId('modalDialogFrame'));
},
//-------------------------------------------------------------------------
'keyDownHandler': function (anEvent) {
if (anEvent.key().string == 'KEY_ENTER') {
anEvent.preventDefault();
//console.log("13 - RETURN ?", this);
this.closeOk();
//console.log('<<< 13')
}
if (anEvent.key().string == 'KEY_ESCAPE') {
anEvent.preventDefault();
//console.log("27 - ESC ?", this);
this.closeCancel();
//console.log("<<< 27");
}
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js
new file mode 100644
index 0000000..32dfa63
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js
@@ -0,0 +1,299 @@
+/*
+
+Copyright 2008-2011 Clipperz Srl
+
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an 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 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.
+ 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/>.
+
+*/
+
+Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
+
+Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) {
+ args = args || {};
+
+ Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments);
+
+// this._cardReference = null;
+
+ return this;
+}
+
+//=============================================================================
+
+Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, {
+
+ //-------------------------------------------------------------------------
+
+ 'toString': function () {
+ return "Clipperz.PM.UI.Mobile.Components.CardDetail component";
+ },
+
+ //-------------------------------------------------------------------------
+/*
+ 'cardReference': function () {
+ return this._cardReference;
+ },
+
+ 'setCardReference': function (aValue) {
+ this._cardReference = aValue;
+ },
+*/
+ //-------------------------------------------------------------------------
+
+ 'renderSelf': function () {
+console.log("CardDetail.renderSelf");
+ this.append(this.element(), {tag:'div', cls:'cardDetail', children:[
+ {tag:'div', cls:'toolbar', children:[
+ {tag:'a', href:'#', cls:'back', html:"List"},
+ {tag:'h1', id:this.getId('cardTitle'), html:"…"}
+ ]},
+ {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[
+ ]}
+ ]});
+ },
+/*
+ 'renderSelf': function() {
+ this.append(this.element(), [
+ {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[
+ {tag:'div', id:this.getId('progressBar')} //,
+ ]}
+ ]);
+
+ this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
+ MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0);
+ },
+*/
+
+ 'setTitle': function (aValue) {
+ this.getElement('cardTitle').innerHTML = aValue;
+ },
+
+ 'fieldListElement': function () {
+ var result;
+
+ result = this.getElement('fieldList');
+ if (result == null) {
+ result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('fieldList')});
+ }
+
+ return result;
+ },
+
+ 'renderFieldValues': function (someFieldValues) {
+ var fieldClass;
+
+ if ((someFieldValues['actionType'] != 'NONE') || (someFieldValues['label'] != '') && (someFieldValues['value'] != '')) {
+ if (someFieldValues['isHidden'] == true) {
+ fieldClass = 'password';
+ } else {
+ fieldClass = '';
+ }
+
+ this.append(this.fieldListElement(), {tag:'li', cls:'cardField', children:[
+ {tag:'a', href:'#', cls:fieldClass, html:someFieldValues['value'], children:[
+ {tag:'small', cls:'label', html:someFieldValues['label']}
+ ]}
+ ]})
+ }
+ },
+
+ 'addField': function (aField) {
+ var deferredResult;
+ var fieldValues;
+
+ fieldValues = {};
+ deferredResult = new Clipperz.Async.Deferred("CardDetail.addField", {trace:false});
+ deferredResult.addMethod(aField, 'label');
+ deferredResult.addCallback(function (aValue) { fieldValues['label'] = aValue; });
+ deferredResult.addMethod(aField, 'value');
+ deferredResult.addCallback(function (aValue) { fieldValues['value'] = aValue; });
+ deferredResult.addMethod(aField, 'actionType');
+ deferredResult.addCallback(function (aValue) { fieldValues['actionType'] = aValue; });
+ deferredResult.addMethod(aField, 'isHidden');
+ deferredResult.addCallback(function (aValue) { fieldValues['isHidden'] = aValue; });
+ deferredResult.addMethod(this, 'renderFieldValues', fieldValues);
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'directLoginElement': function () {
+ var result;
+
+ result = this.getElement('directLoginList');
+ if (result == null) {
+ this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"});
+ result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')});
+ }
+
+ return result;
+ },
+
+ 'addDirectLogin': function (aDirectLogin) {
+ this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[
+ {tag:'a', href:'#', html:"direct login", children:[
+ {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]}
+ ]}
+ ]})
+
+console.log("ADD DIRECT LOGIN", aDirectLogin);
+ },
+
+ //=========================================================================
+
+ 'showCard': function (aCard) {
+ var deferredResult;
+
+// this.render();
+
+console.log("CardDetail.showCard", aCard);
+ deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false});
+ deferredResult.addMethod(aCard, 'label');
+ deferredResult.addMethod(this, 'setTitle');
+
+ deferredResult.addMethod(aCard, 'fields');
+ deferredResult.addCallback(MochiKit.Base.values);
+ deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField'));
+
+ deferredResult.addMethod(aCard, 'directLogins');
+ deferredResult.addCallback(MochiKit.Base.values);
+ deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin'));
+
+
+ deferredResult.callback();
+
+ return deferredResult;
+// return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [
+// MochiKit.Base.method(this.record(), 'hasPendingChanges'),
+// MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'),
+//
+// MochiKit.Base.method(this.record(), 'label'),
+// MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'),
+// MochiKit.Base.method(this.record(), 'notes'),
+// MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'),
+//
+// MochiKit.Base.method(this.record(), 'fields'),
+// MochiKit.Base.values,
+// MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')),
+//
+// MochiKit.Base.method(this.record(), 'directLogins'),
+// MochiKit.Base.values,
+// MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')),
+//
+// MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
+// MochiKit.Base.noop
+// ], {trace:false});
+
+ },
+
+ //=========================================================================
+
+ 'showCardDetails': function (someData) {
+ this.element().innerHTML = '';
+ this.append(this.element(), [
+ {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) {
+ return {tag:'div', cls:'row', children:[
+ {tag:'label', html:aFieldData['label']},
+// {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), html:aFieldData['value']}
+ {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), children:[
+ {tag:'div', children:[{tag:'p', html:aFieldData['value']}]}
+ ]}
+// {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), value:aFieldData['value'], disabled:true}
+
+ ]}
+ }, someData['fields'])}
+ ]);
+
+ MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) {
+ MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); })
+ }, this));
+
+ if (someData['directLogins'].length > 0) {
+ this.append(this.element(), [
+ {tag:'h2', html:"Direct logins"},
+ {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) {
+ return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[
+ {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']},
+// {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']}
+ {tag:'span', cls:'directLogin', html:aDirectLoginData['label']}
+ ]}
+ }, someData['directLogins'])}
+ ]);
+
+ MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) {
+ MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler');
+ }, this),
+ MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row'])
+ )
+ };
+
+ if (someData['notes'] != '') {
+ this.append(this.element(), [
+ {tag:'h2', html:"Notes"},
+ {tag:'fieldset', id:this.getId('fieldset'), children:[
+ {tag:'div', cls:'row notes', children:[
+ {tag:'span', html:someData['notes']}
+ ]}
+ ]}
+ ]);
+ };
+
+ return true;
+ },
+
+ //-------------------------------------------------------------------------
+/*
+ 'toggleClickHandler': function (anEvent) {
+ var nextState;
+ var fieldValue;
+
+//console.log("TOGGLE");
+ anEvent.preventDefault;
+ fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0];
+
+ nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true');
+ if (nextState) {
+ MochiKit.DOM.removeElementClass(fieldValue, 'clear');
+ } else {
+ MochiKit.DOM.addElementClass(fieldValue, 'clear');
+ }
+
+ MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState);
+ },
+* /
+ //=========================================================================
+/*
+ 'directLoginClickHandler': function (anEvent) {
+ anEvent.preventDefault();
+
+ if (/(directLogin_)/.test(anEvent.src().id)) {
+ var directLoginReference;
+
+ directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2];
+ MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference});
+ }
+ },
+*/
+ //=========================================================================
+
+ __syntaxFix__: "syntax fix"
+});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
index c3f2701..a4aa212 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
@@ -1,201 +1,254 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
-Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components');
+Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
-Clipperz.PM.UI.iPhone.Components.CardList = function(args) {
+Clipperz.PM.UI.Mobile.Components.CardList = function(args) {
args = args || {};
- Clipperz.PM.UI.iPhone.Components.CardList.superclass.constructor.apply(this, arguments);
+ Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments);
this._cardDetail = null;
return this;
}
//=============================================================================
-Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, {
+Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, {
//-------------------------------------------------------------------------
'toString': function () {
- return "Clipperz.PM.UI.iPhone.Components.CardList component";
+ return "Clipperz.PM.UI.Mobile.Components.CardList component";
},
//-------------------------------------------------------------------------
- 'renderSelf': function(/*aContainer, aPosition*/) {
- this.append(this.element(), [
- {tag:'div', cls:'toolbar', id:'toolbar', children:[
- {tag:'h1', id:'pageTitle', html:"cards"},
- {tag:'a', id:'backButton', cls:'button', href:'#', html:"cards"}
+ 'renderSelf': function () {
+ this.append(this.element(), {tag:'div', cls:'cardList', children:[
+ {tag:'div', cls:'toolbar', children:[
+ {tag:'h1', html:"clipperz"},
+// {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')},
+ {tag:'a', href:'#', id:'settings', cls:'button', html:"*"}
]},
- {tag:'div', cls:'cardList', id:this.getId('cardList'), children:[
- {tag:'form', title:'search', cls:'panel cardListSearchForm', id:this.getId('cardListSearchForm'), children:[
- {tag:'input', type:'search', name:'search', value:"", placeholder:"search", id:this.getId('searchField')}
- ]},
- {tag:'ul', cls:'panel cardListPanel', id:this.getId('cardListPanel'), children:[]}
- ]},
- {tag:'div', cls:'panel cardDetailPanel', id:this.getId('cardDetail')}
- ]);
-
- MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this, 'searchHandler');
- MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this, 'searchHandler');
- MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this, 'searchHandler');
+ {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[
+ {tag:'ul', cls:'rounded', id:this.getId('list'), children:[
+ {tag:'li', html:'loading'}
+ ]}
+ ]}
+ ]});
+
+ MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler');
+ MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart', this, 'cardSelectionHandler');
+// MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this, 'searchHandler');
+// MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this, 'searchHandler');
+// MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this, 'searchHandler');
- MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this, 'cardListClickHandler');
- MochiKit.Signal.connect('backButton', 'onclick', this, 'backButtonClickHandler');
+// MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this, 'cardListClickHandler');
+// MochiKit.Signal.connect('backButton', 'onclick', this, 'backButtonClickHandler');
- MochiKit.Style.hideElement('backButton');
- MochiKit.Style.hideElement(this.getElement('cardDetail'));
+// MochiKit.Style.hideElement('backButton');
+// MochiKit.Style.hideElement(this.getElement('cardDetail'));
},
- //-------------------------------------------------------------------------
+ 'showCards': function (someCards) {
+ var cardListElement;
+ if (this.isFullyRendered() == false) {
+ this.render();
+ };
+
+ cardListElement = this.getElement('list')
+
+ cardInfo = {
+ '_rowObject': MochiKit.Async.succeed,
+ '_reference': MochiKit.Base.methodcaller('reference'),
+ '_searchableContent': MochiKit.Base.methodcaller('searchableContent'),
+ 'label': MochiKit.Base.methodcaller('label'),
+ 'favicon': MochiKit.Base.methodcaller('favicon')
+ };
+
+//console.log("someCards", someCards);
+ deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false});
+ deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false}));
+ deferredResult.addCallback(Clipperz.Async.collectAll);
+ deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label')));
+ deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement);
+// deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading');
+ deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement));
+ deferredResult.callback(someCards);
+ },
+
+ 'appendCardToList': function (aCardListElement, aCardInfo) {
+//console.log("appendCardToList", aCardInfo);
+ this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[
+ {tag:'a', href:'#', html:aCardInfo['label'], children:[
+ {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]}
+ ]}
+ ]});
+ },
+
+ 'cardSelectionHandler': function (anEvent) {
+ var listElement;
+ var cardReference;
+
+ anEvent.preventDefault();
+
+ listElement = anEvent.target();
+ if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) {
+ listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem');
+ }
+ cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference');
+console.log("###", listElement, cardReference);
+ // TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected
+ MochiKit.Signal.signal(this, 'selectedCard', cardReference);
+ },
+ //-------------------------------------------------------------------------
+/*
'searchHandler': function (anEvent) {
if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { // RETURN
anEvent.preventDefault();
} else {
if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) {
anEvent.target().value = "";
}
if (anEvent.type() == 'keyup') {
MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value);
}
}
},
//-------------------------------------------------------------------------
'update': function (someObjects) {
var cardListPanel;
var i,c;
cardListPanel = this.getElement('cardListPanel');
cardListPanel.innerHTML = '';
c = someObjects.length;
for (i=0; i<c; i++) {
this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[
{tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')},
{tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']}
]})
MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler');
}
},
'cardListClickHandler': function (anEvent) {
anEvent.preventDefault();
if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) {
var cardListReference;
cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2];
//console.log("Showing detail for card named", cardListReference);
MochiKit.Signal.signal(this, 'selectedCard', cardListReference);
}
},
//=========================================================================
'cardDetail': function (someData) {
if (this._cardDetail == null) {
- this._cardDetail = new Clipperz.PM.UI.iPhone.Components.CardDetail({element:this.getElement('cardDetail')});
+ this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')});
}
return this._cardDetail;
},
//-------------------------------------------------------------------------
'removeCardDetail': function () {
if (this._cardDetail != null) {
this._cardDetail.remove();
this._cardDetail = null;
}
},
//=========================================================================
'showCard': function (someData) {
var deferredResult;
var offset;
offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
this.cardDetail().render();
this.cardDetail().setCardReference(someData['_reference']);
MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset});
new MochiKit.Visual.Sequence([
// new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}),
new MochiKit.Visual.Parallel([
new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative', transition:MochiKit.Visual.Transitions.linear, sync:true}),
new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute', transition:MochiKit.Visual.Transitions.linear, sync:true}),
// new MochiKit.Visual.ScrollTo('toolbar', {sync:true}),
MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
], {duration:1, sync:true}),
MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true})
], {})
MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title'];
return true;
},
//-------------------------------------------------------------------------
'showCardDetails': function (someData) {
return this.cardDetail().showCardDetails(someData);
},
//=========================================================================
'backButtonClickHandler': function (anEvent) {
var offset;
anEvent.preventDefault();
MochiKit.DOM.getElement('pageTitle').innerHTML = "cards";
offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset});
MochiKit.DOM.showElement(this.getElement('cardList'));
new MochiKit.Visual.Parallel([
new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative', transition:MochiKit.Visual.Transitions.linear, sync:true}),
new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative', transition:MochiKit.Visual.Transitions.linear, sync:true}),
MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}),
MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')})
},
-
+*/
//=========================================================================
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js
new file mode 100644
index 0000000..eafcdbc
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js
@@ -0,0 +1,356 @@
+/*
+
+Copyright 2008-2011 Clipperz Srl
+
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an 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 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.
+ 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/>.
+
+*/
+
+Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
+
+Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) {
+ args = args || {};
+
+ this._pin = '';
+
+ this._message = null;
+ this._steps = 0;
+ this._actualSteps = 0;
+
+ this._callback = null;
+ this._errorCallback = null;
+
+ this._mode = 'CREDENTIALS';
+
+ Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments);
+
+ return this;
+}
+
+//=============================================================================
+
+Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, {
+
+ //-------------------------------------------------------------------------
+
+ 'toString': function () {
+ return "Clipperz.PM.UI.Mobile.Components.LoginForm component";
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'callback': function () {
+ return this._callback;
+ },
+
+ 'errorCallback': function () {
+ return this._errorCallback;
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'mode': function () {
+ return this._mode;
+ },
+
+ 'setMode': function (aValue) {
+ this._mode = aValue;
+ },
+
+ //..........................................................................
+
+ 'pin': function () {
+ return this._pin;
+ },
+
+ 'setPin': function (aValue) {
+ this._pin = aValue;
+ },
+
+ //..........................................................................
+
+ 'username': function () {
+ return this._username;
+ },
+
+ 'setUsername': function (aValue) {
+ this._username = aValue;
+ },
+
+ //..........................................................................
+
+ 'passphrase': function () {
+ return this._passphrase;
+ },
+
+ 'setPassphrase': function (aValue) {
+ this._passphrase = aValue;
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'message': function () {
+ return this._message;
+ },
+
+ '_setMessage': function (aValue) {
+ this._message = aValue;
+
+ if (aValue == null) {
+ MochiKit.Style.hideElement(this.getElement('credentialsMessage'));
+ } else {
+ this.getElement('message').innerHTML = aValue;
+ MochiKit.Style.showElement(this.getElement('credentialsMessage'));
+ }
+ },
+
+ 'setMessage': function (aValue) {
+ this._setMessage(aValue);
+ MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error');
+ },
+
+ 'setErrorMessage': function (aValue) {
+ this._setMessage(aValue);
+ MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error');
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'setCallbacks': function (args) {
+ this._callback = args['callback'];
+ this._errorCallback = args['errorCallback'];
+ },
+
+ 'showErrors': function (args) {
+//console.log("LoginForm.showErrors", args);
+ if (args['previousFailedAttempt'] == 'LOGIN') {
+ this.setErrorMessage("Wrong credentials");
+ } else if (args['previousFailedAttempt'] == 'PIN') {
+ if (args['failedAttempts'] == -1) {
+ this.setErrorMessage("Wrong PIN - Resetted");
+ } else {
+ this.setErrorMessage("Wrong PIN");
+ }
+ } else {
+ this.setMessage(null);
+ }
+ },
+
+ 'updateWithArgs': function (args) {
+ this.renderIfNeeded();
+ this.setCallbacks(args);
+ this.showErrors(args);
+ this.updateRendering();
+ },
+
+ 'showPinLogin': function (args) {
+ this.setPin('');
+ this.setMode('PIN');
+ this.updateWithArgs(args);
+
+// $(this.getAnchor('PIN')).focus();
+ this.getElement('PIN').focus();
+ },
+
+ 'showCredentialsLogin': function (args) {
+ this.setMode('CREDENTIALS');
+ this.updateWithArgs(args);
+
+ if (this.getElement('usernameField').value.length == 0) {
+// $(this.getAnchor('usernameField')).focus();
+ this.getElement('usernameField').focus();
+ } else {
+// $(this.getAnchor('passphraseField')).focus();
+ this.getElement('passphraseField').focus();
+ this.getElement('passphraseField').select();
+ }
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'renderIfNeeded': function () {
+ if (this.isFullyRendered() == false) {
+ this.render();
+ };
+ this.updateRendering();
+ },
+
+ 'updateRendering': function () {
+ MochiKit.Style.showElement(this.getElement('credentialsBody'));
+ MochiKit.Style.hideElement(this.getElement('validating'));
+
+// this.hideAllPanes();
+ MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div'));
+ if (this.mode() == 'CREDENTIALS') {
+ selectedPanel = this.getElement('credentials')
+ } else if (this.mode() == 'PIN') {
+ selectedPanel = this.getElement('pin')
+// this.updatePinDisplay();
+ } else {
+ throw 'Unhandled login form mode';
+ }
+ MochiKit.Style.showElement(selectedPanel);
+
+ MochiKit.Style.hideElement(this.getElement('validating'));
+ },
+
+ 'renderSelf': function() {
+ var selectedPanel;
+ this.append(this.element(), {tag:'div', id:'login', children:[
+ {tag:'div', cls:'toolbar', children:[
+ {tag:'h1', html:"clipperz"}
+ ]},
+ {tag:'div', cls:'scroll', children:[
+ //==================================================================
+ {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[
+ {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"}
+ ]},
+ //==================================================================
+ {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[
+ //--------------------------------------------------------------
+ {tag:'div', cls:'pin', id:this.getId('pin'), children:[
+ {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[
+ {tag:'ul', cls:'edit rounded', children:[
+ {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]},
+ ]},
+ {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"}
+ ]}
+ ]},
+ //--------------------------------------------------------------
+ {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[
+ {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[
+ {tag:'ul', cls:'edit rounded', children:[
+ {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]},
+ {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/ placeholder:"passphrase", id:this.getId('passphraseField') }]}
+ ]},
+ {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"}
+// {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"}
+
+ ]}
+ ]},
+ //--------------------------------------------------------------
+ ]},
+ //==================================================================
+ {tag:'div', cls:'validating', id:this.getId('validating'), children:[
+ {tag:'div', cls:'loading', children:[
+ {tag:'div', cls:'spinner', children:[
+ {tag:'div', cls:'bar01'},
+ {tag:'div', cls:'bar02'},
+ {tag:'div', cls:'bar03'},
+ {tag:'div', cls:'bar04'},
+ {tag:'div', cls:'bar05'},
+ {tag:'div', cls:'bar06'},
+ {tag:'div', cls:'bar07'},
+ {tag:'div', cls:'bar08'},
+ {tag:'div', cls:'bar09'},
+ {tag:'div', cls:'bar10'},
+ {tag:'div', cls:'bar11'},
+ {tag:'div', cls:'bar12'}
+ ]}
+ ]},
+ {tag:'div', id:this.getId('loadingMessage')},
+ {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"}
+ ]}
+ //==================================================================
+ ]}
+ ]});
+
+ MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler');
+ MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler');
+
+ MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler');
+ MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler');
+
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle');
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress', this, 'updateProgressHandle');
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress', this, 'advanceProgressHandle');
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle');
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'submitPinHandler': function (anEvent) {
+ var pin;
+
+ this.setMessage(null);
+ pin = this.getElement('PIN').value;
+// $(this.getAnchor('PIN')).blur();
+ this.getElement('PIN').blur();
+
+ credentials = Clipperz.PM.PIN.credentialsWithPIN(pin);
+ this.loginWithCredentials(credentials);
+ },
+
+ 'submitCredentialsHandler': function (anEvent) {
+//console.log("submitCredentialsHandler");
+ var credentials;
+
+ this.setMessage(null);
+
+ credentials = {};
+ credentials['username'] = this.getElement('usernameField').value;
+ credentials['passphrase'] = this.getElement('passphraseField').value;
+// $(this.getAnchor('passphraseField')).blur();
+ this.getElement('passphraseField').blur();
+
+ this.loginWithCredentials(credentials);
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'loginWithCredentials': function (someCredentials) {
+ var args;
+
+ args = {};
+ args['credentials'] = someCredentials;
+ args['errorCallback'] = this.errorCallback();
+
+ MochiKit.Style.hideElement(this.getElement('credentialsBody'));
+ MochiKit.Style.showElement(this.getElement('validating'));
+
+ MochiKit.Async.callLater(0.1, this.callback(), args);
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'initProgressHandle': function (anEvent) {
+//console.log("** initProgressHandle", anEvent);
+ this._steps = anEvent['steps'];
+ this._actualSteps = 0;
+ },
+
+ 'updateProgressHandle': function (anEvent) {
+//console.log("** updateProgressHandle", anEvent);
+ this._steps += anEvent['extraSteps'];
+ },
+
+ 'advanceProgressHandle': function (anEvent) {
+//console.log("** advanceProgressHandle", anEvent);
+ this._actualSteps ++;
+//console.log("STEPS: " + this._actualSteps + "/" + this._steps);
+ },
+
+ 'progressDoneHandle': function (anEvent) {
+//console.log("** progressDoneHandle", anEvent);
+ },
+
+ //-------------------------------------------------------------------------
+ __syntaxFix__: "syntax fix"
+});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js
new file mode 100644
index 0000000..12a61f7
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js
@@ -0,0 +1,393 @@
+/*
+
+Copyright 2008-2011 Clipperz Srl
+
+This file is part of Clipperz Community Edition.
+Clipperz Community Edition is an 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 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.
+ 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/>.
+
+*/
+
+Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers');
+
+Clipperz.PM.UI.Mobile.Controllers.MainController = function() {
+ this._jQTouch = null;
+ this._user = null;
+ this._proxy = null;
+ this._loginForm = null;
+ this._cardList = null;
+ this._cardDetail = null;
+
+ return this;
+}
+
+MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, {
+
+ 'toString': function () {
+ return "Clipperz.PM.UI.Mobile.Controllers.MainController";
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'user': function () {
+ return this._user;
+ },
+
+ 'setUser': function (aValue) {
+ this._user = aValue;
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'jQTouch': function () {
+ return this._jQTouch;
+ },
+
+ 'setJQTouch': function (aValue) {
+ this._jQTouch = aValue;
+ },
+
+ //=========================================================================
+
+ 'run': function () {
+ console.log("MainController.run");
+
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin'));
+ Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[
+ {tag:'div', id:'loginForm'},
+ {tag:'div', id:'cardList'},
+ {tag:'div', id:'cardDetail'},
+ {tag:'div', id:'preferences'}
+ ]});
+
+ this.showLoginForm();
+
+ this.initjQTouch();
+
+
+// this.showAddToHomeScreenBaloon();
+// this.selectInitialProxy();
+ },
+
+ 'initjQTouch': function () {
+ var jqt;
+
+ jqt = new $.jQTouch({
+ icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAz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mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==',
+// icon4: 'jqtouch4.png',
+// startupScreen: null, // Pass a string path to a 320px x 460px startup screen for full screen apps.
+ statusBar: 'black-translucent', // Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`.
+// addGlossToIcon: true, // Set to 'false' to prevent automatic glossy button effect on icon.
+ preloadImages: false, // Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']`
+ fixedViewport: true, // Removes the user's ability to scale the page. Ensures the site behaves more like an application.
+// fullScreen: true, // The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable.
+// fullScreenClass: 'fullscreen' // Adds a class to the `<body>` when running in full-screen mode, to allow for easy detection and styling. Set to `false` to disable.
+// themeSelectionSelector: '#jqt #themes ul', // ???
+
+// useAnimations: true, // Set to `false` to disable all animations.
+// useFastTouch: true, // Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental**
+// useTouchScroll: true, // Adds support for iOS5 scrolling. Set to false to disable. **Experimental**
+
+ cacheGetRequests: false, // Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true)
+
+// backSelector: '.back, .cancel, .goback', // A CSS selector for back links/buttons. When clicked, the page history goes back one, automatically reversing whichever entrance animation was used.
+
+// cubeSelector: '.cube', // Link selector for a cube animation.
+// dissolveSelector: '.dissolve', // Link selector for a dissolve animation.
+// fadeSelector: '.fade', // Link selector for a fade animation.
+// flipSelector: '.flip', // Link selector for a 3d flip animation.
+ formSelector: null, // Sets which forms are automatically submitted via Ajax. (default: 'form')
+// popSelector: '.pop', // Link selector for a pop animation. (default: '.pop')
+// slideSelector: 'body > * > ul li a', // Link selector for the default slide-left transition. By default applies to all links within an unordered list. Accepts any jQuery-capable selector `'li &gt; a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a')
+// slideupSelector: '.slideup', // Link selector for a slide up animation. (default: '.slideup')
+// submitSelector: '.submit', // Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit')
+// swapSelector: '.swap', // Link selector for 3d swap animation. (default: '.swap')
+// touchSelector: 'a, .touch', // Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch')
+
+ debug: false
+ });
+
+ this.setJQTouch(jqt);
+ },
+
+ //=========================================================================
+
+ 'showAddToHomeScreenBaloon': function () {
+console.log(">>> showAddToHomeScreenBaloon");
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'selectInitialProxy': function () {
+//console.log(">>> selectInitialProxy");
+ if (this.isOnline()) {
+//console.log("--- selectInitialProxy: using default proxy");
+ this._proxy = Clipperz.PM.Proxy.defaultProxy;
+ } else {
+ if (this.hasLocalData()) {
+//console.log("--- selectInitialProxy: using local cache proxy");
+ this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false});
+ } else {
+ this.showOfflineError();
+ }
+ }
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'showLoginForm': function (args) {
+ args = args || {};
+
+ args['callback'] = MochiKit.Base.method(this, 'doLogin');
+
+ if (Clipperz.PM.PIN.isSet()) {
+ args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin');
+ this.loginForm().showPinLogin(args);
+ } else {
+ args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin');
+ this.loginForm().showCredentialsLogin(args);
+ }
+ },
+
+ //.........................................................................
+
+ 'handleFailedCredentialsLogin': function () {
+console.log("LOGIN FAILED");
+ this.showLoginForm({'previousFailedAttempt':'LOGIN'});
+ },
+
+ //.........................................................................
+
+ 'handleFailedPinLogin': function () {
+ var failedAttempts;
+ var status;
+
+ failedAttempts = Clipperz.PM.PIN.recordFailedAttempt();
+ this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts});
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'doLogin': function (someArgs) {
+ var deferredResult;
+ var credentials;
+ var errorCallback;
+ var user;
+ var getPassphraseDelegate;
+
+//console.log(">>> MainController.doLogin", someArgs);
+ credentials = someArgs['credentials'];
+ errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop;
+
+ getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase);
+ user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate});
+
+ deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false});
+ deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
+ deferredResult.addCallback(MochiKit.Async.wait, 0.1);
+ deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
+ deferredResult.addMethod(user, 'login');
+ deferredResult.addCallbacks(
+ MochiKit.Base.method(this, 'processSuccessfulLogin', user),
+ errorCallback
+ );
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //..........................................................................
+
+ 'processSuccessfulLogin': function (aUser) {
+ var deferredResult;
+
+ deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false});
+ deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount');
+// deferredResult.addMethod(this, 'removeLoginForm');
+ deferredResult.addMethod(this, 'setUser', aUser);
+ deferredResult.addMethod(this, 'setupApplication');
+ deferredResult.addMethod(this, 'runApplication');
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'setupApplication': function () {
+ var deferredResult;
+
+console.log(">>> setupApplication");
+ deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false});
+ deferredResult.addMethod(this, 'welcomeFirstTimeUser');
+ deferredResult.addMethod(this, 'showPaymentReminder');
+ deferredResult.addMethod(this, 'copyDataLocally');
+ deferredResult.callback(arguments);
+
+ return deferredResult;
+ },
+
+
+ //..........................................................................
+
+ 'isFirstTimeUser': function () {
+ return false;
+ },
+
+ 'welcomeFirstTimeUser': function () {
+ var deferredResult;
+
+ deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false});
+
+ if (this.isFirstTimeUser()) {
+ deferredResult.addCallback(function () { console.log("--> welcome"); });
+ }
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //..........................................................................
+
+ 'shouldShowPaymentReminder': function () {
+ return true;
+ },
+
+ 'showPaymentReminder': function () {
+ var deferredResult;
+
+ deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false});
+
+ if (this.shouldShowPaymentReminder()) {
+ deferredResult.addCallback(function () { console.log("--> payment reminder"); });
+ }
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //..........................................................................
+
+ 'canCopyDataLocally': function () {
+ return false;
+ },
+
+ 'copyDataLocally': function () {
+ var deferredResult;
+
+ deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false});
+
+ if (this.canCopyDataLocally()) {
+ deferredResult.addCallback(function () { console.log("--> copy data locally"); });
+ }
+ deferredResult.callback();
+
+ return deferredResult;
+
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'runApplication': function () {
+ var deferredResult;
+
+//console.log(">>> runApplication");
+ deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true});
+ deferredResult.addMethod(this.user(), 'getRecords');
+ deferredResult.addMethod(this, 'showCards');
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //=========================================================================
+
+ 'showOfflineError': function (anException) {
+ alert("Error: " + anException);
+ throw anException;
+ },
+
+ //=========================================================================
+
+ 'isOnline': function() {
+ return navigator.onLine;
+ },
+
+ 'hasLocalData': function() {
+ return false;
+ },
+
+ //=========================================================================
+
+ 'loginForm': function() {
+ if (this._loginForm == null) {
+ this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')});
+ }
+
+ return this._loginForm;
+ },
+
+ 'removeLoginForm': function () {
+ if (this._loginForm != null) {
+ this._loginForm.remove();
+ this._loginForm = null;
+ }
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'cardList': function () {
+ if (this._cardList == null) {
+ this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')});
+ MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler');
+ }
+
+ return this._cardList;
+ },
+
+ 'showCards': function (someCards) {
+ this.cardList().showCards(someCards);
+ this.jQTouch().goTo('#cardList', 'slideleft');
+ },
+
+ //-------------------------------------------------------------------------
+
+ 'cardDetail': function () {
+ if (this._cardDetail == null) {
+ this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')});
+ }
+
+ return this._cardDetail;
+ },
+
+ 'selectCardHandler': function (aCardReference) {
+ var deferredResult;
+
+ deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true});
+ deferredResult.addMethod(this.cardDetail(), 'render');
+ deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft');
+ deferredResult.addMethod(this.user(), 'getRecord', aCardReference);
+ deferredResult.addMethod(this.cardDetail(), 'showCard');
+ deferredResult.callback();
+
+ return deferredResult;
+ },
+
+ //=========================================================================
+ __syntaxFix__: "syntax fix"
+});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js
index ee6d7a3..d6b0574 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js
@@ -1,145 +1,150 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
Clipperz.PM.UI.Web.Components.AccountPanel = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Components.AccountPanel.superclass.constructor.apply(this, arguments);
// this._initiallySelectedTab = args.selected || 'ACCOUNT';
this._initiallySelectedTab = args.selected || 'PASSPHRASE';
this._tabPanelControllerConfiguration = {
// 'ACCOUNT': {
// tab: 'accountTab',
// panel: 'accountPanel'
// },
'PASSPHRASE': {
tab: 'passphraseTab',
panel: 'passphrasePanel'
},
+ 'OTP': {
+ tab: 'OTPTab',
+ panel: 'OTPPanel'
+ },
'PREFERENCES': {
tab: 'preferencesTab',
panel: 'preferencesPanel'
},
'LOGIN_HISTORY': {
tab: 'loginHistoryTab',
panel: 'loginHistoryPanel'
}
};
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Web.Components.AccountPanel component";
},
//-------------------------------------------------------------------------
'renderSelf': function(/*aContainer, aPosition*/) {
//Clipperz.log("AccountPanel.renderSelf element", this.element());
this.append(this.element(), [
{tag:'div', cls:'header', children:[
{tag:'div', cls:'subPanelTabs', children:[
{tag:'ul', children:[
// {tag:'li', id:this.getId('accountTab'), children:[{tag:'a', href:'#', html:'Account'}], cls:'first'},
{tag:'li', id:this.getId('passphraseTab'), children:[{tag:'a', href:'#', html:'Passphrase'}], cls:'first'},
+ {tag:'li', id:this.getId('OTPTab'), children:[{tag:'a', href:'#', html:'One Time Passwords'}]},
{tag:'li', id:this.getId('preferencesTab'), children:[{tag:'a', href:'#', html:'Preferences'}]},
{tag:'li', id:this.getId('loginHistoryTab'), children:[{tag:'a', href:'#', html:'Login history'}]}
]}
]}
]},
{tag:'div', cls:'body', children:[
{tag:'div', cls:'accountPanel', children:[
{tag:'div', cls:'subPanelContent', children:[
{tag:'ul', children:[
// {tag:'li', id:this.getId('accountPanel'), children:[
// {tag:'h3', html:"-- Account --"}
// ]},
{tag:'li', id:this.getId('passphrasePanel'), children:[
{tag:'h3', cls:'changePassphrase', html:"Change passphrase"},
{tag:'form', id:this.getId('changePassphrase'), cls:'changePassphrase', children:[
{tag:'div', cls:'currentCredentials', children:[
{tag:'div', cls:'field username', children:[
{tag:'label', html:"username", 'for':this.getId('currentUsername')},
{tag:'input', id:this.getId('currentUsername')}
]},
{tag:'div', cls:'field passphrase', children:[
{tag:'label', html:"passphrase", 'for':this.getId('currentPassphrase')},
{tag:'input', id:this.getId('currentPassphrase')}
]}
]},
{tag:'div', cls:'newPassphrase', children:[
{tag:'div', cls:'field', children:[
{tag:'label', html:"new passphrase", 'for':this.getId('newPassphrase')},
{tag:'input', id:this.getId('newPassphrase')}
]},
{tag:'div', cls:'field', children:[
{tag:'label', html:"re-new passphrase", 'for':this.getId('reNewPassphrase')},
{tag:'input', id:this.getId('reNewPassphrase')}
]}
]},
{tag:'div', cls:'confirm', children:[
{tag:'input', type:'checkbox', id:this.getId('confirm')},
{tag:'label', html:"I understand that Clipperz will not be able to recover a lost passphrase", 'for':this.getId('confirm')}
]}
]},
{tag:'div', cls:'clear'},
{tag:'div', cls:'confirmButton', id:this.getId('confirmationButton'), children:[
{tag:'span', html:"change passphrase"}
- ]},
-
- {tag:'h3', cls:'manageOTP', html:"Manage One-Time Passphrases"},
- {}
+ ]}
+ ]},
+ {tag:'li', id:this.getId('OTPPanel'), children:[
+// {tag:'h3', html:"Manage One-Time Passphrases"}
]},
{tag:'li', id:this.getId('preferencesPanel'), children:[
- {tag:'h3', html:"-- Preferences --"}
+// {tag:'h3', html:"-- Preferences --"}
]},
{tag:'li', id:this.getId('loginHistoryPanel'), children:[
- {tag:'h3', html:"-- Login History --"}
+// {tag:'h3', html:"-- Login History --"}
]}
]}
]}
]}
]},
{tag:'div', cls:'footer'}
]);
this.tabPanelController().setup({selected:this.initiallySelectedTab()});
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js
index d2f1045..462d864 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js
@@ -1,108 +1,116 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
Clipperz.PM.UI.Web.Components.DataPanel = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Components.DataPanel.superclass.constructor.apply(this, arguments);
this._initiallySelectedTab = args.selected || 'OFFLINE_COPY';
this._tabPanelControllerConfiguration = {
'OFFLINE_COPY': {
tab: 'offlineCopyTab',
panel: 'offlineCopyPanel'
},
'SHARING': {
tab: 'sharingTab',
panel: 'sharingPanel'
},
'IMPORT': {
tab: 'importTab',
panel: 'importPanel'
},
'EXPORT': {
tab: 'exportTab',
panel: 'exportPanel'
}
};
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Web.Components.DataPanel component";
},
//-------------------------------------------------------------------------
'renderSelf': function(/*aContainer, aPosition*/) {
this.append(this.element(), [
{tag:'div', cls:'header', children:[
{tag:'div', cls:'subPanelTabs', children:[
{tag:'ul', children:[
{tag:'li', id:this.getId('offlineCopyTab'), children:[{tag:'a', href:'#', html:'Offline copy'}], cls:'first'},
{tag:'li', id:this.getId('sharingTab'), children:[{tag:'a', href:'#', html:'Sharing'}]},
{tag:'li', id:this.getId('importTab'), children:[{tag:'a', href:'#', html:'Import'}]},
{tag:'li', id:this.getId('exportTab'), children:[{tag:'a', href:'#', html:'Export'}]}
]}
]}
]},
{tag:'div', cls:'body', children:[
{tag:'div', cls:'accountPanel', children:[
{tag:'div', cls:'subPanelContent', children:[
{tag:'ul', children:[
{tag:'li', id:this.getId('offlineCopyPanel'), children:[
- {tag:'h3', html:"Offline copy"}
+// {tag:'h3', html:"Offline copy"},
+ {tag:'p', html:"With just one click you can dump all your encrypted data from Clipperz servers to your hard disk and create a read-only offline version of Clipperz to be used when you are not connected to the Internet."},
+ {tag:'a', id:this.getId('offlineCopyDownloadLink'), href:'#', html:"Download", cls:'downloadOfflineCopy'}
]},
{tag:'li', id:this.getId('sharingPanel'), children:[
- {tag:'h3', html:"Sharing"}
+// {tag:'h3', html:"Sharing"}
]},
{tag:'li', id:this.getId('importPanel'), children:[
- {tag:'h3', html:"Import"}
+// {tag:'h3', html:"Import"}
]},
{tag:'li', id:this.getId('exportPanel'), children:[
- {tag:'h3', html:"Export"}
+// {tag:'h3', html:"Export"}
]}
]}
]}
]}
]},
{tag:'div', cls:'footer'}
]);
this.tabPanelController().setup({selected:this.initiallySelectedTab()});
+ MochiKit.Signal.connect(this.getId('offlineCopyDownloadLink'), 'onclick', this, 'downloadOfflineCopy');
},
-
+
+ 'downloadOfflineCopy': function (anEvent) {
+ anEvent.preventDefault();
+ MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy', anEvent.src());
+ },
+
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js
index 5d082b5..26506e7 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js
@@ -1,152 +1,156 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
Clipperz.PM.UI.Web.Components.LoginProgress = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Components.LoginProgress.superclass.constructor.apply(this, arguments);
this._deferred = null;
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI.Common.Components.BaseComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Web.Components.LoginProgress component";
},
//-------------------------------------------------------------------------
'deferred': function() {
return this._deferred;
},
'setDeferred': function(aValue) {
this._deferred = aValue;
},
//-------------------------------------------------------------------------
'renderSelf': function() {
// var loginProgressElement;
//
// loginProgressElement = MochiKit.DOM.getElement('loginProgress');
//
// if (loginProgressElement == null) {
// loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true);
// }
//console.log(">> LoginProgress.renderSelf", this.element());
this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [
// this.append(loginProgressElement, [
{tag:'div', cls:'header', children:[
{tag:'h3', id:this.getId('title'), html:"login progress"}
]},
{tag:'div', cls:'body', children:[
{tag:'div', id:this.getId('progressBar')},
{tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[
// {tag:'div', cls:'img ALERT', children:[{tag:'div'}]},
{tag:'div', cls:'img ALERT', children:[{tag:'canvas', id:this.getId('canvas')}]},
{tag:'p', html:"Login failed"}
]}
]},
{tag:'div', cls:'footer', children:[
{tag:'div', cls:'buttonArea', id:this.getId('buttonArea'), children:[
- {tag:'div', cls:'button', id:this.getId('button'), children:[
- {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"}
- ]}
+// {tag:'div', cls:'button', id:this.getId('button'), children:[
+// {tag:'a', href:'#', id:this.getId('buttonLink'), html:"cancel"}
+// ]}
+ {tag:'a', cls:'button', id:this.getId('button'), html:"cancel"}
]}
]}
]});
// ]);
Clipperz.PM.UI.Canvas.marks['!'](this.getElement('canvas'), "#ffffff");
this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
MochiKit.Style.hideElement(this.getElement('errorBox'));
- MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler');
+// MochiKit.Signal.connect(this.getId('buttonLink'), 'onclick', this, 'cancelEventHandler');
+ MochiKit.Signal.connect(this.getId('button'), 'onclick', this, 'cancelEventHandler');
},
//-------------------------------------------------------------------------
'displayElement': function() {
return MochiKit.DOM.getElement('loginProgress');
},
//-------------------------------------------------------------------------
'cancelEventHandler': function(anEvent) {
anEvent.preventDefault();
MochiKit.Signal.signal(this, 'cancelEvent');
},
//-------------------------------------------------------------------------
'disableCancel': function() {
MochiKit.Style.hideElement(this.getElement('buttonArea'));
},
//-------------------------------------------------------------------------
'showErrorMessage': function() {
- this.getElement('buttonLink').innerHTML = "close";
+// this.getElement('buttonLink').innerHTML = "close";
+ this.getElement('button').innerHTML = "close";
+ MochiKit.DOM.addElementClass(this.getElement('button'), 'default');
MochiKit.Style.hideElement(this.getElement('progressBar'));
this.getElement('title').innerHTML = "Error";
MochiKit.Style.showElement(this.getElement('errorBox'));
MochiKit.Style.showElement(this.getElement('buttonArea'));
},
//-------------------------------------------------------------------------
'deferredHideModalAndRemove': function(someParameters, aResult) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("LoginProgress.deferredHideModalAndRemove", {trace:false});
deferredResult.addMethod(this, 'deferredHideModal');
deferredResult.addMethod(this, 'remove');
deferredResult.addCallback(function () {
return aResult;
});
deferredResult.callback(someParameters);
return deferredResult;
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js
index 3ee6189..0fa369f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js
@@ -1,110 +1,110 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Components.ToolsPanel.superclass.constructor.apply(this, arguments);
this._initiallySelectedTab = args.selected || 'PASSWORD_GENERATOR';
this._tabPanelControllerConfiguration = {
'PASSWORD_GENERATOR': {
tab: 'passwordGeneratorTab',
panel: 'passwordGeneratorPanel'
},
'BOOKMARKLET': {
tab: 'bookmarkletTab',
panel: 'bookmarkletPanel'
},
'COMPACT_EDITION': {
tab: 'compactEditionTab',
panel: 'compactEditionPanel'
},
'HTTP_AUTH': {
tab: 'httpAuthTab',
panel: 'httpAuthPanel'
}
};
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Common.Components.TabPanelComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.Web.Components.ToolsPanel component";
},
//-------------------------------------------------------------------------
'renderSelf': function(/*aContainer, aPosition*/) {
this.append(this.element(), [
{tag:'div', cls:'header', children:[
{tag:'div', cls:'subPanelTabs', children:[
{tag:'ul', children:[
{tag:'li', id:this.getId('passwordGeneratorTab'), children:[{tag:'a', href:'#', html:'Password generator'}], cls:'first'},
{tag:'li', id:this.getId('bookmarkletTab'), children:[{tag:'a', href:'#', html:'Bookmarklet'}]},
{tag:'li', id:this.getId('compactEditionTab'), children:[{tag:'a', href:'#', html:'Compact edition'}]},
{tag:'li', id:this.getId('httpAuthTab'), children:[{tag:'a', href:'#', html:'HTTP Auth'}]}
]}
]}
]},
{tag:'div', cls:'body', children:[
{tag:'div', cls:'accountPanel', children:[
{tag:'div', cls:'subPanelContent', children:[
{tag:'ul', children:[
{tag:'li', id:this.getId('passwordGeneratorPanel'), children:[
- {tag:'h3', html:"Password generator"}
+// {tag:'h3', html:"Password generator"}
]},
{tag:'li', id:this.getId('bookmarkletPanel'), children:[
- {tag:'h3', html:"Bookmarklet"}
+// {tag:'h3', html:"Bookmarklet"}
]},
{tag:'li', id:this.getId('compactEditionPanel'), children:[
- {tag:'h3', html:"Compact edition"}
+// {tag:'h3', html:"Compact edition"}
]},
{tag:'li', id:this.getId('httpAuthPanel'), children:[
- {tag:'h3', html:"HTTP Auth"}
+// {tag:'h3', html:"HTTP Auth"}
]}
]}
]}
]}
]},
{tag:'div', cls:'footer'}
]);
this.tabPanelController().setup({selected:this.initiallySelectedTab()});
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
index 9a0e744..1ab2e69 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
@@ -1,326 +1,351 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.AppController = function(args) {
this._user = null;
this._tabSlotNames = {
//tabName: slotName
'cards': 'cardGrid',
// 'directLogins': 'directLoginGrid',
'account': 'accountPanel',
'data': 'dataPanel',
'tools': 'toolsPanel'
};
//controllers
this._cardsController = null;
// this._directLoginsController = null;
this._filterController = null; // new Clipperz.PM.UI.Web.Controllers.FilterController();
//components
this._appPage = null;
this._userInfoBox = null;
this._tabSidePanel = null;
// MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'editCard', this, 'handleEditCard');
// MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard', this, 'handleDeleteCard');
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved', this, 'userDataSuccessfullySavedHandler');
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.AppController";
},
//-----------------------------------------------------------------------------
'setUser': function(anUser) {
this._user = anUser;
},
'user': function() {
return this._user;
},
//-----------------------------------------------------------------------------
/*
'tabSlotNames': function() {
return this._tabSlotNames;
},
*/
'slotNameForTab': function(aTabName) {
return this._tabSlotNames[aTabName];
},
'hideAllAppPageTabSlots': function() {
var aTabName;
for (aTabName in this._tabSlotNames) {
this.appPage().hideSlot(this.slotNameForTab(aTabName));
}
},
//-----------------------------------------------------------------------------
'appPage': function() {
if (this._appPage == null) {
this._appPage = new Clipperz.PM.UI.Web.Components.AppPage();
}
return this._appPage;
},
//-----------------------------------------------------------------------------
'tabSidePanel': function() {
if (this._tabSidePanel == null) {
this._tabSidePanel = new Clipperz.PM.UI.Web.Components.TabSidePanel();
}
return this._tabSidePanel;
},
//-----------------------------------------------------------------------------
'userInfoBox': function() {
if (this._userInfoBox == null) {
this._userInfoBox = new Clipperz.PM.UI.Web.Components.UserInfoBox();
MochiKit.Signal.connect(this._userInfoBox, 'logout', this, 'handleLogout');
MochiKit.Signal.connect(this._userInfoBox, 'lock', this, 'handleLock');
MochiKit.Signal.connect(this._userInfoBox, 'unlock', this, 'handleUnlock');
}
return this._userInfoBox;
},
//-----------------------------------------------------------------------------
'accountPanel': function () {
if (this._accountPanel == null) {
this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel(/*{selected:'Preferences'}*/);
}
return this._accountPanel;
},
//.........................................................................
'dataPanel': function () {
if (this._dataPanel == null) {
this._dataPanel = new Clipperz.PM.UI.Web.Components.DataPanel();
}
return this._dataPanel;
},
//.........................................................................
'toolsPanel': function () {
if (this._toolsPanel == null) {
this._toolsPanel = new Clipperz.PM.UI.Web.Components.ToolsPanel();
}
return this._toolsPanel;
},
//-----------------------------------------------------------------------------
'filterController': function () {
if (this._filterController == null) {
this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController();
}
return this._filterController;
},
'cardsController': function() {
if (this._cardsController == null) {
this._cardsController = new Clipperz.PM.UI.Web.Controllers.CardsController({'filterController':this._filterController});
}
return this._cardsController;
},
//-----------------------------------------------------------------------------
/*
'directLoginsController': function() {
//Clipperz.log(">>> AppController.directLoginsController");
if (this._directLoginsController == null) {
this._directLoginsController = new Clipperz.PM.UI.Web.Controllers.DirectLoginsController({'filterController':this._filterController});
}
//Clipperz.log("<<< AppController.directLoginsController");
return this._directLoginsController;
},
*/
//-----------------------------------------------------------------------------
'populateUserInfo': function() {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("AppController.populateUserInfo", {trace:false});
deferredResult.collectResults({
'username': MochiKit.Base.methodcaller('displayName'),
'cardsNumber': [
MochiKit.Base.methodcaller('getRecords'),
function (someResults) { return someResults.length; }
],
'directLoginsNumber': [
MochiKit.Base.methodcaller('getDirectLogins'),
function (someResults) { return someResults.length; }
]
})
deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails');
deferredResult.callback(this.user());
return deferredResult;
},
//-----------------------------------------------------------------------------
'run': function(args) {
var deferredResult;
var slot;
var page;
var user;
slot = args.slot;
user = args.user;
this.setUser(user);
slot.setContent(this.appPage());
this.appPage().slotNamed('userInfoBox').setContent(this.userInfoBox());
this.appPage().slotNamed('tabSidePanel').setContent(this.tabSidePanel());
this.appPage().slotNamed('accountPanel').setContent(this.accountPanel());
this.appPage().slotNamed('dataPanel').setContent(this.dataPanel());
this.appPage().slotNamed('toolsPanel').setContent(this.toolsPanel());
this.hideAllAppPageTabSlots();
this.appPage().showSlot(this.slotNameForTab('cards'));
- MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected');
- MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard');
- MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard');
+ MochiKit.Signal.connect(this.tabSidePanel(), 'tabSelected', this, 'handleTabSelected');
+ MochiKit.Signal.connect(this.tabSidePanel(), 'addCard', this, 'handleAddCard');
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'addCard', this, 'handleAddCard');
+
+ MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'downloadOfflineCopy', this, 'handleDownloadOfflineCopy');
deferredResult = new Clipperz.Async.Deferred("AppController.run", {trace:false});
deferredResult.addMethod(this.cardsController(), 'run', {slot:this.appPage().slotNamed('cardGrid'), user:user});
// deferredResult.addMethod(this.directLoginsController(), 'run', {slot:this.appPage().slotNamed('directLoginGrid'), user:user});
deferredResult.addMethod(this, 'populateUserInfo');
deferredResult.addCallback(MochiKit.Visual.ScrollTo, 'miscLinks', {duration:0});
deferredResult.addCallback(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN');
deferredResult.addMethod(this.tabSidePanel(), 'selectTab', 'cards');
deferredResult.callback();
},
//-----------------------------------------------------------------------------
'handleTabSelected': function (selectedTabName) {
var aTabName;
var aSlotName;
//Clipperz.log(">>> AppController.handleTabSelected", selectedTabName);
this.hideAllAppPageTabSlots();
this.appPage().showSlot(this.slotNameForTab(selectedTabName));
switch (selectedTabName) {
case 'cards':
this.cardsController().focus();
break;
// case 'directLogins':
// this.directLoginsController().focus();
// break;
case 'data':
break;
case 'account':
break;
case 'tools':
break;
}
//Clipperz.log("<-- AppController.handleTabSelected", aTabName);
},
//=============================================================================
'handleAddCard': function (aSourceElement) {
//Clipperz.log("=== AppController.addCard", aSourceElement);
this.cardsController().addCard(aSourceElement);
},
//=============================================================================
'userDataSuccessfullySavedHandler': function (anEvent) {
this.populateUserInfo();
},
//=============================================================================
'handleLogout': function(anEvent) {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("AppController.handleLogout", {trace:false});
deferredResult.addMethod(this.user(), 'logout');
deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout');
deferredResult.callback();
return deferredResult;
},
//-----------------------------------------------------------------------------
'handleLock': function (anEvent) {
return Clipperz.Async.callbacks("AppController.handleLock", [
MochiKit.Base.method(this.cardsController(), 'deleteAllCleanTextData'),
MochiKit.Base.method(this.user(), 'lock')
], {trace:false});
},
//.............................................................................
'handleUnlock': function (anEvent) {
return Clipperz.Async.callbacks("AppController.handleUnock", [
MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress'),
MochiKit.Base.method(this.user(), 'login'),
MochiKit.Base.method(this.cardsController(), 'focus'),
MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'),
MochiKit.Base.method(this.userInfoBox(), 'unlock')
], {trace:false});
},
+ 'handleDownloadOfflineCopy': function (anEvent) {
+console.log("AppController.handleDownloadOfflineCopy");
+ var downloadHref;
+
+ downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl;
+
+ if (Clipperz_IEisBroken == true) {
+ window.open(downloadHref, "");
+ } else {
+ var deferredResult;
+ var newWindow;
+
+ newWindow = window.open("", "");
+
+ deferredResult = new Clipperz.Async.Deferred("AppController.handleDownloadOfflineCopy", {trace:true});
+ deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"});
+ deferredResult.addCallback(function(aWindow) {
+ aWindow.location.href = downloadHref;
+ }, newWindow);
+ deferredResult.callback();
+ }
+ },
+
//=============================================================================
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js
deleted file mode 100644
index 5380aa1..0000000
--- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js
+++ b/dev/null
@@ -1,163 +0,0 @@
-/*
-
-Copyright 2008-2011 Clipperz Srl
-
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an 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 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.
- 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/>.
-
-*/
-
-Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components');
-
-Clipperz.PM.UI.iPhone.Components.CardDetail = function(args) {
- args = args || {};
-
- Clipperz.PM.UI.iPhone.Components.CardDetail.superclass.constructor.apply(this, arguments);
-
- this._cardReference = null;
-
- return this;
-}
-
-//=============================================================================
-
-Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, {
-
- //-------------------------------------------------------------------------
-
- 'toString': function () {
- return "Clipperz.PM.UI.iPhone.Components.CardDetail component";
- },
-
- //-------------------------------------------------------------------------
-
- 'cardReference': function () {
- return this._cardReference;
- },
-
- 'setCardReference': function (aValue) {
- this._cardReference = aValue;
- },
-
- //-------------------------------------------------------------------------
-
- 'renderSelf': function(/*aContainer, aPosition*/) {
- this.append(this.element(), [
- {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[
- {tag:'div', id:this.getId('progressBar')} //,
-// {tag:'h1', cls:'loading', html:"loading"}
- ]}
- ]);
-
- this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
- MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0);
- },
-
- //=========================================================================
-
- 'showCardDetails': function (someData) {
- this.element().innerHTML = '';
- this.append(this.element(), [
- {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) {
- return {tag:'div', cls:'row', children:[
- {tag:'label', html:aFieldData['label']},
-// {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), html:aFieldData['value']}
- {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), children:[
- {tag:'div', children:[{tag:'p', html:aFieldData['value']}]}
- ]}
-// {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden'] ? 'password' : 'text')), value:aFieldData['value'], disabled:true}
-
- ]}
- }, someData['fields'])}
- ]);
-
- MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) {
- MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); })
- }, this));
-
- if (someData['directLogins'].length > 0) {
- this.append(this.element(), [
- {tag:'h2', html:"Direct logins"},
- {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) {
- return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[
- {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']},
-// {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']}
- {tag:'span', cls:'directLogin', html:aDirectLoginData['label']}
- ]}
- }, someData['directLogins'])}
- ]);
-
- MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) {
- MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler');
- }, this),
- MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row'])
- )
- };
-
- if (someData['notes'] != '') {
- this.append(this.element(), [
- {tag:'h2', html:"Notes"},
- {tag:'fieldset', id:this.getId('fieldset'), children:[
- {tag:'div', cls:'row notes', children:[
- {tag:'span', html:someData['notes']}
- ]}
- ]}
- ]);
- };
-
- return true;
- },
-
- //-------------------------------------------------------------------------
-/*
- 'toggleClickHandler': function (anEvent) {
- var nextState;
- var fieldValue;
-
-//console.log("TOGGLE");
- anEvent.preventDefault;
- fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0];
-
- nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true');
- if (nextState) {
- MochiKit.DOM.removeElementClass(fieldValue, 'clear');
- } else {
- MochiKit.DOM.addElementClass(fieldValue, 'clear');
- }
-
- MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState);
- },
-*/
- //=========================================================================
-
- 'directLoginClickHandler': function (anEvent) {
- anEvent.preventDefault();
-
- if (/(directLogin_)/.test(anEvent.src().id)) {
- var directLoginReference;
-
- directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2];
- MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference});
- }
- },
-
- //=========================================================================
-
- __syntaxFix__: "syntax fix"
-});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js
deleted file mode 100644
index 5341878..0000000
--- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js
+++ b/dev/null
@@ -1,178 +0,0 @@
-/*
-
-Copyright 2008-2011 Clipperz Srl
-
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an 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 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.
- 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/>.
-
-*/
-
-Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components');
-
-Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) {
- args = args || {};
-
- Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments);
-
- return this;
-}
-
-//=============================================================================
-
-Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, {
-
- //-------------------------------------------------------------------------
-
- 'toString': function () {
- return "Clipperz.PM.UI.iPhone.Components.LoginForm component";
- },
-
- //-------------------------------------------------------------------------
-
- 'focusOnUsername': function () {
- this.getElement('username').focus();
- },
-
- //-------------------------------------------------------------------------
-
- 'username': function () {
- return this.getElement('username').value;
- },
-
- 'passphrase': function () {
- return this.getElement('passphrase').value;
- },
-
- //-------------------------------------------------------------------------
-
- 'renderSelf': function(/*aContainer, aPosition*/) {
- this.append(this.element(), [
- {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[
- {tag:'h1', id:'pageTitle', html:'Clipperz'},
- {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"}
- ]},
- {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[
- {tag:'fieldset', id:this.getId('fieldset'), children:[
- {tag:'div', cls:'row', children:[
- {tag:'label', html:"username"},
- {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')}
- ]},
- {tag:'div', cls:'row', children:[
- {tag:'label', html:"passphrase"},
- {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')}
- ]}
- ]},
- {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')}
- ]},
- {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[
- {tag:'div', id:this.getId('progressBar')} //,
-// {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')}
- ]},
- {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[
- {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[
- {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"}
- ]}
- ]}
- ]);
-
- MochiKit.Signal.connect(this.getElement('submit'), 'onclick', this, 'submitHandler');
- MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit', this, 'submitHandler');
-
-// MochiKit.Signal.connect(this.getElement('cancel'), 'onclick', this, 'cancelHandler');
- MochiKit.Signal.connect('backButton', 'onclick', this, 'backHandler');
-
- this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')}));
-
-// MochiKit.Style.hideElement(this.getElement('errorMessage'));
-
- this.showLoginForm();
-// MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername'));
- },
-
- //-------------------------------------------------------------------------
-
- 'showLoginForm': function () {
- MochiKit.Style.showElement(this.getElement('loginFormPanel'));
- MochiKit.Style.hideElement(this.getElement('loginProgressPanel'));
- MochiKit.Style.hideElement(this.getElement('loginErrorPanel'));
- MochiKit.Style.hideElement('backButton');
- },
-
- 'slideInLoginForm': function () {
- var offset;
-
- offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
-
- MochiKit.Style.showElement(this.getElement('loginFormPanel'));
- MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0});
-
- new MochiKit.Visual.Sequence([
- new MochiKit.Visual.Parallel([
- new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative', transition:MochiKit.Visual.Transitions.linear, sync:true}),
- new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute', transition:MochiKit.Visual.Transitions.linear, sync:true}),
- MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
- ], {duration:0.5, sync:true}),
- MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true})
- ], {})
- },
-
- 'showLoginProgress': function () {
- MochiKit.Style.hideElement(this.getElement('loginFormPanel'));
- MochiKit.Style.showElement(this.getElement('loginProgressPanel'));
- },
-
- 'showLoginError': function (anError) {
- this.getElement('errorMessage').innerHTML = "Login error";
-
- MochiKit.Style.showElement('backButton');
- MochiKit.Style.hideElement(this.getElement('loginProgressPanel'));
- MochiKit.Style.showElement(this.getElement('loginErrorPanel'));
- MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45});
- },
-
- //-------------------------------------------------------------------------
-/*
- 'disableCancelButton': function () {
- MochiKit.DOM.hideElement(this.getElement('cancel'));
- },
-*/
- //-------------------------------------------------------------------------
-
- 'submitHandler': function (anEvent) {
- anEvent.preventDefault();
-
- MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()});
- },
-
- 'cancelHandler': function (anEvent) {
- anEvent.preventDefault();
-
-//console.log("CANCEL");
- },
-
- 'backHandler': function (anEvent) {
- anEvent.preventDefault();
-
- this.slideInLoginForm();
- },
-
- //-------------------------------------------------------------------------
-
- __syntaxFix__: "syntax fix"
-});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js
deleted file mode 100644
index 3fcaae1..0000000
--- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js
+++ b/dev/null
@@ -1,369 +0,0 @@
-/*
-
-Copyright 2008-2011 Clipperz Srl
-
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an 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 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.
- 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/>.
-
-*/
-
-Clipperz.Base.module('Clipperz.PM.UI.iPhone.Controllers');
-
-// Some parts of this controller have been derived from the iUI library.
-
-Clipperz.PM.UI.iPhone.Controllers.MainController = function() {
- this._loginForm = null;
- this._cardList = null;
- this._cachedValues = null;
- this._user = null;
-
- if (typeof window.onorientationchange == 'object') {
- MochiKit.Signal.connect(window, 'onorientationchange', this, 'orientationChangeHandler');
- MochiKit.Async.callLater(0, MochiKit.Base.method(this, 'orientationChangeHandler'));
- } else {
- this.setOrientation('portrait');
-// this.setOrientation('landscape');
- }
-
- this.addMetaTag('viewport', 'width=devicewidth; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;');
- this.addMetaTag('apple-mobile-web-app-capable', 'yes');
- this.addMetaTag('apple-mobile-web-app-status-bar-style', 'black');
-
- this.addLinkTag('apple-touch-icon', 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAABfCAYAAACOTBv1AAAACXBIWXMAAAsTAAALEwEAmpwYAAAQC0lEQVR4nO2ce3wU1b3AvzOzz2TzBpKQhIS3CnLxgYoPqAgiQS8igiAqiFprtT571YpKUa9tvVgrVvhc7IXS4lUUvGgR5CWIoiAIYoQgJGDI+0k2yW42szNz7h8pGBHIPmazqeb7+UD4DHt+vzPfPTnnzJkzIwGCLqKCHO0K/JTpkh9FuuRHkS75UaRLfhTpkh9FuuRHkS75UaRLfhTpkh9FLNGuwKnIzc3l9WXLQAIhQILWvwQnjn3vUNtjkoQQ4kSZr77KY+TIkR1/EgHQKeWnp6eTkJiI0P2gqyeOnxD7T+ttxf/wp4SwOOnTp0/UzqM9OqV8oFXygSVIm3/xvePSKf59up/cWfO9z3c2OnmfH646qVMv2XZa+RKtrT8cWruoztv2O6384/15OLSODZ237Xda+W1nMKEiROe+U9Rp5ZtFJ+51Oq/8E/P7MOjE3oFOLL/1Iik8fUJoCF03pT6RoNPKF4Q/2zF0P0J0yQ8aM/pqoesIXQs/UITotPKFYRDuXMXQ/dDV8oNECIShgRGmOKFj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moJS/pljH1qhymbmJKTk1j50CCaDm/jwt6CtJMWQA0D8kuhsEJCGODKOpcl+d14/d0Pw87dHhHpdk6mqLicFZ9Ucc3E27A35lPv1anxQrKTE5ftPj98WS6BEscz66wcKTZne3lzs48q0rm0ZwsV1V4yUr7L6W2B7QehvFYCAc5zJ3H3kkNs3bHXlNzt0WG3Ed1uNzfcv4j368fh6H4Obi98+i2UN7QOcnnlEqoKB61XsvXz/abmXrt5B/tixtCiSuwuaM1XVgeb86DeI6M4Ezjaazrjn1zFkaKOe8omKtsFzx00kFd/eR6evOUgQYJdUN8sYc+8hHHPfnH69/CEgaIorHl+Es1fvU2yS3DMIyOEIC7nfBbujmXF2tDemRMOUdur6XA4WPDUbWRVr0D11CNbY5i3pzebPjNn7f9U9M7O5LWpyTSV5CFJYB08hbvmf0RpWUXEcp6JDunzT4Wmabz74ReIjBEMH9iNQwzhleWRbX317gbktCGcn6ZzICGX2597i4aGxojmbA8R7T/ZvTKF3W7rsHwDB/SL+jkDIqpbxH/qdMrX+f5U6JIfRbrkR5Eu+VGkS34U6ZIfRbrkR5Eu+VGkS34U6ZIfRbrkR5H/Bx8z6HmTXnicAAAAAElFTkSuQmCCCg==');
-// this.addLinkTag('apple-touch-startup-image', 'default.png');
-
-// if (!window.navigator.standalone) // not running as an installed app
-
- MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', this, 'selectedDirectLoginHandler');
-
- MochiKit.DOM.addElementClass(document.body, 'iPhone');
- return this;
-}
-
-MochiKit.Base.update(Clipperz.PM.UI.iPhone.Controllers.MainController.prototype, {
-
- 'toString': function () {
- return "Clipperz.PM.UI.iPhone.Controllers.MainController";
- },
-
- //=========================================================================
-
- 'user': function () {
- return this._user;
- },
-
- 'setUser': function (aValue) {
- this._user = aValue;
- },
-
- //=========================================================================
-
- 'loginForm': function() {
- if (this._loginForm == null) {
- MochiKit.DOM.removeElement('mainDiv');
- this._loginForm = new Clipperz.PM.UI.iPhone.Components.LoginForm({element:MochiKit.DOM.currentDocument().body});
- MochiKit.Signal.connect(this._loginForm, 'doLogin', this, 'doLoginHandler')
- }
-
- return this._loginForm;
- },
-
- 'removeLoginForm': function () {
- if (this._loginForm != null) {
- this._loginForm.remove();
- this._loginForm = null;
- }
- },
-
- //-----------------------------------------------------------------------------
-
- 'cardList': function () {
- if (this._cardList == null) {
- this._cardList = new Clipperz.PM.UI.iPhone.Components.CardList({element:MochiKit.DOM.currentDocument().body});
- MochiKit.Signal.connect(this._cardList, 'searchEvent', this, 'searchEventHandler')
- MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selecetedCardHandler')
- }
-
- return this._cardList;
- },
-
- //=========================================================================
-
- 'currentWidth': function () {
- return this._currentWidth;
- },
-
- 'setCurrentWidth': function (aValue) {
- this._currentWidth = aValue;
- },
-
- //=========================================================================
-
- 'orientationChangeHandler': function () {
- switch(window.orientation) {
- case 0:
- this.setOrientation('portrait');
- break;
- case 90:
- case -90:
- this.setOrientation('landscape');
- break;
- }
- },
-
- //-------------------------------------------------------------------------
-
- 'setOrientation': function (anOrientation) {
- document.body.setAttribute('orientation', anOrientation);
- setTimeout(scrollTo, 100, 0, 1);
- },
-
- //-------------------------------------------------------------------------
-
- 'slidePages': function (fromPage, toPage, backwards) {
- var axis;
- var slideDone;
-
- slideDone = function () {
- // console.log("slideDone");
- if (!hasClass(toPage, "dialog")) {
- fromPage.removeAttribute("selected");
- }
- checkTimer = setInterval(checkOrientAndLocation, 300);
- setTimeout(updatePage, 0, toPage, fromPage);
- fromPage.removeEventListener('webkitTransitionEnd', slideDone, false);
- }
-
- axis = (backwards ? fromPage : toPage).getAttribute("axis");
-
- clearInterval(checkTimer);
-
- if (canDoSlideAnim() && axis != 'y') {
- slide2(fromPage, toPage, backwards, slideDone);
- } else {
- slide1(fromPage, toPage, backwards, axis, slideDone);
- }
- },
-
- //-------------------------------------------------------------------------
-
- 'getCachedValues': function () {
- var deferredResult;
-
- if (this._cachedObjects != null) {
- deferredResult = MochiKit.Async.succeed(this._cachedObjects);
- } else {
- deferredResult = new Clipperz.Async.Deferred("MainController.getCachedValues", {trace:false});
- deferredResult.addMethod(this.user(), 'getRecords');
- deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.getCachedValues - collectResults", {
- '_rowObject': MochiKit.Async.succeed,
- '_reference': MochiKit.Base.methodcaller('reference'),
- 'label': MochiKit.Base.methodcaller('label'),
- 'favicon': MochiKit.Base.methodcaller('favicon'),
- '_searchableContent': MochiKit.Base.methodcaller('searchableContent')
- }, {trace:false}));
- deferredResult.addCallback(Clipperz.Async.collectAll);
- deferredResult.addCallback(MochiKit.Base.bind(function (someRows) {
- this._cachedObjects = someRows;
- return this._cachedObjects;
- }, this));
- deferredResult.callback();
- }
-
- return deferredResult;
- },
- //=========================================================================
-
- 'run': function(shouldShowRegistrationForm) {
- this.loginForm().render();
- MochiKit.Async.callLater(1, MochiKit.Base.method(this.loginForm(), 'focusOnUsername'));
- },
-
- //=========================================================================
-
- 'doLoginHandler': function (someArgs) {
- var deferredResult;
- var parameters;
- var shouldUseOTP;
-// var loginProgress;
- var user;
- var getPassphraseDelegate;
-
- parameters = someArgs;
- shouldUseOTP = (typeof(parameters.passphrase) == 'undefined');
-
- getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase);
- user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':getPassphraseDelegate});
-
- deferredResult = new Clipperz.Async.Deferred("MainController.doLogin", {trace:false});
- deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
- deferredResult.addMethod(this.loginForm(), 'showLoginProgress');
- deferredResult.addCallback(MochiKit.Async.wait, 0.1);
- deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
- deferredResult.addMethod(user, 'login');
- deferredResult.addMethod(this, 'setUser', user);
- deferredResult.addMethod(user, 'getRecords');
- deferredResult.addMethod(this, 'removeLoginForm');
- deferredResult.addMethod(this.cardList(), 'render');
- deferredResult.addMethod(this, 'displaySelectedRecords', '');
- deferredResult.addErrback(MochiKit.Base.method(this.loginForm(), 'showLoginError'));
- deferredResult.callback();
-
- return deferredResult;
- },
-
- //=========================================================================
-
- 'searchEventHandler': function (aValue) {
-//console.log("searching for ... " + aValue);
- return this.displaySelectedRecords(aValue);
- },
-
- //=========================================================================
-
- '_displaySelectedRows': function (aFilter, someRows) {
- var result;
-
- result = someRows;
-
- if (aFilter != null) {
- var filter;
- var filterRegExp;
-
- filter = aFilter.replace(/[^A-Za-z0-9]/g, "\\$&");
- filterRegExp = new RegExp(filter, "i");
- result = MochiKit.Base.filter(function (aCachedResult) { return filterRegExp.test(aCachedResult['_searchableContent'])}, result);
- }
-
-
- result.sort(MochiKit.Base.partial(function (aKey, aComparator, aObject, bObject) {
- return aComparator(aObject[aKey], bObject[aKey]);
- }, 'label', Clipperz.Base.caseInsensitiveCompare));
-
- this.cardList().update(result);
- },
-
- //-------------------------------------------------------------------------
-
- 'displaySelectedRecords': function (aFilter) {
- return Clipperz.Async.callbacks("MainController.displaySelectedrows", [
- MochiKit.Base.method(this, 'getCachedValues'),
- MochiKit.Base.method(this, '_displaySelectedRows', aFilter)
- ], {trace:false});
- },
-
- //=========================================================================
-
- 'selecetedCardHandler': function (aRecordReference) {
- var deferredResult;
- var recordData;
-
- recordData = {};
-//console.log("Showing detail for card with reference", aRecordReference);
- deferredResult = new Clipperz.Async.Deferred("MainController.selectedCardHandler", {trace:false});
- deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
- deferredResult.collectResults({
- '_reference': MochiKit.Base.methodcaller('reference'),
- 'title': MochiKit.Base.methodcaller('label'),
- 'favicon': MochiKit.Base.methodcaller('favicon')
- });
- deferredResult.addCallback(function (someData) {
- MochiKit.Base.update(recordData, someData);
- })
- deferredResult.addMethod(this.cardList(), 'showCard', recordData);
-
- deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
- deferredResult.addMethodcaller('notes');
- deferredResult.addCallback(function (someNotes) {
- recordData['notes'] = someNotes;
- })
-
- deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
- deferredResult.addMethodcaller('getCurrentRecordVersion');
- deferredResult.addMethodcaller('fields');
- deferredResult.addCallback(MochiKit.Base.values);
- deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - fields", {
- 'label': MochiKit.Base.methodcaller('label'),
- 'value': MochiKit.Base.methodcaller('value'),
- 'isHidden': MochiKit.Base.methodcaller('isHidden')
- }, {trace:false}));
- deferredResult.addCallback(Clipperz.Async.collectAll);
- deferredResult.addCallback(function (someData) {
- recordData['fields'] = someData;
- });
-
- deferredResult.addMethod(this.user(), 'getRecord', aRecordReference);
- deferredResult.addMethodcaller('directLogins');
- deferredResult.addCallback(MochiKit.Base.values);
- deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - directLogins", {
- 'label': MochiKit.Base.methodcaller('label'),
- 'favicon': MochiKit.Base.methodcaller('favicon'),
- '_reference': MochiKit.Base.methodcaller('reference')
- }, {trace:false}));
- deferredResult.addCallback(Clipperz.Async.collectAll);
- deferredResult.addCallback(function (someData) {
- recordData['directLogins'] = someData;
- });
-
- deferredResult.addMethod(this.cardList(), 'showCardDetails', recordData);
- deferredResult.callback();
-
- return deferredResult;
- },
-
- //=========================================================================
-
- 'selectedDirectLoginHandler': function (someData) {
- var deferredResult;
-
-//console.log("<<< signal - directLogin");
- deferredResult = new Clipperz.Async.Deferred("MainController.selectedDirectLoginHandler", {trace:false});
- deferredResult.addMethod(this.user(), 'getRecord', someData['cardReference']);
- deferredResult.addMethodcaller('directLogins');
- deferredResult.addCallback(MochiKit.Base.itemgetter(someData['directLoginReference']));
-// deferredResult.addMethodcaller('runDirectLogin');
- deferredResult.addCallback(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin);
- deferredResult.callback();
-
- return deferredResult;
- },
-
- //=========================================================================
-
- 'addMetaTag': function (aName, aContent) {
- var metaTag;
-
- metaTag = document.createElement('meta');
- metaTag.name = aName;
- metaTag.content = aContent;
- document.getElementsByTagName('head')[0].appendChild(metaTag);
- },
-
- 'addLinkTag': function (aRel, anHref) {
- var linkTag;
-
- linkTag = document.createElement('link');
- linkTag.rel = aRel;
- linkTag.href = anHref;
- document.getElementsByTagName('head')[0].appendChild(linkTag);
- },
-
- //=========================================================================
- __syntaxFix__: "syntax fix"
-}); \ No newline at end of file
diff --git a/frontend/gamma/js/main_iPhone.js b/frontend/gamma/js/main.mobile.js
index 0644f68..60a32fa 100644
--- a/frontend/gamma/js/main_iPhone.js
+++ b/frontend/gamma/js/main.mobile.js
@@ -1,57 +1,64 @@
/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz Community Edition.
Clipperz Community Edition is an 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 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.
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/>.
*/
function _pm_logEvent(anEvent) {
// console.log("####", anEvent);
anEvent.preventDefault();
}
function handleGenericDeferredError(anError) {
var result;
if (anError instanceof MochiKit.Async.CancelledError) {
result = anError;
} else {
MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
result = new MochiKit.Async.CancelledError(anError);
}
return result;
}
Clipperz.PM.RunTime = {};
function run() {
- MochiKit.DOM.removeElement('javaScriptAlert');
Clipperz.PM.Strings.Languages.initSetup();
- Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.iPhone.Controllers.MainController();
- Clipperz.PM.RunTime.mainController.run(false);
+ Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Mobile.Controllers.MainController();
+ Clipperz.PM.RunTime.mainController.run();
}
+// if (navigator.standalone == false) {
+// window.localStorage.setItem('PIN', '1234');
+// alert("Saved PIN");
+// } else {
+// alert (window.localStorage.getItem('PIN'));
+// }
+
+
MochiKit.DOM.addLoadEvent(run);