1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2025-10-25 09:37:35 +02:00

Updated version of /gamma

Tons of changes, included a new draft of the mobile version (still VERY rough)
This commit is contained in:
Clipperz
2013-01-08 16:21:04 +01:00
parent 267603e3aa
commit 816fc35420
181 changed files with 7764 additions and 2149 deletions

View File

@@ -406,6 +406,10 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Compo
return result;
},
'getAnchor': function (aValue) {
return '#' + this.getId(aValue);
},
//-------------------------------------------------------------------------
'getElement': function(aValue) {

View File

@@ -62,7 +62,8 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Com
//-------------------------------------------------------------------------
'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()}
@@ -70,36 +71,43 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Button, Clipperz.PM.UI.Com
{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"
});

View File

@@ -98,14 +98,29 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe
},
'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 () {
@@ -132,17 +147,20 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe
'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();

View File

@@ -23,30 +23,30 @@ refer to http://www.clipperz.com.
*/
Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components');
Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
Clipperz.PM.UI.iPhone.Components.CardDetail = function(args) {
Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) {
args = args || {};
Clipperz.PM.UI.iPhone.Components.CardDetail.superclass.constructor.apply(this, arguments);
Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments);
this._cardReference = null;
// this._cardReference = null;
return this;
}
//=============================================================================
Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, {
Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, {
//-------------------------------------------------------------------------
'toString': function () {
return "Clipperz.PM.UI.iPhone.Components.CardDetail component";
return "Clipperz.PM.UI.Mobile.Components.CardDetail component";
},
//-------------------------------------------------------------------------
/*
'cardReference': function () {
return this._cardReference;
},
@@ -54,20 +54,156 @@ Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI
'setCardReference': function (aValue) {
this._cardReference = aValue;
},
*/
//-------------------------------------------------------------------------
'renderSelf': function(/*aContainer, aPosition*/) {
'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')} //,
// {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);
},
*/
'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});
},
//=========================================================================
@@ -143,9 +279,9 @@ Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI
MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState);
},
*/
* /
//=========================================================================
/*
'directLoginClickHandler': function (anEvent) {
anEvent.preventDefault();
@@ -156,7 +292,7 @@ Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference});
}
},
*/
//=========================================================================
__syntaxFix__: "syntax fix"

View File

@@ -23,12 +23,12 @@ refer to http://www.clipperz.com.
*/
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;
@@ -37,44 +37,97 @@ Clipperz.PM.UI.iPhone.Components.CardList = function(args) {
//=============================================================================
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')}
]);
{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('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('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();
@@ -127,7 +180,7 @@ Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.C
'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;
@@ -195,7 +248,7 @@ Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.C
], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')})
},
*/
//=========================================================================
__syntaxFix__: "syntax fix"
});

View File

@@ -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"
});

File diff suppressed because one or more lines are too long

View File

@@ -41,6 +41,10 @@ Clipperz.PM.UI.Web.Components.AccountPanel = function(args) {
tab: 'passphraseTab',
panel: 'passphrasePanel'
},
'OTP': {
tab: 'OTPTab',
panel: 'OTPPanel'
},
'PREFERENCES': {
tab: 'preferencesTab',
panel: 'preferencesPanel'
@@ -74,6 +78,7 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.
{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'}]}
]}
@@ -117,16 +122,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.AccountPanel, Clipperz.PM.UI.
{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 --"}
]}
]}
]}

View File

@@ -82,16 +82,18 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Com
{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"}
]}
]}
]}
@@ -101,8 +103,14 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DataPanel, Clipperz.PM.UI.Com
]);
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"
});

View File

@@ -82,9 +82,10 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI
]},
{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"}
]}
]}
]});
@@ -95,7 +96,8 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI
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');
},
//-------------------------------------------------------------------------
@@ -121,7 +123,9 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI
//-------------------------------------------------------------------------
'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'));

View File

@@ -82,16 +82,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ToolsPanel, Clipperz.PM.UI.Co
{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"}
]}
]}
]}

View File

@@ -231,9 +231,11 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
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});
@@ -321,6 +323,29 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
], {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"
});

View File

@@ -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"
});

File diff suppressed because one or more lines are too long