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

From: uw
Date: Thu Apr 27 18:15:09 2000
Modified files:
      php-lib/pages/form/example_assistant.inc
      php-lib/php/form/assistant.inc

Log message:
- bugfixes setFinishButton()
- example modified to follow new syntax

Index: php-lib/pages/form/example_assistant.inc
diff -u php-lib/pages/form/example_assistant.inc:1.2 php-lib/pages/form/example_assistant.inc:1.3
--- php-lib/pages/form/example_assistant.inc:1.2 Mon Apr 17 12:42:33 2000
+++ php-lib/pages/form/example_assistant.inc Thu Apr 27 18:14:37 2000
@@ -7,7 +7,15 @@
                 
                 $this->setTemplatePath("/home/www/servers/ulf.dev.netuse.de/pages/newooh/templates/");
                 $this->setMode("strict");
- $this->setFinish("Finish the assistant", "finish.php3");
+ $this->setFinishButton("Finish the assistant", "button_finish");
+ $this->setExitButton("X", "button_exit");
+ $this->setHelp(
+ array(
+ "name" => "button_help",
+ "label" => "?",
+ "help" => "Some help on using the form show as a comment"
+ )
+ );
                 
                 $this->setLabel(
                                                                                         array(
Index: php-lib/php/form/assistant.inc
diff -u php-lib/php/form/assistant.inc:1.4 php-lib/php/form/assistant.inc:1.5
--- php-lib/php/form/assistant.inc:1.4 Wed Apr 26 18:33:21 2000
+++ php-lib/php/form/assistant.inc Thu Apr 27 18:14:38 2000
@@ -234,7 +234,7 @@
         } // end func getPageValues
         
         /**
- * Set the label, name and comment text that belogn to the help button
+ * Set the label, name and comment text that belongs to the help button
         *  <email protected> array $data
         *  <email protected> boolean $ok
         *  <email protected> public
@@ -253,15 +253,18 @@
                 return true;
         } // end func setHelp
         
- function setExitButton($name, $label) {
+ 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
+ "name" => $name,
+ "label" => $label
                                                                                                 );
                 return true;
         } // end func setExitButton
@@ -274,14 +277,14 @@
         *  <email protected> boolean $ok
         *  <email protected> finish
         */
- function setFinishButton($name, $label) {
- if (""==$name || ""==$label) {
+ 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
+ "name" => $name,
+ "label" => $label
                                                                                                         );
                 return true;
         } // end func setFinishButton
@@ -434,7 +437,7 @@
                                                                                                 "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");
@@ -779,6 +782,10 @@
                         $this->selected = -2;
                         return false;
                 }
+ if (isset($data[$this->exit["name"]])) {
+ $this->selected = -3;
+ return false;
+ }
 
                 $len = strlen($this->buttonname);
                 reset($data);
@@ -799,8 +806,7 @@
                 
                 $ok = $this->findSelected();
                 if (-1 == $this->selected) {
- $this->now = 0;
- $this->lastviewed = "";
+ $this->now = $this->lastviewed;
                         return false;
                 }
                 if (-2 == $this->selected) {
@@ -808,17 +814,21 @@
                         $this->flag_specials = "help";
                         return true;
                 }
+ if (-3 == $this->selected) {
+ $this->now = $this->lastviewed;
+ $this->flag_specials = "exit";
+ }
                 
                 if ("strict"!=$this->mode) {
                         $this->now = $this->selected;
                         return;
                 }
                 
- list($prev, $next)=$this->getNeighbour($this->lastviewed);
- if ($this->selected<=$next && $this->page_errors[$this->selected]) {
+ if ($this->page_errors[$this->selected] && $this->page_errors[0]) {
                         $this->now = $this->selected;
                         return;
                 }
+
                 if (!$this->page_errors[$this->lastviewed]) {
                         $this->now = $this->lastviewed;
                         return;

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