diff options
Diffstat (limited to 'rt/html/REST/1.0/Forms')
-rw-r--r-- | rt/html/REST/1.0/Forms/queue/default | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/queue/ns | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/attachments | 17 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/default | 69 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/history | 27 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/links | 10 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/user/default | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/user/ns | 6 |
8 files changed, 35 insertions, 112 deletions
diff --git a/rt/html/REST/1.0/Forms/queue/default b/rt/html/REST/1.0/Forms/queue/default index cfc4b5291..c87c33cce 100644 --- a/rt/html/REST/1.0/Forms/queue/default +++ b/rt/html/REST/1.0/Forms/queue/default @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/REST/1.0/Forms/queue/ns b/rt/html/REST/1.0/Forms/queue/ns index 227318944..b0ba0036a 100644 --- a/rt/html/REST/1.0/Forms/queue/ns +++ b/rt/html/REST/1.0/Forms/queue/ns @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/REST/1.0/Forms/ticket/attachments b/rt/html/REST/1.0/Forms/ticket/attachments index 4ee409bdc..ca75ce0d1 100644 --- a/rt/html/REST/1.0/Forms/ticket/attachments +++ b/rt/html/REST/1.0/Forms/ticket/attachments @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -51,7 +49,7 @@ $id $args => undef </%ARGS> -<%INIT> +<%perl> my @data; my ($c, $o, $k, $e) = ("", [], {}, ""); my $ticket = new RT::Ticket $session{CurrentUser}; @@ -82,12 +80,7 @@ if ($aid) { return [ "# Invalid attachment id: $aid", [], {}, 1 ]; } if ($content) { - $c = $attachment->OriginalContent; - # if we're sending a binary attachment (and only the attachment) - # flag it so bin/rt knows to special case it - if ($attachment->ContentType !~ /^text\//) { - $r->content_type($attachment->ContentType); - } + $c = $attachment->OriginalContent; } else { my @data; push @data, [ id => $attachment->Id ]; @@ -132,4 +125,4 @@ else { } return [ $c, $o, $k, $e ]; -</%INIT> +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/default b/rt/html/REST/1.0/Forms/ticket/default index 69e385f57..7d515e51f 100644 --- a/rt/html/REST/1.0/Forms/ticket/default +++ b/rt/html/REST/1.0/Forms/ticket/default @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -51,9 +49,8 @@ $id $changes => {} $fields => undef -$args => undef </%ARGS> -<%INIT> +<%perl> use MIME::Entity; my @comments; @@ -86,7 +83,7 @@ if ($id ne 'new') { } } else { - if (!keys(%data)) { + if (%data == 0) { # GET ticket/new: Return a suitable default form. # We get defaults from queue/1 (XXX: What if it isn't there?). my $due = new RT::Date $session{CurrentUser}; @@ -130,26 +127,11 @@ else { if (exists $create{lc $k}) { $v{$create{lc $k}} = delete $data{$k}; } - # Set custom field - elsif ($k =~ /^CF-/i) { - my $cf = RT::CustomField->new( $RT::SystemUser ); - my $cfk = $k; - $cfk =~ s/^CF-//i; - unless($cf->LoadByName( Name => $cfk )) { - push @comments, "# Invalid custom field name ($cfk)"; - delete $data{$k}; - next; - } - $v{"CustomField-".$cf->Id()} = delete $data{$k}; - } elsif (lc $k eq 'text') { $text = delete $data{$k}; } } - # people fields allow multiple values - $v{$_} = vsplit($v{$_}) foreach ( grep $create{lc $_}, @people ); - if ($text) { $v{MIMEObj} = MIME::Entity->build( @@ -159,23 +141,20 @@ else { ); } - my($tid,$trid,$terr) = $ticket->Create(%v); - unless ($tid) { - push(@comments, "# Could not create ticket."); - push(@comments, "# " . $terr); - goto DONE; + $ticket->Create(%v); + unless ($ticket->Id) { + return [ "# Could not create ticket.", [], {}, 1 ]; } delete $data{id}; $id = $ticket->Id; push(@comments, "# Ticket $id created."); - # see if the hash is empty - goto DONE if ! keys(%data); + goto DONE if %data == 0; } } # Now we know we're dealing with an existing ticket. -if (!keys(%data)) { +if (%data == 0) { my ($time, $key, $val, @data); push @data, [ id => "ticket/".$ticket->Id ]; @@ -192,7 +171,7 @@ if (!keys(%data)) { } foreach $key (@people) { - next unless (!%$fields || (exists $fields->{lc $key})); + next unless (!%$fields || (exists $fields->{lc $key})); push @data, [ $key => [ $ticket->$key->MemberEmailAddresses ] ]; } @@ -211,18 +190,6 @@ if (!keys(%data)) { push @data, [ $key => $val ]; } - # Display custom fields - my $CustomFields = $ticket->QueueObj->TicketCustomFields(); - while (my $cf = $CustomFields->Next()) { - next unless (!%$fields || (exists $fields->{"cf-".lc $cf->Name})); - my $vals = $ticket->CustomFieldValues($cf->Id()); - my @out = (); - while (my $v = $vals->Next()) { - push @out, $v->Content; - } - push @data, [ 'CF-' . $cf->Name => join ',', @out ]; - } - my %k = map {@$_} @data; $o = [ map {$_->[0]} @data ]; $k = \%k; @@ -304,20 +271,6 @@ else { $s =~ s/^# //; } } - # Set custom field - elsif ($key =~ /^CF-/i) { - my $cf = RT::CustomField->new( $RT::SystemUser ); - $key =~ s/^CF-//i; - if (not $cf->LoadByName( Name => $key )) { - $n = 0; - $s = "Unknown custom field."; - } - else { - ($n, $s) = $ticket->AddCustomFieldValue( - Field => $cf, Value => $val ); - $s =~ s/^# // if defined $s; - } - } elsif ($key ne 'id' && $key ne 'type' && $key ne 'creator') { $n = 0; $s = "Unknown field."; @@ -342,4 +295,4 @@ DONE: $c ||= join("\n", @comments) if @comments; return [$c, $o, $k, $e]; -</%INIT> +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/history b/rt/html/REST/1.0/Forms/ticket/history index 5dd7417d0..4663e97ee 100644 --- a/rt/html/REST/1.0/Forms/ticket/history +++ b/rt/html/REST/1.0/Forms/ticket/history @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -53,7 +51,7 @@ $args => undef $format => undef $fields => undef </%ARGS> -<%INIT> +<%perl> my $ticket = new RT::Ticket $session{CurrentUser}; my ($c, $o, $k, $e) = ("", [], {}, ""); @@ -96,19 +94,7 @@ if ($type) { if ($tid) { my @data; my $t = new RT::Transaction $session{CurrentUser}; - - # this paragraph limits the transaction ID query to transactions on this ticket. - # Otherwise you can query any transaction from any ticket, which makes no sense. - my $Transactions = $ticket->Transactions; - my $tok=0; - while (my $T = $Transactions->Next()) { - $tok=1 if ($T->Id == $tid) - } - if ($tok) { - $t->Load($tid); - } else { - return [ "# Transaction $tid is not related to Ticket $id", [], {}, 1 ]; - } + $t->Load($tid); push @data, [ id => $t->Id ]; push @data, [ Ticket => $t->Ticket ] @@ -182,7 +168,8 @@ if ($tid) { $fieldstring .= $key; } my ($content, $forms); - $m->subexec("/REST/1.0/show", + + $m->subexec("$RT::WebPath/REST/1.0/show", id => \@tid, format => $format, fields => $fieldstring); @@ -197,4 +184,4 @@ if (!$c) { return [ $c, $o, $k, $e ]; -</%INIT> +</%perl> diff --git a/rt/html/REST/1.0/Forms/ticket/links b/rt/html/REST/1.0/Forms/ticket/links index 6b2ed222d..9f14da4e3 100644 --- a/rt/html/REST/1.0/Forms/ticket/links +++ b/rt/html/REST/1.0/Forms/ticket/links @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -52,7 +50,7 @@ $id $format => 's' $changes => undef </%ARGS> -<%INIT> +<%perl> my @data; my $ticket = new RT::Ticket $session{CurrentUser}; @@ -169,4 +167,4 @@ else { } return [ $c, $o, $k, $e ]; -</%INIT> +</%perl> diff --git a/rt/html/REST/1.0/Forms/user/default b/rt/html/REST/1.0/Forms/user/default index 621e96dfa..ad2ebd57a 100644 --- a/rt/html/REST/1.0/Forms/user/default +++ b/rt/html/REST/1.0/Forms/user/default @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/REST/1.0/Forms/user/ns b/rt/html/REST/1.0/Forms/user/ns index 3503d8ace..406156304 100644 --- a/rt/html/REST/1.0/Forms/user/ns +++ b/rt/html/REST/1.0/Forms/user/ns @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# 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. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: |