Changeset 4093

Show
Ignore:
Timestamp:
Wed Nov 16 13:03:53 2005
Author:
mugur
Message:

fixed ticket:1412 - Subscribers screen: sort by most recently added

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/campsite/implementation/database/upgrade/2.3.x/tables.sql

    r4086 r4093  
    3 3 ALTER TABLE Users CHANGE COLUMN Password Password VARCHAR(64) NOT NULL DEFAULT '';  
    4 4  
    5   #  
    6   # Log table  
    7   #  
      5 --  
      6 -- Log table  
      7 --  
    8 8  
    9   # Fix the log table - use the USER ID instead of the user name to identify  
    10   # the user.  
      9 -- Fix the log table - use the USER ID instead of the user name to identify  
      10 -- the user.  
    11 11 ALTER TABLE `Log` ADD `fk_user_id` INT UNSIGNED AFTER `User` ;  
    12 12 UPDATE Log, Users SET Log.fk_user_id=Users.Id WHERE Log.User=Users.UName;  
    13 13 ALTER TABLE `Log` DROP `User` ;  
    14 14  
    15   # Fix the names of the "Log" table to coorespond to database naming conventions  
      15 -- Fix the names of the "Log" table to coorespond to database naming conventions  
    15 15 ALTER TABLE `Log` CHANGE `TStamp` `time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';  
    16 16 ALTER TABLE `Log` CHANGE `IdEvent` `fk_event_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0';  
     
    19 19  
    20 20  
    21   #  
    22   # ArticlePublish table  
    23   #  
      21 --  
      22 -- ArticlePublish table  
      23 --  
    24 24  
    25   # Fix names of "ArticlePublish" table to use database naming conventions  
      25 -- Fix names of "ArticlePublish" table to use database naming conventions  
    25 25 ALTER TABLE `ArticlePublish` CHANGE `NrArticle` `fk_article_number` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',  
    26 26 CHANGE `IdLanguage` `fk_language_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',  
     
    32 32 CHANGE `Completed` `is_completed` ENUM( 'N', 'Y' ) NOT NULL DEFAULT 'N';  
    33 33  
    34   # Delete the old primary key.  
      34 -- Delete the old primary key.  
    34 34 ALTER TABLE `ArticlePublish` DROP PRIMARY KEY;  
    35 35  
    36   # Add new indexes.  
      36 -- Add new indexes.  
    36 36 ALTER TABLE `ArticlePublish` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;  
    37 37 ALTER TABLE `ArticlePublish` ADD INDEX `article_index` ( `fk_article_number` , `fk_language_id` );  
    38 38 ALTER TABLE `ArticlePublish` ADD INDEX `event_time_index` ( `time_action` , `is_completed` );  
    39 39  
    40   #  
    41   # IssuePublish table  
    42   #  
      40 --  
      41 -- IssuePublish table  
      42 --  
    43 43  
    44   # Drop old index.  
      44 -- Drop old index.  
    44 44 ALTER TABLE `IssuePublish` DROP PRIMARY KEY;  
    45 45  
    46   # Fix column names.  
      46 -- Fix column names.  
    46 46 ALTER TABLE `IssuePublish` CHANGE `IdPublication` `fk_publication_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',  
    47 47 CHANGE `NrIssue` `fk_issue_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',  
    56 56 CHANGE `Completed` `is_completed` ENUM( 'N', 'Y' ) NOT NULL DEFAULT 'N';  
    57 57  
    58   # Add new indexes.  
      58 -- Add new indexes.  
    58 58 ALTER TABLE `IssuePublish` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;  
    59 59 ALTER TABLE `IssuePublish` ADD INDEX `issue_index` ( `fk_publication_id` , `fk_issue_id` , `fk_language_id` );  
    60 60 ALTER TABLE `IssuePublish` ADD INDEX `action_time_index` ( `time_action` , `is_completed` );  
    61 61  
      62 -- Add time_created and time_updated fields  
      63 ALTER TABLE `campsite`.`Users` ADD COLUMN `time_updated` TIMESTAMP  NOT NULL AFTER `Text3`;  
      64 ALTER TABLE `campsite`.`Users` ADD COLUMN `time_created` TIMESTAMP  NOT NULL AFTER `time_updated`;  
  • trunk/campsite/implementation/management/priv/users/index.php

    r4085 r4093  
    10 10 $typeParam = 'uType=' . urlencode($uType);  
    11 11 $isReader = $uType == 'Subscribers' ? 'Y' : 'N';  
      12 $orderField = Input::Get('ordfld', 'string', 'fname');  
      13 $orderDir = Input::Get('orddir', 'string', 'asc');  
      14 $orderURLs = array('fname'=>'ordfld=fname&orddir=asc', 'uname'=>'ordfld=uname&orddir=asc',  
      15     'cdate'=>'ordfld=cdate&orddir=asc');  
      16 $orderSigns = array('fname'=>'', 'uname'=>'', 'cdate'=>'');  
      17 $orderFields = array('fname'=>'Name', 'uname'=>'UName', 'cdate'=>'time_created');  
      18 if (!array_key_exists($orderField, $orderURLs)) {  
      19     $orderField = 'fname';  
      20     $orderDir = 'asc';  
      21 }  
      22 foreach($orderURLs as $field=>$fieldURL) {  
      23     $dir = ($orderField == $field ? ($orderDir == 'asc' ? 'desc' : 'asc') : 'asc');  
      24     $orderURLs[$field] = "ordfld=$field&orddir=$dir";  
      25     if ($dir == 'desc') {  
      26         $orderSigns[$field] = "<img src=\"".$Campsite["ADMIN_IMAGE_BASE_URL"]."/search_order_direction_down.png\" border=\"0\">";  
      27     } else {  
      28         $orderSigns[$field] = "<img src=\"".$Campsite["ADMIN_IMAGE_BASE_URL"]."/search_order_direction_up.png\" border=\"0\">";  
      29     }  
      30 }  
    12 31  
    13 32 $crumbs = array();  
     
    47 66     <td style="padding-left: 10px;"><?php putGS("Full Name"); ?></td>  
    48 67     <td><input type="text" name="full_name" value="<?php p(htmlspecialchars($full_name)); ?>" class="input_text" style="width: 150px;"></td>  
    49       <td><?php putGS("User Name"); ?></td>  
      68     <td><?php putGS("Account Name"); ?></td>  
    49 68     <td><input type="text" name="user_name" value="<?php p(htmlspecialchars($user_name)); ?>" class="input_text" style="width: 70px;"></td>  
    50 69     <td><?php putGS("E-Mail"); ?></td>  
     
    154 173     $sql .= " GROUP BY s.Id";  
    155 174 }  
    156   $sql .= " ORDER BY Name ASC";  
      175 $sql .= " ORDER BY " . $orderFields[$orderField] . " $orderDir";  
    156 175 $res = $Campsite['db']->SelectLimit($sql, $lpp+1, $userOffs);  
    157 176 if (gettype($res) == 'object' && $res->NumRows() > 0) {  
     
    161 180 ?><table border="0" cellspacing="1" cellpadding="3" class="table_list">  
    162 181     <tr class="table_list_header">  
    163           <td align="left" valign="top"><b><?php putGS("Full Name"); ?></b></td>  
    164           <td align="left" valign="top"><b><?php putGS("User Name"); ?></b></td>  
      182         <td align="left" valign="top">  
      183             <table><tr>  
      184             <td><b><a href="?<?php echo "$typeParam&" . $orderURLs['fname']; ?>"><?php putGS("Full Name"); ?></a></b></td>  
      185             <td><?php if ($orderField == 'fname') echo $orderSigns['fname']; ?></td>  
      186             </tr></table>  
      187         </td>  
      188         <td align="left" valign="top">  
      189             <table><tr>  
      190             <td><b><a href="?<?php echo "$typeParam&" . $orderURLs['uname']; ?>"><?php putGS("Account Name"); ?></a></b></td>  
      191             <td><?php if ($orderField == 'uname') echo $orderSigns['uname']; ?></td>  
      192             </tr></table>  
      193         </td>  
    165 194         <td align="left" valign="top"><b><?php putGS("E-Mail"); ?></b></td>  
    166 195 <?php if ($uType == "Subscribers" && $User->hasPermission("ManageSubscriptions")) { ?>  
    167 196         <td align="left" valign="top"><b><?php putGS("Subscriptions"); ?></b></td>  
    168 197 <?php } ?>  
      198         <td align="left" valign="top">  
      199             <table><tr>  
      200             <td><b><a href="?<?php echo "$typeParam&" . $orderURLs['cdate']; ?>"><?php putGS("Creation Date"); ?></a></b></td>  
      201             <td><?php if ($orderField == 'cdate') echo $orderSigns['cdate']; ?></td>  
      202             </tr></table>  
      203         </td>  
    169 204 <?php if ($canDelete) { ?>  
    170 205         <td align="left" valign="top"><b><?php putGS("Delete"); ?></b></td>  
    200 235             <?php putGS("Subscriptions"); ?></td>  
    201 236 <?php } ?>  
      237         <td>  
      238 <?php  
      239     $creationDate = $row['time_created'];  
      240     if ((int)$creationDate == 0) {  
      241         echo "N/A";  
      242     } else {  
      243         echo $creationDate;  
      244     }  
      245 ?>  
      246         </td>  
    202 247 <?php  
    203 248     $email = $old_email;