Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js new file mode 100644 index 0000000..52e718c --- a/dev/null +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/TitleComponent.js | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
31 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | ||
32 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } | ||
33 | |||
34 | //############################################################################# | ||
35 | |||
36 | Clipperz.PM.Components.RecordDetail.TitleComponent = function(anElement, args) { | ||
37 | args = args || {}; | ||
38 | |||
39 | Clipperz.PM.Components.RecordDetail.TitleComponent.superclass.constructor.call(this, anElement, args); | ||
40 | |||
41 | //this._inputElement = null; | ||
42 | |||
43 | this.mainComponent().addEditComponent(this); | ||
44 | |||
45 | this.render(); | ||
46 | |||
47 | return this; | ||
48 | } | ||
49 | |||
50 | //============================================================================= | ||
51 | |||
52 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.TitleComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { | ||
53 | |||
54 | 'toString': function() { | ||
55 | return "Clipperz.PM.Components.RecordDetail.TitleComponent component"; | ||
56 | }, | ||
57 | |||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'value': function() { | ||
61 | return this.record().label(); | ||
62 | }, | ||
63 | |||
64 | 'setValue': function(aValue) { | ||
65 | this.record().setLabel(aValue); | ||
66 | }, | ||
67 | |||
68 | //------------------------------------------------------------------------- | ||
69 | /* | ||
70 | 'inputElement': function() { | ||
71 | return this._inputElement; | ||
72 | }, | ||
73 | |||
74 | 'setInputElement': function(aValue) { | ||
75 | this._inputElement = aValue; | ||
76 | }, | ||
77 | */ | ||
78 | //------------------------------------------------------------------------- | ||
79 | |||
80 | 'render': function() { | ||
81 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', html:' '}); | ||
82 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:"3", html:' ', children:[ | ||
83 | // {tag:'div', /*style:'border: 1px solid green;',*/ id:this.getId('title')} | ||
84 | // ]}); | ||
85 | // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', html:' '}); | ||
86 | // | ||
87 | // this.setInputElement(new Clipperz.PM.Components.TextFormField(this.getElement('title'), {editMode:this.editMode(), value:this.value()})); | ||
88 | |||
89 | this.update(); | ||
90 | }, | ||
91 | |||
92 | //------------------------------------------------------------------------- | ||
93 | /* | ||
94 | 'update': function() { | ||
95 | this.inputElement().update({value:this.value(), editMode:this.editMode()}); | ||
96 | }, | ||
97 | */ | ||
98 | //------------------------------------------------------------------------- | ||
99 | |||
100 | 'updateViewMode': function() { | ||
101 | this.element().update(""); | ||
102 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'h2', html:this.value()}); | ||
103 | }, | ||
104 | |||
105 | //------------------------------------------------------------------------- | ||
106 | |||
107 | 'updateEditMode': function() { | ||
108 | //MochiKit.Logging.logDebug(">>> TitleComponent.updateEditMode"); | ||
109 | // this.getElement('title').update(""); | ||
110 | // Clipperz.YUI.DomHelper.append(this.getDom('title'), {tag:'div', id:this.getId('title_input')}); | ||
111 | // this.setInputElement(Clipperz.YUI.DomHelper.append(this.getDom('title_input'), {tag:'input', type:'text', value:this.value()}, true)); | ||
112 | |||
113 | this.element().update(""); | ||
114 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'input', id:this.getId('titleField'), type:'text', value:"this.value()"}); | ||
115 | this.getElement('titleField').dom.value = this.value(); | ||
116 | |||
117 | //MochiKit.Logging.logDebug("<<< TitleComponent.updateEditMode"); | ||
118 | }, | ||
119 | |||
120 | //------------------------------------------------------------------------- | ||
121 | |||
122 | 'synchronizeComponentValues': function() { | ||
123 | var inputElement; | ||
124 | |||
125 | //MochiKit.Logging.logDebug(">>> TitleComponent.synchronizeComponentValues"); | ||
126 | inputElement = this.element().getChildrenByTagName('input')[0]; | ||
127 | |||
128 | if (inputElement != null) { | ||
129 | this.setValue(inputElement.dom.value); | ||
130 | } | ||
131 | //MochiKit.Logging.logDebug("<<< TitleComponent.synchronizeComponentValues"); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | __syntaxFix__: "syntax fix" | ||
136 | }); | ||
137 | |||