id = $id; $this->defval = $defval; $this->content = $defval; } function load_state () { $this->content = param ($this->id . "_content", $this->defval); } function js_content () { return "document.forms.page." . $this->id . "_content.value"; } function output ($attribs = "") { return "id . "\" " . "name=\"" . $this->id . "_content\" " . "value=\"" . htmlentities($this->content) . "\" " . $attribs . " />"; } } class WRMutable extends WRComponent { var $element; var $defval; var $command; var $params; var $content; function WRMutable ($id, $element, $defval) { $this->id = $id; $this->element = $element; $this->defval = $defval; $this->url = false; $this->content = false; } function load_state () { $this->command = param ($this->id . "_cmd"); $this->params = param ($this->id . "_params"); $this->content = param ($this->id . "_content"); } function js_ahah ($backend_url,$command,$params, $method) { return "document.forms.page." . $this->id . "_cmd.value = $command;\n" . "document.forms.page." . $this->id . "_params.value = $params;\n" . "document.forms.page." . $this->id . "_content.value = '';\n" . "ahah($backend_url + '?ahah=' + $command + '&' + $params,'" . $this->id ."',$method);"; } function js_set_html ($content) { return "document.forms.page." . $this->id . "_cmd.value = '';\n" . "document.forms.page." . $this->id . "_content.value = $content;\n" . "document.getElementById('" . $this->id . "').innerHTML = $content;\n" . "execJS (document.getElementById ('" . $this->id . "'));" . "doFade ('" . $this->id . "',1)"; } function js_set_text ($content) { return $this->js_set_html ('htmlentities(' . $content . ')'); } function set_html ($content) { $this->content = $content; } function set_text ($content) { $this->content = htmlentities ($content); } function output ($attribs = "") { global $SITE_PREFIX; $html = "id . "_cmd\" value=\"" . htmlentities($this->command) . "\"/>\n"; $html .= "id . "_params\" value=\"" . htmlentities($this->params) . "\"/>\n"; $html .= "id . "_content\" value=\"" . htmlentities($this->content) . "\"/>\n"; $html .= "<" . $this->element . " id=\"" . $this->id . "\" class=\"normal\" " . $attribs . ">"; if ($this->command) { $html .= invoke_backend ($this->command, $this->params); } else { if ($this->content) { $html .= $this->content; } else { $html .= $this->defval; } } $html .= "" . $this->element . ">"; return $html; } } class WRButton extends WRComponent { var $name; var $serverSide; function WRButton ($id,$name,$serverSide = false) { $this->id = $id; $this->name = $name; $this->serverSide = $serverSide; } function load_state () { } function generate_head_elements () { if (!$this->serverSide) { $callback = "JS_" . $this->id; echo "\n"; } } function process_submits () { if (param($this->id) == $this->name) { $callback = "FALLBACK_" . $this->id; $result = $callback ($this); return $result; } return "UNHANDLED"; } function output ($attribs = "") { if ($this->serverSide) return "id . "\" " . " value=\"" . htmlentities($this->name) . "\" $attribs />"; else return "id . "\" " . "onClick=\"handle_" . $this->id . "(); return false;\" " . " value=\"" . htmlentities($this->name) . "\" $attribs />"; } } class WRSheet extends WRComponent { var $name; var $close; var $state; function WRSheet ($id,$name,$close) { $this->id = $id; $this->name = $name; $this->close = $close; $this->state = 0; } function load_state () { $this->state = intval(param ($this->id . "_state")); } function process_submits () { if (param($this->id . "_open") == $this->name) { $this->state = 1; return "HANDLED"; } if (param($this->id . "_close") == $this->close) { $this->state = 0; return "HANDLED"; } return "UNHANDLED"; } function output_open_button ($attribs = "") { $html = "id . "_open\" " . "onClick=\"" . "document.getElementById ('" . $this->id . "').style.display = 'block';" . "return false;\" " . " value=\"" . htmlentities($this->name) . "\" $attribs />\n"; $html .= "id . "_state\" value=\"" . $this->state ."\" />\n"; return $html; } function output_sheet_begin () { if ($this->state) return "