Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Panels') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js index c19a8a3..bab5fba 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js +++ b/frontend/beta/js/Clipperz/PM/Components/Panels/MainPanel.js @@ -1,339 +1,369 @@ /* Copyright 2008-2013 Clipperz Srl 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 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 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. 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.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; } //############################################################################# Clipperz.PM.Components.Panels.MainPanel = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Panels.MainPanel.superclass.constructor.call(this, anElement, args); this._recordListDataModel = null; this._selectedRecord = null; this._recordDetailComponent = null; this._recordListGrid = null; this._directLinkItemTemplate = null; this._recordItemTemplate = null; this._addNewRecordButton = null; this._deleteRecordButton = null; this._creationWizard = null; Clipperz.NotificationCenter.register(null, 'selectAndEnterEditMode', this, 'selectRecordAndEnterEditModeHandler'); Clipperz.NotificationCenter.register(null, 'recordAdded', this, 'recordAddedHandler'); Clipperz.NotificationCenter.register(null, 'recordUpdated', this, 'recordUpdatedHandler'); Clipperz.NotificationCenter.register(null, 'recordRemoved', this, 'recordRemovedHandler'); Clipperz.NotificationCenter.register(null, 'directLoginAdded', this, 'directLoginAddedHandler'); Clipperz.NotificationCenter.register(null, 'directLoginUpdated', this, 'directLoginUpdatedHandler'); Clipperz.NotificationCenter.register(null, 'directLoginRemoved', this, 'directLoginRemovedHandler'); Clipperz.NotificationCenter.register(null, 'accountLocked', this, 'accountLockedHandler'); MochiKit.Signal.connect(MochiKit.DOM.currentWindow(), 'onresize', this, 'resizeModalMask'); this.render(); return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Panels.MainPanel, Clipperz.PM.Components.Panels.BasePanel, { 'toString': function() { return "Clipperz.PM.Components.Panels.MainPanel component"; }, //------------------------------------------------------------------------- 'render': function() { this.element().update(""); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', id:'mainPanelTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', children:[ {tag:'td', width:'15', children:[ {tag:'div', cls:'mainPanelMinHeightDiv'} ]}, {tag:'td', valign:'top', id:'directLoginsTD', width:'200', children:[ + {tag:'div', id:'accountStatus', children:[ + {tag:'div', cls:'header', children:[{tag:'h5', cls:'title', htmlString:"Account info"}]}, +// {tag:'div', cls:'accountStatus', html:"early adopter"}, + {tag:'div', cls:'accountLevel', children:[ + {tag:'span', cls:'label', html:"status"}, + {tag:'span', cls:'status', html:"early adopter"} + ]}, + {tag:'div', cls:'accountLevel', children:[ + {tag:'span', cls:'label', html:"level"}, +// {tag:'span', cls:'level', html:"★☆☆☆"} + {tag:'span', cls:'level', html:"☆☆☆☆"} + ]}, + {tag:'div', cls:'accountExpiration', children:[ + {tag:'span', cls:'label', html:"expires"}, +// {tag:'span', cls:'expriation', html:"on 26 April 2014"} + {tag:'span', cls:'expriation', html:"never"} + ]}, +// {tag:'div', cls:'payButton', children:[ +// {tag:'a', href:'#', cls:'info', html:"info"} +// ]} + {tag:'div', id:'payButton', cls:'payButton'} + ]}, {tag:'div', id:'directLoginsBlock', children:[ {tag:'div', cls:'directLoginsBlockHeaderBox', children:[{tag:'h3', id:'directLoginTitle', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockLabel']}]}, {tag:'div', id:'directLoginsDescription', htmlString:Clipperz.PM.Strings['mainPanelDirectLoginBlockDescription']}, {tag:'ul', id:'directLogins'} ]} ]}, {tag:'td', width:'15', children:[ {tag:'div', cls:'mainPanelMinHeightDiv'} ]}, {tag:'td', valign:'top', children:[ {tag:'div', id:'mainContent', children:[ {tag:'div', id:'recordListBlockHeader'}, {tag:'div', id:'recordListAndDetailBlock', children:[ {tag:'table', id:'recordListAndDetailBlockTABLE', border:'0', cellspacing:'0', cellpadding:'0', children:[ {tag:'tbody', children:[ {tag:'tr', children:[ {tag:'td', valign:'top', width:'250', children:[ {tag:'div', id:'recordListBlock', children:[ {tag:'div', id:'recordListFilterHeader'}, {tag:'ul', id:'records'} ]} ]}, {tag:'td', id:'recordDetailSeparatorTD', rowspan:'2', valign:'top', bgcolor:'#ddddff', html:' '}, {tag:'td', valign:'top', children:[ {tag:'div', id:'recordDetailMainBlock', children:[ {tag:'div', id:'recordTitleTopBlock'}, {tag:'div', id:'recordDetailBlock', children:[ {tag:'div', id:'recordDetail'} ]} ]}, {tag:'div', id:'recordCreationWizardMainBlock', children:[ {tag:'div', id:'recordCreationWizard', html:"WIZARD"} ]} ]} ]}, {tag:'tr', children:[ {tag:'td', id:'cardBoxLowerLeftTD', html:' '}, {tag:'td', id:'cardBoxLowerRightTD', html:' '} ]} ]} ]} ]} ]} ]}, {tag:'td', width:'15', html:" "} ]} ]} ]}); this.renderRecordListBlockHeader(); // this.renderRecordListFilterHeader(); YAHOO.ext.Element.get('directLogins').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); + // TODO + new YAHOO.ext.Button('payButton', {text:"Info", handler:this.payButtonHandler, scope:this}); this.recordDetailComponent(); YAHOO.ext.Element.get('recordDetailMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).show(); YAHOO.ext.Element.get('recordCreationWizardMainBlock').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide(); }, //------------------------------------------------------------------------- + 'payButtonHandler': function(anEvent) { + window.open('https://www.clipperz.com/pricing/', '_blank'); + }, + + //------------------------------------------------------------------------- + 'addNewRecordButton': function() { return this._addNewRecordButton; }, 'setAddNewRecordButton': function(aValue) { this._addNewRecordButton = aValue; }, 'deleteRecordButton': function() { return this._deleteRecordButton; }, 'setDeleteRecordButton': function(aValue) { this._deleteRecordButton = aValue; }, //------------------------------------------------------------------------- 'addNewRecord': function(anEvent) { var deferredResult; // var currentNumberOfRecords; deferredResult = new MochiKit.Async.Deferred(); // currentNumberOfRecords = MochiKit.Base.keys(this.user().records()).length; /* // if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords > 0) && ((currentNumberOfRecords%10) == 0)) { // if (true) { if ((this.user().preferences().shouldShowDonationPanel()) && (currentNumberOfRecords >= 5)) { deferredResult.addCallback(Clipperz.PM.showDonationSplashScreen, this.user(), 'recordListAddRecordButton'); } */ deferredResult.addCallback(MochiKit.Base.bind(function() { var currentlySelectedRecord; currentlySelecedRecord = this.selectedRecord(); this.setSelectedRecord(null); YAHOO.ext.Element.get('recordDetailMainBlock').hide(); YAHOO.ext.Element.get('recordCreationWizardMainBlock').show(); this.setCreationWizard(new Clipperz.PM.Components.RecordDetail.CreationWizard(YAHOO.ext.Element.get('recordCreationWizardMainBlock'), {previouslySelectedRecord:currentlySelecedRecord, mainComponent:this})); this.enterModalView(); }, this)); deferredResult.callback(); }, //------------------------------------------------------------------------- 'creationWizard': function() { return this._creationWizard; }, 'setCreationWizard': function(aValue) { this._creationWizard = aValue; }, //------------------------------------------------------------------------- 'exitWizard': function(aSelectedRecord, shouldEnterEditMode) { //MochiKit.Logging.logDebug(">>> MainPanel.exitWizard - " + aSelectedRecord) YAHOO.ext.Element.get('recordCreationWizardMainBlock').hide(); YAHOO.ext.Element.get('recordDetailMainBlock').show(); if (shouldEnterEditMode == true) { this.selectRecordAndEnterEditMode(aSelectedRecord); } else { this.setSelectedRecord(aSelectedRecord); this.exitModalView(); } this.creationWizard().remove(); this.setCreationWizard(null); //MochiKit.Logging.logDebug("<<< MainPanel.exitWizard"); }, //------------------------------------------------------------------------- 'selectRecordAndEnterEditMode': function(aRecord) { this.setSelectedRecord(aRecord); this.recordDetailComponent().setEditMode('EDIT'); }, 'selectRecordAndEnterEditModeHandler': function(anEvent) { this.selectRecordAndEnterEditMode(anEvent.source()); }, //------------------------------------------------------------------------- 'resizeModalMask': function() { //MochiKit.Logging.logDebug(">>> MainPanel.resizeModalMask"); MochiKit.Style.setElementDimensions('recordDetailEditModeHeaderMask', {w:MochiKit.Style.getElementDimensions('mainDiv').w, h:119}); MochiKit.Style.setElementDimensions('recordDetailEditModeVerticalMask', {w:511, h:MochiKit.Style.getElementDimensions('mainDiv').h - 119}); //MochiKit.Logging.logDebug("<<< MainPanel.resizeModalMask"); }, //------------------------------------------------------------------------- 'enterModalView': function() { if (this.user().preferences().useSafeEditMode()) { var headerMaskElement; var verticalMaskElement; this.resizeModalMask(); headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); headerMaskElement.show(); headerMaskElement.mask(); verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); verticalMaskElement.show(); verticalMaskElement.mask(); } }, //------------------------------------------------------------------------- 'exitModalView': function() { if (this.user().preferences().useSafeEditMode()) { var headerMaskElement; var verticalMaskElement; headerMaskElement = YAHOO.ext.Element.get('recordDetailEditModeHeaderMask'); headerMaskElement.unmask(); headerMaskElement.hide(); verticalMaskElement = YAHOO.ext.Element.get('recordDetailEditModeVerticalMask'); verticalMaskElement.unmask(); verticalMaskElement.hide(); } }, //------------------------------------------------------------------------- 'removeSelectedRecord': function() { var selectedRecordReferences; //MochiKit.Logging.logDebug(">>> MainPanel.removeSelectedRecord"); if (this.selectedRecord() != null) { selectedRecordReferences = [this.selectedRecord().reference()]; } else { selectedRecordReferences = []; } if (selectedRecordReferences.length > 0 ) { var recordReference; var records; var deferred; records = []; for (recordReference in selectedRecordReferences) { var record; //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - recordReference: " + selectedRecordReferences[recordReference]); record = this.user().records()[selectedRecordReferences[recordReference]]; //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - record: " + record); records.push(record); } //MochiKit.Logging.logDebug("### MainPanel.removeSelectedRecord - records.length: " + records.length); deferred = new MochiKit.Async.Deferred(); //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 1:"); //deferred.addBoth(function(res) {MochiKit.Logging.logDebug("MainPanel.removeSelectedRecord - 1: " + res); return res;}); //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 2:"); deferred.addCallback(function() { var deferredResult; deferredResult = new MochiKit.Async.Deferred(); Clipperz.PM.Components.MessageBox().deferredShow({ title:Clipperz.PM.Strings['mainPanelDeletingRecordPanelConfirmationTitle'], text:Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmationText'], width:240, showProgressBar:false, showCloseButton:false, buttons:{ 'yes':Clipperz.PM.Strings['mainPanelDeleteRecordPanelConfirmButtonLabel'], 'no':Clipperz.PM.Strings['mainPanelDeleteRecordPanelDenyButtonLabel'] }, fn:MochiKit.Base.partial(function(aDeferred, aResult) { if (aResult == 'yes') { aDeferred.callback(aResult); } else { aDeferred.errback(aResult); } }, deferredResult) }, 'recordListRemoveRecordButton'); return deferredResult; }); //MochiKit.Logging.logDebug("--- MainPanel.removeSelectedRecord - 3:"); |