Date: 05/16/00
- Next message: uw: "[phplib-dev] cvs commit"
- Next in thread: uw: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: uw
Date: Tue May 16 17:59:37 2000
Added files:
php-lib/php/form/unnamed.inc
Modified files:
php-lib/php/form/assistant.inc
php-lib/php/form/assistant_gifimage.inc
php-lib/php/form/form.inc
php-lib/php/form/form_elements.inc
php-lib/php/form/template_bridge.inc
Log message:
- cvs is broken
- object hierarchie is final
;-)
Index: php-lib/php/form/assistant.inc
diff -u php-lib/php/form/assistant.inc:1.10 php-lib/php/form/assistant.inc:1.11
--- php-lib/php/form/assistant.inc:1.10 Mon May 8 19:31:37 2000
+++ php-lib/php/form/assistant.inc Tue May 16 17:59:33 2000
@@ -1,40 +1,32 @@
<?php
/**
-* Tabstyled forms in one assistant frame
-*
-*
+* Assistant/wizard that guides a user through several forms
+* <email protected> Ulf Wendel <ulf <email protected>>
+* <email protected> 0.1alpha
*/
-class assistant {
- function assistant() {
- } // end constructor
+class assistant extends panemanager {
- function restoreAssistant() {
-
- $this->saveFormValues();
- $this->setPageErrors();
- $this->findPosition();
- $this->loadFormValues();
-
- } // end func restoreAssistant
-
+ /**
+ * PHPLIB persistance helper, name of this class
+ * <email protected> string $classname
+ * <email protected> public
+ */
var $classname = "assistant";
- var $persistent_slots = array("page_errors", "page_values", "lastviewed");
/**
- * Array with status (isValid()) information on each page
- * - must be restored by a session! -
- * <email protected> array $page_errors
- * <email protected> private
+ * PHPLIB persistance helper, list of persistant "slots"
+ * <email protected> array $persistent_slots
+ * <email protected> public
*/
- var $page_errors = array();
+ var $persistent_slots = array("page_errors", "page_values", "lastviewed");
/**
- * Hash with form values of all pages
+ * Array with status (isValid()) information on each page
* - must be restored by a session! -
- * <email protected> array $page_values
+ * <email protected> array $page_errors
* <email protected> private
*/
- var $page_values = array();
+ var $page_errors = array();
/**
* Which page was shown last?
@@ -52,24 +44,8 @@
var $now = -1;
/**
- * Opening form tag
- * <email protected> string $form_start
- * <email protected> private
- * <email protected> Start(), getStart(), setStart()
- */
- var $form_start = "";
-
- /**
- * Closing form tag
- * <email protected> string $form_end
- * <email protected> private
- * <email protected> Finish(), getFinish(), setFinish()
- */
- var $form_end = "";
-
- /**
* Show tabs?
- * <email protected> boolean $show_tabs
+ * <email protected> bool $show_tabs
* <email protected> private
* <email protected> show_tabs()
*/
@@ -106,33 +82,8 @@
"main" => "assistant_main.tpl"
#"tabs" => "assistant_tabs.html"
);
-
- /**
- * error number
- * <email protected> int $errno = 0
- * <email protected> private
- */
- var $errno = 0;
-
- /**
- * errormessage
- * <email protected> string $error = ""
- * <email protected> private
- */
- var $error = "";
- var $flag_showerror = true;
- var $flag_haltonerror = false;
-
/**
- * Array of pages
- * <email protected> array $pages = array()
- * <email protected> private
- * <email protected> addPage()
- */
- var $pages = array();
-
- /**
* "switching mode"
* <email protected> enum(strict|weak) $mode = "strict"
* <email protected> private
@@ -141,14 +92,6 @@
var $mode = "strict";
/**
- * Label and action of the very last button that finishes the assistant
- * <email protected> array $finish_button
- * <email protected> private
- * <email protected> setFinish()
- */
- var $finish_button = array();
-
- /**
* Some labels
* <email protected> array $labels
* <email protected> setLabels()
@@ -168,37 +111,13 @@
/**
* Show prev- and next-button?
- * <email protected> boolean show_prevnext = true
+ * <email protected> bool show_prevnext = true
* <email protected> private
* <email protected> setPrevNext()
*/
var $show_prevnext = true;
/**
- * Label and name of a button that exits the assistant
- * <email protected> array $finish
- * <email protected> private
- * <email protected> setFinishButton(), isFinishPressed()
- */
- var $finish_button = array();
-
- /**
- * Label and name of a exit button that always to abort the assistant
- * <email protected> array $exit
- * <email protected> private
- * <email protected> setExitButton, isExitPressed()
- */
- var $exit = array();
-
- /**
- * Label, name and comment text that belongs to the help button
- * <email protected> array $help
- * <email protected> private
- * <email protected> setHelp(), isHelpPressed()
- */
- var $help = array();
-
- /**
* Flag, set if specials
* <email protected> string $flag_specials
* <email protected> private
@@ -207,220 +126,30 @@
var $flag_specials = "";
/**
- * Method used in the forms
- * <email protected> string $method = "POST"
+ * Restores the Assistant. Load the pages with values, sets validation flags etc.
* <email protected> private
- * <email protected> setMethod()
*/
- var $method = "POST";
-
- /**
- * Use this method to provide the structure of the assistant
- * The method gets called by the constructor
- * <email protected> void
- * <email protected> void
- * <email protected> public
- */
- function Init() {
- } // end func Init()
-
- /**
- * checks the existance of a HTTP_POST|GET_VARS
- * <email protected> string $varname name of the variable you're looking for.
- * The varibale must be scalar, arrays are not
- * supported
- * <email protected> boolean $ok
- * <email protected> isHelpPressed(), isExitPressed(), isFinishPressed()
- * <email protected> private
- */
- function issetHTTPXVAR($varname) {
- global $HTTP_POST_VARS, $HTTP_GET_VARS;
-
- if(""==$varname) {
- $this->setError(69, "form->issetHTTPXVARS(), illegal function call");
- return false;
- }
-
- $ok = false;
- switch ($this->method) {
- case "POST":
- $ok = isset($HTTP_POST_VARS[$varname]);
- break;
-
- case "GET":
- $ok = isset($HTTP_GET_VARS[$varname]);
- break;
-
- default:
- $this->setError(65, "form->issetHTTPXVAR(), unknown form method");
- break;
- }
-
- return $ok;
- } // end func issetHTTPXVAR
-
- /**
- * Is the Button "Finish" pressed?
- * <email protected> boolean $ok
- * <email protected> isExitPressed(), isHelpPressed
- * <email protected> public
- */
- function isFinishPressed() {
- if (!isset($this->finish_button["name"])) {
- $this->setError(66, "form->isFinishPressed(), there's no finish button defined");
- return false;
- }
-
- return $this->issetHTTPXVAR($this->finish_button["name"]);
- } // end func isFinishPressed()
-
- /**
- * Is the Button "Exit" pressed?
- * <email protected> boolean $ok
- * <email protected> isFinishPressed(), isHelpPressed()
- * <email protected> public
- */
- function isExitPressed() {
- if (!isset($this->exit["name"])) {
- $this->setError(67, "form->isExitPressed(), there's no exit button defined");
- return false;
- }
-
- return $this->issetHTTPXVARS($this->exit["name"]);
- } // end func isExitPressed()
-
- /**
- * Is the Button "Help" pressed?
- * <email protected> boolean $ok
- * <email protected> isFinishPressed(), isExitPressed()
- * <email protected> public
- */
- function isHelpPressed() {
- if (!isset($this->help["name"])) {
- $this->setError(68, "form->isHelpPressed(), there's no help button defined");
- return false;
- }
- return $this->issetHTTPXVARS($this->help["name"]);
-
- } // end func isHelpPressed()
-
- /*
- * Return the session hash with values of one page or all pages.
- * <email protected> string $page_name = "", "" means return all pages
- * <email protected> array $page_values
- * <email protected> public
- * <email protected> isValid()
- */
- function getPageValues($page_name="") {
- if (""==$page_name)
- return $this->page_values;
-
- $p_id = $this->PageNametoPageID($page_name);
- if (-1 == $p_id) {
- $this->setError(60, "assistant -> getPageValues(), unknown page '$page_name'");
- return array();
- }
- return array($p_id => $this->page_values[$p_id]);
- } // end func getPageValues
-
+ function restoreAssistant() {
- // LEAB HACK
- function getPageValuesWithTranslatedNames() {
-
- $values_with_names = array();
- $form_names = array();
- $radio_elements = array();
-
- reset($this->pages);
- while (list($p_id, $data)=each($this->pages)) {
- $obj = $data["object"];
-
- if ($p_id!=$this->now)
- $obj->restoreSessionHash($this->page_values[$p_id]);
- $name_translation_list = $obj->getNameTranslationList();
-
- while (list($form_elname, $data)=each($name_translation_list)) {
-
- if (!isset($values_with_names[$p_id][$data["name"]])) {
- $values_with_names[$p_id][$data["name"]] = $data["value"];
-
- } else {
- if (""!=$data["value"])
- $values_with_names[$p_id][$data["name"]] = $data["value"];
- }
+ $this->saveFormValues();
+ $this->setPageErrors();
+ $this->findPosition();
+ $this->loadFormValues();
- }
-
- }
-
- return $values_with_names;
- } // end func getPageValuesWithTranslatedNames
-
- /**
- * Set the label, name and comment text that belongs to the help button
- * <email protected> array $data
- * <email protected> boolean $ok
- * <email protected> public
- * <email protected> help
- */
- function setHelp($data) {
- if (!is_array($data)) {
- $this->setError(19, "assistant -> setHelp(), illegal function call");
- return false;
- }
- $this->help = array (
- "name" => $data["name"],
- "label" => $data["label"],
- "help" => $data["help"]
- );
- return true;
- } // end func setHelp
+ } // end func restoreAssistant
- function setExitButton($label, $name) {
- global $PHP_SELF
- if (""==$name || ""==$label) {
- $this->setError(18, "assistant -> setExitButton(), illegal function call");
- return false;
- }
- if (""==$action)
- $action = $PHP_SELF;
-
- $this->exit = array (
- "name" => $name,
- "label" => $label
- );
- return true;
- } // end func setExitButton
- /**
- * Sets the label and name of a button that allows to exit the assistant
- * as soon as all forms are valid
- * <email protected> string $name
- * <email protected> string $label
- * <email protected> boolean $ok
- * <email protected> finish
- */
- function setFinishButton($label, $name) {
- if (""==$name || ""==$label ) {
- $this->setError(17, "assistant -> setFinishButton(), illegal function call");
- return false;
- }
- $this->finish_button = array (
- "name" => $name,
- "label" => $label
- );
- return true;
- } // end func setFinishButton
/**
* Sets the path to the templates
* <email protected> string $template
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> Runtime_WrongParam
* <email protected> public
*/
function setTemplatePath($template) {
if (""==$template) {
- $this->setError(16, "assistant -> setTemplatePath(), illegal function call");
+ $this->error = new exception_runtime_wrongparam("setTemplatePath(), illegal function call", 16, __FILE__, __LINE__);
return false;
}
$this->template = $template;
@@ -429,13 +158,14 @@
/**
* Creates a new template object
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> Runtime
* <email protected> private
* <email protected> assistant()
*/
function newTemplate() {
if (""==$this->template || 0==count($this->template_files)) {
- $this->setError(15, "assistant -> newTemplate(), illegal function call");
+ $this->error = new exception_runtime("newTemplate(), illegal function call", 15, __FILE__, __LINE__);
return false;
}
unset($this->tpl);
@@ -471,18 +201,17 @@
/**
* return the current page
* <email protected> string $html
+ * <email protected> runtime
* <email protected> public
* <email protected> show()
*/
function get() {
if (0==count($this->pages)) {
- $this->setError(14, "assistant -> get(), no pages in assistant");
+ $this->error = new exception_runtime("assistant -> get(), no pages in assistant", 14, __FILE__, __LINE__);
return "";
}
- #$this->introspection("me");
$this->lastviewed = $this->now;
-
$this->newTemplate();
$counter = 0;
@@ -560,224 +289,11 @@
"BUTTON_EXIT" => $exit,
"BUTTON_HELP" => $help
);
- #$this->introspection("REPLACE", $replace);
$this->tpl->set_var($replace);
$this->tpl->parse("out", "main", true);
+
return $this->tpl->get("out");
} // end func get()
-
- /**
- * return a reset button
- * <email protected> string $label
- * <email protected> string $hmtl
- * <email protected> private
- */
- function getResetButton($label) {
- if (""==(string)$label) {
- $this->setError(16, "assistant -> getResetButton(), illegal function call");
- return "";
- }
- return sprintf('<input type="reset" value="%s">', $label);
- } // end getResetButton
-
- /**
- * return a submit button
- * <email protected> string $label
- * <email protected> string $value
- * <email protected> string $name
- * <email protected> string $html
- * <email protected> private
- */
- function getButton($label, $value, $name="") {
- if (""==(string)$label || (""==(string)$value && ""==(string)$name)) {
- $this->setError(15, "assistent -> getButton(), illegal function call");
- return "";
- }
-
- if (""==$name)
- $name = sprintf("%s_%d", $this->buttonname, $value);
-
- $html = sprintf('<input type="submit" value="%s" name="%s">',
- $label,
- $name
- );
- return $html;
- } // end func getButton
-
- /**
- * Generate a tab.
- * <email protected> string $label
- * <email protected> boolean $optional
- * <email protected> boolean $noerror
- * <email protected> array ( $tab, $bgcolor )
- * <email protected> private
- */
- function getTab($label, $value, $optional, $noerror) {
-
- $html = sprintf('<input type="submit" value="%s" name="%s_%d">',
- $label,
- $this->buttonname,
- $value
- );
- if ($noerror)
- $bgcolor = ' bgcolor="#e0ffe0"';
- else
- $bgcolor = ' bgcolor="#ffe0e0"';
-
- return array($html, $bgcolor);
- } // end func getTab
-
- /**
- * print, generate and return the current page
- * <email protected> string $html
- * <email protected> public
- * <email protected> get()
- */
- function show() {
- $html = $this->get();
- print $html;
- return $html;
- } // end func show()
- /**
- * Generate tabs?
- * <email protected> boolean $ok
- * <email protected> public
- * <email protected> show_tabs
- */
- function showTabs($ok=true) {
- if (true!=$ok)
- $ok = false;
- $this->show_tabs = $ok;
- } // end func showTabs
-
- /**
- * Sets the opening form tag
- * <email protected> string $html
- * <email protected> string $method
- * <email protected> boolean $ok
- * <email protected> public
- * <email protected> getStart(), Start(), form_start
- */
- function setStart($html, $method="POST") {
- if (""==$html) {
- $this->setError(13, "assistant -> setStart(), illegal function call");
- return false;
- }
- $this->form_start = $html;
- $this->setMethod($method);
- return false;
- } // end func setStart
-
- function setMethod($method="POST") {
- if ("POST"!=strtoupper($method))
- $method = "GET";
-
- reset($this->pages);
- while (list($p_id, $data)=each($this->pages)) {
- $obj = $data["object"];
- $obj->setMethod($method);
- $this->pages[$p_id]["object"] = $obj;
- }
-
- $this->method = $method;
- } // end fun setMethod
-
- /**
- * Generate <form>-Tag
- * <email protected> string $js_name = ""
- * <email protected> enum(POST|GET) $method = "POST"
- * <email protected> string $action = ""
- * <email protected> string $target = ""
- * <email protected> string $form_name = ""
- * <email protected> string $html
- * <email protected> public
- * <email protected> setStart(), getStart()
- */
- function getStart($js_name="", $method="POST", $action="", $target="", $form_name="") {
- global $PHP_SELF;
-
- $html = "";
-
- $html.= sprintf('<form action="%s" target="%s" ',
- (""==$action) ? $PHP_SELF : $action,
- (""==$target) ? "_self" : $target
- );
-
- $method = ("GET"==strtoupper($method)) ? "GET" : "POST";
- if ($this->flag_file) {
- $html.= 'enctype="multipart/form-data" ';
- $method = "POST";
- }
- $html.= sprintf('method="%s" ', $method );
- $this->setMethod($method);
-
- if (""!=$js_name) {
- $this->js_name = $js_name;
- $html.= sprintf('name="%s" onSubmit="return %s_Validator(this, \'\')" ',
- $js_name,
- $js_name
- );
- }
-
- $html = substr($html, 0, -1);
- $html.=">".$this->cr_html;
-
- return $html;
- } // end fun getStart
-
-
- /**
- * generate, print and return the opening form tag
- * <email protected> string $js_name = ""
- * <email protected> enum(POST|GET) $method = "POST"
- * <email protected> string $action = ""
- * <email protected> string $target = ""
- * <email protected> string $form_name = ""
- * <email protected> string $html
- * <email protected> public
- * <email protected> getStart(), setStart()
- */
- function Start($js_name="", $method="POST", $action="", $target="", $form_name="") {
- $this->form_start = $this->getStart($js_name, $method, $action, $target, $form_name);
- } // end func Start
-
- /**
- * set the closing form tag
- * <email protected> string $html
- * <email protected> boolean $ok
- * <email protected> public
- * <email protected> getFinish(), Finish(), form_end
- */
- function setFinish($html) {
- if (""==$html) {
- $this->setError(13, "assistant -> setFinish(), illegal function call");
- return false;
- }
- $this->form_end = $html;
- return true;
- } // end func setFinish()
-
- /**
- * Generate closing </form>-Tag
- * <email protected> string $additional_html = ""
- * <email protected> string $html
- * <email protected> public
- * <email protected> setFinish(), Finish(), form_end
- */
- function getFinish($additional_html="") {
- return "</form>".$additional_html;
- }
-
- /**
- * generate, print and return the closing form tag
- * <email protected> string $additional_html = ""
- * <email protected> string $html
- * <email protected> public
- * <email protected> setFinish(), getFinish(), form_end
- */
- function Finish($additional_html="") {
- $this->form_end = $this->getFinish($additional_html="");
- } // end func Finish()
/**
* Get the values of the last form
@@ -858,7 +374,7 @@
/**
* Are all pages valid, is the requested page valid?
* <email protected> string $page = "", if empty test all
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function isValid($page="") {
@@ -916,7 +432,7 @@
/**
* Sets the error flags of all pages
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> private
*/
function setPageErrors() {
@@ -943,7 +459,7 @@
* page validation flags.
* <email protected> string $pages name of one page, "" means update all
* <email protected> array $pages array with page names
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function updatePageErrors($pages = "") {
@@ -1079,7 +595,7 @@
/**
* Add a page to the assistant
* <email protected> array $pagedata
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function addPage($pagedata) {
@@ -1141,7 +657,7 @@
* Sets the label and action for the button that finishes the form
* <email protected> string $label
* <email protected> string $action, fallback on $PHP_SELF
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function setFinish($label, $action="") {
@@ -1165,7 +681,7 @@
* Set the labels of some buttons
* <email protected> string|array $labels
* <email protected> string $value
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> labels
* <email protected> public
*/
@@ -1194,108 +710,5 @@
return $ok;
} // end func setLabel
- /**
- * Handle internal errors
- * <email protected> int $errno error code
- * <email protected> int $error errormessage
- * <email protected> private
- */
- function setError($errno, $error) {
- $this->errno = $errno;
- $this->error = $error;
-
- if ($this->flag_showerror)
- printf("\n(%d) %s<br>\n", $errno, $error);
- if ($this->flag_haltonerror)
- die(sprint("\n(%d) %s<br>\n", $errno, $error));
- } // end func setError
-
- /**
- * Returns last error code
- * <email protected> void
- * <email protected> public
- * <email protected> array( int $errno, string $error )
- */
- function getError() {
- return array($this->errno, $this->error);
- } // end func getError
-
- function introspection($title="", $data = "", $level=0, $userfunction=false) {
-
- if (""==$data)
- $data = $this;
-
- printf('<table border="1" cellspacing="4" cellpadding="4" bordercolor="Silver">%s',
- $this->cr_html
- );
-
- if (""!=$title)
- printf('<tr>%s<td colspan=4><b>%s</b></td>%s</tr>%s',
- $this->cr_html,
- $title,
- $this->cr_html,
- $this->cr_html
- );
-
- reset($data);
- while (list($k, $v)=each($data)) {
-
- if ("user function"==gettype($v) && !$userfunction)
- continue;
-
- if (is_object($v)) continue;
- #if ($level>4) continue;
-
- if (is_array($v) || is_object($v)) {
-
- if (is_array($v) && $level<1)
- $color="maroon";
- else
- $color="navy";
-
- printf('<tr>
- <td align="left" valign="top">
- <font color="%s"><pre><b>%s</b></pre></font>
- </td>
- <td align="left" valign="top"><font color="%s"><pre>=></pre></font></td>
- <td align="left" valign="top" colspan=2>',
- $color,
- $k,
- $color,
- $v
- );
- $this->introspection("", $v, ++$level);
- printf('</td>%s</tr>%s', $this->cr_html, $this->cr_html);
- $level--;
-
- } else {
-
- if (is_object($data) && $level>0)
- $color="navy";
- else
- $color="black";
-
- printf('<tr>
- <td align="left" valign="top">
- <font color="%s"><pre><b>%s</b></pre></font>
- </td>
- <td align="left" valign="top"><pre><font color="%s">=></pre></font></td>
- <td align="left" valign="top"><pre><font color="%s">[%s]</font></pre></td>
- <td align="left" valign="top"><pre><font color="%s">"%s"</font></pre></td>
- </tr>',
- $color,
- $k,
- $color,
- $color,
- gettype($v),
- $color,
- $v
- );
- }
- }
- print '</table>'.$this->cr_html;
-
- } // end func introspection
-
} // end class assistant
?>
Index: php-lib/php/form/assistant_gifimage.inc
diff -u php-lib/php/form/assistant_gifimage.inc:1.5 php-lib/php/form/assistant_gifimage.inc:1.6
--- php-lib/php/form/assistant_gifimage.inc:1.5 Thu May 4 14:08:43 2000
+++ php-lib/php/form/assistant_gifimage.inc Tue May 16 17:59:33 2000
@@ -1,5 +1,5 @@
<?php
-class asssistant_gifimage extends assistant {
+class panemanager_gifimage extends panemanger {
/**
* Path to the ttf font
@@ -31,7 +31,7 @@
/**
* See button_width!
- * <email protected> boolean $button_autosize
+ * <email protected> bool $button_autosize
* <email protected> private
* <email protected> button_width, button_height
*/
@@ -82,7 +82,7 @@
/**
* Render 3D tabs?
- * <email protected> boolean $flag_3d
+ * <email protected> bool $flag_3d
* <email protected> private
*/
var $flag_3d = true;
@@ -151,12 +151,13 @@
* <email protected> string $value
* <email protected> string $name
* <email protected> string $html
+ * <email protected> runtime_wrongparam, runtime_io
* <email protected> private
* <email protected> createButton()
*/
function getButton($label, $value, $name="") {
if (""==(string)$label || (""==(string)$value && ""==(string)$name)) {
- $this->setError(15, "assistant_gifimage -> getButton(), illegal function call");
+ $this->error = new exception_runtime_wrongparam("getButton(), illegal function call", 15, __FILE__, __LINE__);
return "";
}
@@ -167,7 +168,7 @@
if (!file_exists($this->cache_dir) || !is_dir($this->cache_dir)) {
$ok = <email protected>($this->cache_dir, 0755);
if (false == $ok) {
- $this->setError(52, "assistant_gifimage -> getButton(), can't create cache directory.");
+ $this->error = new exception_io("assistant_gifimage -> getButton(), can't create cache directory.", 52, __FILE__, __LINE__);
return "";
}
}
@@ -201,7 +202,8 @@
* <email protected> string $value
* <email protected> string $name = ""
* <email protected> private
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> system
* <email protected> getButton()
*/
function createButton($file, $label, $value, $name="") {
@@ -210,7 +212,7 @@
$im = <email protected>(500, 100);
if (false == $im) {
- $this->setError(53, "assistant_gifimage -> createButton(), can't create an image.");
+ $this->error = new exception_system("createButton(), can't create an image, no image support?", 53, __FILE__, __LINE__);
return false;
}
$pos = ImageTTFBBox($this->fsize, 0, $this->font, $label);
@@ -226,7 +228,7 @@
$im = <email protected>($width, $height);
if ( false == $im) {
- $this->setError(53, "assistant_gifimage -> createButton(), can't create an image.");
+ $this->error = new exception_system("assistant_gifimage -> createButton(), can't create an image.", 53, __FILE__, __LINE__);
return false;
}
@@ -266,9 +268,10 @@
/**
* Generate a graphical tab
* <email protected> string $label
- * <email protected> boolean $optional
- * <email protected> boolean $noerror
+ * <email protected> bool $optional
+ * <email protected> bool $noerror
* <email protected> array ( $tab, $bgcolor )
+ * <email protected> io
* <email protected> private
*/
function getTab($label, $value, $optional, $noerror) {
@@ -291,7 +294,7 @@
echo is_dir($this->cache_dir), "<br>", file_exists($this->cache_dir), "<br>";
$ok = <email protected>($this->cache_dir, 0755);
if (false == $ok) {
- $this->setError(50, "assistant_gifimage -> getTab(), can't create cache directory.");
+ $this->error = new exception_io("assistant_gifimage -> getTab(), can't create cache directory.", 50, __FILE__, __LINE__);
return array("", $bgcolor);
}
}
@@ -321,9 +324,10 @@
* <email protected> string $file filename used to save the tab
* <email protected> string $label
* <email protected> string $value
- * <email protected> boolean $optional
- * <email protected> boolean $noerror
- * <email protected> boolean $ok
+ * <email protected> bool $optional
+ * <email protected> bool $noerror
+ * <email protected> bool $ok
+ * <email protected> system
* <email protected> private
* <email protected> getTab()
*/
@@ -331,7 +335,7 @@
$im = <email protected>($this->tab_width, $this->tab_height);
if ( false == $im) {
- $this->setError(50, "assistant_gifimage -> createTab(), can't create an image.");
+ $this->error = new exception_system("assistant_gifimage -> createTab(), can't create an image.", 50, __FILE__, __LINE__);
return false;
}
@@ -426,13 +430,14 @@
/**
* Is the Button "Finish" pressed?
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> runtime
* <email protected> isExitPressed(), isHelpPressed
* <email protected> public
*/
function isFinishPressed() {
if (!isset($this->finish_button["name"])) {
- $this->setError(66, "form->isFinishPressed(), there's no finish button defined");
+ $this->error = new exception_runtime("isFinishPressed(), there's no finish button defined", 66, __FILE__, __LINE__);
return false;
}
return $this->issetHTTPXVAR($this->finish_button["name"]."_x");
@@ -440,13 +445,14 @@
/**
* Is the Button "Exit" pressed?
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> runtime
* <email protected> isFinishPressed(), isHelpPressed()
* <email protected> public
*/
function isExitPressed() {
if (!isset($this->exit["name"])) {
- $this->setError(67, "form->isExitPressed(), there's no exit button defined");
+ $this->error = new exception_runtime("isExitPressed(), there's no exit button defined", 67, __FILE__, __LINE__);
return false;
}
return $this->issetHTTPXVAR($this->exit["name"]."_x");
@@ -454,13 +460,14 @@
/**
* Is the Button "Help" pressed?
- * <email protected> boolean $ok
+ * <email protected> bool $ok
+ * <email protected> runtime
* <email protected> isFinishPressed(), isExitPressed()
* <email protected> public
*/
function isHelpPressed() {
if (!isset($this->help["name"])) {
- $this->setError(68, "form->isHelpPressed(), there's no help button defined");
+ $this->error = new exception_runtime("isHelpPressed(), there's no help button defined", 68, __FILE__, __LINE__);
return false;
}
return $this->issetHTTPXVAR($this->help["name"]."_x");
Index: php-lib/php/form/form.inc
diff -u php-lib/php/form/form.inc:1.5 php-lib/php/form/form.inc:1.6
--- php-lib/php/form/form.inc:1.5 Mon May 8 19:31:38 2000
+++ php-lib/php/form/form.inc Tue May 16 17:59:33 2000
@@ -1,6 +1,8 @@
<?php
/**
* "Main" class
+* <email protected> Ulf Wendel <ulf <email protected>>
+* <email protected> 0.1
*/
class form {
/**
@@ -39,7 +41,7 @@
/**
* Is there a file element in our form
- * <email protected> boolean $flag_file = false
+ * <email protected> bool $flag_file = false
* <email protected> private
*/
var $flag_file = false;
@@ -129,7 +131,7 @@
/**
* Is this checkbox checked
- * <email protected> boolean $checked
+ * <email protected> bool $checked
*/
function isChecked($elname) {
@@ -190,7 +192,7 @@
/**
* Loads the form with HTTP_[POST|GET]_VARS
* <email protected> array $ellist
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function autoloadValues($ellist="") {
@@ -269,7 +271,7 @@
* Sets the values of elements
* You'll need it to reload submitted values
* <email protected> array $values elementname => value
- * <email protected> boolean $ok false => unknown element(s), illegal function call
+ * <email protected> bool $ok false => unknown element(s), illegal function call
* <email protected> public
*/
function setValues($values) {
@@ -310,8 +312,8 @@
* <email protected> string|array $ellist Eigther string: element name or
* Array: element name => string|array events,
* if events = all gets automatically expanded
- * <email protected> boolean $status = false, false => off, true => on
- * <email protected> boolean $ok
+ * <email protected> bool $status = false, false => off, true => on
+ * <email protected> bool $ok
* <email protected> private
* <email protected> ValidationOn(), ValidationOff()
*/
@@ -355,7 +357,7 @@
* <email protected> string|array $ellist List of elements
* <email protected> Validation(), ValidationOn()
* <email protected> private
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function ValidationOff($ellist) {
return $this->Validation($ellist, false);
@@ -367,7 +369,7 @@
* <email protected> string|array $ellist List of elements
* <email protected> Validation(), ValidationOff()
* <email protected> private
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function ValidationOn($ellist) {
return $this->Validation($ellist, true);
@@ -542,7 +544,7 @@
/**
* add an element to the form
* <email protected> array $element_data
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function addElement($element_data) {
@@ -669,7 +671,7 @@
* Return the current value of an element.
* Use the function within your custom validation functions
* <email protected> string $name element name
- * <email protected> array(boolean $ok, mixed $value)
+ * <email protected> array(bool $ok, mixed $value)
* <email protected> public
*/
function getValue($name) {
@@ -720,7 +722,7 @@
* <email protected> string $name
* <email protected> string $label
* <email protected> string $value = ""
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
* <email protected> getNewComboOption(), SetOptions(), getOptions()
*/
@@ -746,7 +748,7 @@
* <email protected> string $function name of the calling function, used to generate the errormessage
* <email protected> string $name name of the element to look for
* <email protected> array $errno 0 => errno for "no element specifies", 1 => errno for "unknown..."
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> private
*/
function ElementExists($function, $name, $errno) {
@@ -862,7 +864,7 @@
/**
* Set (save) an validation error of an element
* <email protected> string $name element name
- * <email protected> boolean $ok true => don't care, false => save error
+ * <email protected> bool $ok true => don't care, false => save error
* <email protected> string $message
* <email protected> private
* <email protected> getValidationResult(), validate()
@@ -970,7 +972,7 @@
* add JavaScript validation code
* <email protected> string $name name of the element
* <email protected> string $code JavaScript code
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function addJS($name, $code) {
@@ -994,7 +996,7 @@
* Set JavaScript validation code
* <email protected> string $name name of the element
* <email protected> string $code JavaScript code
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function setJS($name, $code) {
@@ -1061,7 +1063,7 @@
* Set the default size, works with text and textarea elements
* <email protected> int $size
* <email protected> public
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function setSize($size) {
if ((int)$size<1) {
@@ -1076,7 +1078,7 @@
* Set the default maxlength, works with text and textarea elements
* <email protected> int $maxlength
* <email protected> public
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function setMaxlength($maxlength) {
if ((int)$maxlength<1) {
@@ -1220,7 +1222,7 @@
* Helpful with dynamically changing trees
* <email protected> array $ellist
* <email protected> public
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function setTree($ellist) {
if (!is_array($ellist)) {
@@ -1271,7 +1273,7 @@
/*
* Sets the options of a combobox
* <email protected> string|array $ellist
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
* <email protected> getOptions()
*/
Index: php-lib/php/form/form_elements.inc
diff -u php-lib/php/form/form_elements.inc:1.6 php-lib/php/form/form_elements.inc:1.7
--- php-lib/php/form/form_elements.inc:1.6 Fri May 5 16:47:31 2000
+++ php-lib/php/form/form_elements.inc Tue May 16 17:59:34 2000
@@ -1,8 +1,8 @@
<?php
/**
* Base of all form Elements
+*
*
-*
*/
class form_elements {
function form_elements ( $element_data, $method, $js_name="", $js_mode="", $cr_html="", $cr_js="", $cr="", $showerror="", $haltonerror="" ) {
@@ -134,14 +134,14 @@
/**
* Is this element frozen?
- * <email protected> boolean $flag_frozen = false
+ * <email protected> bool $flag_frozen = false
* <email protected> private
*/
var $flag_frozen = false;
/**
* Do we have elements of typ file?
- * <email protected> boolean $flag_file = false;
+ * <email protected> bool $flag_file = false;
* <email protected> private
* <email protected> isFile()
*/
@@ -149,7 +149,7 @@
/**
* Is this a hidden element?
- * <email protected> boolean $flag_hidden = false
+ * <email protected> bool $flag_hidden = false
* <email protected> private
* <email protected> isHidden()
*/
@@ -157,7 +157,7 @@
/**
* Is this a radio element?
- * <email protected> boolean $flag_radio = false
+ * <email protected> bool $flag_radio = false
* <email protected> private
* <email protected> isRadio()
*/
@@ -165,7 +165,7 @@
/**
* Is this a button (reset/image/submit)
- * <email protected> boolean $flag_button = false
+ * <email protected> bool $flag_button = false
* <email protected> private
* <email protected> isButton()
*/
@@ -202,7 +202,7 @@
/**
* javascript validation code set by user?
- * <email protected> boolean $flag_setjs = false;
+ * <email protected> bool $flag_setjs = false;
* <email protected> private
*/
var $flag_setjs = false;
@@ -244,7 +244,7 @@
/**
* Sets the name of the custom validation function
* <email protected> string $validator
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> getValidator()
*/
function setValidator($validator) {
@@ -299,7 +299,7 @@
/**
* Is this checkbox checked?
- * <email protected> boolean $checked
+ * <email protected> bool $checked
* <email protected> private (public to form)
*/
function isChecked() {
@@ -340,7 +340,7 @@
/**
* Default validation of this element
* <email protected> ??? $value
- * <email protected> array( boolean $ok, string $message )
+ * <email protected> array( bool $ok, string $message )
*/
function validate() {
$ok = true;
@@ -352,8 +352,8 @@
* Set the reacton flags. Which part of the default validator is used
* for validation?
* <email protected> array|string $event, if set to "all" all events are set to status
- * <email protected> boolean $status
- * <email protected> boolean $ok
+ * <email protected> bool $status
+ * <email protected> bool $ok
* <email protected> public
* <email protected> val_events
*/
@@ -387,7 +387,7 @@
/**
* Loads the value
* <email protected> string $value
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function setValue($value) {
@@ -404,7 +404,7 @@
/**
* add JavaScript validation code
* <email protected> string $code
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function addJS($code) {
@@ -442,7 +442,7 @@
/**
* generate default JavaScript validation code
* <email protected> private
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function generateJS() {
@@ -538,7 +538,7 @@
/**
* Do we validate this event?
* <email protected> string $event
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> private
*/
function doValidation($event) {
@@ -599,7 +599,7 @@
/**
* Is this a radio element?
- * <email protected> boolean
+ * <email protected> bool
* <email protected> public
*/
function isRadio() {
@@ -608,7 +608,7 @@
/**
* Is this a hidden element?
- * <email protected> boolean
+ * <email protected> bool
* <email protected> public
*/
function isHidden() {
@@ -617,7 +617,7 @@
/**
* Is this a file element
- * <email protected> boolean
+ * <email protected> bool
* <email protected> public
*/
function isFile() {
@@ -654,7 +654,7 @@
* Set the options
* helpful with combobox
* <email protected> public
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function setOptions($options) {
return false;
@@ -665,7 +665,7 @@
* <email protected> string $label
* <email protected> string $value
* <email protected> public
- * <email protected> boolean $ok
+ * <email protected> bool $ok
*/
function addOption($label, $value="") {
return true;
@@ -694,7 +694,7 @@
* Set the current tree
* helpful with treeview
* <email protected> array $tree
- * <email protected> boolean $ok
+ * <email protected> bool $ok
* <email protected> public
*/
function setTree($tree) {
@@ -2251,7 +2251,7 @@
/**
* Is this checkbox checked?
- * <email protected> boolean $checked
+ * <email protected> bool $checked
*/
function isChecked() {
return $this->checked;
Index: php-lib/php/form/template_bridge.inc
diff -u php-lib/php/form/template_bridge.inc:1.6 php-lib/php/form/template_bridge.inc:1.7
--- php-lib/php/form/template_bridge.inc:1.6 Thu May 4 14:08:44 2000
+++ php-lib/php/form/template_bridge.inc Tue May 16 17:59:34 2000
@@ -31,6 +31,7 @@
} // end func template_bridge
function Init() {
+ die();
} // end func Init()
/**
@@ -92,12 +93,11 @@
* <email protected> setImagepath()
*/
var $imagepath = "";
-
+
/**
* Array of all elements
*/
- var $elements = array();
-
+ var $elements = array();
/**
* Object of form we're working on
* <email protected> object $form
@@ -133,8 +133,8 @@
/**
* How to handle errors
- * <email protected> boolean $showerror = false
- * <email protected> boolean $haltonerror = false
+ * <email protected> bool $showerror = false
+ * <email protected> bool $haltonerror = false
* <email protected> private
* <email protected> getError(), setError(), showError, haltonerror, showerror
*/
@@ -151,12 +151,14 @@
/**
* Sets the path to the template
* <email protected> string $template
+ * <email protected> bool $ok
+ * <email protected> runtime_wrongparam
* <email protected> template
* <email protected> public
*/
function setTemplatePath($template) {
if (""==$template) {
- $this->setError(31, "template_bridge -> setTemplatePath(), illegal function call");
+ $this->error = new exception_runtime_wrongparam("template_bridge -> setTemplatePath(), illegal function call", 31, __FILE__, __LINE__);
return false;
}
$this->template = $template;
@@ -165,13 +167,15 @@
/**
* Sets the template files
- * <email protected> string|array $template_files
+ *

