diff options
author | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
commit | ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (patch) | |
tree | a2ea500cf510739908761a6bfbd14e990131f2cc /rt/html/REST | |
parent | a513c0bef534d05f03c1242831b6f3be19b97dae (diff) |
import rt 3.6.4
Diffstat (limited to 'rt/html/REST')
-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 | ||||
-rwxr-xr-x | rt/html/REST/1.0/Forms/ticket/comment | 152 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/default | 73 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/history | 27 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/ticket/links | 10 | ||||
-rwxr-xr-x | rt/html/REST/1.0/Forms/ticket/merge | 96 | ||||
-rwxr-xr-x | rt/html/REST/1.0/Forms/ticket/take | 135 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/transaction/default | 143 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/user/default | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/user/ns | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/NoAuth/mail-gateway | 49 | ||||
-rw-r--r-- | rt/html/REST/1.0/autohandler | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/dhandler | 19 | ||||
-rw-r--r-- | rt/html/REST/1.0/logout | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/search/dhandler | 6 | ||||
-rw-r--r-- | rt/html/REST/1.0/search/ticket | 31 | ||||
-rw-r--r-- | rt/html/REST/1.0/ticket/comment | 8 | ||||
-rw-r--r-- | rt/html/REST/1.0/ticket/link | 11 | ||||
-rw-r--r-- | rt/html/REST/1.0/ticket/merge | 6 |
21 files changed, 734 insertions, 85 deletions
diff --git a/rt/html/REST/1.0/Forms/queue/default b/rt/html/REST/1.0/Forms/queue/default index c87c33cce..cfc4b5291 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/Forms/queue/ns b/rt/html/REST/1.0/Forms/queue/ns index b0ba0036a..227318944 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/Forms/ticket/attachments b/rt/html/REST/1.0/Forms/ticket/attachments index ca75ce0d1..4ee409bdc 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -49,7 +51,7 @@ $id $args => undef </%ARGS> -<%perl> +<%INIT> my @data; my ($c, $o, $k, $e) = ("", [], {}, ""); my $ticket = new RT::Ticket $session{CurrentUser}; @@ -80,7 +82,12 @@ if ($aid) { return [ "# Invalid attachment id: $aid", [], {}, 1 ]; } if ($content) { - $c = $attachment->OriginalContent; + $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); + } } else { my @data; push @data, [ id => $attachment->Id ]; @@ -125,4 +132,4 @@ else { } return [ $c, $o, $k, $e ]; -</%perl> +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/comment b/rt/html/REST/1.0/Forms/ticket/comment new file mode 100755 index 000000000..4ed2da8af --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/comment @@ -0,0 +1,152 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# <jesse@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 }}} +%# REST/1.0/Forms/ticket/comment +%# +<%ARGS> +$id +%changes +</%ARGS> +<%INIT> +use MIME::Entity; +use LWP::MediaTypes; +use RT::Interface::REST; +use File::Temp qw(tempfile); + +$RT::Logger->debug("Got ticket id=$id for comment"); +$RT::Logger->debug("Got args @{[keys(%changes)]}."); + +my $ticket = new RT::Ticket $session{CurrentUser}; +my ($c, $o, $k, $e) = ("", [], {}, 0); + +# http://.../REST/1.0/ticket/1/comment +$ticket->Load($id); +if (!$ticket->Id) { + $e = 1; + $c = "# Ticket $id does not exist."; + goto OUTPUT; +} + +my $action; +($action = $changes{Action}) =~ s/^(.)(.*)$/\U$1\L$2\E/; +unless ($action =~ /^(?:Comment|Correspond)$/) { + $e = 1; + $c = "# Invalid action: `$action'."; + goto OUTPUT; +} + +my $text = $changes{Text}; +my @atts = @{ vsplit($changes{Attachment}) }; + +if (!$changes{Text} && @atts == 0) { + $e = 1; + $c = "# Empty comment with no attachments submitted."; + goto OUTPUT; +} + +my $cgi = $m->cgi_object; +my $ent = MIME::Entity->build(Type => "multipart/mixed"); +$ent->attach(Data => $changes{Text}) if $changes{Text}; + +my $i = 1; +foreach my $att (@atts) { + local $/=undef; + my $file = $att; + $file =~ s#^.*[\\/]##; + + my $fh = $cgi->upload("attachment_$i"); + if ($fh) { + my $buf; + my ($w, $tmp) = tempfile(); + my $info = $cgi->uploadInfo(); + + while (sysread($fh, $buf, 8192)) { + syswrite($w, $buf); + } + + $ent->attach( + Path => $tmp, + Type => $info->{'Content-Type'} || guess_media_type($tmp), + Filename => $file, + Disposition => "attachment" + ); + } + else { + $e = 1; + $c = "# No attachment for $att."; + goto OUTPUT; + } + + $i++; +} + +unless ($ticket->CurrentUserHasRight('ModifyTicket') || + ($action eq "Comment" && + $ticket->CurrentUserHasRight("CommentOnTicket")) || + ($action eq "Correspond" && + $ticket->CurrentUserHasRight("ReplyToTicket"))) +{ + $e = 1; + $c = "# You are not allowed to $action on ticket $id."; + goto OUTPUT; +} + +my $cc = join ", ", @{ vsplit($changes{Cc}) }; +my $bcc = join ", ", @{ vsplit($changes{Bcc}) }; +my ($n, $s) = $ticket->$action(MIMEObj => $ent, + CcMessageTo => $cc, + BccMessageTo => $bcc, + TimeTaken => $changes{TimeWorked} || 0); +$c = "# ".$s; +if ($changes{Status}) { + my ($status_n, $status_s) = $ticket->SetStatus($changes{'Status'} ); + $c .= "\n# ".$status_s; +} + +OUTPUT: +return [ $c, $o, $k, $e ]; +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/default b/rt/html/REST/1.0/Forms/ticket/default index 78f6c9562..69e385f57 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -49,15 +51,16 @@ $id $changes => {} $fields => undef +$args => undef </%ARGS> -<%perl> +<%INIT> use MIME::Entity; my @comments; my ($c, $o, $k, $e) = ("", [], {}, 0); my %data = %$changes; my $ticket = new RT::Ticket $session{CurrentUser}; -my @dates = qw(Created Starts Started Due Resolved Told); +my @dates = qw(Created Starts Started Due Resolved Told LastUpdated); my @people = qw(Requestors Cc AdminCc); my @create = qw(Queue Requestor Subject Cc AdminCc Owner Status Priority InitialPriority FinalPriority TimeEstimated TimeWorked @@ -83,7 +86,7 @@ if ($id ne 'new') { } } else { - if (%data == 0) { + if (!keys(%data)) { # 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}; @@ -95,7 +98,7 @@ else { $starts->SetToNow; return [ - "# Required: Queue, Requestor, Subject", + "# Required: id, Queue", [ qw(id Queue Requestor Subject Cc AdminCc Owner Status Priority InitialPriority FinalPriority TimeEstimated Starts Due Text) ], { @@ -127,11 +130,26 @@ 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( @@ -141,20 +159,23 @@ else { ); } - $ticket->Create(%v); - unless ($ticket->Id) { - return [ "# Could not create ticket.", [], {}, 1 ]; + my($tid,$trid,$terr) = $ticket->Create(%v); + unless ($tid) { + push(@comments, "# Could not create ticket."); + push(@comments, "# " . $terr); + goto DONE; } delete $data{id}; $id = $ticket->Id; push(@comments, "# Ticket $id created."); - goto DONE if %data == 0; + # see if the hash is empty + goto DONE if ! keys(%data); } } # Now we know we're dealing with an existing ticket. -if (%data == 0) { +if (!keys(%data)) { my ($time, $key, $val, @data); push @data, [ id => "ticket/".$ticket->Id ]; @@ -171,7 +192,7 @@ if (%data == 0) { } foreach $key (@people) { - next unless (!%$fields || (exists $fields->{lc $key})); + next unless (!%$fields || (exists $fields->{lc $key})); push @data, [ $key => [ $ticket->$key->MemberEmailAddresses ] ]; } @@ -190,6 +211,18 @@ if (%data == 0) { 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; @@ -271,6 +304,20 @@ 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."; @@ -295,4 +342,4 @@ DONE: $c ||= join("\n", @comments) if @comments; return [$c, $o, $k, $e]; -</%perl> +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/history b/rt/html/REST/1.0/Forms/ticket/history index 4663e97ee..5dd7417d0 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -51,7 +53,7 @@ $args => undef $format => undef $fields => undef </%ARGS> -<%perl> +<%INIT> my $ticket = new RT::Ticket $session{CurrentUser}; my ($c, $o, $k, $e) = ("", [], {}, ""); @@ -94,7 +96,19 @@ if ($type) { if ($tid) { my @data; my $t = new RT::Transaction $session{CurrentUser}; - $t->Load($tid); + + # 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 ]; + } push @data, [ id => $t->Id ]; push @data, [ Ticket => $t->Ticket ] @@ -168,8 +182,7 @@ if ($tid) { $fieldstring .= $key; } my ($content, $forms); - - $m->subexec("$RT::WebPath/REST/1.0/show", + $m->subexec("/REST/1.0/show", id => \@tid, format => $format, fields => $fieldstring); @@ -184,4 +197,4 @@ if (!$c) { return [ $c, $o, $k, $e ]; -</%perl> +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/links b/rt/html/REST/1.0/Forms/ticket/links index 9f14da4e3..6b2ed222d 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -50,7 +52,7 @@ $id $format => 's' $changes => undef </%ARGS> -<%perl> +<%INIT> my @data; my $ticket = new RT::Ticket $session{CurrentUser}; @@ -167,4 +169,4 @@ else { } return [ $c, $o, $k, $e ]; -</%perl> +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/merge b/rt/html/REST/1.0/Forms/ticket/merge new file mode 100755 index 000000000..69af6c8e1 --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/merge @@ -0,0 +1,96 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# <jesse@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 }}} +%# REST/1.0/Forms/ticket/merge +%# +<%ARGS> +$id +$args +</%ARGS> +<%INIT> +use RT::Interface::REST; + +my $into = $args; + +my $ticket = new RT::Ticket $session{CurrentUser}; +my $ticket_into = new RT::Ticket $session{CurrentUser}; +my ($c, $o, $k, $e) = ("", [], {}, 0); + +# http://.../REST/1.0/ticket/1/merge/6 (merges ticket 1 into ticket 6) + +$ticket->Load($id); +if (!$ticket->Id) { + $e = 1; + $c = "# Ticket $id does not exist."; + goto OUTPUT; +} +$ticket_into->Load($into); +if (!$ticket_into->Id) { + $e = 1; + $c = "# Ticket $into does not exist."; + goto OUTPUT; +} + +if (!$ticket->CurrentUserHasRight('ModifyTicket')) { + $e = 1; + $c = "# You are not allowed to modify ticket $id."; + goto OUTPUT; +} + +my ($n, $s) = $ticket->MergeInto($into); + +if ($n == 0) { + $e = 1; + $c = "# Could not complete the merge."; +} +else { + $c = "# Merge completed."; +} + +OUTPUT: +return [ $c, $o, $k, $e ]; +</%INIT> diff --git a/rt/html/REST/1.0/Forms/ticket/take b/rt/html/REST/1.0/Forms/ticket/take new file mode 100755 index 000000000..35ee11fa7 --- /dev/null +++ b/rt/html/REST/1.0/Forms/ticket/take @@ -0,0 +1,135 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# <jesse@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 }}} +%# REST/1.0/Forms/ticket/take +%# +<%ARGS> +$id +%changes +</%ARGS> +<%INIT> +use RT::Interface::REST; + +my $ticket = new RT::Ticket $session{CurrentUser}; +my ($c, $o, $k, $e) = ("", [], {}, 0); + +# http://.../REST/1.0/ticket/1/take +$ticket->Load( $id ); +unless ( $ticket->Id ) { + $e = 1; + $c = "# Ticket $id does not exist."; + goto OUTPUT; +} + +my $action; + +my @comments; + +($action = $changes{Action}) =~ s/^(.)(.*)$/\U$1\L$2\E/; +unless ($action =~ /^(?:Take|Steal|Untake)$/) { + $e = 1; + $c = "# Invalid action: `$action'."; + goto OUTPUT; +} + +my ($status, $msg) = $ticket->$action(); +$c = "# $msg"; +$e = 1 unless $status; +goto OUTPUT; + +#unless ($ticket->CurrentUserHasRight('ModifyTicket') || +# ( ($action eq "Take" || $action eq 'Untake') && +# $ticket->CurrentUserHasRight("TakeTicket")) || +# ($action eq "Steal" && +# $ticket->CurrentUserHasRight("StealTicket"))) +#{ +# $e = 1; +# $c = "# You are not allowed to $action ticket $id."; +# goto OUTPUT; +#} + +#if ( keys %changes ) { +#} +#else { +# # process the form data structure +# my ($key, $val); +# +# foreach $key (keys %data) { +# $val = $data{$key}; +# +# if ($key =~ /^force$/i) { +# if ($val !~ /^(?:0|1)$/) { +# push(@comments, "# invalid value for 'force': $val"); +# goto DONE; +# } +# my ($ret_id, $msg); +# +# ### take +# if ($val == 0) { +# ($ret_id, $msg) = $ticket->Take; +# if (!$ret_id) { +# push(@comments, "# Couldn't take ticket $id: $msg"); +# goto DONE; +# } +# push(@comments, "# Ticket $id taken."); +# } +# ### steal +# else { +# ($ret_id, $msg) = $ticket->Steal; +# if (!$ret_id) { +# push(@comments, "# Couldn't steal ticket $id: $msg"); +# goto DONE; +# } +# push(@comments, "# Ticket $id stolen."); +# } +# } +# } +#} + +OUTPUT: +return [ $c, $o, $k, $e ]; +</%INIT> diff --git a/rt/html/REST/1.0/Forms/transaction/default b/rt/html/REST/1.0/Forms/transaction/default new file mode 100644 index 000000000..e23098a66 --- /dev/null +++ b/rt/html/REST/1.0/Forms/transaction/default @@ -0,0 +1,143 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# <jesse@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 }}} +%# REST/1.0/Forms/transaction +%# +<%ARGS> +$id +$args => undef +$format => undef +$fields => undef +</%ARGS> +<%INIT> +my $trans = new RT::Transactions $session{CurrentUser}; +my ($c, $o, $k, $e) = ("", [], {} , ""); + +chomp $args; +my @arglist = split('/', $args); +my $tid = $id; + +$trans->Limit(FIELD => 'Id', OPERATOR => '=', VALUE => $tid); + +if ($tid) { + my @data; + my $t = new RT::Transaction $session{CurrentUser}; + $t->Load($tid); + if ($format eq "l") { + push @data, [ id => $t->Id ]; + push @data, [ Ticket => $t->Ticket ] + if (!%$fields || exists $fields->{lc 'Ticket'}); + push @data, [ TimeTaken => $t->TimeTaken ] + if (!%$fields || exists $fields->{lc 'TimeTaken'}); + push @data, [ Type => $t->Type ] + if (!%$fields || exists $fields->{lc 'Type'}); + push @data, [ Field => $t->Field ] + if (!%$fields || exists $fields->{lc 'Field'}); + push @data, [ OldValue => $t->OldValue ] + if (!%$fields || exists $fields->{lc 'OldValue'}); + push @data, [ NewValue => $t->NewValue ] + if (!%$fields || exists $fields->{lc 'NewValue'}); + push @data, [ Data => $t->Data ] + if (!%$fields || exists $fields->{lc 'Data'}); + push @data, [ Description => $t->Description ] + if (!%$fields || exists $fields->{lc 'Description'}); + push @data, [ Content => $t->Content ] + if (!%$fields || exists $fields->{lc 'Content'}); + + if (!%$fields || exists $fields->{lc 'Content'}) { + my $creator = new RT::User $session{CurrentUser}; + $creator->Load($t->Creator); + push @data, [ Creator => $creator->Name ]; + } + push @data, [ Created => $t->Created ] + if (!%$fields || exists $fields->{lc 'Created'}); + + if (!%$fields || exists $fields->{lc 'Attachments'}) { + my $attachlist; + my $attachments = $t->Attachments; + while (my $a = $attachments->Next) { + my $size = length($a->Content); + if ($size > 1024) { + $size = int($size/102.4)/10 . "k"; + } + else { + $size .= "b"; + } + $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")"; + } + push @data, [Attachments => $attachlist]; + } + + } else { + push @data, [ id => $t->Id ]; + push @data, [ Description => $t->Description ]; + } + + my %k = map {@$_} @data; + $o = [ map {$_->[0]} @data ]; + $k = \%k; +} +#else { +# my (@data, $tids); +# $format ||= "s"; +# $format = "l" if (%$fields); +# +# while (my $t = $trans->Next) { +# my $tid = $t->Id; +# if ($format eq "l") { +# $tids .= "," if $tids; +# $tids .= $tid; +# } else { +# push @$o, $tid; +# $k->{$tid} = $t->Description; +# } +# } +#} + +return [ $c, $o, $k, $e ]; + +</%INIT> diff --git a/rt/html/REST/1.0/Forms/user/default b/rt/html/REST/1.0/Forms/user/default index ad2ebd57a..621e96dfa 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/Forms/user/ns b/rt/html/REST/1.0/Forms/user/ns index 406156304..3503d8ace 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-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/NoAuth/mail-gateway b/rt/html/REST/1.0/NoAuth/mail-gateway index 5252c1968..739dace9d 100644 --- a/rt/html/REST/1.0/NoAuth/mail-gateway +++ b/rt/html/REST/1.0/NoAuth/mail-gateway @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -52,26 +54,31 @@ $action => "correspond" $ticket => undef </%ARGS> <%init> -use RT::Interface::Email; +$m->comp('/Elements/Callback', _CallbackName => 'Pre', %ARGS); +use RT::Interface::Email (); # It's an exporter, but we don't care $r->content_type('text/plain; charset=utf-8'); $m->error_format('text'); -my ( $status, $error, $Ticket ) = RT::Interface::Email::Gateway(\%ARGS); - if ($status == -75 ) { -$m->out("temporary failure - ". $error); - } - elsif ($status == 1) { -$m->out('ok'); - if ( $Ticket->Id ) { -$m->out('Ticket: '. $Ticket->Id); -$m->out('Queue: '. $Ticket->QueueObj->Name ); -$m->out('Owner: '. $Ticket->OwnerObj->Name); -$m->out('Status: '. $Ticket->Status ); -$m->out('Subject: '. $Ticket->Subject ); -$m->out('Requestor: '. $Ticket->Requestors->MemberEmailAddressesAsString ); - } - } else { -$m->out('not ok - '.$error); - } - +my ( $status, $error, $Ticket ) = RT::Interface::Email::Gateway( \%ARGS ); +if ( $status == 1 ) { + $m->out('ok'); + if ( $Ticket->Id ) { + $m->out( 'Ticket: ' . ($Ticket->Id || '') ); + $m->out( 'Queue: ' . ($Ticket->QueueObj->Name || '') ); + $m->out( 'Owner: ' . ($Ticket->OwnerObj->Name || '') ); + $m->out( 'Status: ' . ($Ticket->Status || '') ); + $m->out( 'Subject: ' . ($Ticket->Subject || '') ); + $m->out( + 'Requestor: ' . ($Ticket->Requestors->MemberEmailAddressesAsString || '') ); + } +} +else { + $RT::Logger->error( "Could not record email: " . $error ); + if ( $status == -75 ) { + $m->out( "temporary failure - " . $error ); + } + else { + $m->out( 'not ok - ' . $error ); + } +} $m->abort(); </%init> diff --git a/rt/html/REST/1.0/autohandler b/rt/html/REST/1.0/autohandler index 8e3fb164d..e8247b18e 100644 --- a/rt/html/REST/1.0/autohandler +++ b/rt/html/REST/1.0/autohandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/dhandler b/rt/html/REST/1.0/dhandler index 6cf45b000..52d6973f1 100644 --- a/rt/html/REST/1.0/dhandler +++ b/rt/html/REST/1.0/dhandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -72,6 +74,7 @@ my $labels = "(?:$label,)*$label"; # http://.../REST/1.0/ticket/edit # 4. http://.../REST/1.0/ticket/nn (all possibly with a single form). # http://.../REST/1.0/ticket/nn/history +# http://.../REST/1.0/ticket/nn/comment # http://.../REST/1.0/ticket/nn/attachment/1 # # Objects are specified by their type, and either a unique numeric ID, @@ -290,7 +293,12 @@ foreach $object (@objects) { # We won't pass $e through to compose, trusting instead that the # handler added suitable comments for the user. if ($e) { - $status = "409 Syntax Error" if @$o; + if (@$o) { + $status = "409 Syntax Error"; + } + else { + $status = "400 Bad Request"; + } push @output, [ $c, $o, $k ]; } else { @@ -303,7 +311,6 @@ unshift(@output, [ join "\n", @comments ]) if @comments; $output = form_compose(\@output); OUTPUT: +$m->out("RT/".$RT::VERSION ." ".$status ."\n\n$output\n") if ($output || $status != 200); +return; </%INIT> -RT/<% $RT::VERSION %> <% $status %> - -<% $output |n %> diff --git a/rt/html/REST/1.0/logout b/rt/html/REST/1.0/logout index 470cb0915..4152a7ee0 100644 --- a/rt/html/REST/1.0/logout +++ b/rt/html/REST/1.0/logout @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/search/dhandler b/rt/html/REST/1.0/search/dhandler index 1915a4644..3e6b314b7 100644 --- a/rt/html/REST/1.0/search/dhandler +++ b/rt/html/REST/1.0/search/dhandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: diff --git a/rt/html/REST/1.0/search/ticket b/rt/html/REST/1.0/search/ticket index d0ab59e98..8f4604d56 100644 --- a/rt/html/REST/1.0/search/ticket +++ b/rt/html/REST/1.0/search/ticket @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -60,7 +62,7 @@ my $tickets = new RT::Tickets $session{CurrentUser}; my $field = '[a-zA-Z][a-zA-Z0-9_-]*'; my (%fields, @fields); if ($fields) { - $format = "l"; + $format ||= "l"; unless ($fields =~ /^(?:$field,)*$field$/) { $status = "400 Bad Request"; $output = "Invalid field specification: $fields"; @@ -115,15 +117,29 @@ my @output; while (my $ticket = $tickets->Next) { $n++; + my $id = $ticket->Id; if ($format eq "i") { - $output .= "ticket/" . $ticket->Id . "\n"; + $output .= "ticket/" . $id . "\n"; } elsif ($format eq "s") { - $output .= $ticket->Id . ": ". $ticket->Subject . "\n"; + if ($fields) { + my $result = $m->comp("/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields); + my ($notes, $order, $key_values, $errors) = @$result; + # If it's the first time through, add our header + if ($n == 1) { + $output .= join("\t",@$order)."\n"; + } + # Cut off the annoying ticket/ before the id; + $key_values->{'id'} = $id; + $output .= join("\t", map {$key_values->{$_}} @$order)."\n"; + + + } else { + $output .= $ticket->Id . ": ". $ticket->Subject . "\n"; + } } else { - my $id = $ticket->Id; - my $d = $m->comp("$RT::WebPath/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields); + my $d = $m->comp("/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields); my ($c, $o, $k, $e) = @$d; push @output, [ $c, $o, $k ]; } @@ -138,4 +154,5 @@ OUTPUT: $m->out("RT/". $RT::VERSION . " " . $status ."\n\n"); $m->out($output ); +return(); </%INIT> diff --git a/rt/html/REST/1.0/ticket/comment b/rt/html/REST/1.0/ticket/comment index e27bfcc1e..240dd90fb 100644 --- a/rt/html/REST/1.0/ticket/comment +++ b/rt/html/REST/1.0/ticket/comment @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -60,7 +62,7 @@ my $status = "200 Ok"; my $output; my $action; -# http://.../REST/1.0/ticket/comment/1 +# http://.../REST/1.0/ticket/1/comment my ($c, $o, $k, $e) = @{ form_parse($content)->[0] }; if ($e || !$o) { if (!$o) { diff --git a/rt/html/REST/1.0/ticket/link b/rt/html/REST/1.0/ticket/link index 6556a5ef7..766e12624 100644 --- a/rt/html/REST/1.0/ticket/link +++ b/rt/html/REST/1.0/ticket/link @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: @@ -72,7 +74,7 @@ my %lfields = ( # http://.../REST/1.0/ticket/link/1 -$object =~ s#^/##; +$object =~ s#^/REST/1.0/ticket/link##; if ($id && $object && $id != $object) { $output = "Different ids in URL (`$object') and submitted form (`$id').\n"; $status = "400 Bad Request"; @@ -109,6 +111,9 @@ my $op = $del ? "DeleteLink" : "AddLink"; ($n, $output) = $ticket->$op(Type => $type, $mode => $to); if ($n == 0) { $status = "500 Error"; +} else { + my $action = $del ? "Deleted" : "Created"; + $output .= " $action link " . $ticket->Id . " $rel $to"; } OUTPUT: diff --git a/rt/html/REST/1.0/ticket/merge b/rt/html/REST/1.0/ticket/merge index 3db52111b..d6ae96f83 100644 --- a/rt/html/REST/1.0/ticket/merge +++ b/rt/html/REST/1.0/ticket/merge @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# 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: |