- Introduced generateDateMonthYearSelectionBox() which is suitable for e.g.
authorRoland Haeder <roland@mxchange.org>
Tue, 8 Apr 2014 21:03:17 +0000 (23:03 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 8 Apr 2014 21:03:17 +0000 (23:03 +0200)
  birthday input fields.
- Introduced doTemplateDisplayReferralIdContent() template helper to get rid
  of an unneccessary if() block and $content[foo] in template
- Content of template register_header.tpl has now been moved to
  inc/language/register_de.php and has marked as deprecated
- Added new template (unfinished) for ext-wernis registration provider

Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/language/register_de.php
inc/language/wernis_de.php
inc/libs/user_functions.php
inc/libs/wernis_functions.php
inc/template-functions.php
templates/de/html/guest/guest_register.tpl
templates/de/html/guest/guest_wernis_registration_form.tpl [new file with mode: 0644]
templates/de/html/register_header.tpl

index fef5e3a..6691e6d 100644 (file)
@@ -47,6 +47,7 @@ addMessages(array(
        'COUNTRY_CODE' => "L&auml;ndercode",
        'GUEST_EMAIL_IS_ALREADY_REGISTERED' => "Sie haben sich bereits mit dieser Email-Adresse angemeldet, oder jemand anderes verwendet Ihre. Doppelte Anmeldungen sind bei uns verboten.",
        'GUEST_ENTER_PASSWORDS' => "Passwort und -wiederholung eingeben:",
+       'GUEST_REGISTER_GENERIC_TITLE' => "Anmeldeformular zum {?mt_word?} <strong>{?MAIN_TITLE?}</strong>:",
 
        // Points accounts - subject
        'POINTS_SUBJECT_REGISTER_WELCOME' => "Anmeldegutschrift",
index 42c4e1d..5c9b41b 100644 (file)
@@ -150,6 +150,7 @@ addMessages(array(
        'GUEST_WERNIS_REGISTRATION_PASSWORD_NOT_SET' => "Bitte geben Sie Ihr Wernis-Passwort ein. Tipp: Dies ist <strong>nicht</strong> Ihr Account-Passwort.",
        'GUEST_WERNIS_REGISTRATION_INVALID_CHALLENGE_RESPONSE' => "Es ist beim Anmeldeversuch ein Fehler unterlaufen: Falsche Challenge-Response",
        'GUEST_WERNIS_REGISTRATION_ZERO_ROWS_FOUND' => "Es konnte keine Anmeldedaten von der WDS66-API gefunden werden. Haben Sie auch den richtigen Link aufgerufen?",
+       'GUEST_REGISTER_WERNIS_PROVIDER_TITLE' => "Anmeldung mit WDS66 am {?mt_word?} <strong>{?MAIN_TITLE?}</strong>:",
 
        // Points accounts - subject
        'POINTS_SUBJECT_WERNIS_WITHDRAW' => "Einzahlung vom WDS66-Account",
index fbf7c45..5041a8c 100644 (file)
@@ -971,24 +971,7 @@ function doDisplayGenericUserRegistrationForm () {
        } // END - if
 
        // Generate birthday selection
-       switch (getLanguage()) {
-               case 'de': // German date format
-                       $content['birthday_selection'] = addSelectionBox('da', postRequestElement('day')).addSelectionBox('mo', postRequestElement('month')).addSelectionBox('ye', postRequestElement('year'));
-                       break;
-
-               default: // Default is the US date format... :)
-                       $content['birthday_selection'] = addSelectionBox('mo', postRequestElement('month')).addSelectionBox('da', postRequestElement('day')).addSelectionBox('ye', postRequestElement('year'));
-                       break;
-       } // END - switch
-
-       // Shall I display the refid or shall I make it editable?
-       if (isDisplayRefidEnabled()) {
-               // Load "hide" form template
-               $content['refid_content'] = loadTemplate('guest_register_refid_hide', TRUE);
-       } else {
-               // Load template to enter it
-               $content['refid_content'] = loadTemplate('guest_register_refid', TRUE);
-       }
+       $content['birthday_selection'] = generateDayMonthYearSelectionBox(postRequestElement('day'),postRequestElement('month'),postRequestElement('year'));
 
        // ZIP codes are numerical values
        $content['zip'] = '';
index 90e88a0..1db29a7 100644 (file)
@@ -539,11 +539,20 @@ function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status
 
                // Is the array filled?
                if ((count($return['mapped_data']) > 0) && (empty($return['message']))) {
+                       // Set must-fillout fields
+                       $return['mapped_data'] = runFilterChain('register_must_fillout', $return['mapped_data']);
+
+                       // Add missing elements
+                       $return['mapped_data']['gender'] = NULL;
+                       $return['mapped_data']['birthday_selection'] = generateDayMonthYearSelectionBox($return['mapped_data']['birth_day'], $return['mapped_data']['birth_month'], $return['mapped_data']['birth_year']);
+
                        // Display form
                        loadTemplate('guest_wernis_registration_form', FALSE, $return['mapped_data']);
+
+                       // All fine
                        return TRUE;
                } else {
-                       // Something bad happened
+                       // Something unexpected happened (e.g. no API requests left)
                        displayMessage($return['message']);
                        return FALSE;
                }
@@ -587,7 +596,7 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) {
        } // END - if
 
        // Now call "get.php"
-       $response = executeWernisApiGet($rows[0], 'data', 'anrede|vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email|werber');
+       $response = executeWernisApiGet($rows[0], 'data', 'vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email|werber');
 
        // Was the status okay?
        if (isHttpResponseStatusOkay($response)) {
@@ -602,10 +611,10 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) {
 
                /*
                 * Do some checks on the decoded string, it should be a
-                * serialized array with 11 entries (see above
+                * serialized array with 10 entries (see above
                 * executeWernisApiGet() call).
                 */
-               assert(substr($decodedData, 0, 6) == 'a:11:{');
+               assert(substr($decodedData, 0, 6) == 'a:10:{');
                assert(substr($decodedData, -1, 1) == '}');
 
                // The array seems to be fine, unserialize it
@@ -613,7 +622,6 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) {
 
                // All mappings WDS66->mailer
                $mappings = array(
-                       'anrede'      => 'gender',
                        'vorname'     => 'surname',
                        'name'        => 'family',
                        'strasse'     => 'street_nr',
index 5eb84e4..cc04cde 100644 (file)
@@ -2401,6 +2401,21 @@ function doTemplateMetaFavIcon ($templateName, $clear = FALSE) {
        return $out;
 }
 
+// Helper function to display referral id or hide it depending on settings
+function doTemplateDisplayReferralIdContent ($template, $clear = FALSE) {
+       // Ddisplay the refid or make it editable?
+       if (isDisplayRefidEnabled()) {
+               // Load "hide" form template
+               $out = loadTemplate('guest_register_refid_hide', TRUE);
+       } else {
+               // Load template to enter it
+               $out = loadTemplate('guest_register_refid', TRUE);
+       }
+
+       // Return code
+       return $out;
+}
+
 // "Getter" for template base path
 function getTemplateBasePath ($part) {
        // Is there cache?
@@ -2435,5 +2450,22 @@ function removeDeprecatedComment ($output) {
        return $return;
 }
 
+// Generates a selection box suitable for e.g. birthdays: day, month and year
+function generateDayMonthYearSelectionBox ($day, $month, $year) {
+       // This depends on selected language
+       switch (getLanguage()) {
+               case 'de': // German date format
+                       $content = addSelectionBox('da', $day) . addSelectionBox('mo', $month) . addSelectionBox('ye', $year);
+                       break;
+
+               default: // Default is the US date format... :)
+                       $content = addSelectionBox('mo', $month) . addSelectionBox('da', $day) . addSelectionBox('ye', $year);
+                       break;
+       } // END - switch
+
+       // Return content
+       return $content;
+}
+
 // [EOF]
 ?>
index 9b2d2e3..1deb876 100644 (file)
@@ -4,7 +4,7 @@
 <table border="0" cellspacing="0" cellpadding="0" width="640" class="table dashed">
        <tr>
                <td colspan="2" class="table_header bottom">
-                       {%template,LoadTemplate=register_header%}
+                       {--GUEST_REGISTER_GENERIC_TITLE--}
                </td>
        </tr>
 
                </td>
        </tr>
 
-       $content[refid_content]
+       {%template,DisplayReferralIdContent%}
 
        <tr>
                <td colspan="2" class="table_header bottom top">
                        </table>
                </td>
        </tr>
+
        <tr>
                <td colspan="2" class="table_footer">
                        <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
diff --git a/templates/de/html/guest/guest_wernis_registration_form.tpl b/templates/de/html/guest/guest_wernis_registration_form.tpl
new file mode 100644 (file)
index 0000000..706fc08
--- /dev/null
@@ -0,0 +1,168 @@
+<div align="center">
+{%form,formMethodPost,formNameRegister=modules.php?module=index&amp;what=register%}
+<input type="hidden" name="registration_provider" value="register" />
+<table border="0" cellspacing="0" cellpadding="0" width="640" class="table dashed">
+       <tr>
+               <td colspan="2" class="table_header bottom">
+                       {--GUEST_REGISTER_WERNIS_PROVIDER_TITLE--}
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="table_header bottom">
+                       {--REGISTER_PERSONAL_DATA--}:
+               </td>
+       </tr>
+
+       <tr>
+               <td class="bottom" colspan="2" align="center">
+               <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--GENDER--}$content[must_fillout_gender]:
+                               </td>
+                               <td class="register_right">
+                                       {%pipe,generateGenderSelectionBox=$content[gender]%}
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--SURNAME--}$content[must_fillout_surname],
+                                       {--FAMILY--}$content[must_fillout_family]:
+                               </td>
+                               <td class="register_right">
+                                       <input type="text" class="form_field" name="surname" size="15" maxlength="255" value="$content[surname]" />
+                                       <input type="text" class="form_field" name="family" size="15" maxlength="255" value="$content[family]" />
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--STREET_NR--}$content[must_fillout_street_nr]:
+                               </td>
+                               <td class="register_right">
+                                       <input type="text" class="form_field" name="street_nr" size="25" maxlength="255" value="$content[street_nr]" />
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--COUNTRY--}$content[must_fillout_cntry], {--ZIP--}$content[must_fillout_zip],
+                                       {--CITY--}$content[must_fillout_city]:
+                               </td>
+                               <td class="register_right">
+                                       {%pipe,postRequestElement,addCountryCodeSelectionBox=country_code%}
+                                       <input type="text" class="form_field" name="zip" size="5" maxlength="10" value="$content[zip]" />
+                                       <input type="text" class="form_field" name="city" size="20" maxlength="255" value="$content[city]" />
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--EMAIL--}$content[must_fillout_email]:
+                               </td>
+                               <td class="register_right">
+                                       <input type="text" class="form_field" name="email" size="30" maxlength="255" value="$content[email]" />
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td class="register_left" align="right">
+                                       {--BIRTHDAY--}$content[must_fillout_birthday]:
+                               </td>
+                               <td class="register_right">
+                                       $content[birthday_selection]
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td colspan="2" align="center">
+                                       <div class="notice">
+                                               $content[must_fillout_marker]:{--GUEST_REGISTER_MUST_SET_NOTICE--}
+                                       </div>
+                               </td>
+                       </tr>
+               </table>
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="table_header bottom">
+                       {--REGISTER_CATEGORIES--}:
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="table_header">
+                       {--GUEST_SELECT_LEAST_CATEGORIES--}
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="bottom">
+                       {%pipe,registerGenerateCategoryTable=guest%}
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="table_header bottom">
+                       {--REGISTER_MISC--}:
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" align="center">
+                       <div class="notice tiny">{--GUEST_EMPTY_PASSWORD_HINT--}</div>
+               </td>
+       </tr>
+
+       <tr>
+               <td class="register_left" align="right">
+                       {--GUEST_ENTER_PASSWORDS--}
+               </td>
+               <td class="register_right">
+                       <input type="password" class="form_field" name="password1" size="10" maxlength="100" />
+                       <input type="password" class="form_field" name="password2" size="10" maxlength="100" />
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" align="center">
+                       {%pipe,addMaxReceiveList=guest%}
+               </td>
+       </tr>
+
+       {%template,DisplayReferralIdContent%}
+
+       <tr>
+               <td colspan="2" class="table_header bottom top">
+                       {--TERMS_OF_USAGE--}:
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="bottom">
+                       <table border="0" cellspacing="0" cellpadding="0" width="640" class="table">
+                       <tr>
+                               <td width="50%" align="right">
+                                       {--AGREE_TO_THIS--}
+                               </td>
+                               <td width="50%">
+                                       <input type="radio" class="form_field" name="agree" value="Y" /> {--YES--}<br />
+                                       <input type="radio" class="form_field" name="agree" value="N" checked="checked" /> {--NO--}
+                               </td>
+                       </tr>
+                       </table>
+               </td>
+       </tr>
+
+       <tr>
+               <td colspan="2" class="table_footer">
+                       <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
+                       <input type="submit" class="form_submit" name="ok" value="{--SUBMIT_REGISTER--}" />
+               </td>
+       </tr>
+</table>
+{%form_close%}
+</div>
index 8cc8465..11f5d85 100644 (file)
@@ -1 +1 @@
-Anmeldeformular zum {?mt_word?} <strong>{?MAIN_TITLE?}</strong>:
+<!-- @DEPRECATED //-->