summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
index 978a54e..bfa4658 100644
--- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/FieldComponent.js
@@ -1,186 +1,184 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } 27if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
30 28
31//############################################################################# 29//#############################################################################
32 30
33Clipperz.PM.Components.RecordDetail.FieldComponent = function(anElement, args) { 31Clipperz.PM.Components.RecordDetail.FieldComponent = function(anElement, args) {
34//MochiKit.Logging.logDebug(">>> new FieldComponent"); 32//MochiKit.Logging.logDebug(">>> new FieldComponent");
35 args = args || {}; 33 args = args || {};
36 34
37 Clipperz.PM.Components.RecordDetail.FieldComponent.superclass.constructor.call(this, anElement, args); 35 Clipperz.PM.Components.RecordDetail.FieldComponent.superclass.constructor.call(this, anElement, args);
38 36
39 this._element = anElement; 37 this._element = anElement;
40 this._recordField = args.recordField || null; 38 this._recordField = args.recordField || null;
41 39
42 this._buttonComponent = null; 40 this._buttonComponent = null;
43 this._labelComponent = null; 41 this._labelComponent = null;
44 this._dragHandler = null; 42 this._dragHandler = null;
45 this._valueComponent = null; 43 this._valueComponent = null;
46 this._typeComponent = null; 44 this._typeComponent = null;
47 45
48 this.mainComponent().addEditComponent(this); 46 this.mainComponent().addEditComponent(this);
49 47
50 this.render(); 48 this.render();
51 49
52 return this; 50 return this;
53} 51}
54 52
55//============================================================================= 53//=============================================================================
56 54
57YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { 55YAHOO.extendX(Clipperz.PM.Components.RecordDetail.FieldComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
58 56
59 'toString': function() { 57 'toString': function() {
60 return "Clipperz.PM.Components.RecordDetail.FieldComponent component"; 58 return "Clipperz.PM.Components.RecordDetail.FieldComponent component";
61 }, 59 },
62 60
63 //------------------------------------------------------------------------- 61 //-------------------------------------------------------------------------
64 62
65 'recordField': function() { 63 'recordField': function() {
66 return this._recordField; 64 return this._recordField;
67 }, 65 },
68 66
69 //------------------------------------------------------------------------- 67 //-------------------------------------------------------------------------
70 68
71 'buttonComponent': function() { 69 'buttonComponent': function() {
72 return this._buttonComponent; 70 return this._buttonComponent;
73 }, 71 },
74 72
75 'setButtonComponent': function(aValue) { 73 'setButtonComponent': function(aValue) {
76 this._buttonComponent = aValue; 74 this._buttonComponent = aValue;
77 }, 75 },
78 76
79 //------------------------------------------------------------------------- 77 //-------------------------------------------------------------------------
80 78
81 'labelComponent': function() { 79 'labelComponent': function() {
82 return this._labelComponent; 80 return this._labelComponent;
83 }, 81 },
84 82
85 'setLabelComponent': function(aValue) { 83 'setLabelComponent': function(aValue) {
86 this._labelComponent = aValue; 84 this._labelComponent = aValue;
87 }, 85 },
88 86
89 //------------------------------------------------------------------------- 87 //-------------------------------------------------------------------------
90 88
91 'dragHandler': function() { 89 'dragHandler': function() {
92 return this._dragHandler; 90 return this._dragHandler;
93 }, 91 },
94 92
95 'setDragHandler': function(aValue) { 93 'setDragHandler': function(aValue) {
96 this._dragHandler = aValue; 94 this._dragHandler = aValue;
97 }, 95 },
98 96
99 //------------------------------------------------------------------------- 97 //-------------------------------------------------------------------------
100 98
101 'valueComponent': function() { 99 'valueComponent': function() {
102 return this._valueComponent; 100 return this._valueComponent;
103 }, 101 },
104 102
105 'setValueComponent': function(aValue) { 103 'setValueComponent': function(aValue) {
106 this._valueComponent = aValue; 104 this._valueComponent = aValue;
107 }, 105 },
108 106
109 //------------------------------------------------------------------------- 107 //-------------------------------------------------------------------------
110 108
111 'typeComponent': function() { 109 'typeComponent': function() {
112 return this._typeComponent; 110 return this._typeComponent;
113 }, 111 },
114 112
115 'setTypeComponent': function(aValue) { 113 'setTypeComponent': function(aValue) {
116 this._typeComponent = aValue; 114 this._typeComponent = aValue;
117 }, 115 },
118 116
119 //------------------------------------------------------------------------- 117 //-------------------------------------------------------------------------
120 118
121 'render': function() { 119 'render': function() {
122//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.render"); 120//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.render");
123 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'32',*/ height:'24', cls:'removeFieldButton', align:'left', valign:'top', id:this.getId('button')}); 121 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'32',*/ height:'24', cls:'removeFieldButton', align:'left', valign:'top', id:this.getId('button')});
124 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'25%',*/ valign:'top', id:this.getId('label')}); 122 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'25%',*/ valign:'top', id:this.getId('label')});
125 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'3',*/ valign:'top', id:this.getId('dragHandler')}); 123 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'3',*/ valign:'top', id:this.getId('dragHandler')});
126 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'50%',*/ valign:'top', children:[ 124 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'50%',*/ valign:'top', children:[
127 {tag:'div', cls:'Clipperz_recordFieldData', id:this.getId('value')} 125 {tag:'div', cls:'Clipperz_recordFieldData', id:this.getId('value')}
128 ]}); 126 ]});
129 127
130 128
131 this.setButtonComponent(new Clipperz.PM.Components.RecordDetail.FieldButtonComponent(this.getElement('button'), {fieldComponent:this})); 129 this.setButtonComponent(new Clipperz.PM.Components.RecordDetail.FieldButtonComponent(this.getElement('button'), {fieldComponent:this}));
132 this.setLabelComponent(new Clipperz.PM.Components.RecordDetail.FieldLabelComponent(this.getElement('label'), {fieldComponent:this})); 130 this.setLabelComponent(new Clipperz.PM.Components.RecordDetail.FieldLabelComponent(this.getElement('label'), {fieldComponent:this}));
133 this.setDragHandler(new Clipperz.PM.Components.RecordDetail.FieldDragHandler(this.getElement('dragHandler'), {fieldComponent:this})); 131 this.setDragHandler(new Clipperz.PM.Components.RecordDetail.FieldDragHandler(this.getElement('dragHandler'), {fieldComponent:this}));
134 this.setValueComponent(new Clipperz.PM.Components.RecordDetail.FieldValueComponent(this.getElement('value'), {fieldComponent:this})); 132 this.setValueComponent(new Clipperz.PM.Components.RecordDetail.FieldValueComponent(this.getElement('value'), {fieldComponent:this}));
135 133
136 if (this.editMode() == 'EDIT') { 134 if (this.editMode() == 'EDIT') {
137 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'60',*/ align:'left', cls:'fieldTypeTD', valign:'top', id:this.getId('type')}); 135 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td',/* width:'60',*/ align:'left', cls:'fieldTypeTD', valign:'top', id:this.getId('type')});
138 this.setTypeComponent(new Clipperz.PM.Components.RecordDetail.FieldTypeComponent(this.getElement('type'), {fieldComponent:this})); 136 this.setTypeComponent(new Clipperz.PM.Components.RecordDetail.FieldTypeComponent(this.getElement('type'), {fieldComponent:this}));
139 } 137 }
140 138
141 this.update(); 139 this.update();
142//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.render"); 140//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.render");
143 }, 141 },
144 142
145 //------------------------------------------------------------------------- 143 //-------------------------------------------------------------------------
146 144
147 'handleButtonClick': function() { 145 'handleButtonClick': function() {
148 this.mainComponent().record().removeField(this.recordField()); 146 this.mainComponent().record().removeField(this.recordField());
149 147
150 // if (this.recordField() == null) { 148 // if (this.recordField() == null) {
151 // this.mainComponent().record().addNewField(); 149 // this.mainComponent().record().addNewField();
152 // } else { 150 // } else {
153 // this.mainComponent().record().removeField(this.recordField()); 151 // this.mainComponent().record().removeField(this.recordField());
154 // } 152 // }
155 }, 153 },
156 154
157 //------------------------------------------------------------------------- 155 //-------------------------------------------------------------------------
158 156
159 'update': function(anEvent) { 157 'update': function(anEvent) {
160//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.update"); 158//MochiKit.Logging.logDebug(">>> RecordDetail.FieldComponent.update");
161 this.buttonComponent().update(); 159 this.buttonComponent().update();
162 this.labelComponent().update(); 160 this.labelComponent().update();
163 this.dragHandler().update(); 161 this.dragHandler().update();
164 this.valueComponent().update(); 162 this.valueComponent().update();
165 if (this.editMode() == 'EDIT') { 163 if (this.editMode() == 'EDIT') {
166 this.typeComponent().update(); 164 this.typeComponent().update();
167 } 165 }
168//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.update"); 166//MochiKit.Logging.logDebug("<<< RecordDetail.FieldComponent.update");
169 }, 167 },
170 168
171 //------------------------------------------------------------------------- 169 //-------------------------------------------------------------------------
172 170
173 'synchronizeComponentValues': function() { 171 'synchronizeComponentValues': function() {
174//MochiKit.Logging.logDebug(">>> FieldComponent.synchronizeComponentValues"); 172//MochiKit.Logging.logDebug(">>> FieldComponent.synchronizeComponentValues");
175 this.labelComponent().synchronizeComponentValues(); 173 this.labelComponent().synchronizeComponentValues();
176 this.valueComponent().synchronizeComponentValues(); 174 this.valueComponent().synchronizeComponentValues();
177 if (this.editMode() == 'EDIT') { 175 if (this.editMode() == 'EDIT') {
178 this.typeComponent().synchronizeComponentValues(); 176 this.typeComponent().synchronizeComponentValues();
179 } 177 }
180//MochiKit.Logging.logDebug("<<< FieldComponent.synchronizeComponentValues"); 178//MochiKit.Logging.logDebug("<<< FieldComponent.synchronizeComponentValues");
181 }, 179 },
182 180
183 //------------------------------------------------------------------------- 181 //-------------------------------------------------------------------------
184 __syntaxFix__: "syntax fix" 182 __syntaxFix__: "syntax fix"
185}); 183});
186 184