Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js index 53bf9c5..d6a03d7 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js @@ -1,408 +1,405 @@ /* Copyright 2008-2011 Clipperz Srl -This file is part of Clipperz's Javascript Crypto Library. -Javascript Crypto Library provides web developers with an extensive -and efficient set of cryptographic functions. The library aims to -obtain maximum execution speed while preserving modularity and -reusability. +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 +refer to http://www.clipperz.com. -* Javascript Crypto Library is free software: you can redistribute +* 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. -* Javascript Crypto Library is distributed in the hope that it will +* 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 Javascript Crypto Library. If not, see + License along with Clipperz Community Edition. If not, see <http://www.gnu.org/licenses/>. */ if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } //############################################################################# Clipperz.PM.Components.RecordDetail.MainComponent = function(anElement, args) { args = args || {}; Clipperz.PM.Components.RecordDetail.MainComponent.superclass.constructor.call(this, anElement, args); // this._element = args.element; this._user = args.user; this._editMode = args.editMode || 'VIEW'; // [ 'VIEW' | 'EDIT' ] this._mainPanel = args.mainPanel; this._record = null; this._editComponents = []; this._addFieldButton = null; this._enableSaveButton = true; this._shouldShowLoginInfo = (Clipperz.PM.Proxy.defaultProxy.isReadOnly() ? false : true); // this._mainLayoutManager = null; // this._layoutRegion = null; Clipperz.NotificationCenter.register(null, 'loadingRecordData', this, 'render'); Clipperz.NotificationCenter.register(null, 'decryptingRecordData', this, 'render'); Clipperz.NotificationCenter.register(null, 'loadingRecordVersionData', this, 'render'); Clipperz.NotificationCenter.register(null, 'decryptingRecordVersionData', this, 'render'); Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render'); Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'render'); this.render(); return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.RecordDetail.MainComponent, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.RecordDetail.MainComponent component"; }, //------------------------------------------------------------------------- 'editMode': function() { return this._editMode; }, 'setEditMode': function(aValue, aButtonElement, shouldSkipComponentSynchronization) { //MochiKit.Logging.logDebug(">>> MainComponent.setEditingMode"); this.scrollToTop(); if (aValue == 'VIEW') { if (shouldSkipComponentSynchronization == true) { this.exitModalView(); } else { this.synchronizeComponentValues(); if (this.record().hasPendingChanges()) { if (this.record().isBrandNew()) { this.record().removeEmptyFields(); } this.saveCurrentRecordChanges(aButtonElement); } else { if (this.record().isBrandNew()) { this.record().user().removeRecord(this.record()); } this.exitModalView(); } } } else if (aValue == 'EDIT') { this.enterModalView(); } else { // ???? } this._editMode = aValue; this.render(); }, //------------------------------------------------------------------------- 'user': function() { return this._user; }, //------------------------------------------------------------------------- 'mainPanel': function() { return this._mainPanel; }, //------------------------------------------------------------------------- 'render': function() { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.render"); this.setEnableSaveButton(true); this.element().update(""); if (this.record() == null) { if (MochiKit.Base.keys(this.user().records()).length == 0) { this.renderWithNoRecordAtAll(); } else { this.renderWithNoSelectedRecord(); } } else { this.renderWithSelectedRecord(); } //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.render"); }, //------------------------------------------------------------------------- 'renderWithNoRecordAtAll': function() { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithNoRecordAtAll"); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'form', cls:'noRecordAtAllFORM', children:[ {tag:'div', cls:'recordTitleBlock', children:[ {tag:'h2', id:'recordTitle', htmlString:Clipperz.PM.Strings['recordDetailNoRecordAtAllTitle']} ]}, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', children:[ {tag:'td', colspan:'5', children:[ {tag:'div', cls:'recordDetailDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailNoRecordAtAllDescription']} ]} ]} ]} ]} ]} ); //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithNoRecordAtAll"); }, //------------------------------------------------------------------------- 'renderWithNoSelectedRecord': function() { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithNoSelectedRecord"); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'form', cls:'noRecordSelectedFORM', children:[ {tag:'div', cls:'recordTitleBlock', children:[ {tag:'h2', id:'recordTitle', htmlString:Clipperz.PM.Strings['recordDetailNoRecordSelectedTitle']} ]}, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', children:[ {tag:'td', colspan:'5', children:[ {tag:'div', cls:'recordDetailDescriptionBox', htmlString:Clipperz.PM.Strings['recordDetailNoRecordSelectedDescription']} ]} ]}, {tag:'tr', colspan:'5', children:[ {tag:'td', colspan:'5', children:this.loginInfo()} ]} ]} ]} ]} ); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithNoSelectedRecord - 1"); if (MochiKit.DOM.getElement('fullLoginHistoryLink') != null) { MochiKit.Signal.connect('fullLoginHistoryLink', 'onclick', this, 'showLoginHistoryPanel'); } //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithNoSelectedRecord - 2"); if (MochiKit.DOM.getElement('offlineCopyDownloadWarningLink') != null) { MochiKit.Signal.connect('offlineCopyDownloadWarningLink', 'onclick', this, 'showDownloadOfflineCopyPanel'); } //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithNoSelectedRecord"); }, //------------------------------------------------------------------------- 'renderWithSelectedRecord': function() { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithSelectedRecord"); if (this.record().shouldLoadData() === true) { // this.renderWithSelectedRecordLoading(); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 1.1"); this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailLoadingRecordMessage']); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 1.2"); } else if (this.record().shouldDecryptData() === true) { // this.renderWithSelectedRecordDecrypting(); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 2.1"); this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailDecryptingRecordMessage']); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 2.2"); } else if (this.record().currentVersion().shouldLoadData() === true) { //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 3.1"); this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailLoadingRecordVersionMessage']); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 3.2"); } else if (this.record().currentVersion().shouldDecryptData() === true) { // this.renderWithSelectedRecordCurrentVersionDecrypting(); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 4.1"); this.renderWhileProcessingWithMessage(Clipperz.PM.Strings['recordDetailDecryptingRecordVersionMessage']); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 4.2"); } else { //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 5.1"); this.renderWithSelectedRecordData(); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecord - 5.2"); } //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithSelectedRecord"); }, //......................................................................... 'renderWhileProcessingWithMessage': function(aMessage) { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWhileProcessingWithMessage"); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'form', cls:'processingRecordFORM', children:[ {tag:'div', cls:'recordTitleBlock', children:[ {tag:'h2', id:'recordTitle', html:this.record().label()} ]}, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', cls:'recordTR', children:[ {tag:'td', colspan:'5', children:[ {tag:'div', cls:'recordDetailDescriptionBox', children:[ {tag:'h5', cls:'recordLoadingMessage', html:aMessage} ]} ]} ]} ]} ]} ]} ); //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWhileProcessingWithMessage"); }, //......................................................................... /* 'renderWithSelectedRecordLoading': function() { Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[ {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[ {tag:'h3', html:this.record().label()}, {tag:'h3', html:"loading"} ]} ]}); }, //......................................................................... 'renderWithSelectedRecordDecrypting': function() { Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[ {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[ {tag:'h3', html:this.record().label()}, {tag:'h3', html:"decrypting ... "} ]} ]}); }, //......................................................................... 'renderWithSelectedRecordCurrentVersionDecrypting': function() { Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'', style:'border:1px solid red; padding: 20px;', children:[ {tag:'div', cls:'Clipprez_RecordDetailTitle', children:[ {tag:'h3', html:this.record().label()}, {tag:'h3', html:"decrypting version ... "} ]} ]}); }, */ //------------------------------------------------------------------------- 'renderWithErrorMessage': function(anErrorMessage) { //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithErrorMessage"); this.element().update(""); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithErrorMessage - 1"); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'form', cls:'errorMessageFORM', children:[ {tag:'div', cls:'recordTitleBlock', children:[ {tag:'h2', id:'recordTitle', html:this.record().label()} ]}, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', cls:'recordTR', children:[ {tag:'td', colspan:'5', children:[ {tag:'div', cls:'recordDetailDescriptionBox loadingError', children:[ {tag:'h5', htmlString:Clipperz.PM.Strings['recordDetailLoadingErrorMessageTitle']}, {tag:'p', html:anErrorMessage.message} ]} ]} ]} ]} ]} ]} ); //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithErrorMessage"); }, //------------------------------------------------------------------------- 'renderWithSelectedRecordData': function() { var columns; this.resetEditComponents(); columns = [ {tag:'td', width:'25', html:' '}, {tag:'td', width:'25%', htmlString:Clipperz.PM.Strings['recordDetailLabelFieldColumnLabel']}, {tag:'td', width:'3', html:' '}, {tag:'td', /*width:'80%',*/ htmlString:Clipperz.PM.Strings['recordDetailDataFieldColumnLabel']} ]; if (this.editMode() == 'EDIT') { columns.push({tag:'td', /*width:'55',*/ htmlString:Clipperz.PM.Strings['recordDetailTypeFieldColumnLabel']}) } //MochiKit.Logging.logDebug(">>> RecordDetail.MainComponent.renderWithSelectedRecordData"); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'form', cls:'recordDataFORM', children:[ {tag:'div', cls:'recordTitleBlock', id:this.getId('title')}, {tag:'div', id:'recordDetailDataBox', cls:'recordDetailDataBox', children:[ {tag:'table', width:'100%', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', children:[ {tag:'td', width:'5', html:" "}, {tag:'td', children:[ {tag:'table', cls:'recordDetailDataBoxTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', id:this.getId('tbody'), children:[ {tag:'tr', /*cls:'recordNoteTR',*/ children:[ {tag:'td', colspan:'5', id:this.getId('notes')} ]}, {tag:'tr', cls:'recordFieldsTR', children:columns /* [ {tag:'td', width:'25', html:' '}, {tag:'td', width:'25%', htmlString:Clipperz.PM.Strings['recordDetailLabelFieldColumnLabel']}, {tag:'td', width:'3', html:' '}, {tag:'td', / *width:'80%',* / htmlString:Clipperz.PM.Strings['recordDetailDataFieldColumnLabel']}, {tag:'td', / *width:'55',* / htmlString:Clipperz.PM.Strings['recordDetailTypeFieldColumnLabel']} ] */ } ]} ]}, {tag:'div', cls:'addFieldButton', id:this.getId('addField'), children:[ {tag:'div', id:this.getId('addFieldButton')} ]}, {tag:'div', id:this.getId('directLogins')}, {tag:'div', id:this.getId('footer')} ]} ]} ]} ]} ]} ]} ); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 1"); new Clipperz.PM.Components.RecordDetail.TitleComponent(this.getElement('title'), {mainComponent:this}); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 2"); new Clipperz.PM.Components.RecordDetail.NotesComponent(this.getElement('notes'), {mainComponent:this}); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 3"); new Clipperz.PM.Components.RecordDetail.DirectLoginsComponent(this.getElement('directLogins'), {mainComponent:this}); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 4"); new Clipperz.PM.Components.RecordDetail.HeaderComponent(this.getElement('footer'), {mainComponent:this}); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 5"); MochiKit.Iter.forEach(MochiKit.Base.values(this.record().currentVersion().fields()), this.appendFieldComponent, this); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 6"); this.setAddFieldButton(new YAHOO.ext.Button(this.getDom('addFieldButton'), {text:Clipperz.PM.Strings['recordDetailAddFieldButtonLabel'], handler:this.addNewRecordField, scope:this})); //MochiKit.Logging.logDebug("--- RecordDetail.MainComponent.renderWithSelectedRecordData - 7"); this.update(); //MochiKit.Logging.logDebug("<<< RecordDetail.MainComponent.renderWithSelectedRecordData"); }, //------------------------------------------------------------------------- 'editComponents': function() { return this._editComponents; }, 'resetEditComponents': function() { this._editComponents = []; }, |