Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js index 6f454fc..2066543 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.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.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } | 29 | if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } |
33 | 30 | ||
34 | //############################################################################# | 31 | //############################################################################# |
35 | 32 | ||
36 | 33 | ||
37 | 34 | ||
38 | Clipperz.PM.Components.RecordDetail.NotesComponent = function(anElement, args) { | 35 | Clipperz.PM.Components.RecordDetail.NotesComponent = function(anElement, args) { |
39 | //MochiKit.Logging.logDebug(">>> new NotesComponent"); | 36 | //MochiKit.Logging.logDebug(">>> new NotesComponent"); |
40 | args = args || {}; | 37 | args = args || {}; |
41 | 38 | ||
42 | Clipperz.PM.Components.RecordDetail.NotesComponent.superclass.constructor.call(this, anElement, args); | 39 | Clipperz.PM.Components.RecordDetail.NotesComponent.superclass.constructor.call(this, anElement, args); |
43 | 40 | ||
44 | this.mainComponent().addEditComponent(this); | 41 | this.mainComponent().addEditComponent(this); |
45 | 42 | ||
46 | this._staticOffset = null; | 43 | this._staticOffset = null; |
47 | this._componentHeight = 50; | 44 | this._componentHeight = 50; |
48 | this._mouseMoveIdentifier = null; | 45 | this._mouseMoveIdentifier = null; |
49 | this._mouseUpIdentifier = null; | 46 | this._mouseUpIdentifier = null; |
50 | 47 | ||
51 | this.element().setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 48 | this.element().setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
52 | 49 | ||
53 | this.render(); | 50 | this.render(); |
54 | //MochiKit.Logging.logDebug("<<< new NotesComponent"); | 51 | //MochiKit.Logging.logDebug("<<< new NotesComponent"); |
55 | 52 | ||
56 | return this; | 53 | return this; |
57 | } | 54 | } |
58 | 55 | ||
59 | //============================================================================= | 56 | //============================================================================= |
60 | 57 | ||
61 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.NotesComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { | 58 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.NotesComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { |
62 | 59 | ||
63 | 'toString': function() { | 60 | 'toString': function() { |
64 | return "Clipperz.PM.Components.RecordDetail.NotesComponent component"; | 61 | return "Clipperz.PM.Components.RecordDetail.NotesComponent component"; |
65 | }, | 62 | }, |
66 | 63 | ||
67 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
68 | 65 | ||
69 | 'value': function() { | 66 | 'value': function() { |
70 | return this.record().notes(); | 67 | return this.record().notes(); |
71 | }, | 68 | }, |
72 | 69 | ||
73 | 'setValue': function(aValue) { | 70 | 'setValue': function(aValue) { |
74 | this.record().setNotes(aValue); | 71 | this.record().setNotes(aValue); |
75 | }, | 72 | }, |
76 | 73 | ||
77 | //------------------------------------------------------------------------- | 74 | //------------------------------------------------------------------------- |
78 | 75 | ||
79 | 'render': function() { | 76 | 'render': function() { |
80 | //MochiKit.Logging.logDebug(">>> NotesComponent.render"); | 77 | //MochiKit.Logging.logDebug(">>> NotesComponent.render"); |
81 | /* | 78 | /* |
82 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:'5', children:[ | 79 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:'5', children:[ |
83 | {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}, | 80 | {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}, |
84 | {tag:'div', cls:'noteFieldContent', id:this.getId('notes')} | 81 | {tag:'div', cls:'noteFieldContent', id:this.getId('notes')} |
85 | ]}); | 82 | ]}); |
86 | */ | 83 | */ |
87 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}); | 84 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}); |
88 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'noteFieldContent', id:this.getId('notes'), children:[ | 85 | Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'noteFieldContent', id:this.getId('notes'), children:[ |
89 | {tag:'div', id:this.getId('resizableDiv'), cls:'resizable-textarea', children:[ | 86 | {tag:'div', id:this.getId('resizableDiv'), cls:'resizable-textarea', children:[ |
90 | {tag:'div', id:this.getId('contentView'), cls:'viewMode', html:""}, | 87 | {tag:'div', id:this.getId('contentView'), cls:'viewMode', html:""}, |
91 | {tag:'div', id:this.getId('contentEdit'), children:[ | 88 | {tag:'div', id:this.getId('contentEdit'), children:[ |
92 | {tag:'span', children:[ | 89 | {tag:'span', children:[ |
93 | {tag:'textarea', id:this.getId('textarea'), html:""} | 90 | {tag:'textarea', id:this.getId('textarea'), html:""} |
94 | ]} | 91 | ]} |
95 | ]}, | 92 | ]}, |
96 | {tag:'div', id:this.getId('grippie'), cls:'grippie'} | 93 | {tag:'div', id:this.getId('grippie'), cls:'grippie'} |
97 | ]} | 94 | ]} |
98 | ]}); | 95 | ]}); |
99 | 96 | ||
100 | this.getElement('contentView').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 97 | this.getElement('contentView').setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
101 | this.getElement('contentEdit').setVisibilityMode(YAHOO.ext.Element.DISPLAY); | 98 | this.getElement('contentEdit').setVisibilityMode(YAHOO.ext.Element.DISPLAY); |
102 | 99 | ||
103 | MochiKit.Signal.connect(this.getId('grippie'), 'onmousedown', this, 'startResize'); | 100 | MochiKit.Signal.connect(this.getId('grippie'), 'onmousedown', this, 'startResize'); |
104 | 101 | ||
105 | this.update(); | 102 | this.update(); |
106 | //MochiKit.Logging.logDebug("<<< NotesComponent.render"); | 103 | //MochiKit.Logging.logDebug("<<< NotesComponent.render"); |
107 | }, | 104 | }, |
108 | 105 | ||
109 | //------------------------------------------------------------------------- | 106 | //------------------------------------------------------------------------- |
110 | 107 | ||
111 | 'updateViewMode': function() { | 108 | 'updateViewMode': function() { |
112 | //MochiKit.Logging.logDebug(">>> NotesComponent.updateViewMode"); | 109 | //MochiKit.Logging.logDebug(">>> NotesComponent.updateViewMode"); |
113 | // this.getElement('notes').update(this.value().replace(/\n/g, '<br>')); | 110 | // this.getElement('notes').update(this.value().replace(/\n/g, '<br>')); |
114 | 111 | ||
115 | this.getElement('contentView').update(Clipperz.Base.sanitizeString(this.value()).replace(/\n/g, '<br>')); | 112 | this.getElement('contentView').update(Clipperz.Base.sanitizeString(this.value()).replace(/\n/g, '<br>')); |
116 | 113 | ||
117 | if (this.isNoteEmpty()) { | 114 | if (this.isNoteEmpty()) { |
118 | this.element().hide(); | 115 | this.element().hide(); |
119 | } else { | 116 | } else { |
120 | this.getElement('contentView').show(); | 117 | this.getElement('contentView').show(); |