From 945721f48f74d5cfffef7c7cf3a3d6bc2521f5dd Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 15 Jul 2003 13:16:32 +0000 Subject: import of rt 3.0.4 --- rt/html/Admin/Elements/AddCustomFieldValue | 44 ++++++ rt/html/Admin/Elements/CreateUserCalled | 26 ++++ rt/html/Admin/Elements/EditCustomField | 127 +++++++++++++++ rt/html/Admin/Elements/EditCustomFieldValues | 42 +++++ rt/html/Admin/Elements/EditCustomFields | 214 ++++++++++++++++++++++++++ rt/html/Admin/Elements/EditQueueWatchers | 55 +++++++ rt/html/Admin/Elements/EditScrip | 149 ++++++++++++++++++ rt/html/Admin/Elements/EditScrips | 97 ++++++++++++ rt/html/Admin/Elements/EditTemplates | 104 +++++++++++++ rt/html/Admin/Elements/EditUserComments | 32 ++++ rt/html/Admin/Elements/GroupTabs | 76 +++++++++ rt/html/Admin/Elements/Header | 28 ++++ rt/html/Admin/Elements/ListGlobalCustomFields | 37 +++++ rt/html/Admin/Elements/ListGlobalScrips | 37 +++++ rt/html/Admin/Elements/ModifyQueue | 78 ++++++++++ rt/html/Admin/Elements/ModifyTemplate | 60 ++++++++ rt/html/Admin/Elements/ModifyUser | 99 ++++++++++++ rt/html/Admin/Elements/QueueRightsForUser | 40 +++++ rt/html/Admin/Elements/QueueTabs | 93 +++++++++++ rt/html/Admin/Elements/SelectCustomFieldType | 36 +++++ rt/html/Admin/Elements/SelectGroups | 37 +++++ rt/html/Admin/Elements/SelectModifyGroup | 33 ++++ rt/html/Admin/Elements/SelectModifyQueue | 33 ++++ rt/html/Admin/Elements/SelectModifyUser | 49 ++++++ rt/html/Admin/Elements/SelectNewGroupMembers | 61 ++++++++ rt/html/Admin/Elements/SelectRights | 90 +++++++++++ rt/html/Admin/Elements/SelectScrip | 48 ++++++ rt/html/Admin/Elements/SelectScripAction | 48 ++++++ rt/html/Admin/Elements/SelectScripCondition | 48 ++++++ rt/html/Admin/Elements/SelectSingleOrMultiple | 43 ++++++ rt/html/Admin/Elements/SelectTemplate | 61 ++++++++ rt/html/Admin/Elements/SelectUsers | 40 +++++ rt/html/Admin/Elements/SystemTabs | 70 +++++++++ rt/html/Admin/Elements/Tabs | 63 ++++++++ rt/html/Admin/Elements/UserTabs | 74 +++++++++ 35 files changed, 2272 insertions(+) create mode 100644 rt/html/Admin/Elements/AddCustomFieldValue create mode 100644 rt/html/Admin/Elements/CreateUserCalled create mode 100644 rt/html/Admin/Elements/EditCustomField create mode 100644 rt/html/Admin/Elements/EditCustomFieldValues create mode 100644 rt/html/Admin/Elements/EditCustomFields create mode 100644 rt/html/Admin/Elements/EditQueueWatchers create mode 100644 rt/html/Admin/Elements/EditScrip create mode 100644 rt/html/Admin/Elements/EditScrips create mode 100644 rt/html/Admin/Elements/EditTemplates create mode 100644 rt/html/Admin/Elements/EditUserComments create mode 100644 rt/html/Admin/Elements/GroupTabs create mode 100644 rt/html/Admin/Elements/Header create mode 100644 rt/html/Admin/Elements/ListGlobalCustomFields create mode 100644 rt/html/Admin/Elements/ListGlobalScrips create mode 100644 rt/html/Admin/Elements/ModifyQueue create mode 100644 rt/html/Admin/Elements/ModifyTemplate create mode 100644 rt/html/Admin/Elements/ModifyUser create mode 100644 rt/html/Admin/Elements/QueueRightsForUser create mode 100644 rt/html/Admin/Elements/QueueTabs create mode 100644 rt/html/Admin/Elements/SelectCustomFieldType create mode 100644 rt/html/Admin/Elements/SelectGroups create mode 100644 rt/html/Admin/Elements/SelectModifyGroup create mode 100644 rt/html/Admin/Elements/SelectModifyQueue create mode 100644 rt/html/Admin/Elements/SelectModifyUser create mode 100644 rt/html/Admin/Elements/SelectNewGroupMembers create mode 100644 rt/html/Admin/Elements/SelectRights create mode 100644 rt/html/Admin/Elements/SelectScrip create mode 100644 rt/html/Admin/Elements/SelectScripAction create mode 100644 rt/html/Admin/Elements/SelectScripCondition create mode 100644 rt/html/Admin/Elements/SelectSingleOrMultiple create mode 100644 rt/html/Admin/Elements/SelectTemplate create mode 100644 rt/html/Admin/Elements/SelectUsers create mode 100644 rt/html/Admin/Elements/SystemTabs create mode 100644 rt/html/Admin/Elements/Tabs create mode 100644 rt/html/Admin/Elements/UserTabs (limited to 'rt/html/Admin/Elements') diff --git a/rt/html/Admin/Elements/AddCustomFieldValue b/rt/html/Admin/Elements/AddCustomFieldValue new file mode 100644 index 000000000..8850734f2 --- /dev/null +++ b/rt/html/Admin/Elements/AddCustomFieldValue @@ -0,0 +1,44 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<&|/l&>Add Value + + + + +
+<&|/l&>Sort:
+ +
+<&|/l&>Name:
+ +
+<&|/l&>Description:
+ +
+ +<%init> + +<%args> +$CustomField => undef + diff --git a/rt/html/Admin/Elements/CreateUserCalled b/rt/html/Admin/Elements/CreateUserCalled new file mode 100644 index 000000000..8ceccca73 --- /dev/null +++ b/rt/html/Admin/Elements/CreateUserCalled @@ -0,0 +1,26 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +
+<&|/l&>New user called +
diff --git a/rt/html/Admin/Elements/EditCustomField b/rt/html/Admin/Elements/EditCustomField new file mode 100644 index 000000000..a09600ba7 --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomField @@ -0,0 +1,127 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<& /Elements/ListActions, actions => \@results &> + + +
+ + + + + + + + +
+<&|/l&>Name: + + +
+<&|/l&>Description: + + +
+<&|/l&>Type: + +<& /Admin/Elements/SelectCustomFieldType, Name => "Type", Default => $CustomFieldObj->Type &> +
+ + +> <&|/l&>Enabled (Unchecking this box disables this custom field) +
+ +

+% if ($CustomFieldObj->Id and $CustomFieldObj->Type =~ /Select/) { +

<&|/l&>Values

+ +<& /Admin/Elements/EditCustomFieldValues, CustomField => $CustomFieldObj &> +<& /Admin/Elements/AddCustomFieldValue, CustomField => $CustomFieldObj &> + +% } +<&/Elements/Submit&> +
+ + + +<%INIT> + +my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); +my $EnabledChecked = "CHECKED"; +my (@results); + +if (! $CustomField ) { + $title = loc("Create a CustomField"); + $id = 'new'; +} else { + + if ($CustomField eq 'new') { + my ($val, $msg) = $CustomFieldObj->Create(Queue => $Queue, + Name => $Name, + Type => $Type, + Description => $Description, + ); + Abort(loc("Could not create CustomField", $msg)) unless ($val); + push @results, $msg; + $CustomFieldObj->SetSortOrder($CustomFieldObj->id); + $title = loc('Created CustomField [_1]', $CustomFieldObj->Name()); + } else { + $CustomFieldObj->Load($CustomField) || Abort(loc('No CustomField')); + $title = loc('Editing CustomField [_1]', $CustomFieldObj->Name()); + + my @aresults = ProcessCustomFieldUpdates ( + CustomFieldObj => $CustomFieldObj, + ARGSRef => \%ARGS ); + push @results, @aresults; + } + + +$id = $CustomFieldObj->id; + + #we're asking about enabled on the web page but really care about disabled. + my $Disabled = ($Enabled ? 0 : 1); + + if ( ($SetEnabled) and ( $Disabled != $CustomFieldObj->Disabled) ) { + my ($code, $msg) = $CustomFieldObj->SetDisabled($Disabled); + push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); + } + + if ($CustomFieldObj->Disabled()) { + $EnabledChecked =""; + } + +} + + + +<%ARGS> +$id => undef +$title => undef +$Queue => undef +$CustomField => undef +$Type => undef +$Description => undef +$Name => undef +$SetEnabled => undef +$Enabled => undef + diff --git a/rt/html/Admin/Elements/EditCustomFieldValues b/rt/html/Admin/Elements/EditCustomFieldValues new file mode 100644 index 000000000..64564adfb --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomFieldValues @@ -0,0 +1,42 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<&|/l&>(Check box to delete) +
    +% while (my $v = $values->Next) { +
  • +<%$v->SortOrder%>: + +<%$v->Name%> +% if ($v->Description) { +(<%$v->Description%>) +% } +
  • +% } +
+<%init> +my $values = $CustomField->Values(); + +<%args> +$CustomField => undef + diff --git a/rt/html/Admin/Elements/EditCustomFields b/rt/html/Admin/Elements/EditCustomFields new file mode 100644 index 000000000..a86b051d0 --- /dev/null +++ b/rt/html/Admin/Elements/EditCustomFields @@ -0,0 +1,214 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<& /Elements/ListActions, actions => \@actions &> + + + +
+<%$caption%>:
+
+% if ($CustomFields->Count == 0 ) { +

<&|/l&>(No custom fields)

+% } else { + + + + + +% my $count; +% while (my $CustomFieldObj = $CustomFields->Next) { +% # show 'move up' unless it's the first item +% if ($count++) { + +% } + + + +
+
    +% while (my $CustomFieldObj = $CustomFields->Next) { +
  • <%$CustomFieldObj->Name%> (<% $CustomFieldObj->FriendlyType %>)
    +<%$CustomFieldObj->Description%> +
  • +% } +
+
+<&|/l&>Move up +% } else { + +% } + +% # show 'move down' unless it's the last item +% if (!$CustomFields->IsLast) { +% $m->print(' | ') if $count > 1; +<&|/l&>Move down +% } +
+% } +
+% if ($id) { + +% } + <&|/l&>Include disabled custom fields in listing. + +
+ + +<%INIT> +my $CustomFields = RT::CustomFields->new($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); +my $caption; + +if ($id) { + $QueueObj->Load($id); +} + +if ($QueueObj->id) { + $CustomFields->LimitToQueue($id); +} +else { + $CustomFields->LimitToGlobal(); +} + +if ($FindDisabledCustomFields) { + $caption = loc("All Custom Fields"); + $CustomFields->{'find_disabled_rows'} = 1; +} else { + $caption = loc("Enabled Custom Fields"); +} + +# {{{ deal with moving sortorder of custom fields +if ($CustomField and $Move) { + my $SourceObj = RT::CustomField->new($session{'CurrentUser'}); + $SourceObj->Load($CustomField) || Abort(loc('No CustomField')); + + my $TargetObj; + my $target_order = $SourceObj->SortOrder + $Move; + while (my $CustomFieldObj = $CustomFields->Next) { + my $this_order = $CustomFieldObj->SortOrder; + + # if we have an exact match, finish the loop now + ($TargetObj = $CustomFieldObj, last) if $this_order == $target_order; + + # otherwise, we need to apropos toward the general direction + # ... first, check the sign is correct + next unless ($this_order - $SourceObj->SortOrder) * $Move > 0; + + # ... next, see if we already have a candidate + if ($TargetObj) { + # ... if yes, compare the delta and choose the smaller one + my $orig_delta = abs($TargetObj->SortOrder - $target_order); + my $this_delta = abs($this_order - $target_order); + next if $orig_delta < $this_delta; + } + + $TargetObj = $CustomFieldObj; + } + + if ($TargetObj) { + # swap their sort order + my ($s, $t) = ($SourceObj->SortOrder, $TargetObj->SortOrder); + $TargetObj->SetSortOrder($s); + $SourceObj->SetSortOrder($t); + # because order changed, we must redo search for subsequent uses + $CustomFields->RedoSearch; + } + + $CustomFields->GotoFirstItem; +} +# }}} + +# {{{ now process the 'copy queue' action +my @actions; +if ($Source and $Source ne $id) { + my $SourceQueue = RT::Queue->new($session{'CurrentUser'}); + $SourceQueue->Load($Source) || Abort(loc("Couldn't load queue")); + my $SourceCustomFields = RT::CustomFields->new($session{'CurrentUser'}); + $SourceCustomFields->LimitToQueue($SourceQueue->id); + + # delete old fields + foreach my $CustomFieldObj ( @{$CustomFields->ItemsArrayRef} ) { + $CustomFieldObj->Delete; + } + + # add new fields + while (my $SourceCustomFieldObj = $SourceCustomFields->Next) { + my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); + my ($val, $msg) = $CustomFieldObj->Create( + id => $SourceCustomFieldObj->id, + Queue => $id, + Name => $SourceCustomFieldObj->Name, + Type => $SourceCustomFieldObj->Type, + Description => $SourceCustomFieldObj->Description, + ); + Abort(loc("Could not create CustomField") . ": $msg") unless ($val); + push @actions, $msg; + + $CustomFieldObj->SetSortOrder($SourceCustomFieldObj->SortOrder); + + # add new values + my $values = $SourceCustomFieldObj->Values(); + while (my $v = $values->Next) { + my ( $addval, $addmsg ) = $CustomFieldObj->AddValue( + Name => $v->Name, + Description => $v->Description, + SortOrder => $v->SortOrder + ); + } + } + + # because content changed, we must redo search for subsequent uses + $CustomFields->RedoSearch; + $CustomFields->GotoFirstItem; +} +# }}} + +# {{{ deal with deleting existing custom fields +foreach my $key (keys %ARGS) { + # {{{ if we're trying to delete the custom field + if ($key =~ /^DeleteCustomField-(\d+)/) { + my $id = $1; + my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'}); + $CustomFieldObj->Load($id); + my ($retval, $msg) = $CustomFieldObj->Delete; + if ($retval) { + push @actions, loc("Custom field deleted"); + } + else { + push @actions, $msg; + } + } + # }}} +} +# }}} + + +<%ARGS> +$id => 0 +$title => undef +$Move => undef +$Source => undef +$CustomField => undef +$FindDisabledCustomFields => undef + diff --git a/rt/html/Admin/Elements/EditQueueWatchers b/rt/html/Admin/Elements/EditQueueWatchers new file mode 100644 index 000000000..db39bfb67 --- /dev/null +++ b/rt/html/Admin/Elements/EditQueueWatchers @@ -0,0 +1,55 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +%if ($Members->Count == 0 ) { +