Diffstat (limited to 'frontend/beta/js/Clipperz/YUI') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/Collapser.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/DomHelper.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/DomQuery.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/Drawer.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/IBLayoutManager.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js | 15 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/MessageBox.js | 15 |
7 files changed, 42 insertions, 63 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/Collapser.js b/frontend/beta/js/Clipperz/YUI/Collapser.js index 5c0ac0f..b104877 100644 --- a/frontend/beta/js/Clipperz/YUI/Collapser.js +++ b/frontend/beta/js/Clipperz/YUI/Collapser.js | |||
@@ -1,73 +1,70 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
31 | 28 | ||
32 | //found on YUI-EXT forum (http://www.yui-ext.com/forum/viewtopic.php?t=683&highlight=accordion) | 29 | //found on YUI-EXT forum (http://www.yui-ext.com/forum/viewtopic.php?t=683&highlight=accordion) |
33 | Clipperz.YUI.Collapser = function(clickEl, collapseEl, initiallyCollapsed) { | 30 | Clipperz.YUI.Collapser = function(clickEl, collapseEl, initiallyCollapsed) { |
34 | this.clickEl = getEl(clickEl); | 31 | this.clickEl = getEl(clickEl); |
35 | this.collapseEl = getEl(collapseEl); | 32 | this.collapseEl = getEl(collapseEl); |
36 | this.clickEl.addClass('collapser-expanded'); | 33 | this.clickEl.addClass('collapser-expanded'); |
37 | if (initiallyCollapsed == true) { | 34 | if (initiallyCollapsed == true) { |
38 | this.afterCollapse(); | 35 | this.afterCollapse(); |
39 | } | 36 | } |
40 | this.clickEl.mon('click', function(){ | 37 | this.clickEl.mon('click', function(){ |
41 | this.collapsed === true ? this.expand() : this.collapse(); | 38 | this.collapsed === true ? this.expand() : this.collapse(); |
42 | }, this, true); | 39 | }, this, true); |
43 | }; | 40 | }; |
44 | 41 | ||
45 | Clipperz.YUI.Collapser.prototype = { | 42 | Clipperz.YUI.Collapser.prototype = { |
46 | 'collapse': function(){ | 43 | 'collapse': function(){ |
47 | this.collapseEl.clip(); | 44 | this.collapseEl.clip(); |
48 | this.collapseEl.setHeight(1, true, .35, this.afterCollapse.createDelegate(this), YAHOO.util.Easing.easeOut); | 45 | this.collapseEl.setHeight(1, true, .35, this.afterCollapse.createDelegate(this), YAHOO.util.Easing.easeOut); |
49 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); | 46 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); |
50 | }, | 47 | }, |
51 | 48 | ||
52 | 'afterCollapse': function(){ | 49 | 'afterCollapse': function(){ |
53 | this.collapsed = true; | 50 | this.collapsed = true; |
54 | this.collapseEl.setDisplayed(false); | 51 | this.collapseEl.setDisplayed(false); |
55 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); | 52 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); |
56 | }, | 53 | }, |
57 | 54 | ||
58 | 'expand': function(){ | 55 | 'expand': function(){ |
59 | this.collapseEl.setDisplayed(true); | 56 | this.collapseEl.setDisplayed(true); |
60 | this.collapseEl.autoHeight(true, .35, this.afterExpand.createDelegate(this), YAHOO.util.Easing.easeOut); | 57 | this.collapseEl.autoHeight(true, .35, this.afterExpand.createDelegate(this), YAHOO.util.Easing.easeOut); |
61 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); | 58 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); |
62 | }, | 59 | }, |
63 | 60 | ||
64 | 'afterExpand': function(){ | 61 | 'afterExpand': function(){ |
65 | this.collapsed = false; | 62 | this.collapsed = false; |
66 | this.collapseEl.unclip(); | 63 | this.collapseEl.unclip(); |
67 | this.collapseEl.setStyle('height', ''); | 64 | this.collapseEl.setStyle('height', ''); |
68 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); | 65 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); |
69 | }, | 66 | }, |
70 | 67 | ||
71 | //----------------------------------------------------- | 68 | //----------------------------------------------------- |
72 | __syntaxFix__: '__syntaxFix__' | 69 | __syntaxFix__: '__syntaxFix__' |
73 | }; | 70 | }; |
diff --git a/frontend/beta/js/Clipperz/YUI/DomHelper.js b/frontend/beta/js/Clipperz/YUI/DomHelper.js index 4f8acde..05edc49 100644 --- a/frontend/beta/js/Clipperz/YUI/DomHelper.js +++ b/frontend/beta/js/Clipperz/YUI/DomHelper.js | |||
@@ -1,408 +1,405 @@ | |||
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.ext) == 'undefined') { Clipperz.ext = {}; } | 27 | if (typeof(Clipperz.ext) == 'undefined') { Clipperz.ext = {}; } |
31 | 28 | ||
32 | /** | 29 | /** |
33 | * @class Clipperz.YUI.DomHelper | 30 | * @class Clipperz.YUI.DomHelper |
34 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. | 31 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. |
35 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. | 32 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. |
36 | * @singleton | 33 | * @singleton |
37 | */ | 34 | */ |
38 | Clipperz.YUI.DomHelper = new function(){ | 35 | Clipperz.YUI.DomHelper = new function(){ |
39 | /**@private*/ | 36 | /**@private*/ |
40 | var d = document; | 37 | var d = document; |
41 | var tempTableEl = null; | 38 | var tempTableEl = null; |
42 | /** True to force the use of DOM instead of html fragments @type Boolean */ | 39 | /** True to force the use of DOM instead of html fragments @type Boolean */ |
43 | this.useDom = false; | 40 | this.useDom = false; |
44 | var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i; | 41 | var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i; |
45 | /** | 42 | /** |
46 | * Applies a style specification to an element | 43 | * Applies a style specification to an element |
47 | * @param {String/HTMLElement} el The element to apply styles to | 44 | * @param {String/HTMLElement} el The element to apply styles to |
48 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or | 45 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or |
49 | * a function which returns such a specification. | 46 | * a function which returns such a specification. |
50 | */ | 47 | */ |
51 | this.applyStyles = function(el, styles){ | 48 | this.applyStyles = function(el, styles){ |
52 | if(styles){ | 49 | if(styles){ |
53 | var D = YAHOO.util.Dom; | 50 | var D = YAHOO.util.Dom; |
54 | if (typeof styles == "string"){ | 51 | if (typeof styles == "string"){ |
55 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; | 52 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; |
56 | var matches; | 53 | var matches; |
57 | while ((matches = re.exec(styles)) != null){ | 54 | while ((matches = re.exec(styles)) != null){ |
58 | D.setStyle(el, matches[1], matches[2]); | 55 | D.setStyle(el, matches[1], matches[2]); |
59 | } | 56 | } |
60 | }else if (typeof styles == "object"){ | 57 | }else if (typeof styles == "object"){ |
61 | for (var style in styles){ | 58 | for (var style in styles){ |
62 | D.setStyle(el, style, styles[style]); | 59 | D.setStyle(el, style, styles[style]); |
63 | } | 60 | } |
64 | }else if (typeof styles == "function"){ | 61 | }else if (typeof styles == "function"){ |
65 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); | 62 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); |
66 | } | 63 | } |
67 | } | 64 | } |
68 | }; | 65 | }; |
69 | 66 | ||
70 | // build as innerHTML where available | 67 | // build as innerHTML where available |
71 | /** @ignore */ | 68 | /** @ignore */ |
72 | var createHtml = function(o){ | 69 | var createHtml = function(o){ |
73 | var b = ''; | 70 | var b = ''; |
74 | 71 | ||
75 | if(typeof(o['html']) != 'undefined') { | 72 | if(typeof(o['html']) != 'undefined') { |
76 | o['html'] = Clipperz.Base.sanitizeString(o['html']); | 73 | o['html'] = Clipperz.Base.sanitizeString(o['html']); |
77 | } else if (typeof(o['htmlString']) != 'undefined') { | 74 | } else if (typeof(o['htmlString']) != 'undefined') { |
78 | o['html'] = o['htmlString']; | 75 | o['html'] = o['htmlString']; |
79 | delete o.htmlString; | 76 | delete o.htmlString; |
80 | } | 77 | } |
81 | 78 | ||
82 | b += '<' + o.tag; | 79 | b += '<' + o.tag; |
83 | for(var attr in o){ | 80 | for(var attr in o){ |
84 | if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue; | 81 | if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue; |
85 | if(attr == 'style'){ | 82 | if(attr == 'style'){ |
86 | var s = o['style']; | 83 | var s = o['style']; |
87 | if(typeof s == 'function'){ | 84 | if(typeof s == 'function'){ |
88 | s = s.call(); | 85 | s = s.call(); |
89 | } | 86 | } |
90 | if(typeof s == 'string'){ | 87 | if(typeof s == 'string'){ |
91 | b += ' style="' + s + '"'; | 88 | b += ' style="' + s + '"'; |
92 | }else if(typeof s == 'object'){ | 89 | }else if(typeof s == 'object'){ |
93 | b += ' style="'; | 90 | b += ' style="'; |
94 | for(var key in s){ | 91 | for(var key in s){ |
95 | if(typeof s[key] != 'function'){ | 92 | if(typeof s[key] != 'function'){ |
96 | b += key + ':' + s[key] + ';'; | 93 | b += key + ':' + s[key] + ';'; |
97 | } | 94 | } |
98 | } | 95 | } |
99 | b += '"'; | 96 | b += '"'; |
100 | } | 97 | } |
101 | }else{ | 98 | }else{ |
102 | if(attr == 'cls'){ | 99 | if(attr == 'cls'){ |
103 | b += ' class="' + o['cls'] + '"'; | 100 | b += ' class="' + o['cls'] + '"'; |
104 | }else if(attr == 'htmlFor'){ | 101 | }else if(attr == 'htmlFor'){ |
105 | b += ' for="' + o['htmlFor'] + '"'; | 102 | b += ' for="' + o['htmlFor'] + '"'; |
106 | }else{ | 103 | }else{ |
107 | b += ' ' + attr + '="' + o[attr] + '"'; | 104 | b += ' ' + attr + '="' + o[attr] + '"'; |
108 | } | 105 | } |
109 | } | 106 | } |
110 | } | 107 | } |
111 | if(emptyTags.test(o.tag)){ | 108 | if(emptyTags.test(o.tag)){ |
112 | b += ' />'; | 109 | b += ' />'; |
113 | }else{ | 110 | }else{ |
114 | b += '>'; | 111 | b += '>'; |
115 | if(o.children){ | 112 | if(o.children){ |
116 | for(var i = 0, len = o.children.length; i < len; i++) { | 113 | for(var i = 0, len = o.children.length; i < len; i++) { |
117 | b += createHtml(o.children[i], b); | 114 | b += createHtml(o.children[i], b); |
118 | } | 115 | } |
119 | } | 116 | } |
120 | if(o.html){ | 117 | if(o.html){ |
121 | b += o.html; | 118 | b += o.html; |
122 | } | 119 | } |
123 | b += '</' + o.tag + '>'; | 120 | b += '</' + o.tag + '>'; |
124 | } | 121 | } |
125 | return b; | 122 | return b; |
126 | } | 123 | } |
127 | 124 | ||
128 | // build as dom | 125 | // build as dom |
129 | /** @ignore */ | 126 | /** @ignore */ |
130 | var createDom = function(o, parentNode){ | 127 | var createDom = function(o, parentNode){ |
131 | var el = d.createElement(o.tag); | 128 | var el = d.createElement(o.tag); |
132 | var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute | 129 | var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute |
133 | for(var attr in o){ | 130 | for(var attr in o){ |
134 | if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue; | 131 | if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue; |
135 | if(attr=='cls'){ | 132 | if(attr=='cls'){ |
136 | el.className = o['cls']; | 133 | el.className = o['cls']; |
137 | }else{ | 134 | }else{ |
138 | if(useSet) el.setAttribute(attr, o[attr]); | 135 | if(useSet) el.setAttribute(attr, o[attr]); |
139 | else el[attr] = o[attr]; | 136 | else el[attr] = o[attr]; |
140 | } | 137 | } |
141 | } | 138 | } |
142 | Clipperz.YUI.DomHelper.applyStyles(el, o.style); | 139 | Clipperz.YUI.DomHelper.applyStyles(el, o.style); |
143 | if(o.children){ | 140 | if(o.children){ |
144 | for(var i = 0, len = o.children.length; i < len; i++) { | 141 | for(var i = 0, len = o.children.length; i < len; i++) { |
145 | createDom(o.children[i], el); | 142 | createDom(o.children[i], el); |
146 | } | 143 | } |
147 | } | 144 | } |
148 | if(o.html){ | 145 | if(o.html){ |
149 | el.innerHTML = o.html; | 146 | el.innerHTML = o.html; |
150 | } | 147 | } |
151 | if(parentNode){ | 148 | if(parentNode){ |
152 | parentNode.appendChild(el); | 149 | parentNode.appendChild(el); |
153 | } | 150 | } |
154 | return el; | 151 | return el; |
155 | }; | 152 | }; |
156 | 153 | ||
157 | /** | 154 | /** |
158 | * @ignore | 155 | * @ignore |
159 | * Nasty code for IE's broken table implementation | 156 | * Nasty code for IE's broken table implementation |
160 | */ | 157 | */ |
161 | var insertIntoTable = function(tag, where, el, html){ | 158 | var insertIntoTable = function(tag, where, el, html){ |
162 | if(!tempTableEl){ | 159 | if(!tempTableEl){ |
163 | tempTableEl = document.createElement('div'); | 160 | tempTableEl = document.createElement('div'); |
164 | } | 161 | } |
165 | var node; | 162 | var node; |
166 | if(tag == 'table' || tag == 'tbody'){ | 163 | if(tag == 'table' || tag == 'tbody'){ |
167 | tempTableEl.innerHTML = '<table><tbody>'+html+'</tbody></table>'; | 164 | tempTableEl.innerHTML = '<table><tbody>'+html+'</tbody></table>'; |
168 | node = tempTableEl.firstChild.firstChild.firstChild; | 165 | node = tempTableEl.firstChild.firstChild.firstChild; |
169 | }else{ | 166 | }else{ |
170 | tempTableEl.innerHTML = '<table><tbody><tr>'+html+'</tr></tbody></table>'; | 167 | tempTableEl.innerHTML = '<table><tbody><tr>'+html+'</tr></tbody></table>'; |
171 | node = tempTableEl.firstChild.firstChild.firstChild.firstChild; | 168 | node = tempTableEl.firstChild.firstChild.firstChild.firstChild; |
172 | } | 169 | } |
173 | if(where == 'beforebegin'){ | 170 | if(where == 'beforebegin'){ |
174 | el.parentNode.insertBefore(node, el); | 171 | el.parentNode.insertBefore(node, el); |
175 | return node; | 172 | return node; |
176 | }else if(where == 'afterbegin'){ | 173 | }else if(where == 'afterbegin'){ |
177 | el.insertBefore(node, el.firstChild); | 174 | el.insertBefore(node, el.firstChild); |
178 | return node; | 175 | return node; |
179 | }else if(where == 'beforeend'){ | 176 | }else if(where == 'beforeend'){ |
180 | el.appendChild(node); | 177 | el.appendChild(node); |
181 | return node; | 178 | return node; |
182 | }else if(where == 'afterend'){ | 179 | }else if(where == 'afterend'){ |
183 | el.parentNode.insertBefore(node, el.nextSibling); | 180 | el.parentNode.insertBefore(node, el.nextSibling); |
184 | return node; | 181 | return node; |
185 | } | 182 | } |
186 | } | 183 | } |
187 | 184 | ||
188 | /** | 185 | /** |
189 | * Inserts an HTML fragment into the Dom | 186 | * Inserts an HTML fragment into the Dom |
190 | * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. | 187 | * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. |
191 | * @param {HTMLElement} el The context element | 188 | * @param {HTMLElement} el The context element |
192 | * @param {String} html The HTML fragmenet | 189 | * @param {String} html The HTML fragmenet |
193 | * @return {HTMLElement} The new node | 190 | * @return {HTMLElement} The new node |
194 | */ | 191 | */ |
195 | this.insertHtml = function(where, el, html){ | 192 | this.insertHtml = function(where, el, html){ |
196 | where = where.toLowerCase(); | 193 | where = where.toLowerCase(); |
197 | if(el.insertAdjacentHTML){ | 194 | if(el.insertAdjacentHTML){ |
198 | var tag = el.tagName.toLowerCase(); | 195 | var tag = el.tagName.toLowerCase(); |
199 | if(tag == 'table' || tag == 'tbody' || tag == 'tr'){ | 196 | if(tag == 'table' || tag == 'tbody' || tag == 'tr'){ |
200 | return insertIntoTable(tag, where, el, html); | 197 | return insertIntoTable(tag, where, el, html); |
201 | } | 198 | } |
202 | switch(where){ | 199 | switch(where){ |
203 | case 'beforebegin': | 200 | case 'beforebegin': |
204 | el.insertAdjacentHTML(where, html); | 201 | el.insertAdjacentHTML(where, html); |
205 | return el.previousSibling; | 202 | return el.previousSibling; |
206 | case 'afterbegin': | 203 | case 'afterbegin': |
207 | el.insertAdjacentHTML(where, html); | 204 | el.insertAdjacentHTML(where, html); |
208 | return el.firstChild; | 205 | return el.firstChild; |
209 | case 'beforeend': | 206 | case 'beforeend': |
210 | el.insertAdjacentHTML(where, html); | 207 | el.insertAdjacentHTML(where, html); |
211 | return el.lastChild; | 208 | return el.lastChild; |
212 | case 'afterend': | 209 | case 'afterend': |
213 | el.insertAdjacentHTML(where, html); | 210 | el.insertAdjacentHTML(where, html); |
214 | return el.nextSibling; | 211 | return el.nextSibling; |
215 | } | 212 | } |
216 | throw 'Illegal insertion point -> "' + where + '"'; | 213 | throw 'Illegal insertion point -> "' + where + '"'; |
217 | } | 214 | } |
218 | var range = el.ownerDocument.createRange(); | 215 | var range = el.ownerDocument.createRange(); |
219 | var frag; | 216 | var frag; |
220 | switch(where){ | 217 | switch(where){ |
221 | case 'beforebegin': | 218 | case 'beforebegin': |
222 | range.setStartBefore(el); | 219 | range.setStartBefore(el); |
223 | frag = range.createContextualFragment(html); | 220 | frag = range.createContextualFragment(html); |
224 | el.parentNode.insertBefore(frag, el); | 221 | el.parentNode.insertBefore(frag, el); |
225 | return el.previousSibling; | 222 | return el.previousSibling; |
226 | case 'afterbegin': | 223 | case 'afterbegin': |
227 | if(el.firstChild){ // faster | 224 | if(el.firstChild){ // faster |
228 | range.setStartBefore(el.firstChild); | 225 | range.setStartBefore(el.firstChild); |
229 | }else{ | 226 | }else{ |
230 | range.selectNodeContents(el); | 227 | range.selectNodeContents(el); |
231 | range.collapse(true); | 228 | range.collapse(true); |
232 | } | 229 | } |
233 | frag = range.createContextualFragment(html); | 230 | frag = range.createContextualFragment(html); |
234 | el.insertBefore(frag, el.firstChild); | 231 | el.insertBefore(frag, el.firstChild); |
235 | return el.firstChild; | 232 | return el.firstChild; |
236 | case 'beforeend': | 233 | case 'beforeend': |
237 | if(el.lastChild){ | 234 | if(el.lastChild){ |
238 | range.setStartAfter(el.lastChild); // faster | 235 | range.setStartAfter(el.lastChild); // faster |
239 | }else{ | 236 | }else{ |
240 | range.selectNodeContents(el); | 237 | range.selectNodeContents(el); |
241 | range.collapse(false); | 238 | range.collapse(false); |
242 | } | 239 | } |
243 | frag = range.createContextualFragment(html); | 240 | frag = range.createContextualFragment(html); |
244 | el.appendChild(frag); | 241 | el.appendChild(frag); |
245 | return el.lastChild; | 242 | return el.lastChild; |
246 | case 'afterend': | 243 | case 'afterend': |
247 | range.setStartAfter(el); | 244 | range.setStartAfter(el); |
248 | frag = range.createContextualFragment(html); | 245 | frag = range.createContextualFragment(html); |
249 | el.parentNode.insertBefore(frag, el.nextSibling); | 246 | el.parentNode.insertBefore(frag, el.nextSibling); |
250 | return el.nextSibling; | 247 | return el.nextSibling; |
251 | } | 248 | } |
252 | throw 'Illegal insertion point -> "' + where + '"'; | 249 | throw 'Illegal insertion point -> "' + where + '"'; |
253 | }; | 250 | }; |
254 | 251 | ||
255 | /** | 252 | /** |
256 | * Creates new Dom element(s) and inserts them before el | 253 | * Creates new Dom element(s) and inserts them before el |
257 | * @param {String/HTMLElement/Element} el The context element | 254 | * @param {String/HTMLElement/Element} el The context element |
258 | * @param {Object} o The Dom object spec (and children) | 255 | * @param {Object} o The Dom object spec (and children) |
259 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 256 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
260 | * @return {HTMLElement} The new node | 257 | * @return {HTMLElement} The new node |
261 | */ | 258 | */ |
262 | this.insertBefore = function(el, o, returnElement){ | 259 | this.insertBefore = function(el, o, returnElement){ |
263 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 260 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
264 | var newNode; | 261 | var newNode; |
265 | if(this.useDom){ | 262 | if(this.useDom){ |
266 | newNode = createDom(o, null); | 263 | newNode = createDom(o, null); |
267 | el.parentNode.insertBefore(newNode, el); | 264 | el.parentNode.insertBefore(newNode, el); |
268 | }else{ | 265 | }else{ |
269 | var html = createHtml(o); | 266 | var html = createHtml(o); |
270 | newNode = this.insertHtml('beforeBegin', el, html); | 267 | newNode = this.insertHtml('beforeBegin', el, html); |
271 | } | 268 | } |
272 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 269 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
273 | }; | 270 | }; |
274 | 271 | ||
275 | /** | 272 | /** |
276 | * Creates new Dom element(s) and inserts them after el | 273 | * Creates new Dom element(s) and inserts them after el |
277 | * @param {String/HTMLElement/Element} el The context element | 274 | * @param {String/HTMLElement/Element} el The context element |
278 | * @param {Object} o The Dom object spec (and children) | 275 | * @param {Object} o The Dom object spec (and children) |
279 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 276 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
280 | * @return {HTMLElement} The new node | 277 | * @return {HTMLElement} The new node |
281 | */ | 278 | */ |
282 | this.insertAfter = function(el, o, returnElement){ | 279 | this.insertAfter = function(el, o, returnElement){ |
283 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 280 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
284 | var newNode; | 281 | var newNode; |
285 | if(this.useDom){ | 282 | if(this.useDom){ |
286 | newNode = createDom(o, null); | 283 | newNode = createDom(o, null); |
287 | el.parentNode.insertBefore(newNode, el.nextSibling); | 284 | el.parentNode.insertBefore(newNode, el.nextSibling); |
288 | }else{ | 285 | }else{ |
289 | var html = createHtml(o); | 286 | var html = createHtml(o); |
290 | newNode = this.insertHtml('afterEnd', el, html); | 287 | newNode = this.insertHtml('afterEnd', el, html); |
291 | } | 288 | } |
292 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 289 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
293 | }; | 290 | }; |
294 | 291 | ||
295 | /** | 292 | /** |
296 | * Creates new Dom element(s) and appends them to el | 293 | * Creates new Dom element(s) and appends them to el |
297 | * @param {String/HTMLElement/Element} el The context element | 294 | * @param {String/HTMLElement/Element} el The context element |
298 | * @param {Object} o The Dom object spec (and children) | 295 | * @param {Object} o The Dom object spec (and children) |
299 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 296 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
300 | * @return {HTMLElement} The new node | 297 | * @return {HTMLElement} The new node |
301 | */ | 298 | */ |
302 | this.append = function(el, o, returnElement){ | 299 | this.append = function(el, o, returnElement){ |
303 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 300 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
304 | var newNode; | 301 | var newNode; |
305 | if(this.useDom){ | 302 | if(this.useDom){ |
306 | newNode = createDom(o, null); | 303 | newNode = createDom(o, null); |
307 | el.appendChild(newNode); | 304 | el.appendChild(newNode); |
308 | }else{ | 305 | }else{ |
309 | var html = createHtml(o); | 306 | var html = createHtml(o); |
310 | newNode = this.insertHtml('beforeEnd', el, html); | 307 | newNode = this.insertHtml('beforeEnd', el, html); |
311 | } | 308 | } |
312 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 309 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
313 | }; | 310 | }; |
314 | 311 | ||
315 | /** | 312 | /** |
316 | * Creates new Dom element(s) and overwrites the contents of el with them | 313 | * Creates new Dom element(s) and overwrites the contents of el with them |
317 | * @param {String/HTMLElement/Element} el The context element | 314 | * @param {String/HTMLElement/Element} el The context element |
318 | * @param {Object} o The Dom object spec (and children) | 315 | * @param {Object} o The Dom object spec (and children) |
319 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 316 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
320 | * @return {HTMLElement} The new node | 317 | * @return {HTMLElement} The new node |
321 | */ | 318 | */ |
322 | this.overwrite = function(el, o, returnElement){ | 319 | this.overwrite = function(el, o, returnElement){ |
323 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 320 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
324 | el.innerHTML = createHtml(o); | 321 | el.innerHTML = createHtml(o); |
325 | return returnElement ? YAHOO.ext.Element.get(el.firstChild, true) : el.firstChild; | 322 | return returnElement ? YAHOO.ext.Element.get(el.firstChild, true) : el.firstChild; |
326 | }; | 323 | }; |
327 | 324 | ||
328 | /** | 325 | /** |
329 | * Creates a new Clipperz.YUI.DomHelper.Template from the Dom object spec | 326 | * Creates a new Clipperz.YUI.DomHelper.Template from the Dom object spec |
330 | * @param {Object} o The Dom object spec (and children) | 327 | * @param {Object} o The Dom object spec (and children) |
331 | * @return {Clipperz.YUI.DomHelper.Template} The new template | 328 | * @return {Clipperz.YUI.DomHelper.Template} The new template |
332 | */ | 329 | */ |
333 | this.createTemplate = function(o){ | 330 | this.createTemplate = function(o){ |
334 | var html = createHtml(o); | 331 | var html = createHtml(o); |
335 | return new Clipperz.YUI.DomHelper.Template(html); | 332 | return new Clipperz.YUI.DomHelper.Template(html); |
336 | }; | 333 | }; |
337 | }(); | 334 | }(); |
338 | 335 | ||
339 | /** | 336 | /** |
340 | * @class Clipperz.YUI.DomHelper.Template | 337 | * @class Clipperz.YUI.DomHelper.Template |
341 | * Represents an HTML fragment template. | 338 | * Represents an HTML fragment template. |
342 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. | 339 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. |
343 | * <br> | 340 | * <br> |
344 | * <b>This class is also available as YAHOO.ext.Template</b>. | 341 | * <b>This class is also available as YAHOO.ext.Template</b>. |
345 | * @constructor | 342 | * @constructor |
346 | * @param {String/Array} html The HTML fragment or an array of fragments to join('') or multiple arguments to join('') | 343 | * @param {String/Array} html The HTML fragment or an array of fragments to join('') or multiple arguments to join('') |
347 | */ | 344 | */ |
348 | Clipperz.YUI.DomHelper.Template = function(html){ | 345 | Clipperz.YUI.DomHelper.Template = function(html){ |
349 | if(html instanceof Array){ | 346 | if(html instanceof Array){ |
350 | html = html.join(''); | 347 | html = html.join(''); |
351 | }else if(arguments.length > 1){ | 348 | }else if(arguments.length > 1){ |
352 | html = Array.prototype.join.call(arguments, ''); | 349 | html = Array.prototype.join.call(arguments, ''); |
353 | } | 350 | } |
354 | /**@private*/ | 351 | /**@private*/ |
355 | this.html = html; | 352 | this.html = html; |
356 | }; | 353 | }; |
357 | Clipperz.YUI.DomHelper.Template.prototype = { | 354 | Clipperz.YUI.DomHelper.Template.prototype = { |
358 | /** | 355 | /** |
359 | * Returns an HTML fragment of this template with the specified values applied | 356 | * Returns an HTML fragment of this template with the specified values applied |
360 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 357 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
361 | * @return {String} | 358 | * @return {String} |
362 | */ | 359 | */ |
363 | applyTemplate : function(values){ | 360 | applyTemplate : function(values){ |
364 | if(this.compiled){ | 361 | if(this.compiled){ |
365 | return this.compiled(values); | 362 | return this.compiled(values); |
366 | } | 363 | } |
367 | var empty = ''; | 364 | var empty = ''; |
368 | var fn = function(match, index){ | 365 | var fn = function(match, index){ |
369 | if(typeof values[index] != 'undefined'){ | 366 | if(typeof values[index] != 'undefined'){ |
370 | return values[index]; | 367 | return values[index]; |
371 | }else{ | 368 | }else{ |
372 | return empty; | 369 | return empty; |
373 | } | 370 | } |
374 | } | 371 | } |
375 | return this.html.replace(this.re, fn); | 372 | return this.html.replace(this.re, fn); |
376 | }, | 373 | }, |
377 | 374 | ||
378 | /** | 375 | /** |
379 | * The regular expression used to match template variables | 376 | * The regular expression used to match template variables |
380 | * @type RegExp | 377 | * @type RegExp |
381 | * @property | 378 | * @property |
382 | */ | 379 | */ |
383 | re : /\{([\w|-]+)\}/g, | 380 | re : /\{([\w|-]+)\}/g, |
384 | 381 | ||
385 | /** | 382 | /** |
386 | * Compiles the template into an internal function, eliminating the RegEx overhead | 383 | * Compiles the template into an internal function, eliminating the RegEx overhead |
387 | */ | 384 | */ |
388 | compile : function(){ | 385 | compile : function(){ |
389 | var body = ["this.compiled = function(values){ return ['"]; | 386 | var body = ["this.compiled = function(values){ return ['"]; |
390 | body.push(this.html.replace(this.re, "', values['$1'], '")); | 387 | body.push(this.html.replace(this.re, "', values['$1'], '")); |
391 | body.push("'].join('');};"); | 388 | body.push("'].join('');};"); |
392 | eval(body.join('')); | 389 | eval(body.join('')); |
393 | return this; | 390 | return this; |
394 | }, | 391 | }, |
395 | 392 | ||
396 | /** | 393 | /** |
397 | * Applies the supplied values to the template and inserts the new node(s) before el | 394 | * Applies the supplied values to the template and inserts the new node(s) before el |
398 | * @param {String/HTMLElement/Element} el The context element | 395 | * @param {String/HTMLElement/Element} el The context element |
399 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 396 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
400 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 397 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
401 | * @return {HTMLElement} The new node | 398 | * @return {HTMLElement} The new node |
402 | */ | 399 | */ |
403 | insertBefore: function(el, values, returnElement){ | 400 | insertBefore: function(el, values, returnElement){ |
404 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 401 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
405 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); | 402 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); |
406 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 403 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
407 | }, | 404 | }, |
408 | 405 | ||
diff --git a/frontend/beta/js/Clipperz/YUI/DomQuery.js b/frontend/beta/js/Clipperz/YUI/DomQuery.js index 84aac08..4ad4193 100644 --- a/frontend/beta/js/Clipperz/YUI/DomQuery.js +++ b/frontend/beta/js/Clipperz/YUI/DomQuery.js | |||
@@ -1,408 +1,405 @@ | |||
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 | /* | 26 | /* |
30 | * yui-ext 0.40 | 27 | * yui-ext 0.40 |
31 | * Copyright(c) 2006, Jack Slocum. | 28 | * Copyright(c) 2006, Jack Slocum. |
32 | */ | 29 | */ |
33 | 30 | ||
34 | /** | 31 | /** |
35 | * @class Ext.DomQuery | 32 | * @class Ext.DomQuery |
36 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. | 33 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. |
37 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). | 34 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). |
38 | * @singleton | 35 | * @singleton |
39 | */ | 36 | */ |
40 | Ext.DomQuery = function(){ | 37 | Ext.DomQuery = function(){ |
41 | var cache = {}, simpleCache = {}, valueCache = {}; | 38 | var cache = {}, simpleCache = {}, valueCache = {}; |
42 | var nonSpace = /\S/; | 39 | var nonSpace = /\S/; |
43 | var trimRe = /^\s*(.*?)\s*$/; | 40 | var trimRe = /^\s*(.*?)\s*$/; |
44 | var tplRe = /\{(\d+)\}/g; | 41 | var tplRe = /\{(\d+)\}/g; |
45 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; | 42 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; |
46 | var clsRes = {}; | 43 | var clsRes = {}; |
47 | 44 | ||
48 | function child(p, index){ | 45 | function child(p, index){ |
49 | var i = 0; | 46 | var i = 0; |
50 | var n = p.firstChild; | 47 | var n = p.firstChild; |
51 | while(n){ | 48 | while(n){ |
52 | if(n.nodeType == 1){ | 49 | if(n.nodeType == 1){ |
53 | i++; | 50 | i++; |
54 | if(i == index){ | 51 | if(i == index){ |
55 | return n; | 52 | return n; |
56 | } | 53 | } |
57 | } | 54 | } |
58 | n = n.nextSibling; | 55 | n = n.nextSibling; |
59 | } | 56 | } |
60 | return null; | 57 | return null; |
61 | }; | 58 | }; |
62 | 59 | ||
63 | function next(d){ | 60 | function next(d){ |
64 | var n = d.nextSibling; | 61 | var n = d.nextSibling; |
65 | while(n && n.nodeType != 1){ | 62 | while(n && n.nodeType != 1){ |
66 | n = n.nextSibling; | 63 | n = n.nextSibling; |
67 | } | 64 | } |
68 | return n; | 65 | return n; |
69 | }; | 66 | }; |
70 | 67 | ||
71 | function prev(d){ | 68 | function prev(d){ |
72 | var n = d.previousSibling; | 69 | var n = d.previousSibling; |
73 | while(n && n.nodeType != 1){ | 70 | while(n && n.nodeType != 1){ |
74 | n = n.previousSibling; | 71 | n = n.previousSibling; |
75 | } | 72 | } |
76 | return n; | 73 | return n; |
77 | }; | 74 | }; |
78 | 75 | ||
79 | function clean(d){ | 76 | function clean(d){ |
80 | var n = d.firstChild, ni = -1; | 77 | var n = d.firstChild, ni = -1; |
81 | while(n){ | 78 | while(n){ |
82 | var nx = n.nextSibling; | 79 | var nx = n.nextSibling; |
83 | if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ | 80 | if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ |
84 | d.removeChild(n); | 81 | d.removeChild(n); |
85 | }else{ | 82 | }else{ |
86 | n.nodeIndex = ++ni; | 83 | n.nodeIndex = ++ni; |
87 | } | 84 | } |
88 | n = nx; | 85 | n = nx; |
89 | } | 86 | } |
90 | return this; | 87 | return this; |
91 | }; | 88 | }; |
92 | 89 | ||
93 | function byClassName(c, a, v){ | 90 | function byClassName(c, a, v){ |
94 | if(!v){ | 91 | if(!v){ |
95 | return c; | 92 | return c; |
96 | } | 93 | } |
97 | var re = clsRes[v]; | 94 | var re = clsRes[v]; |
98 | if(!re){ | 95 | if(!re){ |
99 | re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)'); | 96 | re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)'); |
100 | clsRes[v] = re; | 97 | clsRes[v] = re; |
101 | } | 98 | } |
102 | var r = []; | 99 | var r = []; |
103 | for(var i = 0, ci; ci = c[i]; i++){ | 100 | for(var i = 0, ci; ci = c[i]; i++){ |
104 | if(re.test(ci.className)){ | 101 | if(re.test(ci.className)){ |
105 | r[r.length] = ci; | 102 | r[r.length] = ci; |
106 | } | 103 | } |
107 | } | 104 | } |
108 | return r; | 105 | return r; |
109 | }; | 106 | }; |
110 | 107 | ||
111 | function convert(c){ | 108 | function convert(c){ |
112 | if(c.slice){ | 109 | if(c.slice){ |
113 | return c; | 110 | return c; |
114 | } | 111 | } |
115 | var r = []; | 112 | var r = []; |
116 | for(var i = 0, l = c.length; i < l; i++){ | 113 | for(var i = 0, l = c.length; i < l; i++){ |
117 | r[r.length] = c[i]; | 114 | r[r.length] = c[i]; |
118 | } | 115 | } |
119 | return r; | 116 | return r; |
120 | }; | 117 | }; |
121 | 118 | ||
122 | function attrValue(n, attr){ | 119 | function attrValue(n, attr){ |
123 | if(!n.tagName && typeof n.length != 'undefined'){ | 120 | if(!n.tagName && typeof n.length != 'undefined'){ |
124 | n = n[0]; | 121 | n = n[0]; |
125 | } | 122 | } |
126 | if(!n){ | 123 | if(!n){ |
127 | return null; | 124 | return null; |
128 | } | 125 | } |
129 | if(attr == 'for'){ | 126 | if(attr == 'for'){ |
130 | return n.htmlFor; | 127 | return n.htmlFor; |
131 | } | 128 | } |
132 | if(attr == 'class' || attr == 'className'){ | 129 | if(attr == 'class' || attr == 'className'){ |
133 | return n.className; | 130 | return n.className; |
134 | } | 131 | } |
135 | return n.getAttribute(attr) || n[attr]; | 132 | return n.getAttribute(attr) || n[attr]; |
136 | 133 | ||
137 | }; | 134 | }; |
138 | 135 | ||
139 | function getNodes(ns, mode, tagName){ | 136 | function getNodes(ns, mode, tagName){ |
140 | var result = [], cs; | 137 | var result = [], cs; |
141 | if(!ns){ | 138 | if(!ns){ |
142 | return result; | 139 | return result; |
143 | } | 140 | } |
144 | mode = mode ? mode.replace(trimRe, '$1') : ''; | 141 | mode = mode ? mode.replace(trimRe, '$1') : ''; |
145 | tagName = tagName || '*'; | 142 | tagName = tagName || '*'; |
146 | if(ns.tagName || ns == document){ | 143 | if(ns.tagName || ns == document){ |
147 | ns = [ns]; | 144 | ns = [ns]; |
148 | } | 145 | } |
149 | if(mode != '/' && mode != '>'){ | 146 | if(mode != '/' && mode != '>'){ |
150 | for(var i = 0, ni; ni = ns[i]; i++){ | 147 | for(var i = 0, ni; ni = ns[i]; i++){ |
151 | cs = ni.getElementsByTagName(tagName); | 148 | cs = ni.getElementsByTagName(tagName); |
152 | result = concat(result, cs); | 149 | result = concat(result, cs); |
153 | } | 150 | } |
154 | }else{ | 151 | }else{ |
155 | for(var i = 0, ni; ni = ns[i]; i++){ | 152 | for(var i = 0, ni; ni = ns[i]; i++){ |
156 | var cn = ni.getElementsByTagName(tagName); | 153 | var cn = ni.getElementsByTagName(tagName); |
157 | for(var j = 0, cj; cj = cn[j]; j++){ | 154 | for(var j = 0, cj; cj = cn[j]; j++){ |
158 | if(cj.parentNode == ni){ | 155 | if(cj.parentNode == ni){ |
159 | result[result.length] = cj; | 156 | result[result.length] = cj; |
160 | } | 157 | } |
161 | } | 158 | } |
162 | } | 159 | } |
163 | 160 | ||
164 | } | 161 | } |
165 | return result; | 162 | return result; |
166 | }; | 163 | }; |
167 | 164 | ||
168 | function concat(a, b){ | 165 | function concat(a, b){ |
169 | if(b.slice){ | 166 | if(b.slice){ |
170 | return a.concat(b); | 167 | return a.concat(b); |
171 | } | 168 | } |
172 | for(var i = 0, l = b.length; i < l; i++){ | 169 | for(var i = 0, l = b.length; i < l; i++){ |
173 | a[a.length] = b[i]; | 170 | a[a.length] = b[i]; |
174 | } | 171 | } |
175 | return a; | 172 | return a; |
176 | } | 173 | } |
177 | 174 | ||
178 | function byTag(cs, tagName){ | 175 | function byTag(cs, tagName){ |
179 | if(cs.tagName || cs == document){ | 176 | if(cs.tagName || cs == document){ |
180 | cs = [cs]; | 177 | cs = [cs]; |
181 | } | 178 | } |
182 | if(!tagName){ | 179 | if(!tagName){ |
183 | return cs; | 180 | return cs; |
184 | } | 181 | } |
185 | var r = []; tagName = tagName.toLowerCase(); | 182 | var r = []; tagName = tagName.toLowerCase(); |
186 | for(var i = 0, ci; ci = cs[i]; i++){ | 183 | for(var i = 0, ci; ci = cs[i]; i++){ |
187 | if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ | 184 | if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ |
188 | r[r.length] = ci; | 185 | r[r.length] = ci; |
189 | } | 186 | } |
190 | } | 187 | } |
191 | return r; | 188 | return r; |
192 | }; | 189 | }; |
193 | 190 | ||
194 | function byId(cs, attr, id){ | 191 | function byId(cs, attr, id){ |
195 | if(cs.tagName || cs == document){ | 192 | if(cs.tagName || cs == document){ |
196 | cs = [cs]; | 193 | cs = [cs]; |
197 | } | 194 | } |
198 | if(!id){ | 195 | if(!id){ |
199 | return cs; | 196 | return cs; |
200 | } | 197 | } |
201 | var r = []; | 198 | var r = []; |
202 | for(var i = 0, l = cs.length; i < l; i++){ | 199 | for(var i = 0, l = cs.length; i < l; i++){ |
203 | var ci = cs[i]; | 200 | var ci = cs[i]; |
204 | if(ci && ci.id == id){ | 201 | if(ci && ci.id == id){ |
205 | r[r.length] = ci; | 202 | r[r.length] = ci; |
206 | } | 203 | } |
207 | } | 204 | } |
208 | return r; | 205 | return r; |
209 | }; | 206 | }; |
210 | 207 | ||
211 | function byAttribute(cs, attr, value, op, custom){ | 208 | function byAttribute(cs, attr, value, op, custom){ |
212 | var r = [], st = custom=='{'; | 209 | var r = [], st = custom=='{'; |
213 | var f = Ext.DomQuery.operators[op]; | 210 | var f = Ext.DomQuery.operators[op]; |
214 | for(var i = 0, l = cs.length; i < l; i++){ | 211 | for(var i = 0, l = cs.length; i < l; i++){ |
215 | var a; | 212 | var a; |
216 | if(st){ | 213 | if(st){ |
217 | a = Ext.DomQuery.getStyle(cs[i], attr); | 214 | a = Ext.DomQuery.getStyle(cs[i], attr); |
218 | } | 215 | } |
219 | else if(attr == 'class' || attr == 'className'){ | 216 | else if(attr == 'class' || attr == 'className'){ |
220 | a = cs[i].className; | 217 | a = cs[i].className; |
221 | }else if(attr == 'for'){ | 218 | }else if(attr == 'for'){ |
222 | a = cs[i].htmlFor; | 219 | a = cs[i].htmlFor; |
223 | }else{ | 220 | }else{ |
224 | a = cs[i].getAttribute(attr); | 221 | a = cs[i].getAttribute(attr); |
225 | } | 222 | } |
226 | if((f && f(a, value)) || (!f && a)){ | 223 | if((f && f(a, value)) || (!f && a)){ |
227 | r[r.length] = cs[i]; | 224 | r[r.length] = cs[i]; |
228 | } | 225 | } |
229 | } | 226 | } |
230 | return r; | 227 | return r; |
231 | }; | 228 | }; |
232 | 229 | ||
233 | function byPseudo(cs, name, value){ | 230 | function byPseudo(cs, name, value){ |
234 | return Ext.DomQuery.pseudos[name](cs, value); | 231 | return Ext.DomQuery.pseudos[name](cs, value); |
235 | }; | 232 | }; |
236 | 233 | ||
237 | // This is for IE MSXML which does not support expandos. | 234 | // This is for IE MSXML which does not support expandos. |
238 | // IE runs the same speed using setAttribute, however FF slows way down | 235 | // IE runs the same speed using setAttribute, however FF slows way down |
239 | // and Safari completely fails so they need to continue to use expandos. | 236 | // and Safari completely fails so they need to continue to use expandos. |
240 | // Branched at load time for faster execution. | 237 | // Branched at load time for faster execution. |
241 | var isIE = window.ActiveXObject; | 238 | var isIE = window.ActiveXObject; |
242 | var addAttr = isIE ? | 239 | var addAttr = isIE ? |
243 | function(n, a, v){ | 240 | function(n, a, v){ |
244 | n.setAttribute(a, v); | 241 | n.setAttribute(a, v); |
245 | } : | 242 | } : |
246 | function(n, a, v){ | 243 | function(n, a, v){ |
247 | n[a] = v; | 244 | n[a] = v; |
248 | }; | 245 | }; |
249 | var getAttr = isIE ? | 246 | var getAttr = isIE ? |
250 | function(n, a){ | 247 | function(n, a){ |
251 | return n.getAttribute(a); | 248 | return n.getAttribute(a); |
252 | } : | 249 | } : |
253 | function(n, a){ | 250 | function(n, a){ |
254 | return n[a]; | 251 | return n[a]; |
255 | }; | 252 | }; |
256 | var clearAttr = isIE ? | 253 | var clearAttr = isIE ? |
257 | function(n, a){ | 254 | function(n, a){ |
258 | n.removeAttribute(a); | 255 | n.removeAttribute(a); |
259 | } : | 256 | } : |
260 | function(n, a, v){ | 257 | function(n, a, v){ |
261 | delete n[a]; | 258 | delete n[a]; |
262 | }; | 259 | }; |
263 | 260 | ||
264 | function nodup(cs){ | 261 | function nodup(cs){ |
265 | if(!cs.length){ | 262 | if(!cs.length){ |
266 | return cs; | 263 | return cs; |
267 | } | 264 | } |
268 | addAttr(cs[0], '_nodup', true); | 265 | addAttr(cs[0], '_nodup', true); |
269 | var r = [cs[0]]; | 266 | var r = [cs[0]]; |
270 | for(var i = 1, len = cs.length; i < len; i++){ | 267 | for(var i = 1, len = cs.length; i < len; i++){ |
271 | var c = cs[i]; | 268 | var c = cs[i]; |
272 | if(!getAttr(c, '_nodup')){ | 269 | if(!getAttr(c, '_nodup')){ |
273 | addAttr(c, '_nodup', true); | 270 | addAttr(c, '_nodup', true); |
274 | r[r.length] = c; | 271 | r[r.length] = c; |
275 | } | 272 | } |
276 | } | 273 | } |
277 | for(var i = 0, len = cs.length; i < len; i++){ | 274 | for(var i = 0, len = cs.length; i < len; i++){ |
278 | clearAttr(cs[i], '_nodup'); | 275 | clearAttr(cs[i], '_nodup'); |
279 | } | 276 | } |
280 | return r; | 277 | return r; |
281 | } | 278 | } |
282 | 279 | ||
283 | function quickDiff(c1, c2){ | 280 | function quickDiff(c1, c2){ |
284 | if(!c1.length){ | 281 | if(!c1.length){ |
285 | return c2; | 282 | return c2; |
286 | } | 283 | } |
287 | for(var i = 0, len = c1.length; i < len; i++){ | 284 | for(var i = 0, len = c1.length; i < len; i++){ |
288 | addAttr(c1[i], '_qdiff', true); | 285 | addAttr(c1[i], '_qdiff', true); |
289 | } | 286 | } |
290 | var r = []; | 287 | var r = []; |
291 | for(var i = 0, len = c2.length; i < len; i++){ | 288 | for(var i = 0, len = c2.length; i < len; i++){ |
292 | if(!getAttr(c2[i], '_qdiff')){ | 289 | if(!getAttr(c2[i], '_qdiff')){ |
293 | r[r.length] = c2[i]; | 290 | r[r.length] = c2[i]; |
294 | } | 291 | } |
295 | } | 292 | } |
296 | for(var i = 0, len = c1.length; i < len; i++){ | 293 | for(var i = 0, len = c1.length; i < len; i++){ |
297 | clearAttr(c1[i], '_qdiff'); | 294 | clearAttr(c1[i], '_qdiff'); |
298 | } | 295 | } |
299 | return r; | 296 | return r; |
300 | } | 297 | } |
301 | 298 | ||
302 | function quickId(ns, mode, root, id){ | 299 | function quickId(ns, mode, root, id){ |
303 | if(ns == root){ | 300 | if(ns == root){ |
304 | var d = root.ownerDocument || root; | 301 | var d = root.ownerDocument || root; |
305 | return d.getElementById(id); | 302 | return d.getElementById(id); |
306 | } | 303 | } |
307 | ns = getNodes(ns, mode, '*'); | 304 | ns = getNodes(ns, mode, '*'); |
308 | return byId(ns, null, id); | 305 | return byId(ns, null, id); |
309 | } | 306 | } |
310 | 307 | ||
311 | return { | 308 | return { |
312 | getStyle : function(el, name){ | 309 | getStyle : function(el, name){ |
313 | return YAHOO.util.Dom.getStyle(el, name); | 310 | return YAHOO.util.Dom.getStyle(el, name); |
314 | }, | 311 | }, |
315 | /** | 312 | /** |
316 | * Compiles a selector/xpath query into a reusable function. The returned function | 313 | * Compiles a selector/xpath query into a reusable function. The returned function |
317 | * takes one parameter "root" (optional), which is the context node from where the query should start. | 314 | * takes one parameter "root" (optional), which is the context node from where the query should start. |
318 | * @param {String} selector The selector/xpath query | 315 | * @param {String} selector The selector/xpath query |
319 | * @param {String} type (optional) Either 'select' (the default) or 'simple' for a simple selector match | 316 | * @param {String} type (optional) Either 'select' (the default) or 'simple' for a simple selector match |
320 | * @return {Function} | 317 | * @return {Function} |
321 | */ | 318 | */ |
322 | compile : function(path, type){ | 319 | compile : function(path, type){ |
323 | // strip leading slashes | 320 | // strip leading slashes |
324 | while(path.substr(0, 1)=='/'){ | 321 | while(path.substr(0, 1)=='/'){ |
325 | path = path.substr(1); | 322 | path = path.substr(1); |
326 | } | 323 | } |
327 | type = type || 'select'; | 324 | type = type || 'select'; |
328 | 325 | ||
329 | var fn = ['var f = function(root){\n var mode; var n = root || document;\n']; | 326 | var fn = ['var f = function(root){\n var mode; var n = root || document;\n']; |
330 | var q = path, mode, lq; | 327 | var q = path, mode, lq; |
331 | var tk = Ext.DomQuery.matchers; | 328 | var tk = Ext.DomQuery.matchers; |
332 | var tklen = tk.length; | 329 | var tklen = tk.length; |
333 | var mm; | 330 | var mm; |
334 | while(q && lq != q){ | 331 | while(q && lq != q){ |
335 | lq = q; | 332 | lq = q; |
336 | var tm = q.match(/^(#)?([\w-\*]+)/); | 333 | var tm = q.match(/^(#)?([\w-\*]+)/); |
337 | if(type == 'select'){ | 334 | if(type == 'select'){ |
338 | if(tm){ | 335 | if(tm){ |
339 | if(tm[1] == '#'){ | 336 | if(tm[1] == '#'){ |
340 | fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; | 337 | fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; |
341 | }else{ | 338 | }else{ |
342 | fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; | 339 | fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; |
343 | } | 340 | } |
344 | q = q.replace(tm[0], ''); | 341 | q = q.replace(tm[0], ''); |
345 | }else{ | 342 | }else{ |
346 | fn[fn.length] = 'n = getNodes(n, mode, "*");'; | 343 | fn[fn.length] = 'n = getNodes(n, mode, "*");'; |
347 | } | 344 | } |
348 | }else{ | 345 | }else{ |
349 | if(tm){ | 346 | if(tm){ |
350 | if(tm[1] == '#'){ | 347 | if(tm[1] == '#'){ |
351 | fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; | 348 | fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; |
352 | }else{ | 349 | }else{ |
353 | fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; | 350 | fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; |
354 | } | 351 | } |
355 | q = q.replace(tm[0], ''); | 352 | q = q.replace(tm[0], ''); |
356 | } | 353 | } |
357 | } | 354 | } |
358 | while(!(mm = q.match(modeRe))){ | 355 | while(!(mm = q.match(modeRe))){ |
359 | var matched = false; | 356 | var matched = false; |
360 | for(var j = 0; j < tklen; j++){ | 357 | for(var j = 0; j < tklen; j++){ |
361 | var t = tk[j]; | 358 | var t = tk[j]; |
362 | var m = q.match(t.re); | 359 | var m = q.match(t.re); |
363 | if(m){ | 360 | if(m){ |
364 | fn[fn.length] = t.select.replace(tplRe, function(x, i){ | 361 | fn[fn.length] = t.select.replace(tplRe, function(x, i){ |
365 | return m[i]; | 362 | return m[i]; |
366 | }); | 363 | }); |
367 | q = q.replace(m[0], ''); | 364 | q = q.replace(m[0], ''); |
368 | matched = true; | 365 | matched = true; |
369 | break; | 366 | break; |
370 | } | 367 | } |
371 | } | 368 | } |
372 | // prevent infinite loop on bad selector | 369 | // prevent infinite loop on bad selector |
373 | if(!matched){ | 370 | if(!matched){ |
374 | throw 'Error parsing selector, parsing failed at "' + q + '"'; | 371 | throw 'Error parsing selector, parsing failed at "' + q + '"'; |
375 | } | 372 | } |
376 | } | 373 | } |
377 | if(mm[1]){ | 374 | if(mm[1]){ |
378 | fn[fn.length] = 'mode="'+mm[1]+'";'; | 375 | fn[fn.length] = 'mode="'+mm[1]+'";'; |
379 | q = q.replace(mm[1], ''); | 376 | q = q.replace(mm[1], ''); |
380 | } | 377 | } |
381 | } | 378 | } |
382 | fn[fn.length] = 'return nodup(n);\n}'; | 379 | fn[fn.length] = 'return nodup(n);\n}'; |
383 | eval(fn.join('')); | 380 | eval(fn.join('')); |
384 | return f; | 381 | return f; |
385 | }, | 382 | }, |
386 | 383 | ||
387 | /** | 384 | /** |
388 | * Selects a group of elements. | 385 | * Selects a group of elements. |
389 | * @param {String} selector The selector/xpath query | 386 | * @param {String} selector The selector/xpath query |
390 | * @param {Node} root (optional) The start of the query (defaults to document). | 387 | * @param {Node} root (optional) The start of the query (defaults to document). |
391 | * @return {Array} | 388 | * @return {Array} |
392 | */ | 389 | */ |
393 | select : function(path, root, type){ | 390 | select : function(path, root, type){ |
394 | if(!root || root == document){ | 391 | if(!root || root == document){ |
395 | root = document; | 392 | root = document; |
396 | } | 393 | } |
397 | if(typeof root == 'string'){ | 394 | if(typeof root == 'string'){ |
398 | root = document.getElementById(root); | 395 | root = document.getElementById(root); |
399 | } | 396 | } |
400 | var paths = path.split(','); | 397 | var paths = path.split(','); |
401 | var results = []; | 398 | var results = []; |
402 | for(var i = 0, len = paths.length; i < len; i++){ | 399 | for(var i = 0, len = paths.length; i < len; i++){ |
403 | var p = paths[i].replace(trimRe, '$1'); | 400 | var p = paths[i].replace(trimRe, '$1'); |
404 | if(!cache[p]){ | 401 | if(!cache[p]){ |
405 | cache[p] = Ext.DomQuery.compile(p); | 402 | cache[p] = Ext.DomQuery.compile(p); |
406 | if(!cache[p]){ | 403 | if(!cache[p]){ |
407 | throw p + ' is not a valid selector'; | 404 | throw p + ' is not a valid selector'; |
408 | } | 405 | } |
diff --git a/frontend/beta/js/Clipperz/YUI/Drawer.js b/frontend/beta/js/Clipperz/YUI/Drawer.js index 394912e..508bfe5 100644 --- a/frontend/beta/js/Clipperz/YUI/Drawer.js +++ b/frontend/beta/js/Clipperz/YUI/Drawer.js | |||
@@ -1,238 +1,235 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
31 | 28 | ||
32 | 29 | ||
33 | Clipperz.YUI.Drawer = function(anElement, aRegion) { | 30 | Clipperz.YUI.Drawer = function(anElement, aRegion) { |
34 | this._status = 'slideIn'; | 31 | this._status = 'slideIn'; |
35 | 32 | ||
36 | this._element = YAHOO.ext.Element.get(anElement); | 33 | this._element = YAHOO.ext.Element.get(anElement); |
37 | this._region = aRegion || null; | 34 | this._region = aRegion || null; |
38 | 35 | ||
39 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; | 36 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; |
40 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; | 37 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; |
41 | 38 | ||
42 | 39 | ||
43 | this._wholeCollapedElement = this.enhanceCollapsedElement(); | 40 | this._wholeCollapedElement = this.enhanceCollapsedElement(); |
44 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); | 41 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); |
45 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); | 42 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); |
46 | 43 | ||
47 | this._contentWrapper = this.enhanceContentElement(); | 44 | this._contentWrapper = this.enhanceContentElement(); |
48 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); | 45 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); |
49 | this.contentElementActor().hide(); | 46 | this.contentElementActor().hide(); |
50 | 47 | ||
51 | this._contentWidth = 200; | 48 | this._contentWidth = 200; |
52 | }; | 49 | }; |
53 | 50 | ||
54 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { | 51 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { |
55 | 52 | ||
56 | 'element': function() { | 53 | 'element': function() { |
57 | return this._element; | 54 | return this._element; |
58 | }, | 55 | }, |
59 | 56 | ||
60 | //----------------------------------------------------- | 57 | //----------------------------------------------------- |
61 | 58 | ||
62 | 'status': function() { | 59 | 'status': function() { |
63 | return this._status; | 60 | return this._status; |
64 | }, | 61 | }, |
65 | 62 | ||
66 | 'setStatus': function(aValue) { | 63 | 'setStatus': function(aValue) { |
67 | this._status = aValue; | 64 | this._status = aValue; |
68 | }, | 65 | }, |
69 | 66 | ||
70 | //----------------------------------------------------- | 67 | //----------------------------------------------------- |
71 | 68 | ||
72 | 'collapsedElement': function() { | 69 | 'collapsedElement': function() { |
73 | return this._collapsedElement; | 70 | return this._collapsedElement; |
74 | }, | 71 | }, |
75 | 72 | ||
76 | //----------------------------------------------------- | 73 | //----------------------------------------------------- |
77 | 74 | ||
78 | 'contentElement': function() { | 75 | 'contentElement': function() { |
79 | return this._contentElement; | 76 | return this._contentElement; |
80 | }, | 77 | }, |
81 | 78 | ||
82 | //----------------------------------------------------- | 79 | //----------------------------------------------------- |
83 | 80 | ||
84 | 'contentElementActor': function() { | 81 | 'contentElementActor': function() { |
85 | return this._contentElementActor; | 82 | return this._contentElementActor; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //----------------------------------------------------- | 85 | //----------------------------------------------------- |
89 | 86 | ||
90 | 'contentWrapper': function() { | 87 | 'contentWrapper': function() { |
91 | return this._contentWrapper; | 88 | return this._contentWrapper; |
92 | }, | 89 | }, |
93 | 90 | ||
94 | //----------------------------------------------------- | 91 | //----------------------------------------------------- |
95 | 92 | ||
96 | 'contentWidth': function() { | 93 | 'contentWidth': function() { |
97 | return this._contentWidth; | 94 | return this._contentWidth; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | //----------------------------------------------------- | 97 | //----------------------------------------------------- |
101 | 98 | ||
102 | 'region': function() { | 99 | 'region': function() { |
103 | return this._region; | 100 | return this._region; |
104 | }, | 101 | }, |
105 | 102 | ||
106 | //----------------------------------------------------- | 103 | //----------------------------------------------------- |
107 | 104 | ||
108 | 'enhanceCollapsedElement': function() { | 105 | 'enhanceCollapsedElement': function() { |
109 | varwrapper; | 106 | varwrapper; |
110 | var link; | 107 | var link; |
111 | 108 | ||
112 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ | 109 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ |
113 | {tag:'div', cls:'drawer-pin-button', children:[ | 110 | {tag:'div', cls:'drawer-pin-button', children:[ |
114 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ | 111 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ |
115 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} | 112 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} |
116 | ]} | 113 | ]} |
117 | ]} | 114 | ]} |
118 | ]}); | 115 | ]}); |
119 | 116 | ||
120 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; | 117 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; |
121 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); | 118 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); |
122 | 119 | ||
123 | this.collapsedElement().setHeight('100%'); | 120 | this.collapsedElement().setHeight('100%'); |
124 | this.collapsedElement().setStyle('cursor', 'pointer'); | 121 | this.collapsedElement().setStyle('cursor', 'pointer'); |
125 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); | 122 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); |
126 | 123 | ||
127 | return wrapper; | 124 | return wrapper; |
128 | }, | 125 | }, |
129 | 126 | ||
130 | //----------------------------------------------------- | 127 | //----------------------------------------------------- |
131 | 128 | ||
132 | 'enhanceContentElement': function() { | 129 | 'enhanceContentElement': function() { |
133 | var wrapper; | 130 | var wrapper; |
134 | 131 | ||
135 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ | 132 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ |
136 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} | 133 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} |
137 | ]}); | 134 | ]}); |
138 | 135 | ||
139 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); | 136 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); |
140 | return wrapper; | 137 | return wrapper; |
141 | }, | 138 | }, |
142 | 139 | ||
143 | //----------------------------------------------------- | 140 | //----------------------------------------------------- |
144 | 141 | ||
145 | 'pinDrawer': function() { | 142 | 'pinDrawer': function() { |
146 | alert("pin drawer"); | 143 | alert("pin drawer"); |
147 | }, | 144 | }, |
148 | 145 | ||
149 | //----------------------------------------------------- | 146 | //----------------------------------------------------- |
150 | 147 | ||
151 | 'showDrawer': function() { | 148 | 'showDrawer': function() { |
152 | if (this.status() == 'slideIn') { | 149 | if (this.status() == 'slideIn') { |
153 | var actor; | 150 | var actor; |
154 | 151 | ||
155 | this.setStatus('slidingOut'); | 152 | this.setStatus('slidingOut'); |
156 | actor = this.contentElementActor(); | 153 | actor = this.contentElementActor(); |
157 | actor.setHeight(this.region().element().getHeight()); | 154 | actor.setHeight(this.region().element().getHeight()); |
158 | 155 | ||
159 | actor.startCapture(true); | 156 | actor.startCapture(true); |
160 | actor.alignTo(this.element(), 'tr'); | 157 | actor.alignTo(this.element(), 'tr'); |
161 | actor.blindShow('left', this.contentWidth(), .35); | 158 | actor.blindShow('left', this.contentWidth(), .35); |
162 | actor.play(this.onSlideOut.createDelegate(this)); | 159 | actor.play(this.onSlideOut.createDelegate(this)); |
163 | } | 160 | } |
164 | }, | 161 | }, |
165 | 162 | ||
166 | //----------------------------------------------------- | 163 | //----------------------------------------------------- |
167 | 164 | ||
168 | 'onSlideOut': function() { | 165 | 'onSlideOut': function() { |
169 | this.setStatus('slideOut'); | 166 | this.setStatus('slideOut'); |
170 | MochiKit.Logging.logDebug(">>> onSlideOut"); | 167 | MochiKit.Logging.logDebug(">>> onSlideOut"); |
171 | // alert("done"); | 168 | // alert("done"); |
172 | }, | 169 | }, |
173 | 170 | ||
174 | //----------------------------------------------------- | 171 | //----------------------------------------------------- |
175 | /* | 172 | /* |
176 | 'showContentElement': function() { | 173 | 'showContentElement': function() { |
177 | var top, left, width, height; | 174 | var top, left, width, height; |
178 | 175 | ||
179 | MochiKit.Logging.logDebug(">>> showContentElement"); | 176 | MochiKit.Logging.logDebug(">>> showContentElement"); |
180 | 177 | ||
181 | 178 | ||
182 | top = this.element().getTop(true); | 179 | top = this.element().getTop(true); |
183 | left = this.element().getRight(); | 180 | left = this.element().getRight(); |
184 | width = this.contentWidth(); | 181 | width = this.contentWidth(); |
185 | height = this.element().getHeight(); | 182 | height = this.element().getHeight(); |
186 | 183 | ||
187 | this.contentWrapper().setStyle('position', 'absolute'); | 184 | this.contentWrapper().setStyle('position', 'absolute'); |
188 | this.contentWrapper().setStyle('overflow', 'none'); | 185 | this.contentWrapper().setStyle('overflow', 'none'); |
189 | this.contentWrapper().setStyle('visibility', 'visible'); | 186 | this.contentWrapper().setStyle('visibility', 'visible'); |
190 | this.contentWrapper().setStyle('z-index', '10'); | 187 | this.contentWrapper().setStyle('z-index', '10'); |
191 | 188 | ||
192 | this.contentWrapper().setLeft(left); | 189 | this.contentWrapper().setLeft(left); |
193 | this.contentWrapper().setTop(top); | 190 | this.contentWrapper().setTop(top); |
194 | this.contentWrapper().setHeight(height); | 191 | this.contentWrapper().setHeight(height); |
195 | this.contentWrapper().setWidth(width); | 192 | this.contentWrapper().setWidth(width); |
196 | 193 | ||
197 | this.contentWrapper().show(); | 194 | this.contentWrapper().show(); |
198 | }, | 195 | }, |
199 | */ | 196 | */ |
200 | //----------------------------------------------------- | 197 | //----------------------------------------------------- |
201 | 198 | ||
202 | 'hideDrawer': function() { | 199 | 'hideDrawer': function() { |
203 | if (this.status() == 'slideOut') { | 200 | if (this.status() == 'slideOut') { |
204 | var actor; | 201 | var actor; |
205 | 202 | ||
206 | this.setStatus('slidingIn'); | 203 | this.setStatus('slidingIn'); |
207 | 204 | ||
208 | actor = this.contentElementActor(); | 205 | actor = this.contentElementActor(); |
209 | actor.setHeight(this.region().element().getHeight()); | 206 | actor.setHeight(this.region().element().getHeight()); |
210 | 207 | ||
211 | actor.startCapture(true); | 208 | actor.startCapture(true); |
212 | actor.alignTo(this.element(), 'tr'); | 209 | actor.alignTo(this.element(), 'tr'); |
213 | actor.blindHide('left', .35); | 210 | actor.blindHide('left', .35); |
214 | actor.setVisible(false); | 211 | actor.setVisible(false); |
215 | actor.play(this.onSlideIn.createDelegate(this)); | 212 | actor.play(this.onSlideIn.createDelegate(this)); |
216 | } | 213 | } |
217 | }, | 214 | }, |
218 | 215 | ||
219 | //----------------------------------------------------- | 216 | //----------------------------------------------------- |
220 | 217 | ||
221 | 'onSlideIn': function() { | 218 | 'onSlideIn': function() { |
222 | this.setStatus('slideIn'); | 219 | this.setStatus('slideIn'); |
223 | MochiKit.Logging.logDebug(">>> onSlideIn"); | 220 | MochiKit.Logging.logDebug(">>> onSlideIn"); |
224 | // alert("done"); | 221 | // alert("done"); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | //----------------------------------------------------- | 224 | //----------------------------------------------------- |
228 | 225 | ||
229 | 'hideContentElement': function() { | 226 | 'hideContentElement': function() { |
230 | this.contentWrapper().hide(); | 227 | this.contentWrapper().hide(); |
231 | }, | 228 | }, |
232 | 229 | ||
233 | //----------------------------------------------------- | 230 | //----------------------------------------------------- |
234 | //----------------------------------------------------- | 231 | //----------------------------------------------------- |
235 | 232 | ||
236 | //----------------------------------------------------- | 233 | //----------------------------------------------------- |
237 | __syntaxFix__: '__syntaxFix__' | 234 | __syntaxFix__: '__syntaxFix__' |
238 | }); \ No newline at end of file | 235 | }); \ No newline at end of file |
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js index 626b699..6e2138e 100644 --- a/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js +++ b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js | |||
@@ -1,114 +1,111 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
31 | 28 | ||
32 | 29 | ||
33 | Clipperz.YUI.IBLayoutManager = function(container, config) { | 30 | Clipperz.YUI.IBLayoutManager = function(container, config) { |
34 | var regionName; | 31 | var regionName; |
35 | varelement; | 32 | varelement; |
36 | 33 | ||
37 | config = config || {}; | 34 | config = config || {}; |
38 | 35 | ||
39 | Clipperz.YUI.IBLayoutManager.superclass.constructor.call(this, container); | 36 | Clipperz.YUI.IBLayoutManager.superclass.constructor.call(this, container); |
40 | this.hideOnLayout = config.hideOnLayout || false; | 37 | this.hideOnLayout = config.hideOnLayout || false; |
41 | 38 | ||
42 | element = YAHOO.ext.Element.get(container); | 39 | element = YAHOO.ext.Element.get(container); |
43 | element.setStyle('position', 'absolute'); | 40 | element.setStyle('position', 'absolute'); |
44 | element.setStyle('overflow', 'hidden'); | 41 | element.setStyle('overflow', 'hidden'); |
45 | 42 | ||
46 | for (regionName in config.regions) { | 43 | for (regionName in config.regions) { |
47 | var newRegion; | 44 | var newRegion; |
48 | 45 | ||
49 | newRegion = new new Clipperz.YUI.IBLayoutRegion(this, regionName, config.regions[regionName]); | 46 | newRegion = new new Clipperz.YUI.IBLayoutRegion(this, regionName, config.regions[regionName]); |
50 | this.addRegion(regionName, newRegion); | 47 | this.addRegion(regionName, newRegion); |
51 | } | 48 | } |
52 | 49 | ||
53 | this.layout(); | 50 | this.layout(); |
54 | }; | 51 | }; |
55 | 52 | ||
56 | YAHOO.extendX(Clipperz.YUI.IBLayoutManager, YAHOO.ext.LayoutManager, { | 53 | YAHOO.extendX(Clipperz.YUI.IBLayoutManager, YAHOO.ext.LayoutManager, { |
57 | 54 | ||
58 | 'toString': function() { | 55 | 'toString': function() { |
59 | return "IBLayoutManager (" + this.el.id + ")"; | 56 | return "IBLayoutManager (" + this.el.id + ")"; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //----------------------------------------------------- | 59 | //----------------------------------------------------- |
63 | 60 | ||
64 | 'add': function(aName, aPanel) { | 61 | 'add': function(aName, aPanel) { |
65 | var regionName; | 62 | var regionName; |
66 | 63 | ||
67 | regionName = aName.toLowerCase(); | 64 | regionName = aName.toLowerCase(); |
68 | return this.regions[regionName].add(aPanel); | 65 | return this.regions[regionName].add(aPanel); |
69 | }, | 66 | }, |
70 | 67 | ||
71 | //----------------------------------------------------- | 68 | //----------------------------------------------------- |
72 | 69 | ||
73 | 'addRegion': function(aRegion) { | 70 | 'addRegion': function(aRegion) { |
74 | var regionName; | 71 | var regionName; |
75 | 72 | ||
76 | regionName = aRegion.name().toLowerCase(); | 73 | regionName = aRegion.name().toLowerCase(); |
77 | if (!this.regions[regionName]) { | 74 | if (!this.regions[regionName]) { |
78 | //MochiKit.Logging.logDebug("--- adding region with name: " + aRegion.name()); | 75 | //MochiKit.Logging.logDebug("--- adding region with name: " + aRegion.name()); |
79 | this.regions[regionName] = aRegion; | 76 | this.regions[regionName] = aRegion; |
80 | } else { | 77 | } else { |
81 | // ???? | 78 | // ???? |
82 | } | 79 | } |
83 | 80 | ||
84 | return aRegion; | 81 | return aRegion; |
85 | }, | 82 | }, |
86 | 83 | ||
87 | //----------------------------------------------------- | 84 | //----------------------------------------------------- |
88 | 85 | ||
89 | 'getRegion': function(target){ | 86 | 'getRegion': function(target){ |
90 | return this.regions[target.toLowerCase()]; | 87 | return this.regions[target.toLowerCase()]; |
91 | }, | 88 | }, |
92 | 89 | ||
93 | //----------------------------------------------------- | 90 | //----------------------------------------------------- |
94 | 91 | ||
95 | 'layout': function(){ | 92 | 'layout': function(){ |
96 | varregion; | 93 | varregion; |
97 | 94 | ||
98 | //MochiKit.Logging.logDebug(">>> IBLayoutManager.layout - regions: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.regions))); | 95 | //MochiKit.Logging.logDebug(">>> IBLayoutManager.layout - regions: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.regions))); |
99 | for (region in this.regions) { | 96 | for (region in this.regions) { |
100 | //MochiKit.Logging.logDebug("--- IBLayoutManager.layout - region: " + region); | 97 | //MochiKit.Logging.logDebug("--- IBLayoutManager.layout - region: " + region); |
101 | this.regions[region].layout(); | 98 | this.regions[region].layout(); |
102 | } | 99 | } |
103 | //MochiKit.Logging.logDebug("<<< IBLayoutManager.layout"); | 100 | //MochiKit.Logging.logDebug("<<< IBLayoutManager.layout"); |
104 | }, | 101 | }, |
105 | 102 | ||
106 | //----------------------------------------------------- | 103 | //----------------------------------------------------- |
107 | 104 | ||
108 | 'getSize': function() { | 105 | 'getSize': function() { |
109 | return this.el.getSize(); | 106 | return this.el.getSize(); |
110 | }, | 107 | }, |
111 | 108 | ||
112 | //----------------------------------------------------- | 109 | //----------------------------------------------------- |
113 | __syntaxFix__: '__syntaxFix__' | 110 | __syntaxFix__: '__syntaxFix__' |
114 | }); | 111 | }); |
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js index 2fd4377..f8e0cb1 100644 --- a/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js +++ b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js | |||
@@ -1,249 +1,246 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
31 | 28 | ||
32 | 29 | ||
33 | Clipperz.YUI.IBLayoutRegion = function(aManager, aName, aConfig) { | 30 | Clipperz.YUI.IBLayoutRegion = function(aManager, aName, aConfig) { |
34 | this._configuration = aConfig; | 31 | this._configuration = aConfig; |
35 | 32 | ||
36 | //Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(); | 33 | //Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(); |
37 | Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(this, aManager, aConfig, aName); | 34 | Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(this, aManager, aConfig, aName); |
38 | }; | 35 | }; |
39 | 36 | ||
40 | YAHOO.extendX(Clipperz.YUI.IBLayoutRegion, YAHOO.ext.LayoutRegion, { | 37 | YAHOO.extendX(Clipperz.YUI.IBLayoutRegion, YAHOO.ext.LayoutRegion, { |
41 | 38 | ||
42 | 'toString': function() { | 39 | 'toString': function() { |
43 | return "IBLayoutRegion (" + this.name() + ")"; | 40 | return "IBLayoutRegion (" + this.name() + ")"; |
44 | }, | 41 | }, |
45 | 42 | ||
46 | //----------------------------------------------------- | 43 | //----------------------------------------------------- |
47 | 44 | ||
48 | 'name': function() { | 45 | 'name': function() { |
49 | return this.position; | 46 | return this.position; |
50 | }, | 47 | }, |
51 | 48 | ||
52 | //----------------------------------------------------- | 49 | //----------------------------------------------------- |
53 | 50 | ||
54 | 'manager': function() { | 51 | 'manager': function() { |
55 | return this.mgr; | 52 | return this.mgr; |
56 | }, | 53 | }, |
57 | 54 | ||
58 | 'configuration': function() { | 55 | 'configuration': function() { |
59 | return this._configuration; | 56 | return this._configuration; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //----------------------------------------------------- | 59 | //----------------------------------------------------- |
63 | 60 | ||
64 | 'getAttributeValue': function(anAttribute) { | 61 | 'getAttributeValue': function(anAttribute) { |
65 | var result; | 62 | var result; |
66 | 63 | ||
67 | switch(anAttribute) { | 64 | switch(anAttribute) { |
68 | case "top": | 65 | case "top": |
69 | result = this.element().getTop(); | 66 | result = this.element().getTop(); |
70 | break; | 67 | break; |
71 | case "left": | 68 | case "left": |
72 | result = this.element().getLeft(); | 69 | result = this.element().getLeft(); |
73 | break; | 70 | break; |
74 | case "bottom": | 71 | case "bottom": |
75 | result = this.element().getBottom(); | 72 | result = this.element().getBottom(); |
76 | break; | 73 | break; |
77 | case "right": | 74 | case "right": |
78 | result = this.element().getRight(); | 75 | result = this.element().getRight(); |
79 | break; | 76 | break; |
80 | case "height": | 77 | case "height": |
81 | result = this.element().getHeight(); | 78 | result = this.element().getHeight(); |
82 | break; | 79 | break; |
83 | case "width": | 80 | case "width": |
84 | result = this.element().getWidth(); | 81 | result = this.element().getWidth(); |
85 | break; | 82 | break; |
86 | } | 83 | } |
87 | //MochiKit.Logging.logDebug("--- " + this.name() + " [" + anAttribute + "] = " + result); | 84 | //MochiKit.Logging.logDebug("--- " + this.name() + " [" + anAttribute + "] = " + result); |
88 | 85 | ||
89 | return result; | 86 | return result; |
90 | }, | 87 | }, |
91 | 88 | ||
92 | //----------------------------------------------------- | 89 | //----------------------------------------------------- |
93 | 90 | ||
94 | 'normalizeConfigureValue': function(aConfigurationValue) { | 91 | 'normalizeConfigureValue': function(aConfigurationValue) { |
95 | var result; | 92 | var result; |
96 | 93 | ||
97 | //MochiKit.Logging.logDebug("--- normalizeConfigureValue - " + aConfigurationValue); | 94 | //MochiKit.Logging.logDebug("--- normalizeConfigureValue - " + aConfigurationValue); |
98 | if (typeof(aConfigurationValue) == 'number') { | 95 | if (typeof(aConfigurationValue) == 'number') { |
99 | result = aConfigurationValue; | 96 | result = aConfigurationValue; |
100 | } else if (aConfigurationValue == 'auto') { | 97 | } else if (aConfigurationValue == 'auto') { |
101 | result = aConfigurationValue; | 98 | result = aConfigurationValue; |
102 | } else { | 99 | } else { |
103 | var splitValues; | 100 | var splitValues; |
104 | var referenceValue; | 101 | var referenceValue; |
105 | var deltaValue; | 102 | var deltaValue; |
106 | var targetRegion; | 103 | var targetRegion; |
107 | var targetAttribute; | 104 | var targetAttribute; |
108 | 105 | ||
109 | splitValues = aConfigurationValue.split('+'); | 106 | splitValues = aConfigurationValue.split('+'); |
110 | referenceValue = Clipperz.Base.trim(splitValues[0]); | 107 | referenceValue = Clipperz.Base.trim(splitValues[0]); |
111 | deltaValue = Clipperz.Base.trim(splitValues[1] || ""); | 108 | deltaValue = Clipperz.Base.trim(splitValues[1] || ""); |
112 | 109 | ||
113 | splitValues = referenceValue.split('.'); | 110 | splitValues = referenceValue.split('.'); |
114 | targetRegion = splitValues[0]; | 111 | targetRegion = splitValues[0]; |
115 | targetAttribute = splitValues[1]; | 112 | targetAttribute = splitValues[1]; |
116 | 113 | ||
117 | //MochiKit.Logging.logDebug("> " + aConfigurationValue); | 114 | //MochiKit.Logging.logDebug("> " + aConfigurationValue); |
118 | //MochiKit.Logging.logDebug(">> manager: " + this.manager()); | 115 | //MochiKit.Logging.logDebug(">> manager: " + this.manager()); |
119 | //MochiKit.Logging.logDebug(">> targetRegion: " + targetRegion); | 116 | //MochiKit.Logging.logDebug(">> targetRegion: " + targetRegion); |
120 | //MochiKit.Logging.logDebug(">>> " + this.manager().getRegion(targetRegion)); | 117 | //MochiKit.Logging.logDebug(">>> " + this.manager().getRegion(targetRegion)); |
121 | targetValue = this.manager().getRegion(targetRegion).getAttributeValue(targetAttribute); | 118 | targetValue = this.manager().getRegion(targetRegion).getAttributeValue(targetAttribute); |
122 | //MochiKit.Logging.logDebug(">>>> " + targetRegion + "." + targetAttribute + " + " + deltaValue + " = " + targetValue); | 119 | //MochiKit.Logging.logDebug(">>>> " + targetRegion + "." + targetAttribute + " + " + deltaValue + " = " + targetValue); |
123 | 120 | ||
124 | result = targetValue + (deltaValue - 0); | 121 | result = targetValue + (deltaValue - 0); |
125 | 122 | ||
126 | //MochiKit.Logging.logDebug("<<< " + aConfigurationValue + " = " + result); | 123 | //MochiKit.Logging.logDebug("<<< " + aConfigurationValue + " = " + result); |
127 | } | 124 | } |
128 | 125 | ||
129 | return result; | 126 | return result; |
130 | }, | 127 | }, |
131 | 128 | ||
132 | 'normalizedConfiguration': function(aConfiguration) { | 129 | 'normalizedConfiguration': function(aConfiguration) { |
133 | varresult; | 130 | varresult; |
134 | varkey; | 131 | varkey; |
135 | 132 | ||
136 | result = {}; | 133 | result = {}; |
137 | 134 | ||
138 | //MochiKit.Logging.logDebug("--- normalizedConfiguration - keys: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(aConfiguration))); | 135 | //MochiKit.Logging.logDebug("--- normalizedConfiguration - keys: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(aConfiguration))); |
139 | for (key in aConfiguration) { | 136 | for (key in aConfiguration) { |
140 | if ((key == 'top') || (key == 'bottom') || (key == 'left') || (key == 'rigth') || (key == 'width') || (key == 'height')) { | 137 | if ((key == 'top') || (key == 'bottom') || (key == 'left') || (key == 'rigth') || (key == 'width') || (key == 'height')) { |
141 | result[key] = this.normalizeConfigureValue(aConfiguration[key]); | 138 | result[key] = this.normalizeConfigureValue(aConfiguration[key]); |
142 | } else { | 139 | } else { |
143 | result[key] = aConfiguration[key]; | 140 | result[key] = aConfiguration[key]; |
144 | } | 141 | } |
145 | } | 142 | } |
146 | 143 | ||
147 | return result; | 144 | return result; |
148 | }, | 145 | }, |
149 | 146 | ||
150 | //----------------------------------------------------- | 147 | //----------------------------------------------------- |
151 | 148 | ||
152 | 'element': function() { | 149 | 'element': function() { |
153 | return this.el; | 150 | return this.el; |
154 | }, | 151 | }, |
155 | 152 | ||
156 | //----------------------------------------------------- | 153 | //----------------------------------------------------- |
157 | /* | 154 | /* |
158 | 'hide': function() { | 155 | 'hide': function() { |
159 | MochiKit.Logging.logDebug(">>> IBLayoutManager.hide()") | 156 | MochiKit.Logging.logDebug(">>> IBLayoutManager.hide()") |
160 | Clipperz.YUI.IBLayoutRegion.superclass.hide.call(this); | 157 | Clipperz.YUI.IBLayoutRegion.superclass.hide.call(this); |
161 | }, | 158 | }, |
162 | */ | 159 | */ |
163 | //----------------------------------------------------- | 160 | //----------------------------------------------------- |
164 | /* | 161 | /* |
165 | 'add': function(aPanel) { | 162 | 'add': function(aPanel) { |
166 | Clipperz.YUI.IBLayoutRegion.superclass.add.call(this, aPanel); | 163 | Clipperz.YUI.IBLayoutRegion.superclass.add.call(this, aPanel); |
167 | aPanel.el.fitToParent(true); | 164 | aPanel.el.fitToParent(true); |
168 | }, | 165 | }, |
169 | */ | 166 | */ |
170 | //----------------------------------------------------- | 167 | //----------------------------------------------------- |
171 | 168 | ||
172 | 'updateBox': function(aBox) { | 169 | 'updateBox': function(aBox) { |
173 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.updateBox - " + aBox); | 170 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.updateBox - " + aBox); |
174 | Clipperz.YUI.IBLayoutRegion.superclass.updateBox.call(this, aBox); | 171 | Clipperz.YUI.IBLayoutRegion.superclass.updateBox.call(this, aBox); |
175 | }, | 172 | }, |
176 | 173 | ||
177 | //----------------------------------------------------- | 174 | //----------------------------------------------------- |
178 | 175 | ||
179 | 'layout': function() { | 176 | 'layout': function() { |
180 | vartop, left, bottom, right, width, height; | 177 | vartop, left, bottom, right, width, height; |
181 | varelement; | 178 | varelement; |
182 | var config; | 179 | var config; |
183 | var windowSize; | 180 | var windowSize; |
184 | var containerSize; | 181 | var containerSize; |
185 | 182 | ||
186 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.layout - " + this); | 183 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.layout - " + this); |
187 | config = this.normalizedConfiguration(this.configuration()); | 184 | config = this.normalizedConfiguration(this.configuration()); |
188 | element = this.element(); | 185 | element = this.element(); |
189 | // containerSize = this.manager().getSize(true); | 186 | // containerSize = this.manager().getSize(true); |
190 | containerSize = this.manager().getSize(false); | 187 | containerSize = this.manager().getSize(false); |
191 | windowSize = {width: YAHOO.util.Dom.getViewportWidth(), height: YAHOO.util.Dom.getViewportHeight()}; | 188 | windowSize = {width: YAHOO.util.Dom.getViewportWidth(), height: YAHOO.util.Dom.getViewportHeight()}; |
192 | 189 | ||
193 | // element.setStyle("position", "absolute"); | 190 | // element.setStyle("position", "absolute"); |
194 | // element.setStyle("overflow", "none"); | 191 | // element.setStyle("overflow", "none"); |
195 | 192 | ||
196 | if (typeof(config.top) == 'number') { | 193 | if (typeof(config.top) == 'number') { |
197 | top = config.top; | 194 | top = config.top; |
198 | 195 | ||
199 | if (typeof(config.bottom) == 'number') { | 196 | if (typeof(config.bottom) == 'number') { |
200 | height = containerSize.height - top - config.bottom; | 197 | height = containerSize.height - top - config.bottom; |
201 | } else if (typeof(config.height) == 'number') { | 198 | } else if (typeof(config.height) == 'number') { |
202 | height = config.height; | 199 | height = config.height; |
203 | } else { | 200 | } else { |
204 | //??? | 201 | //??? |
205 | } | 202 | } |
206 | } else { | 203 | } else { |
207 | if ((typeof(config.bottom) == 'number') && (typeof(config.height) == 'number')) { | 204 | if ((typeof(config.bottom) == 'number') && (typeof(config.height) == 'number')) { |
208 | top = containerSize.height - (config.height + config.bottom); | 205 | top = containerSize.height - (config.height + config.bottom); |
209 | height = config.height; | 206 | height = config.height; |
210 | } else if ((config.bottom == 'auto') && (typeof(config.height) == 'number')) { | 207 | } else if ((config.bottom == 'auto') && (typeof(config.height) == 'number')) { |
211 | top = ((containerSize.height - config.height) / 2); | 208 | top = ((containerSize.height - config.height) / 2); |
212 | height = config.height; | 209 | height = config.height; |
213 | } | 210 | } |
214 | } | 211 | } |
215 | 212 | ||
216 | if (typeof(config.left) == 'number') { | 213 | if (typeof(config.left) == 'number') { |
217 | left = config.left; | 214 | left = config.left; |
218 | 215 | ||
219 | if (typeof(config.right) == 'number') { | 216 | if (typeof(config.right) == 'number') { |
220 | width = (containerSize.width - left - config.right); | 217 | width = (containerSize.width - left - config.right); |
221 | } else if (typeof(config.width) == 'number') { | 218 | } else if (typeof(config.width) == 'number') { |
222 | width = config.width; | 219 | width = config.width; |
223 | } else { | 220 | } else { |
224 | //??? | 221 | //??? |
225 | } | 222 | } |
226 | } else { | 223 | } else { |
227 | if ((typeof(config.right) == 'number') && (typeof(config.width) == 'number')) { | 224 | if ((typeof(config.right) == 'number') && (typeof(config.width) == 'number')) { |
228 | left = containerSize.width - (config.width + config.right); | 225 | left = containerSize.width - (config.width + config.right); |
229 | width = config.width; | 226 | width = config.width; |
230 | } else if ((config.right == 'auto') && (typeof(config.width) == 'number')) { | 227 | } else if ((config.right == 'auto') && (typeof(config.width) == 'number')) { |
231 | left = ((containerSize.width - config.width) / 2); | 228 | left = ((containerSize.width - config.width) / 2); |
232 | width = config.width; | 229 | width = config.width; |
233 | } | 230 | } |
234 | } | 231 | } |
235 | //MochiKit.Logging.logDebug("--- setting position (top: " + top + ", left: " + left + ", width: " + width + ", height: " + height + ")"); | 232 | //MochiKit.Logging.logDebug("--- setting position (top: " + top + ", left: " + left + ", width: " + width + ", height: " + height + ")"); |
236 | element.setTop(top); | 233 | element.setTop(top); |
237 | element.setLeft(left); | 234 | element.setLeft(left); |
238 | element.setWidth(width); | 235 | element.setWidth(width); |
239 | element.setHeight(height); | 236 | element.setHeight(height); |
240 | 237 | ||
241 | if (this.activePanel != null) { | 238 | if (this.activePanel != null) { |
242 | this.activePanel.setSize(width, height); | 239 | this.activePanel.setSize(width, height); |
243 | } | 240 | } |
244 | //MochiKit.Logging.logDebug("<<< IBLayoutRegion.layout"); | 241 | //MochiKit.Logging.logDebug("<<< IBLayoutRegion.layout"); |
245 | }, | 242 | }, |
246 | 243 | ||
247 | //----------------------------------------------------- | 244 | //----------------------------------------------------- |
248 | __syntaxFix__: '__syntaxFix__' | 245 | __syntaxFix__: '__syntaxFix__' |
249 | }); | 246 | }); |
diff --git a/frontend/beta/js/Clipperz/YUI/MessageBox.js b/frontend/beta/js/Clipperz/YUI/MessageBox.js index ec33d7d..c7b4702 100644 --- a/frontend/beta/js/Clipperz/YUI/MessageBox.js +++ b/frontend/beta/js/Clipperz/YUI/MessageBox.js | |||
@@ -1,265 +1,262 @@ | |||
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 | Clipperz.YUI.MessageBox = function(){ | 26 | Clipperz.YUI.MessageBox = function(){ |
30 | var dlg, opt, mask; | 27 | var dlg, opt, mask; |
31 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; | 28 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; |
32 | var buttons, activeTextEl, bwidth; | 29 | var buttons, activeTextEl, bwidth; |
33 | 30 | ||
34 | var handleButton = function(button){ | 31 | var handleButton = function(button){ |
35 | if(typeof opt.fn == 'function'){ | 32 | if(typeof opt.fn == 'function'){ |
36 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ | 33 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ |
37 | dlg.hide(); | 34 | dlg.hide(); |
38 | } | 35 | } |
39 | }else{ | 36 | }else{ |
40 | dlg.hide(); | 37 | dlg.hide(); |
41 | } | 38 | } |
42 | }; | 39 | }; |
43 | 40 | ||
44 | return { | 41 | return { |
45 | updateButtons: function(b){ | 42 | updateButtons: function(b){ |
46 | var width = 0; | 43 | var width = 0; |
47 | if(!b){ | 44 | if(!b){ |
48 | buttons['ok'].hide(); | 45 | buttons['ok'].hide(); |
49 | buttons['cancel'].hide(); | 46 | buttons['cancel'].hide(); |
50 | buttons['yes'].hide(); | 47 | buttons['yes'].hide(); |
51 | buttons['no'].hide(); | 48 | buttons['no'].hide(); |
52 | return width; | 49 | return width; |
53 | } | 50 | } |
54 | for(var k in buttons){ | 51 | for(var k in buttons){ |
55 | if(typeof buttons[k] != 'function'){ | 52 | if(typeof buttons[k] != 'function'){ |
56 | if(b[k]){ | 53 | if(b[k]){ |
57 | buttons[k].show(); | 54 | buttons[k].show(); |
58 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); | 55 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); |
59 | width += buttons[k].el.getWidth()+15; | 56 | width += buttons[k].el.getWidth()+15; |
60 | }else{ | 57 | }else{ |
61 | buttons[k].hide(); | 58 | buttons[k].hide(); |
62 | } | 59 | } |
63 | } | 60 | } |
64 | } | 61 | } |
65 | return width; | 62 | return width; |
66 | }, | 63 | }, |
67 | 64 | ||
68 | getDialog : function(){ | 65 | getDialog : function(){ |
69 | if(!dlg){ | 66 | if(!dlg){ |
70 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { | 67 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { |
71 | autoCreate:true, | 68 | autoCreate:true, |
72 | shadow:true, | 69 | shadow:true, |
73 | draggable:true, | 70 | draggable:true, |
74 | resizable:false, | 71 | resizable:false, |
75 | constraintoviewport:true, | 72 | constraintoviewport:true, |
76 | fixedcenter:true, | 73 | fixedcenter:true, |
77 | shim:true, | 74 | shim:true, |
78 | modal:true, | 75 | modal:true, |
79 | width:400, height:100, | 76 | width:400, height:100, |
80 | buttonAlign:'center', | 77 | buttonAlign:'center', |
81 | closeClick : function(){ | 78 | closeClick : function(){ |
82 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ | 79 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ |
83 | handleButton('no'); | 80 | handleButton('no'); |
84 | }else{ | 81 | }else{ |
85 | handleButton('cancel'); | 82 | handleButton('cancel'); |
86 | } | 83 | } |
87 | } | 84 | } |
88 | }); | 85 | }); |
89 | dlg.closeClick = function(){ | 86 | dlg.closeClick = function(){ |
90 | alert('wtf'); | 87 | alert('wtf'); |
91 | }; | 88 | }; |
92 | mask = dlg.mask; | 89 | mask = dlg.mask; |
93 | dlg.addKeyListener(27, dlg.hide, dlg); | 90 | dlg.addKeyListener(27, dlg.hide, dlg); |
94 | buttons = {}; | 91 | buttons = {}; |
95 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); | 92 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); |
96 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); | 93 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); |
97 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); | 94 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); |
98 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); | 95 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); |
99 | bodyEl = dlg.body.createChild({ | 96 | bodyEl = dlg.body.createChild({ |
100 | tag:'div', | 97 | tag:'div', |
101 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' | 98 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' |
102 | }); | 99 | }); |
103 | msgEl = bodyEl.dom.firstChild; | 100 | msgEl = bodyEl.dom.firstChild; |
104 | textboxEl = getEl(bodyEl.dom.childNodes[2]); | 101 | textboxEl = getEl(bodyEl.dom.childNodes[2]); |
105 | textboxEl.enableDisplayMode(); | 102 | textboxEl.enableDisplayMode(); |
106 | textboxEl.addKeyListener([10,13], function(){ | 103 | textboxEl.addKeyListener([10,13], function(){ |
107 | if(dlg.isVisible() && opt && opt.buttons){ | 104 | if(dlg.isVisible() && opt && opt.buttons){ |
108 | if(opt.buttons.ok){ | 105 | if(opt.buttons.ok){ |
109 | handleButton('ok'); | 106 | handleButton('ok'); |
110 | }else if(opt.buttons.yes){ | 107 | }else if(opt.buttons.yes){ |
111 | handleButton('yes'); | 108 | handleButton('yes'); |
112 | } | 109 | } |
113 | } | 110 | } |
114 | }); | 111 | }); |
115 | textareaEl = getEl(bodyEl.dom.childNodes[3]); | 112 | textareaEl = getEl(bodyEl.dom.childNodes[3]); |
116 | textareaEl.enableDisplayMode(); | 113 | textareaEl.enableDisplayMode(); |
117 | progressEl = getEl(bodyEl.dom.childNodes[4]); | 114 | progressEl = getEl(bodyEl.dom.childNodes[4]); |
118 | progressEl.enableDisplayMode(); | 115 | progressEl.enableDisplayMode(); |
119 | pp = getEl(progressEl.dom.firstChild.firstChild); | 116 | pp = getEl(progressEl.dom.firstChild.firstChild); |
120 | } | 117 | } |
121 | return dlg; | 118 | return dlg; |
122 | }, | 119 | }, |
123 | 120 | ||
124 | updateText : function(text){ | 121 | updateText : function(text){ |
125 | if(!dlg.isVisible() && !opt.width){ | 122 | if(!dlg.isVisible() && !opt.width){ |
126 | dlg.resizeTo(this.maxWidth, 100); // resize first so content is never clipped from previous shows | 123 | dlg.resizeTo(this.maxWidth, 100); // resize first so content is never clipped from previous shows |
127 | } | 124 | } |
128 | msgEl.innerHTML = text; | 125 | msgEl.innerHTML = text; |
129 | var w = Math.max(Math.min(opt.width || msgEl.offsetWidth, this.maxWidth), | 126 | var w = Math.max(Math.min(opt.width || msgEl.offsetWidth, this.maxWidth), |
130 | Math.max(opt.minWidth || this.minWidth, bwidth)); | 127 | Math.max(opt.minWidth || this.minWidth, bwidth)); |
131 | if(opt.prompt){ | 128 | if(opt.prompt){ |
132 | activeTextEl.setWidth(w); | 129 | activeTextEl.setWidth(w); |
133 | } | 130 | } |
134 | dlg.setContentSize(w, bodyEl.getHeight()); | 131 | dlg.setContentSize(w, bodyEl.getHeight()); |
135 | }, | 132 | }, |
136 | 133 | ||
137 | updateProgress : function(value, text){ | 134 | updateProgress : function(value, text){ |
138 | if(text){ | 135 | if(text){ |
139 | this.updateText(text); | 136 | this.updateText(text); |
140 | } | 137 | } |
141 | pp.setWidth(value*progressEl.dom.firstChild.offsetWidth); | 138 | pp.setWidth(value*progressEl.dom.firstChild.offsetWidth); |
142 | }, | 139 | }, |
143 | 140 | ||
144 | isVisible : function(){ | 141 | isVisible : function(){ |
145 | return dlg && dlg.isVisible(); | 142 | return dlg && dlg.isVisible(); |
146 | }, | 143 | }, |
147 | 144 | ||
148 | hide : function(){ | 145 | hide : function(){ |
149 | if(this.isVisible()){ | 146 | if(this.isVisible()){ |
150 | dlg.hide(); | 147 | dlg.hide(); |
151 | } | 148 | } |
152 | }, | 149 | }, |
153 | 150 | ||
154 | show : function(options){ | 151 | show : function(options){ |
155 | var d = this.getDialog(); | 152 | var d = this.getDialog(); |
156 | opt = options; | 153 | opt = options; |
157 | d.setTitle(opt.title || ' '); | 154 | d.setTitle(opt.title || ' '); |
158 | d.close.setDisplayed(opt.closable !== false); | 155 | d.close.setDisplayed(opt.closable !== false); |
159 | activeTextEl = textboxEl; | 156 | activeTextEl = textboxEl; |
160 | opt.prompt = opt.prompt || (opt.multiline ? true : false) | 157 | opt.prompt = opt.prompt || (opt.multiline ? true : false) |
161 | if(opt.prompt){ | 158 | if(opt.prompt){ |
162 | if(opt.multiline){ | 159 | if(opt.multiline){ |
163 | textboxEl.hide(); | 160 | textboxEl.hide(); |
164 | textareaEl.show(); | 161 | textareaEl.show(); |
165 | textareaEl.setHeight(typeof opt.multiline == 'number' ? | 162 | textareaEl.setHeight(typeof opt.multiline == 'number' ? |
166 | opt.multiline : this.defaultTextHeight); | 163 | opt.multiline : this.defaultTextHeight); |
167 | activeTextEl = textareaEl; | 164 | activeTextEl = textareaEl; |
168 | }else{ | 165 | }else{ |
169 | textboxEl.show(); | 166 | textboxEl.show(); |
170 | textareaEl.hide(); | 167 | textareaEl.hide(); |
171 | } | 168 | } |
172 | }else{ | 169 | }else{ |
173 | textboxEl.hide(); | 170 | textboxEl.hide(); |
174 | textareaEl.hide(); | 171 | textareaEl.hide(); |
175 | } | 172 | } |
176 | progressEl.setDisplayed(opt.progress === true); | 173 | progressEl.setDisplayed(opt.progress === true); |
177 | this.updateProgress(0); | 174 | this.updateProgress(0); |
178 | activeTextEl.dom.value = opt.value || ''; | 175 | activeTextEl.dom.value = opt.value || ''; |
179 | if(opt.prompt){ | 176 | if(opt.prompt){ |
180 | dlg.setDefaultButton(activeTextEl); | 177 | dlg.setDefaultButton(activeTextEl); |
181 | }else{ | 178 | }else{ |
182 | var bs = opt.buttons; | 179 | var bs = opt.buttons; |
183 | var db = null; | 180 | var db = null; |
184 | if(bs && bs.ok){ | 181 | if(bs && bs.ok){ |
185 | db = buttons['ok']; | 182 | db = buttons['ok']; |
186 | }else if(bs && bs.yes){ | 183 | }else if(bs && bs.yes){ |
187 | db = buttons['yes']; | 184 | db = buttons['yes']; |
188 | } | 185 | } |
189 | dlg.setDefaultButton(db); | 186 | dlg.setDefaultButton(db); |
190 | } | 187 | } |
191 | bwidth = this.updateButtons(opt.buttons); | 188 | bwidth = this.updateButtons(opt.buttons); |
192 | this.updateText(opt.msg); | 189 | this.updateText(opt.msg); |
193 | d.modal = opt.modal !== false; | 190 | d.modal = opt.modal !== false; |
194 | d.mask = opt.modal !== false ? mask : false; | 191 | d.mask = opt.modal !== false ? mask : false; |
195 | d.animateTarget = null; | 192 | d.animateTarget = null; |
196 | d.show(options.animEl); | 193 | d.show(options.animEl); |
197 | }, | 194 | }, |
198 | 195 | ||
199 | progress : function(title, msg){ | 196 | progress : function(title, msg){ |
200 | this.show({ | 197 | this.show({ |
201 | title : title, | 198 | title : title, |
202 | msg : msg, | 199 | msg : msg, |
203 | buttons: false, | 200 | buttons: false, |
204 | progress:true, | 201 | progress:true, |
205 | closable:false | 202 | closable:false |
206 | }); | 203 | }); |
207 | }, | 204 | }, |
208 | 205 | ||
209 | progressElement : function() { | 206 | progressElement : function() { |
210 | return progressEl; | 207 | return progressEl; |
211 | }, | 208 | }, |
212 | 209 | ||
213 | opt: function() { | 210 | opt: function() { |
214 | return opt; | 211 | return opt; |
215 | }, | 212 | }, |
216 | 213 | ||
217 | alert : function(title, msg, fn, scope){ | 214 | alert : function(title, msg, fn, scope){ |
218 | this.show({ | 215 | this.show({ |
219 | title : title, | 216 | title : title, |
220 | msg : msg, | 217 | msg : msg, |
221 | buttons: this.OK, | 218 | buttons: this.OK, |
222 | fn: fn, | 219 | fn: fn, |
223 | scope : scope | 220 | scope : scope |
224 | }); | 221 | }); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | confirm : function(title, msg, fn, scope){ | 224 | confirm : function(title, msg, fn, scope){ |
228 | this.show({ | 225 | this.show({ |
229 | title : title, | 226 | title : title, |
230 | msg : msg, | 227 | msg : msg, |
231 | buttons: this.YESNO, | 228 | buttons: this.YESNO, |
232 | fn: fn, | 229 | fn: fn, |
233 | scope : scope | 230 | scope : scope |
234 | }); | 231 | }); |
235 | }, | 232 | }, |
236 | 233 | ||
237 | prompt : function(title, msg, fn, scope, multiline){ | 234 | prompt : function(title, msg, fn, scope, multiline){ |
238 | this.show({ | 235 | this.show({ |
239 | title : title, | 236 | title : title, |
240 | msg : msg, | 237 | msg : msg, |
241 | buttons: this.OKCANCEL, | 238 | buttons: this.OKCANCEL, |
242 | fn: fn, | 239 | fn: fn, |
243 | minWidth:250, | 240 | minWidth:250, |
244 | scope : scope, | 241 | scope : scope, |
245 | prompt:true, | 242 | prompt:true, |
246 | multiline: multiline | 243 | multiline: multiline |
247 | }); | 244 | }); |
248 | }, | 245 | }, |
249 | 246 | ||
250 | OK : {ok:true}, | 247 | OK : {ok:true}, |
251 | YESNO : {yes:true, no:true}, | 248 | YESNO : {yes:true, no:true}, |
252 | OKCANCEL : {ok:true, cancel:true}, | 249 | OKCANCEL : {ok:true, cancel:true}, |
253 | YESNOCANCEL : {yes:true, no:true, cancel:true}, | 250 | YESNOCANCEL : {yes:true, no:true, cancel:true}, |
254 | 251 | ||
255 | defaultTextHeight:75, | 252 | defaultTextHeight:75, |
256 | maxWidth : 500, | 253 | maxWidth : 500, |
257 | minWidth : 100, | 254 | minWidth : 100, |
258 | buttonText : { | 255 | buttonText : { |
259 | ok : 'OK', | 256 | ok : 'OK', |
260 | cancel : 'Cancel', | 257 | cancel : 'Cancel', |
261 | yes : 'Yes', | 258 | yes : 'Yes', |
262 | no : 'No' | 259 | no : 'No' |
263 | } | 260 | } |
264 | }; | 261 | }; |
265 | }(); | 262 | }(); |