bzr branch
http://darksoft.org/webbzr/adei/trunk
1
by Suren A. Chilingaryan
Initial import |
1 |
<?php
|
119
by Suren A. Chilingaryan
New way of service handling (mod_rewrite), Various fixups, katrin stuff moved to SETUP directory |
2 |
global $ADEI_TIMINGS; |
3 |
global $EXPORT_SAMPLING_RATES; |
|
4 |
global $EXPORT_FORMATS; |
|
536
by Suren A. Chilingaryan
Allow per-setup customization of ADEI menu |
5 |
global $ADEI_MENU_ICON; |
6 |
global $ADEI_MENU_EXTRA_ITEMS; |
|
119
by Suren A. Chilingaryan
New way of service handling (mod_rewrite), Various fixups, katrin stuff moved to SETUP directory |
7 |
|
8 |
ADEI::RequireClass("export"); |
|
9 |
ADEI::RequireClass("draw"); |
|
1
by Suren A. Chilingaryan
Initial import |
10 |
|
11 |
header("Content-type: text/xml"); |
|
12 |
header("Cache-Control: no-cache, must-revalidate"); |
|
13 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
|
14 |
||
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
15 |
|
16 |
if ($_GET['version'] == 1) { |
|
17 |
$item_tag = "MenuItem"; |
|
18 |
$item_title = "name"; |
|
19 |
$item_image = "src"; |
|
20 |
$separator_tag = "divider"; |
|
21 |
$separator_attrs = ""; |
|
22 |
} else { |
|
23 |
$item_tag = "item"; |
|
24 |
$item_title = "text"; |
|
25 |
$item_image = "img"; |
|
26 |
$separator_tag = "item"; |
|
27 |
$separator_attrs = "type=\"separator\""; |
|
28 |
}
|
|
29 |
||
30 |
||
1
by Suren A. Chilingaryan
Initial import |
31 |
/*
|
32 |
echo "<?xml version='1.0' ?>";
|
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
33 |
echo "<menu maxItems=\"1\" $item_title=\"\">";
|
34 |
echo "<$item_tag $item_title=\"\" src=\"menu.png\" id=\"main_file\" width=\"20px\" withoutImages=\"yes\"/>";
|
|
1
by Suren A. Chilingaryan
Initial import |
35 |
echo "</menu>";
|
36 |
return;
|
|
37 |
*/
|
|
38 |
||
39 |
function ListExperiments(&$list, &$query) { |
|
326
by Suren A. Chilingaryan
Fix the menu problems while experiments are used |
40 |
global $item_tag; |
41 |
global $item_title; |
|
42 |
||
1
by Suren A. Chilingaryan
Initial import |
43 |
foreach ($list as $eid => $exp) { |
44 |
$exp_name = xml_escape($exp["name"]); |
|
45 |
$equery = $query . "__" . $exp['start'] . "-" . $exp['stop']; |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
46 |
$res .= "<$item_tag $item_title=\"$exp_name\" id=\"SetQuery__$equery\"/>"; |
1
by Suren A. Chilingaryan
Initial import |
47 |
}
|
48 |
||
49 |
return $res; |
|
50 |
}
|
|
51 |
||
52 |
try {
|
|
53 |
$req = new REQUEST(); |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
54 |
$list = $req->GetSources(REQUEST::LIST_ALL); |
1
by Suren A. Chilingaryan
Initial import |
55 |
|
56 |
$data = ""; |
|
57 |
$source = ""; |
|
58 |
foreach ($list as $sreq) { |
|
59 |
$src_name = xml_escape($sreq->props['db_server'] . "." . $sreq->props['db_name']); |
|
60 |
$query = $sreq->props['db_server'] . "__" . $sreq->props['db_name']; |
|
61 |
||
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
62 |
try {
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
63 |
$s_data = "<$item_tag $item_title=\"$src_name\" id=\"SetQuery__$query\" withoutImages=\"yes\">"; |
64 |
$s_source = "<$item_tag $item_title=\"$src_name\" id=\"SetSource__$query\" withoutImages=\"yes\">"; |
|
1
by Suren A. Chilingaryan
Initial import |
65 |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
66 |
$reader = $sreq->CreateReader(); |
67 |
$groups = $reader->GetGroupList(); |
|
1
by Suren A. Chilingaryan
Initial import |
68 |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
69 |
$glist = $sreq->GetGroups(); |
70 |
foreach ($glist as $gid => $greq) { |
|
71 |
$group = &$groups[$gid]; |
|
72 |
||
73 |
$gr_name = xml_escape($group['name']); |
|
74 |
$gquery = $query . "__" . $gid; |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
75 |
$s_data .= "<$item_tag $item_title=\"$gr_name\" id=\"SetQuery__$gquery\" withoutImages=\"yes\">"; |
76 |
$s_source .= "<$item_tag $item_title=\"$gr_name\" id=\"SetSource__$gquery\" withoutImages=\"yes\">"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
77 |
|
78 |
$cache = $greq->CreateCache($reader); |
|
79 |
$explist = $cache->GetExperimentList(); |
|
80 |
||
81 |
||
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
82 |
$mlist = $cache->GetMaskList(REQUEST::NEED_INFO); |
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
83 |
foreach ($mlist as $mid => $mask) { |
84 |
$mask_name = xml_escape($mask['name']); |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
85 |
$mquery = $gquery . "__" . $mask['mask']; |
86 |
$s_data .= "<$item_tag $item_title=\"$mask_name\" id=\"SetQuery__$mquery\" withoutImages=\"yes\">"; |
|
87 |
$s_source .= "<$item_tag $item_title=\"$mask_name\" id=\"SetSource__$mquery\"/>"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
88 |
$s_data .= ListExperiments($explist, $mquery); |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
89 |
$s_data .= "</$item_tag>"; |
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
90 |
}
|
91 |
||
92 |
if ($MENU_SHOW_ITEMS) { |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
93 |
$s_data .= "<$item_tag $item_title=\"" . _("Items") . "\" id=\"folder__$gquery\" withoutImages=\"yes\">"; |
94 |
$s_source .= "<$item_tag $item_title=\"" . _("Items") . "\" id=\"folder__$gquery\" withoutImages=\"yes\">"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
95 |
}
|
96 |
||
97 |
$ilist = $cache->GetItemList(); |
|
98 |
unset($aid); |
|
99 |
foreach ($ilist as $iid => &$item) { |
|
100 |
if (isset($aid)) $aid .= ",$iid"; |
|
101 |
else $aid = $iid; |
|
102 |
||
103 |
if ($MENU_SHOW_ITEMS) { |
|
104 |
$item_name = xml_escape($item["name"]); |
|
105 |
$iquery = $gquery . "__" . $iid; |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
106 |
$s_data .= "<$item_tag $item_title=\"$item_name\" id=\"SetQuery__$iquery\" withoutImages=\"yes\">"; |
107 |
$s_source .= "<$item_tag $item_title=\"$item_name\" id=\"SetSource__$iquery\" />"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
108 |
$s_data .= ListExperiments($explist, $iquery); |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
109 |
$s_data .= "</$item_tag>"; |
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
110 |
}
|
111 |
}
|
|
112 |
|
|
1
by Suren A. Chilingaryan
Initial import |
113 |
if ($MENU_SHOW_ITEMS) { |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
114 |
$s_data .= "</$item_tag>"; |
115 |
$s_source .= "</$item_tag>"; |
|
1
by Suren A. Chilingaryan
Initial import |
116 |
}
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
117 |
/*
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
118 |
$aquery = $gquery . "__" . $aid; |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
119 |
$s_data .= "<$item_tag $item_title=\"" . _("All Items") . "\" id=\"SetQuery__$aquery\" withoutImages=\"yes\">"; |
120 |
$s_source .= "<$item_tag $item_title=\"" . _("All Items") . "\" id=\"SetSource__$aquery\" />"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
121 |
$s_data .= ListExperiments($explist, $aquery); |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
122 |
$s_data .= "</$item_tag>"; |
123 |
*/
|
|
124 |
$s_data .= "</$item_tag>"; |
|
125 |
$s_source .= "</$item_tag>"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
126 |
}
|
127 |
||
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
128 |
$s_data .= "</$item_tag>"; |
129 |
$s_source .= "</$item_tag>"; |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
130 |
} catch (ADEIException $ae) { |
131 |
$ae->logInfo(NULL, $req); |
|
132 |
$errmsg = xml_escape($ae->getInfo()); |
|
133 |
||
134 |
$s_data = " |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
135 |
<$item_tag $item_title=\"$src_name\" withoutImages=\"yes\"> |
136 |
<$item_tag $item_title=\"" . translate("Data source is failed, error: %s", $errmsg) . "\" withoutImages=\"yes\"/> |
|
137 |
</$item_tag> |
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
138 |
"; |
139 |
||
140 |
$s_source = $s_data; |
|
1
by Suren A. Chilingaryan
Initial import |
141 |
}
|
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
142 |
|
143 |
$data .= $s_data; |
|
144 |
$source .= $s_source; |
|
1
by Suren A. Chilingaryan
Initial import |
145 |
}
|
146 |
||
35
by Suren A. Chilingaryan
Minor refactoring: REQUEST/READER/CACHE listing flags, REQUEST listing functions, eliminating FETCH_BOTH fetches in DATABASE, support for partial menu generation |
147 |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
148 |
$range = "<$item_tag $item_title=\"" . _("All") . "\" id=\"SetWindow__0\"/>"; |
1
by Suren A. Chilingaryan
Initial import |
149 |
foreach ($ADEI_TIMINGS as $opt => $value) { |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
150 |
$range .= "<$item_tag $item_title=\"$opt\" id=\"SetWindow__$value\"/>"; |
1
by Suren A. Chilingaryan
Initial import |
151 |
}
|
152 |
||
153 |
||
154 |
$export .= ""; |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
155 |
$export .= "<$item_tag $item_title=\"" . _("Format") . "\" id=\"folder__SetFormat\" withoutImages=\"yes\">"; |
1
by Suren A. Chilingaryan
Initial import |
156 |
foreach ($EXPORT_FORMATS as $id => &$val) { |
43
by Suren A. Chilingaryan
Data filtering support |
157 |
if ((($val['title'])||($val['hidden'] === false))&&(!$val['hidden'])) { |
158 |
$name = $val['title']; |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
159 |
$export .= "<$item_tag $item_title=\"$name\" id=\"SetFormat__$id\"/>"; |
43
by Suren A. Chilingaryan
Data filtering support |
160 |
}
|
1
by Suren A. Chilingaryan
Initial import |
161 |
}
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
162 |
$export .= "</$item_tag>"; |
1
by Suren A. Chilingaryan
Initial import |
163 |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
164 |
$export .= "<$item_tag $item_title=\"" . _("Sampling") . "\" id=\"folder__SetExportSampling\" withoutImages=\"yes\">"; |
165 |
$export .= "<$item_tag $item_title=\"" . _("No Resampling") . "\" id=\"SetExportSampling__0\"/>"; |
|
1
by Suren A. Chilingaryan
Initial import |
166 |
foreach ($EXPORT_SAMPLING_RATES as $name => $id) { |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
167 |
$export .= "<$item_tag $item_title=\"$name\" id=\"SetExportSampling__$id\"/>"; |
1
by Suren A. Chilingaryan
Initial import |
168 |
}
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
169 |
$export .= "</$item_tag>"; |
1
by Suren A. Chilingaryan
Initial import |
170 |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
171 |
$export .= "<$item_tag $item_title=\"" . _("Exported Items") . "\" id=\"folder__SetExportMask\" withoutImages=\"yes\">"; |
172 |
$export .= "<$item_tag $item_title=\"" . _("Current Mask") . "\" id=\"SetExportMask__" . EXPORT::MASK_STANDARD . "\"/>"; |
|
173 |
$export .= "<$item_tag $item_title=\"" . _("Current Group") . "\" id=\"SetExportMask__" . EXPORT::MASK_GROUP . "\"/>"; |
|
174 |
$export .= "<$item_tag $item_title=\"" . _("Current Database") . "\" id=\"SetExportMask__" . EXPORT::MASK_SOURCE . "\"/>"; |
|
175 |
$export .= "<$item_tag $item_title=\"" . _("Everything") . "\" id=\"SetExportMask__" . EXPORT::MASK_COMPLETE . "\"/>"; |
|
176 |
$export .= "</$item_tag>"; |
|
1
by Suren A. Chilingaryan
Initial import |
177 |
|
24
by Suren A. Chilingaryan
Logger subsystem |
178 |
} catch(ADEIException $ex) { |
25
by Suren A. Chilingaryan
Various LOGGER and ZEUSReader fixes |
179 |
$ex->logInfo(NULL, $req); |
24
by Suren A. Chilingaryan
Logger subsystem |
180 |
$err = xml_escape($ex->getInfo()); |
1
by Suren A. Chilingaryan
Initial import |
181 |
}
|
182 |
||
183 |
if ($err) { |
|
184 |
$menu = "<?xml version='1.0' ?> |
|
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
185 |
<menu maxItems=\"1\" $item_title=\"\"> |
536
by Suren A. Chilingaryan
Allow per-setup customization of ADEI menu |
186 |
<$item_tag $item_title=\"\" src=\"$ADEI_MENU_ICON\" id=\"main_file\" width=\"20px\" withoutImages=\"yes\"> |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
187 |
<$item_tag $item_title=\"" . translate("Menu Generation is failed, error: %s", $err) . "\" id=\"folder__data\" withoutImages=\"yes\"/> |
188 |
</$item_tag> |
|
1
by Suren A. Chilingaryan
Initial import |
189 |
</menu>"; |
190 |
echo $menu; |
|
198
by Suren A. Chilingaryan
Update of setups |
191 |
exit(0); |
1
by Suren A. Chilingaryan
Initial import |
192 |
}
|
193 |
||
536
by Suren A. Chilingaryan
Allow per-setup customization of ADEI menu |
194 |
if ($ADEI_MENU_EXTRA_ITEMS) { |
195 |
$extra_items = preg_replace_callback( |
|
196 |
"/(item_tag|item_title|item_image|separator_tag|separator_attrs)/", |
|
197 |
function ($matches) use($item_tag, $item_title, $item_image, $separator_tag, $separator_attrs) { |
|
198 |
eval('$tmpval = "$' . $matches[0] . '";'); |
|
199 |
return "$tmpval"; |
|
200 |
},
|
|
201 |
$ADEI_MENU_EXTRA_ITEMS) . "<$separator_tag $separator_attrs id=\"div_3\"/>"; |
|
202 |
} else { |
|
203 |
$extra_items = ""; |
|
204 |
}
|
|
1
by Suren A. Chilingaryan
Initial import |
205 |
|
37
by Suren A. Chilingaryan
MASK support improvements |
206 |
$menu = "<?xml version='1.0' encoding='UTF-8'?> |
80
by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend |
207 |
<menu absolutePosition=\"auto\" mode=\"popup\" maxItems=\"$MENU_SCROLL_LIMIT\" $item_title=\"\"> |
536
by Suren A. Chilingaryan
Allow per-setup customization of ADEI menu |
208 |
<$item_tag $item_title=\"\" $item_image=\"$ADEI_MENU_ICON\" id=\"main_file\" width=\"20px\" withoutImages=\"yes\"> |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
209 |
<$item_tag $item_title=\"" . _("New Query") . "\" id=\"folder__data\" withoutImages=\"yes\">" . $data . "</$item_tag> |
210 |
<$item_tag $item_title=\"" . _("Data Source") . "\" id=\"folder__data_source\" withoutImages=\"yes\">" . $source . "</$item_tag> |
|
211 |
<$item_tag $item_title=\"" . _("Time Range") . "\" id=\"folder__data_range\" withoutImages=\"yes\">" . $range . "</$item_tag> |
|
212 |
<$item_tag $item_title=\"" . _("Export Settings") . "\" id=\"folder__data_export\" withoutImages=\"yes\">" . $export . "</$item_tag> |
|
213 |
<$separator_tag $separator_attrs id=\"div_1\"/> |
|
214 |
<$item_tag $item_title=\"" . _("Save Mask") . "\" id=\"SaveMask\" withoutImages=\"yes\"/> |
|
215 |
<$item_tag $item_title=\"" . _("Save Window") . "\" id=\"SaveWindow\" withoutImages=\"yes\"/> |
|
536
by Suren A. Chilingaryan
Allow per-setup customization of ADEI menu |
216 |
<$separator_tag $separator_attrs id=\"div_2\"/>$extra_items |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
217 |
<$item_tag $item_title=\"" . _("Lock Window") . "\" id=\"LockWindow\" withoutImages=\"yes\"/> |
218 |
<$item_tag $item_title=\"" . _("ReDraw") . "\" id=\"ReDraw\" withoutImages=\"yes\"/> |
|
219 |
<$item_tag $item_title=\"" . _("Save") . "\" id=\"ExportWindow\"/> |
|
220 |
</$item_tag> |
|
1
by Suren A. Chilingaryan
Initial import |
221 |
</menu>"; |
79
by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added |
222 |
/*
|
223 |
*/
|
|
1
by Suren A. Chilingaryan
Initial import |
224 |
echo $menu; |
225 |
?>
|