/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk
1 by Suren A. Chilingaryan
Initial import
1
<?php 
2
3
require("config.php");
4
require("tools.php");
227 by Suren A. Chilingaryan
Use localization subsystem, updated Katrin configs
5
require("locale.php");
1 by Suren A. Chilingaryan
Initial import
6
7
header("Content-Type: application/xhtml+xml; charset=UTF-8");
8
header("Content-Type: text/html; charset=UTF-8");
9
header("Cache-Control: no-cache, must-revalidate");
10
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
11
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
12
if (!isset($_GET["minimal"])) {
212 by Suren A. Chilingaryan
Integration of work of students with fixes
13
	if (strpos($_SERVER['HTTP_USER_AGENT'],"iPhone") || strpos($_SERVER['HTTP_USER_AGENT'],"iPod") || strpos($_SERVER['HTTP_USER_AGENT'],"iPad") || preg_match('/iPhone/',$_SERVER['HTTP_USER_AGENT']) || preg_match('/iPod/',$_SERVER['HTTP_USER_AGENT'])) {
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
14
		$host  = $_SERVER['HTTP_HOST'];
15
		$uri   = rtrim(dirname($_SERVER['PHP_SELF']), "/\\");
16
		$extra = 'index.php?minimal=iAdei';
17
		header("Location: http://$host$uri/$extra");	
18
	} 	
19
}
20
130 by Suren A. Chilingaryan
Minimized interface version
21
if (isset($_GET["minimal"])) {
22
    if ($_GET["minimal"]) $minimal = $_GET["minimal"];
23
    else $minimal = true;
24
    unset($_GET["minimal"]);
25
} else $minimal = false;
26
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
27
$ADEI_MODE = $minimal;
130 by Suren A. Chilingaryan
Minimized interface version
28
29
if ($minimal) {
30
    switch ($minimal) {
31
     case "nosource":
32
	$allowed_modules = false;
33
	$displayed_popups = array("controls");
34
	$CONTROLS = array("export", "aggregator", "searchtab");
35
        $allowed_popups = array("source");
36
	
37
	$no_header = false;
38
	$no_search = false;
39
     break;
137 by Suren A. Chilingaryan
setups and configuration, nomenu minimal mode
40
     case "nomenu":
41
	$allowed_modules = false;
42
	$displayed_popups = array();
43
        $allowed_popups = array("source", "export");
44
	$no_header = false;
45
	$no_search = true;
46
	$no_menu = true;
47
     break;
130 by Suren A. Chilingaryan
Minimized interface version
48
     case "search":
49
	$config_module = "graph";
50
	$allowed_modules = array("graph");
51
	//$displayed_popups = array("searchtab");
52
	$displayed_popups = array("controls");
53
	$allowed_popups = array("source", "export");
54
	$CONTROLS = array("searchtab");
55
	
56
	$no_header = false;
57
	$no_search = false;
58
     break;
59
     case "wiki":
60
	$config_module = "wiki";
61
	$allowed_modules = array("graph", "wiki");
62
	$displayed_popups = array();
63
        $allowed_popups = array("source", "export");
64
	$no_header = false;
65
	$no_search = true;
66
     break;
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
67
     case "iAdei":
68
        if (!in_array("settings", $MODULES)) array_push($MODULES, "settings");
69
        $config_module = "wiki";
70
	$allowed_modules = array("slowcontrol", "alarms", "graph", "wiki", "settings");
71
        $allowed_popups = array("source", "export");
72
        $displayed_popups = array();        
73
        $no_header = true;
74
        $iHeader = true;
75
     break;
130 by Suren A. Chilingaryan
Minimized interface version
76
     default:
77
	$config_module = "graph";
78
	$allowed_modules = array($config_module);
79
        $allowed_popups = array("source", "export");
80
	$displayed_popups = array();
81
	$no_header = true;
82
    }
83
84
    if ($no_header) {
85
	$no_menu = true;
86
	$no_search = true;
87
    }
88
} else {
89
    $allowed_popups = false;
90
    $allowed_modules = false;
91
    $no_header = false;
92
    $no_menu = false;
93
    $no_search = false;
94
95
    if (isset($_GET["module"])) $config_module = $_GET["module"];
96
    else $config_module = $DEFAULT_MODULE;
97
98
}
99
1 by Suren A. Chilingaryan
Initial import
100
$config_options = &$_GET;
101
if (sizeof($config_options)) $config_options["apply"] = 1;
102
103
session_start();
104
if (isset($_SESSION['setup'])) {
24 by Suren A. Chilingaryan
Logger subsystem
105
    if ($_SESSION['setup'] != $ADEI_SETUP) {
1 by Suren A. Chilingaryan
Initial import
106
        session_regenerate_id();
24 by Suren A. Chilingaryan
Logger subsystem
107
        $_SESSION['setup'] = $ADEI_SETUP;
1 by Suren A. Chilingaryan
Initial import
108
    }
109
} else {
24 by Suren A. Chilingaryan
Logger subsystem
110
    $_SESSION['setup'] = $ADEI_SETUP;
1 by Suren A. Chilingaryan
Initial import
111
}
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
112
113
114
require("module.php");
115
116
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
117
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1 by Suren A. Chilingaryan
Initial import
118
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
119
<head>
76 by Suren A. Chilingaryan
Fix from UI branch: prevent filtering of uncached virtual groups and databases
120
    <title>ADEI (Advanced Data Extraction Infrastructure) </title>
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
121
<?  if($iHeader){?>
122
	<meta name = "viewport" content = "user-scalable=no, initial-scale = 1.0, maximum-scale = 1.0, minimum-scale = 1.0" />
123
	<meta name="apple-touch-fullscreen" content="YES" />
124
	<meta name="apple-mobile-web-app-capable" content="yes" />
125
	<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
126
	<link rel="stylesheet" type="text/css" href="iadei.css"/> <?/* Should be first, otherwise cssSetProperty would not work */?>
127
	<link rel="stylesheet" type="text/css" href="includes/sw/spinningwheel.css"/>
128
<?  } else {?>    
129
	<link rel="stylesheet" type="text/css" href="adei.css"/> <?/* Should be first, otherwise cssSetProperty would not work */?>
130
<?  }  
131
132
    if (file_exists($SETUP_CSS)) {?>
133
	<link rel="stylesheet" type="text/css" href="<?echo $SETUP_CSS;?>"/>
1 by Suren A. Chilingaryan
Initial import
134
<?  }?>
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
135
    <link rel="stylesheet" type="text/css" href="includes/dhtmlx/skins/dhtmlxmenu_<?=$DHTMLX_SKIN;?>.css"/>
136
    <link rel="stylesheet" type="text/css" href="includes/dhtmlx/dhtmlxtree.css"/>
1 by Suren A. Chilingaryan
Initial import
137
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
138
    <script type="text/javascript" src="includes/date.format.js"></script>
1 by Suren A. Chilingaryan
Initial import
139
    <script type="text/javascript" src="includes/datetimepicker.js"></script>
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
140
    <script type="text/javascript" src="includes/rsh.js"></script>
141
1 by Suren A. Chilingaryan
Initial import
142
    <script type="text/javascript" src="includes/prototype.js"></script>
143
    <script type="text/javascript" src="includes/scriptaculous/scriptaculous.js?load=builder,effects,dragdrop"></script>
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
144
    <script type="text/javascript" src="includes/cropper/cropper.js"></script>
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
145
	
1 by Suren A. Chilingaryan
Initial import
146
<?/*
147
    This causes Ajax.Request (prototype) to return on 'onSuccess' handler
148
    status=0 (should be 200) and undefined responseText. 
149
    This happens ocassionally (not always). Could be stimulated by openning
150
    current ADEI page in the new tab. Occurce much rare if reloaded in the 
151
    same tab and even more rare than just pressing Apply button. However, still
152
    happens sometimes.
153
    
154
    <script type="text/javascript" src="includes/ext/adapter/prototype/ext-prototype-adapter.js"></script>
155
    <script type="text/javascript" src="includes/ext/ext-all.js"></script>
156
*/?>
157
158
    <script type="text/javascript" src="includes/dhtmlx/dhtmlxcommon.js"></script>
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
159
    <script type="text/javascript" src="includes/dhtmlx/dhtmlxmenu.js"></script>
160
    <script type="text/javascript" src="includes/dhtmlx/dhtmlxtree.js"></script>
1 by Suren A. Chilingaryan
Initial import
161
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
162
<?
163
    if ($ADEI_RELEASE) {
164
	echo "<script type=\"text/javascript\" src=\"adei.js\"></script>\n";
205 by Suren A. Chilingaryan
Revert back to SetConfiguration from SetCustomProperties while handling certain property in search; trully support HTML content in description field within search results; support execution in XMLModule; support for setup-specific javascript code; KATRIN update
165
	if (file_exists("setups/$ADEI_SETUP/$ADEI_SETUP.js")) {
166
	    echo "<script type=\"text/javascript\" src=\"setups/$ADEI_SETUP/$ADEI_SETUP.js\"></script>\n";
167
	}
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
168
    } else {
169
	$dir = opendir("js");
170
	while ($file = readdir($dir)) {
171
	    if (preg_match("/\.js$/", $file)) {
172
		echo "<script type=\"text/javascript\" src=\"js/$file\"></script>\n";
173
	    }
174
	}
175
	closedir($dir);
169 by Suren A. Chilingaryan
Control subsystem
176
177
	$dir = opendir("js/xmlmodule");
178
	while ($file = readdir($dir)) {
179
	    if (preg_match("/\.js$/", $file)) {
180
		echo "<script type=\"text/javascript\" src=\"js/xmlmodule/$file\"></script>\n";
181
	    }
182
	}
183
	closedir($dir);
205 by Suren A. Chilingaryan
Revert back to SetConfiguration from SetCustomProperties while handling certain property in search; trully support HTML content in description field within search results; support execution in XMLModule; support for setup-specific javascript code; KATRIN update
184
208 by Suren A. Chilingaryan
Suppress 'failed to open dir' message
185
	$dir = @opendir("setups/$ADEI_SETUP/js");
205 by Suren A. Chilingaryan
Revert back to SetConfiguration from SetCustomProperties while handling certain property in search; trully support HTML content in description field within search results; support execution in XMLModule; support for setup-specific javascript code; KATRIN update
186
	if ($dir) {
187
	    while ($file = readdir($dir)) {
188
		if (preg_match("/\.js$/", $file)) {
189
		    echo "<script type=\"text/javascript\" src=\"setups/$ADEI_SETUP/js/$file\"></script>\n";
190
	        }
191
	    }
192
	    closedir($dir);
193
208 by Suren A. Chilingaryan
Suppress 'failed to open dir' message
194
	    $dir = @opendir("setups/$ADEI_SETUP/js/xmlmodule");
205 by Suren A. Chilingaryan
Revert back to SetConfiguration from SetCustomProperties while handling certain property in search; trully support HTML content in description field within search results; support execution in XMLModule; support for setup-specific javascript code; KATRIN update
195
	    if ($dir) {
196
		while ($file = readdir($dir)) {
197
		    if (preg_match("/\.js$/", $file)) {
198
			echo "<script type=\"text/javascript\" src=\"setups/$ADEI_SETUP/js/xmlmodule/$file\"></script>\n";
199
		    }
200
		}
201
		closedir($dir);
202
	    }
203
	}
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
204
    }
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
205
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
206
?>    
1 by Suren A. Chilingaryan
Initial import
207
    <script type="text/javascript" ev:event="onload">
208
//<![CDATA[
209
	function Geometry() {
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
210
	    /* DS: Do we need this? */
210 by Suren A. Chilingaryan
Use typeof to make a proper check
211
	    if (typeof adei == "undefined") return;
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
212
1 by Suren A. Chilingaryan
Initial import
213
	    var new_width = windowGetWidth();
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
214
	    var new_height = windowGetHeight();
1 by Suren A. Chilingaryan
Initial import
215
	    <?moduleAdjustGeometry("new_width", "new_height");?>
216
	}
312 by Suren A. Chilingaryan
Resizing of sidebar popups
217
	
218
	function UpdatePopupGeometry(source, dragger) {
219
	    adei.popup.popups_width = 0;        // to allow reduction
220
      	    adei.popup.UpdateGeometry(source);
221
      	    adei.popup.RunCallbacks();
222
	}
1 by Suren A. Chilingaryan
Initial import
223
224
	function Startup() {
225
	    var adei_options = new Object();
226
	    <?foreach ($config_options as $key => $value) {
227
		echo "adei_options." . $key . "=\"" . $value . "\";\n";
228
	    }?>
229
	    
130 by Suren A. Chilingaryan
Minimized interface version
230
	    <?if ($minimal) {
231
		if ($no_menu) $menuid = "false";
232
		else $menuid="\"menu_zone\"";
233
		
234
		if ($displayed_popups) $sidebarid="\"main_sidebar\"";
235
		else $sidebarid = "false";
236
	    ?>
237
		adei = new ADEI("main_div", <?=$sidebarid?>, "main_statusbar", <?=$menuid?>, "<?echo session_id();?>");
238
	    <?} else {?>
239
		adei = new ADEI("main_div", "main_sidebar", "main_statusbar", "menu_zone", "<?echo session_id();?>");
240
	    <?}?>
277 by Suren A. Chilingaryan
Move dhtmlx_iconset property to index.php for sharing with other modules
241
1 by Suren A. Chilingaryan
Initial import
242
	    adei.SetOptions(adei_options);
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
243
    
1 by Suren A. Chilingaryan
Initial import
244
	    adei.SetProperty('window_border', <?echo $AJAX_WINDOW_BORDER;?>);
245
	    adei.SetProperty('parse_delay', <?echo $AJAX_PARSE_DELAY;?>);
246
	    adei.SetProperty('subsecond_threshold', <?echo $GRAPH_SUBSECOND_THRESHOLD;?>);
247
	    adei.SetProperty('zoom_ratio', <?echo $GRAPH_ZOOM_RATIO;?>);
11 by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc.
248
	    adei.SetProperty('step_ratio', <?echo $GRAPH_STEP_RATIO;?>);
249
	    adei.SetProperty('deepzoom_area', <?echo $GRAPH_DEEPZOOM_AREA;?>);
250
	    adei.SetProperty('edge_ratio', <?echo $GRAPH_EDGE_RATIO;?>);
14 by Suren A. Chilingaryan
Some minimal information on status bar
251
	    adei.SetProperty('default_status_duration', <?echo $STATUS_DEFAULT_DURATION;?>);
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
252
	    adei.SetProperty('menu_scroll_limit', <?= $MENU_SCROLL_LIMIT?>);
195 by Suren A. Chilingaryan
Image Export by Arsen Sogomonyan
253
	    adei.SetProperty('export_formats',<?= json_encode($EXPORT_FORMATS)?>);
277 by Suren A. Chilingaryan
Move dhtmlx_iconset property to index.php for sharing with other modules
254
	    adei.SetProperty('dhtmlx_iconset', '<?="includes/dhtmlx/imgs/" . ((file_exists("includes/dhtmlx/imgs/$DHTMLX_ICONSET"))?"$DHTMLX_ICONSET/":"")?>');
1 by Suren A. Chilingaryan
Initial import
255
256
	    <?if ($SETUP_MULTI_MODE) {?>
24 by Suren A. Chilingaryan
Logger subsystem
257
	    adei.AddToQuery('setup=<?echo $ADEI_SETUP?>');
1 by Suren A. Chilingaryan
Initial import
258
	    <?}?>
259
	    
130 by Suren A. Chilingaryan
Minimized interface version
260
	    <?modulePlaceJS(($allowed_popups===false)?false:array_merge($allowed_popups, $displayed_popups), $allowed_modules);?>
1 by Suren A. Chilingaryan
Initial import
261
11 by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc.
262
	    Geometry();
312 by Suren A. Chilingaryan
Resizing of sidebar popups
263
	    <?moduleSetupDragger();?>
11 by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc.
264
1 by Suren A. Chilingaryan
Initial import
265
	    adei.Start('<?echo $config_module;?>', <?echo $AJAX_UPDATE_RATE;?>);
266
	}
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
267
	
268
	function Navigate(btn) {
269
  	    if(btn != "settings") {
270
		adei.OpenModule(btn);
271
	    } else {
272
    		adei.SetConfiguration("p_id=main");
273
    		adei.OpenModule(btn);
274
    		adei.updater.Update();
275
  	    } 
276
	}
1 by Suren A. Chilingaryan
Initial import
277
//]]>
278
    </script>
279
</head>
280
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
281
<body onload="javascript:Startup()" onresize="Geometry()" onorientationchange="Geometry()">
1 by Suren A. Chilingaryan
Initial import
282
<div class="all ales">
130 by Suren A. Chilingaryan
Minimized interface version
283
<?if (!$no_menu) {?>
79 by Suren A. Chilingaryan
New version of dhtmlxmenu and dhtmlxtree is added
284
    <div class="menu_button"><div id="menu_zone"></div></div>
130 by Suren A. Chilingaryan
Minimized interface version
285
<?}?>
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
286
130 by Suren A. Chilingaryan
Minimized interface version
287
<?if (!$no_header) {?>
1 by Suren A. Chilingaryan
Initial import
288
    <div id="header_div" class="header">
289
	<table width="100%" cellspacing="0" cellpadding="0"><tr>
290
	    <td class="title">
291
	        <b><?echo $TITLE;?></b>
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
292
	    </td><td class="right">
130 by Suren A. Chilingaryan
Minimized interface version
293
	    <? if (!$no_search) {?>
80 by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend
294
		<div class="search"><form action="javascript:nope()" onsubmit="javascript:adei.Search(this.search.value);"><input name="search" id="search"/></form></div>
130 by Suren A. Chilingaryan
Minimized interface version
295
	    <? }?>
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
296
	        <div class="links"><table width="100%" height="100%" cellspacing="0" cellpadding="0"><tr><td>
130 by Suren A. Chilingaryan
Minimized interface version
297
		    <?moduleLinkModules($allowed_modules);?>
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
298
		</td></tr></table></div>
1 by Suren A. Chilingaryan
Initial import
299
	    </td>
300
	</tr></table>
301
    </div>
130 by Suren A. Chilingaryan
Minimized interface version
302
<?}?>
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
303
304
<?if ($iHeader){?>
305
    <div id="header_div" class="iheader">
306
	<table><tr><td><button class="settingsbtn" id="settingsbutton" onclick="javascript:Navigate('settings');"></button></td><td><h1 class="ADEIhead">ADEI</h1></td></tr></table>
307
        <select class="moduleSelector" onChange='javascript:Navigate(this.options[this.selectedIndex].value);' name="modsel" id="modsel">
308
<? 
309
     if($allowed_modules){
310
     	for($i = 0; $i<sizeof($allowed_modules);$i++){
311
   			echo"<option value='$allowed_modules[$i]'>";
312
     		if (isset($GLOBALS[$allowed_modules[$i] . "_title"])) echo  $GLOBALS[$allowed_modules[$i] . "_title"];
313
			else echo"$allowed_modules[$i]";
314
			echo"</option>";
315
     		
316
     	}
317
     }
318
 ?>
319
	</select>     
320
    </div>
321
<?}?>
322
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
323
    <div><table align="center" cellspacing="0" cellpadding="0">
130 by Suren A. Chilingaryan
Minimized interface version
324
	<?/*<tr><td colspan="2"></td></tr>*/?>
325
	<tr><td id="main_sidebar"><div>
326
	    <?if ($minimal) {
327
		foreach ($allowed_popups as $popup) {
328
		    ?><div class="popup" id="popup_<?echo $popup;?>" style="display: none;"><?
329
			if (function_exists($popup . "Page")) call_user_func($popup . "Page");
330
		    ?></div><?
331
		}
332
		moduleLinkPopups($displayed_popups);
333
	    } else {?>
1 by Suren A. Chilingaryan
Initial import
334
		<?moduleLinkPopups();?>
130 by Suren A. Chilingaryan
Minimized interface version
335
	    <?}?>
336
	</div></td><td width="100%"><div id="main_div">
337
		<?modulePlacePages($allowed_modules);?>
338
	</div></td></tr>
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
339
    </table></div>
210.1.1 by Suren A. Chilingaryan
Support of Appled devices by Toni Pirhonen
340
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
341
    <div id="main_statusbar" class="statusbar">
13 by Suren A. Chilingaryan
Handling of aggregation options
342
	<div>I'm a status bar</div>
12 by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu
343
    </div>
1 by Suren A. Chilingaryan
Initial import
344
</div>
345
</body>
346
</html>