summaryrefslogtreecommitdiff
path: root/rt/html/REST/1.0/Forms
diff options
context:
space:
mode:
Diffstat (limited to 'rt/html/REST/1.0/Forms')
-rwxr-xr-xrt/html/REST/1.0/Forms/ticket/comment152
-rwxr-xr-xrt/html/REST/1.0/Forms/ticket/merge96
-rwxr-xr-xrt/html/REST/1.0/Forms/ticket/take135
-rw-r--r--rt/html/REST/1.0/Forms/transaction/default143
4 files changed, 0 insertions, 526 deletions
diff --git a/rt/html/REST/1.0/Forms/ticket/comment b/rt/html/REST/1.0/Forms/ticket/comment
deleted file mode 100755
index 4ed2da8..0000000
--- a/rt/html/REST/1.0/Forms/ticket/comment
+++ /dev/null
@@ -1,152 +0,0 @@
-%# 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/merge b/rt/html/REST/1.0/Forms/ticket/merge
deleted file mode 100755
index 69af6c8..0000000
--- a/rt/html/REST/1.0/Forms/ticket/merge
+++ /dev/null
@@ -1,96 +0,0 @@
-%# 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
deleted file mode 100755
index 35ee11f..0000000
--- a/rt/html/REST/1.0/Forms/ticket/take
+++ /dev/null
@@ -1,135 +0,0 @@
-%# 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
deleted file mode 100644
index e23098a..0000000
--- a/rt/html/REST/1.0/Forms/transaction/default
+++ /dev/null
@@ -1,143 +0,0 @@
-%# 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>