]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/reports/xul/xulbuilder.js
LP1642337: Reporter Boolean Filters
[Evergreen.git] / Open-ILS / web / reports / xul / xulbuilder.js
1 function createComplexHTMLElement (e, attrs, objects, text) {
2         var l = document.createElementNS('http://www.w3.org/1999/xhtml',e);
3
4         if (attrs) {
5                 for (var i in attrs) l.setAttribute(i,attrs[i]);
6         }
7
8         if (objects) {
9                 for ( var i in objects ) l.appendChild( objects[i] );
10         }
11
12         if (text) {
13                 l.appendChild( document.createTextNode(text) )
14         }
15
16         return l;
17 }
18
19 function createComplexXULElement (e, attrs, objects) {
20         var l = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul',e);
21
22         if (attrs) {
23                 for (var i in attrs) {
24                         if (typeof attrs[i] == 'function') {
25                                 l.addEventListener( i, attrs[i], true );
26                         } else {
27                                 l.setAttribute(i,attrs[i]);
28                         }
29                 }
30         }
31
32         if (objects) {
33                 for ( var i in objects ) l.appendChild( objects[i] );
34         }
35
36         return l;
37 }
38
39 function createDescription (attrs) {
40         return createComplexXULElement('description', attrs, Array.prototype.slice.apply(arguments, [1]) );
41 }
42
43 function createTooltip (attrs) {
44         return createComplexXULElement('tooltip', attrs, Array.prototype.slice.apply(arguments, [1]) );
45 }
46
47 function createLabel (attrs) {
48         return createComplexXULElement('label', attrs, Array.prototype.slice.apply(arguments, [1]) );
49 }
50
51 function createVbox (attrs) {
52         return createComplexXULElement('vbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
53 }
54
55 function createHbox (attrs) {
56         return createComplexXULElement('hbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
57 }
58
59 function createRow (attrs) {
60         return createComplexXULElement('row', attrs, Array.prototype.slice.apply(arguments, [1]) );
61 }
62
63 function createTextbox (attrs) {
64         return createComplexXULElement('textbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
65 }
66
67 function createCheckbox (attrs) {
68         return createComplexXULElement('checkbox', attrs, Array.prototype.slice.apply(arguments, [1]) );
69 }
70
71 function createTreeChildren (attrs) {
72         return createComplexXULElement('treechildren', attrs, Array.prototype.slice.apply(arguments, [1]) );
73 }
74
75 function createTreeItem (attrs) {
76         return createComplexXULElement('treeitem', attrs, Array.prototype.slice.apply(arguments, [1]) );
77 }
78
79 function createTreeRow (attrs) {
80         return createComplexXULElement('treerow', attrs, Array.prototype.slice.apply(arguments, [1]) );
81 }
82
83 function createTreeCell (attrs) {
84         return createComplexXULElement('treecell', attrs, Array.prototype.slice.apply(arguments, [1]) );
85 }
86
87 function createPopup (attrs) {
88         return createComplexXULElement('popup', attrs, Array.prototype.slice.apply(arguments, [1]) );
89 }
90
91 function createMenuPopup (attrs) {
92         return createComplexXULElement('menupopup', attrs, Array.prototype.slice.apply(arguments, [1]) );
93 }
94
95 function createMenu (attrs) {
96         return createComplexXULElement('menu', attrs, Array.prototype.slice.apply(arguments, [1]) );
97 }
98
99 function createMenuItem (attrs) {
100         return createComplexXULElement('menuitem', attrs, Array.prototype.slice.apply(arguments, [1]) );
101 }
102
103 function createMenuSeparator (attrs) {
104         return createComplexXULElement('menuseparator', attrs, Array.prototype.slice.apply(arguments, [1]) );
105 }
106
107