[phplib-dev] cvs commit From: uw (phplib-dev <email protected>)
Date: 05/05/00

From: uw
Date: Fri May 5 16:47:32 2000
Modified files:
      php-lib/php/form/assistant.inc
      php-lib/php/form/form_elements.inc

Log message:
Same procedure as every day, Ulf? Same proceduce as every day, Miss
Bugwatch.

Index: php-lib/php/form/assistant.inc
diff -u php-lib/php/form/assistant.inc:1.8 php-lib/php/form/assistant.inc:1.9
--- php-lib/php/form/assistant.inc:1.8 Wed May 3 12:39:48 2000
+++ php-lib/php/form/assistant.inc Fri May 5 16:47:31 2000
@@ -230,7 +230,8 @@
         * The varibale must be scalar, arrays are not
         * supported
         *  <email protected> boolean $ok
- *  <email protected> isHelpPressed(), isExitPressed(), isFinishPressed()
+ *  <email protected> isHelpPressed(), isExitPressed(), isFinishPressed()
+ *  <email protected> private
         */
         function issetHTTPXVAR($varname) {
                 global $HTTP_POST_VARS, $HTTP_GET_VARS;
@@ -262,6 +263,7 @@
         * Is the Button "Finish" pressed?
         *  <email protected> boolean $ok
         *  <email protected> isExitPressed(), isHelpPressed
+ *  <email protected> public
         */
         function isFinishPressed() {
                 if (!isset($this->finish_button["name"])) {
@@ -275,7 +277,8 @@
         /**
         * Is the Button "Exit" pressed?
         *  <email protected> boolean $ok
- *  <email protected> isFinishPressed(), isHelpPressed()
+ *  <email protected> isFinishPressed(), isHelpPressed()
+ *  <email protected> public
         */
         function isExitPressed() {
                 if (!isset($this->exit["name"])) {
@@ -290,6 +293,7 @@
         * Is the Button "Help" pressed?
         *  <email protected> boolean $ok
         *  <email protected> isFinishPressed(), isExitPressed()
+ *  <email protected> public
         */
         function isHelpPressed() {
                 if (!isset($this->help["name"])) {
@@ -759,12 +763,14 @@
         *  <email protected> private
         */
         function loadFormValues() {
- if ($this->lastviewed == $this->now || !isset($this->page_values[$this->now]))
- return;
-
+
                 $obj = $this->pages[$this->now]["object"];
- $obj->restoreSessionHash($this->page_values[$this->now]);
- $this->pages[$this->now]["object"] = $obj;
+ if ($this->lastviewed != $this->now && isset($this->page_values[$this->now])) {
+ $obj->restoreSessionHash($this->page_values[$this->now]);
+ $this->pages[$this->now]["object"] = $obj;
+ }
+ $this->page_errors[$this->now] = ($obj->isValid()) ? true : false;
+
         } // end func loadFormValues()
         
         /**
@@ -915,21 +921,22 @@
                                 $pages[] = $page;
                 }
                 
- if (""!=$pages)
+ if (!is_array($pages))
                         $pages = array($pages);
                 
                 if (0==count($pages)) {
- $this->setError(63, "form -> updatePageErrors(), no pages in assistant or no pages provided");
+ $this->setError(63, "form -> updatePageErrors(), no pages defined?");
                         return false;
                 }
-
                         
                 $ok = true;
                 $unknown = "";
                                         
                 reset($pages);
                 while (list($k, $page)=each($pages)) {
- if (isset($this->page_values[$page])) {
+ if (isset($this->page_values[$page]) ) {
+ if (isset($this->pages[$page]["optional"]))
+ continue;
                                 $obj = $this->pages[$page]["object"];
                                 $obj->restoreSessionHash($this->page_values[$page]);
                                 $this->page_errors[$page] = ($obj->isValid()) ? true : false;
@@ -1202,8 +1209,10 @@
                         
                         if ("user function"==gettype($v) && !$userfunction)
                                 continue;
- if (is_object($v))
- continue;
+
+ if (is_object($v)) continue;
+ #if ($level>4) continue;
+
                         if (is_array($v) || is_object($v)) {
                                 
                                 if (is_array($v) && $level<1)
Index: php-lib/php/form/form_elements.inc
diff -u php-lib/php/form/form_elements.inc:1.5 php-lib/php/form/form_elements.inc:1.6
--- php-lib/php/form/form_elements.inc:1.5 Thu May 4 14:08:43 2000
+++ php-lib/php/form/form_elements.inc Fri May 5 16:47:31 2000
@@ -296,8 +296,17 @@
                         return $this->getfrozen($value);
                 return "";
         } // end func get()
-
+
         /**
+ * Is this checkbox checked?
+ *  <email protected> boolean $checked
+ *  <email protected> private (public to form)
+ */
+ function isChecked() {
+ return false;
+ } // end func isChecked
+
+ /**
         * Returns the generated html in frozen style
         *  <email protected> string $value, only used with radio buttons!
         *  <email protected> string $html
@@ -416,7 +425,7 @@
                 $this->js_code=$code;
                 $this->flag_setjs = true;
         } // end func setJS
-
+
         /**
         * returns JavaScript validation code
         *  <email protected> int $js_errid = 0
@@ -2240,6 +2249,26 @@
         var $tabindex = "";
         var $additional_html = "";
         
+ /**
+ * Is this checkbox checked?
+ *  <email protected> boolean $checked
+ */
+ function isChecked() {
+ return $this->checked;
+ } // end func isChecked
+
+
+ function setValue($value) {
+ if (is_array($value) || is_object($value)) {
+ $this->setError(55, "form_elements_checkbox -> setValue() - the value of this element must be skalar data");
+ return false;
+ }
+
+ if ($this->value == $value)
+ $this->checked = true;
+ return true;
+ } // end func setValue
+
         function get($value="") {
 
                 if (true == $this->flag_frozen)
@@ -2248,7 +2277,7 @@
                 $html = "";
                 $html.= sprintf('<input type="checkbox" name="%s" ', $this->name, $this->value );
                 
- if ($this->checked)
+ if (true == $this->checked)
                         $html.= 'checked ';
                 if (""!=$this->accesskey)
                         $html.= sprintf('accesskey="%s" ', $this->accesskey);

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>