[Rt-commit] rt branch, 4.4/queue-sort-order, created. rt-4.2.9-103-g75c2067
? sunnavy
sunnavy at bestpractical.com
Wed Dec 31 06:05:49 EST 2014
The branch, 4.4/queue-sort-order has been created
at 75c206710acdbb391abe8c46fbaeed38457c130b (commit)
- Log -----------------------------------------------------------------
commit 75c206710acdbb391abe8c46fbaeed38457c130b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Dec 19 08:21:51 2014 +0800
SortOrder column for queue
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 0e95b7b..5322c8d 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2865,7 +2865,7 @@ Set(%AdminSearchResultFormat,
Queues =>
q{'<a href="__WebPath__/Admin/Queues/Modify.html?id=__id__">__id__</a>/TITLE:#'}
.q{,'<a href="__WebPath__/Admin/Queues/Modify.html?id=__id__">__Name__</a>/TITLE:Name'}
- .q{,__Description__,__Address__,__Priority__,__DefaultDueIn__,__Lifecycle__,__SubjectTag__,__Disabled__},
+ .q{,__Description__,__Address__,__Priority__,__DefaultDueIn__,__Lifecycle__,__SubjectTag__,__Disabled__,__SortOrder__},
Groups =>
q{'<a href="__WebPath__/Admin/Groups/Modify.html?id=__id__">__id__</a>/TITLE:#'}
diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index 847adfa..e6eb3b5 100644
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -29,6 +29,7 @@ CREATE TABLE Queues (
CommentAddress VARCHAR2(120),
Lifecycle VARCHAR2(32),
SubjectTag VARCHAR2(120),
+ SortOrder NUMBER(11,0) DEFAULT 0 NOT NULL,
Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
Created DATE,
LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
diff --git a/etc/schema.Pg b/etc/schema.Pg
index c1ef22f..c7499c5 100644
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -52,6 +52,7 @@ CREATE TABLE Queues (
CommentAddress varchar(120) NULL ,
Lifecycle varchar(32) NULL,
SubjectTag varchar(120) NULL ,
+ SortOrder integer NOT NULL DEFAULT 0 ,
Creator integer NOT NULL DEFAULT 0 ,
Created TIMESTAMP NULL ,
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
index b748d85..6f2262e 100644
--- a/etc/schema.SQLite
+++ b/etc/schema.SQLite
@@ -30,6 +30,7 @@ CREATE TABLE Queues (
CommentAddress varchar(120) collate NOCASE NULL ,
Lifecycle varchar(32) collate NOCASE NULL ,
SubjectTag varchar(120) collate NOCASE NULL ,
+ SortOrder integer NOT NULL DEFAULT 0 ,
Creator integer NULL DEFAULT 0 ,
Created DATETIME NULL ,
LastUpdatedBy integer NULL DEFAULT 0 ,
diff --git a/etc/schema.mysql b/etc/schema.mysql
index f1458b4..a66965c 100644
--- a/etc/schema.mysql
+++ b/etc/schema.mysql
@@ -26,6 +26,7 @@ CREATE TABLE Queues (
CommentAddress varchar(120) NULL,
Lifecycle varchar(32) NULL,
SubjectTag varchar(120) NULL,
+ SortOrder integer NOT NULL DEFAULT 0 ,
Creator integer NOT NULL DEFAULT 0 ,
Created DATETIME NULL ,
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
diff --git a/etc/upgrade/4.3.2/content b/etc/upgrade/4.3.2/content
index 3cfadfe..9673e6c 100644
--- a/etc/upgrade/4.3.2/content
+++ b/etc/upgrade/4.3.2/content
@@ -7,6 +7,8 @@ our @Initial = (
my $queues = RT::Queues->new(RT->SystemUser);
$queues->UnLimit;
$queues->{'find_disabled_rows'} = 1;
+ # override the default order by SortOrder, because it doesn't exist yet
+ $queues->OrderByCols();
while ( my $queue = $queues->Next ) {
next if $queue->FirstAttribute('DefaultValues');
my %default;
diff --git a/etc/upgrade/4.3.6/schema.Oracle b/etc/upgrade/4.3.6/schema.Oracle
new file mode 100644
index 0000000..3f353c4
--- /dev/null
+++ b/etc/upgrade/4.3.6/schema.Oracle
@@ -0,0 +1 @@
+ALTER TABLE Queues ADD SortOrder NUMBER(11,0) DEFAULT 0 NOT NULL;
diff --git a/etc/upgrade/4.3.6/schema.Pg b/etc/upgrade/4.3.6/schema.Pg
new file mode 100644
index 0000000..6d379c2
--- /dev/null
+++ b/etc/upgrade/4.3.6/schema.Pg
@@ -0,0 +1 @@
+ALTER TABLE Queues ADD COLUMN SortOrder integer NOT NULL DEFAULT 0;
diff --git a/etc/upgrade/4.3.6/schema.SQLite b/etc/upgrade/4.3.6/schema.SQLite
new file mode 100644
index 0000000..6d379c2
--- /dev/null
+++ b/etc/upgrade/4.3.6/schema.SQLite
@@ -0,0 +1 @@
+ALTER TABLE Queues ADD COLUMN SortOrder integer NOT NULL DEFAULT 0;
diff --git a/etc/upgrade/4.3.6/schema.mysql b/etc/upgrade/4.3.6/schema.mysql
new file mode 100644
index 0000000..6d379c2
--- /dev/null
+++ b/etc/upgrade/4.3.6/schema.mysql
@@ -0,0 +1 @@
+ALTER TABLE Queues ADD COLUMN SortOrder integer NOT NULL DEFAULT 0;
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index fa5e8a1..557f600 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -940,6 +940,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
=cut
+=head2 SortOrder
+
+Returns the current value of SortOrder.
+(In the database, SortOrder is stored as int(11).)
+
+
+=cut
+
=head2 Creator
@@ -1013,6 +1021,8 @@ sub _CoreAccessible {
{read => 1, write => 1, sql_type => 12, length => 120, is_blob => 0, is_numeric => 0, type => 'varchar(120)', default => ''},
Lifecycle =>
{read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => 'default'},
+ SortOrder =>
+ {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
Creator =>
{read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
Created =>
diff --git a/lib/RT/Queues.pm b/lib/RT/Queues.pm
index add6f61..78e357e 100644
--- a/lib/RT/Queues.pm
+++ b/lib/RT/Queues.pm
@@ -80,10 +80,19 @@ sub _Init {
my $self = shift;
$self->{'with_disabled_column'} = 1;
- # By default, order by name
- $self->OrderBy( ALIAS => 'main',
- FIELD => 'Name',
- ORDER => 'ASC');
+ # By default, order by SortOrder, then Name
+ $self->OrderByCols(
+ {
+ ALIAS => 'main',
+ FIELD => 'SortOrder',
+ ORDER => 'ASC',
+ },
+ {
+ ALIAS => 'main',
+ FIELD => 'Name',
+ ORDER => 'ASC',
+ }
+ );
return ($self->SUPER::_Init(@_));
}
@@ -112,6 +121,13 @@ sub AddRecord {
$self->{'rows'}++;
}
+# no need to order here, it's already ordered in _Init
+sub ItemsOrderBy {
+ my $self = shift;
+ my $items = shift;
+ return $items;
+}
+
RT::Base->_ImportOverlays();
1;
diff --git a/share/html/Admin/Articles/Classes/Objects.html b/share/html/Admin/Articles/Classes/Objects.html
index 8d42ce7..73ef134 100644
--- a/share/html/Admin/Articles/Classes/Objects.html
+++ b/share/html/Admin/Articles/Classes/Objects.html
@@ -64,8 +64,8 @@
<h2><&|/l&>Selected Queues</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'id',
- Order => 'ASC',
+ OrderBy => ['SortOrder','Name'],
+ Order => ['ASC', 'ASC'],
%ARGS,
Collection => $applied,
Rows => 0,
@@ -81,8 +81,8 @@
<h2><&|/l&>Unselected Queues</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'id',
- Order => 'ASC',
+ OrderBy => ['SortOrder','Name'],
+ Order => ['ASC', 'ASC'],
%ARGS,
Collection => $not_applied,
Rows => $rows,
diff --git a/share/html/Admin/CustomFields/Objects.html b/share/html/Admin/CustomFields/Objects.html
index a0516bb..8eeb6b6 100644
--- a/share/html/Admin/CustomFields/Objects.html
+++ b/share/html/Admin/CustomFields/Objects.html
@@ -66,8 +66,8 @@
% unless ( $CF->IsOnlyGlobal ) {
<h2><&|/l&>Selected objects</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'id',
- Order => 'ASC',
+ OrderBy => $class->isa('RT::Queue') ? ['SortOrder', 'Name'] : 'id',
+ Order => $class->isa('RT::Queue') ? ['ASC', 'ASC'] : 'ASC',
%ARGS,
Collection => $added,
Rows => 0,
@@ -83,8 +83,8 @@
<h2><&|/l&>Unselected objects</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'id',
- Order => 'ASC',
+ OrderBy => $class->isa('RT::Queue') ? ['SortOrder', 'Name'] : 'id',
+ Order => $class->isa('RT::Queue') ? ['ASC', 'ASC'] : 'ASC',
%ARGS,
Collection => $not_added,
Rows => $rows,
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index f89a376..c825dad 100644
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -84,6 +84,10 @@
<td colspan="3"><input name="SubjectTag" value="<% $ARGS{'SubjectTag'} || ($Create ? "" : $QueueObj->SubjectTag || '' ) %>" size="60" /></td>
</tr>
+<tr><td align="right"><&|/l&>Sort Order</&>:</td>
+<td colspan="3"><input name="SortOrder" value="<% $Create ? 0 : $QueueObj->SortOrder || $SortOrder || 0 %>" size="60" /></td>
+</tr>
+
<tr><td align="right"><&|/l&>Reply Address</&>:</td>
<td><input name="CorrespondAddress" value="<% $Create ? "" : $QueueObj->CorrespondAddress || $CorrespondAddress || '' %>" />
<br /><span><em><&|/l , RT->Config->Get('CorrespondAddress')&>(If left blank, will default to [_1])</&></em></span></td>
@@ -175,7 +179,7 @@ unless ($Create) {
if ( $QueueObj->Id ) {
$title = loc('Configuration for queue [_1]', $QueueObj->Name );
- my @attribs= qw(Description CorrespondAddress CommentAddress Name
+ my @attribs= qw(Description CorrespondAddress CommentAddress Name SortOrder
Sign SignAuto Encrypt Lifecycle SubjectTag Disabled);
# we're asking about enabled on the web page but really care about disabled
@@ -247,4 +251,5 @@ $CommentAddress => undef
$SetEnabled => undef
$SetCrypt => undef
$Enabled => undef
+$SortOrder => undef
</%ARGS>
diff --git a/share/html/Admin/Queues/index.html b/share/html/Admin/Queues/index.html
index 396ebdf..407ce3c 100644
--- a/share/html/Admin/Queues/index.html
+++ b/share/html/Admin/Queues/index.html
@@ -75,8 +75,8 @@
<em><&|/l&>No queues matching search criteria found.</&></em>
% } else {
<& /Elements/CollectionList,
- OrderBy => 'Name',
- Order => 'ASC',
+ OrderBy => ['SortOrder','Name'],
+ Order => ['ASC','ASC'],
Rows => $Rows,
%ARGS,
Format => $Format,
diff --git a/share/html/Admin/Scrips/Objects.html b/share/html/Admin/Scrips/Objects.html
index 1c3858e..23b1f40 100644
--- a/share/html/Admin/Scrips/Objects.html
+++ b/share/html/Admin/Scrips/Objects.html
@@ -74,8 +74,8 @@
<h2><&|/l&>Selected objects</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'id',
- Order => 'ASC',
+ OrderBy => ['SortOrder','Name'],
+ Order => ['ASC', 'ASC'],
%ARGS,
Collection => $added,
Rows => 0,
@@ -91,8 +91,8 @@
<h2><&|/l&>Unselected objects</&></h2>
<& /Elements/CollectionList,
- OrderBy => 'Name',
- Order => 'ASC',
+ OrderBy => ['SortOrder','Name'],
+ Order => ['ASC', 'ASC'],
%ARGS,
Collection => $not_added,
Rows => $rows,
diff --git a/share/html/Elements/RT__Queue/ColumnMap b/share/html/Elements/RT__Queue/ColumnMap
index 0651b64..682ee93 100644
--- a/share/html/Elements/RT__Queue/ColumnMap
+++ b/share/html/Elements/RT__Queue/ColumnMap
@@ -112,7 +112,7 @@ my $COLUMN_MAP = {
};
foreach my $field (qw(
- Name Description CorrespondAddress CommentAddress
+ Name Description CorrespondAddress CommentAddress SortOrder
)) {
$COLUMN_MAP->{$field} = {
title => $field,
-----------------------------------------------------------------------
More information about the rt-commit
mailing list