[Rt-commit] r7751 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Wed May 2 17:34:10 EDT 2007
Author: ruz
Date: Wed May 2 17:34:00 2007
New Revision: 7751
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditTemplates
Log:
r5213 at cubic-pc: cubic | 2007-05-03 01:29:51 +0400
* switch EditTemplates interfac to ColumnMaps
** backward compatible
** add DeleteTemplates argument (list of IDs) as replacement for 'DeleteTemplate-X'
Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditTemplates
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditTemplates (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditTemplates Wed May 2 17:34:00 2007
@@ -6,35 +6,31 @@
% unless ( $Templates->Count ) {
<p><i><&|/l&>(No templates)</&></i></p>
% } else {
-<table>
-<tr>
-<th>
+
<i><&|/l&>(Check box to delete)</&></i>
-</th>
-<th>
-</th>
-</tr>
-% my $count;
-% while ( my $TemplateObj = $Templates->Next ) {
-<tr>
-<td>
-<input type="checkbox" class="checkbox" name="DeleteTemplate-<%$TemplateObj->Id%>" value="1" />
-</td>
-<td>
-<a href="Template.html?Queue=<%$id%>&Template=<%$TemplateObj->id()%>">
-<strong><% loc($TemplateObj->Name) %></strong></a>
-<br /><% loc($TemplateObj->Description) %>
-</td>
-</tr>
-% }
-</table>
+<& /Elements/CollectionList,
+ OrderBy => 'id',
+ Order => 'ASC',
+ BaseURL => 'Templates.html?',
+ %ARGS,
+ DisplayFormat => '__CheckBox.{DeleteTemplates}__,'. $Format,
+ Format => $Format,
+ Collection => $Templates,
+ AllowSorting => 1,
+ PassArguments => [qw(Format Rows Page Order OrderBy FindDisabledQueues)],
+&>
% }
<& /Elements/Submit, Label => loc('Delete Template') &>
</form>
<%INIT>
+my $dir_path = $m->request_comp->dir_path;
+$Format ||= qq{'<a href="__WebPath__$dir_path/Template.html?Queue=$id&Template=__id__">__id__</a>/TITLE:#'}
+ .qq{,'<a href="__WebPath__$dir_path/Template.html?Queue=$id&Template=__id__">__Name__</a>/TITLE:Name'}
+ .qq{,'__Description__'};
+
my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
$QueueObj->Load( $id ) if $id;
@@ -52,10 +48,13 @@
# deal with deleting existing templates
my @actions;
+# backwards compatibility, use DeleteTemplates array for this
foreach my $key (keys %ARGS) {
next unless $key =~ /^DeleteTemplate-(\d+)/;
+ push @DeleteTemplates, $1;
+}
- my $id = $1;
+foreach my $id( @DeleteTemplates ) {
my $TemplateObj = RT::Template->new( $session{'CurrentUser'} );
$TemplateObj->Load( $id );
unless ( $TemplateObj->id ) {
@@ -65,7 +64,7 @@
my ($retval, $msg) = $TemplateObj->Delete;
if ( $retval ) {
- push @actions, loc("Template deleted");
+ push @actions, loc("Template #[_1] deleted", $id);
}
else {
push @actions, $msg;
@@ -74,4 +73,8 @@
</%INIT>
<%ARGS>
$id => 0
+
+$Format => undef
+
+ at DeleteTemplates => ()
</%ARGS>
More information about the Rt-commit
mailing list