Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Import/CSVImport') (more/less context) (show whitespace changes)
5 files changed, 30 insertions, 45 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js index 18b36da..3f4952d 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js +++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportColumns.js @@ -1,174 +1,171 @@ /* 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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } //############################################################################# Clipperz.PM.Components.Import.CSVImport.CSVImportColumns = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Import.CSVImport.CSVImportColumns.superclass.constructor.call(this, anElement, args); this._mainComponent = args.mainComponent; return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportColumns, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.Import.CSVImport.CSVImportColumns component"; }, //------------------------------------------------------------------------- 'mainComponent': function() { return this._mainComponent; }, //------------------------------------------------------------------------- 'render': function() { var i,c; var columnSelectorCheckboxCells; var checkboxes; var data; //MochiKit.Logging.logDebug(">>> CSVImportColumns.render"); Clipperz.NotificationCenter.unregister(this); MochiKit.Signal.disconnectAllTo(this); this.element().update(""); data = this.mainComponent().parsedValues(); columnSelectorCheckboxCells = []; c = data[0].length; for (i=0; i<c; i++) { columnSelectorCheckboxCells.push({tag:'th', valign:'top', cls:(this.mainComponent().isColumnSelected(i) ? 'selectedColumn': 'skippedColumn'), children:[ {tag:'input', type:'checkbox', id:this.getId('columnCheckbox_' + i), value:i} ]}) } this.domHelper().append(this.element(), {tag:'div', children:[ {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Columns']}, {tag:'div', id:this.getId('dataDiv'), cls:'csvImportPreview', children:[ {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview columns', cellspacing:'0', children:[ {tag:'thead', id:this.getId('previewData_thead'), children:[ {tag:'tr', children:columnSelectorCheckboxCells} ]}, {tag:'tbody', id:this.getId('previewData_tbody'), children:[]} ]} ]} ]}); c = data[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { this.getDom('columnCheckbox_' + i).checked = true; } } this.renderData(this.getElement('previewData_tbody'), data); checkboxes = MochiKit.DOM.getElementsByTagAndClassName('input', null, this.getDom('previewData_thead')); c = checkboxes.length; for (i=0; i<c; i++) { MochiKit.Signal.connect(checkboxes[i], 'onclick', this, 'renderDataHandler'); } //MochiKit.Logging.logDebug("<<< CSVImportColumns.render"); }, //------------------------------------------------------------------------- 'renderData': function(anElement, someData) { var config; var i,c; //MochiKit.Logging.logDebug(">>> CSVImportColumns.renderData"); // anElement.update(""); MochiKit.DOM.replaceChildNodes(anElement.dom); config = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) { var result; var i,c; result = {tag:'tr', children:[]}; c = aRowData.length; for (i=0; i<c; i++) { var field; field = aRowData[i]; result.children.push({tag:'td', valign:'top', cls:(this.mainComponent().isColumnSelected(i) ? 'selectedColumn': 'skippedColumn'), html:(MochiKit.Base.isNotEmpty(field) ? field.replace(/\n/g, '<br>') : ' ')}); } return result; }, this), someData); MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config); Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada')); //MochiKit.Logging.logDebug("<<< CSVImportColumns.renderData"); }, //------------------------------------------------------------------------- 'renderDataHandler': function(anEvent) { var thElement; thElement = YAHOO.ext.Element.get(anEvent.src().parentNode); if (anEvent.src().checked == true) { this.mainComponent().skippedColumns().remove(anEvent.src().value); thElement.addClass('selectedColumn'); thElement.removeClass('skippedColumn'); } else { this.mainComponent().skippedColumns().add(anEvent.src().value); thElement.removeClass('selectedColumn'); thElement.addClass('skippedColumn'); } if (this.mainComponent().skippedColumns().allItems().length == this.mainComponent().parsedValues()[0].length) { this.mainComponent().nextButton().disable(); } else { this.mainComponent().nextButton().enable(); } this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js index a368747..f7dbd5d 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js +++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportFields.js @@ -1,247 +1,244 @@ /* 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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } //############################################################################# Clipperz.PM.Components.Import.CSVImport.CSVImportFields = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Import.CSVImport.CSVImportFields.superclass.constructor.call(this, anElement, args); this._mainComponent = args.mainComponent; return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportFields, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.Import.CSVImport.CSVImportFields component"; }, //------------------------------------------------------------------------- 'mainComponent': function() { return this._mainComponent; }, //------------------------------------------------------------------------- 'render': function() { var fieldsHeaderCells; var titleColumnIndex; var notesColumnIndex; var i,c; Clipperz.NotificationCenter.unregister(this); MochiKit.Signal.disconnectAllTo(this); this.element().update(""); titleColumnIndex = this.mainComponent().titleColumnIndex() notesColumnIndex = this.mainComponent().notesColumnIndex() fieldsHeaderCells = []; fieldsHeaderCells.push({tag:'td', valign:'top', cls:'title', html:this.mainComponent().labelForColumn(titleColumnIndex)}); c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) { var trimmedLabel; trimmedLabel = Clipperz.Base.trim(this.mainComponent().labelForColumn(i)); fieldsHeaderCells.push({tag:'td', valign:'top', id:this.getId('fieldHeaderTD_' + i), cls:((trimmedLabel == "") ? 'missingLabelWarning' : (this.isColumnSetup(i) ? 'configuredColumn': 'unconfiguredColumn')), children:[ {tag:'span', html:((trimmedLabel == "") ? Clipperz.PM.Strings['CSV_ImportWizard_Fields_MissingLabelWarning'] : trimmedLabel)/*, cls:((trimmedLabel == "") ? 'missingLabelWarning' : '')*/}, {tag:'select', id:this.getId('select_' + i), name:i, children:[ {tag:'option', value:'UNDEFINED', html:"select data type", cls:'disabledOption'}, {tag:'option', value:'TXT', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['TXT']['shortDescription']}, {tag:'option', value:'PWD', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['PWD']['shortDescription']}, {tag:'option', value:'URL', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['URL']['shortDescription']}, {tag:'option', value:'DATE', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['DATE']['shortDescription']}, {tag:'option', value:'ADDR', htmlString:Clipperz.PM.Strings['recordFieldTypologies']['ADDR']['shortDescription']} ]} ]}) } } if (notesColumnIndex != -1) { fieldsHeaderCells.push({tag:'td', valign:'top', cls:'notes', html:this.mainComponent().labelForColumn(notesColumnIndex)}); } this.domHelper().append(this.element(), {tag:'div', children:[ {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Fields']}, {tag:'div', id:this.getId('dataDiv'), children:[ {tag:'div', children:[ ]}, {tag:'div', cls:'csvImportPreview', children:[ {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[ {tag:'thead', id:this.getId('previewData_thead'), children:[ {tag:'tr', cls:'CSV_previewData_header', children:fieldsHeaderCells} ]}, {tag:'tbody', id:this.getId('previewData_tbody'), children:[]} ]} ]} ]} ]}); for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) { Clipperz.DOM.selectOptionMatchingValue(this.getDom('select_' + i), this.mainComponent().typeForColumn(i)); MochiKit.Signal.connect(this.getDom('select_' + i), 'onchange', this, 'renderDataRowsHandler'); } } this.renderDataRows(this.getElement('previewData_tbody')); // Clipperz.NotificationCenter.register(null, 'updatedCSVImportColumnHeader', this, 'renderDataRowsHandler'); }, //------------------------------------------------------------------------- 'isColumnSetup': function(aColumnIndex) { return ((Clipperz.Base.trim(this.mainComponent().labelForColumn(aColumnIndex)) != "") && (this.mainComponent().typeForColumn(aColumnIndex) != 'UNDEFINED')); }, //------------------------------------------------------------------------- 'renderDataRowsHandler': function(anEvent) { var columnIndex; var tdElement; //MochiKit.Logging.logDebug(">>> renderDataRowsHandler") columnIndex = anEvent.src().name; this.mainComponent().setTypeForColumn(anEvent.src().value, columnIndex); tdElement = this.getElement('fieldHeaderTD_' + columnIndex); if (this.isColumnSetup(columnIndex)) { tdElement.removeClass('unconfiguredColumn'); tdElement.addClass('configuredColumn'); } else { tdElement.addClass('unconfiguredColumn'); tdElement.removeClass('configuredColumn'); } this.renderDataRows(this.getElement('previewData_tbody')); }, //------------------------------------------------------------------------- 'renderDataRows': function(anElement) { var titleColumnIndex; var notesColumnIndex; var data var i,c; //MochiKit.Logging.logDebug("#### >> renderDataRows"); // anElement.update(""); MochiKit.DOM.replaceChildNodes(anElement.dom); if (this.mainComponent().isFirstRowHeader()) { data = this.mainComponent().parsedValues().slice(1); } else { data = this.mainComponent().parsedValues(); } titleColumnIndex = this.mainComponent().titleColumnIndex(); notesColumnIndex = this.mainComponent().notesColumnIndex(); c = data.length; for (i=0; i<c; i++) { var rowData; var rowConfig; var ii, cc; rowData = data[i]; rowConfig = {tag:'tr', children:[ {tag:'td', valign:'top', cls:'title', html:(MochiKit.Base.isNotEmpty(rowData[titleColumnIndex]) ? rowData[titleColumnIndex].replace(/\n/g, '<br>') : ' ')} ]}; cc = rowData.length; for (ii=0; ii<cc; ii++) { // if ((ii != titleColumnIndex) && (ii != notesColumnIndex)) { if ((ii != titleColumnIndex) && (ii != notesColumnIndex) && (this.mainComponent().isColumnSelected(ii))) { rowConfig.children.push({ tag:'td', valign:'top', cls:(this.isColumnSetup(ii) ? 'configuredColumn' : 'unconfiguredColumn'), html:(MochiKit.Base.isNotEmpty(rowData[ii]) ? rowData[ii].replace(/\n/g, '<br>') : ' ') }); } } if (notesColumnIndex != -1) { rowConfig.children.push({tag:'td', valign:'top', cls:'notes', html:(MochiKit.Base.isNotEmpty(rowData[notesColumnIndex]) ? rowData[notesColumnIndex].replace(/\n/g, '<br>') : ' ')}); } this.domHelper().append(anElement, rowConfig); } Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada')); this.checkWetherToEnableNextButton(); //MochiKit.Logging.logDebug("#### << renderDataRows"); }, //------------------------------------------------------------------------- 'checkWetherToEnableNextButton': function() { var result; var titleColumnIndex; var notesColumnIndex; var i,c; titleColumnIndex = this.mainComponent().titleColumnIndex() notesColumnIndex = this.mainComponent().notesColumnIndex() result = true; c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (i != notesColumnIndex) && (this.mainComponent().isColumnSelected(i))) { result = result && this.isColumnSetup(i); } } if (result) { this.mainComponent().nextButton().enable(); } else { this.mainComponent().nextButton().disable(); } }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js index ebd243a..5cb8679 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js +++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js @@ -1,240 +1,237 @@ /* 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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } //############################################################################# Clipperz.PM.Components.Import.CSVImport.CSVImportHeader = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Import.CSVImport.CSVImportHeader.superclass.constructor.call(this, anElement, args); this._mainComponent = args.mainComponent; this._pendingDeferredLabelFieldHandlerEvents = 0; return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportHeader, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.Import.CSVImport.CSVImportHeader component"; }, //------------------------------------------------------------------------- 'mainComponent': function() { return this._mainComponent; }, //------------------------------------------------------------------------- 'render': function() { var thConfigs; var i,c; //MochiKit.Logging.logDebug(">>> CSVImportHeader.render"); Clipperz.NotificationCenter.unregister(this); MochiKit.Signal.disconnectAllTo(this); thConfigs = []; c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { // thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:this.mainComponent().labelForColumn(i)}]}); thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:""}]}); } } this.element().update(""); this.domHelper().append(this.element(), {tag:'div', children:[ {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header']}, {tag:'div', cls:'importStepParameters', children:[ {tag:'input', type:'checkbox', name:'isFistRowHeader', id:this.getId('isFirstRowHeader_checkbox')}, {tag:'span', id:this.getId('isFirstRowHeader_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header_Settings_firstRowHeaderLabel']} ]}, {tag:'div', id:this.getId('dataDiv'), children:[ {tag:'div', cls:'csvImportPreview', children:[ {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview header', cellspacing:'0', children:[ {tag:'thead', children:[{tag:'tr', children:thConfigs}]}, {tag:'tbody', id:this.getId('previewData_tbody')} ]} ]} ]} ]}); for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { this.getElement('headerTextField_' + i).dom.value = this.mainComponent().labelForColumn(i); } } this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); if (this.mainComponent().isFirstRowHeader()) { this.getDom('isFirstRowHeader_checkbox').click(); } c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onchange', MochiKit.Base.partial(MochiKit.Base.method(this, 'labelFieldHandler'), i)); MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onkeypress', MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandler'), i)); } } MochiKit.Signal.connect(this.getDom('isFirstRowHeader_checkbox'), 'onclick', this, 'toggleFirstRowHeaderCheckboxHandler'); if (Clipperz_IEisBroken != true) { MochiKit.Signal.connect(this.getDom('isFirstRowHeader_span'), 'onclick', this.getDom('isFirstRowHeader_checkbox'), 'click'); } //MochiKit.Logging.logDebug("<<< CSVImportHeader.render"); }, //------------------------------------------------------------------------- 'renderData': function(anElement, someData) { var trConfigs; var data; var i,c; // anElement.update(""); MochiKit.DOM.replaceChildNodes(anElement.dom); if (this.mainComponent().isFirstRowHeader()) { data = someData.slice(1); } else { data = someData; } trConfigs = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) { var result; var i,c; result = {tag:'tr', children:[]}; c = aRowData.length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { result.children.push({tag:'td', valign:'top', html:(MochiKit.Base.isNotEmpty(aRowData[i]) ? aRowData[i].replace(/\n/g, '<br>') : ' ')}); } } return result; }, this), data); MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, trConfigs); Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada')); }, //------------------------------------------------------------------------- 'toggleFirstRowHeaderCheckboxHandler': function() { var firstRowData; var i,c; //MochiKit.Logging.logDebug(">>> toggleFirstRowHeaderCheckboxHandler"); this.mainComponent().setIsFirstRowHeader(this.getDom('isFirstRowHeader_checkbox').checked); firstRowData = this.mainComponent().parsedValues()[0]; c = firstRowData.length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { var label; if (this.mainComponent().isFirstRowHeader()) { label = firstRowData[i]; } else { label = null; } this.mainComponent().setLabelForColumn(label, i); } }; this.updateInputFieldValues(); this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); //MochiKit.Logging.logDebug("<<< toggleFirstRowHeaderCheckboxHandler"); }, //------------------------------------------------------------------------- 'updateInputFieldValues': function() { var i,c; //MochiKit.Logging.logDebug(">>> updateInputFieldValues"); c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { this.getDom('headerTextField_' + i).value = this.mainComponent().labelForColumn(i); } } //console.log('[1] fieldSettings', fieldSettings); //MochiKit.Logging.logDebug("<<< updateInputFieldValues"); }, //------------------------------------------------------------------------- 'labelFieldHandler': function(aColumnIndex, anEvent) { var inputField; //MochiKit.Logging.logDebug(">>> labelFieldHandler"); inputField = anEvent.src(); this.mainComponent().setLabelForColumn(inputField.value, aColumnIndex); //MochiKit.Logging.logDebug("##### [" + anEvent.src().id + "] -> label[" + aColumnIndex + "]: '" + inputField.value + "'"); //MochiKit.Logging.logDebug("<<< labelFieldHandler"); }, 'deferredLabelFieldHandler': function(aColumnIndex, anEvent) { //MochiKit.Logging.logDebug(">>> deferredLabelFieldHandler"); this._pendingDeferredLabelFieldHandlerEvents ++; MochiKit.Async.callLater(1, MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandlerCatcher'), aColumnIndex, anEvent)); //MochiKit.Logging.logDebug("<<< deferredLabelFieldHandler"); }, 'deferredLabelFieldHandlerCatcher': function(aColumnIndex, anEvent) { //MochiKit.Logging.logDebug(">>> deferredLabelFieldHandlerCatcher"); this._pendingDeferredLabelFieldHandlerEvents --; if (this._pendingDeferredLabelFieldHandlerEvents == 0) { this.labelFieldHandler(aColumnIndex, anEvent); } //MochiKit.Logging.logDebug("<<< deferredLabelFieldHandlerCatcher"); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js index a53c531..6344e06 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js +++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportNotes.js @@ -1,212 +1,209 @@ /* 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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } //############################################################################# Clipperz.PM.Components.Import.CSVImport.CSVImportNotes = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Import.CSVImport.CSVImportNotes.superclass.constructor.call(this, anElement, args); this._mainComponent = args.mainComponent; return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportNotes, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.Import.CSVImport.CSVImportNotes component"; }, //------------------------------------------------------------------------- 'mainComponent': function() { return this._mainComponent; }, //------------------------------------------------------------------------- 'render': function() { var notesSelectorCheckboxCells; var totalNumberOfColumns; var titleColumnIndex; var notesColumnIndex; var i,c; Clipperz.NotificationCenter.unregister(this); MochiKit.Signal.disconnectAllTo(this); this.element().update(""); titleColumnIndex = this.mainComponent().titleColumnIndex() notesColumnIndex = this.mainComponent().notesColumnIndex() totalNumberOfColumns = this.mainComponent().parsedValues()[0].length; notesSelectorCheckboxCells = [{tag:'th', cls:'title', html:this.mainComponent().labelForColumn(titleColumnIndex)}]; c = totalNumberOfColumns; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) { notesSelectorCheckboxCells.push({tag:'th', id:this.getId('th_' + i), valign:'top', children:[ {tag:'input', type:'radio', id:this.getId('radio_' + i), name:'CSVImportNotesColumn', value:i}, {tag:'span', cls:'clickableSpan', id:this.getId('columnLabel_' + i), html:this.mainComponent().labelForColumn(i)} ]}) } } this.domHelper().append(this.element(), {tag:'div', children:[ {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Notes']}, {tag:'div', id:this.getId('dataDiv'), children:[ {tag:'div', cls:'importStepParameters', children:[ {tag:'input', id:this.getId('doNotSetNotes_radio'), type:'radio', name:'CSVImportNotesColumn', value:-1}, {tag:'span', id:this.getId('doNotSetNotes_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Notes_Settings_noSelectionLabel']} ]}, {tag:'div', cls:'csvImportPreview', children:[ {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[ {tag:'thead', id:this.getId('previewData_thead'), children:[ {tag:'tr', children:notesSelectorCheckboxCells} ]}, {tag:'tbody', id:this.getId('previewData_tbody'), children:[]} ]} ]} ]} ]}); this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); if ((notesColumnIndex >= totalNumberOfColumns) || (notesColumnIndex == titleColumnIndex) || !(this.mainComponent().isColumnSelected(notesColumnIndex))) { this.mainComponent().setNotesColumnIndex(-1); notesColumnIndex = -1; } c = totalNumberOfColumns; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) { MochiKit.Signal.connect(this.getDom('radio_' + i), 'onclick', this, 'renderDataHandler'); if (Clipperz_IEisBroken != true) { MochiKit.Signal.connect(this.getDom('columnLabel_' + i), 'onclick', this.getDom('radio_' + i), 'click'); } } } MochiKit.Signal.connect(this.getDom('doNotSetNotes_radio'), 'onclick', this, 'renderDataHandler'); if (Clipperz_IEisBroken != true) { MochiKit.Signal.connect(this.getDom('doNotSetNotes_span'), 'onclick', this.getDom('doNotSetNotes_radio'), 'click'); } if (notesColumnIndex == -1) { this.getDom('doNotSetNotes_radio').click(); } else { this.getDom('radio_' + notesColumnIndex).click(); } }, //------------------------------------------------------------------------- 'renderData': function(anElement, someData) { var data; var config; var titleColumnIndex; var notesColumnIndex; var i,c; // anElement.update(""); MochiKit.DOM.replaceChildNodes(anElement.dom); titleColumnIndex = this.mainComponent().titleColumnIndex(); notesColumnIndex = this.mainComponent().notesColumnIndex(); if (this.mainComponent().isFirstRowHeader()) { data = someData.slice(1); } else { data = someData; } // config = [{tag:'tr', cls:'CSV_previewData_header', children:[{tag:'td', valign:'top', html:header[titleColumnIndex], cls:'title'}]}]; // c = header.length; // for (i=0; i<c; i++) { // if (i != titleColumnIndex) { // config[0].children.push({tag:'td', valign:'top', html:header[i], cls:((notesColumnIndex == i) ? 'notesColumn': '')}) // } // } config = MochiKit.Base.map(MochiKit.Base.bind(function(aTitleColumnIndex, aRowData) { var result; var i,c; result = {tag:'tr', children:[{tag:'td', valign:'top', cls:'title', html:(MochiKit.Base.isNotEmpty(aRowData[aTitleColumnIndex]) ? aRowData[aTitleColumnIndex].replace(/\n/g, '<br>') : ' ')}]}; c = aRowData.length; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) { result.children.push({tag:'td', valign:'top', cls:((notesColumnIndex == i) ? 'notesColumn': ''), html:(MochiKit.Base.isNotEmpty(aRowData[i]) ? aRowData[i].replace(/\n/g, '<br>') : ' ')}); } } return result; }, this, titleColumnIndex), data); MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config); Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada')); }, //------------------------------------------------------------------------- 'renderDataHandler': function(anEvent) { var titleColumnIndex; var i,c; this.mainComponent().setNotesColumnIndex(anEvent.src().value); titleColumnIndex = this.mainComponent().titleColumnIndex(); c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if ((i != titleColumnIndex) && (this.mainComponent().isColumnSelected(i))) { this.getElement('th_' + i).removeClass('notesColumn'); } } if (anEvent.src().value != -1) { this.getElement('th_' + anEvent.src().value).addClass('notesColumn'); } this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js index 9162867..aa57580 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js +++ b/frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportTitle.js @@ -1,189 +1,186 @@ /* 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.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } //############################################################################# Clipperz.PM.Components.Import.CSVImport.CSVImportTitle = function(anElement, args) { args = args || {}; Clipperz.PM.Components.Import.CSVImport.CSVImportTitle.superclass.constructor.call(this, anElement, args); this._mainComponent = args.mainComponent; return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportTitle, Clipperz.PM.Components.BaseComponent, { 'toString': function() { return "Clipperz.PM.Components.Import.CSVImport.CSVImportTitle component"; }, //------------------------------------------------------------------------- 'mainComponent': function() { return this._mainComponent; }, //------------------------------------------------------------------------- 'render': function() { var titleSelectorCheckboxCells; var titleColumnIndex; var i,c; Clipperz.NotificationCenter.unregister(this); MochiKit.Signal.disconnectAllTo(this); this.element().update(""); titleColumnIndex = this.mainComponent().titleColumnIndex() titleSelectorCheckboxCells = []; c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { titleSelectorCheckboxCells.push({tag:'th', valign:'top', id:this.getId('th_' + i), children:[ {tag:'input', type:'radio', id:this.getId('radio_' + i), name:'CSVImportTitleColumn', value:i}, {tag:'span', cls:'clickableSpan', id:this.getId('columnLabel_' + i), html:this.mainComponent().labelForColumn(i)} ]}) } } if (titleColumnIndex >= titleSelectorCheckboxCells.length) { this.mainComponent().setTitleColumnIndex(-1); } this.domHelper().append(this.element(), {tag:'div', children:[ {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Title']}, {tag:'div', id:this.getId('dataDiv'), cls:'csvImportPreview', children:[ {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview', cellspacing:'0', children:[ {tag:'thead', id:this.getId('previewData_thead'), children:[ {tag:'tr', children:titleSelectorCheckboxCells} ]}, {tag:'tbody', id:this.getId('previewData_tbody'), children:[]} ]} ]} ]}); this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { MochiKit.Signal.connect(this.getDom('radio_' + i), 'onclick', this, 'renderDataHandler'); if (Clipperz_IEisBroken != true) { MochiKit.Signal.connect(this.getDom('columnLabel_' + i), 'onclick', this.getDom('radio_' + i), 'click'); } } } if (titleColumnIndex != -1) { this.getDom('radio_' + titleColumnIndex).click(); } else { this.mainComponent().nextButton().disable(); } }, //------------------------------------------------------------------------- 'renderData': function(anElement, someData) { var data; var config; var titleColumnIndex; var i,c; // anElement.update(""); MochiKit.DOM.replaceChildNodes(anElement.dom); titleColumnIndex = this.mainComponent().titleColumnIndex() if (this.mainComponent().isFirstRowHeader()) { data = someData.slice(1); } else { data = someData; } config = MochiKit.Base.map(MochiKit.Base.bind(function(aRowData) { var result; var i,c; result = {tag:'tr', children:[]}; c = aRowData.length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { var field; field = aRowData[i]; result.children.push({tag:'td', valign:'top', cls:((titleColumnIndex == i) ? 'titleColumn': ''), html:(MochiKit.Base.isNotEmpty(field) ? field.replace(/\n/g, '<br>') : ' ')}); } } return result; }, this), data); MochiKit.Base.map(function(aRowConfig) {Clipperz.YUI.DomHelper.append(anElement, aRowConfig);}, config); Clipperz.Style.applyZebraStylesToTable(this.getId('previewDada')); }, //------------------------------------------------------------------------- 'renderDataHandler': function(anEvent) { var i,c; this.mainComponent().setTitleColumnIndex(anEvent.src().value); c = this.mainComponent().parsedValues()[0].length; for (i=0; i<c; i++) { if (this.mainComponent().isColumnSelected(i)) { this.getElement('th_' + i).removeClass('titleColumn'); } } this.getElement('th_' + anEvent.src().value).addClass('titleColumn'); if (anEvent.src().value != -1) { this.mainComponent().nextButton().enable(); } else { this.mainComponent().nextButton().disable(); } this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); |