[Rt-commit] r7762 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Thu May 3 22:38:36 EDT 2007


Author: ruz
Date: Thu May  3 22:38:35 2007
New Revision: 7762

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/index.html

Log:
 r5229 at cubic-pc:  cubic | 2007-05-04 06:36:22 +0400
 * switch to CollectionList for users in admin UI
 ** paging
 ** sorting
 ** more info on one page
 ** save a state of the form between reloads
 


Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/index.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/index.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/index.html	Thu May  3 22:38:35 2007
@@ -50,67 +50,87 @@
     current_subtab => 'Admin/Users/',
     Title => loc('Select a user') &>
 
-<h1><%$caption%></h1>
+<h1><% $caption %></h1>
 <p><&|/l&>Select a user</&>:</p>
-<ul>
 % unless ( $users->Count ) {
 <li><em><&|/l&>No users matching search criteria found.</&></em></li>
-% }
+% } else {
 
-% my @ids;
-% while ( $user = $users->Next ) {
-%    push @ids, $user->Id;
-<li><a href="Modify.html?id=<% $user->id %>"><& /Elements/ShowUser, User => $user &></a></li>
-%}
-</ul>
-% if ( my $ids = join(',', @ids) ) {
-<em>(<a href="<%RT->Config->Get('WebPath')%>/Download/Tabular/User/<% $ids %>/Users.tsv"><&|/l&>Download as a tab-delimited file</&></a>)</em><br />
+<& /Elements/CollectionList,
+    OrderBy => 'Name',
+    Order => 'ASC',
+    Rows  => 100,
+    BaseURL => RT->Config->Get('WebPath') .'/Admin/Users/index.html?',
+    %ARGS,
+    Format => $Format,
+    Collection => $users,
+    AllowSorting => 1,
+    PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField IdLike EmailLike FindDisabledUsers)],
+&>
+
+% my $ids = join ',', map $_->id, @{ $users->ItemsArrayRef };
+% if ( $ids ) {
+<div align="right"><em>
+(<a href="<%RT->Config->Get('WebPath')%>/Download/Tabular/User/<% $ids %>/Users.tsv">
+<&|/l&>Download as a tab-delimited file</&>
+</a>)</em></div>
 % }
 
 <br /><br />
-<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
+% }
 
+<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Users/index.html">
+% foreach my $field( qw(Format Rows Page Order OrderBy) ) {
+%     next unless defined $ARGS{ $field } && length $ARGS{ $field };
+<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
+% }
 <&|/l&>Find people whose</&> <& /Elements/SelectUsers &><br />
-<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" /> <&|/l&>Include disabled users in search.</&>
+<input type="checkbox" class="checkbox" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> />
+<&|/l&>Include disabled users in search.</&>
 <br />
 <div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> 
 </form>
 
 <%INIT>
-my ($user, $caption);
-my $users = new RT::Users($session{'CurrentUser'});
+my $caption;
+my $users = RT::Users->new( $session{'CurrentUser'} );
+$users->{'find_disabled_rows'} = 1 if $FindDisabledUsers;
 
-if ($FindDisabledUsers) {
-	$users->{'find_disabled_rows'} = 1;
-}
-
-if (length $UserString) {
+if ( length $UserString ) {
     $caption = loc("Users matching search criteria");
-    if ($UserField =~ /^CustomField-(\d+)/) {
-	$users->LimitCustomField(
-	    CUSTOMFIELD => $1,
-	    OPERATOR => $UserOp,
-	    VALUE => $UserString,
-	); 
+    if ( $UserField =~ /^CustomField-(\d+)/ ) {
+        $users->LimitCustomField(
+            CUSTOMFIELD => $1,
+            OPERATOR => $UserOp,
+            VALUE => $UserString,
+        ); 
     }
     else {
-	$users->Limit(
-	    FIELD => $UserField,
-	    OPERATOR => $UserOp,
-	    VALUE => $UserString,
-	); 
+        $users->Limit(
+            FIELD => $UserField,
+            OPERATOR => $UserOp,
+            VALUE => $UserString,
+        ); 
     }
 }
 else {
     $caption = loc("Privileged users");
     $users->LimitToPrivileged;
 }
+
+$Format ||= q{'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__id__</a>/TITLE:#'}
+    .q{,'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__Name__</a>/TITLE:Name'}
+    .q{,__RealName__, __EmailAddress__};
+
 </%INIT>
 <%ARGS>
+$Format => undef,
+
 $UserString => undef
 $UserOp => '='
 $UserField => 'Name'
 $IdLike => undef
 $EmailLike => undef
+
 $FindDisabledUsers => 0
 </%ARGS>


More information about the Rt-commit mailing list