diff options
Diffstat (limited to 'rt/html/REST/1.0/Forms/queue')
-rw-r--r-- | rt/html/REST/1.0/Forms/queue/default | 170 | ||||
-rw-r--r-- | rt/html/REST/1.0/Forms/queue/ns | 62 |
2 files changed, 0 insertions, 232 deletions
diff --git a/rt/html/REST/1.0/Forms/queue/default b/rt/html/REST/1.0/Forms/queue/default deleted file mode 100644 index ca9cf69ec..000000000 --- a/rt/html/REST/1.0/Forms/queue/default +++ /dev/null @@ -1,170 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2009 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/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 }}} -%# REST/1.0/Forms/queue/default -%# -<%ARGS> -$id -$format => 's' -$changes => {} -</%ARGS> -<%perl> -my @comments; -my ($c, $o, $k, $e) = ("", [], {}, 0); -my %data = %$changes; -my $queue = new RT::Queue $session{CurrentUser}; -my @fields = qw(Name Description CorrespondAddress CommentAddress - InitialPriority FinalPriority DefaultDueIn); -my %fields = map { lc $_ => $_ } @fields; - -if ($id ne 'new') { - $queue->Load($id); - if (!$queue->Id) { - return [ "# Queue $id does not exist.", [], {}, 1 ]; - } -} -else { - if (%data == 0) { - return [ - "# Required: Name", - [ "id", @fields ], - { - id => 'queue/new', - Name => '<queue name>', - Description => "", - CommentAddress => "", - CorrespondAddress => "", - InitialPriority => "", - FinalPriority => "", - DefaultDueIn => "", - }, - 0 - ]; - } - else { - my %v; - my %create = %fields; - - foreach my $k (keys %data) { - if (exists $create{lc $k}) { - $v{$create{lc $k}} = delete $data{$k}; - } - } - - if ($v{Name} eq '<queue name>') { - my %o = keys %$changes; - delete @o{"id", @fields}; - return [ - "# Please set the queue name.", - [ "id", @fields, keys %o ], $changes, 1 - ]; - } - - $queue->Create(%v); - unless ($queue->Id) { - return [ "# Could not create queue.", [], {}, 1 ]; - } - - delete $data{id}; - $id = $queue->Id; - push(@comments, "# Queue $id created."); - goto DONE if %data == 0; - } -} - -if (%data == 0) { - my @data; - - push @data, [ id => "queue/".$queue->Id ]; - foreach my $key (@fields) { - push @data, [ $key => $queue->$key ]; - } - - my %k = map {@$_} @data; - $o = [ map {$_->[0]} @data ]; - $k = \%k; -} -else { - my ($get, $set, $key, $val, $n, $s); - - foreach $key (keys %data) { - $val = $data{$key}; - $key = lc $key; - $n = 1; - - if (exists $fields{$key}) { - $key = $fields{$key}; - $set = "Set$key"; - - next if $val eq $queue->$key; - ($n, $s) = $queue->$set($val); - } - elsif ($key ne 'id') { - $n = 0; - $s = "Unknown field."; - } - - SET: - if ($n == 0) { - $e = 1; - push @comments, "# $key: $s"; - unless (@$o) { - my %o = keys %$changes; - delete @o{"id", @fields}; - @$o = ("id", @fields, keys %o); - $k = $changes; - } - } - } - - push(@comments, "# Queue $id updated.") unless $n == 0; -} - -DONE: -$c ||= join("\n", @comments) if @comments; -return [ $c, $o, $k, $e ]; -</%perl> diff --git a/rt/html/REST/1.0/Forms/queue/ns b/rt/html/REST/1.0/Forms/queue/ns deleted file mode 100644 index 0cb594b73..000000000 --- a/rt/html/REST/1.0/Forms/queue/ns +++ /dev/null @@ -1,62 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2009 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/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 }}} -%# REST/1.0/Forms/queue/ns -%# -<%ARGS> -$id -</%ARGS> -<%perl> -use RT::Queues; - -my $queues = new RT::Queues $session{CurrentUser}; -$queues->Limit(FIELD => 'Name', OPERATOR => '=', VALUE => $id); -if ($queues->Count == 0) { - return (0, "No queue named $id exists."); -} -return $queues->Next->Id; -</%perl> |