From 3d524defe71b5058cef3318f0c0703999c27128e Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Thu, 7 Mar 2019 00:04:12 +0100 Subject: [PATCH] TT#54205 TT#54264 TT#54351 TT#54263 TT#54206 Timesets events representation fixes Change-Id: I0553e8786c28d564d56891d40a5faa5f827eddc0 --- lib/NGCP/Panel/Controller/TimeSet.pm | 12 ++++++------ lib/NGCP/Panel/Form/TimeSet/EventAdvanced.pm | 12 +++++++----- lib/NGCP/Panel/Utils/TimeSet.pm | 5 ++++- share/templates/timeset/event_list.tt | 3 ++- share/templates/timeset/list.tt | 1 - share/templates/timeset/switch_end_control.tt | 2 +- share/templates/timeset/switch_field_label.tt | 2 +- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/NGCP/Panel/Controller/TimeSet.pm b/lib/NGCP/Panel/Controller/TimeSet.pm index d8f536d769..a9069bde9f 100644 --- a/lib/NGCP/Panel/Controller/TimeSet.pm +++ b/lib/NGCP/Panel/Controller/TimeSet.pm @@ -153,9 +153,9 @@ sub edit :Chained('base') :PathPart('edit') { calendarfile => $posted ? $upload : undef, }; - my $item = NGCP::Panel::Utils::TimeSet::get_timeset(c => $c, timeset => $c->stash->{timeset_rs}); - $item->{reseller}{id} = delete $params->{reseller_id}; - $item = merge($item, $c->session->{created_objects}); + my $timeset = NGCP::Panel::Utils::TimeSet::get_timeset(c => $c, timeset => $c->stash->{timeset_rs}); + $timeset->{reseller}{id} = delete $timeset->{reseller_id}; + $timeset = merge($timeset, $c->session->{created_objects}); my $form; if($c->user->roles eq "admin") { @@ -166,7 +166,7 @@ sub edit :Chained('base') :PathPart('edit') { $form->process( posted => $posted, params => $params, - item => $item, + item => $timeset, ); NGCP::Panel::Utils::Navigation::check_form_buttons( c => $c, @@ -261,9 +261,9 @@ sub event_list :Chained('base') :PathPart('event') :CaptureArgs(0) { $c->stash->{event_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, [ { name => 'id', search => 1, title => $c->loc('#') }, - { name => 'time_set_id', search => 1, title => $c->loc('Time Set #') }, + { name => 'time_set_id', 'visible' => 0, 'title' => 'Time Set #' }, { name => 'comment', search => 1, title => $c->loc('Comment') }, - { name => 'periods_ical.rrule_ical', search => 0, accessor => "ical", title => $c->loc('iCal')},#, literal_sql => '""' + { name => 'periods_ical.rrule_ical', search => 0, accessor => "ical", title => $c->loc('Rules')},#, literal_sql => '""' ]); $c->stash(template => 'timeset/event_list.tt'); diff --git a/lib/NGCP/Panel/Form/TimeSet/EventAdvanced.pm b/lib/NGCP/Panel/Form/TimeSet/EventAdvanced.pm index 38a4755f25..ace2b649a4 100644 --- a/lib/NGCP/Panel/Form/TimeSet/EventAdvanced.pm +++ b/lib/NGCP/Panel/Form/TimeSet/EventAdvanced.pm @@ -90,7 +90,7 @@ has_field 'start.time' => ( #dtend has_field 'end' => ( type => 'Compound', - label => 'Event stop ', + label => 'Stop ', do_label => 1, do_wrapper => 1, tags => { @@ -131,7 +131,6 @@ has_field 'end.time' => ( do_wrapper => 1, tags => { inline => 1, - after_element => }, wrapper_class => [qw/ngcp-inline-control ngcp-end-control ngcp-datetimepicker-input/], ); @@ -208,9 +207,10 @@ has_field 'repeat.freq' => ( sub frequency_options { my %values = ('secondly' => 'Second', 'minutely' => 'Minute', 'hourly' => 'Hour', 'daily' => 'Day', 'weekly' => 'Week', 'monthly' => 'Month', 'yearly' => 'Year'); + my @freq_order = qw/daily weekly monthly yearly hourly minutely secondly/; my $options = [ { value => 'no', label => 'None (run once)' }, - map { +{value => $_, label => $values{$_} }; } keys %values + map { +{value => $_, label => $values{$_} }; } @freq_order ]; } @@ -652,7 +652,7 @@ sub custom_set_values { $fif->{repeat}->{freq} = $values->{freq}; $fif->{repeat}->{interval} = $values->{interval}; } else { - $fif->{repeat}->{freq} ne 'no'; + $fif->{repeat}->{freq} = 'no'; } if ($values->{count}) { @@ -670,7 +670,9 @@ sub custom_set_values { my @join_fields = qw/bymonthday byminute byweekno bysecond bymonth byhour/; foreach my $join_field (@join_fields) { - $fif->{$join_field} = [split(/,/, $values->{$join_field})]; + if ($values->{$join_field}) { + $fif->{$join_field} = [split(/,/, $values->{$join_field})]; + } } if ($values->{byday}) { if ($values->{byday} =~ /^(?:(?:MO|TU|WE|TH|FR|SA|SU),?)+$/) {# diff --git a/lib/NGCP/Panel/Utils/TimeSet.pm b/lib/NGCP/Panel/Utils/TimeSet.pm index c9b57d4906..e3fc242f3c 100644 --- a/lib/NGCP/Panel/Utils/TimeSet.pm +++ b/lib/NGCP/Panel/Utils/TimeSet.pm @@ -12,7 +12,10 @@ use constant CALENDAR_MIME_TYPE => 'text/calendar'; sub get_calendar_file_name { my %params = @_; my($c, $timeset) = @params{qw/c timeset/}; - return $timeset->name.'_'.$timeset->id; + my $name = $timeset->name; + #replacement not collapsed intentionally + $name =~s/[^[:alnum:] ]/_/g; + return $name.'_'.$timeset->id; } sub delete_timeset { diff --git a/share/templates/timeset/event_list.tt b/share/templates/timeset/event_list.tt index 8bb36829ac..932166d399 100644 --- a/share/templates/timeset/event_list.tt +++ b/share/templates/timeset/event_list.tt @@ -188,7 +188,7 @@ $( document ).ready(function() { } -[% site_config.title = c.loc('Time Set Event') -%] +[% site_config.title = c.loc('Time set "[_1]" - Events', timeset.name) -%] [% helper.name = c.loc('Time Set Event'); @@ -214,6 +214,7 @@ $( document ).ready(function() { helper.top_buttons = [ { name = c.loc('Create Event'), uri = c.uri_for_action('/timeset/event_create', [c.req.captures.0] ), icon = 'icon-star' }, { name = c.loc('Upload iCalendar events'), uri = c.uri_for_action('/timeset/event_upload',[c.req.captures.0]), icon = 'icon-star' }, + { name = c.loc('Download iCalendar'), uri = c.uri_for_action('/timeset/download', [c.req.captures.0]), icon = 'icon-th-list'}, ]; END; diff --git a/share/templates/timeset/list.tt b/share/templates/timeset/list.tt index 2fde3e680a..13087002c9 100644 --- a/share/templates/timeset/list.tt +++ b/share/templates/timeset/list.tt @@ -15,7 +15,6 @@ UNLESS c.user.read_only; helper.dt_buttons = [ { name = c.loc('Events'), uri = "/timeset/'+full.id+'/event", class = 'btn-small btn-tertiary', icon = 'icon-th-list' }, - { name = c.loc('Download'), uri = "/timeset/'+full.id+'/download", class = 'btn-small btn-primary', icon = 'icon-th-list' }, { name = c.loc('Edit'), uri = "/timeset/'+full.id+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' }, { name = c.loc('Delete'), uri = "/timeset/'+full.id+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' }, ]; diff --git a/share/templates/timeset/switch_end_control.tt b/share/templates/timeset/switch_end_control.tt index bfd49155bc..e4a746b195 100644 --- a/share/templates/timeset/switch_end_control.tt +++ b/share/templates/timeset/switch_end_control.tt @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/share/templates/timeset/switch_field_label.tt b/share/templates/timeset/switch_field_label.tt index b31085a4ff..a56bf5d0a2 100644 --- a/share/templates/timeset/switch_field_label.tt +++ b/share/templates/timeset/switch_field_label.tt @@ -1,3 +1,3 @@
[%c.loc(vars.field.label)%]
-
[%c.loc('Invert selection')%]
+
[%c.loc('Invert selection')%]
[%c.loc('Clear')%]