Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js index 0e4640e..a5a4697 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js | |||
@@ -7,163 +7,163 @@ For further information about its features and functionalities please | |||
7 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
8 | 8 | ||
9 | * Clipperz is free software: you can redistribute it and/or modify it | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
10 | under the terms of the GNU Affero General Public License as published | 10 | under the terms of the GNU Affero General Public License as published |
11 | by the Free Software Foundation, either version 3 of the License, or | 11 | by the Free Software Foundation, either version 3 of the License, or |
12 | (at your option) any later version. | 12 | (at your option) any later version. |
13 | 13 | ||
14 | * Clipperz is distributed in the hope that it will be useful, but | 14 | * Clipperz is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
18 | 18 | ||
19 | * 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 |
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
27 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } | 27 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } |
28 | 28 | ||
29 | //############################################################################# | 29 | //############################################################################# |
30 | 30 | ||
31 | Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) { | 31 | Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) { |
32 | //MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent"); | 32 | //MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent"); |
33 | args = args || {}; | 33 | args = args || {}; |
34 | 34 | ||
35 | Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args); | 35 | Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args); |
36 | 36 | ||
37 | this._directLoginBinding = args.directLoginBinding || null; | 37 | this._directLoginBinding = args.directLoginBinding || null; |
38 | this.render(); | 38 | this.render(); |
39 | 39 | ||
40 | Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode'); | 40 | Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode'); |
41 | Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode'); | 41 | Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode'); |
42 | Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode'); | 42 | Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode'); |
43 | //MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent"); | 43 | //MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent"); |
44 | 44 | ||
45 | return this; | 45 | return this; |
46 | } | 46 | } |
47 | 47 | ||
48 | //============================================================================= | 48 | //============================================================================= |
49 | 49 | ||
50 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { | 50 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { |
51 | 51 | ||
52 | 'toString': function() { | 52 | 'toString': function() { |
53 | return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component"; | 53 | return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component"; |
54 | }, | 54 | }, |
55 | 55 | ||
56 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
57 | 57 | ||
58 | 'directLoginBinding': function() { | 58 | 'directLoginBinding': function() { |
59 | return this._directLoginBinding; | 59 | return this._directLoginBinding; |
60 | }, | 60 | }, |
61 | 61 | ||
62 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
63 | 63 | ||
64 | 'render': function() { | 64 | 'render': function() { |
65 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()}) | 65 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()}) |
66 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()}) | 66 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()}) |
67 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render"); | 67 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render"); |
68 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[ | 68 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[ |
69 | {tag:'span', html:this.directLoginBinding().key()} | 69 | {tag:'span', html:this.directLoginBinding().key()} |
70 | ]}); | 70 | ]}); |
71 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1"); | 71 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1"); |
72 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[ | 72 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[ |
73 | {tag:'div', id:this.getId('editModeBox'), children:[ | 73 | {tag:'div', id:this.getId('editModeBox'), children:[ |
74 | {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()} | 74 | {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()} |
75 | ]}, | 75 | ]}, |
76 | {tag:'div', id:this.getId('viewModeBox'), children:[ | 76 | {tag:'div', id:this.getId('viewModeBox'), children:[ |
77 | {tag:'span', id:this.getId('viewValue'), html:""} | 77 | {tag:'span', id:this.getId('viewValue'), html:""} |
78 | ]} | 78 | ]} |
79 | ]}); | 79 | ]}); |
80 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2"); | 80 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2"); |
81 | this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 81 | this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
82 | this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 82 | this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
83 | 83 | ||
84 | this.update(); | 84 | this.update(); |
85 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render"); | 85 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render"); |
86 | }, | 86 | }, |
87 | 87 | ||
88 | //------------------------------------------------------------------------- | 88 | //------------------------------------------------------------------------- |
89 | 89 | ||
90 | 'recordFieldOptions': function() { | 90 | 'recordFieldOptions': function() { |
91 | varresult; | 91 | varresult; |
92 | var option; | 92 | var option; |
93 | varrecordFieldKey; | 93 | varrecordFieldKey; |
94 | varrecordFields; | 94 | varrecordFields; |
95 | 95 | ||
96 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions"); | 96 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions"); |
97 | recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields(); | 97 | recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields(); |
98 | result = []; | 98 | result = []; |
99 | option = {tag:'option', value:null, html:'---'}; | 99 | option = {tag:'option', value:null, html:'---'}; |
100 | result.push(option); | 100 | result.push(option); |
101 | for (recordFieldKey in recordFields) { | 101 | for (recordFieldKey in recordFields) { |
102 | //TODO: remove the value: field and replace it with element.dom.value = <some value> | 102 | //TODO: remove the value: field and replace it with element.dom.value = <some value> |
103 | option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()} | 103 | option = {tag:'option', value:recordFieldKey, html:Clipperz.Base.sanitizeString(recordFields[recordFieldKey].label())} |
104 | if (recordFieldKey == this.directLoginBinding().fieldKey()) { | 104 | if (recordFieldKey == this.directLoginBinding().fieldKey()) { |
105 | option['selected'] = true; | 105 | option['selected'] = true; |
106 | } | 106 | } |
107 | result.push(option); | 107 | result.push(option); |
108 | } | 108 | } |
109 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions"); | 109 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions"); |
110 | 110 | ||
111 | return result; | 111 | return result; |
112 | }, | 112 | }, |
113 | 113 | ||
114 | //------------------------------------------------------------------------- | 114 | //------------------------------------------------------------------------- |
115 | 115 | ||
116 | 'syncAndUpdateEditMode': function() { | 116 | 'syncAndUpdateEditMode': function() { |
117 | this.synchronizeComponentValues(); | 117 | this.synchronizeComponentValues(); |
118 | this.updateEditMode(); | 118 | this.updateEditMode(); |
119 | }, | 119 | }, |
120 | 120 | ||
121 | 'updateEditMode': function() { | 121 | 'updateEditMode': function() { |
122 | varselectElementBox; | 122 | varselectElementBox; |
123 | 123 | ||
124 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode"); | 124 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode"); |
125 | this.getElement('viewModeBox').hide(); | 125 | this.getElement('viewModeBox').hide(); |
126 | 126 | ||
127 | selectElementBox = this.getElement('editModeBox'); | 127 | selectElementBox = this.getElement('editModeBox'); |
128 | selectElementBox.update(""); | 128 | selectElementBox.update(""); |
129 | 129 | ||
130 | Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}); | 130 | Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}); |
131 | 131 | ||
132 | /* | 132 | /* |
133 | selectElement = this.getElement('select'); | 133 | selectElement = this.getElement('select'); |
134 | 134 | ||
135 | selectElement.update(""); | 135 | selectElement.update(""); |
136 | MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) { | 136 | MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) { |
137 | Clipperz.YUI.DomHelper.append(selectElement.dom, anOption); | 137 | Clipperz.YUI.DomHelper.append(selectElement.dom, anOption); |
138 | }); | 138 | }); |
139 | */ | 139 | */ |
140 | 140 | ||
141 | 141 | ||
142 | this.getElement('editModeBox').show(); | 142 | this.getElement('editModeBox').show(); |
143 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode"); | 143 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode"); |
144 | }, | 144 | }, |
145 | 145 | ||
146 | //------------------------------------------------------------------------- | 146 | //------------------------------------------------------------------------- |
147 | 147 | ||
148 | 'updateViewMode': function() { | 148 | 'updateViewMode': function() { |
149 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode"); | 149 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode"); |
150 | this.getElement('editModeBox').hide(); | 150 | this.getElement('editModeBox').hide(); |
151 | this.getElement('viewModeBox').show(); | 151 | this.getElement('viewModeBox').show(); |
152 | 152 | ||
153 | this.getElement('viewValue').update(this.directLoginBinding().field().label()); | 153 | this.getElement('viewValue').update(Clipperz.Base.sanitizeString(this.directLoginBinding().field().label())); |
154 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode"); | 154 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode"); |
155 | }, | 155 | }, |
156 | 156 | ||
157 | //------------------------------------------------------------------------- | 157 | //------------------------------------------------------------------------- |
158 | 158 | ||
159 | 'synchronizeComponentValues': function() { | 159 | 'synchronizeComponentValues': function() { |
160 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues") | 160 | //MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues") |
161 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select')); | 161 | //MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select')); |
162 | this.directLoginBinding().setFieldKey(this.getDom('select').value); | 162 | this.directLoginBinding().setFieldKey(this.getDom('select').value); |
163 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues"); | 163 | //MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues"); |
164 | }, | 164 | }, |
165 | 165 | ||
166 | //------------------------------------------------------------------------- | 166 | //------------------------------------------------------------------------- |
167 | __syntaxFix__: "syntax fix" | 167 | __syntaxFix__: "syntax fix" |
168 | }); | 168 | }); |
169 | 169 | ||