Date: 05/03/00
- Next message: athompso: "[phplib-dev] cvs commit"
- Next in thread: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: uw
Date: Wed May 3 12:39:49 2000
Modified files:
php-lib/php/form/assistant.inc
php-lib/php/form/assistant_gifimage.inc
Log message:
- added methods isFinishPressed(), isExitPressed(), isHelpPressed()
Index: php-lib/php/form/assistant.inc
diff -u php-lib/php/form/assistant.inc:1.7 php-lib/php/form/assistant.inc:1.8
--- php-lib/php/form/assistant.inc:1.7 Fri Apr 28 16:49:42 2000
+++ php-lib/php/form/assistant.inc Wed May 3 12:39:48 2000
@@ -178,7 +178,7 @@
* Label and name of a button that exits the assistant
* <email protected> array $finish
* <email protected> private
- * <email protected> setFinishButton()
+ * <email protected> setFinishButton(), isFinishPressed()
*/
var $finish_button = array();
@@ -186,7 +186,7 @@
* Label and name of a exit button that always to abort the assistant
* <email protected> array $exit
* <email protected> private
- * <email protected> setExitButton
+ * <email protected> setExitButton, isExitPressed()
*/
var $exit = array();
@@ -194,7 +194,7 @@
* Label, name and comment text that belongs to the help button
* <email protected> array $help
* <email protected> private
- * <email protected> setHelp()
+ * <email protected> setHelp(), isHelpPressed()
*/
var $help = array();
@@ -224,6 +224,82 @@
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()
+ */
+ 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
+ */
+ 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()
+ */
+ 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()
+ */
+ 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
@@ -824,21 +900,49 @@
} // end func setPageErrors
/**
- * If the user sets some page_values in init()
- * this method must be called to update the page validation flags
+ * If you override some page_values in Init() you have to update the
+ * 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> public
*/
- function updatePageErrors() {
-
- if ($this->now != $this->lastviewed) {
- $obj = $this->pages[$this->now]["object"];
- $obj->restoreSessionHash($this->page_values[$this->now]);
- $this->page_errors[$this->now] = ($obj->isValid()) ? true : false;
- return true;
+ function updatePageErrors($pages = "") {
+
+ if (""==$pages) {
+ reset($this->pages);
+ while (list($page, $data)=each($this->pages))
+ $pages[] = $page;
}
- return false;
+ if (""!=$pages)
+ $pages = array($pages);
+
+ if (0==count($pages)) {
+ $this->setError(63, "form -> updatePageErrors(), no pages in assistant or no pages provided");
+ return false;
+ }
+
+
+ $ok = true;
+ $unknown = "";
+
+ reset($pages);
+ while (list($k, $page)=each($pages)) {
+ if (isset($this->page_values[$page])) {
+ $obj = $this->pages[$page]["object"];
+ $obj->restoreSessionHash($this->page_values[$page]);
+ $this->page_errors[$page] = ($obj->isValid()) ? true : false;
+ } else
+ $unknown.= "'$page' ";
+ }
+
+ if (""!=$unknown) {
+ $this->setError(64, "form -> updatePageErrors(), unknown pages: $unknown");
+ $ok = false;
+ }
+
+ return $ok;
} // end func updatePageErrors
function findSelected() {
Index: php-lib/php/form/assistant_gifimage.inc
diff -u php-lib/php/form/assistant_gifimage.inc:1.3 php-lib/php/form/assistant_gifimage.inc:1.4
--- php-lib/php/form/assistant_gifimage.inc:1.3 Fri Apr 28 13:14:18 2000
+++ php-lib/php/form/assistant_gifimage.inc Wed May 3 12:39:48 2000
@@ -45,7 +45,7 @@
* <email protected> private
* <email protected> button_height
*/
- var $button_width = 10;
+ var $button_width = 15;
/**
* Height of a button, see button_width
@@ -143,8 +143,8 @@
* <email protected> int $tab_border
* <email protected> private
*/
- var $tab_border = 1;
-
+ var $tab_border = 1;
+
/**
* return a submit button
* <email protected> string $label
@@ -426,6 +426,45 @@
);
return $hex;
} // end func GDColor
+
+ /**
+ * Is the Button "Finish" pressed?
+ * <email protected> boolean $ok
+ * <email protected> isExitPressed(), isHelpPressed
+ */
+ 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"]."_x");
+ } // end func isFinishPressed()
+
+ /**
+ * Is the Button "Exit" pressed?
+ * <email protected> boolean $ok
+ * <email protected> isFinishPressed(), isHelpPressed()
+ */
+ function isExitPressed() {
+ if (!isset($this->exit["name"])) {
+ $this->setError(67, "form->isExitPressed(), there's no exit button defined");
+ return false;
+ }
+ return $this->issetHTTPXVAR($this->exit["name"]."_x");
+ } // end func isExitPressed()
+
+ /**
+ * Is the Button "Help" pressed?
+ * <email protected> boolean $ok
+ * <email protected> isFinishPressed(), isExitPressed()
+ */
+ function isHelpPressed() {
+ if (!isset($this->help["name"])) {
+ $this->setError(68, "form->isHelpPressed(), there's no help button defined");
+ return false;
+ }
+ return $this->issetHTTPXVAR($this->help["name"]."_x");
+ } // end func isHelpPressed()
} // end class assistant_gifimage
?>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: athompso: "[phplib-dev] cvs commit"
- Next in thread: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: athompso: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: ssilk: "[phplib-dev] cvs commit"
- Maybe reply: uw: "[phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

