Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js index 53bf9c5..d6a03d7 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/MainComponent.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 | Clipperz.PM.Components.RecordDetail.MainComponent = function(anElement, args) { | 33 | Clipperz.PM.Components.RecordDetail.MainComponent = function(anElement, args) { |
37 | args = args || {}; | 34 | args = args || {}; |
38 | 35 | ||
39 | Clipperz.PM.Components.RecordDetail.MainComponent.superclass.constructor.call(this, anElement, args); | 36 | Clipperz.PM.Components.RecordDetail.MainComponent.superclass.constructor.call(this, anElement, args); |
40 | 37 | ||
41 | //this._element = args.element; | 38 | //this._element = args.element; |
42 | this._user = args.user; | 39 | this._user = args.user; |
43 | this._editMode = args.editMode || 'VIEW'; //[ 'VIEW' | 'EDIT' ] | 40 | this._editMode = args.editMode || 'VIEW'; //[ 'VIEW' | 'EDIT' ] |
44 | this._mainPanel = args.mainPanel; | 41 | this._mainPanel = args.mainPanel; |
45 | 42 | ||
46 | this._record = null; | 43 | this._record = null; |
47 | this._editComponents = []; | 44 | this._editComponents = []; |
48 | this._addFieldButton = null; | 45 | this._addFieldButton = null; |
49 | 46 | ||
50 | this._enableSaveButton = true; | 47 | this._enableSaveButton = true; |
51 | this._shouldShowLoginInfo = (Clipperz.PM.Proxy.defaultProxy.isReadOnly() ? false : true); | 48 | this._shouldShowLoginInfo = (Clipperz.PM.Proxy.defaultProxy.isReadOnly() ? false : true); |
52 | 49 | ||
53 | //this._mainLayoutManager = null; | 50 | //this._mainLayoutManager = null; |
54 | //this._layoutRegion = null; | 51 | //this._layoutRegion = null; |
55 | 52 | ||
56 | Clipperz.NotificationCenter.register(null, 'loadingRecordData', this, 'render'); | 53 | Clipperz.NotificationCenter.register(null, 'loadingRecordData', this, 'render'); |
57 | Clipperz.NotificationCenter.register(null, 'decryptingRecordData', this, 'render'); | 54 | Clipperz.NotificationCenter.register(null, 'decryptingRecordData', this, 'render'); |
58 | Clipperz.NotificationCenter.register(null, 'loadingRecordVersionData', this, 'render'); | 55 | Clipperz.NotificationCenter.register(null, 'loadingRecordVersionData', this, 'render'); |
59 | Clipperz.NotificationCenter.register(null, 'decryptingRecordVersionData', this, 'render'); | 56 | Clipperz.NotificationCenter.register(null, 'decryptingRecordVersionData', this, 'render'); |
60 | Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render'); | 57 | Clipperz.NotificationCenter.register(null, 'setupDone', this, 'render'); |
61 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'render'); | 58 | Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'render'); |
62 | 59 | ||
63 | this.render(); | 60 | this.render(); |
64 | 61 | ||
65 | return this; | 62 | return this; |
66 | } | 63 | } |
67 | 64 | ||
68 | //============================================================================= | 65 | //============================================================================= |
69 | 66 | ||
70 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.MainComponent, Clipperz.PM.Components.BaseComponent, { | 67 | YAHOO.extendX(Clipperz.PM.Components.RecordDetail.MainComponent, Clipperz.PM.Components.BaseComponent, { |
71 | 68 | ||
72 | 'toString': function() { | 69 | 'toString': function() { |
73 | return "Clipperz.PM.Components.RecordDetail.MainComponent component"; | 70 | return "Clipperz.PM.Components.RecordDetail.MainComponent component"; |
74 | }, | 71 | }, |
75 | 72 | ||
76 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
77 | 74 | ||
78 | 'editMode': function() { | 75 | 'editMode': function() { |
79 | return this._editMode; | 76 | return this._editMode; |
80 | }, | 77 | }, |
81 | 78 | ||
82 | 'setEditMode': function(aValue, aButtonElement, shouldSkipComponentSynchronization) { | 79 | 'setEditMode': function(aValue, aButtonElement, shouldSkipComponentSynchronization) { |
83 | //MochiKit.Logging.logDebug(">>> MainComponent.setEditingMode"); | 80 | //MochiKit.Logging.logDebug(">>> MainComponent.setEditingMode"); |
84 | this.scrollToTop(); | 81 | this.scrollToTop(); |
85 | 82 | ||
86 | if (aValue == 'VIEW') { | 83 | if (aValue == 'VIEW') { |
87 | if (shouldSkipComponentSynchronization == true) { | 84 | if (shouldSkipComponentSynchronization == true) { |
88 | this.exitModalView(); | 85 | this.exitModalView(); |
89 | } else { | 86 | } else { |
90 | this.synchronizeComponentValues(); | 87 | this.synchronizeComponentValues(); |
91 | if (this.record().hasPendingChanges()) { | 88 | if (this.record().hasPendingChanges()) { |
92 | if (this.record().isBrandNew()) { | 89 | if (this.record().isBrandNew()) { |
93 | this.record().removeEmptyFields(); | 90 | this.record().removeEmptyFields(); |
94 | } | 91 | } |
95 | this.saveCurrentRecordChanges(aButtonElement); | 92 | this.saveCurrentRecordChanges(aButtonElement); |
96 | } else { | 93 | } else { |
97 | if (this.record().isBrandNew()) { | 94 | if (this.record().isBrandNew()) { |
98 | this.record().user().removeRecord(this.record()); | 95 | this.record().user().removeRecord(this.record()); |
99 | } | 96 | } |
100 | this.exitModalView(); | 97 | this.exitModalView(); |
101 | } | 98 | } |
102 | } | 99 | } |
103 | } else if (aValue == 'EDIT') { | 100 | } else if (aValue == 'EDIT') { |
104 | this.enterModalView(); | 101 | this.enterModalView(); |
105 | } else { | 102 | } else { |
106 | //???? | 103 | //???? |
107 | } | 104 | } |
108 | 105 | ||
109 | this._editMode = aValue; | 106 | this._editMode = aValue; |
110 | this.render(); | 107 | this.render(); |
111 | }, | 108 | }, |
112 | 109 | ||
113 | //------------------------------------------------------------------------- | 110 | //------------------------------------------------------------------------- |
114 | 111 | ||
115 | 'user': function() { | 112 | 'user': function() { |
116 | return this._user; | 113 | return this._user; |
117 | }, | 114 | }, |
118 | 115 | ||
119 | //------------------------------------------------------------------------- | 116 | //------------------------------------------------------------------------- |
120 | 117 | ||