[Rt-commit] rtir branch, 5.0/allow-inline-edit-on-ticket-display, repushed
Craig Kaiser
craig at bestpractical.com
Mon Jan 4 11:44:51 EST 2021
The branch 5.0/allow-inline-edit-on-ticket-display was deleted and repushed:
was d6e735d34ef9bb7a5b74feeddbd1288c710dfd7f
now f3dd22c684d20bb2616dd6f178945fd70dd2d915
1: 2ef5dd7f ! 1: 2fbb548c Add inline edit to RTIR Display.html page
@@ -10,7 +10,7 @@
% $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'LeftColumnStart' );
+<%PERL>
-+ my $modify_url = RT->Config->Get('WebPath')."/RTIR/Display.html?id=".$Ticket->Id;
++ my $modify_url = RT->Config->Get('WebPath')."/RTIR/Edit.html?id=".$Ticket->Id;
+ my $modify_inline
+ = '<a class="inline-edit-toggle edit" href="%s">'
+ . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
@@ -222,12 +222,12 @@
+% }
</&>
--<& /Elements/ShowCustomFieldCustomGroupings,
-+<& /RTIR/Elements/ShowCustomFieldCustomGroupings,
+ <& /Elements/ShowCustomFieldCustomGroupings,
Object => $Ticket,
- title_href => RT::IR->HREFTo("Edit.html"),
+ title_href => RT::IR->HREFTo("Edit.html"),
-+ InlineEdit => 1
++ InlineEdit => ($can_modify || $can_modify_cf) ? $InlineEdit : 0,
++ ActionURL => RT->Config->Get('WebPath')."/RTIR/Display.html"
&>
<& /RTIR/Elements/ShowArticles, Ticket => $Ticket &>
@@ -236,9 +236,9 @@
% $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'RightColumnStart' );
+<%PERL>
-+ my $people_url = RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id;
++ my $people_url = RT->Config->Get('WebPath')."/Ticket/Edit.html?id=".$Ticket->Id;
+ my $people_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $people_url, 'h' ) );
-+ my $people_behavior = $inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link';
++ my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
+
<&| /Widgets/TitleBox,
@@ -246,7 +246,7 @@
- title_href => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
- class => 'ticket-info-people',
+ title => loc('People'),
-+ title_href => RT->Config->Get('WebPath')."/RTIR/Edit.html?id=".$Ticket->Id,
++ title_href => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
+ class => (join " ", 'ticket-info-people', ($people_behavior eq 'always' ? 'editing' : ())),
+ data => { 'inline-edit-behavior' => $people_behavior },
+ (($can_modify || $can_modify_people) && $people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
@@ -274,13 +274,14 @@
- class => 'ticket-info-dates',
+
+<%PERL>
-+ my $dates_url = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id;
++ my $dates_url = RT->Config->Get('WebPath')."/Ticket/Edit.html?id=".$Ticket->Id;
+ my $dates_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
-+ my $dates_behavior = $inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link';
++ my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
+
+ <&| /Widgets/TitleBox,
+ title => loc("Dates"),
++ title_href => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
+ class => (join " ", 'ticket-info-dates', ($modify_behavior eq 'always' ? 'editing' : ())),
+ data => { 'inline-edit-behavior' => $dates_behavior },
+ ($can_modify ? (title_href => $dates_url) : ()),
@@ -335,141 +336,18 @@
my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
-diff --git a/html/RTIR/Elements/ShowCustomFieldCustomGroupings b/html/RTIR/Elements/ShowCustomFieldCustomGroupings
-new file mode 100644
---- /dev/null
-+++ b/html/RTIR/Elements/ShowCustomFieldCustomGroupings
-@@
-+%# BEGIN BPS TAGGED BLOCK {{{
-+%#
-+%# COPYRIGHT:
-+%#
-+%# This software is Copyright (c) 1996-2020 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 }}}
-+<%perl>
-+for my $group ( @Groupings ) {
-+ my $CustomFields = $Object->CustomFields;
-+ $m->callback(
-+ Table => 1, # default is true
-+ %ARGS,
-+ CallbackPage => '/Elements/ShowCustomFields',
-+ CallbackName => 'MassageCustomFields',
-+ Object => $Object,
-+ CustomFields => $CustomFields,
-+ );
-+
-+ $CustomFields->LimitToGrouping( $Object => $group );
-+ next unless $CustomFields->First;
-+
-+ my $modify_url = $title_href ? "$title_href?id=".$Object->id.($group?";Grouping=".$m->interp->apply_escapes($group,'u')."#".CSSClass("$css_class-$group") : "#".$css_class) : undef;
-+ my $modify_inline
-+ = '<a class="inline-edit-toggle edit" href="'
-+ . $m->interp->apply_escapes( ( $modify_url || '#' ), 'h' ) . '">'
-+ . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
-+ . '</a>'
-+ . '<a class="inline-edit-toggle cancel hidden" href="#">'
-+ . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
-+ . '</a>';
-+ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{$group} || $inline_edit_behavior{_default} || 'link') : 'hide';
-+ my @class = $css_class;
-+ push @class, CSSClass("$css_class-$group") if $group;
-+ push @class, 'editing' if $modify_behavior eq 'always';
-+
-+ my %grouping_args = (
-+ title => $group? loc($group) : loc('Custom Fields'),
-+ class => (join " ", @class),
-+ hide_empty => 1,
-+ title_href => $modify_url,
-+ ($modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_inline) : ()),
-+ data => { 'inline-edit-behavior' => $modify_behavior },
-+ %$TitleBoxARGS,
-+ );
-+ $m->callback( CallbackName => 'TitleBox', Object => $Object, Grouping => $group, ARGSRef => \%grouping_args );
-+</%perl>
-+<&| /Widgets/TitleBox, %grouping_args &>
-+% unless ($modify_behavior eq 'always') {
-+ <div class="inline-edit-display">
-+ <& /Elements/ShowCustomFields, %ARGS, Object => $Object, Grouping => $group &>
-+ </div>
-+% }
-+% if ($modify_behavior ne 'hide') {
-+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Display.html" method="post" enctype="multipart/form-data">
-+ <input type="hidden" class="hidden" name="id" value="<% $Object->id %>" />
-+ <& /Elements/EditCustomFields, Object => $Object, Grouping => $group, InTable => 0 &>
-+ <div class="form-row">
-+ <div class="col-12 text-right">
-+ <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
-+ </div>
-+ </div>
-+ </form>
-+% }
-+</&>
-+% }
-+<%ARGS>
-+$Object
-+$title_href => ""
-+$InlineEdit => 0
-+ at Groupings => ()
-+</%ARGS>
-+<%INIT>
-+my $css_class = lc(ref($Object)||$Object);
-+$css_class =~ s/^rt:://;
-+$css_class =~ s/::/-/g;
-+$css_class = CSSClass($css_class);
-+$css_class .= '-info-cfs';
-+
-+my $TitleBoxARGS = delete $ARGS{TitleBoxARGS} || {};
-+
-+$InlineEdit = 0 unless $Object->isa('RT::Ticket');
-+my %inline_edit_behavior;
-+if (RT->Config->Get('InlineEditPanelBehavior')) {
-+ %inline_edit_behavior = %{ RT->Config->Get('InlineEditPanelBehavior')->{RT::CustomField->_GroupingClass($Object)} || {} };
-+}
-+
-+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
-+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
-+
-+ at Groupings = (RT::CustomField->CustomGroupings( $Object ), '') unless @Groupings;
-+</%INIT>
+diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
+--- a/html/RTIR/Incident/Display.html
++++ b/html/RTIR/Incident/Display.html
+@@
+
+ <& /Elements/ShowCustomFieldCustomGroupings,
+ Object => $TicketObj,
+- title_href => RT::IR->HREFTo("Edit.html"),
++ title_href => RT::IR->HREFTo("Edit.html"),
++ InlineEdit => ($can_modify || $can_modify_cf) ? 1 : 0,
++ ActionURL => RT->Config->Get('WebPath')."/RTIR/Display.html"
+ &>
+
+ <&| /Widgets/TitleBox,
2: 82028fd6 ! 2: ce4eae5e Add inline edit to Incidents/Display.html page
@@ -10,7 +10,7 @@
% $m->callback( %ARGS, Ticket => $TicketObj, CallbackName => 'LeftColumnStart' );
+<%PERL>
-+ my $modify_url = RT->Config->Get('WebPath')."/RTIR/Incident/Display.html?id=".$TicketObj->Id;
++ my $modify_url = RT->Config->Get('WebPath')."/RTIR/Incident/Edit.html?id=".$TicketObj->Id;
+ my $modify_inline
+ = '<a class="inline-edit-toggle edit" href="%s">'
+ . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
@@ -19,7 +19,7 @@
+ . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
+ . '</a>';
+ my $modify_basics = sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) );
-+ my $modify_behavior = $inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link';
++ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
+
<&| /Widgets/TitleBox,
@@ -161,18 +161,18 @@
+% }
</&>
--<& /Elements/ShowCustomFieldCustomGroupings,
-+<& /RTIR/Elements/ShowCustomFieldCustomGroupings,
+ <& /Elements/ShowCustomFieldCustomGroupings,
Object => $TicketObj,
-- title_href => RT::IR->HREFTo("Edit.html"),
-+ title_href => RT::IR->HREFTo("Edit.html"),
-+ InlineEdit => 1
+ title_href => RT::IR->HREFTo("Edit.html"),
+- InlineEdit => ($can_modify || $can_modify_cf) ? 1 : 0,
++ InlineEdit => ($can_modify || $can_modify_cf) ? $InlineEdit : 0,
+ ActionURL => RT->Config->Get('WebPath')."/RTIR/Display.html"
&>
+<%PERL>
-+ my $dates_url = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$TicketObj->Id;
++ my $dates_url = RT::IR->HREFTo("Edit.html?id=". $TicketObj->Id);
+ my $dates_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
-+ my $dates_behavior = $inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link';
++ my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
+
<&| /Widgets/TitleBox,
@@ -232,4 +232,10 @@
}
if ( $ARGS{'BulkLink'} || $Child ) {
+@@
+ $SelectedTicket => undef
+ @SelectedTickets => ()
+ $ForceShowHistory => 0
++$InlineEdit => RT->Config->Get('InlineEdit', $session{CurrentUser})
+ </%ARGS>
3: d6e735d3 = 3: f3dd22c6 Add ARG for /RTIR/Elements/ShowIncidents to add classes when in a form
More information about the rt-commit
mailing list