summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js23
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js23
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js25
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js22
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js28
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js28
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js28
10 files changed, 102 insertions, 141 deletions
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 1ab2e69..3d9d6d3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
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() {
@@ -279,73 +277,72 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
//=============================================================================
'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/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
index effde31..b1ff81f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Controllers.CardDialogController.superclass.constructor.call(this, args);
this._record = args.record || Clipperz.Base.exception.raise('MandatoryParameter');
this._delegate = args.delegate || Clipperz.Base.exception.raise('MandatoryParameter');
this._referenceElement = null;
this._cardDialogComponent = null;
this._fieldsReferences = {};
this._directLoginReferences = {};
this._directLoginWizardController = null;
this._directLoginEditingComponent = null;
this._isDirectLoginEditingComponentVisible = false;
return this;
};
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.CardDialogController";
},
//-------------------------------------------------------------------------
'record': function () {
return this._record;
},
'delegate': function () {
return this._delegate;
},
//-------------------------------------------------------------------------
'fieldsReferences': function () {
return this._fieldsReferences;
},
@@ -329,97 +327,96 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object
return deferredResult;
},
//-------------------------------------------------------------------------
'updateRecordDirectLoginDetails': function (aDirectLogin) {
var result;
if (MochiKit.Base.isUndefinedOrNull(aDirectLogin)) {
result = MochiKit.Async.succeed();
} else {
result = Clipperz.Async.callbacks("CardDialogController.updateRecordDirectLoginDetails", [
MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
MochiKit.Base.method(aDirectLogin, 'setLabel'),
MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
MochiKit.Base.method(aDirectLogin, 'setFavicon')
], {trace:false});
}
return result;
},
//=========================================================================
'addField': function () {
return this.record().addField({
'label':this.cardDialogComponent().newFieldLabel(),
'value':this.cardDialogComponent().newFieldValue(),
'isHidden':this.cardDialogComponent().newFieldIsHidden()
});
},
'handleAddField': function () {
return Clipperz.Async.callbacks("CardDialogController.handleAddField", [
MochiKit.Base.method(this, 'addField'),
MochiKit.Base.method(this, 'addCardDialogComponentWithField'),
MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'),
MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'),
MochiKit.Base.method(this, 'handleChangedValue')
], {trace:false})
},
//-------------------------------------------------------------------------
'handlePerformFieldAction': function (aFieldID, aTargetElement) {
-//console.log("### targetElement", aTargetElement);
return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
MochiKit.Base.method(this.record(), 'fields'),
MochiKit.Base.itemgetter(aFieldID),
Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", {
'value': MochiKit.Base.methodcaller('value'),
'type': MochiKit.Base.methodcaller('actionType')
}, {trace:false}),
MochiKit.Base.bind(function (someValues) {
switch (someValues['type']) {
case 'NONE':
throw "this event handler should not be triggered for fields with type 'NONE'";
break;
case 'URL':
var url;
url = someValues['value'];
if (/^https?\:\/\//.test(url) == false) {
url = 'http://' + url;
}
window.open(url);
break;
case 'EMAIL':
var url;
url = 'mailto:' + someValues['value'];
MochiKit.DOM.currentWindow().location = url;
break;
case 'PASSWORD':
//Clipperz.log("SHOW PASSWORD " + someValues['value']);
this.showPasswordTooltip(someValues['value'], aTargetElement);
break;
}
}, this)
], {trace:false});
},
//-------------------------------------------------------------------------
'handleDeleteField': function (aFieldID) {
return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [
MochiKit.Base.method(this.record(), 'fields'),
MochiKit.Base.itemgetter(aFieldID),
MochiKit.Base.method(this.record(), 'removeField'),
MochiKit.Base.method(this, 'fieldsReferences'),
MochiKit.Base.itemgetter(aFieldID),
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
index f58f0b8..68b5b9f 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.CardsController = function() {
Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments);
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard');
return this;
}
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.CardsController";
},
'createGrid': function () {
var grid;
grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
'name': 'Cards.favicon',
'selector': MochiKit.Base.methodcaller('favicon'),
'cssClass': 'favicon'
}),
new Clipperz.PM.UI.Web.Components.LinkColumnManager({
'name': 'Cards.title',
'selector': MochiKit.Base.methodcaller('label'),
'label': 'title',
'cssClass': 'title',
'comparator': Clipperz.Base.caseInsensitiveCompare,
'sortable': true,
'sorted': 'ASCENDING',
// 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})}
'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
}),
new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({
'name': 'Cards.directLogins',
'selector': MochiKit.Base.methodcaller('directLoginReferences'),
'label': 'direct logins',
'cssClass': 'directLogin'
}),
new Clipperz.PM.UI.Web.Components.DateColumnManager({
'name': 'Cards.latestUpdate',
'selector': MochiKit.Base.methodcaller('updateDate'),
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
index c025a51..92ed6e3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) {
this._directLoginEditingComponent = args.directLoginEditingComponent || Clipperz.Base.exception.raise('MandatoryParameter');
this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter');
MochiKit.Signal.connect(this._directLoginEditingComponent, 'changedValue', this, 'handleChangedValue');
MochiKit.Signal.connect(this._directLoginEditingComponent, 'moveForward', this, 'handleMoveForward');
MochiKit.Signal.connect(this._directLoginEditingComponent, 'keyPressed', this, 'handleDirectLoginEditingComponentKeyPressed');
this._directLogin = null;
this._directLoginHasJustBeenAdded = false;
this._rulerComponent = null;
this._steps = null;
this._currentStepIndex = 0;
this._isNextEnabled = false;
this._recordFields = null;
this._originalBindings = null;
this._bindingComponents = [];
this._formValueComponents = [];
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.prototype, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController";
},
//-------------------------------------------------------------------------
'directLogin': function () {
return this._directLogin;
},
//-------------------------------------------------------------------------
'directLoginHasJustBeenAdded': function () {
return this._directLoginHasJustBeenAdded;
},
@@ -118,97 +116,96 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
'resetBindingComponents': function () {
this.directLoginEditingComponent().clearAllBindingsComponents();
this._bindingComponents = [];
},
//=============================================================================
'formValueComponents': function () {
return this._formValueComponents;
},
'resetFormValueComponents': function () {
this.directLoginEditingComponent().clearAllFormValueComponents();
this._formValueComponents = [];
},
//=============================================================================
'recordFields': function () {
return this._recordFields;
},
'setRecordFields': function (aValue) {
this._recordFields = aValue;
},
'recordFieldWithReference': function (aReference) {
var matchingValues;
var result;
matchingValues = MochiKit.Base.filter(function (aField) { return aField['reference'] == aReference; }, this.recordFields());
if (matchingValues.length == 0) {
result = null;
} else {
result = matchingValues[0];
}
return result;
},
//-----------------------------------------------------------------------------
'originalBindings': function () {
return this._originalBindings;
},
'setOriginalBindings': function (aValue) {
-//console.log("BINDINGS", aValue);
this._originalBindings = aValue;
},
//=============================================================================
'rulerComponent': function () {
if (this._rulerComponent == null) {
this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
translationContext:'Wizards.DirectLoginWizard'
});
this._rulerComponent.render();
MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
MochiKit.Signal.connect(this._rulerComponent, 'moveForward', this, 'handleMoveForward');
MochiKit.Signal.connect(this._rulerComponent, 'moveBackward', this, 'handleMoveBackward');
MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved', this, 'handleCursorMoved');
}
return this._rulerComponent;
},
//-----------------------------------------------------------------------------
'showRuler': function (someSteps) {
var rulerElement;
this.setSteps(someSteps);
rulerElement = this.rulerComponent().element();
this.directLoginEditingComponent().disableAllPanels();
MochiKit.Style.showElement(rulerElement);
MochiKit.Style.setElementPosition(rulerElement, {x:-1000, y:this.directLoginEditingComponent().bottomMargin()});
new MochiKit.Visual.Move(rulerElement, {
x:0, y:this.directLoginEditingComponent().bottomMargin(),
mode:'absolute',
duration:1,
afterFinish:MochiKit.Base.method(this, 'handleCursorMoved')
});
},
'fixRulerRendering': function (aValue) {
this.rulerComponent().setDisplayMode(aValue);
},
//-----------------------------------------------------------------------------
@@ -362,98 +359,96 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController.
this.directLoginEditingComponent().focusOnFaviconElement();
break;
case 'DONE':
break;
}
},
//=============================================================================
'steps': function () {
return this._steps;
},
'setSteps': function (aValue) {
this._steps = aValue;
this.rulerComponent().setSteps(aValue);
this.resetCurrentStepIndex();
},
'currentStepIndex': function () {
return this._currentStepIndex;
},
'currentStep': function () {
return this.steps()[this.currentStepIndex()];
},
//=============================================================================
'handleExit': function () {
MochiKit.Signal.signal(this, 'exit');
},
'done': function () {
this.doneWithRuler();
Clipperz.Async.callbacks("DirectLoginWizardController.done", [
MochiKit.Base.method(this.directLoginEditingComponent(), 'label'),
MochiKit.Base.method(this.directLogin(), 'setLabel'),
MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'),
MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'),
// Bindings
MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'),
// MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) {
Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) {
-//console.log("aBindingComponent", aBindingComponent);
-// this.directLogin().
return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [
MochiKit.Base.method(this.directLogin(), 'bindings'),
MochiKit.Base.itemgetter(aBindingComponent.formFieldName()),
MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue())
], {trace:false});
}, this)),
MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'),
MochiKit.Base.method(this.directLogin(), 'setFavicon'),
MochiKit.Base.partial(MochiKit.Signal.signal, this, 'done', {
'directLogin': this.directLogin(),
'hasJustBeenAdded': this.directLoginHasJustBeenAdded()
})
], {trace:false});
},
//=============================================================================
'handleMoveBackward': function () {
if (this._currentStepIndex > 0) {
var afterMoveAction;
this._currentStepIndex --;
afterMoveAction = MochiKit.Base.noop;
switch(this.currentStep()) {
case 'LABEL':
break;
case 'TYPE':
break;
case 'CONFIGURATION':
break;
case 'BINDINGS':
break;
case 'FAVICON':
break;
case 'DONE':
break;
};
this.rulerComponent().moveBackward(afterMoveAction);
}
if (this._currentStepIndex == 0) {
this.enablePrevious(false);
}
},
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
index 6ca3be4..7ab512a 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
/*
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() {
Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments);
return this;
};
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.DirectLoginsController, Clipperz.PM.UI.Web.Controllers.GridController, {
'createGrid': function () {
return new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [
new Clipperz.PM.UI.Web.Components.FaviconColumnManager({
'name': 'DirectLogins.favicon',
'selector': MochiKit.Base.methodcaller('favicon'),
'cssClass': 'favicon'
}),
// new Clipperz.PM.UI.Web.Components.LinkColumnManager({
new Clipperz.PM.UI.Web.Components.DirectLoginColumnManager({
'name': 'DirectLogins.title',
'selector': MochiKit.Base.methodcaller('label'),
'label': 'title',
'cssClass': 'title',
'comparator': Clipperz.Base.caseInsensitiveCompare,
'sortable': true,
'sorted': 'ASCENDING',
'actionMethod': MochiKit.Base.methodcaller('runDirectLogin')
}),
// new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
// 'label': 'strength',
// 'cssClass': 'title',
// 'selector': MochiKit.Base.methodcaller('label') //should be 'strength' or a strenght evaluation function
// }),
new Clipperz.PM.UI.Web.Components.LinkColumnManager({
'name': 'DirectLogins.cardTitle',
'selector': MochiKit.Base.compose(MochiKit.Base.methodcaller('label'), MochiKit.Base.methodcaller('record')),
'label': 'card',
'cssClass': 'cardTitle',
'comparator': Clipperz.Base.caseInsensitiveCompare,
'sortable': true,
'sorted': 'UNSORTED',
'actionMethod': MochiKit.Base.method(this, 'handleShowCard')
}),
// new Clipperz.PM.UI.Web.Components.TextColumnManager({ //should be StrengthColumnManager
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
index bfc093a..de59ec3 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.FilterController = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Controllers.FilterController.superclass.constructor.call(this, args);
this._filterElements = [];
this._filter = "";
this._pendingSearchClicks = 0;
return this;
};
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.FilterController, Object, {
//-----------------------------------------------------------------------------
'getFilter': function () {
return this._filter;
},
'_setFilter': function (aFilterElement, aFilter) {
if (aFilter != this._filter) {
this._filter = aFilter;
MochiKit.Signal.signal(this, 'filterUpdated', aFilter);
this.updateFilterElements(aFilterElement, aFilter);
}
},
'setFilter': function (aFilter) {
this._setFilter(null, aFilter);
},
//-----------------------------------------------------------------------------
'filterElements': function () {
return this._filterElements;
},
'registerFilterElement': function (aFilterElement) {
//Clipperz.log("=== FilterController.registerFilterElement", aFilterElement);
this._filterElements.push(aFilterElement);
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
index 8bb3016..44fbdef 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.GridController = function(args) {
args = args || {};
Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args);
this._grid = null;
this._user = null;
this._sortedColumnManager = null;
this._cachedObjects = null;
this._filterController = args.filterController || null;
this._deferredDisplaySelectedRowsInvocation = null;
return this;
};
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.GridController";
},
//-----------------------------------------------------------------------------
'createGrid': function () {
throw Clipperz.Base.exception.AbstractMethod;
},
'setupWithGrid': function (aGrid) {
this._grid = aGrid;
if (this._grid != null) {
MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) {
if (aColumnManager.isSortable()) {
if (aColumnManager.isSorted()) {
this.setSortedColumnManager(aColumnManager);
}
MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort');
}
MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow');
MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow');
}, this);
}
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
index a57152d..ac85d36 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.LoginController = function(args) {
this._args = args || {};
this._loginPage = null;
this._newUserWizardController = null;
this._newUserCreationComponent = null;
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.LoginController";
},
'args': function () {
return this._args;
},
//-----------------------------------------------------------------------------
'loginPage': function() {
if (this._loginPage == null) {
this._loginPage = new Clipperz.PM.UI.Web.Components.LoginPage();
MochiKit.Signal.connect(this._loginPage, 'createNewAccountClick', this, 'handleCreateNewAccountClick')
}
return this._loginPage;
},
//-----------------------------------------------------------------------------
'run': function(args) {
var slot;
var loginPage;
var loginForm;
slot = args.slot;
loginForm = new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']});
@@ -167,84 +165,82 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, {
this._newUserCreationComponent = new Clipperz.PM.UI.Web.Components.NewUserCreationComponent();
}
return this._newUserCreationComponent;
},
'clearNewUserCreationComponent': function () {
if (this._newUserCreationComponent != null) {
this._newUserCreationComponent.clear();
}
this._newUserCreationComponent = null;
},
//-------------------------------------------------------------------------
'handleHideNewUserCreationComponent': function () {
this.clearNewUserCreationComponent();
},
'handleCompleteNewUserCreationComponent': function (someParameters) {
var deferredResult;
var user;
var newUserCreationComponent;
user = someParameters.user;
newUserCreationComponent = this.newUserCreationComponent();
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN', MochiKit.Base.method(newUserCreationComponent, 'deferredHideModal', {closeToElement:MochiKit.DOM.currentDocument().body})),
deferredResult = new Clipperz.Async.Deferred("LoginController.handleCompleteNewUserCreationComponent", {trace:false});
deferredResult.addCallbackList([
MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'),
MochiKit.Base.method(user, 'login'),
MochiKit.Base.method(this, 'userLoggedIn', user),
MochiKit.Base.method(this, 'clearNewUserCreationComponent')
]);
deferredResult.addErrback(function (aValue) { Clipperz.log("WTF!! Error doing the login after creating a new user" + aValue)});
deferredResult.callback();
return deferredResult;
},
//=========================================================================
'handleFailedLogin': function(aLoginProgress, anError) {
var result;
-//console.log("anError", anError);
if (anError instanceof MochiKit.Async.CancelledError) {
result = anError;
} else {
var deferredResult;
-MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError);
+Clipperz.logError("## MainController - FAILED LOGIN: " + anError);
deferredResult = new MochiKit.Async.Deferred();
aLoginProgress.showErrorMessage("failed login");
// Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback');
MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback');
deferredResult.addCallback(MochiKit.Async.fail, anError)
result = deferredResult;
}
return result;
},
'handleGenericError': function(anError) {
var result;
if (anError instanceof MochiKit.Async.CancelledError) {
result = anError;
} else {
-MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
-//console.log(anError);
+Clipperz.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack);
result = new MochiKit.Async.CancelledError(anError);
}
return result;
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
index c83e3c0..9194125 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js
@@ -1,70 +1,68 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.MainController = function(args) {
this._args = args;
// controllers
this._loginController = null;
this._appController = null;
// components
this._headerComponent = null;
this._pageComponent = null;
this._footerComponent = null;
this._passphraseDelegateLock = new MochiKit.Async.DeferredLock();
this._passphraseDelegateLock.acquire();
//Clipperz.log('MainController init _passphraseDelegateLock', this._passphraseDelegateLock);
this._passphraseDelegate = null;
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestSent', this, 'handleRemoteRequestSent');
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'remoteRequestReceived', this, 'handleRemoteRequestReceived');
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.MainController";
},
'args': function () {
return this._args;
},
//-----------------------------------------------------------------------------
'headerComponent': function() {
if (this._headerComponent == null) {
this._headerComponent = new Clipperz.PM.UI.Web.Components.PageHeader();
}
return this._headerComponent;
},
@@ -130,86 +128,80 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("MainController.getPassphrase", {trace:false});
deferredResult.acquireLock(this._passphraseDelegateLock);
deferredResult.addMethod(this, 'invokePassphraseDelegate');
deferredResult.releaseLock(this._passphraseDelegateLock);
deferredResult.callback();
return deferredResult;
},
//.........................................................................
'invokePassphraseDelegate': function () {
return this._passphraseDelegate();
},
'passphraseDelegateLock': function () {
return this._passphraseDelegateLock;
},
//.........................................................................
'setPassphraseDelegate': function (aDelegate) {
var shouldReleaseLock;
shouldReleaseLock = (this._passphraseDelegate == null);
this._passphraseDelegate = aDelegate;
if (shouldReleaseLock) {
this._passphraseDelegateLock.release();
}
},
//.........................................................................
'removePassphraseDelegate': function (aDelegate) {
if (this._passphraseDelegate == aDelegate) {
this._passphraseDelegate = null;
this._passphraseDelegateLock.acquire();
}
},
//-------------------------------------------------------------------------
'loginControllerUserLoggedInCallback': function(anEvent) {
-//Clipperz.log(">>> loginControllerUserLoggedInCallback", anEvent);
-// this.setUser(anEvent.parameters()['user']);
-//console.log("--- loginControllerUserLoggedInCallback - 1");
-
-//console.log("--- loginControllerUserLoggedInCallback - 2");
this.headerComponent().switchToLoggedMode();
this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']});
-//Clipperz.log("<<< loginControllerUserLoggedInCallback");
},
//-----------------------------------------------------------------------------
'handleRemoteRequestSent': function () {
//Clipperz.log("REMOTE REQUEST sent >>>");
},
'handleRemoteRequestReceived': function () {
//Clipperz.log("REMOTE REQUEST received <<<");
},
//-----------------------------------------------------------------------------
'handleLogout': function(anEvent) {
this.exit('logout.html');
},
//-----------------------------------------------------------------------------
'exit': function(aPageName) {
//Clipperz.log("### exit " + aPageName);
MochiKit.Async.wait(0).addCallback(function() {
window.location.href = "./" + aPageName + "?ln=" + Clipperz.PM.Strings.selectedLanguage;
});
},
//-----------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
index 7db6888..b70aa17 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
@@ -1,123 +1,120 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) {
this._newUserCreationComponent = args.newUserCreationComponent || Clipperz.Base.exception.raise('MandatoryParameter');
MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue', this, 'handleChangedValue');
MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward', this, 'handleMoveForward');
MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed', this, 'handleNewUserCreationComponentKeyPressed');
this._rulerComponent = null;
this._steps = null;
this._currentStepIndex = 0;
this._isNextEnabled = false;
this._userCreationState = 'IDLE'; // 'IN PROGRESS', 'DONE', 'FAILED'
this._user = null;
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, {
'toString': function() {
return "Clipperz.PM.UI.Web.Controllers.NewUserWizardController";
},
//-------------------------------------------------------------------------
'newUserCreationComponent': function () {
return this._newUserCreationComponent;
},
//=============================================================================
'user': function () {
return this._user;
},
'setUser': function (aValue) {
this._user = aValue;
},
//-----------------------------------------------------------------------------
'userCreationState': function () {
return this._userCreationState;
},
'setUserCreationState': function (aValue) {
-//console.log("+++ NewUserWizardController.setUserCreationState", aValue);
this._userCreationState = aValue;
this.checkState();
},
//=============================================================================
'resetCurrentStepIndex': function () {
this._currentStepIndex = 0;
this.rulerComponent().resetStatus({animateTransition:true});
},
//-----------------------------------------------------------------------------
'enableNext': function (aValue) {
this.rulerComponent().enableNext(aValue);
this._isNextEnabled = aValue;
},
'isNextEnabled': function () {
return this._isNextEnabled;
},
//-----------------------------------------------------------------------------
'enablePrevious': function (aValue) {
this.rulerComponent().enablePrevious(aValue);
},
//=============================================================================
'rulerComponent': function () {
if (this._rulerComponent == null) {
this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({
translationContext:'Wizards.NewUserWizard'
});
this._rulerComponent.render();
MochiKit.Signal.connect(this._rulerComponent, 'exit', this, 'handleExit');
MochiKit.Signal.connect(this._rulerComponent, 'done', this, 'done');
MochiKit.Signal.connect(this._rulerComponent, 'moveForward', this, 'handleMoveForward');
MochiKit.Signal.connect(this._rulerComponent, 'moveBackward', this, 'handleMoveBackward');
MochiKit.Signal.connect(this._rulerComponent, 'cursorMoved', this, 'handleCursorMoved');
}
return this._rulerComponent;
},
'resetRuler': function () {
@@ -177,106 +174,103 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
},
//=============================================================================
'createNewUserRulerSteps': function () {
return [ 'CREDENTIALS', 'CHECK_CREDENTIALS', 'TERMS_OF_SERVICE', 'CREATE_USER'/*, 'LOGIN' */];
},
//-------------------------------------------------------------------------
'run': function () {
return Clipperz.Async.callbacks("NewUserWizardController.run", [
MochiKit.Base.method(this, 'createNewUserRulerSteps'),
MochiKit.Base.method(this, 'showRuler')
], {trace:false});
},
//-----------------------------------------------------------------------------
'checkState': function () {
var enablePrevious;
var enableNext;
enablePrevious = true;
enableNext = false;
this.newUserCreationComponent().disableAllPanels();
switch(this.currentStep()) {
case 'CREDENTIALS':
this.newUserCreationComponent().enableCredentialsPanel();
enableNext = (
(this.newUserCreationComponent().username() != '')
&&
(this.newUserCreationComponent().passphrase() != '')
);
// enablePrevious = false;
break;
case 'CHECK_CREDENTIALS':
this.newUserCreationComponent().enableCheckCredentialsPanel();
enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase());
// enablePrevious = true;
break
case 'TERMS_OF_SERVICE':
this.newUserCreationComponent().enableTermsOfServicePanel();
-//console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase());
-//console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService());
enableNext = (
(this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on')
&&
(this.newUserCreationComponent().readTermsOfService() == 'on')
)
break;
case 'CREATE_USER':
-//console.log(">>> CREATE_USER", this.userCreationState());
this.newUserCreationComponent().enableCreateUserPanel();
switch (this.userCreationState()) {
case 'IDLE':
this.setUserCreationState('IN PROGRESS');
this.preformActualUserRegistration();
enablePrevious = false;
enableNext = false;
break;
case 'IN PROGRESS':
enablePrevious = false;
enableNext = false;
break;
case 'DONE':
enablePrevious = false;
enableNext = true;
break;
case 'FAILED':
enablePrevious = true;
enableNext = false;
break;
};
break;
// case 'LOGIN':
// this.newUserCreationComponent().enableLoginPanel();
// break;
}
if (this.currentStepIndex() > 0) {
this.enablePrevious(enablePrevious);
} else {
this.enablePrevious(false);
}
this.enableNext(enableNext);
},
//-----------------------------------------------------------------------------
'setFocus': function () {
switch(this.currentStep()) {
case 'CREDENTIALS':
this.newUserCreationComponent().focusOnUsernameElement();
break;
case 'CHECK_CREDENTIALS':
this.newUserCreationComponent().focusOnRePassphraseElement();
break
case 'TERMS_OF_SERVICE':
@@ -292,166 +286,164 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
'steps': function () {
return this._steps;
},
'setSteps': function (aValue) {
this._steps = aValue;
this.rulerComponent().setSteps(aValue);
this.resetCurrentStepIndex();
},
'currentStepIndex': function () {
return this._currentStepIndex;
},
'currentStep': function () {
return this.steps()[this.currentStepIndex()];
},
//=============================================================================
'handleExit': function () {
return Clipperz.Async.callbacks("NewUserWizardController.handleExit", [
// MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'),
Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [
MochiKit.Base.method(this, 'hideRuler'),
MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal')
], {trace:false}),
MochiKit.Base.method(this, 'resetRuler'),
// MochiKit.Base.method(this.newUserCreationComponent(), 'reset'),
MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit')
], {trace:false})
},
'done': function () {
this.doneWithRuler();
MochiKit.Signal.signal(this, 'done', {'user': this.user()});
},
//=============================================================================
'handleMoveBackward': function () {
if (this._currentStepIndex > 0) {
var afterMoveAction;
afterMoveAction = MochiKit.Base.noop;
-//console.log("<-- backward", this.currentStep());
switch(this.currentStep()) {
case 'CREDENTIALS':
case 'CHECK_CREDENTIALS':
case 'TERMS_OF_SERVICE':
this._currentStepIndex --;
this.rulerComponent().moveBackward(afterMoveAction);
break;
case 'CREATE_USER':
this.setUser(null);
this.newUserCreationComponent().hideAllProgeressStates();
this.resetCurrentStepIndex();
this.setUserCreationState('IDLE');
break;
// case 'LOGIN':
// break;
};
}
if (this._currentStepIndex == 0) {
this.enablePrevious(false);
}
},
'handleMoveForward': function () {
if (this.isNextEnabled()) {
var afterMoveAction;
this._currentStepIndex ++;
afterMoveAction = MochiKit.Base.noop;
switch(this.currentStep()) {
case 'CREDENTIALS':
break;
case 'CHECK_CREDENTIALS':
break
case 'TERMS_OF_SERVICE':
break;
case 'CREATE_USER':
break;
// case 'LOGIN':
// break;
};
this.rulerComponent().moveForward(afterMoveAction);
};
},
'handleCursorMoved': function () {
// this.checkState();
// this.setFocus();
return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [
MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
MochiKit.Base.method(this, 'checkState'),
MochiKit.Base.method(this, 'setFocus')
], {trace:false});
},
//-------------------------------------------------------------------------
'handleChangedValue': function (anEvent) {
this.checkState();
},
//-------------------------------------------------------------------------
'handleNewUserCreationComponentKeyPressed': function (anEvent) {
-//console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string);
if (anEvent.key().string == 'KEY_ENTER') {
if (anEvent.target().nodeName != 'TEXTAREA') {
anEvent.preventDefault();
this.handleMoveForward();
}
} else if (anEvent.key().string == 'KEY_TAB') {
if (anEvent.target() == this.newUserCreationComponent().usernameElement()) {
} else {
this.handleMoveForward();
if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) {
anEvent.preventDefault();
}
}
} else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) {
this.handleMoveForward();
} else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) {
this.handleMoveBackward();
} else if (anEvent.key().string == 'KEY_ESCAPE') {
anEvent.stop();
this.handleExit();
} else {
MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState'));
}
},
//=============================================================================
'preformActualUserRegistration': function () {
var deferredResult;
deferredResult = new Clipperz.Async.Deferred("NewUSerWizardController.preformActualUserRegistration", {trace:false});
deferredResult.addMethod(this.newUserCreationComponent(), 'showProgressOnUserCreation');
deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this.newUserCreationComponent(), 'passphrase'));
deferredResult.addCallback(Clipperz.PM.DataModel.User.registerNewAccount,
this.newUserCreationComponent().username(),
MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')
);
deferredResult.addMethod(this, 'setUser');
deferredResult.addMethod(this.newUserCreationComponent(), 'showUserCreationDone');
deferredResult.addMethod(this, 'setUserCreationState', 'DONE');
// deferredResult.addErrback(MochiKit.Base.method(this.newUserCreationComponent(), 'showUserCreationFailed'));
// deferredResult.addErrback(MochiKit.Base.method(this, 'setUser', null));
// deferredResult.addErrback(MochiKit.Base.method(this, 'setUserCreationState', 'FAILED'));
deferredResult.addErrback(MochiKit.Base.bind(function (aValue) {
this.newUserCreationComponent().showUserCreationFailed();
this.setUser(null);
this.setUserCreationState('FAILED');