Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/Import/CSVImport/CSVImportHeader.js | 15 |
1 files changed, 6 insertions, 9 deletions
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,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
32 | if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } | 29 | if (typeof(Clipperz.PM.Components.Import) == 'undefined') { Clipperz.PM.Components.Import = {}; } |
33 | if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } | 30 | if (typeof(Clipperz.PM.Components.Import.CSVImport) == 'undefined') { Clipperz.PM.Components.Import.CSVImport = {}; } |
34 | 31 | ||
35 | //############################################################################# | 32 | //############################################################################# |
36 | 33 | ||
37 | Clipperz.PM.Components.Import.CSVImport.CSVImportHeader = function(anElement, args) { | 34 | Clipperz.PM.Components.Import.CSVImport.CSVImportHeader = function(anElement, args) { |
38 | args = args || {}; | 35 | args = args || {}; |
39 | 36 | ||
40 | Clipperz.PM.Components.Import.CSVImport.CSVImportHeader.superclass.constructor.call(this, anElement, args); | 37 | Clipperz.PM.Components.Import.CSVImport.CSVImportHeader.superclass.constructor.call(this, anElement, args); |
41 | this._mainComponent = args.mainComponent; | 38 | this._mainComponent = args.mainComponent; |
42 | 39 | ||
43 | this._pendingDeferredLabelFieldHandlerEvents = 0; | 40 | this._pendingDeferredLabelFieldHandlerEvents = 0; |
44 | 41 | ||
45 | return this; | 42 | return this; |
46 | } | 43 | } |
47 | 44 | ||
48 | //============================================================================= | 45 | //============================================================================= |
49 | 46 | ||
50 | YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportHeader, Clipperz.PM.Components.BaseComponent, { | 47 | YAHOO.extendX(Clipperz.PM.Components.Import.CSVImport.CSVImportHeader, Clipperz.PM.Components.BaseComponent, { |
51 | 48 | ||
52 | 'toString': function() { | 49 | 'toString': function() { |
53 | return "Clipperz.PM.Components.Import.CSVImport.CSVImportHeader component"; | 50 | return "Clipperz.PM.Components.Import.CSVImport.CSVImportHeader component"; |
54 | }, | 51 | }, |
55 | 52 | ||
56 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
57 | 54 | ||
58 | 'mainComponent': function() { | 55 | 'mainComponent': function() { |
59 | return this._mainComponent; | 56 | return this._mainComponent; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //------------------------------------------------------------------------- | 59 | //------------------------------------------------------------------------- |
63 | 60 | ||
64 | 'render': function() { | 61 | 'render': function() { |
65 | var thConfigs; | 62 | var thConfigs; |
66 | var i,c; | 63 | var i,c; |
67 | 64 | ||
68 | //MochiKit.Logging.logDebug(">>> CSVImportHeader.render"); | 65 | //MochiKit.Logging.logDebug(">>> CSVImportHeader.render"); |
69 | Clipperz.NotificationCenter.unregister(this); | 66 | Clipperz.NotificationCenter.unregister(this); |
70 | MochiKit.Signal.disconnectAllTo(this); | 67 | MochiKit.Signal.disconnectAllTo(this); |
71 | 68 | ||
72 | thConfigs = []; | 69 | thConfigs = []; |
73 | c = this.mainComponent().parsedValues()[0].length; | 70 | c = this.mainComponent().parsedValues()[0].length; |
74 | for (i=0; i<c; i++) { | 71 | for (i=0; i<c; i++) { |
75 | if (this.mainComponent().isColumnSelected(i)) { | 72 | if (this.mainComponent().isColumnSelected(i)) { |
76 | // thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:this.mainComponent().labelForColumn(i)}]}); | 73 | // thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:this.mainComponent().labelForColumn(i)}]}); |
77 | thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:""}]}); | 74 | thConfigs.push({tag:'th', children:[{tag:'input', type:'text', id:this.getId('headerTextField_' + i), value:""}]}); |
78 | } | 75 | } |
79 | } | 76 | } |
80 | 77 | ||
81 | this.element().update(""); | 78 | this.element().update(""); |
82 | this.domHelper().append(this.element(), {tag:'div', children:[ | 79 | this.domHelper().append(this.element(), {tag:'div', children:[ |
83 | {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header']}, | 80 | {tag:'div', cls:'importStepDescription', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header']}, |
84 | {tag:'div', cls:'importStepParameters', children:[ | 81 | {tag:'div', cls:'importStepParameters', children:[ |
85 | {tag:'input', type:'checkbox', name:'isFistRowHeader', id:this.getId('isFirstRowHeader_checkbox')}, | 82 | {tag:'input', type:'checkbox', name:'isFistRowHeader', id:this.getId('isFirstRowHeader_checkbox')}, |
86 | {tag:'span', id:this.getId('isFirstRowHeader_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header_Settings_firstRowHeaderLabel']} | 83 | {tag:'span', id:this.getId('isFirstRowHeader_span'), cls:'clickableSpan', htmlString:Clipperz.PM.Strings['CSV_ImportWizard_Header_Settings_firstRowHeaderLabel']} |
87 | ]}, | 84 | ]}, |
88 | {tag:'div', id:this.getId('dataDiv'), children:[ | 85 | {tag:'div', id:this.getId('dataDiv'), children:[ |
89 | {tag:'div', cls:'csvImportPreview', children:[ | 86 | {tag:'div', cls:'csvImportPreview', children:[ |
90 | {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview header', cellspacing:'0', children:[ | 87 | {tag:'table', id:this.getId('previewDada'), cls:'csvImportPreview header', cellspacing:'0', children:[ |
91 | {tag:'thead', children:[{tag:'tr', children:thConfigs}]}, | 88 | {tag:'thead', children:[{tag:'tr', children:thConfigs}]}, |
92 | {tag:'tbody', id:this.getId('previewData_tbody')} | 89 | {tag:'tbody', id:this.getId('previewData_tbody')} |
93 | ]} | 90 | ]} |
94 | ]} | 91 | ]} |
95 | ]} | 92 | ]} |
96 | ]}); | 93 | ]}); |
97 | 94 | ||
98 | for (i=0; i<c; i++) { | 95 | for (i=0; i<c; i++) { |
99 | if (this.mainComponent().isColumnSelected(i)) { | 96 | if (this.mainComponent().isColumnSelected(i)) { |
100 | this.getElement('headerTextField_' + i).dom.value = this.mainComponent().labelForColumn(i); | 97 | this.getElement('headerTextField_' + i).dom.value = this.mainComponent().labelForColumn(i); |
101 | } | 98 | } |
102 | } | 99 | } |
103 | 100 | ||
104 | this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); | 101 | this.renderData(this.getElement('previewData_tbody'), this.mainComponent().parsedValues()); |
105 | 102 | ||
106 | if (this.mainComponent().isFirstRowHeader()) { | 103 | if (this.mainComponent().isFirstRowHeader()) { |
107 | this.getDom('isFirstRowHeader_checkbox').click(); | 104 | this.getDom('isFirstRowHeader_checkbox').click(); |
108 | } | 105 | } |
109 | 106 | ||
110 | c = this.mainComponent().parsedValues()[0].length; | 107 | c = this.mainComponent().parsedValues()[0].length; |
111 | for (i=0; i<c; i++) { | 108 | for (i=0; i<c; i++) { |
112 | if (this.mainComponent().isColumnSelected(i)) { | 109 | if (this.mainComponent().isColumnSelected(i)) { |
113 | MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onchange', MochiKit.Base.partial(MochiKit.Base.method(this, 'labelFieldHandler'), i)); | 110 | MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onchange', MochiKit.Base.partial(MochiKit.Base.method(this, 'labelFieldHandler'), i)); |
114 | MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onkeypress', MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandler'), i)); | 111 | MochiKit.Signal.connect(this.getDom('headerTextField_' + i), 'onkeypress', MochiKit.Base.partial(MochiKit.Base.method(this, 'deferredLabelFieldHandler'), i)); |
115 | } | 112 | } |
116 | } | 113 | } |
117 | 114 | ||
118 | MochiKit.Signal.connect(this.getDom('isFirstRowHeader_checkbox'), 'onclick', this, 'toggleFirstRowHeaderCheckboxHandler'); | 115 | MochiKit.Signal.connect(this.getDom('isFirstRowHeader_checkbox'), 'onclick', this, 'toggleFirstRowHeaderCheckboxHandler'); |
119 | if (Clipperz_IEisBroken != true) { | 116 | if (Clipperz_IEisBroken != true) { |
120 | MochiKit.Signal.connect(this.getDom('isFirstRowHeader_span'), 'onclick', this.getDom('isFirstRowHeader_checkbox'), 'click'); | 117 | MochiKit.Signal.connect(this.getDom('isFirstRowHeader_span'), 'onclick', this.getDom('isFirstRowHeader_checkbox'), 'click'); |