From ad5a2bb076e11f2561f2b97941dc78072da85f0b Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Fri, 15 Aug 2008 18:19:03 +0000
Subject: [PATCH] More stubs in refill page, refill page filter basicly
 finished

---
 application/ship-simu/config.php              |  6 ++++
 .../filter/class_MoneyRefillPageFilter.php    | 13 +++++--
 .../de/code/action_login_money_refill.ctp     | 36 +++++++++++++++++++
 .../main/class_BaseFrameworkSystem.php        |  8 ++++-
 4 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php
index 29be1ee..93084b3 100644
--- a/application/ship-simu/config.php
+++ b/application/ship-simu/config.php
@@ -205,6 +205,9 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha', "GraphicalCodeCaptcha");
 // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA
 $cfg->setConfigEntry('shipsimu_guest_login_captcha', "GraphicalCodeCaptcha");
 
+// CFG: REFILL-FORM-CAPTCHA
+$cfg->setConfigEntry('refill_form_captcha', "GraphicalCodeCaptcha");
+
 // CFG: LOGOUT-IMMEDIATE
 $cfg->setConfigEntry('logout_immediate', "N");
 
@@ -226,6 +229,9 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha_secured', "Y");
 // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA-SECURED
 $cfg->setConfigEntry('shipsimu_guest_login_captcha_secured', "Y");
 
+// CFG: REFILL-FORM-CAPTCHA-SECURED
+$cfg->setConfigEntry('refill_form_captcha_secured', "Y");
+
 // CFG: BLOCK-SHOWS-REGISTRATION
 $cfg->setConfigEntry('block_shows_registration', "Y");
 
diff --git a/application/ship-simu/main/filter/class_MoneyRefillPageFilter.php b/application/ship-simu/main/filter/class_MoneyRefillPageFilter.php
index 68e9c7a..98ed3d2 100644
--- a/application/ship-simu/main/filter/class_MoneyRefillPageFilter.php
+++ b/application/ship-simu/main/filter/class_MoneyRefillPageFilter.php
@@ -57,8 +57,17 @@ class MoneyRefillPageFilter extends BaseFrameworkSystem implements Filterable {
 	 * @return	void
 	 */
 	public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-		// Implement this!
-		$this->partialStub("Please implement this method.");
+		// Is the configuration variable set?
+		if ($this->getConfigInstance()->readConfig('refill_page_active') === "N") {
+			// Password is empty
+			$requestInstance->requestIsValid(false);
+
+			// Add a message to the response
+			$responseInstance->addFatalMessage('refill_page_not_active');
+
+			// Abort here
+			return false;
+		} // END - if
 	}
 }
 
diff --git a/application/ship-simu/templates/de/code/action_login_money_refill.ctp b/application/ship-simu/templates/de/code/action_login_money_refill.ctp
index 66f2b73..84cf84c 100644
--- a/application/ship-simu/templates/de/code/action_login_money_refill.ctp
+++ b/application/ship-simu/templates/de/code/action_login_money_refill.ctp
@@ -1,3 +1,39 @@
+<?php
+// Neue Helper-Instanz holen
+$helper = WebFormHelper::createWebFormHelper($this, 'refill_form');
+
+// Add form group
+$helper->addFormGroup('refill_form', "Bitte w&auml;hle aus, was du nachbestellen willst und gebe die Menge an.");
+
+// Add sub group
+$helper->addFormSubGroup('refill_type', "Was m&ouml;chstest du nun nachbestellen?");
+$helper->addInputSelectField('type', "Bitte ausw&auml;hlen");
+
+// In-game currencies (if more than default add them here!)
+$helper->addSelectSubOption('currencies', "--- W&auml;hrungen ---");
+$helper->addSelectOption('currency', "{?currency?}");
+
+// Raw materials
+$helper->addSelectSubOption('raw_materials', "--- Rohstoffe ---");
+$helper->addSelectOption('raw_wood', "Holz");
+$helper->addSelectOption('raw_iron', "Metall");
+$helper->addSelectOption('raw_stones', "Steine");
+
+// This is needed to close the select tag
+$helper->addInputSelectField('type', "");
+
+// CAPTCHA enbaled?
+if ($helper->ifFormSecuredWithCaptcha()) {
+	$helper->addFormGroup('captcha_refill', "Bitte wiederhole den angezeigten Code:");
+	$helper->addCaptcha();
+} // END - if
+
+// Submit button
+$helper->addFormGroup('buttons_refill', "Mit Absenden des Formulars wird deine Nachbestellung rechtskr&auml;ftig!");
+$helper->addInputResetButton("Eingaben l&ouml;schen");
+$helper->addInputSubmitButton("Nachbestellung verbindlich aufgeben");
+$helper->flushContent();
+?>
 <div id="refill_frame">
 	<div class="content_header">
 		Jetzt dein {?currency?}-Konto aufladen!
diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php
index 198280b..9dd62b4 100644
--- a/inc/classes/main/class_BaseFrameworkSystem.php
+++ b/inc/classes/main/class_BaseFrameworkSystem.php
@@ -232,7 +232,13 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
 			// Some arguments are there
 			foreach ($args as $arg) {
 				// Add the type
-				$argsString .= $arg." (".gettype($arg)."), ";
+				$argsString .= $arg." (".gettype($arg);
+
+				// Add length if type is string
+				if (gettype($arg) == 'string') $argsString .= ", ".strlen($arg);
+
+				// Closing bracket
+				$argsString .= "), ";
 			} // END - foreach
 
 			// Remove last comma
-- 
2.39.5