/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
$source_title = _("Data Source");

function sourceJS() {
    global $ADEI_MODE;
    global $config_options;
    global $SOURCE_KEEP_WINDOW;
    
?>
    function source_moduleSetDisplayInfo(s, module_name) {
	if (module_name == "time") {
	    s.interval.window.axes_on_display = false;
	    s.interval.window.module_on_display = true;
	    s.interval.module_on_display = true;
	    s.module_on_display = false;
	} else if (module_name == "axes") {
	    s.interval.window.axes_on_display = true;
	    s.interval.window.module_on_display = false;
	    s.interval.module_on_display = false;
	    s.module_on_display = false;
	} else /* source */ {
	    s.interval.window.axes_on_display = false;
	    s.interval.window.module_on_display = false;
	    s.interval.module_on_display = false;
	    s.module_on_display = true;
	}
	s.FixHidden();
    }

    function source_popupSetDisplayInfo(s, status) {
	if (status) {
	    source_moduleSetDisplayInfo(s, source_modules.current_module);
	} else {
	    s.interval.window.module_on_display = false;
	    s.interval.module_on_display = false;
	    s.module_on_display = false;
	}
    }
    
    function source_fixItemSelSize() {
	/* We defined a source_db_item_sel size in procents, to fill completely two table cells.
	However, this causes problems in Gecko while using adaptive SetWidth. The SELECT would
	be extend during first step, but not shrinked back on the second. */
	 
	var itemsel = document.getElementById("source_db_item_sel");
	domSetWidth(itemsel,itemsel.offsetWidth);
    }

    if ((!client.isIE())&&(!client.isKonqueror())) {
	    /* This problem only occurs in Gecko 1.8. The fix by iteself causes problems in IE (no
	    idea why). The Opera does not need the fix, but it not harmless as well */
        domShow("popup_source");
	source_fixItemSelSize();
	domHide("popup_source");
    }



    source_modules = new MODULE("source");
    if (adei.popup) source_modules.RegisterGeometryCallback(popupUpdateGeometryCallback, { 'popup': adei.popup, 'module': "source" });
    source_modules.Open("source");

    <?if ($ADEI_MODE == 'srctree') {?>
	source_modules.Open("time");
    <?}?>


    if (adei.popup) {
	adei.popup.RegisterOnCallback("source", moduleUpdateGeometry, source_modules);
	adei.popup.RegisterControlsModule("source", source_modules);
	adei.popup.RegisterControl("source", "source");
	adei.popup.RegisterControl("source", "time");
	adei.popup.RegisterControl("source", "axes");
    }
    

    var source_opts = new Object();
    <?if ($SOURCE_KEEP_WINDOW) {?> source_opts.keep_window = true; <?}?>

    source_window = new WINDOW("source_timewindow_sel", "source_winstart_inp", "source_winend_inp", "source_axes_table", "source_miny_inp", "source_maxy_inp", "source_logy_inp");
    source_interval = new INTERVAL(source_window, "source_db_experiment_sel", "source_timestart_inp", "source_timeend_inp");
    source = new SOURCE(source_interval, "source_db_server_sel", "source_db_name_sel", "source_db_group_sel","source_c_group_sel",  "source_db_mask_sel", "source_db_item_sel", "source_apply_button", source_opts);

    adei.AttachSourceModule(source, source_interval, source_window);
	
    if (adei.popup) {
        source.RegisterGeometryCallback(moduleUpdateGeometry, source_modules);
	if (isIE()||client.isKonqueror()) {
	    adei.popup.RegisterOffCallback("source", source_popupSetDisplayInfo, source);
	    adei.popup.RegisterOnCallback("source", source_popupSetDisplayInfo, source);
	    source_modules.RegisterCallback(source_moduleSetDisplayInfo, source);
	    source.FixHiddenIE();
	}
    }
<?
    if ($ADEI_MODE == "iAdei") {
?>
    settingmodule = new SETTINGS(source_window);
<?
    }
}

function sourcePage() {
    global $ADEI_MODE;
    global $ZEUS_TIMINGS;
?>
<table width="100%"><tr>
    <?if ($ADEI_MODE != 'srctree') {?>
    <th class="module_source_link_current" id="module_link_source_source"><a href="javascript:source_modules.Open('source')"><?echo _("Source");?></a></th>
    <?}?>
    <th class="module_source_link" id="module_link_source_time"><a href="javascript:source_modules.Open('time')"><?echo _("Time");?></a></th>
    <th class="module_source_link" id="module_link_source_axes"><a href="javascript:source_modules.Open('axes')"><?echo _("Axes");?></a></th>
</tr><tr><td colspan="3">
 <div class="controls">
    <div class="module" id="module_source_dummy" style="display: none;"></div> <?/* Most of the browsers add some empty space, 
	if hidden divs are stacked before displayed one, this is added to make it work uniform among first and others. */?>
    <div class="module" id="module_source_source">
	<table class="select_table" width="100%"><?
	echo "<tr><td>" . _("Server") . "</td><td><select id=\"source_db_server_sel\" onchange='javascript:source.UpdateServer(this.value)'><option>Loading...</option></select></td></tr>";
	echo "<tr><td>" . _("Database") . "</td><td><select id=\"source_db_name_sel\" onchange='javascript:source.UpdateDatabase(this.value)'><option>Loading...</option></select></td></tr>";
	echo "<tr><td><span class=\"hide_source_control\">" . _("Controls") . "</span></td><td><span class=\"hide_source_control\"><select id=\"source_c_group_sel\" onchange='javascript:source.UpdateCGroup(this.value)'><option>Loading...</option></select></span></td></tr>";
	echo "<tr><td><span class=\"hide_source_history\">" . _("LogGroup") . "</span></td><td><span class=\"hide_source_history\"><select id=\"source_db_group_sel\" onchange='javascript:source.UpdateGroup(this.value)'><option>Loading...</option></select></span></td></tr>";
	echo "<tr><td><span class=\"hide_source_history\">" . _("ItemMask") . "</span></td><td><span class=\"hide_source_history\"><select id=\"source_db_mask_sel\" onchange='javascript:source.UpdateMask(this.value)'><option>Loading...</option></select></span></td></tr>";
	echo "<tr id=\"source_db_item_tr\"><td colspan=\"2\"><select id=\"source_db_item_sel\" onchange='javascript:source.UpdateItem(this.value)'><option>Loading...</option></select></td>";
	?></table>
    </div>
    <div class="module" id="module_source_time" style="display: none;">
	<table class="select_table"><tr><?
	    echo "<td>" . _("Experiment") . "</td><td><select id=\"source_db_experiment_sel\" onchange='javascript:source_interval.UpdateExperiment(this.value)'><option>Loading...</option></select></td>";
	?></tr><tr>
	    <td><div class="hide_experiment_custom"><?echo _("Start");?></div></td>
	    <td id="source_timestart"><div class="hide_experiment_custom">
		<input type="text" id="source_timestart_inp" maxlength="25" onchange="javascript:source_window.UpdateRange()"/>
		<a href="javascript:NewCal('source_timestart_inp','mmmddyyyy',true,24,windowUpdateRangeFunction(source_window))">
		    <img src="images/cal.png"/>
		</a>
	    </div></td>
	</tr><tr>
	    <td><div class="hide_experiment_custom"><?echo _("End");?></div></td>
	    <td id="source_timeend"><div class="hide_experiment_custom">
		<input type="text" id="source_timeend_inp" maxlength="25" onchange="javascript:source_window.UpdateRange()"/>
		<a href="javascript:NewCal('source_timeend_inp','mmmddyyyy',true,24,windowUpdateRangeFunction(source_window))">
		    <img src="images/cal.png"/>
		</a>
	    </div></td>
	</tr><tr>
	    <td><?echo _("Window");?></td><td><select id="source_timewindow_sel" onchange='javascript:source_window.UpdateWidth(this.value)'><option>Loading...</option></select></td>
	</tr><tr>
	    <td><div class="hide_window_custom"><?echo _("Start");?></div></td>
	    <td id="source_winstart"><div class="hide_window_custom">
		<input type="text" id="source_winstart_inp" maxlength="31" onchange="javascript:source_window.UpdateRange()"/>
		<a href="javascript:NewCal('source_winstart_inp','mmmddyyyy',true,24,windowUpdateRangeFunction(source_window))">
		    <img src="images/cal.png"/>
		</a>
	    </div></td>
	</tr><tr>
	    <td><div class="hide_window_custom"><?echo _("End");?></div></td>
	    <td id="source_winend"><div class="hide_window_custom">
		<input type="text" id="source_winend_inp" maxlength="31" onchange="javascript:source_window.UpdateRange()" />
		<a href="javascript:NewCal('source_winend_inp','mmmddyyyy',true,24,windowUpdateRangeFunction(source_window));">
		    <img src="images/cal.png"/>
		</a>
	    </div></td>
	</tr></table>
    </div>
    <div class="module" id="module_source_axes" style="display: none;">
	<table id="source_axes_table" class="select_table"><tr>
	    <td><div><span class="axis_name"><?echo _("Y");?></span> [<a href='javascript:source_window.ResetY("0")'><?echo _("R");?></a>]</div></td>
	    <td><div><span class="source_yrange">
		<input type="text" id="source_miny_inp" maxlength="16" onchange="javascript:source_window.UpdateRange()"/>
	    </span></div></td>
	    <td><div><span class="source_yrange">&nbsp;-&nbsp;</span></div></td>
	    <td><div><span class="source_yrange">
		<input type="text" id="source_maxy_inp" maxlength="16" onchange="javascript:source_window.UpdateRange()"/>
	    </span></div></td>
	    <td><div><span class="source_ymode">
		<input type="checkbox" id="source_logy_inp" onchange="javascript:source_window.UpdateRange()"/>
	    </span></div></td><td><div>Log</div></td>
	<?/*</tr><tr>
	    <td colspan="2"><div id="source_yopts">
		<input type="text" id="source_y_units" maxlength="16" onchange="javascript:source_window.UpdateYUnits()"/>
		-
		<input type="text" id="source_y_name" maxlength="16" onchange="javascript:source_window.UpdateYRange()"/>
	    </div></td>
	*/?></tr>
	</table>
    </div>
 </div>
</td></tr><tr class="source_apply"><td colspan="3">
    <button id="source_apply_button" type="button" onclick="javascript:source.Apply()"><?echo translate("Apply");?></button>
</td></tr></table>
<?}?>