1
function INTERVAL_CONFIG() {
7
function INTERVAL(window, exp_sel_id, start_id, end_id) {
8
this.cfg = new INTERVAL_CONFIG;
11
//this.window.SetConfig(null);
14
this.source_expsel = new SELECT(exp_sel_id, intervalUpdateExperiment, this);
15
this.sin = document.getElementById(start_id);
16
if (!this.sin) alert("Custom experiment start time input field (\"" + start_id + "\") is not found");
17
this.ein = document.getElementById(end_id);
18
if (!this.ein) alert("Custom experiment end time input field (\"" + end_id + "\") is not found");
22
INTERVAL.prototype.SetSource = function(src) {
24
this.window.SetSource(src);
25
this.window.SetInterval(this);
29
INTERVAL.prototype.SetConfig = function(config) {
31
this.window.SetConfig(config);
35
INTERVAL.prototype.SetUpdater = function(updater) {
36
this.updater = updater;
37
this.window.SetUpdater(updater);
40
INTERVAL.prototype.ApplyConfig = function(subcall) {
41
this.window.ApplyConfig(subcall);
42
this.config.SetInterval(this.cfg.start, this.cfg.end);
45
INTERVAL.prototype.ReadConfig = function(opts) {
46
opts.experiment = this.config.cfg.experiment;
47
this.window.ReadConfig(opts);
51
INTERVAL.prototype.Update = function(props, opts) {
52
if (props) this.props = props;
56
this.source_expsel.Update(adei.GetService("experiment", props), opts, opts?opts.experiment:null);
57
} else if ((opts.experiment)||(opts.reset)) {
58
if (!opts.experiment) opts.experiment = this.source_expsel.GetValue(0);
60
this.UpdateExperiment(opts.experiment, opts);
62
if (this.source_expsel.GetValue() != opts.experiment)
63
this.source_expsel.SetValue(opts.experiment);
64
} else if (opts.confirm) {
65
this.config.Confirm(this);
70
INTERVAL.prototype.UpdateExperiment = function(value, opts) {
71
if (((opts)&&(opts.reload))||(value != this.experiment)) {
74
this.experiment = value;
77
if (this.cfg.custom == 0) {
78
cssShowClass('.hide_experiment_custom');
81
if (!this.module_on_display) this.fix_hidden = true;
83
if (typeof this.geometry_cb == "function") {
84
this.geometry_cb(this.geometry_cbattr);
88
if (this.cfg.custom) {
89
cssHideClass('.hide_experiment_custom');
92
if (!this.module_on_display) this.fix_hidden = true;
95
var atmp = value.split('-',2);
96
this.cfg.start = atmp[0];
97
this.cfg.end = atmp[1];
101
if (typeof opts == "undefined") opts = new Object;
104
this.window.Update(this.props + "&" + this.GetExperimentProps(0), opts);
105
} else if ((opts)&&(opts.window)) {
106
this.window.Update(this.props + "&" + this.GetExperimentProps(0), opts);
107
} else if ((opts)&&(opts.confirm)) {
108
this.config.Confirm(this);
113
INTERVAL.prototype.GetExperimentProps = function(read_custom) {
114
if (typeof read_custom == "undefined") read_custom = 1;
116
if (this.cfg.custom) {
120
if (this.sin.value) from = adeiDateParse(this.sin.value);
123
if (this.ein.value) to = adeiDateParse(this.ein.value);
127
alert('Invalid start time (\"' + this.sin.value + '\") is specified');
131
alert('Invalid end time (\"' + this.ein.value + '\") is specified');
135
return 'experiment='+from+'-'+to;
137
return 'experiment=0-0';
140
return 'experiment=' + this.cfg.start + '-' + this.cfg.end;
144
INTERVAL.prototype.RegisterGeometryCallback = function(cb, cbattr) {
145
this.window.RegisterGeometryCallback(cb, cbattr);
146
this.geometry_cb = cb;
147
this.geometry_cbattr = cbattr;
151
INTERVAL.prototype.FixHidden = function() {
152
if ((this.fix_hidden)&&(this.module_on_display)) {
153
if (this.cfg.custom) {
154
cssHideClass('.hide_experiment_custom');
155
cssShowClass('.hide_experiment_custom');
157
cssShowClass('.hide_experiment_custom');
158
cssHideClass('.hide_experiment_custom');
160
this.fix_hidden = false;
162
this.window.FixHidden();
165
function intervalUpdateExperiment(interval, value, opts) {
166
interval.UpdateExperiment(value, opts);