Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/Printing/Record.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/Printing/Record.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js b/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js index 5f5c29f..170bd09 100644 --- a/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js +++ b/frontend/beta/js/Clipperz/PM/Components/Printing/Record.js | |||
@@ -1,92 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } | 26 | if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } |
29 | if (typeof(Clipperz.PM.Components.Printing) == 'undefined') { Clipperz.PM.Components.Printing = {}; } | 27 | if (typeof(Clipperz.PM.Components.Printing) == 'undefined') { Clipperz.PM.Components.Printing = {}; } |
30 | 28 | ||
31 | Clipperz.PM.Components.Printing.Record = function(args) { | 29 | Clipperz.PM.Components.Printing.Record = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | this._record = args['record']; | 32 | this._record = args['record']; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
38 | 36 | ||
39 | MochiKit.Base.update(Clipperz.PM.Components.Printing.Record.prototype, { | 37 | MochiKit.Base.update(Clipperz.PM.Components.Printing.Record.prototype, { |
40 | 38 | ||
41 | 'record': function() { | 39 | 'record': function() { |
42 | return this._record; | 40 | return this._record; |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'deferredDrawToWindow': function(aWindow) { | 45 | 'deferredDrawToWindow': function(aWindow) { |
48 | vardeferredResult; | 46 | vardeferredResult; |
49 | 47 | ||
50 | deferredResult = new MochiKit.Async.Deferred(); | 48 | deferredResult = new MochiKit.Async.Deferred(); |
51 | deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData')); | 49 | deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData')); |
52 | deferredResult.addCallback(MochiKit.Base.method(this, 'appendToWindow', aWindow)); | 50 | deferredResult.addCallback(MochiKit.Base.method(this, 'appendToWindow', aWindow)); |
53 | deferredResult.callback(); | 51 | deferredResult.callback(); |
54 | return deferredResult; | 52 | return deferredResult; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'appendToWindow': function(aWindow) { | 57 | 'appendToWindow': function(aWindow) { |
60 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { | 58 | MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { |
61 | var newBlock; | 59 | var newBlock; |
62 | var fields; | 60 | var fields; |
63 | 61 | ||
64 | fields = MochiKit.Base.concat( | 62 | fields = MochiKit.Base.concat( |
65 | MochiKit.Base.map(MochiKit.Base.bind(function(aField) { | 63 | MochiKit.Base.map(MochiKit.Base.bind(function(aField) { |
66 | var result; | 64 | var result; |
67 | var dt, dd; | 65 | var dt, dd; |
68 | var label, value; | 66 | var label, value; |
69 | 67 | ||
70 | label = aField.label(); | 68 | label = aField.label(); |
71 | value = aField.value(); | 69 | value = aField.value(); |
72 | dt = MochiKit.DOM.createDOM('DT', null, label); | 70 | dt = MochiKit.DOM.createDOM('DT', null, label); |
73 | dd = MochiKit.DOM.createDOM('DD', null, value) | 71 | dd = MochiKit.DOM.createDOM('DD', null, value) |
74 | result = [dt, dd]; | 72 | result = [dt, dd]; |
75 | 73 | ||
76 | return result | 74 | return result |
77 | }, this), MochiKit.Base.values(this.record().currentVersion().fields())) | 75 | }, this), MochiKit.Base.values(this.record().currentVersion().fields())) |
78 | ); | 76 | ); |
79 | 77 | ||
80 | newBlock = MochiKit.DOM.DIV({'class': 'recordBlock'}, | 78 | newBlock = MochiKit.DOM.DIV({'class': 'recordBlock'}, |
81 | MochiKit.DOM.H2(null, this.record().label()), | 79 | MochiKit.DOM.H2(null, this.record().label()), |
82 | MochiKit.DOM.DIV({'class': 'recordNotes'}, MochiKit.Base.map(MochiKit.Base.partial(MochiKit.DOM.P, null), this.record().notes().split("\n"))), | 80 | MochiKit.DOM.DIV({'class': 'recordNotes'}, MochiKit.Base.map(MochiKit.Base.partial(MochiKit.DOM.P, null), this.record().notes().split("\n"))), |
83 | MochiKit.DOM.createDOM('DL', null, fields) | 81 | MochiKit.DOM.createDOM('DL', null, fields) |
84 | ); | 82 | ); |
85 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, newBlock); | 83 | MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, newBlock); |
86 | 84 | ||
87 | }, this)); | 85 | }, this)); |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //------------------------------------------------------------------------- | 88 | //------------------------------------------------------------------------- |
91 | __syntaxFix__: "syntax fix" | 89 | __syntaxFix__: "syntax fix" |
92 | }); | 90 | }); |