/adei/trunk

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