Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bestpractical/rt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorShawn M Moore <shawn@bestpractical.com>2017-04-13 19:26:26 +0300
committersunnavy <sunnavy@bestpractical.com>2022-10-19 00:25:59 +0300
commit58d08f216325c2380ff68e11bd22027e1ebc5cb1 (patch)
tree363eb2d5c499c5c50183d7659d9be80560901e95 /share
parent753a8de24ad25558806c1c46577b4063553e0a56 (diff)
Factor out a LookupType role from CustomFields
This will be added to CustomRoles to support custom roles on assets and other record types. This generalizes and deprecates /Admin/Elements/SelectCustomFieldLookupType in favor of a new /Admin/Elements/SelectLookupType. That way we can use it on the CustomRole Modify page
Diffstat (limited to 'share')
-rw-r--r--share/html/Admin/CustomFields/Modify.html4
-rw-r--r--share/html/Admin/Elements/SelectCustomFieldLookupType17
-rw-r--r--share/html/Admin/Elements/SelectLookupType61
3 files changed, 70 insertions, 12 deletions
diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 2cfc5be13e..daef955a53 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -96,8 +96,10 @@
% }
<&| /Elements/LabeledValue, Label => loc("Applies to") &>
- <& /Admin/Elements/SelectCustomFieldLookupType,
+ <& /Admin/Elements/SelectLookupType,
+ Class => 'RT::CustomField',
Name => "LookupType",
+ Object => $CustomFieldObj,
Default => $CustomFieldObj->LookupType || $LookupType,
&>
</&>
diff --git a/share/html/Admin/Elements/SelectCustomFieldLookupType b/share/html/Admin/Elements/SelectCustomFieldLookupType
index f43d543829..95d7970b83 100644
--- a/share/html/Admin/Elements/SelectCustomFieldLookupType
+++ b/share/html/Admin/Elements/SelectCustomFieldLookupType
@@ -45,16 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<select class="form-control selectpicker" name="<%$Name%>">
-%for my $option ($cf->LookupTypes) {
-<option value="<%$option%>"<%defined ($Default) && ($option eq $Default) && qq[ selected="selected"] |n%>><% $cf->FriendlyLookupType($option) %></option>
-%}
-</select>
-<%INIT>
-my $cf = RT::CustomField->new($session{'CurrentUser'});
+<& SelectLookupType, %ARGS, Class => 'RT::CustomField' &>
+<%INIT>
+RT->Deprecated(
+ Remove => '5.4',
+ Instead => 'SelectLookupType',
+);
</%INIT>
-<%ARGS>
-$Default=> ''
-$Name => 'LookupType'
-</%ARGS>
diff --git a/share/html/Admin/Elements/SelectLookupType b/share/html/Admin/Elements/SelectLookupType
new file mode 100644
index 0000000000..7b470555cd
--- /dev/null
+++ b/share/html/Admin/Elements/SelectLookupType
@@ -0,0 +1,61 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2022 Best Practical Solutions, LLC
+%# <sales@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 }}}
+<select class="form-control selectpicker" name="<%$Name%>">
+%for my $option ($Object->LookupTypes) {
+<option value="<%$option%>"<%defined ($Default) && ($option eq $Default) && qq[ selected="selected"] |n%>><% $Object->FriendlyLookupType($option) %></option>
+%}
+</select>
+<%INIT>
+$Object ||= $Class->new($session{'CurrentUser'});
+</%INIT>
+<%ARGS>
+$Default => ''
+$Name => 'LookupType'
+$Object => undef
+$Class => ''
+</%ARGS>