[Rt-commit] r19369 - in rt/3.999/trunk: lib/RT/Model lib/RT/View/Admin share/html/Admin/Elements

clkao at bestpractical.com clkao at bestpractical.com
Wed Apr 29 09:13:26 EDT 2009


Author: clkao
Date: Wed Apr 29 09:13:25 2009
New Revision: 19369

Added:
   rt/3.999/trunk/lib/RT/View/Admin/Rules.pm
   rt/3.999/trunk/share/html/Admin/Elements/RuleTabs
Modified:
   rt/3.999/trunk/lib/RT/Model/Rule.pm
   rt/3.999/trunk/lib/RT/View/Admin.pm
   rt/3.999/trunk/share/html/Admin/Elements/Tabs

Log:
add admin/rules crud page.

Modified: rt/3.999/trunk/lib/RT/Model/Rule.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/Rule.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/Rule.pm	Wed Apr 29 09:13:25 2009
@@ -65,9 +65,9 @@
 sub table {'Rules'}
 use Jifty::DBI::Schema;
 use Jifty::DBI::Record schema {
-    column action_code    => type is 'text';
-    column condition_code => type is 'text';
-    column prepare_code   => type is 'text';
+    column action_code    => type is 'text', render as 'textarea';
+    column condition_code => type is 'text', render as 'textarea';
+    column prepare_code   => type is 'text', render as 'textarea';
     column description               => type is 'text';
 };
 use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata map => {

Modified: rt/3.999/trunk/lib/RT/View/Admin.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/View/Admin.pm	(original)
+++ rt/3.999/trunk/lib/RT/View/Admin.pm	Wed Apr 29 09:13:25 2009
@@ -63,5 +63,8 @@
 require RT::View::Admin::CustomFields;
 alias RT::View::Admin::CustomFields under 'custom_fields/';
 
+require RT::View::Admin::Rules;
+alias RT::View::Admin::Rules under 'rules/';
+
 1;
 

Added: rt/3.999/trunk/lib/RT/View/Admin/Rules.pm
==============================================================================
--- (empty file)
+++ rt/3.999/trunk/lib/RT/View/Admin/Rules.pm	Wed Apr 29 09:13:25 2009
@@ -0,0 +1,90 @@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+#                                          <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/copyleft/gpl.html.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
+use warnings;
+use strict;
+
+package RT::View::Admin::Rules;
+use Jifty::View::Declare -base;
+use base 'RT::View::CRUD';
+
+use constant page_title     => 'Rule Management';
+use constant object_type    => 'Rule';
+use constant tab_url        => '/Admin/Elements/RuleTabs';
+use constant current_tab    => 'admin/rules/'; # this is not working
+
+use constant display_columns => qw(id description condition_code prepare_code action_code);
+
+sub _current_collection {
+    my $self = shift;
+    my $c    = $self->SUPER::_current_collection();
+    $c->unlimit;
+#    $c->limit_to_user_defined_groups();
+    return $c;
+}
+
+=head2 view_field_name
+
+Display each group's name as a hyperlink to the modify page
+
+=cut
+
+sub view_field_name {
+    my $self = shift;
+    my %args = @_;
+
+    $self->view_via_callback(%args, callback => sub {
+        my %args = @_;
+        hyperlink(
+            label => $args{current_value},
+            url   => "/Admin/Rules/Modify.html?id=$args{id}",
+        );
+    });
+}
+
+1;
+

Added: rt/3.999/trunk/share/html/Admin/Elements/RuleTabs
==============================================================================
--- (empty file)
+++ rt/3.999/trunk/share/html/Admin/Elements/RuleTabs	Wed Apr 29 09:13:25 2009
@@ -0,0 +1,81 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%# 
+%# COPYRIGHT:
+%# 
+%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC
+%#                                          <jesse at bestpractical.com>
+%# 
+%# (Except where explicitly superseded by other copyright notices)
+%# 
+%# 
+%# LICENSE:
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%# 
+%# 
+%# CONTRIBUTION SUBMISSION POLICY:
+%# 
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%# 
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%# 
+%# END BPS TAGGED BLOCK }}}
+<& /Admin/Elements/Tabs,
+    title          => $title,
+    current_tab    => 'Admin/Rules/',
+    subtabs        => $tabs,
+    current_subtab => $current_tab,
+&>
+
+<%INIT>
+    my $tabs = {
+        A => { title => _('Select'),
+               path  => "Admin/Rules/", },
+        E => { title => _('Create'),
+               path  => 'Admin/Rules/Modify.html?create=1',
+        },
+    };
+
+    # Now let callbacks add their extra tabs
+    $m->callback( %ARGS, tabs => $tabs );
+
+    foreach my $tab ( values %{$tabs} ) {
+        next unless $tab->{'path'} eq $current_tab;
+
+        $tab->{"subtabs"} = $subtabs;
+        $tab->{"current_subtab"} = $current_subtab;
+    }
+</%INIT>
+
+<%ARGS>
+$id => undef
+$current_tab => undef
+$subtabs => undef
+$current_subtab => undef
+$title => undef
+</%ARGS>

Modified: rt/3.999/trunk/share/html/Admin/Elements/Tabs
==============================================================================
--- rt/3.999/trunk/share/html/Admin/Elements/Tabs	(original)
+++ rt/3.999/trunk/share/html/Admin/Elements/Tabs	Wed Apr 29 09:13:25 2009
@@ -64,10 +64,13 @@
 	       D => { 'title' => _('Custom Fields'),
 			   path => 'Admin/CustomFields/',
 			 },
-	       E => { 'title' => _('Global'),
+	       E => { 'title' => _('Rules'),
+			   path => 'admin/rules/',
+			 },
+	       F => { 'title' => _('Global'),
 			   path => 'Admin/Global/',
 			 },
-	       F => { 'title' => _('Tools'),
+	       G => { 'title' => _('Tools'),
 			   path => 'Admin/Tools/',
 			 },
 	     };


More information about the Rt-commit mailing list