[Bps-public-commit] rt-extension-repeatticket branch, rt5, created. 1.11-13-gaf776b0
? sunnavy
sunnavy at bestpractical.com
Wed Sep 30 14:16:14 EDT 2020
The branch, rt5 has been created
at af776b08ea0e00de14d9ea09c0381f0efa85fd38 (commit)
- Log -----------------------------------------------------------------
commit 96e51508e51d51a3814da285fcd9c6888b9535f2
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 03:13:53 2020 +0800
Migrate to elevator themes for RT 5
diff --git a/html/Callbacks/RepeatTicket/Ticket/Create.html/AfterBasics b/html/Callbacks/RepeatTicket/Ticket/Create.html/AfterBasics
index 73faca6..a8cbcaa 100644
--- a/html/Callbacks/RepeatTicket/Ticket/Create.html/AfterBasics
+++ b/html/Callbacks/RepeatTicket/Ticket/Create.html/AfterBasics
@@ -1,4 +1,4 @@
-<&| /Widgets/TitleBox, title => loc("Recurrence"), class=>'ticket-info-repeat-recurrence', title_class => 'inverse' &>
+<&| /Widgets/TitleBox, title => loc("Recurrence"), class=>'ticket-info-repeat' &>
<& /Ticket/Elements/EditRecurrence, ARGSRef => $ARGSRef, Initial => 1 &>
</&>
<%init>
diff --git a/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn b/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
index 06f2ee4..62c70b5 100644
--- a/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
+++ b/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
@@ -1,4 +1,4 @@
-<&| /Widgets/TitleBox, title => loc("Recurrence"), class=>'ticket-info-repeat-recurrence', title_class => 'inverse',
+<&| /Widgets/TitleBox, title => loc("Recurrence"), class=>'ticket-info-repeat',
($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyRecurrence.html?id=".$Ticket->Id) : ()) &>
<& /Ticket/Elements/EditRecurrence, Ticket => $Ticket, ReadOnly => 1 &>
</&>
diff --git a/html/Ticket/Elements/EditRecurrence b/html/Ticket/Elements/EditRecurrence
index 480c70f..d5200ee 100644
--- a/html/Ticket/Elements/EditRecurrence
+++ b/html/Ticket/Elements/EditRecurrence
@@ -12,8 +12,8 @@ jQuery( function () {
jQuery('div.repeat input[name=repeat-type]').change( function () {
var val = jQuery(this).val();
- jQuery('div.repeat td.repeat-details:not(.repeat-details-'+val+')').addClass('hidden');
- jQuery('div.repeat td.repeat-details-' +val ).removeClass('hidden');
+ jQuery('div.repeat .repeat-details:not(.repeat-details-'+val+')').addClass('hidden');
+ jQuery('div.repeat .repeat-details-' +val ).removeClass('hidden');
} );
% if ( $ReadOnly ) {
@@ -22,190 +22,204 @@ jQuery( function () {
} );
</script>
<div class="repeat">
-<label><input name="repeat-enabled" type="checkbox" value="1" <% $ARGSRef->{'repeat-enabled'} ? 'checked="checked"' : '' |n %>/> <&|/l&>Enable Recurrence?</&></label>
-
-<div class="repeat-toggle <% $ARGSRef->{'repeat-enabled'} ? '' : 'hidden' %> ">
-
-<label><&|/l&>Ticket lead time (days)</&>:
-<input size="3" name="repeat-lead-time" type="text" value="<% $ARGSRef->{'repeat-lead-time'} %>" /></label>
-<label><&|/l&>Concurrent active tickets</&>:
-<input size="3" name="repeat-coexistent-number" type="text" value="<% $ARGSRef->{'repeat-coexistent-number'} %>" /></label>
-
-<fieldset>
-<legend><&|/l&>Recurrence pattern</&></legend>
-<table width="100%" border="0">
-<tr>
-<td width="100px">
- <table border="0">
- <tr>
- <td width="100px">
- <label><input name="repeat-type" type="radio" value="daily" <% ($ARGSRef->{'repeat-type'} || '') eq 'daily' ? 'checked="checked"' : '' |n %> /> <&|/l&>Daily</&></label>
- </td>
- <td width="1" rowspan="4" bgcolor="#aaa"><br></td>
- </tr>
- <tr>
- <td width="100px">
- <label><input name="repeat-type" type="radio" value="weekly" <% ($ARGSRef->{'repeat-type'} || '') eq 'weekly' ? 'checked="checked"' : '' |n %>/> <&|/l&>Weekly</&></label>
- </td>
- </tr>
- <tr>
- <td width="100px">
- <label><input name="repeat-type" type="radio" value="monthly" <% ($ARGSRef->{'repeat-type'} || '') eq 'monthly' ? 'checked="checked"' : '' |n %>/> <&|/l&>Monthly</&></label>
- </td>
- </tr>
- <tr>
- <td width="100px">
- <label><input name="repeat-type" type="radio" value="yearly" <% ($ARGSRef->{'repeat-type'} || '') eq 'yearly' ? 'checked="checked"' : '' |n %>/> <&|/l&>Yearly</&></label>
- </td>
- </tr>
- </table>
-</td>
-<td class="repeat-details repeat-details-daily <% ($ARGSRef->{'repeat-type'} || '' ) eq 'daily' ? '' : 'hidden' %>">
- <table border="0">
- <tr>
- <td>
- <label><input name="repeat-details-daily" type="radio" value="day" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'day' ? 'checked="checked"' : '' |n %>/>
- <&|/l_unsafe, $input->("repeat-details-daily-day") &>Every [_1] Day(s)</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-daily" type="radio" value="weekday" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'weekday' ? 'checked="checked"' : '' |n %>/>
- <&|/l&>Every Weekday</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-daily" type="radio" value="complete" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'complete' ? 'checked="checked"' : '' |n %>/>
- <&|/l_unsafe, $input->("repeat-details-daily-complete") &>Create new task [_1] day(s) after each task is completed</&></label>
- </td>
- </tr>
- </table>
-</td>
-
-<td class="repeat-details repeat-details-weekly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'weekly' ? '' : 'hidden' %>">
- <table border="0">
- <tr>
- <td colspan="5">
- <label><input name="repeat-details-weekly" type="radio" value="week" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'week' ? 'checked="checked"' : '' |n %> />
- <&|/l_unsafe, $input->("repeat-details-weekly-week") &>Recur every [_1] week(s) on</&>:</label>
- </td>
- </tr>
- <tr>
- <td width="10px" />
-% for my $number ( 0 .. 6 ) {
- <td>
- <label><input name="repeat-details-weekly-weeks" type="checkbox" value="<% $week_values[$number] %>"
-% if ( defined $ARGSRef->{'repeat-details-weekly-weeks'} && (
-% ( ref $ARGSRef->{'repeat-details-weekly-weeks'} && grep { $_ eq $week_values[$number] }
-% @{$ARGSRef->{'repeat-details-weekly-weeks'}} ) ||
-% ( $ARGSRef->{'repeat-details-weekly-weeks'} eq $week_values[$number] ) ) ) {
- checked="checked"
-% }
-/><% loc($week_labels[$number]) %></label>
- </td>
-% if ( $number == 3 ) {
- </tr>
- <tr>
- <td width="10px" />
-% }
-% }
- </tr>
- <tr>
- <td colspan="5">
- <label><input name="repeat-details-weekly" type="radio" value="complete" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'complete' ? 'checked="checked"' : '' |n%>/>
- <&|/l_unsafe, $input->("repeat-details-weekly-complete") &>Create new task [_1] week(s) after each task is completed</&></label>
- </td>
- </tr>
- </table>
-</td>
-
-<td class="repeat-details repeat-details-monthly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'monthly' ? '' : 'hidden' %>">
- <table border="0">
- <tr>
- <td>
- <label><input name="repeat-details-monthly" type="radio" value="day" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'day' ? 'checked="checked"' : '' |n %> /><&|/l_unsafe, $input->("repeat-details-monthly-day-day"), $input->("repeat-details-monthly-day-month") &>Day [_1] of every [_2] month(s)</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-monthly" type="radio" value="week" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'week' ? 'checked="checked"' : '' |n %> /><&|/l_unsafe, $nth->("repeat-details-monthly-week-number"), $wday->("repeat-details-monthly-week-week"), $input->("repeat-details-monthly-week-month") &>The [_1] [_2] of every [_3] month(s)</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-monthly" type="radio" value="complete" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'complete' ? 'checked="checked"' : '' |n %> />
- <&|/l_unsafe, $input->("repeat-details-monthly-complete") &>Create new task [_1] month(s) after each task is completed</&></label>
- </td>
- </tr>
- </table>
-</td>
-
-<td class="repeat-details repeat-details-yearly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'yearly' ? '' : 'hidden' %>">
- <table border="0">
- <tr>
- <td>
- <label><input name="repeat-details-yearly" type="radio" value="day" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'day' ? 'checked="checked"' : '' |n %> /><&|/l_unsafe, $month->("repeat-details-yearly-day-month"), $input->("repeat-details-yearly-day-day") &>Every [_1] [_2]</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-yearly" type="radio" value="week" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'week' ? 'checked="checked"' : '' |n %> /><&|/l_unsafe, $nth->("repeat-details-yearly-week-number"), $wday->("repeat-details-yearly-week-week"), $month->("repeat-details-yearly-week-month") &>The [_1] [_2] of [_3]</&></label>
- </td>
- </tr>
- <tr>
- <td>
- <label><input name="repeat-details-yearly" type="radio" value="complete" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'complete' ? 'checked="checked"' : '' |n %> />
- <&|/l_unsafe, $input->("repeat-details-yearly-complete") &>Create new task [_1] year(s) after each task is completed</&></label>
- </td>
- </tr>
- </table>
-</td>
-
-</tr>
-</table>
-</fieldset>
-
-
-<fieldset>
-<legend><&|/l&>Range of recurrence</&></legend>
-<table width="100%" border="0">
-<tr>
- <td rowspan="3">
- <label>
- <&|/l&>Start</&>:
+ <div class="form-row">
+ <div class="label col-4"></div>
+ <div class="value col-auto">
+ <div class="custom-control custom-checkbox">
+ <input type="checkbox" id="repeat-enabled" name="repeat-enabled" class="custom-control-input" value="1" <% $ARGSRef->{'repeat-enabled'} ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-enabled"><&|/l&>Enable Recurrence?</&></label>
+ </div>
+ </div>
+ </div>
+
+ <div class="repeat-toggle <% $ARGSRef->{'repeat-enabled'} ? '' : 'hidden' %> ">
+
+ <div class="form-row">
+ <div class="label input col-4">
+ <&|/l&>Ticket lead time (days)</&>:
+ </div>
+ <div class="value col-auto">
+ <input class="form-control" size="3" name="repeat-lead-time" type="text" value="<% $ARGSRef->{'repeat-lead-time'} %>" />
+ </div>
+ </div>
+
+ <div class="form-row">
+ <div class="label input col-4">
+ <&|/l&>Concurrent active tickets</&>:
+ </div>
+ <div class="value col-auto">
+ <input class="form-control" size="3" name="repeat-coexistent-number" type="text" value="<% $ARGSRef->{'repeat-coexistent-number'} %>" />
+ </div>
+ </div>
+
+ <div class="form-row">
+ <div class="label input col-4">
+ <&|/l&>Recurrence pattern</&>:
+ </div>
+ <div class="value col-auto">
+
+ <div class="form-check form-check-inline">
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-type-daily" name="repeat-type" class="custom-control-input" value="daily" <% ($ARGSRef->{'repeat-type'} || '') eq 'daily' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-type-daily"><&|/l&>Daily</&></label>
+ </div>
+ </div>
+
+ <div class="form-check form-check-inline">
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-type-weekly" name="repeat-type" class="custom-control-input" value="weekly" <% ($ARGSRef->{'repeat-type'} || '') eq 'weekly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-type-weekly"><&|/l&>Weekly</&></label>
+ </div>
+ </div>
+
+ <div class="form-check form-check-inline">
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-type-monthly" name="repeat-type" class="custom-control-input" value="monthly" <% ($ARGSRef->{'repeat-type'} || '') eq 'monthly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-type-monthly"><&|/l&>Monthly</&></label>
+ </div>
+ </div>
+
+ <div class="form-check form-check-inline">
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-type-yearly" name="repeat-type" class="custom-control-input" value="yearly" <% ($ARGSRef->{'repeat-type'} || '') eq 'yearly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-type-yearly"><&|/l&>Yearly</&></label>
+ </div>
+
+ </div>
+
+ <div class="mt-3 repeat-details repeat-details-daily <% ($ARGSRef->{'repeat-type'} || '' ) eq 'daily' ? '' : 'hidden' %>">
+
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-details-daily-day" name="repeat-details-daily" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-daily-day"><&|/l_unsafe, $input->("repeat-details-daily-day") &>Every [_1] Day(s)</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-daily-weekday" name="repeat-details-daily" class="custom-control-input" value="weekday" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'weekday' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-details-daily-weekday"><&|/l&>Every Weekday</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-daily-complete" name="repeat-details-daily" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-daily-complete"><&|/l_unsafe, $input->("repeat-details-daily-complete") &>Create new task [_1] day(s) after each task is completed</&></label>
+ </div>
+
+ </div>
+
+ <div class="mt-3 repeat-details repeat-details-weekly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'weekly' ? '' : 'hidden' %>">
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-details-weekly-week" name="repeat-details-weekly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-weekly-week"><&|/l_unsafe, $input->("repeat-details-weekly-week") &>Recur every [_1] week(s) on</&>:</label>
+ </div>
+
+ <div class="ml-4">
+% for my $number ( 0 .. 6 ) {
+ <div class="form-check form-check-inline">
+ <div class="custom-control custom-checkbox">
+ <input id="repeat-details-weekly-weeks-<% $week_values[$number] %>" name="repeat-details-weekly-weeks" type="checkbox" class="custom-control-input" value="<% $week_values[$number] %>"
+% if ( defined $ARGSRef->{'repeat-details-weekly-weeks'} && (
+% ( ref $ARGSRef->{'repeat-details-weekly-weeks'} && grep { $_ eq $week_values[$number] }
+% @{$ARGSRef->{'repeat-details-weekly-weeks'}} ) ||
+% ( $ARGSRef->{'repeat-details-weekly-weeks'} eq $week_values[$number] ) ) ) {
+ checked="checked"
+% }
+ />
+ <label class="custom-control-label" for="repeat-details-weekly-weeks-<% $week_values[$number] %>"><% loc($week_labels[$number]) %></label>
+ </div>
+ </div>
+% }
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-weekly-complete" name="repeat-details-weekly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-weekly-complete"><&|/l_unsafe, $input->("repeat-details-weekly-complete") &>Create new task [_1] week(s) after each task is completed</&></label>
+ </div>
+
+ </div>
+
+ <div class="mt-3 repeat-details repeat-details-monthly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'monthly' ? '' : 'hidden' %>">
+
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-details-monthly-day" name="repeat-details-monthly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-monthly-day"><&|/l_unsafe, $input->("repeat-details-monthly-day-day"), $input->("repeat-details-monthly-day-month") &>Day [_1] of every [_2] month(s)</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-monthly-week" name="repeat-details-monthly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-monthly-week"><&|/l_unsafe, $nth->("repeat-details-monthly-week-number"), $wday->("repeat-details-monthly-week-week"), $input->("repeat-details-monthly-week-month") &>The [_1] [_2] of every [_3] month(s)</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-monthly-complete" name="repeat-details-monthly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-monthly-complete"><&|/l_unsafe, $input->("repeat-details-monthly-complete") &>Create new task [_1] month(s) after each task is completed</&></label>
+ </div>
+
+ </div>
+
+ <div class="mt-3 repeat-details repeat-details-yearly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'yearly' ? '' : 'hidden' %>">
+
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-details-yearly-day" name="repeat-details-yearly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-yearly-day"><&|/l_unsafe, $month->("repeat-details-yearly-day-month"), $input->("repeat-details-yearly-day-day") &>Every [_1] [_2]</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-yearly-week" name="repeat-details-yearly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-yearly-week"><&|/l_unsafe, $nth->("repeat-details-yearly-week-number"), $wday->("repeat-details-yearly-week-week"), $month->("repeat-details-yearly-week-month") &>The [_1] [_2] of [_3]</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-details-yearly-complete" name="repeat-details-yearly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-details-yearly-complete"><&|/l_unsafe, $input->("repeat-details-yearly-complete") &>Create new task [_1] year(s) after each task is completed</&></label>
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+
+ <div class="form-row mt-2">
+ <div class="label input col-4">
+ <&|/l&>Start of recurrence</&>:
+ </div>
+ <div class="value col-auto">
<& /Elements/SelectDate, Name => 'repeat-start-date', ShowTime => 0, Default => $ARGSRef->{'repeat-start-date'} || '' &>
- </label>
- </td>
- <td>
- <label>
- <input type="radio" name="repeat-end" value="none" <% ($ARGSRef->{'repeat-end'} || '') eq 'none' ? 'checked="checked"' : '' |n %>> <&|/l&>No end date</&>
- </label>
- </td>
-</tr>
-<tr>
- <td>
- <label><input type="radio" name="repeat-end" value="number" <% ($ARGSRef->{'repeat-end'} || '') eq 'number' ? 'checked="checked"' : '' |n %>>
- <&|/l_unsafe, $input->("repeat-end-number",6,10) &>End after [_1] occurrence(s)</&>
-% if ( $Initial ) {
- <input name="repeat-occurrences" type="hidden" value="1">
-% } else {
- <&|/l&>Current</&>: <input size="6" type="text" name="repeat-occurrences" readonly="readonly" value="<% $ARGSRef->{'repeat-occurrences'} %>"></label>
-% }
- </td>
-</tr>
-<tr>
- <td>
- <label><input type="radio" name="repeat-end" value="date" <% ($ARGSRef->{'repeat-end'} || '') eq 'date' ? 'checked="checked"' : '' |n %>> <&|/l&>End by</&>:
- <& /Elements/SelectDate, Name => 'repeat-end-date', ShowTime => 0, Default => $ARGSRef->{'repeat-end-date'} || '' &></label>
- </td>
-</tr>
-</table>
-</fieldset>
+ </div>
+ </div>
-</div>
+ <div class="form-row">
+ <div class="label input col-4">
+ <&|/l&>End of recurrence</&>:
+ </div>
+ <div class="value col-auto form-check">
+
+ <div class="custom-control custom-radio">
+ <input type="radio" id="repeat-end-none" name="repeat-end" class="custom-control-input" value="none" <% ($ARGSRef->{'repeat-end'} || '') eq 'none' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="repeat-end-none"><&|/l&>No end date</&></label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-end-number" name="repeat-end" class="custom-control-input" value="number" <% ($ARGSRef->{'repeat-end'} || '') eq 'number' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-end-number"><&|/l_unsafe, $input->("repeat-end-number",6,10) &>End after [_1] occurrence(s)</&>
+% if ( $Initial ) {
+ <input name="repeat-occurrences" type="hidden" value="1">
+% } else {
+ <&|/l&>Current</&>: <input size="6" type="text" name="repeat-occurrences" readonly="readonly" value="<% $ARGSRef->{'repeat-occurrences'} %>">
+% }
+ </label>
+ </div>
+
+ <div class="mt-1 custom-control custom-radio">
+ <input type="radio" id="repeat-end-date" name="repeat-end" class="custom-control-input" value="date" <% ($ARGSRef->{'repeat-end'} || '') eq 'date' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="repeat-end-date">
+ <&|/l&>End by</&>: <& /Elements/SelectDate, Name => 'repeat-end-date', ShowTime => 0, Default => $ARGSRef->{'repeat-end-date'} || '' &>
+ </label>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
<%init>
@@ -242,7 +256,7 @@ my $input = sub {
my ($name, $width, $default) = (@_);
$width ||= 4; $default ||= 1;
my $escaped = $m->interp->apply_escapes($name, "h");
- return qq|<input name="$escaped" type="text" size="$width" value="|
+ return qq|<input name="$escaped" type="text" size="$width" class="form-control" value="|
. $m->interp->apply_escapes($ARGSRef->{$name} || $default, "h")
. qq|" />|;
};
@@ -250,7 +264,7 @@ my $input = sub {
my $nth = sub {
my ($name) = @_;
my $escaped = $m->interp->apply_escapes($name, "h");
- my $str = qq|<select name="$escaped">|;
+ my $str = qq|<select class="form-control selectpicker" name="$escaped">|;
for my $number ( 1 .. 4, -1 ) {
$str .= qq|<option value="$number" |
. (($ARGSRef->{$name} || '') eq $number ? 'selected="selected"' : '') . ">"
@@ -263,7 +277,7 @@ my $nth = sub {
my $wday = sub {
my ($name) = @_;
my $escaped = $m->interp->apply_escapes($name, "h");
- my $str = qq|<select name="$escaped">|;
+ my $str = qq|<select class="form-control selectpicker" name="$escaped">|;
for my $number ( 0 .. 6 ) {
$str .= qq|<option value="$week_values[$number]" |
. (($ARGSRef->{$name} || '') eq $week_values[$number] ? 'selected="selected"' : '' ) . ">"
@@ -276,7 +290,7 @@ my $wday = sub {
my $month = sub {
my ($name) = @_;
my $escaped = $m->interp->apply_escapes($name, "h");
- my $str = qq|<select name="$escaped">|;
+ my $str = qq|<select class="form-control selectpicker" name="$escaped">|;
for my $number ( 1 .. 12 ) {
$str .= qq|<option value="$number" |
. (($ARGSRef->{$name} || '') eq $number ? 'selected="selected"' : '') . ">"
diff --git a/html/Ticket/ModifyRecurrence.html b/html/Ticket/ModifyRecurrence.html
index de8e100..9821c63 100644
--- a/html/Ticket/ModifyRecurrence.html
+++ b/html/Ticket/ModifyRecurrence.html
@@ -4,12 +4,17 @@
<& /Elements/ListActions, actions => \@results &>
% unless ( $skip ) {
-<form method="post" name="ModifyRecurrence" action="ModifyRecurrence.html">
+<form method="post" name="ModifyRecurrence" action="ModifyRecurrence.html" class="mx-auto max-width-lg">
<input type="hidden" class="hidden" name="id" value="<%$TicketObj->Id%>" />
<&| /Widgets/TitleBox,title => loc('Modify recurrence for ticket # [_1]', $TicketObj->Id), class=> 'ticket-info-repeat' &>
<& Elements/EditRecurrence, Ticket => $TicketObj, ARGSRef => $ARGSRef &>
</&>
-<& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes') &>
+
+ <div class="form-row">
+ <div class="col-12">
+ <& /Elements/Submit, Name => 'SubmitTicket', Label => loc('Save Changes') &>
+ </div>
+ </div>
</form>
% }
diff --git a/static/css/repeat-ticket.css b/static/css/repeat-ticket.css
index b8d1460..4d17888 100644
--- a/static/css/repeat-ticket.css
+++ b/static/css/repeat-ticket.css
@@ -1 +1,22 @@
-.ticket-info-repeat-recurrence .titlebox .titlebox-title .left { background-color: #B23 }
+.ticket-info-repeat-recurrence .titlebox.card {
+ border-top: 3px solid #B23;
+}
+
+.ticket-info-repeat .form-row .form-check {
+ margin-top: 5px;
+}
+
+
+.ticket-info-repeat .custom-control-label.has-text-input::before,
+.ticket-info-repeat .custom-control-label.has-text-input::after {
+ top: 0.5rem;
+}
+
+.ticket-info-repeat .form-control {
+ display: inline;
+ width: auto;
+}
+
+.ticket-info-repeat .bootstrap-select > .dropdown-toggle {
+ width: auto;
+}
commit 9829635302494547d50d9f2b326d26674ce52302
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 05:53:01 2020 +0800
Update tests to make them pass on RT 5
diff --git a/xt/cf.t b/xt/cf.t
index ea291f2..3b2308f 100644
--- a/xt/cf.t
+++ b/xt/cf.t
@@ -13,11 +13,7 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue' }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
@@ -38,6 +34,7 @@ $m->submit_form_ok(
'repeat-details-daily' => 'day',
'repeat-details-daily-day' => 1,
},
+ button => 'SubmitTicket',
},
'Create'
);
diff --git a/xt/daily.t b/xt/daily.t
index 862cb71..061b17e 100644
--- a/xt/daily.t
+++ b/xt/daily.t
@@ -79,26 +79,26 @@ sub run_tests{
ok( $m->login( 'root', 'password' ), 'logged in' );
- $m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+ $m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a ticket with a recurrence in the General queue.";
- $m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up recurring aperture maintenance',
- 'Content' => 'Perform work on portals once per day',
- 'repeat-enabled' => 1,
- 'repeat-type' => 'daily',
- 'repeat-details-daily' => 'day',
- 'repeat-details-daily-day' => 1,
- },}, 'Create');
+ $m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up recurring aperture maintenance',
+ 'Content' => 'Perform work on portals once per day',
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'daily',
+ 'repeat-details-daily' => 'day',
+ 'repeat-details-daily-day' => 1,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+ );
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/end_conditions.t b/xt/end_conditions.t
index cae27a9..7f66a7a 100644
--- a/xt/end_conditions.t
+++ b/xt/end_conditions.t
@@ -101,26 +101,26 @@ sub run_tests{
ok( $m->login( 'root', 'password' ), 'logged in' );
- $m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+ $m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a ticket with a recurrence in the General queue.";
- $m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up recurring aperture maintenance',
- 'Content' => 'Perform work on portals once per day',
- 'repeat-enabled' => 1,
- 'repeat-type' => 'daily',
- 'repeat-details-daily' => 'day',
- 'repeat-details-daily-day' => 1,
- },}, 'Create');
+ $m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up recurring aperture maintenance',
+ 'Content' => 'Perform work on portals once per day',
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'daily',
+ 'repeat-details-daily' => 'day',
+ 'repeat-details-daily-day' => 1,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+ );
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/monthly.t b/xt/monthly.t
index 33ec223..78548aa 100644
--- a/xt/monthly.t
+++ b/xt/monthly.t
@@ -12,29 +12,29 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a ticket with a recurrence in the General queue.";
my $day = DateTime->now;
-$m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up monthly aperture maintenance',
- 'Content' => 'Perform work on portals on the first of each month',
- 'repeat-lead-time' => 14,
- 'repeat-coexistent-number' => 1,
- 'repeat-enabled' => 1,
- 'repeat-type' => 'monthly',
- 'repeat-details-monthly-day-day' => $day->day,
- 'repeat-details-monthly-day-month' => 1,
- },}, 'Create');
+$m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up monthly aperture maintenance',
+ 'Content' => 'Perform work on portals on the first of each month',
+ 'repeat-lead-time' => 14,
+ 'repeat-coexistent-number' => 1,
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'monthly',
+ 'repeat-details-monthly-day-day' => $day->day,
+ 'repeat-details-monthly-day-month' => 1,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+);
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/on_complete.t b/xt/on_complete.t
index 04bc090..cd97521 100644
--- a/xt/on_complete.t
+++ b/xt/on_complete.t
@@ -10,27 +10,27 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a recurrence that starts based on completion of previous ticket.";
my $day = DateTime->now;
-$m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up monthly aperture maintenance',
- 'Content' => 'Perform work on portals on the first of each month',
- 'repeat-enabled' => 1,
- 'repeat-type' => 'monthly',
- 'repeat-details-monthly' => 'complete',
- 'repeat-details-monthly-complete' => 0,
- },}, 'Create');
+$m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up monthly aperture maintenance',
+ 'Content' => 'Perform work on portals on the first of each month',
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'monthly',
+ 'repeat-details-monthly' => 'complete',
+ 'repeat-details-monthly-complete' => 0,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+);
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/start_date.t b/xt/start_date.t
index 69476e8..c85620d 100644
--- a/xt/start_date.t
+++ b/xt/start_date.t
@@ -10,11 +10,7 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
@@ -23,20 +19,24 @@ diag "Create a ticket with a recurrence in the General queue.";
my $day = DateTime->now->add( days => 14 ); # Start in two weeks
diag "Repeat start date is: " . $day->ymd;
-$m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up recurring aperture maintenance',
- 'Content' => 'Perform work on portals on Thursday',
- 'repeat-lead-time' => 7,
- 'repeat-coexistent-number' => 2,
- 'repeat-enabled' => 1,
- 'repeat-type' => 'weekly',
- 'repeat-details-weekly' => 'week',
- 'repeat-details-weekly-week' => 1,
- 'repeat-details-weekly-weeks' => 'th',
- 'repeat-start-date' => $day->ymd,
- },}, 'Create');
+$m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up recurring aperture maintenance',
+ 'Content' => 'Perform work on portals on Thursday',
+ 'repeat-lead-time' => 7,
+ 'repeat-coexistent-number' => 2,
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'weekly',
+ 'repeat-details-weekly' => 'week',
+ 'repeat-details-weekly-week' => 1,
+ 'repeat-details-weekly-weeks' => 'th',
+ 'repeat-start-date' => $day->ymd,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+);
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/weekly.t b/xt/weekly.t
index 8767b65..51790db 100644
--- a/xt/weekly.t
+++ b/xt/weekly.t
@@ -10,29 +10,29 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a ticket with a recurrence in the General queue.";
-$m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up recurring aperture maintenance',
- 'Content' => 'Perform work on portals on Tuesday and Thursday',
- 'repeat-lead-time' => 7,
- 'repeat-coexistent-number' => 2,
- 'repeat-enabled' => 1,
- 'repeat-type' => 'weekly',
- 'repeat-details-weekly' => 'week',
- 'repeat-details-weekly-week' => 1,
- 'repeat-details-weekly-weeks' => 'th',
- },}, 'Create');
+$m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up recurring aperture maintenance',
+ 'Content' => 'Perform work on portals on Tuesday and Thursday',
+ 'repeat-lead-time' => 7,
+ 'repeat-coexistent-number' => 2,
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'weekly',
+ 'repeat-details-weekly' => 'week',
+ 'repeat-details-weekly-week' => 1,
+ 'repeat-details-weekly-weeks' => 'th',
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+);
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
diff --git a/xt/yearly.t b/xt/yearly.t
index ff3ed94..0d65f6a 100644
--- a/xt/yearly.t
+++ b/xt/yearly.t
@@ -10,29 +10,29 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
ok( $m->login( 'root', 'password' ), 'logged in' );
-$m->submit_form_ok({
- form_name => 'CreateTicketInQueue',
- fields => {
- 'Queue' => 'General' },
- }, 'Click to create ticket');
+$m->submit_form_ok( { form_name => 'CreateTicketInQueue', }, 'Click to create ticket' );
$m->content_contains('Enable Recurrence');
diag "Create a ticket with a recurrence in the General queue.";
my $day = DateTime->now;
-$m->submit_form_ok({
- form_name => 'TicketCreate',
- fields => {
- 'Subject' => 'Set up monthly aperture maintenance',
- 'Content' => 'Perform work on portals on the first of each month',
- 'repeat-lead-time' => 21,
- 'repeat-coexistent-number' => 1,
- 'repeat-enabled' => 1,
- 'repeat-type' => 'yearly',
- 'repeat-details-yearly-day-month' => $day->month,
- 'repeat-details-yearly-day-day' => $day->day,
- },}, 'Create');
+$m->submit_form_ok(
+ { form_name => 'TicketCreate',
+ fields => {
+ 'Subject' => 'Set up monthly aperture maintenance',
+ 'Content' => 'Perform work on portals on the first of each month',
+ 'repeat-lead-time' => 21,
+ 'repeat-coexistent-number' => 1,
+ 'repeat-enabled' => 1,
+ 'repeat-type' => 'yearly',
+ 'repeat-details-yearly-day-month' => $day->month,
+ 'repeat-details-yearly-day-day' => $day->day,
+ },
+ button => 'SubmitTicket',
+ },
+ 'Create'
+);
$m->text_like( qr/Ticket\s(\d+)\screated in queue/);
commit 36a899b811282e3aba0a39e322cd534201da7194
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 05:54:47 2020 +0800
Remove unnecessary "undef $m"
diff --git a/xt/cf.t b/xt/cf.t
index 3b2308f..7bb9ab0 100644
--- a/xt/cf.t
+++ b/xt/cf.t
@@ -70,5 +70,4 @@ ok( RT::Extension::RepeatTicket::SetRepeatAttribute(
is( $ticket->FirstCustomFieldValue('Original Ticket'),
undef, 'Original Ticket is unset' );
-undef $m;
done_testing;
diff --git a/xt/daily.t b/xt/daily.t
index 061b17e..e220327 100644
--- a/xt/daily.t
+++ b/xt/daily.t
@@ -112,5 +112,4 @@ sub run_tests{
return $daily_id;
}
-undef $m;
done_testing;
diff --git a/xt/monthly.t b/xt/monthly.t
index 78548aa..be27f1b 100644
--- a/xt/monthly.t
+++ b/xt/monthly.t
@@ -64,5 +64,4 @@ is( $ticket2->DueObj->ISO(Time => 0), $day->ymd, 'Due on: ' . $day->ymd);
is( $ticket2->Subject, $ticket2->DueObj->AsString . ' Set up monthly aperture maintenance',
'Ticket subject matches subject configuration: ' . $ticket2->Subject);
-undef $m;
done_testing;
commit 760ad959f70736c0efdb143d175c83b58101b426
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 06:26:35 2020 +0800
Bump version to 2.0 for RT 5
This big version bump makes it more notable that it's not a back
compatible version.
diff --git a/META.yml b/META.yml
index 63b3997..e099972 100644
--- a/META.yml
+++ b/META.yml
@@ -27,6 +27,6 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '1.11'
+version: '2.00'
x_module_install_rtx_version: '0.39'
x_requires_rt: 4.0.6
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index 7d1dec7..04bc8d5 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -3,7 +3,7 @@ use strict;
package RT::Extension::RepeatTicket;
-our $VERSION = "1.11";
+our $VERSION = "2.00";
use RT::Interface::Web;
use DateTime;
commit 0bd166c65ec5fa03c41620c4fb8badef2558f1db
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 06:25:12 2020 +0800
Support RT 5.0 and update docs accordingly
diff --git a/META.yml b/META.yml
index e099972..82ad80c 100644
--- a/META.yml
+++ b/META.yml
@@ -24,9 +24,9 @@ no_index:
- xt
requires:
DateTime::Event::ICal: 0
- perl: 5.8.3
+ perl: 5.10.1
resources:
license: http://opensource.org/licenses/gpl-license.php
version: '2.00'
x_module_install_rtx_version: '0.39'
-x_requires_rt: 4.0.6
+x_requires_rt: 5.0.0
diff --git a/Makefile.PL b/Makefile.PL
index ccf3d68..fce17aa 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -3,11 +3,11 @@ RTx('RT-Extension-RepeatTicket');
requires('DateTime::Event::ICal');
-requires_rt('4.0.6');
+requires_rt('5.0.0');
my ($lp) = ($INC{'RT.pm'} =~ /^(.*)[\\\/]/);
my $lib_path = join( ' ', "$RT::LocalPath/lib", $lp );
-my $bin_path = $RT::BinPath || "$RT::BasePath/bin" || "/opt/rt4/bin";
+my $bin_path = $RT::BinPath || "$RT::BasePath/bin" || "/opt/rt5/bin";
# Straight from perldoc perlvar
use Config;
diff --git a/README b/README
index 7fbf9c4..a075562 100644
--- a/README
+++ b/README
@@ -16,6 +16,9 @@ DESCRIPTION
tickets are needed, and when your daily cron job runs the
rt-repeat-ticket script.
+RT VERSION
+ Works with RT 5.0. Check out 1.* versions if you are still using RT 4.
+
INSTALLATION
perl Makefile.PL
make
@@ -31,19 +34,13 @@ INSTALLATION
If you are upgrading this module, check for upgrading instructions
in case changes need to be made to your database.
- Edit your /opt/rt4/etc/RT_SiteConfig.pm
- If you are using RT 4.2 or greater, add this line:
+ Edit your /opt/rt5/etc/RT_SiteConfig.pm
+ Add this line:
Plugin('RT::Extension::RepeatTicket');
- For RT 4.0, add this line:
-
- Set(@Plugins, qw(RT::Extension::RepeatTicket));
-
- or add RT::Extension::RepeatTicket to your existing @Plugins line.
-
Clear your mason cache
- rm -rf /opt/rt4/var/mason_data/obj
+ rm -rf /opt/rt5/var/mason_data/obj
Add bin/rt-repeat-ticket to the daily cron job.
Restart your webserver
diff --git a/bin/rt-repeat-ticket.in b/bin/rt-repeat-ticket.in
index 87b132f..7832924 100755
--- a/bin/rt-repeat-ticket.in
+++ b/bin/rt-repeat-ticket.in
@@ -8,7 +8,7 @@ package RT::Repeat::Ticket::Run;
BEGIN {
### after: use lib qw(@RT_LIB_PATH@);
-use lib '/opt/rt4/local/lib /opt/rt4/lib';
+use lib '/opt/rt5/local/lib /opt/rt5/lib';
use RT;
RT::LoadConfig;
RT::Init;
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index 04bc8d5..b95b0ad 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -782,6 +782,10 @@ New tickets are created when you initially save the recurrence, if new
tickets are needed, and when your daily cron job runs the rt-repeat-ticket
script.
+=head1 RT VERSION
+
+Works with RT 5.0. Check out 1.* versions if you are still using RT 4.
+
=head1 INSTALLATION
=over
@@ -804,21 +808,15 @@ in your database.
If you are upgrading this module, check for upgrading instructions
in case changes need to be made to your database.
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
-If you are using RT 4.2 or greater, add this line:
+Add this line:
Plugin('RT::Extension::RepeatTicket');
-For RT 4.0, add this line:
-
- Set(@Plugins, qw(RT::Extension::RepeatTicket));
-
-or add C<RT::Extension::RepeatTicket> to your existing C<@Plugins> line.
-
=item Clear your mason cache
- rm -rf /opt/rt4/var/mason_data/obj
+ rm -rf /opt/rt5/var/mason_data/obj
=item Add F<bin/rt-repeat-ticket> to the daily cron job.
diff --git a/lib/RT/Extension/RepeatTicket/Test.pm.in b/lib/RT/Extension/RepeatTicket/Test.pm.in
index 0f4ef53..f994543 100644
--- a/lib/RT/Extension/RepeatTicket/Test.pm.in
+++ b/lib/RT/Extension/RepeatTicket/Test.pm.in
@@ -2,7 +2,7 @@ use strict;
use warnings;
### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/opt/rt5/local/lib /opt/rt5/lib);
package RT::Extension::RepeatTicket::Test;
commit 40f66a6087e455e8091383199e2eebc9d243db3b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 10 06:22:38 2020 +0800
Update M:I
diff --git a/META.yml b/META.yml
index 82ad80c..eafebb8 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.18'
+generated_by: 'Module::Install version 1.19'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,5 +28,5 @@ requires:
resources:
license: http://opensource.org/licenses/gpl-license.php
version: '2.00'
-x_module_install_rtx_version: '0.39'
+x_module_install_rtx_version: '0.42'
x_requires_rt: 5.0.0
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index 51e7e97..8852e0b 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -8,7 +8,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
}
# special map on pre-defined feature sets
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 07525c5..7ba98c2 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.18';
+ $VERSION = '1.19';
# Storage for the pseudo-singleton
$MAIN = undef;
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index 75f61e8..0e3dada 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b61d424..9fa42c2 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 1de368c..d65c753 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 54b52cb..3072b08 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 087da8d..13fdcd0 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 8ba3d88..13a4464 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 692ce71..11bf971 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 3268e7e..2dd9489 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -6,9 +6,10 @@ use strict;
use warnings;
no warnings 'once';
+use Term::ANSIColor qw(:constants);
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.39';
+our $VERSION = '0.42';
use FindBin;
use File::Glob ();
@@ -53,7 +54,7 @@ sub RTx {
my @look = @INC;
unshift @look, grep {defined and -d $_} @try;
push @look, grep {defined and -d $_}
- map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+ map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
warn
@@ -76,6 +77,22 @@ sub RTx {
$self->requires_rt('4.0.0');
}
+ my $package = $name;
+ $package =~ s/-/::/g;
+ if ( $RT::CORED_PLUGINS{$package} ) {
+ my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
+ die RED, <<"EOT";
+
+**** Error: Your installed version of RT ($RT::VERSION) already
+ contains this extension in core, so you don't need to
+ install it.
+
+ Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
+ to configure it.
+
+EOT
+ }
+
# Installation locations
my %path;
my $plugin_path;
@@ -223,7 +240,7 @@ sub requires_rt {
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[-1] eq $version) {
- die <<"EOT";
+ die RED, <<"EOT";
**** Error: This extension requires RT $version. Your installed version
of RT ($RT::VERSION) is too old.
@@ -249,12 +266,12 @@ sub requires_rt_plugin {
unshift @INC, $path;
} else {
my $name = $self->name;
- warn <<"EOT";
+ my $msg = <<"EOT";
**** Warning: $name requires that the $plugin plugin be installed and
enabled; it does not appear to be installed.
-
EOT
+ warn RED, $msg, RESET, "\n";
}
$self->requires(@_);
}
@@ -264,9 +281,8 @@ sub rt_too_new {
my $name = $self->name;
$msg ||= <<EOT;
-**** Error: Your installed version of RT (%s) is too new; this extension
- only works with versions older than %s.
-
+**** Warning: Your installed version of RT (%s) is too new; this extension
+ has not been tested on your version of RT and may not work as expected.
EOT
$self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
@@ -274,7 +290,7 @@ EOT
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[0] eq $version) {
- die sprintf($msg,$RT::VERSION,$version);
+ warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
}
}
@@ -297,4 +313,4 @@ sub _load_rt_handle {
__END__
-#line 468
+#line 484
diff --git a/inc/Module/Install/RTx/Runtime.pm b/inc/Module/Install/RTx/Runtime.pm
index 937949f..ae07502 100644
--- a/inc/Module/Install/RTx/Runtime.pm
+++ b/inc/Module/Install/RTx/Runtime.pm
@@ -33,6 +33,7 @@ sub RTxDatabase {
my $lib_path = File::Basename::dirname($INC{'RT.pm'});
my @args = (
+ "-I.",
"-Ilib",
"-I$RT::LocalLibPath",
"-I$lib_path",
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index b80c900..f7aa615 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index da279c7..2db861a 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index 4fd023d..fb157a6 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,12 +2,12 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
-package YAML::Tiny; # git description: v1.69-8-g2c1e266
+package YAML::Tiny; # git description: v1.72-7-g8682f63
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
-our $VERSION = '1.70';
+our $VERSION = '1.73';
#####################################################################
# The YAML::Tiny API.
@@ -374,7 +374,7 @@ sub _load_scalar {
while ( @$lines ) {
$lines->[0] =~ /^(\s*)/;
last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
+ push @multiline, substr(shift(@$lines), $indent->[-1]);
}
my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
commit 639209b04baa287480de6565b5e2214583b4b4c0
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Jul 16 02:27:00 2020 +0800
Add "." to @INC for perl 5.26+
diff --git a/Makefile.PL b/Makefile.PL
index fce17aa..453caea 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,3 +1,4 @@
+use lib '.';
use inc::Module::Install;
RTx('RT-Extension-RepeatTicket');
commit 271cecfe586e37820a46654765ef62e2edc2a816
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Jul 29 06:02:03 2020 +0800
Update copyright year to 2020
diff --git a/README b/README
index a075562..2874254 100644
--- a/README
+++ b/README
@@ -197,7 +197,7 @@ BUGS
L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-RepeatTicket>.
LICENSE AND COPYRIGHT
- This software is Copyright (c) 2014 by Best Practical Solutions
+ This software is Copyright (c) 2014-2020 by Best Practical Solutions
This is free software, licensed under:
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index b95b0ad..7e51768 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -1019,7 +1019,7 @@ or via the web at
=head1 LICENSE AND COPYRIGHT
-This software is Copyright (c) 2014 by Best Practical Solutions
+This software is Copyright (c) 2014-2020 by Best Practical Solutions
This is free software, licensed under:
commit 6a865ad4543febf045bd699553a3b695a1e5364f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Jul 29 06:09:08 2020 +0800
Prep 2.00
diff --git a/Changes b/Changes
index a215aea..589ca3e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for RT-Extension-RepeatTicket
+2.00 2020-07-28
+ - Add RT 5 Support(RT 4 users need to use 1.* versions)
+
1.11 2017-11-07
- Correctly display concurrent ticket number of 0
commit e694501ef7e37eec9368e8756d00e33bdb4bc4b1
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Oct 1 01:12:20 2020 +0800
Check ModifyTicket right before making changes
diff --git a/html/Ticket/ModifyRecurrence.html b/html/Ticket/ModifyRecurrence.html
index 9821c63..3c0c78d 100644
--- a/html/Ticket/ModifyRecurrence.html
+++ b/html/Ticket/ModifyRecurrence.html
@@ -32,9 +32,14 @@ unless( $cf->id && ( $cf->can('IsAdded') ? ( $cf->IsAdded(0) || $cf->IsAdded($Ti
}
if ( $ARGS{SubmitTicket} ) {
- my ( $ret, $message ) = RT::Extension::RepeatTicket::SetRepeatAttribute( $TicketObj, %ARGS );
- $ARGSRef = \%ARGS if not $ret; # Save params on failure
- push @results, $message;
+ if ( $TicketObj->CurrentUserHasRight('ModifyTicket') ) {
+ my ( $ret, $message ) = RT::Extension::RepeatTicket::SetRepeatAttribute( $TicketObj, %ARGS );
+ $ARGSRef = \%ARGS if not $ret; # Save params on failure
+ push @results, $message;
+ }
+ else {
+ push @results, loc('Permission Denied');
+ }
}
</%INIT>
commit 3c436ed45b75014afc40d0b08d30fbe67e0f8025
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Oct 1 01:06:59 2020 +0800
Add $InputIdPrefix support to have multiple EditRecurrence HTML on a page
HTML id is not allowed to duplicate on a page. This is for inline edit,
where we need to call EditRecurrence twice, for display and modify,
respectively.
diff --git a/html/Ticket/Elements/EditRecurrence b/html/Ticket/Elements/EditRecurrence
index d5200ee..8fd5258 100644
--- a/html/Ticket/Elements/EditRecurrence
+++ b/html/Ticket/Elements/EditRecurrence
@@ -27,8 +27,8 @@ jQuery( function () {
<div class="label col-4"></div>
<div class="value col-auto">
<div class="custom-control custom-checkbox">
- <input type="checkbox" id="repeat-enabled" name="repeat-enabled" class="custom-control-input" value="1" <% $ARGSRef->{'repeat-enabled'} ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-enabled"><&|/l&>Enable Recurrence?</&></label>
+ <input type="checkbox" id="<% $InputIdPrefix %>repeat-enabled" name="repeat-enabled" class="custom-control-input" value="1" <% $ARGSRef->{'repeat-enabled'} ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-enabled"><&|/l&>Enable Recurrence?</&></label>
</div>
</div>
</div>
@@ -61,29 +61,29 @@ jQuery( function () {
<div class="form-check form-check-inline">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-type-daily" name="repeat-type" class="custom-control-input" value="daily" <% ($ARGSRef->{'repeat-type'} || '') eq 'daily' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-type-daily"><&|/l&>Daily</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-type-daily" name="repeat-type" class="custom-control-input" value="daily" <% ($ARGSRef->{'repeat-type'} || '') eq 'daily' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-type-daily"><&|/l&>Daily</&></label>
</div>
</div>
<div class="form-check form-check-inline">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-type-weekly" name="repeat-type" class="custom-control-input" value="weekly" <% ($ARGSRef->{'repeat-type'} || '') eq 'weekly' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-type-weekly"><&|/l&>Weekly</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-type-weekly" name="repeat-type" class="custom-control-input" value="weekly" <% ($ARGSRef->{'repeat-type'} || '') eq 'weekly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-type-weekly"><&|/l&>Weekly</&></label>
</div>
</div>
<div class="form-check form-check-inline">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-type-monthly" name="repeat-type" class="custom-control-input" value="monthly" <% ($ARGSRef->{'repeat-type'} || '') eq 'monthly' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-type-monthly"><&|/l&>Monthly</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-type-monthly" name="repeat-type" class="custom-control-input" value="monthly" <% ($ARGSRef->{'repeat-type'} || '') eq 'monthly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-type-monthly"><&|/l&>Monthly</&></label>
</div>
</div>
<div class="form-check form-check-inline">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-type-yearly" name="repeat-type" class="custom-control-input" value="yearly" <% ($ARGSRef->{'repeat-type'} || '') eq 'yearly' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-type-yearly"><&|/l&>Yearly</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-type-yearly" name="repeat-type" class="custom-control-input" value="yearly" <% ($ARGSRef->{'repeat-type'} || '') eq 'yearly' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-type-yearly"><&|/l&>Yearly</&></label>
</div>
</div>
@@ -91,33 +91,33 @@ jQuery( function () {
<div class="mt-3 repeat-details repeat-details-daily <% ($ARGSRef->{'repeat-type'} || '' ) eq 'daily' ? '' : 'hidden' %>">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-details-daily-day" name="repeat-details-daily" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-daily-day"><&|/l_unsafe, $input->("repeat-details-daily-day") &>Every [_1] Day(s)</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-daily-day" name="repeat-details-daily" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-daily-day"><&|/l_unsafe, $input->("repeat-details-daily-day") &>Every [_1] Day(s)</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-daily-weekday" name="repeat-details-daily" class="custom-control-input" value="weekday" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'weekday' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-details-daily-weekday"><&|/l&>Every Weekday</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-daily-weekday" name="repeat-details-daily" class="custom-control-input" value="weekday" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'weekday' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-details-daily-weekday"><&|/l&>Every Weekday</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-daily-complete" name="repeat-details-daily" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-daily-complete"><&|/l_unsafe, $input->("repeat-details-daily-complete") &>Create new task [_1] day(s) after each task is completed</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-daily-complete" name="repeat-details-daily" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-daily'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-daily-complete"><&|/l_unsafe, $input->("repeat-details-daily-complete") &>Create new task [_1] day(s) after each task is completed</&></label>
</div>
</div>
<div class="mt-3 repeat-details repeat-details-weekly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'weekly' ? '' : 'hidden' %>">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-details-weekly-week" name="repeat-details-weekly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-weekly-week"><&|/l_unsafe, $input->("repeat-details-weekly-week") &>Recur every [_1] week(s) on</&>:</label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-weekly-week" name="repeat-details-weekly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-weekly-week"><&|/l_unsafe, $input->("repeat-details-weekly-week") &>Recur every [_1] week(s) on</&>:</label>
</div>
<div class="ml-4">
% for my $number ( 0 .. 6 ) {
<div class="form-check form-check-inline">
<div class="custom-control custom-checkbox">
- <input id="repeat-details-weekly-weeks-<% $week_values[$number] %>" name="repeat-details-weekly-weeks" type="checkbox" class="custom-control-input" value="<% $week_values[$number] %>"
+ <input id="<% $InputIdPrefix %>repeat-details-weekly-weeks-<% $week_values[$number] %>" name="repeat-details-weekly-weeks" type="checkbox" class="custom-control-input" value="<% $week_values[$number] %>"
% if ( defined $ARGSRef->{'repeat-details-weekly-weeks'} && (
% ( ref $ARGSRef->{'repeat-details-weekly-weeks'} && grep { $_ eq $week_values[$number] }
% @{$ARGSRef->{'repeat-details-weekly-weeks'}} ) ||
@@ -125,15 +125,15 @@ jQuery( function () {
checked="checked"
% }
/>
- <label class="custom-control-label" for="repeat-details-weekly-weeks-<% $week_values[$number] %>"><% loc($week_labels[$number]) %></label>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-details-weekly-weeks-<% $week_values[$number] %>"><% loc($week_labels[$number]) %></label>
</div>
</div>
% }
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-weekly-complete" name="repeat-details-weekly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-weekly-complete"><&|/l_unsafe, $input->("repeat-details-weekly-complete") &>Create new task [_1] week(s) after each task is completed</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-weekly-complete" name="repeat-details-weekly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-weekly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-weekly-complete"><&|/l_unsafe, $input->("repeat-details-weekly-complete") &>Create new task [_1] week(s) after each task is completed</&></label>
</div>
</div>
@@ -141,18 +141,18 @@ jQuery( function () {
<div class="mt-3 repeat-details repeat-details-monthly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'monthly' ? '' : 'hidden' %>">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-details-monthly-day" name="repeat-details-monthly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-monthly-day"><&|/l_unsafe, $input->("repeat-details-monthly-day-day"), $input->("repeat-details-monthly-day-month") &>Day [_1] of every [_2] month(s)</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-monthly-day" name="repeat-details-monthly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-monthly-day"><&|/l_unsafe, $input->("repeat-details-monthly-day-day"), $input->("repeat-details-monthly-day-month") &>Day [_1] of every [_2] month(s)</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-monthly-week" name="repeat-details-monthly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-monthly-week"><&|/l_unsafe, $nth->("repeat-details-monthly-week-number"), $wday->("repeat-details-monthly-week-week"), $input->("repeat-details-monthly-week-month") &>The [_1] [_2] of every [_3] month(s)</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-monthly-week" name="repeat-details-monthly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-monthly-week"><&|/l_unsafe, $nth->("repeat-details-monthly-week-number"), $wday->("repeat-details-monthly-week-week"), $input->("repeat-details-monthly-week-month") &>The [_1] [_2] of every [_3] month(s)</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-monthly-complete" name="repeat-details-monthly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-monthly-complete"><&|/l_unsafe, $input->("repeat-details-monthly-complete") &>Create new task [_1] month(s) after each task is completed</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-monthly-complete" name="repeat-details-monthly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-monthly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-monthly-complete"><&|/l_unsafe, $input->("repeat-details-monthly-complete") &>Create new task [_1] month(s) after each task is completed</&></label>
</div>
</div>
@@ -160,18 +160,18 @@ jQuery( function () {
<div class="mt-3 repeat-details repeat-details-yearly <% ($ARGSRef->{'repeat-type'} || '' ) eq 'yearly' ? '' : 'hidden' %>">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-details-yearly-day" name="repeat-details-yearly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-yearly-day"><&|/l_unsafe, $month->("repeat-details-yearly-day-month"), $input->("repeat-details-yearly-day-day") &>Every [_1] [_2]</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-yearly-day" name="repeat-details-yearly" class="custom-control-input" value="day" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'day' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-yearly-day"><&|/l_unsafe, $month->("repeat-details-yearly-day-month"), $input->("repeat-details-yearly-day-day") &>Every [_1] [_2]</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-yearly-week" name="repeat-details-yearly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-yearly-week"><&|/l_unsafe, $nth->("repeat-details-yearly-week-number"), $wday->("repeat-details-yearly-week-week"), $month->("repeat-details-yearly-week-month") &>The [_1] [_2] of [_3]</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-yearly-week" name="repeat-details-yearly" class="custom-control-input" value="week" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'week' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-yearly-week"><&|/l_unsafe, $nth->("repeat-details-yearly-week-number"), $wday->("repeat-details-yearly-week-week"), $month->("repeat-details-yearly-week-month") &>The [_1] [_2] of [_3]</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-details-yearly-complete" name="repeat-details-yearly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-details-yearly-complete"><&|/l_unsafe, $input->("repeat-details-yearly-complete") &>Create new task [_1] year(s) after each task is completed</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-details-yearly-complete" name="repeat-details-yearly" class="custom-control-input" value="complete" <% ($ARGSRef->{'repeat-details-yearly'} || '') eq 'complete' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-details-yearly-complete"><&|/l_unsafe, $input->("repeat-details-yearly-complete") &>Create new task [_1] year(s) after each task is completed</&></label>
</div>
</div>
@@ -184,7 +184,7 @@ jQuery( function () {
<&|/l&>Start of recurrence</&>:
</div>
<div class="value col-auto">
- <& /Elements/SelectDate, Name => 'repeat-start-date', ShowTime => 0, Default => $ARGSRef->{'repeat-start-date'} || '' &>
+ <& /Elements/SelectDate, Name => 'repeat-start-date', id => "${InputIdPrefix}repeat-start-date_Date", ShowTime => 0, Default => $ARGSRef->{'repeat-start-date'} || '' &>
</div>
</div>
@@ -195,13 +195,13 @@ jQuery( function () {
<div class="value col-auto form-check">
<div class="custom-control custom-radio">
- <input type="radio" id="repeat-end-none" name="repeat-end" class="custom-control-input" value="none" <% ($ARGSRef->{'repeat-end'} || '') eq 'none' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label" for="repeat-end-none"><&|/l&>No end date</&></label>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-end-none" name="repeat-end" class="custom-control-input" value="none" <% ($ARGSRef->{'repeat-end'} || '') eq 'none' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label" for="<% $InputIdPrefix %>repeat-end-none"><&|/l&>No end date</&></label>
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-end-number" name="repeat-end" class="custom-control-input" value="number" <% ($ARGSRef->{'repeat-end'} || '') eq 'number' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-end-number"><&|/l_unsafe, $input->("repeat-end-number",6,10) &>End after [_1] occurrence(s)</&>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-end-number" name="repeat-end" class="custom-control-input" value="number" <% ($ARGSRef->{'repeat-end'} || '') eq 'number' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-end-number"><&|/l_unsafe, $input->("repeat-end-number",6,10) &>End after [_1] occurrence(s)</&>
% if ( $Initial ) {
<input name="repeat-occurrences" type="hidden" value="1">
% } else {
@@ -211,9 +211,9 @@ jQuery( function () {
</div>
<div class="mt-1 custom-control custom-radio">
- <input type="radio" id="repeat-end-date" name="repeat-end" class="custom-control-input" value="date" <% ($ARGSRef->{'repeat-end'} || '') eq 'date' ? ' checked="checked"': '' |n %>>
- <label class="custom-control-label has-text-input" for="repeat-end-date">
- <&|/l&>End by</&>: <& /Elements/SelectDate, Name => 'repeat-end-date', ShowTime => 0, Default => $ARGSRef->{'repeat-end-date'} || '' &>
+ <input type="radio" id="<% $InputIdPrefix %>repeat-end-type-date" name="repeat-end" class="custom-control-input" value="date" <% ($ARGSRef->{'repeat-end'} || '') eq 'date' ? ' checked="checked"': '' |n %>>
+ <label class="custom-control-label has-text-input" for="<% $InputIdPrefix %>repeat-end-type-date">
+ <&|/l&>End by</&>: <& /Elements/SelectDate, Name => 'repeat-end-date', id => "${InputIdPrefix}repeat-end-date_Date", ShowTime => 0, Default => $ARGSRef->{'repeat-end-date'} || '' &>
</label>
</div>
@@ -306,4 +306,5 @@ $ARGSRef => undef
$Ticket => undef
$ReadOnly => undef
$Initial => undef
+$InputIdPrefix => ''
</%args>
commit c9e97e300611e026a2c77563bb96178e4771c2fd
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Oct 1 01:11:38 2020 +0800
Add inline edit support for "Recurrence" panel on ticket display page
diff --git a/html/Callbacks/RepeatTicket/Ticket/Display.html/BeforeDisplay b/html/Callbacks/RepeatTicket/Ticket/Display.html/BeforeDisplay
new file mode 100644
index 0000000..77028b6
--- /dev/null
+++ b/html/Callbacks/RepeatTicket/Ticket/Display.html/BeforeDisplay
@@ -0,0 +1,20 @@
+<%INIT>
+return unless $ARGSRef->{SubmitRecurrence};
+
+if ( $$TicketObj->CurrentUserHasRight('ModifyTicket') ) {
+ my ( $ret, $msg ) = RT::Extension::RepeatTicket::SetRepeatAttribute( $$TicketObj, %$ARGSRef );
+ if ( !$ret ) {
+ RT->Logger->warning("Couldn't update recurrence: $msg");
+ }
+ push @$Actions, $msg;
+}
+else {
+ push @$Actions, loc("Permission Denied");
+}
+</%INIT>
+
+<%ARGS>
+$TicketObj
+$ARGSRef
+$Actions
+</%ARGS>
diff --git a/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn b/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
index 62c70b5..9d4e4e5 100644
--- a/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
+++ b/html/Callbacks/RepeatTicket/Ticket/Elements/ShowSummary/LeftColumn
@@ -1,13 +1,54 @@
<&| /Widgets/TitleBox, title => loc("Recurrence"), class=>'ticket-info-repeat',
- ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyRecurrence.html?id=".$Ticket->Id) : ()) &>
-<& /Ticket/Elements/EditRecurrence, Ticket => $Ticket, ReadOnly => 1 &>
+ ($can_modify ? (title_href => $modify_url) : ()),
+ ($can_modify && $modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
+ class => (join " ", 'ticket-info-repeat', ($modify_behavior eq 'always' ? 'editing' : ())),
+ data => { 'inline-edit-behavior' => $modify_behavior },
+&>
+% unless ($modify_behavior eq 'always') {
+ <div class="inline-edit-display">
+ <& /Ticket/Elements/EditRecurrence, Ticket => $Ticket, ReadOnly => 1 &>
+ </div>
+% }
+
+% if ($modify_behavior ne 'hide') {
+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+ <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+ <& /Ticket/Elements/EditRecurrence, Ticket => $Ticket, InputIdPrefix => 'inline-edit-' &>
+ <div class="form-row">
+ <div class="col-12 text-right">
+ <input type="submit" class="button btn btn-primary" name="SubmitRecurrence" value="<&|/l&>Save</&>" />
+ </div>
+ </div>
+ </form>
+% }
</&>
<%args>
$Ticket
+$InlineEdit
</%args>
<%init>
my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
my $cf = RT::CustomField->new($session{CurrentUser});
$cf->Load('Original Ticket');
return unless $cf->id && ( $cf->can('IsAdded') ? ( $cf->IsAdded(0) || $cf->IsAdded($Ticket->Queue) ) : ( $cf->IsApplied(0) || $cf->IsApplied($Ticket->Queue)) );
+
+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
+
+my %inline_edit_behavior;
+if ( RT->Config->Get('InlineEditPanelBehavior') ) {
+ %inline_edit_behavior = %{ RT->Config->Get('InlineEditPanelBehavior')->{'RT::Ticket'} || {} };
+}
+
+my $modify_url = RT->Config->Get('WebPath')."/Ticket/ModifyRecurrence.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>}
+ . '</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_basics = sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) );
+my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Recurrence} || $inline_edit_behavior{_default} || 'link') : 'hide';
+
</%init>
diff --git a/html/Ticket/Elements/EditRecurrence b/html/Ticket/Elements/EditRecurrence
index 8fd5258..709c311 100644
--- a/html/Ticket/Elements/EditRecurrence
+++ b/html/Ticket/Elements/EditRecurrence
@@ -17,11 +17,11 @@ jQuery( function () {
} );
% if ( $ReadOnly ) {
- jQuery('div.repeat input, div.repeat select').attr('disabled', true);
+ jQuery('div.repeat.read-only input, div.repeat.read-only select').attr('disabled', true);
% }
} );
</script>
-<div class="repeat">
+<div class="repeat <% $ReadOnly ? 'read-only' : '' %>">
<div class="form-row">
<div class="label col-4"></div>
commit af776b08ea0e00de14d9ea09c0381f0efa85fd38
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Oct 1 02:01:51 2020 +0800
Add patch to make radio/checkbox checkable with inline edit
diff --git a/README b/README
index 2874254..d873773 100644
--- a/README
+++ b/README
@@ -34,6 +34,11 @@ INSTALLATION
If you are upgrading this module, check for upgrading instructions
in case changes need to be made to your database.
+ patch RT
+ Apply for 5.0.0:
+
+ patch -p1 -d /opt/rt5 < patches/0001-Fix-radio-checkbox-inputs-for-click-panel-behavior-o.patch
+
Edit your /opt/rt5/etc/RT_SiteConfig.pm
Add this line:
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index 7e51768..a8029f8 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -808,6 +808,12 @@ in your database.
If you are upgrading this module, check for upgrading instructions
in case changes need to be made to your database.
+=item C<patch RT>
+
+Apply for 5.0.0:
+
+ patch -p1 -d /opt/rt5 < patches/0001-Fix-radio-checkbox-inputs-for-click-panel-behavior-o.patch
+
=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
Add this line:
diff --git a/patches/0001-Fix-radio-checkbox-inputs-for-click-panel-behavior-o.patch b/patches/0001-Fix-radio-checkbox-inputs-for-click-panel-behavior-o.patch
new file mode 100644
index 0000000..794a57b
--- /dev/null
+++ b/patches/0001-Fix-radio-checkbox-inputs-for-click-panel-behavior-o.patch
@@ -0,0 +1,31 @@
+From 4e9be8a391a75e68d137ed58072ed75c82d1b185 Mon Sep 17 00:00:00 2001
+From: sunnavy <sunnavy at bestpractical.com>
+Date: Fri, 14 Aug 2020 02:18:31 +0800
+Subject: [PATCH] Fix radio/checkbox inputs for "click" panel behavior of
+ inline edit
+
+Previously these inputs were wrongly intercepted by inline edit and
+couldn't be actually checked.
+---
+ share/static/js/util.js | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/share/static/js/util.js b/share/static/js/util.js
+index 34dd5ec92..5ad1b9300 100644
+--- a/share/static/js/util.js
++++ b/share/static/js/util.js
+@@ -964,6 +964,11 @@ jQuery(function () {
+ return;
+ }
+
++ // Bypass radio/checkbox controls too
++ if (jQuery(e.target).closest('div.custom-radio, div.custom-checkbox').length) {
++ return;
++ }
++
+ e.preventDefault();
+ var container = jQuery(this).closest('.titlebox');
+ if (container.hasClass('editing')) {
+--
+2.24.3 (Apple Git-128)
+
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list