]> git.mxchange.org Git - shipsimu.git/commitdiff
More improvements and fixes:
authorRoland Häder <roland@mxchange.org>
Sat, 15 Nov 2008 21:08:05 +0000 (21:08 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 15 Nov 2008 21:08:05 +0000 (21:08 +0000)
- CAPTCHA added to profile page
- Action for profile page added
- User status re-fixed...
- Form for training payed by goverment added (unfinished)
- Web link/form/base helper fixed/improved

12 files changed:
.gitattributes
application/ship-simu/config.php
application/ship-simu/main/actions/web/class_WebShipSimuLogin
application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php
application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php [new file with mode: 0644]
application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php
application/ship-simu/templates/de/code/action_ship_simu_login_goverment_training.ctp
application/ship-simu/templates/de/code/action_ship_simu_login_profile.ctp
inc/classes/main/filter/change/class_EmailChangeFilter.php
inc/classes/main/filter/change/class_PasswordChangeFilter.php
inc/classes/main/helper/web/forms/class_WebFormHelper.php
inc/classes/main/helper/web/links/class_WebLinkHelper.php

index 878445b651d2f23f346799b51a8ec73610e5a872..01097e3585d52241e4ef574b92f30bf6dcb78abb 100644 (file)
@@ -167,6 +167,7 @@ application/ship-simu/main/actions/web/class_WebShipSimuLogin -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php -text
+application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php -text
 application/ship-simu/main/bank/.htaccess -text
index ce4b96fc37d25f67e9d7a98e42de93a171e483d3..058397fcd062e6cdf725df72d8c75c13889c3b74 100644 (file)
@@ -160,6 +160,9 @@ $cfg->setConfigEntry('captcha_register_verifier_filter', "GraphicalCodeCaptchaVe
 // CFG: CAPTCHA-REFILL-VERFIER-FILTER
 $cfg->setConfigEntry('captcha_refill_verifier_filter', "GraphicalCodeCaptchaVerifierFilter");
 
+// CFG: CAPTCHA-PROFILE-VERFIER-FILTER
+$cfg->setConfigEntry('captcha_profile_verifier_filter', "GraphicalCodeCaptchaVerifierFilter");
+
 // CFG: CONFIRM-CODE-VERIFIER-FILTER
 $cfg->setConfigEntry('confirm_code_verifier_filter', "ConfirmCodeVerifierFilter");
 
@@ -226,6 +229,9 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha', "GraphicalCodeCaptcha");
 // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA
 $cfg->setConfigEntry('shipsimu_guest_login_captcha', "GraphicalCodeCaptcha");
 
+// CFG: SHIPSIMU-PROFILE-CAPTCHA
+$cfg->setConfigEntry('shipsimu_profile_captcha', "GraphicalCodeCaptcha");
+
 // CFG: REFILL-FORM-CAPTCHA
 $cfg->setConfigEntry('refill_form_captcha', "GraphicalCodeCaptcha");
 
@@ -247,6 +253,9 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha_secured', "Y");
 // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA-SECURED
 $cfg->setConfigEntry('shipsimu_guest_login_captcha_secured', "Y");
 
+// CFG: SHIPSIMU-PROFILE-CAPTCHA-SECURED
+$cfg->setConfigEntry('shipsimu_profile_captcha_secured', "Y");
+
 // CFG: REFILL-FORM-CAPTCHA-SECURED
 $cfg->setConfigEntry('refill_form_captcha_secured', "Y");
 
index 99b2e56dfa88855d5a72bd109fa79f9f5862be23..ad2f1ccaff1e4a50c10b525d6d74dd4b2fb5735b 100644 (file)
@@ -70,7 +70,8 @@ class WebShipSimuLogin???Action extends BaseAction implements Commandable, Regis
         * @todo        Add some filters here
         */
        public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Unfinished method
+               // Check for user status by default
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
        }
 }
 
index fed0d1df33ca32babbd6b54067de530fd455bec2..31464c82348c3f221dc90870350ab2106c65fe8f 100644 (file)
@@ -69,6 +69,8 @@ class WebShipSimuLoginLogoutAction extends BaseAction implements Commandable, Re
         * @return      void
         */
        public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Check for user status by default
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
        }
 }
 
diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php
new file mode 100644 (file)
index 0000000..532e47e
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+/**
+ * An action for profile (editing) page
+ *
+ * @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 WebShipSimuLoginProfileAction extends BaseAction implements Commandable, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this action
+        *
+        * @param       $resolverInstance       An instance of an action resolver
+        * @return      $actionInstance         An instance of this action class
+        */
+       public final static function createWebShipSimuLoginProfileAction (ActionResolver $resolverInstance) {
+               // Get a new instance
+               $actionInstance = new WebShipSimuLoginProfileAction();
+
+               // Set the resolver instance
+               $actionInstance->setResolverInstance($resolverInstance);
+
+               // Return the instance
+               return $actionInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @todo        0% done
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Unfinished method
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add some filters here
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Check for user status by default
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+       }
+}
+
+// [EOF]
+?>
index a9c652e0237ebd448a997bcbca3b06b6fb3cd1ba..e8aff7d0e414ee3527f558763b068205d04bf5e1 100644 (file)
@@ -133,6 +133,9 @@ class WebShipsimuProfileCommand extends BaseCommand implements Commandable {
                // Account password validation
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter'));
 
+               // Validate CAPTCHA input
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_profile_verifier_filter'));
+
                // Email changed
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_filter'));
 
index 3e602740eb47d3f3ed4c74875b557964e2cca920..e168ef9cb7cbca5e60347bf7f30663d70e68ff7d 100644 (file)
@@ -8,9 +8,28 @@ $helperInstance->prefetchValueInstance('user');
 // Add main form group
 $helperInstance->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausf&uuml;llen!");
 
+// Add group for personal data
+$helperInstance->addFormGroup('persona_data', "Deine pers&ouml;nliche Daten, die f&uuml;r die Kursusteilnahme n&ouml;tig sind:");
+
+// Display email, surname and family name
+$helperInstance->addFormNote('name', "Dein Name: <span class=\"persona_data\">".$helperInstance->getValueField('surname')." ".$helperInstance->getValueField('family')."</span>");
+$helperInstance->addFormNote('email', "Email-Adresse: <span class=\"persona_data\">".$helperInstance->getValueField('email')."</span>");
+
+// Add link placeholder for profile page
+$helperInstance->addFormNote('profile', "Stimmen die Daten noch? {?shipsimu_profile_link?}");
+
 // Flush the finished form
 $helperInstance->flushContent();
 
+// Get link helper for profile link
+$linkInstance = WebLinkHelper::createWebLinkHelper($this, 'shipsimu_profile_link', 'index.php?app={?app_short_name?}&amp;page=login_area');
+
+// Add action
+$linkInstance->addActionLinkById('profile', 'goto_profile_link');
+
+// Flush the finished form
+$linkInstance->flushContent();
+
 ?>
 <div id="goverment_frame">
        <div id="goverment_header">
index 866489d89919be0777264b0b3c2a3da52b1b5d6d..b97e27f5d09a2330378ff29f9ae68c52e1e183f3 100644 (file)
@@ -16,7 +16,7 @@ $helperInstance->addFieldText('pass2', "Neues Passwort, Wiederholung:");
 $helperInstance->addInputPasswordField('pass2');
 
 // Display current email
-$helperInstance->addFormNote('current_email', "Derzeitige Email-Adresse: <span id=\"displayed_field\">".$helperInstance->getValueField('email')."</span>");
+$helperInstance->addFormNote('current_email', "Derzeitige Email-Adresse: <span class=\"persona_data\">".$helperInstance->getValueField('email')."</span>");
 
 // Only for changing email address
 if ($helperInstance->ifEmailChangeAllowed()) {
@@ -29,12 +29,12 @@ if ($helperInstance->ifEmailChangeAllowed()) {
 
        if ($helperInstance->ifEmailMustBeUnique()) {
                $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
-       } // END - Unique email addresses
+       } // END - if
 
        if ($helperInstance->ifEmailChangeRequireConfirmation()) {
                $helperInstance->addFormNote('confirm_link', "Es wird ein Best&auml;tigungslink an deine neue Email-Adresse gesendet. Bitte klicke diesen dann m&ouml;glichst schnell an.");
-       } // END - Change requires confirmation
-} // END - email change allowed
+       } // END - if
+} // END - if
 
 // Add form group for user profile
 $helperInstance->addFormGroup('profile', "Hier kannst du deine Profildaten &auml;ndern.");
@@ -50,9 +50,9 @@ if ($helperInstance->ifRegisterIncludesPersonaData()) {
        $helperInstance->addInputTextFieldWithDefault('street');
        $helperInstance->addFieldText('city', "Wohnort:");
        $helperInstance->addInputTextFieldWithDefault('city');
-} // END - Persona data
+} // END - if
 
-// Add su group for zip code
+// Add sub group for zip code
 $helperInstance->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
 $helperInstance->addFieldText('zip', "Postleitzahl:");
 $helperInstance->addInputTextFieldWithDefault('zip');
@@ -91,8 +91,8 @@ if ($helperInstance->ifChatEnabled('msn')) {
 } // END - if
 
 if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
-       $helperInstance->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
-} // END - Extra note
+       $helperInstance->addFormExtraNote(1, "Die Benachrichtigungen per Email sind im Loginbereich verfeinerbar, welche du genau haben willst.");
+} // END - if
 
 // Rules already accepted?
 if ($helperInstance->ifRulesHaveChanged()) {
@@ -104,16 +104,24 @@ if ($helperInstance->ifRulesHaveChanged()) {
        $helperInstance->addInputHiddenField('rules', "1");
 }
 
+// CAPTCHA enabled?
+if ($helperInstance->ifFormSecuredWithCaptcha()) {
+       $helperInstance->addFormGroup('captcha_user', "Unser Benuzter-Login ist durch ein CAPTCHA gesch&uuml;tzt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
+       $helperInstance->addCaptcha();
+} // END - if
+
 // Ask again for current account password
 $helperInstance->addFormGroup('pass_old', "Bitte gebe zur Best&auml;tigung der &Auml;nderungen dein derzeitiges Passwort ein.");
 $helperInstance->addFieldText('pass_old', "Derzeitiges Passwort:");
 $helperInstance->addInputPasswordField('pass_old');
 
-// Abschliessender Hinweis und Abschluss des Formulars
+// Final notices
 $helperInstance->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!");
 $helperInstance->addInputResetButton("Alles nochmal eingeben");
 $helperInstance->addInputSubmitButton("Accountdaten aktualisieren");
 $helperInstance->addFormNote('data_protection', "Deine Daten werden nach den g&uuml;ltigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link &quot;Datenschutz&quot;.");
+
+// Flush finished form
 $helperInstance->flushContent();
 ?>
 <div id="content_header">
index 0991492f7c10e3f24578ca044d80a74e0c28a8b2..d213a22336eb84da1e6b6472f594a6e81fbebaae 100644 (file)
@@ -94,6 +94,12 @@ class EmailChangeFilter extends BaseFrameworkSystem implements Filterable {
                        return false;
                } // END - if
 
+               // Are email and confirmation empty?
+               if ((empty($email1)) && (empty($email2))) {
+                       // No email change required!
+                       return true;
+               } // END - if
+
                // Now, get a user instance for comparison
                $userInstance = Registry::getRegistry()->getInstance('user');
 
index 078d2944f921408f94520582d5a5b9ad5703208b..5a604fd4732d0df35b826db0c79df75450b5bca1 100644 (file)
@@ -82,6 +82,12 @@ class PasswordChangeFilter extends BaseFrameworkSystem implements Filterable {
                        return false;
                } // END - if
 
+               // Are password and confirmation empty?
+               if ((empty($pass1)) && (empty($pass2))) {
+                       // Don't change password here
+                       return true;
+               } // END - if
+
                // Do both match?
                if ($pass1 != $pass2) {
                        // Request is invalid!
index acb419a222aaf9488bf022ecd164fd0a5c98baea..539f025af8364ae1426e363ca67edf14eb1c6839 100644 (file)
@@ -552,12 +552,6 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
-               // Is a group open?
-               if ($this->ifGroupOpenedPreviously()) {
-                       // Then automatically close it here
-                       $this->addFormGroup();
-               } // END - if
-
                // Generate the content
                $inputContent = sprintf("       <div id=\"form_note_%s\">
                %s
index 540cf80c1698d7df1e70a690a6164d3ca5b7e401..1a238a6d2c2239d732363c50b371719a81ce6cf1 100644 (file)
@@ -251,6 +251,21 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate {
                $this->addContentToPreviousGroup($linkContent);
        }
 
+       /**
+        * Adds a link to the previously opened group with a text from language system
+        *
+        * @param       $linkAction             Action (action=xxx) value for the link
+        * @param       $languageId             Language id string to use
+        * @return      void
+        */
+       public function addActionLinkById ($linkAction, $languageId) {
+               // Resolve the language string
+               $languageResolved = $this->getLanguageInstance()->getMessage($languageId);
+
+               // Add the action link
+               $this->addActionLink($linkAction, $languageResolved);
+       }
+
        /**
         * Adds a default link (no extra parameters) to the content with specified
         * language id string.