]> git.mxchange.org Git - shipsimu.git/commitdiff
Registration form and form helper completed, XHTML markup errors fixed
authorRoland Häder <roland@mxchange.org>
Tue, 27 May 2008 12:18:50 +0000 (12:18 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 27 May 2008 12:18:50 +0000 (12:18 +0000)
23 files changed:
.gitattributes
application/selector/templates/de/code/selector_main.ctp
application/ship-simu/config.php
application/ship-simu/templates/de/code/header.ctp
application/ship-simu/templates/de/code/register.ctp
inc/classes/exceptions/helper/.htaccess [new file with mode: 0644]
inc/classes/exceptions/helper/class_FormClosedException.php [new file with mode: 0644]
inc/classes/exceptions/helper/class_FormGroupClosedException.php [new file with mode: 0644]
inc/classes/exceptions/helper/class_FormOpenedException.php [new file with mode: 0644]
inc/classes/exceptions/helper/class_InvalidFormNameException.php [new file with mode: 0644]
inc/classes/exceptions/template/class_FormClosedException.php [deleted file]
inc/classes/exceptions/template/class_FormOpenedException.php [deleted file]
inc/classes/exceptions/template/class_InvalidFormNameException.php [deleted file]
inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/helper/class_
inc/classes/main/helper/class_BaseHelper.php [new file with mode: 0644]
inc/classes/main/helper/class_BaseTemplateHelper.php [deleted file]
inc/classes/main/helper/web/class_HtmlFormHelper.php [deleted file]
inc/classes/main/helper/web/class_WebFormHelper.php [new file with mode: 0644]
inc/classes/main/template/class_TemplateEngine.php
inc/config.php
templates/de/code/header.ctp

index 7c2e3278ee3b1df40bc7d0774e68481687ba523f..afa5c070965b9415e1661427887d35beb542b741 100644 (file)
@@ -153,6 +153,11 @@ inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -t
 inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php -text
 inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php -text
 inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text
+inc/classes/exceptions/helper/.htaccess -text
+inc/classes/exceptions/helper/class_FormClosedException.php -text
+inc/classes/exceptions/helper/class_FormGroupClosedException.php -text
+inc/classes/exceptions/helper/class_FormOpenedException.php -text
+inc/classes/exceptions/helper/class_InvalidFormNameException.php -text
 inc/classes/exceptions/io/.htaccess -text
 inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
 inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text
@@ -197,10 +202,7 @@ inc/classes/exceptions/template/.htaccess -text
 inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
 inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text
 inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text
-inc/classes/exceptions/template/class_FormClosedException.php -text
-inc/classes/exceptions/template/class_FormOpenedException.php -text
 inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text
-inc/classes/exceptions/template/class_InvalidFormNameException.php -text
 inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text
 inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
 inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
@@ -288,9 +290,9 @@ inc/classes/main/factories/web/.htaccess -text
 inc/classes/main/factories/web/class_NewsFactory.php -text
 inc/classes/main/helper/.htaccess -text
 inc/classes/main/helper/class_ -text
-inc/classes/main/helper/class_BaseTemplateHelper.php -text
+inc/classes/main/helper/class_BaseHelper.php -text
 inc/classes/main/helper/web/.htaccess -text
-inc/classes/main/helper/web/class_HtmlFormHelper.php -text
+inc/classes/main/helper/web/class_WebFormHelper.php -text
 inc/classes/main/io/.htaccess -text
 inc/classes/main/io/class_FileIoStream.php -text
 inc/classes/main/io/class_FrameworkDirectoryPointer.php -text
index 4779a57de40b42b4e4db41ea7a9219ae7b97afe3..1bdaaee3c34cb0478a4f584de41f68b9e92797f9 100644 (file)
@@ -1,15 +1,17 @@
-<!-- A compileable template for the application selector //-->
-
 {?header?}
 
 {?navigation?}
 
 <div id="main_header">
-       [HEADER_APPLICATION_SELECTOR]
+[HEADER_APPLICATION_SELECTOR]
 </div>
 
 <div id="main_content">
-       {?selector_apps?}
+{?selector_apps?}
+</div>
+
+<div id="main_footer">
+[FOOTER_APPLICATION_SELECTOR]
 </div>
 
-{?footer_msg:footer_msg=[FOOTER_APPLICATION_SELECTOR]?}
+{?footer?}
index a1c85d66eefc03894eb75ae7c1885352ec5814b6..7c924f268f4bea0c958bf58094af8568dece31ff 100644 (file)
@@ -31,5 +31,41 @@ $cfg->setConfigEntry("default_command", "home");
 // CFG: HOME-WITH-NEWS
 $cfg->setConfigEntry("home_with_news", "Y");
 
+// CFG: FORM-ACTION
+$cfg->setConfigEntry("form_action", "index.php?app={?app_short_name?}&amp;page=do_form");
+
+// CFG: FORM-METHOD
+$cfg->setConfigEntry("form_method", "post");
+
+// CFG: FORM-TARGET
+$cfg->setConfigEntry("form_target", "_self");
+
+// CFG: REGISTRATION-REQUIRES-EMAIL
+$cfg->setConfigEntry("register_requires_email", "Y");
+
+// CFG: REGISTRATION-INCLUDES-PROFILE
+$cfg->setConfigEntry("register_includes_profile", "Y");
+
+// CFG: REGISTRATION-PERSONAL-DATA
+$cfg->setConfigEntry("register_personal_data", "Y");
+
+// CFG: CHAT-ENABLED-ICQ
+$cfg->setConfigEntry("chat_enabled_icq", "Y");
+
+// CFG: CHAT-ENABLED-JABBER
+$cfg->setConfigEntry("chat_enabled_jabber", "Y");
+
+// CFG: CHAT-ENABLED-YAHOO
+$cfg->setConfigEntry("chat_enabled_yahoo", "Y");
+
+// CFG: CHAT-ENABLED-AOL
+$cfg->setConfigEntry("chat_enabled_aol", "Y");
+
+// CFG: CHAT-ENABLED-MSN
+$cfg->setConfigEntry("chat_enabled_msn", "Y");
+
+// CFG: COMMAND-PARAMETER
+$cfg->setConfigEntry("command_parameter", "page");
+
 // [EOF]
 ?>
index 2306a6bffc828d8dbf3e0538e6bee23a7eae6860..2134e431fa4795f99805c901e0625407676ea494 100644 (file)
@@ -10,7 +10,7 @@
        <meta name="keywords" content="$config[meta_keywords]" />
        <meta name="robots" content="index,follow" />
        <meta name="description" content="$config[meta_description]" />
-       <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+       <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <meta http-equiv="content-style-type" content="text/css" />
        <meta http-equiv="content-script-type" content="text/javascript" />
        <meta http-equiv="language" content="de" />
index cfdbf8c117a2767487112e7b0ddaf8fabecb9aca..adc4561d38e9ec4022216f3c53477ed3a5233ba0 100644 (file)
@@ -1,13 +1,13 @@
 <?php
-// Get helper instance for HTML forms. This will add the opening form-tag to
+// Get helper instance for web forms. This will add the opening form-tag to
 // the helper's render cache which is simply a small variable in the class
-// BaseTemplateHelper.
-$helper = HtmlFormHelper::createHtmlFormHelper($this, "register_form");
+// BaseHelper.
+$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_register");
 
 // Nickname und Passwort sollten immer abgefragt werden, die Email als Loginname
 // wuerde aber auch gehen.
 $helper->addFormGroup("login", "Bitte gebe hier gew&uuml;nschten Nickname und dein Zugangspasswort ein.");
-$helper->addFormSubGroup("username", "Dein Nickname wird nach Absenden des Formulares erst gepr&uuml;ft. Sp&auml;ter bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
+$helper->addFormSubGroup("username", "Dein Nickname wird erst nach Absenden des Formulares gepr&uuml;ft. Sp&auml;ter bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
 $helper->addFieldText("username", "Nickname im Spiel:");
 $helper->addInputTextField("username", 10, 255);
 $helper->addFormSubGroup("password", "Dein Passwort sollte nicht zu leicht erratbar sein. Sp&auml;ter bauen wir hier noch einen automatischen Test ein, der dir sofort die Passwortst&auml;rke anzeigt.");
@@ -16,7 +16,7 @@ $helper->addInputPasswordField("pass1", 5, 255);
 $helper->addFieldText("pass2", "Passwortwiederholung:");
 $helper->addInputPasswordField("pass2", 5, 255);
 
-if ($helper->ifRegistrationRequiresEmailVerification()) {
+if ($helper->ifRegisterRequiresEmailVerification()) {
        $helper->addFormGroup("email", "Bitte gebe deine Email zweimal (ein zweites Mal zur Best&auml;tigung) ein, damit wir dir deinen Freischaltlink zusenden k&ouml;nnen.");
        $helper->addFieldText("email1", "Email-Adresse:");
        $helper->addInputTextField("email1", 15, 255);
@@ -24,16 +24,16 @@ if ($helper->ifRegistrationRequiresEmailVerification()) {
        $helper->addInputTextField("email2", 15, 255);
 } // END - email verification
 
-if ($helper->ifRegistrationIncludesProfile()) {
+if ($helper->ifRegisterIncludesProfile()) {
        $helper->addFormGroup("profile", "Hier kannst du zus&auml;tzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollst&auml;ndigen!");
-       if (!$helper->ifRegistrationRequiresEmailVerification()) {
+       if (!$helper->ifRegisterRequiresEmailVerification()) {
                $helper->addFormSubGroup("email", "Die Angabe deiner Email-Adresse ist nur dann n&ouml;tig, wenn du auch Email-Benachrichtigungen (<span id=\"add_note\">*1</span>) haben m&ouml;chtest.");
                $helper->addFieldText("email1", "Email-Adresse:");
                $helper->addInputTextField("email1", 15, 255);
        } // END - No email verification
 
        // Persoenliche Daten mit in der Anmeldung abfragen?
-       if ($helper->ifRegistrationIncludesPersonaData()) {
+       if ($helper->ifRegisterIncludesPersonaData()) {
                $helper->addFormSubGroup("persona", "Wenn du magst, dann vervollst&auml;ndige deine komplette Adresse mit deinem Namen.");
                $helper->addFieldText("surname", "Dein Vorname:");
                $helper->addInputTextField("surname", 10, 255);
@@ -56,31 +56,35 @@ if ($helper->ifRegistrationIncludesProfile()) {
        }
        if ($helper->ifChatEnabled("jabber")) {
                $helper->addFieldText("jabber", "Jabber:");
-               $helper->addInputTextField("jabber", 10, 15);
+               $helper->addInputTextField("jabber", 15, 50);
        }
        if ($helper->ifChatEnabled("yahoo")) {
                $helper->addFieldText("yahoo", "Yahoo!:");
-               $helper->addInputTextField("yahoo", 10, 15);
+               $helper->addInputTextField("yahoo", 15, 50);
        }
        if ($helper->ifChatEnabled("aol")) {
                $helper->addFieldText("aol", "AOL-Screenname:");
-               $helper->addInputTextField("aol", 10, 15);
+               $helper->addInputTextField("aol", 15, 50);
        }
        if ($helper->ifChatEnabled("msn")) {
                $helper->addFieldText("msn", "MSN:");
-               $helper->addInputTextField("msn", 10, 15);
+               $helper->addInputTextField("msn", 15, 50);
        }
 
-       if (!$helper->ifRegistrationRequiresEmailVerification()) {
+       if (!$helper->ifRegisterRequiresEmailVerification()) {
                $helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
        } // END - Extra note
 } // END - ask profile data
 
 // Spielregeln abfragen
 $helper->addFormGroup("rules", "Bitte lese dir die Spieleregeln gut durch und kreuze dann &quot;Ja, ich akzeptiere die aktuellen Spielregeln&quot; an.");
+$helper->addFieldText("rules", "Ja, ich akzeptiere die aktuellen Spielregeln:");
 $helper->addInputCheckboxField("rules", false);
 
 // Abschliessender Hinweis und Abschluss des Formulars
+$helper->addFormGroup("buttons", "Wenn du alle ben&ouml;tigten Felder korrekt ausgef&uuml;t hast, kannst du die Anmeldung abschliessen.");
+$helper->addInputResetButton("Alles nochmal eingeben");
+$helper->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
 $helper->addFormNote("Deine Daten werden nach den g&uuml;ltigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link &quot;Datenschutz&quot;.");
 $helper->addFormTag();
 $helper->flushContent();
@@ -90,5 +94,5 @@ $helper->flushContent();
 </div>
 
 <div id="register_box">
-       {?register_form?}
+       {?shipsimu_register?}
 </div>
diff --git a/inc/classes/exceptions/helper/.htaccess b/inc/classes/exceptions/helper/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/helper/class_FormClosedException.php b/inc/classes/exceptions/helper/class_FormClosedException.php
new file mode 100644 (file)
index 0000000..9390911
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * An exception thrown when the form is still closed but input field shall be
+ * added to it. This should normally not happen, but well, who knows?
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormClosedException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $classArray             Class throwing the exception
+        * @param               $code                   Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $classArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Could not add form element <u>%s</u> because form is closed.",
+                       $classArray[0]->__toString(),
+                       $this->getLine(),
+                       $classArray[1]
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/helper/class_FormGroupClosedException.php b/inc/classes/exceptions/helper/class_FormGroupClosedException.php
new file mode 100644 (file)
index 0000000..608228d
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * An exception thrown when a form group is still closed.
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormGroupClosedException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $classArray             Class throwing the exception
+        * @param               $code                   Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $classArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Could not add sub group <u>%s</u> because no form group has been opened before.",
+                       $classArray[0]->__toString(),
+                       $this->getLine(),
+                       $classArray[1]
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/helper/class_FormOpenedException.php b/inc/classes/exceptions/helper/class_FormOpenedException.php
new file mode 100644 (file)
index 0000000..e964c7c
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * An exception thrown when the form is still opened but we e.g. shall flush
+ * the content.
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FormOpenedException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $class          Class throwing the exception
+        * @param               $code                   Code number for the exception
+        * @return      void
+        */
+       public function __construct (BaseFrameworkSystem $class, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Form is not yet closed. Close it with method <u>%s::addFormTag()</u> and add no parameters.",
+                       $class->__toString(),
+                       $this->getLine(),
+                       $class->__toString()
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/helper/class_InvalidFormNameException.php b/inc/classes/exceptions/helper/class_InvalidFormNameException.php
new file mode 100644 (file)
index 0000000..85b5137
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * An exception thrown when the form name is invalid (set to false)
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidFormNameException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $class          Class throwing the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (BaseFrameworkSystem $class, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Form name not set.",
+                       $class->__toString(),
+                       $this->getLine()
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/template/class_FormClosedException.php b/inc/classes/exceptions/template/class_FormClosedException.php
deleted file mode 100644 (file)
index 9390911..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * An exception thrown when the form is still closed but input field shall be
- * added to it. This should normally not happen, but well, who knows?
- *
- * @author             Roland Haeder <webmaster@mxchange.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class FormClosedException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param               $classArray             Class throwing the exception
-        * @param               $code                   Code number for the exception
-        * @return      void
-        */
-       public function __construct (array $classArray, $code) {
-               // Add a message around the missing class
-               $message = sprintf("[%s:%d] Could not add form element <u>%s</u> because form is closed.",
-                       $classArray[0]->__toString(),
-                       $this->getLine(),
-                       $classArray[1]
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/exceptions/template/class_FormOpenedException.php b/inc/classes/exceptions/template/class_FormOpenedException.php
deleted file mode 100644 (file)
index e964c7c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * An exception thrown when the form is still opened but we e.g. shall flush
- * the content.
- *
- * @author             Roland Haeder <webmaster@mxchange.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class FormOpenedException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param               $class          Class throwing the exception
-        * @param               $code                   Code number for the exception
-        * @return      void
-        */
-       public function __construct (BaseFrameworkSystem $class, $code) {
-               // Add a message around the missing class
-               $message = sprintf("[%s:%d] Form is not yet closed. Close it with method <u>%s::addFormTag()</u> and add no parameters.",
-                       $class->__toString(),
-                       $this->getLine(),
-                       $class->__toString()
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/exceptions/template/class_InvalidFormNameException.php b/inc/classes/exceptions/template/class_InvalidFormNameException.php
deleted file mode 100644 (file)
index 85b5137..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * An exception thrown when the form name is invalid (set to false)
- *
- * @author             Roland Haeder <webmaster@mxchange.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class InvalidFormNameException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param               $class          Class throwing the exception
-        * @param               $code           Code number for the exception
-        * @return      void
-        */
-       public function __construct (BaseFrameworkSystem $class, $code) {
-               // Add a message around the missing class
-               $message = sprintf("[%s:%d] Form name not set.",
-                       $class->__toString(),
-                       $this->getLine()
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-}
-
-// [EOF]
-?>
index 3f92b37ec8bfac5d0517a63acb2289239f3e6d4d..43a5ec66d0e32595bd2386bf04210e47e2fdbf8a 100644 (file)
@@ -7,6 +7,7 @@
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
+ * @deprecated
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@ class InvalidTemplateVariableNameException extends FrameworkException {
         * The constructor
         *
         * @param               $classArray             An array holding our informations
-        * @param               $code           Code number for the exception
+        * @param               $code                   Code number for the exception
         * @return      void
         */
        public function __construct (array $classArray, $code) {
index 5e923ad937c1c442a27a225f8eb3c01d266a745d..f460986a655c35dac483daf9449a78037bf20b68 100644 (file)
@@ -903,12 +903,20 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        }
 
        /**
-        * Output a partial stub message for the given method name
+        * Output a partial stub message for the caller method
         *
-        * @param       $methodName             Name of the partially finished method
         * @return      void
         */
-       protected function partialStub ($methodName) {
+       protected function partialStub () {
+               // Get the backtrace
+               $backtrace = debug_backtrace();
+
+               // Generate the class::method string
+               $methodName = "UnknownClass::unknownMethod";
+               if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
+                       $methodName = $backtrace[1]['class']."::".$backtrace[1]['function'];
+               }
+
                // Debug instance is there?
                if (!is_null($this->getDebugInstance())) {
                        // Output stub message
index dff09f7fb884802b59f6aeb0b47181b1e9757b08..8a1892b8a0b6badcb43a2e6247ef9045befcbf8c 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class  extends BaseTemplateHelper {
+class  extends BaseHelper {
        /**
         * Private constructor
         *
diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php
new file mode 100644 (file)
index 0000000..11d636c
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+/**
+ * A generic helper class with generic methods
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseHelper extends BaseFrameworkSystem {
+       /**
+        * Template engine instance
+        */
+       private $templateInstance = null;
+
+       /**
+        * Rendered content created by the helper class
+        */
+       private $content = "";
+
+       /**
+        * Private constructor
+        *
+        * @param       $className      Real name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Setter for template engine instances
+        *
+        * @param       $templateInstance       An instance of a template engine class
+        * @return      void
+        */
+       protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+               $this->templateInstance = $templateInstance;
+       }
+
+       /**
+        * Getter for template engine instances
+        *
+        * @return      $templateInstance       An instance of a template engine class
+        */
+       protected final function getTemplateInstance () {
+               return $this->templateInstance;
+       }
+
+       /**
+        * Add content
+        *
+        * @param       $newContent             New content to add
+        * @return      void
+        */
+       protected final function addContent ($newContent) {
+               $this->content .= (string) trim($newContent)."\r\n";
+       }
+
+       /**
+        * Getter for content
+        *
+        * @return      $content        The rendered content by this helper
+        */
+       protected final function getContent () {
+               return $this->content;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/helper/class_BaseTemplateHelper.php b/inc/classes/main/helper/class_BaseTemplateHelper.php
deleted file mode 100644 (file)
index 8558386..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * A generic helper class with generic methods
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class BaseTemplateHelper extends BaseFrameworkSystem {
-       /**
-        * Template engine instance
-        */
-       private $templateInstance = null;
-
-       /**
-        * Rendered content created by the helper class
-        */
-       private $content = "";
-
-       /**
-        * Private constructor
-        *
-        * @param       $className      Real name of the class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-
-               // Create unique ID number
-               $this->createUniqueID();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
-       }
-
-       /**
-        * Setter for template engine instances
-        *
-        * @param       $templateInstance       An instance of a template engine class
-        * @return      void
-        */
-       public final function setTemplateInstance (CompileableTemplate $templateInstance) {
-               $this->templateInstance = $templateInstance;
-       }
-
-       /**
-        * Getter for template engine instances
-        *
-        * @return      $templateInstance       An instance of a template engine class
-        */
-       public final function getTemplateInstance () {
-               return $this->templateInstance;
-       }
-
-       /**
-        * Add content
-        *
-        * @param       $newContent             New content to add
-        * @return      void
-        */
-       public final function addContent ($newContent) {
-               $this->content .= (string) trim($newContent)."\r\n";
-       }
-
-       /**
-        * Getter for content
-        *
-        * @return      $content        The rendered content by this helper
-        */
-       public final function getContent () {
-               return $this->content;
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/main/helper/web/class_HtmlFormHelper.php b/inc/classes/main/helper/web/class_HtmlFormHelper.php
deleted file mode 100644 (file)
index 281f4d4..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-/**
- * A helper for constructing HTML forms
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class HtmlFormHelper extends BaseTemplateHelper {
-       /**
-        * Wether the form tag is opened (keep at false or else your forms will
-        * never work!)
-        */
-       private $formOpened = false;
-
-       /**
-        * Name of the form
-        */
-       private $formName = "";
-
-       /**
-        * Wether the group is opened or not
-        */
-       private $groupOpened = false;
-
-       /**
-        * Wether the sub group is opened or not
-        */
-       private $subGroupOpened = false;
-
-       // Class Constants
-       const EXCEPTION_FORM_NAME_INVALID = 0xb00;
-       const EXCEPTION_CLOSED_FORM       = 0xb01;
-       const EXCEPTION_OPENED_FORM       = 0xb02;
-
-       /**
-        * Private constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("HTML-Formularhilfsklasse");
-       }
-
-       /**
-        * Creates the helper class with the given template engine instance and form name
-        *
-        * @param       $templateInstance       An instance of a valid template engine
-        * @param       $formName                       Name of the form
-        * @param       $formId                         Value for "id" attribute (default: $formName)
-        * @return      $helperInstance         A preparedf instance of this class
-        */
-       public final static function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false) {
-               // Get new instance
-               $helperInstance = new HtmlFormHelper();
-
-               // Set template instance
-               $helperInstance->setTemplateInstance($templateInstance);
-
-               // Is the form id not set?
-               if ($formId === false) {
-                       // Use form id from form name
-                       $formId = $formName;
-               }
-
-               // Create the form
-               $helperInstance->addFormTag($formName, $formId);
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Add the form tag or close it an already opened form tag
-        *
-        * @param       $formName       Name of the form (default: false)
-        * @param       $formId         Id of the form (attribute "id"; default: false)
-        * @return      void
-        * @throws      InvalidFormNameException        If the form name is invalid (=false)
-        */
-       public function addFormTag ($formName = false, $formId = false) {
-               // When the form is not yet opened at least form name must be valid
-               if ((!$this->formOpened) && ($formName === false)) {
-                       // Thrown an exception
-                       throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
-               }
-
-               // Close the form is default
-               $formContent = "</form>";
-
-               // Check wether we shall open or close the form
-               if (!$this->formOpened) {
-                       // Add HTML code
-                       $formContent = sprintf("<form name=\"%s\" action=\"%s\" method=\"%s\" target=\"%s\"",
-                               $formName,
-                               $this->getConfigInstance()->readConfig("form_action"),
-                               $this->getConfigInstance()->readConfig("form_method"),
-                               $this->getConfigInstance()->readConfig("form_target")
-                       );
-
-                       // Is the form id set?
-                       if ($formId !== false) {
-                               // Then add it as well
-                               $formContent .= sprintf(" id=\"%s\"",
-                                       $formId
-                               );
-                       }
-
-                       // Add close bracket
-                       $formContent .= ">";
-
-                       // Open the form and remeber the form name
-                       $this->formOpened = true;
-                       $this->formName = $formName;
-               } else {
-                       // Add the hidden field required to identify safely this form
-                       $this->addInputHiddenField("form", $this->formName);
-
-                       // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
-                       // Simply close it
-                       $this->formOpened = false;
-               }
-
-               // Add it to the content
-               $this->addContent($formContent);
-       }
-
-       /**
-        * Add an input tag to the form or throw an exception if it is not yet
-        * opened. The field's name will be set as id.
-        *
-        * @param       $fieldName                      Input field name
-        * @param       $fieldSize                      Input size
-        * @param       $fieldMaxLength         Input max length
-        * @param       $fieldValue                     Input default value (default: empty)
-        * @return      void
-        * @throws      FormClosedException             If the form is not yet opened
-        */
-       public function addInputTextField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
-               // Is the form opened?
-               if (!$this->formOpened) {
-                       // Throw an exception
-                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
-
-               // Generate the content
-               $inputContent = sprintf("<input type=\"text\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
-                       $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
-
-               // And add it
-               $this->addContent($inputContent);
-       }
-
-       /**
-        * Flushs the content out (not yet secured against open forms, etc.!) or
-        * throw an exception if it is not yet closed
-        *
-        * @return      void
-        * @throws      FormOpenedException             If the form is still open
-        */
-       public function flushContent () {
-               // Is the form opened?
-               if ($this->formOpened) {
-                       // Throw an exception
-                       throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
-               }
-
-               // Send content to template engine
-               $this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
-       }
-
-       /**
-        * Add a form group or close an already opened and open a new one
-        *
-        * @param       $groupName      Name of the group
-        * @param       $groupText      Text including HTML to show above this group
-        * @return      void
-        * @throws      EmptyVariableException  If $groupName is not set
-        */
-       public function addFormGroup ($groupName, $groupText) {
-               // At least the group name should be set
-               if (empty($groupName)) {
-                       // Throw exception here
-                       throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               }
-
-               // Not fully finished!
-               $this->partialStub(__METHOD__);
-
-               // Is this group opened?
-               if (!$this->groupOpened) {
-                       // Switch the state
-                       $this->groupOpened = true;
-               } else {
-                       // Switch the state
-                       $this->groupOpened = false;
-
-                       // All call it again
-                       $this->addFormGroup($groupName, $groupText);
-               }
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/main/helper/web/class_WebFormHelper.php b/inc/classes/main/helper/web/class_WebFormHelper.php
new file mode 100644 (file)
index 0000000..41ad0fd
--- /dev/null
@@ -0,0 +1,574 @@
+<?php
+/**
+ * A helper for constructing web forms
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebFormHelper extends BaseHelper {
+       /**
+        * Wether the form tag is opened (keep at false or else your forms will
+        * never work!)
+        */
+       private $formOpened = false;
+
+       /**
+        * Name of the form
+        */
+       private $formName = "";
+
+       /**
+        * Wether the group is opened or not
+        */
+       private $groupOpened = false;
+
+       /**
+        * Wether the sub group is opened or not
+        */
+       private $subGroupOpened = false;
+
+       /**
+        * Name of the sub group
+        */
+       private $subGroupName = "";
+
+       // Class Constants
+       const EXCEPTION_FORM_NAME_INVALID       = 0xb00;
+       const EXCEPTION_CLOSED_FORM             = 0xb01;
+       const EXCEPTION_OPENED_FORM             = 0xb02;
+       const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03;
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("HTML-Formularhilfsklasse");
+       }
+
+       /**
+        * Creates the helper class with the given template engine instance and form name
+        *
+        * @param       $templateInstance       An instance of a valid template engine
+        * @param       $formName                       Name of the form
+        * @param       $formId                         Value for "id" attribute (default: $formName)
+        * @return      $helperInstance         A preparedf instance of this class
+        */
+       public final static function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false) {
+               // Get new instance
+               $helperInstance = new WebFormHelper();
+
+               // Set template instance
+               $helperInstance->setTemplateInstance($templateInstance);
+
+               // Is the form id not set?
+               if ($formId === false) {
+                       // Use form id from form name
+                       $formId = $formName;
+               }
+
+               // Create the form
+               $helperInstance->addFormTag($formName, $formId);
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Add the form tag or close it an already opened form tag
+        *
+        * @param       $formName       Name of the form (default: false)
+        * @param       $formId         Id of the form (attribute "id"; default: false)
+        * @return      void
+        * @throws      InvalidFormNameException        If the form name is invalid (=false)
+        */
+       public function addFormTag ($formName = false, $formId = false) {
+               // When the form is not yet opened at least form name must be valid
+               if (($this->formOpened === false) && ($formName === false)) {
+                       // Thrown an exception
+                       throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
+               }
+
+               // Close the form is default
+               $formContent = "</form>";
+
+               // Check wether we shall open or close the form
+               if ($this->formOpened === false) {
+                       // Add HTML code
+                       $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s\" method=\"%s\" target=\"%s\"",
+                               $formName,
+                               $this->getConfigInstance()->readConfig("form_action"),
+                               $this->getConfigInstance()->readConfig("form_method"),
+                               $this->getConfigInstance()->readConfig("form_target")
+                       );
+
+                       // Is the form id set?
+                       if ($formId !== false) {
+                               // Then add it as well
+                               $formContent .= sprintf(" id=\"%s_form\"",
+                                       $formId
+                               );
+                       }
+
+                       // Add close bracket
+                       $formContent .= ">";
+
+                       // Open the form and remeber the form name
+                       $this->formOpened = true;
+                       $this->formName = $formName;
+               } else {
+                       // Add the hidden field required to identify safely this form
+                       $this->addInputHiddenField("form", $this->formName);
+
+                       // Is a group open?
+                       if ($this->groupOpened === true) {
+                               // Then automatically close it here
+                               $this->addFormGroup("", "");
+                       }
+
+                       // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
+                       // Simply close it
+                       $this->formOpened = false;
+               }
+
+               // Add it to the content
+               $this->addContent($formContent);
+       }
+
+       /**
+        * Add a text input tag to the form or throw an exception if it is not yet
+        * opened. The field's name will be set as id.
+        *
+        * @param       $fieldName                      Input field name
+        * @param       $fieldSize                      Input size
+        * @param       $fieldMaxLength         Input max length
+        * @param       $fieldValue                     Input default value (default: empty)
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputTextField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
+                       $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+
+               // And add it maybe with a "li" tag
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a password input tag to the form or throw an exception if it is not
+        * yet opened. The field's name will be set as id.
+        *
+        * @param       $fieldName                      Input field name
+        * @param       $fieldSize                      Input size
+        * @param       $fieldMaxLength         Input max length
+        * @param       $fieldValue                     Input default value (default: empty)
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputPasswordField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
+                       $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a hidden input tag to the form or throw an exception if it is not
+        * yet opened. The field's name will be set as id.
+        *
+        * @param       $fieldName                      Input field name
+        * @param       $fieldValue                     Input default value (default: empty)
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputHiddenField ($fieldName, $fieldValue = "") {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
+                       $fieldName,
+                       $fieldValue
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a checkbox input tag to the form or throw an exception if it is not
+        * yet opened. The field's name will be set as id.
+        *
+        * @param       $fieldName                      Input field name
+        * @param       $fieldChecked           Wether the field is checked (defaut: checked)
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Set wether the check box is checked...
+               $checked = " checked=\"checked\"";
+               if ($fieldChecked === false) $checked = " ";
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s\" value=\"1\"%s/>",
+                       $fieldName,
+                       $fieldName,
+                       $checked
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a reset input tag to the form or throw an exception if it is not
+        * yet opened. The field's name will be set as id.
+        *
+        * @param       $buttonText             Text displayed on the button
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputResetButton ($buttonText) {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, "reset"), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"reset\" class=\"reset_button\" id=\"%s_reset\" value=\"%s\" />",
+                       $this->formName,
+                       $buttonText
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a reset input tag to the form or throw an exception if it is not
+        * yet opened. The field's name will be set as id.
+        *
+        * @param       $buttonText                     Text displayed on the button
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addInputSubmitButton ($buttonText) {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, "submit"), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Generate the content
+               $inputContent = sprintf("<input type=\"submit\" class=\"submit_button\" id=\"%s_submit\" name=\"%s_button\" value=\"%s\" />",
+                       $this->formName,
+                       $this->formName,
+                       $buttonText
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add a form group or close an already opened and open a new one
+        *
+        * @param       $groupName      Name of the group
+        * @param       $groupText      Text including HTML to show above this group
+        * @return      void
+        * @throws      FormClosedException             If no form has been opened before
+        * @throws      EmptyVariableException  If $groupName is not set
+        */
+       public function addFormGroup ($groupName, $groupText) {
+               // Is a form opened?
+               if ($this->formOpened === false) {
+                       // Throw exception here
+                       throw new FormClosedException(array($this, $groupName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // At least the group name should be set
+               if ((empty($groupName)) && ($this->groupOpened === false)) {
+                       // Throw exception here
+                       throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               }
+
+               // Initialize content with closing div by default
+               $content = "    </div>\n</div><!-- Group - CLOSE //-->";
+
+               // Is this group opened?
+               if ($this->groupOpened === false) {
+                       // Begin the div/span blocks
+                       $content = sprintf("<!-- Group %s - OPEN //-->
+<div class=\"group_box\" id=\"%s_group_box\">
+       <span class=\"group_text\" id=\"%s_group_text\">
+               %s
+       </span>
+       <div class=\"group_field\" id=\"%s_group_field\">",
+                               $groupName,
+                               $groupName,
+                               $groupName,
+                               $groupText,
+                               $groupName
+                       );
+
+                       // Add the content
+                       $this->addContent($content);
+
+                       // Switch the state
+                       $this->groupOpened = true;
+               } else {
+                       // Is a sub group opened?
+                       if ($this->subGroupOpened === true) {
+                               // Close it here
+                               $this->addFormSubGroup("", "");
+                       }
+
+                       // Add the content
+                       $this->addContent($content);
+
+                       // Switch the state
+                       $this->groupOpened = false;
+
+                       // All call it again if the group name is not empty
+                       if (!empty($groupName)) {
+                               $this->addFormGroup($groupName, $groupText);
+                       }
+               }
+       }
+
+       /**
+        * Add a form sub group or close an already opened and open a new one or
+        * throws an exception if no group has been opened before or if the sub
+        * group name is empty.
+        *
+        * @param       $subGroupName   Name of the group
+        * @param       $subGroupText   Text including HTML to show above this group
+        * @return      void
+        * @throws      FormGroupClosedException        If no group has been opened before
+        * @throws      EmptyVariableException          If $subGroupName is not set
+        */
+       public function addFormSubGroup ($subGroupName, $subGroupText) {
+               // Is a group opened?
+               if ($this->groupOpened === false) {
+                       // Throw exception here
+                       throw new FormGroupClosedException(array($this, $subGroupName), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
+               }
+
+               // At least the sub group name should be set
+               if ((empty($subGroupName)) && ($this->subGroupOpened === false)) {
+                       // Throw exception here
+                       throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               }
+
+               // Initialize content with closing div by default
+               $content = "    </div>\n</div><!-- Sub group- CLOSE //-->";
+
+               // Is this group opened?
+               if ($this->subGroupOpened === false) {
+                       // Begin the span block
+                       $content = sprintf("<!-- Sub group %s - OPEN //-->
+<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
+       <span class=\"subgroup_text\" id=\"%s_subgroup_text\">
+               %s
+       </span>
+       <div class=\"subgroup_field\" id=\"%s_subgroup_field\">",
+                               $subGroupName,
+                               $subGroupName,
+                               $subGroupName,
+                               $subGroupText,
+                               $subGroupName
+                       );
+
+                       // Add the content
+                       $this->addContent($content);
+
+                       // Switch the state and remeber the name
+                       $this->subGroupOpened = true;
+                       $this->subGroupName = $subGroupName;
+               } else {
+                       // Add the content
+                       $this->addContent($content);
+
+                       // Switch the state
+                       $this->subGroupOpened = false;
+
+                       // All call it again if sub group name is not empty
+                       if (!empty($subGroupName)) {
+                               $this->addFormSubGroup($subGroupName, $subGroupText);
+                       }
+               }
+       }
+
+       /**
+        * Add text surrounded by a span block when there is a group opened before
+        * or else by a div block.
+        *
+        * @param       $fieldName                      Field name
+        * @param       $fieldText                      Text for the field
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addFieldText ($fieldName, $fieldText) {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Set the block type
+               $block = "div";
+               if ($this->groupOpened === true) $block = "span";
+
+               // Generate the content
+               $inputContent = sprintf("       <%s id=\"%s_text\">
+               %s
+       </%s>",
+                       $block,
+                       $fieldName,
+                       $fieldText,
+                       $block
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Add text (notes) surrounded by a div block. Still opened groups or sub
+        * groups will be automatically closed.
+        *
+        * @param       $formNotes      The form notes we shell addd
+        * @return      void
+        * @throws      FormClosedException             If the form is not yet opened
+        */
+       public function addFormNote ($formNotes) {
+               // Is the form opened?
+               if ($this->formOpened === false) {
+                       // Throw an exception
+                       throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+               }
+
+               // Is a group open?
+               if ($this->groupOpened === true) {
+                       // Then automatically close it here
+                       $this->addFormGroup("unknown", "");
+               }
+
+               // Generate the content
+               $inputContent = sprintf("       <div id=\"form_note\">
+               %s
+       </div>",
+                       $formNotes
+               );
+
+               // And add it
+               $this->addContent($inputContent);
+       }
+
+       /**
+        * Checks wether the registration requires a valid email address
+        *
+        * @return      $required       Wether the email address is required
+        */
+       public function ifRegisterRequiresEmailVerification () {
+               $required = ($this->getConfigInstance()->readConfig("register_requires_email") == "Y");
+               return $required;
+       }
+
+       /**
+        * Checks wether profile data shall be asked
+        *
+        * @return      $required       Wether profile shall be asked
+        */
+       public function ifRegisterIncludesProfile () {
+               $required = ($this->getConfigInstance()->readConfig("register_includes_profile") == "Y");
+               return $required;
+       }
+
+       /**
+        * Checks wether personal data shall be asked
+        *
+        * @return      $required       Wether personal data shall be asked
+        */
+       public function ifRegisterIncludesPersonaData () {
+               $required = ($this->getConfigInstance()->readConfig("register_personal_data") == "Y");
+               return $required;
+       }
+
+       /**
+        * Checks wether the specified chat protocol is enabled in this form
+        *
+        * @return      $required       Wether the specified chat protocol is enabled
+        */
+       public function ifChatEnabled ($chatProtocol) {
+               $required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
+               return $required;
+       }
+
+       /**
+        * Flushs the content out (not yet secured against open forms, etc.!) or
+        * throw an exception if it is not yet closed
+        *
+        * @return      void
+        * @throws      FormOpenedException             If the form is still open
+        */
+       public function flushContent () {
+               // Is the form still open?
+               if ($this->formOpened === true) {
+                       // Throw an exception
+                       throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
+               }
+
+               // Send content to template engine
+               $this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
+       }
+}
+
+// [EOF]
+?>
index e2961f848a12857dee9f8cfa0a33a70bf5830352..ee01937a364d75ebae00264c73138131e83a4b19 100644 (file)
@@ -975,7 +975,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
 
                // Run the compilation twice to get content from helper classes in
                $cnt = 0;
-               while ($cnt < 2) {
+               while ($cnt < 3) {
                        // Finalize the compilation of template variables
                        $this->finalizeVariableCompilation();
 
index 536a89dbfef7f7ad665967f0d69267b023600897..a3ea28ec2b6cd6722a998cd2706fd3668478c616 100644 (file)
@@ -141,17 +141,5 @@ $cfg->setConfigEntry("default_application", "selector");
 // CFG: VERBOSE-LEVEL
 $cfg->setConfigEntry("verbose_level", 0);
 
-// CFG: COMMAND-PARAMETER
-$cfg->setConfigEntry("command_parameter", "page");
-
-// CFG: FORM-ACTION
-$cfg->setConfigEntry("form_action", "index.php?app={?app_short_name?}&{?command_parameter?}=do_form");
-
-// CFG: FORM-METHOD
-$cfg->setConfigEntry("form_method", "POST");
-
-// CFG: FORM-TARGET
-$cfg->setConfigEntry("form_target", "_self");
-
 // [EOF]
 ?>
index b82ab23a8f5bcb344e5aa304e4c888c86a2959ac..cce846071dfe3e81dbd8dbaefe962a9d0643025d 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
        <title>