[Rt-commit] rt branch, admin_ui, updated. ac7129f851bc5bdf6fdbf81ec05d4352e3876ec4

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jan 4 03:01:26 EST 2010


The branch, admin_ui has been updated
       via  ac7129f851bc5bdf6fdbf81ec05d4352e3876ec4 (commit)
      from  07b912eb90b37bded9ccf28a348576e035fb30f4 (commit)

Summary of changes:
 lib/RT/Action/CreateCustomField.pm |   44 ++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 lib/RT/Action/CreateCustomField.pm

- Log -----------------------------------------------------------------
commit ac7129f851bc5bdf6fdbf81ec05d4352e3876ec4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jan 4 16:01:04 2010 +0800

    CreateCustomField action

diff --git a/lib/RT/Action/CreateCustomField.pm b/lib/RT/Action/CreateCustomField.pm
new file mode 100644
index 0000000..a818e2d
--- /dev/null
+++ b/lib/RT/Action/CreateCustomField.pm
@@ -0,0 +1,44 @@
+package RT::Action::CreateCustomField;
+use strict;
+use warnings;
+
+use base qw/Jifty::Action::Record::Create/;
+
+sub record_class { 'RT::Model::CustomField' }
+
+use constant report_detailed_messages => 1;
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+    param 'link_value_to' => hints is _(
+q{RT can make this custom field's values into hyperlinks to another service.
+Fill in this field with a URL.
+RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record
+id and custom field value, respectively}
+    );
+    param 'include_content_for_value' => hints is _(
+q{RT can include content from another web service when showing this custom field.
+Fill in this field with a URL.
+RT will replace <tt>__id__</tt> and <tt>__CustomField__</tt> with the record id and custom field value, respectively
+Some browsers may only load content from the same domain as your RT server.}
+    );
+};
+
+sub take_action {
+    my $self = shift;
+    $self->SUPER::take_action;
+
+    my @attrs = qw/link_value_to include_content_for_value/;
+
+    for my $attr (@attrs) {
+        if ( $self->has_argument($attr) ) {
+            my $method = "set_$attr";
+            my ( $status, $msg ) =
+              $self->record->$method( $self->argument_value($attr) );
+            Jifty->log->error($msg) unless $status;
+        }
+    }
+    return 1;
+}
+
+1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list