[Jaws-commits] r10796 - in branches/0.8/html/gadgets/Users: . templates

afz at jaws-project.com afz at jaws-project.com
Sat Nov 28 08:34:37 UTC 2009


Author: afz
Date: 2009-11-28 08:34:37 +0000 (Sat, 28 Nov 2009)
New Revision: 10796

Modified:
   branches/0.8/html/gadgets/Users/HTML.php
   branches/0.8/html/gadgets/Users/Model.php
   branches/0.8/html/gadgets/Users/templates/Register.html
Log:
fix some user friendly issue in registration user section

Modified: branches/0.8/html/gadgets/Users/HTML.php
===================================================================
--- branches/0.8/html/gadgets/Users/HTML.php	2009-11-28 08:32:47 UTC (rev 10795)
+++ branches/0.8/html/gadgets/Users/HTML.php	2009-11-28 08:34:37 UTC (rev 10796)
@@ -643,12 +643,18 @@
             $tpl->SetVariable('dob_sample',        _t('USERS_USERS_BIRTHDAY_SAMPLE'));
 
             if ($post_data = $GLOBALS['app']->Session->PopSimpleResponse('Users.Register.Data')) {
-                $tpl->SetVariable('username', $post_data['username']);
-                $tpl->SetVariable('email',    $post_data['email']);
-                $tpl->SetVariable('url',      $post_data['url']);
-                $tpl->SetVariable('dname',    $post_data['dname']);
-                $tpl->SetVariable('fname',    $post_data['fname']);
-                $tpl->SetVariable('lname',    $post_data['lname']);
+                $tpl->SetVariable('username',  $post_data['username']);
+                $tpl->SetVariable('email',     $post_data['email']);
+                $tpl->SetVariable('url',       $post_data['url']);
+                $tpl->SetVariable('dname',     $post_data['dname']);
+                $tpl->SetVariable('fname',     $post_data['fname']);
+                $tpl->SetVariable('lname',     $post_data['lname']);
+                $tpl->SetVariable('dob_year',  $post_data['dob_year']);
+                $tpl->SetVariable('dob_month', $post_data['dob_month']);
+                $tpl->SetVariable('dob_day',   $post_data['dob_day']);
+                $tpl->SetVariable("selected_gender_{$post_data['gender']}", 'selected="selected"');
+            } else {
+                $tpl->SetVariable("selected_gender_0", 'selected="selected"');
             }
 
             $tpl->SetVariable('register', _t('USERS_REGISTER'));

Modified: branches/0.8/html/gadgets/Users/Model.php
===================================================================
--- branches/0.8/html/gadgets/Users/Model.php	2009-11-28 08:32:47 UTC (rev 10795)
+++ branches/0.8/html/gadgets/Users/Model.php	2009-11-28 08:34:37 UTC (rev 10796)
@@ -49,10 +49,16 @@
             return _t('USERS_REGISTER_EMAIL_NOT_VALID');
         }
 
+        $xss = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS');
         require_once JAWS_PATH . 'include/Jaws/User.php';
         $jUser = new Jaws_User;
 
-        $xss = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS');
+        //We already have a $username in the DB?
+        $info = $jUser->GetUserInfoByName($username);
+        if (Jaws_Error::IsError($info) || isset($info['username'])) {
+            return _t('USERS_USERS_ALREADY_EXISTS', $xss->filter($username));
+        }
+
         $user_type = is_numeric($user_type)? $user_type : 2;
         $user_enabled = $GLOBALS['app']->Registry->Get('/config/anon_activation') == 'auto';
         $user_id = $jUser->AddUser($username, $dname, $email,
@@ -173,9 +179,6 @@
                     $tpl->SetVariable('activation_link', $GLOBALS['app']->Map->GetURLFor('Users', 'ActivateUser',
                                                                 array('key' => $secretKey), true, 'site_url'));
                     $tpl->ParseBlock('Notification/Activation');
-                } else {
-                    $delete_user = true;
-                    $message = _t('USERS_ACTIVATE_NOT_ACTIVATED_SENDMAIL', $xss->filter($email));
                 }
             }
             $tpl->SetVariable('thanks', _t('GLOBAL_THANKS'));
@@ -191,8 +194,9 @@
                 $mail->SetBody($body, 'text');
                 $mresult = $mail->send();
                 if (Jaws_Error::IsError($mresult) && $activation == 'admin') {
-                    $delete_user = true;
-                    $message = _t('USERS_ACTIVATE_NOT_ACTIVATED_SENDMAIL', $xss->filter($email));
+                    // do nothing
+                    //$delete_user = true;
+                    //$message = _t('USERS_ACTIVATE_NOT_ACTIVATED_SENDMAIL', $xss->filter($email));
                 }
             }
         }

Modified: branches/0.8/html/gadgets/Users/templates/Register.html
===================================================================
--- branches/0.8/html/gadgets/Users/templates/Register.html	2009-11-28 08:32:47 UTC (rev 10795)
+++ branches/0.8/html/gadgets/Users/templates/Register.html	2009-11-28 08:34:37 UTC (rev 10796)
@@ -36,8 +36,8 @@
       </p>
       <p><label for="register_gender">{lbl_gender}:</label>
         <select name="gender" id="register_gender">
-          <option value="0" selected="selected">{gender_male}</option>
-          <option value="1">{gender_female}</option>
+          <option value="0" {selected_gender_0}>{gender_male}</option>
+          <option value="1" {selected_gender_1}>{gender_female}</option>
         </select>
       </p>
       <p id="register_dob">



More information about the Jaws-commits mailing list