[Rt-commit] rt branch, 4.4/ajax-edit-custom-fields, created. rt-4.4.0-53-g6df144c

Dustin Graves dustin at bestpractical.com
Wed Feb 24 20:00:40 EST 2016


The branch, 4.4/ajax-edit-custom-fields has been created
        at  6df144c588263e46d4b4aa17fe82f67c9b3b77ac (commit)

- Log -----------------------------------------------------------------
commit 6df144c588263e46d4b4aa17fe82f67c9b3b77ac
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Thu Feb 25 00:58:41 2016 +0000

    wip

diff --git a/share/html/Elements/EditCustomFields b/share/html/Elements/EditCustomFields
index 79174de..3b9123f 100644
--- a/share/html/Elements/EditCustomFields
+++ b/share/html/Elements/EditCustomFields
@@ -88,7 +88,12 @@
 % $m->callback( CallbackName => 'AfterCustomFields', Object => $Object,
 %               Grouping => $Grouping, ARGSRef => \%ARGS );
 <%INIT>
-$CustomFields ||= $Object->CustomFields;
+if (ref $Object eq 'RT::Ticket' && $Queue && !$CustomFields) {
+    $CustomFields = RT::CustomFields->new( $session{CurrentUser} );
+    $CustomFields->LimitToGlobalOrQueue( $Queue );
+} else {
+    $CustomFields ||= $Object->CustomFields;
+}
 
 $CustomFields->LimitToGrouping( $Object => $Grouping ) if defined $Grouping;
 
@@ -116,4 +121,5 @@ $Grouping     => undef
 $AsTable => 1
 $InTable => 0
 $ShowHints => 1
+$Queue => undef
 </%ARGS>
diff --git a/share/html/Elements/LoadEditCustomFieldCustomGroupings b/share/html/Elements/LoadEditCustomFieldCustomGroupings
new file mode 100644
index 0000000..111a16b
--- /dev/null
+++ b/share/html/Elements/LoadEditCustomFieldCustomGroupings
@@ -0,0 +1,85 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
+%#                                          <sales at 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 }}}
+<%ARGS>
+$Object
+</%ARGS>
+<%INIT>
+my %params = %ARGS;
+delete $params{Object};
+
+my $url = RT->Config->Get('WebPath') . '/Helpers/EditCustomFieldCustomGroupings?'.
+    $m->comp('/Elements/QueryString', %params,
+        ClassName => ref $Object, ObjectId => $Object->id);
+
+my $loading_message = loc('Loading...');
+</%INIT>
+
+<script type="text/javascript">
+jQuery(function() {
+    var customFieldPlaceholder = jQuery('#CustomFieldPlaceholder'),
+        customFieldForm = customFieldPlaceholder.closest('form');
+
+    var loadCustomFields = function() {
+        var queue, url;
+
+        customFieldPlaceholder.html('<% $loading_message %>');
+
+        if (this.value) queue = jQuery(this).val();
+        url = '<% $url |n %>' + (queue ? '&Queue=' + queue : '');
+
+        customFieldPlaceholder.load(url);
+    }
+    customFieldForm.find('select[name=Queue]').change(loadCustomFields);
+    customFieldForm.find('input[name=Queue]').change(loadCustomFields);
+    loadCustomFields();
+});
+</script>
+
+<div id="CustomFieldPlaceholder">
+    <% $loading_message %>
+</div>
diff --git a/share/html/Helpers/EditCustomFieldCustomGroupings b/share/html/Helpers/EditCustomFieldCustomGroupings
new file mode 100644
index 0000000..05913f0
--- /dev/null
+++ b/share/html/Helpers/EditCustomFieldCustomGroupings
@@ -0,0 +1,63 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
+%#                                          <sales at 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 }}}
+<%args>
+$ClassName
+$ObjectId
+$Queue => undef
+</%args>
+<%init>
+my %params = %ARGS;
+delete $params{ClassName};
+delete $params{ObjectId};
+
+my $object = $ClassName->new( $session{CurrentUser} );
+$object->Load($ObjectId);
+$m->abort() unless $object->Id;
+</%init>
+<& /Elements/EditCustomFieldCustomGroupings, %params, Object => $object &>
+% $m->abort();
diff --git a/share/html/Ticket/Modify.html b/share/html/Ticket/Modify.html
index fb8fb08..fc169d0 100644
--- a/share/html/Ticket/Modify.html
+++ b/share/html/Ticket/Modify.html
@@ -63,7 +63,7 @@
 </&>
 % $m->callback( CallbackName => 'AfterBasics', Ticket => $TicketObj );
 
-<& /Elements/EditCustomFieldCustomGroupings, Object => $TicketObj &>
+<& /Elements/LoadEditCustomFieldCustomGroupings, Object => $TicketObj &>
 
 <& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#993333" &>
 </form>

-----------------------------------------------------------------------


More information about the rt-commit mailing list