[Jaws-commits] r13346 - in trunk/jaws/html/gadgets/Users: . actions/AdminHTML languages resources templates

afz at jaws-project.com afz at jaws-project.com
Thu Aug 9 17:51:54 UTC 2012


Author: afz
Date: 2012-08-09 17:51:53 +0000 (Thu, 09 Aug 2012)
New Revision: 13346

Modified:
   trunk/jaws/html/gadgets/Users/AdminAjax.php
   trunk/jaws/html/gadgets/Users/actions/AdminHTML/Users.php
   trunk/jaws/html/gadgets/Users/languages/en.php
   trunk/jaws/html/gadgets/Users/languages/fa.php
   trunk/jaws/html/gadgets/Users/resources/script.js
   trunk/jaws/html/gadgets/Users/resources/style.rtl.css
   trunk/jaws/html/gadgets/Users/templates/AdminUser.html
Log:
[Users]: Add/Edit expiry date

Modified: trunk/jaws/html/gadgets/Users/AdminAjax.php
===================================================================
--- trunk/jaws/html/gadgets/Users/AdminAjax.php	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/AdminAjax.php	2012-08-09 17:51:53 UTC (rev 13346)
@@ -44,15 +44,22 @@
             return array();
         }
 
+        $objDate = $GLOBALS['app']->loadDate();
         if ($account) {
             require_once JAWS_PATH . 'include/Jaws/Gravatar.php';
             $profile['image'] = Jaws_Gravatar::GetGravatar($profile['email'], 48);
+            if (!empty($profile['expiry_date'])) {
+                $profile['expiry_date'] = $objDate->Format($profile['expiry_date'], 'Y-m-d');
+            } else {
+                $profile['expiry_date'] = '';
+            }
         }
 
         if ($personal) {
             if (!empty($profile['dob'])) {
-                $objDate = $GLOBALS['app']->loadDate();
                 $profile['dob'] = $objDate->Format($profile['dob'], 'Y-m-d');
+            } else {
+                $profile['dob'] = '';
             }
         }
 
@@ -114,10 +121,12 @@
      * @param   int     $guid       Group where user should go
      * @param   int     $superadmin User's type (superadmin or normal)
      * @param   int     $concurrent_logins  Concurrent logins limitation
+     * @param   string  $expiry_date  Expiry date
      * @param   int     $status     user's status (null: all users, 0: disabled, 1: activated, 2: not verified)
      * @return  array   Response (notice or error)
      */
-    function AddUser($username, $password, $nickname, $email, $superadmin, $concurrent_logins, $status)
+    function AddUser($username, $password, $nickname, $email, $superadmin, $concurrent_logins,
+                     $expiry_date, $status)
     {
         $this->CheckSession('Users', 'ManageUsers');
         if ($GLOBALS['app']->Registry->Get('/crypt/enabled') == 'true') {
@@ -138,7 +147,9 @@
                                           $password,
                                           $superadmin,
                                           $status,
-                                          $concurrent_logins);
+                                          $concurrent_logins,
+                                          null,
+                                          $expiry_date);
         if (Jaws_Error::isError($res)) {
             $GLOBALS['app']->Session->PushLastResponse($res->getMessage(),
                                                        RESPONSE_ERROR);
@@ -165,10 +176,12 @@
      * @param   string  $email      User's email
      * @param   int     $superadmin User's type (ADMIN or NORMAL)
      * @param   int     $concurrent_logins   Concurrent logins limitation
+     * @param   string  $expiry_date  Expiry date
      * @param   int     $status     user's status (null: all users, 0: disabled, 1: activated, 2: not verified)
      * @return  array   Response (notice or error)
      */
-    function UpdateUser($uid, $username, $password, $nickname, $email, $superadmin, $concurrent_logins, $status)
+    function UpdateUser($uid, $username, $password, $nickname, $email, $superadmin, $concurrent_logins,
+                        $expiry_date, $status)
     {
         $this->CheckSession('Users', 'ManageUsers');
         if ($GLOBALS['app']->Registry->Get('/crypt/enabled') == 'true') {
@@ -182,13 +195,15 @@
         }
 
         if ($uid == $GLOBALS['app']->Session->GetAttribute('user')) {
-            $status     = null;
-            $superadmin = null;
+            $status      = null;
+            $superadmin  = null;
+            $expiry_date = null;
         } else {
             $status = (int)$status;
             if (!$GLOBALS['app']->Session->IsSuperAdmin()) {
-                $status     = null;
-                $superadmin = null;
+                $status      = null;
+                $superadmin  = null;
+                $expiry_date = null;
             }
         }
         $res = $this->_UserModel->UpdateUser($uid,
@@ -198,7 +213,9 @@
                                              $password,
                                              $superadmin,
                                              $status,
-                                             $concurrent_logins);
+                                             $concurrent_logins,
+                                             null,
+                                             $expiry_date);
         if (Jaws_Error::isError($res)) {
             $GLOBALS['app']->Session->PushLastResponse($res->getMessage(), RESPONSE_ERROR);
         } else {

Modified: trunk/jaws/html/gadgets/Users/actions/AdminHTML/Users.php
===================================================================
--- trunk/jaws/html/gadgets/Users/actions/AdminHTML/Users.php	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/actions/AdminHTML/Users.php	2012-08-09 17:51:53 UTC (rev 13346)
@@ -311,6 +311,16 @@
         $tpl->SetVariable('lbl_logins', _t('USERS_USERS_CONCURRENT_LOGINS'));
         $tpl->SetVariable('logins', $logins->Get());
 
+        // expiry date
+        $dExpiry =& Piwi::CreateWidget('DatePicker', 'expiry_date', '');
+        $dExpiry->SetId('expiry_date');
+        $dExpiry->showTimePicker(true);
+        $dExpiry->setLanguageCode($GLOBALS['app']->Registry->Get('/config/calendar_language'));
+        $dExpiry->setCalType($GLOBALS['app']->Registry->Get('/config/calendar_type'));
+        $dExpiry->setDateFormat('%Y-%m-%d');
+        $tpl->SetVariable('lbl_expiry_date', _t('USERS_USERS_EXPIRY_DATE'));
+        $tpl->SetVariable('expiry_date', $dExpiry->Get());
+
         // status
         $status =& Piwi::CreateWidget('Combo', 'status');
         $status->SetID('status');

Modified: trunk/jaws/html/gadgets/Users/languages/en.php
===================================================================
--- trunk/jaws/html/gadgets/Users/languages/en.php	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/languages/en.php	2012-08-09 17:51:53 UTC (rev 13346)
@@ -95,6 +95,7 @@
 define('_EN_USERS_USERS_BIRTHDAY_SAMPLE', "e.g., 2009/08/31");
 define('_EN_USERS_USERS_SHOW_ALL', "Show all");
 define('_EN_USERS_USERS_CONCURRENT_LOGINS', "Concurrent logins");
+define('_EN_USERS_USERS_EXPIRY_DATE', "Expiry date");
 define('_EN_USERS_FIND_USER', "Find user");
 define('_EN_USERS_USERS_SEND_AUTO_PASSWORD', "Leave it empty for send random password to your email");
 define('_EN_USERS_USERS_PASSWORD_VERIFY', "Verify Password");

Modified: trunk/jaws/html/gadgets/Users/languages/fa.php
===================================================================
--- trunk/jaws/html/gadgets/Users/languages/fa.php	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/languages/fa.php	2012-08-09 17:51:53 UTC (rev 13346)
@@ -83,6 +83,7 @@
 define('_FA_USERS_USERS_BIRTHDAY_SAMPLE', "مانند: 18 - 05 - 1360");
 define('_FA_USERS_USERS_SHOW_ALL', "دیدن همه");
 define('_FA_USERS_USERS_CONCURRENT_LOGINS', "تعداد ورود همزمان");
+define('_FA_USERS_USERS_EXPIRY_DATE', "زمان پایان");
 define('_FA_USERS_FIND_USER', "جستجوی کاربر");
 define('_FA_USERS_USERS_SEND_AUTO_PASSWORD', "برای ارسال گذرواژه تصادفی به ایمیل شما، آنرا خالی بگذارید");
 define('_FA_USERS_USERS_PASSWORD_VERIFY', "کنترل مجدد گذرواژه");

Modified: trunk/jaws/html/gadgets/Users/resources/script.js
===================================================================
--- trunk/jaws/html/gadgets/Users/resources/script.js	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/resources/script.js	2012-08-09 17:51:53 UTC (rev 13346)
@@ -198,6 +198,7 @@
                                    $('email').value,
                                    $('superadmin').value,
                                    $('logins').value,
+                                   $('expiry_date').value,
                                    $('status').value);
             } else {
                 usersAsync.updateuser($('uid').value,
@@ -207,6 +208,7 @@
                                       $('email').value,
                                       $('superadmin').value,
                                       $('logins').value,
+                                      $('expiry_date').value,
                                       $('status').value);
             }
 
@@ -297,16 +299,17 @@
     currentAction = 'UserAccount';
     $('legend_title').innerHTML  = editUser_title;
     $('user_workarea').innerHTML = cachedUserForm;
+    initDatePicker('expiry_date');
     selectGridRow('users_datagrid', rowElement.parentNode.parentNode);
 
     var uInfo = usersSync.getuser(uid, true);
-    //$('user_avatar').src = uInfo['image'];
-    $('username').value   = uInfo['username'];
-    $('nickname').value   = uInfo['nickname'];
-    $('email').value      = uInfo['email'];
-    $('superadmin').value = Number(uInfo['superadmin']);
-    $('logins').value     = uInfo['concurrent_logins'];
-    $('status').value     = uInfo['status'];
+    $('username').value    = uInfo['username'];
+    $('nickname').value    = uInfo['nickname'];
+    $('email').value       = uInfo['email'];
+    $('superadmin').value  = Number(uInfo['superadmin']);
+    $('logins').value      = uInfo['concurrent_logins'];
+    $('expiry_date').value = uInfo['expiry_date'];
+    $('status').value      = uInfo['status'];
 }
 
 /**
@@ -399,6 +402,7 @@
     unselectGridRow('users_datagrid');
     $('legend_title').innerHTML  = addUser_title;
     $('user_workarea').innerHTML = cachedUserForm;
+    initDatePicker('expiry_date');
 }
 
 /**

Modified: trunk/jaws/html/gadgets/Users/resources/style.rtl.css
===================================================================
--- trunk/jaws/html/gadgets/Users/resources/style.rtl.css	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/resources/style.rtl.css	2012-08-09 17:51:53 UTC (rev 13346)
@@ -196,7 +196,7 @@
 width: 52px;
 }
 
-#username, #email, #pass1, #pass2, #logins,
+#username, #email, #pass1, #pass2, #logins, #expiry_date,
 #dob, #url, #timezone, #language, #theme {
 direction: ltr;
 }

Modified: trunk/jaws/html/gadgets/Users/templates/AdminUser.html
===================================================================
--- trunk/jaws/html/gadgets/Users/templates/AdminUser.html	2012-08-09 14:59:25 UTC (rev 13345)
+++ trunk/jaws/html/gadgets/Users/templates/AdminUser.html	2012-08-09 17:51:53 UTC (rev 13346)
@@ -8,6 +8,7 @@
   <tr><td><label for="pass1">{lbl_pass1}:</label><br />{pass1}</td></tr>
   <tr><td><label for="pass2">{lbl_pass2}:</label><br />{pass2}</td></tr>
   <tr><td><label for="logins">{lbl_logins}:</label><br />{logins}</td></tr>
+  <tr><td><label for="expiry_date">{lbl_expiry_date}:</label><br />{expiry_date}</td></tr>
   <tr><td><label for="status">{lbl_status}:</label><br />{status}</td></tr>
 </table>
 <!-- END user -->



More information about the Jaws-commits mailing list