studio-timeslot: add week in month
This commit is contained in:
@@ -353,3 +353,12 @@ update calcms_series set image = replace(image , '/agenda_files/media/images/',
|
||||
update calcms_series set image = replace(image , '/agenda_files/media/icons/', '') where image like '%/agenda_files/media/icons/%';
|
||||
update calcms_series set image = replace(image , '/agenda_files/media/thumbs/', '') where image like '%/agenda_files/media/thumbs/%';
|
||||
|
||||
-- add day of month to studio schedules
|
||||
ALTER TABLE `calcms`.`calcms_studio_timeslot_schedule`
|
||||
ADD COLUMN `period_type` VARCHAR(45) NOT NULL AFTER `end_date`,
|
||||
ADD COLUMN `weekday` INT UNSIGNED NULL AFTER `period_type`,
|
||||
ADD COLUMN `week_of_month` INT UNSIGNED NULL AFTER `weekday`,
|
||||
ADD COLUMN `month` INT UNSIGNED NULL AFTER `week_of_month`,
|
||||
CHANGE COLUMN `frequency` `frequency` INT UNSIGNED NULL ;
|
||||
|
||||
update `calcms_studio_timeslot_schedule` set period_type = 'days' where period_type = '';
|
||||
@@ -4,7 +4,6 @@ use strict;
|
||||
use warnings;
|
||||
no warnings 'redefine';
|
||||
|
||||
use Data::Dumper;
|
||||
use Date::Calc();
|
||||
use time();
|
||||
|
||||
@@ -12,8 +11,7 @@ use time();
|
||||
# table: calcms_studio_timeslot_dates
|
||||
# columns: id, studio_id, start(datetime), end(datetime)
|
||||
# TODO: delete column schedule_id
|
||||
#use base 'Exporter';
|
||||
our @EXPORT_OK = qw(get_columns get insert update delete get_dates);
|
||||
our @EXPORT_OK = qw(get_columns get insert update delete get_dates);
|
||||
|
||||
sub get_columns ($){
|
||||
my ($config) = @_;
|
||||
@@ -124,34 +122,37 @@ sub update {
|
||||
my $day_start = $config->{date}->{day_starting_hour};
|
||||
|
||||
#get the schedule with schedule id ordered by date
|
||||
my $schedules = studio_timeslot_schedule::get(
|
||||
$config,
|
||||
{
|
||||
schedule_id => $entry->{schedule_id}
|
||||
}
|
||||
my $schedules = studio_timeslot_schedule::get($config,
|
||||
{schedule_id => $entry->{schedule_id}}
|
||||
);
|
||||
|
||||
#add scheduled dates
|
||||
my $i = 0;
|
||||
my $dates = {};
|
||||
for my $schedule (@$schedules) {
|
||||
|
||||
#calculate dates from start to end_date
|
||||
my $dateList = get_dates( $schedule->{start}, $schedule->{end}, $schedule->{end_date}, $schedule->{frequency} );
|
||||
my $dateList;
|
||||
if ($schedule->{period_type} eq 'days') {
|
||||
#calculate dates from start to end_date
|
||||
$dateList = get_dates($schedule->{start}, $schedule->{end}, $schedule->{end_date}, $schedule->{frequency});
|
||||
} elsif ($schedule->{period_type} eq 'week_of_month') {
|
||||
my $timezone = $config->{date}->{time_zone};
|
||||
$dateList = get_week_of_month_dates($timezone,
|
||||
$schedule->{start}, $schedule->{end}, $schedule->{end_date},
|
||||
$schedule->{week_of_month}, $schedule->{weekday}, $schedule->{month},
|
||||
$schedule->{nextDay}
|
||||
);
|
||||
}
|
||||
|
||||
for my $date (@$dateList) {
|
||||
#set studio i from
|
||||
$date->{project_id} = $schedule->{project_id};
|
||||
$date->{studio_id} = $schedule->{studio_id};
|
||||
$date->{schedule_id} = $schedule->{schedule_id};
|
||||
$dates->{ $date->{start} . $date->{studio_id} } = $date;
|
||||
$date->{project_id} = $schedule->{project_id};
|
||||
$date->{studio_id} = $schedule->{studio_id};
|
||||
$date->{schedule_id} = $schedule->{schedule_id};
|
||||
$dates->{$date->{start} . $date->{studio_id}} = $date;
|
||||
}
|
||||
}
|
||||
|
||||
for my $date ( keys %$dates ) {
|
||||
for my $date (sort keys %$dates) {
|
||||
my $timeslot_date = $dates->{$date};
|
||||
|
||||
#insert date
|
||||
my $entry = {
|
||||
project_id => $timeslot_date->{project_id},
|
||||
studio_id => $timeslot_date->{studio_id},
|
||||
@@ -159,9 +160,9 @@ sub update {
|
||||
start => $timeslot_date->{start},
|
||||
end => $timeslot_date->{end},
|
||||
};
|
||||
$entry->{start_date} = time::add_hours_to_datetime( $entry->{start}, -$day_start );
|
||||
$entry->{end_date} = time::add_hours_to_datetime( $entry->{end}, -$day_start );
|
||||
db::insert( $dbh, 'calcms_studio_timeslot_dates', $entry );
|
||||
$entry->{start_date} = time::add_hours_to_datetime($entry->{start}, -$day_start);
|
||||
$entry->{end_date} = time::add_hours_to_datetime($entry->{end}, -$day_start);
|
||||
db::insert($dbh, 'calcms_studio_timeslot_dates', $entry);
|
||||
$i++;
|
||||
}
|
||||
return $i;
|
||||
@@ -196,7 +197,6 @@ sub get_dates {
|
||||
|
||||
my $dates = [];
|
||||
return $dates if ( $date->{end} le $date->{start} );
|
||||
|
||||
return $dates if ( $stop_date lt $end_date );
|
||||
|
||||
my $j = Date::Calc::Delta_Days( @start_date, @stop_date );
|
||||
@@ -219,21 +219,19 @@ sub get_dates {
|
||||
my $start_date = sprintf( "%04d-%02d-%02d", @start_date );
|
||||
my @next_date = Date::Calc::Add_Delta_Days( $start[0], $start[1], $start[2], $i + 1 );
|
||||
my $next_date = sprintf( "%04d-%02d-%02d", @next_date );
|
||||
push @$dates,
|
||||
{
|
||||
push @$dates, {
|
||||
start => $start_date . ' 00:00:00',
|
||||
end => $next_date . ' 00:00:00',
|
||||
};
|
||||
last if ( $c > 1000 );
|
||||
};
|
||||
last if $c > 1000;
|
||||
$c++;
|
||||
}
|
||||
|
||||
#end day
|
||||
push @$dates,
|
||||
{
|
||||
push @$dates, {
|
||||
start => $end_date . ' 00:00:00',
|
||||
end => $end_date . ' ' . $end_time,
|
||||
} if ( $end_time ne '00:00:00' );
|
||||
} if $end_time ne '00:00:00';
|
||||
return $dates;
|
||||
}
|
||||
|
||||
@@ -247,17 +245,60 @@ sub get_dates {
|
||||
|
||||
my $start_date = sprintf( "%04d-%02d-%02d", @start_date );
|
||||
my $end_date = sprintf( "%04d-%02d-%02d", @end_date );
|
||||
push @$dates,
|
||||
{
|
||||
push @$dates, {
|
||||
start => $start_date . ' ' . $start_time,
|
||||
end => $end_date . ' ' . $end_time,
|
||||
};
|
||||
last if ( $c > 1000 );
|
||||
};
|
||||
last if $c > 1000;
|
||||
$c++;
|
||||
}
|
||||
return $dates;
|
||||
}
|
||||
|
||||
# based on series_dates but with (timezone, start, end) instead of (start, duration)
|
||||
sub get_week_of_month_dates ($$$$$$$$) {
|
||||
my ($timezone, $start, $end, $end_date, $week, $weekday, $frequency, $nextDay) = @_;
|
||||
#datetime, datetime, date, every nth week of month, weekday [1..7], every 1st,2nd,3th time, add 24 hours to start, (for night hours at last weekday of month)
|
||||
|
||||
return undef if $timezone eq '';
|
||||
return undef if $start eq '';
|
||||
return undef if $end eq '';
|
||||
return undef if $end_date eq '';
|
||||
return undef if $week eq '';
|
||||
return undef if $weekday eq '';
|
||||
return undef if $frequency eq '';
|
||||
return undef if $frequency == 0;
|
||||
|
||||
my $start_dates = time::get_nth_weekday_in_month($start, $end_date, $week, $weekday);
|
||||
|
||||
if (defined $nextDay && $nextDay > 0) {
|
||||
for (my $i = 0; $i < @$start_dates; $i++) {
|
||||
$start_dates->[$i] = time::add_hours_to_datetime($start_dates->[$i], 24);
|
||||
}
|
||||
}
|
||||
|
||||
my $results = [];
|
||||
my $duration = time::get_duration($start, $end, $timezone);
|
||||
my $c = -1;
|
||||
for my $start_datetime (@$start_dates) {
|
||||
$c++;
|
||||
my @start = @{ time::datetime_to_array($start_datetime) };
|
||||
next unless @start >= 6;
|
||||
next if ($c % $frequency) != 0;
|
||||
my @end_datetime = Date::Calc::Add_Delta_DHMS(
|
||||
$start[0], $start[1], $start[2], # start date
|
||||
$start[3], $start[4], $start[5], # start time
|
||||
0, 0, $duration, 0 # delta days, hours, minutes, seconds
|
||||
);
|
||||
my $end_datetime = time::array_to_datetime( \@end_datetime );
|
||||
push @$results, {
|
||||
start => $start_datetime,
|
||||
end => $end_datetime
|
||||
};
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
#remove all studio_timeslot_dates for studio_id and schedule_id
|
||||
sub delete {
|
||||
my ($config, $entry) = @_;
|
||||
@@ -269,8 +310,8 @@ sub delete {
|
||||
my $dbh = db::connect($config);
|
||||
|
||||
my $query = qq{
|
||||
delete
|
||||
from calcms_studio_timeslot_dates
|
||||
delete
|
||||
from calcms_studio_timeslot_dates
|
||||
where schedule_id=?
|
||||
};
|
||||
my $bind_values = [ $entry->{schedule_id} ];
|
||||
|
||||
@@ -67,7 +67,6 @@ sub insert($$) {
|
||||
return unless defined $entry->{studio_id};
|
||||
return unless defined $entry->{start};
|
||||
return unless defined $entry->{end};
|
||||
return unless defined $entry->{frequency};
|
||||
|
||||
my $dbh = db::connect($config);
|
||||
return db::insert( $dbh, 'calcms_studio_timeslot_schedule', $entry );
|
||||
@@ -82,7 +81,6 @@ sub update($$) {
|
||||
return unless defined $entry->{schedule_id};
|
||||
return unless defined $entry->{start};
|
||||
return unless defined $entry->{end};
|
||||
return unless defined $entry->{frequency};
|
||||
|
||||
$entry->{id} = $entry->{schedule_id};
|
||||
delete $entry->{schedule_id};
|
||||
@@ -100,8 +98,6 @@ sub update($$) {
|
||||
};
|
||||
db::put( $dbh, $query, \@bind_values );
|
||||
|
||||
#print "done\n";
|
||||
|
||||
$entry->{schedule_id} = $entry->{id};
|
||||
delete $entry->{id};
|
||||
|
||||
|
||||
@@ -48,18 +48,17 @@
|
||||
#content .editor .cell {
|
||||
display: table-cell ;
|
||||
vertical-align:baseline;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#content .frequency {
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
#content div.weekday {
|
||||
padding: 0;
|
||||
width: 2em;
|
||||
margin-right: -0.5em;
|
||||
margin-top: 1.2em;
|
||||
#content .editor div.cell.weekday {
|
||||
vertical-align: bottom;
|
||||
width: 2.5ch;
|
||||
padding-bottom: 9px;
|
||||
}
|
||||
|
||||
#content div.show_schedule_head {
|
||||
|
||||
@@ -61,6 +61,37 @@ function initTable(){
|
||||
$('.tablesorter-scroller-table table').css('width','95%');
|
||||
}
|
||||
|
||||
// show/hide schedule fields depending on period type for a given schedule element
|
||||
function showScheduleFields(id){
|
||||
var select='#'+id+' select[name="period_type"]';
|
||||
var type=$(select).val();
|
||||
//hide and show values for different schedule types
|
||||
if (type=='days' || type=='') {
|
||||
$('#'+id+' div.cell.frequency').show();
|
||||
$('#'+id+' div.cell.end').show();
|
||||
$('#'+id+' div.cell.schedule_weekday').hide();
|
||||
$('#'+id+' div.cell.week_of_month').hide();
|
||||
$('#'+id+' div.cell.schedule_month').hide();
|
||||
$('#'+id+' div.cell.nextDay').hide();
|
||||
}else if(type=='week_of_month'){
|
||||
$('#'+id+' div.cell.frequency').hide();
|
||||
$('#'+id+' div.cell.end').show();
|
||||
$('#'+id+' div.cell.schedule_weekday').show();
|
||||
$('#'+id+' div.cell.week_of_month').show();
|
||||
$('#'+id+' div.cell.schedule_month').show();
|
||||
$('#'+id+' div.cell.nextDay').show();
|
||||
}else{
|
||||
alert("invalid schedule type");
|
||||
}
|
||||
}
|
||||
|
||||
function initScheduleFields(){
|
||||
$('div.row.schedule form').each(function(){
|
||||
var id = $(this).attr('id');
|
||||
if(contains(id,'schedule_'))showScheduleFields(id);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(
|
||||
function(){
|
||||
setupLocalization(function(){
|
||||
@@ -88,6 +119,7 @@ $(document).ready(
|
||||
onSelect: function(){updateWeekdays();}
|
||||
});
|
||||
|
||||
initScheduleFields();
|
||||
setSelectedOptions();
|
||||
|
||||
showYearPicker('#show_date', {
|
||||
@@ -95,6 +127,7 @@ $(document).ready(
|
||||
showDates();
|
||||
}
|
||||
});
|
||||
|
||||
showDates();
|
||||
});
|
||||
|
||||
|
||||
@@ -64,3 +64,156 @@ msgstr "alle 28 Tage"
|
||||
msgid "every_month"
|
||||
msgstr "monatlich"
|
||||
|
||||
msgid "schedule_start"
|
||||
msgstr "Start"
|
||||
|
||||
msgid "schedule_end"
|
||||
msgstr "wiederholt bis"
|
||||
|
||||
msgid "duration"
|
||||
msgstr "Dauer"
|
||||
|
||||
msgid "duration_in_minutes"
|
||||
msgstr "Dauer in Minuten"
|
||||
|
||||
msgid "frequency"
|
||||
msgstr "wie oft"
|
||||
|
||||
msgid "frequency_days"
|
||||
msgstr "alle x Tage"
|
||||
|
||||
msgid "exception"
|
||||
msgstr "Ausnahme"
|
||||
|
||||
msgid "week_of_month"
|
||||
msgstr "Woche"
|
||||
|
||||
msgid "weekday"
|
||||
msgstr "Wochentag"
|
||||
|
||||
msgid "period_type"
|
||||
msgstr "Wiederholung"
|
||||
|
||||
msgid "period_type_single"
|
||||
msgstr "keine"
|
||||
|
||||
msgid "period_type_days"
|
||||
msgstr "festes Interval"
|
||||
|
||||
msgid "period_type_week_of_month"
|
||||
msgstr "Woche im Monat"
|
||||
|
||||
msgid "nextDay"
|
||||
msgstr "Nacht"
|
||||
|
||||
msgid "minutes"
|
||||
msgstr "Minuten"
|
||||
|
||||
msgid "hour"
|
||||
msgstr "Stunde"
|
||||
|
||||
msgid "hours"
|
||||
msgstr "Stunden"
|
||||
|
||||
msgid "day"
|
||||
msgstr "Tag"
|
||||
|
||||
msgid "days"
|
||||
msgstr "Tage"
|
||||
|
||||
msgid "daily"
|
||||
msgstr "täglich"
|
||||
|
||||
msgid "week"
|
||||
msgstr "Woche"
|
||||
|
||||
msgid "weeks"
|
||||
msgstr "Wochen"
|
||||
|
||||
msgid "weekly"
|
||||
msgstr "wöchentlich"
|
||||
|
||||
msgid "month"
|
||||
msgstr "Monat"
|
||||
|
||||
msgid "months"
|
||||
msgstr "Monate"
|
||||
|
||||
msgid "from"
|
||||
msgstr "von"
|
||||
|
||||
msgid "till"
|
||||
msgstr "bis"
|
||||
|
||||
msgid "modified"
|
||||
msgstr "bearbeited"
|
||||
|
||||
msgid "added"
|
||||
msgstr "hinzugefügt"
|
||||
|
||||
msgid "at"
|
||||
msgstr "am"
|
||||
|
||||
msgid "by"
|
||||
msgstr "von"
|
||||
|
||||
msgid "unit"
|
||||
msgstr "in"
|
||||
|
||||
msgid "choose_free"
|
||||
msgstr "frei wählbar"
|
||||
|
||||
msgid "every"
|
||||
msgstr "alle"
|
||||
|
||||
msgid "every_month"
|
||||
msgstr "wie oft"
|
||||
|
||||
msgid "every_time"
|
||||
msgstr "jedes Mal"
|
||||
|
||||
msgid "every_2nd_time"
|
||||
msgstr "jedes 2. Mal"
|
||||
|
||||
msgid "every_3rd_time"
|
||||
msgstr "jedes 3. Mal"
|
||||
|
||||
msgid "every_4th_time"
|
||||
msgstr "jedes 4. Mal"
|
||||
|
||||
msgid "week_1st"
|
||||
msgstr "erster"
|
||||
|
||||
msgid "week_2nd"
|
||||
msgstr "zweiter"
|
||||
|
||||
msgid "week_3rd"
|
||||
msgstr "dritter"
|
||||
|
||||
msgid "week_4th"
|
||||
msgstr "vierter"
|
||||
|
||||
msgid "week_5th"
|
||||
msgstr "fünter"
|
||||
|
||||
msgid "monday"
|
||||
msgstr "Montag"
|
||||
|
||||
msgid "tuesday"
|
||||
msgstr "Dienstag"
|
||||
|
||||
msgid "wednesday"
|
||||
msgstr "Mittwoch"
|
||||
|
||||
msgid "thursday"
|
||||
msgstr "Donnerstag"
|
||||
|
||||
msgid "friday"
|
||||
msgstr "Freitag"
|
||||
|
||||
msgid "saturday"
|
||||
msgstr "Samstag"
|
||||
|
||||
msgid "sunday"
|
||||
msgstr "Sonntag"
|
||||
|
||||
|
||||
@@ -64,4 +64,150 @@ msgstr "every four weeks"
|
||||
msgid "every_month"
|
||||
msgstr "every month"
|
||||
|
||||
msgid "schedule_start"
|
||||
msgstr "start of schedule"
|
||||
|
||||
msgid "schedule_end"
|
||||
msgstr "end of schedule"
|
||||
|
||||
msgid "duration"
|
||||
msgstr "duration"
|
||||
|
||||
msgid "duration_in_minutes"
|
||||
msgstr "duration in minutes"
|
||||
|
||||
msgid "frequency"
|
||||
msgstr "how often"
|
||||
|
||||
msgid "frequency_days"
|
||||
msgstr "every n days"
|
||||
|
||||
msgid "week_of_month"
|
||||
msgstr "week of month"
|
||||
|
||||
msgid "weekday"
|
||||
msgstr "weekday"
|
||||
|
||||
msgid "period_type"
|
||||
msgstr "type of planning"
|
||||
|
||||
msgid "period_type_days"
|
||||
msgstr "regular recurrence"
|
||||
|
||||
msgid "period_type_week_of_month"
|
||||
msgstr "week of month"
|
||||
|
||||
msgid "nextDay"
|
||||
msgstr "night"
|
||||
|
||||
msgid "minutes"
|
||||
msgstr "minutes"
|
||||
|
||||
msgid "hour"
|
||||
msgstr "hour"
|
||||
|
||||
msgid "hours"
|
||||
msgstr "hours"
|
||||
|
||||
msgid "day"
|
||||
msgstr "day"
|
||||
|
||||
msgid "days"
|
||||
msgstr "days"
|
||||
|
||||
msgid "daily"
|
||||
msgstr "daily"
|
||||
|
||||
msgid "week"
|
||||
msgstr "week"
|
||||
|
||||
msgid "weeks"
|
||||
msgstr "weeks"
|
||||
|
||||
msgid "weekly"
|
||||
msgstr "weekly"
|
||||
|
||||
msgid "month"
|
||||
msgstr "month"
|
||||
|
||||
msgid "months"
|
||||
msgstr "months"
|
||||
|
||||
msgid "from"
|
||||
msgstr "from"
|
||||
|
||||
msgid "till"
|
||||
msgstr "till"
|
||||
|
||||
msgid "modified"
|
||||
msgstr "modified"
|
||||
|
||||
msgid "added"
|
||||
msgstr "added"
|
||||
|
||||
msgid "at"
|
||||
msgstr "at"
|
||||
|
||||
msgid "by"
|
||||
msgstr "by"
|
||||
|
||||
msgid "unit"
|
||||
msgstr "in"
|
||||
|
||||
msgid "choose_free"
|
||||
msgstr "choose freely"
|
||||
|
||||
msgid "every"
|
||||
msgstr "every"
|
||||
|
||||
msgid "every_month"
|
||||
msgstr "every nth time"
|
||||
|
||||
msgid "every_time"
|
||||
msgstr "every time"
|
||||
|
||||
msgid "every_2nd_time"
|
||||
msgstr "every 2nd time"
|
||||
|
||||
msgid "every_3rd_time"
|
||||
msgstr "every 3rd time"
|
||||
|
||||
msgid "every_4th_time"
|
||||
msgstr "every 4th time"
|
||||
|
||||
msgid "week_1st"
|
||||
msgstr "1st"
|
||||
|
||||
msgid "week_2nd"
|
||||
msgstr "2nd"
|
||||
|
||||
msgid "week_3rd"
|
||||
msgstr "3rd"
|
||||
|
||||
msgid "week_4th"
|
||||
msgstr "4th"
|
||||
|
||||
msgid "week_5th"
|
||||
msgstr "5th"
|
||||
|
||||
msgid "monday"
|
||||
msgstr "Monday"
|
||||
|
||||
msgid "tuesday"
|
||||
msgstr "Tuesday"
|
||||
|
||||
msgid "wednesday"
|
||||
msgstr "Wednesday"
|
||||
|
||||
msgid "thursday"
|
||||
msgstr "Thursday"
|
||||
|
||||
msgid "friday"
|
||||
msgstr "Friday"
|
||||
|
||||
msgid "saturday"
|
||||
msgstr "Saturday"
|
||||
|
||||
msgid "sunday"
|
||||
msgstr "Sunday"
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@ use strict;
|
||||
use warnings;
|
||||
no warnings 'redefine';
|
||||
|
||||
use Data::Dumper;
|
||||
use URI::Escape();
|
||||
|
||||
use params();
|
||||
use config();
|
||||
use entry();
|
||||
@@ -24,11 +21,11 @@ use localization();
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
my $r = shift;
|
||||
( my $cgi, my $params, my $error ) = params::get($r);
|
||||
(my $cgi, my $params, my $error) = params::get($r);
|
||||
|
||||
my $config = config::get('../config/config.cgi');
|
||||
my ( $user, $expires ) = auth::get_user( $config, $params, $cgi );
|
||||
return if ( ( !defined $user ) || ( $user eq '' ) );
|
||||
my ($user, $expires) = auth::get_user($config, $params, $cgi);
|
||||
return if ((!defined $user) || ($user eq ''));
|
||||
|
||||
my $user_presets = uac::get_user_presets(
|
||||
$config,
|
||||
@@ -39,48 +36,45 @@ my $user_presets = uac::get_user_presets(
|
||||
}
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params = uac::setDefaultStudio( $params, $user_presets );
|
||||
$params = uac::setDefaultProject( $params, $user_presets );
|
||||
$params = uac::setDefaultStudio($params, $user_presets);
|
||||
$params = uac::setDefaultProject($params, $user_presets);
|
||||
|
||||
my $request = {
|
||||
url => $ENV{QUERY_STRING} || '',
|
||||
params => {
|
||||
original => $params,
|
||||
checked => check_params( $config, $params ),
|
||||
checked => check_params($config, $params),
|
||||
},
|
||||
};
|
||||
$request = uac::prepare_request( $request, $user_presets );
|
||||
$request = uac::prepare_request($request, $user_presets);
|
||||
$params = $request->{params}->{checked};
|
||||
|
||||
#process header
|
||||
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
|
||||
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'all,menu' } );
|
||||
my $headerParams = uac::set_template_permissions($request->{permissions}, $params);
|
||||
$headerParams->{loc} = localization::get($config, {user => $user, file => 'all,menu'});
|
||||
|
||||
my $action = $params->{action} || '';
|
||||
if ( $action eq 'show_dates' ) {
|
||||
if ($action eq 'show_dates') {
|
||||
#print "Content-type:text/html\n\n";
|
||||
} else {
|
||||
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
|
||||
template::process($config, 'print', template::check($config, 'default.html'), $headerParams);
|
||||
}
|
||||
return unless uac::check( $config, $params, $user_presets ) == 1;
|
||||
return unless uac::check($config, $params, $user_presets) == 1;
|
||||
|
||||
if ( $action eq 'show_dates' ) {
|
||||
if ($action eq 'show_dates') {
|
||||
print "Content-Type:text/html\n\n";
|
||||
} else {
|
||||
template::process( $config, 'print', template::check( $config, 'studio-timeslots-header.html' ), $headerParams );
|
||||
template::process($config, 'print', template::check($config, 'studio-timeslots-header.html'), $headerParams);
|
||||
}
|
||||
|
||||
if ( defined $params->{action} ) {
|
||||
save_schedule( $config, $request ) if ( $params->{action} eq 'save_schedule' );
|
||||
delete_schedule( $config, $request ) if ( $params->{action} eq 'delete_schedule' );
|
||||
if ( $params->{action} eq 'show_dates' ) {
|
||||
showDates( $config, $request );
|
||||
return;
|
||||
}
|
||||
if (defined $params->{action}) {
|
||||
save_schedule($config, $request) if $params->{action} eq 'save_schedule';
|
||||
delete_schedule($config, $request) if $params->{action} eq 'delete_schedule';
|
||||
return showDates($config, $request) if $params->{action} eq 'show_dates';
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
showTimeslotSchedule( $config, $request );
|
||||
showTimeslotSchedule($config, $request);
|
||||
return;
|
||||
|
||||
#insert or update a schedule and update all schedule dates
|
||||
@@ -88,44 +82,40 @@ sub save_schedule {
|
||||
my ($config, $request) = @_;
|
||||
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{update_studio_timeslot_schedule} == 1 ) {
|
||||
uac::permissions_denied('update_studio_timeslot_schedule');
|
||||
return;
|
||||
}
|
||||
return uac::permissions_denied('update_studio_timeslot_schedule')
|
||||
unless $permissions->{update_studio_timeslot_schedule} == 1;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
|
||||
for my $attr ( 'project_id', 'studio_id', 'start', 'end', 'end_date', 'schedule_studio_id' ) {
|
||||
unless ( defined $params->{$attr} ) {
|
||||
uac::print_error( $attr . ' not given!' );
|
||||
return;
|
||||
}
|
||||
}
|
||||
for my $attr ('project_id', 'studio_id', 'start', 'end', 'end_date', 'schedule_studio_id') {
|
||||
return uac::print_error($attr . ' not given!') unless defined $params->{$attr};
|
||||
}
|
||||
|
||||
my $entry = {};
|
||||
for my $attr ( 'project_id', 'start', 'end', 'end_date', 'frequency' ) {
|
||||
$entry->{$attr} = $params->{$attr} if defined $params->{$attr};
|
||||
}
|
||||
if ($params->{period_type} eq 'days') {
|
||||
entry::set_numbers($entry, $params, ['frequency']);
|
||||
$entry->{period_type} = $params->{period_type};
|
||||
}elsif($params->{period_type} eq 'week_of_month') {
|
||||
entry::set_numbers($entry, $params, ['weekday', 'week_of_month', 'month']);
|
||||
$entry->{period_type} = $params->{period_type};
|
||||
}
|
||||
|
||||
my $entry = {map {$_ => $params->{$_}} ('project_id', 'start', 'end', 'end_date')};
|
||||
|
||||
#set schedule's studio to value from schedule_studio_id
|
||||
$entry->{studio_id} = $params->{schedule_studio_id} if defined $params->{schedule_studio_id};
|
||||
|
||||
if ( ( $entry->{end} ne '' ) && ( $entry->{end} le $entry->{start} ) ) {
|
||||
uac::print_error('start date should be before end date!');
|
||||
return;
|
||||
}
|
||||
return uac::print_error('start date should be before end date!')
|
||||
if $entry->{end} ne '' && $entry->{end} le $entry->{start};
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
if ( defined $params->{schedule_id} ) {
|
||||
if (defined $params->{schedule_id}) {
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
studio_timeslot_schedule::update( $config, $entry );
|
||||
|
||||
my $updates = studio_timeslot_dates::update( $config, $entry );
|
||||
studio_timeslot_schedule::update($config, $entry);
|
||||
my $updates = studio_timeslot_dates::update($config, $entry);
|
||||
uac::print_info("timeslot schedule saved. $updates dates scheduled");
|
||||
} else {
|
||||
$entry->{schedule_id} = studio_timeslot_schedule::insert( $config, $entry );
|
||||
|
||||
my $updates = studio_timeslot_dates::update( $config, $entry );
|
||||
$entry->{schedule_id} = studio_timeslot_schedule::insert($config, $entry);
|
||||
my $updates = studio_timeslot_dates::update($config, $entry);
|
||||
uac::print_info("timeslot schedule added. $updates dates added");
|
||||
}
|
||||
|
||||
@@ -135,27 +125,20 @@ sub delete_schedule {
|
||||
my ($config, $request) = @_;
|
||||
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{update_studio_timeslot_schedule} == 1 ) {
|
||||
uac::permissions_denied('update_studio_timeslot_schedule');
|
||||
return;
|
||||
}
|
||||
|
||||
return uac::permissions_denied('update_studio_timeslot_schedule')
|
||||
unless $permissions->{update_studio_timeslot_schedule} == 1;
|
||||
my $params = $request->{params}->{checked};
|
||||
|
||||
my $entry = {};
|
||||
for my $attr ( 'project_id', 'studio_id', 'schedule_id' ) {
|
||||
if ( defined $params->{$attr} ) {
|
||||
$entry->{$attr} = $params->{$attr};
|
||||
} else {
|
||||
uac::print_error( $attr . ' not given!' );
|
||||
return;
|
||||
}
|
||||
for my $attr ('project_id', 'studio_id', 'schedule_id') {
|
||||
return uac::print_error($attr . ' not given!') unless defined $params->{$attr};
|
||||
$entry->{$attr} = $params->{$attr};
|
||||
}
|
||||
|
||||
$config->{access}->{write} = 1;
|
||||
$entry->{schedule_id} = $params->{schedule_id};
|
||||
studio_timeslot_schedule::delete( $config, $entry );
|
||||
studio_timeslot_dates::update( $config, $entry );
|
||||
studio_timeslot_schedule::delete($config, $entry);
|
||||
studio_timeslot_dates::update($config, $entry);
|
||||
uac::print_info("timeslot schedule deleted");
|
||||
}
|
||||
|
||||
@@ -163,49 +146,38 @@ sub showTimeslotSchedule {
|
||||
my ($config, $request) = @_;
|
||||
|
||||
$config->{access}->{write} = 0;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{read_studio_timeslot_schedule} == 1 ) {
|
||||
uac::permissions_denied('read_studio_timeslot_schedule');
|
||||
return;
|
||||
}
|
||||
return uac::permissions_denied('read_studio_timeslot_schedule')
|
||||
unless $permissions->{read_studio_timeslot_schedule} == 1;
|
||||
|
||||
for my $param ( 'project_id', 'studio_id' ) {
|
||||
unless ( defined $params->{$param} ) {
|
||||
uac::print_error("missing $param");
|
||||
return;
|
||||
}
|
||||
for my $param ('project_id', 'studio_id') {
|
||||
return uac::print_error("missing $param") unless defined $params->{$param};
|
||||
}
|
||||
|
||||
#this will be updated later (especially allow_update_events)
|
||||
for my $permission ( keys %{ $request->{permissions} } ) {
|
||||
$params->{'allow'}->{$permission} = $request->{permissions}->{$permission};
|
||||
}
|
||||
$params->{'allow'}->{$_} = $request->{permissions}->{$_} for (keys %{$request->{permissions}});
|
||||
|
||||
$params->{loc} =
|
||||
localization::get( $config, { user => $params->{presets}->{user}, file => 'all,studio-timeslots' } );
|
||||
localization::get($config, {user => $params->{presets}->{user}, file => 'all,studio-timeslots'});
|
||||
|
||||
my $studio_id = $params->{studio_id};
|
||||
my $project_id = $params->{project_id};
|
||||
|
||||
#get project schedule
|
||||
my $schedules = studio_timeslot_schedule::get(
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id
|
||||
|
||||
# studio_id=>$studio_id
|
||||
}
|
||||
);
|
||||
$config, {project_id => $project_id}
|
||||
);
|
||||
|
||||
#list of all studios by id
|
||||
my $studios = studios::get( $config, { project_id => $project_id } );
|
||||
my $studios = studios::get($config, {project_id => $project_id});
|
||||
|
||||
#remove seconds from dates
|
||||
for my $schedule (@$schedules) {
|
||||
$schedule->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
$schedule->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
$schedule->{period_type_days} = 1 if $schedule->{period_type} eq 'days';
|
||||
$schedule->{period_type_week_of_month} = 1 if $schedule->{period_type} eq 'week_of_month';
|
||||
|
||||
#insert assigned studio
|
||||
for my $studio (@$studios) {
|
||||
@@ -213,8 +185,8 @@ sub showTimeslotSchedule {
|
||||
id => $studio->{id},
|
||||
name => $studio->{name},
|
||||
};
|
||||
$entry->{selected} = 1 if ( $studio->{id} eq $schedule->{studio_id} );
|
||||
push @{ $schedule->{studios} }, $entry;
|
||||
$entry->{selected} = 1 if $studio->{id} eq $schedule->{studio_id};
|
||||
push @{$schedule->{studios}}, $entry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,22 +196,17 @@ sub showTimeslotSchedule {
|
||||
};
|
||||
$result->{schedule} = $schedules;
|
||||
$result->{studios} = $studios;
|
||||
$result->{start} = $params->{start};
|
||||
$result->{end} = $params->{end};
|
||||
$result->{end_date} = $params->{end_date};
|
||||
$result->{frequency} = $params->{frequency};
|
||||
|
||||
for my $attr ('start', 'end', 'end_date', 'frequency', 'period_type', 'weekday', 'week_of_month', 'month') {
|
||||
$result->{$attr} = $params->{$attr};
|
||||
}
|
||||
#remove seconds from datetimes
|
||||
$result->{start} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $result->{start};
|
||||
$result->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/ if defined $result->{end};
|
||||
|
||||
#copy entry values to params
|
||||
for my $key ( keys %$result ) {
|
||||
$params->{$key} = $result->{$key};
|
||||
}
|
||||
$params->{$_} = $result->{$_} for keys %$result;
|
||||
|
||||
#print '<pre>'.Dumper($params).'</pre>';
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
template::process($config, 'print', $params->{template}, $params);
|
||||
}
|
||||
|
||||
sub showDates {
|
||||
@@ -249,22 +216,16 @@ sub showDates {
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{read_studio_timeslot_schedule} == 1 ) {
|
||||
uac::permissions_denied('read_studio_timeslot_schedule');
|
||||
return;
|
||||
}
|
||||
return uac::permissions_denied('read_studio_timeslot_schedule')
|
||||
unless $permissions->{read_studio_timeslot_schedule} == 1;
|
||||
|
||||
for my $param ( 'project_id', 'studio_id' ) {
|
||||
unless ( defined $params->{$param} ) {
|
||||
uac::print_error("missing $param");
|
||||
return;
|
||||
}
|
||||
for my $param ('project_id', 'studio_id') {
|
||||
return uac::print_error("missing $param") unless defined $params->{$param};
|
||||
}
|
||||
|
||||
#this will be updated later (especially allow_update_events)
|
||||
for my $permission ( keys %{ $request->{permissions} } ) {
|
||||
$params->{'allow'}->{$permission} = $request->{permissions}->{$permission};
|
||||
}
|
||||
$params->{'allow'}->{$_} = $request->{permissions}->{$_}
|
||||
for (keys %{$request->{permissions}});
|
||||
|
||||
my $studio_id = $params->{studio_id};
|
||||
my $project_id = $params->{project_id};
|
||||
@@ -277,15 +238,13 @@ sub showDates {
|
||||
$config,
|
||||
{
|
||||
project_id => $project_id,
|
||||
|
||||
# studio_id=>$studio_id,
|
||||
from => $fromDate,
|
||||
till => $tillDate
|
||||
}
|
||||
);
|
||||
|
||||
$params->{loc} =
|
||||
localization::get( $config, { user => $params->{presets}->{user}, file => 'all,studio-timeslots' } );
|
||||
localization::get($config, {user => $params->{presets}->{user}, file => 'all,studio-timeslots'});
|
||||
my $language = $params->{loc}->{region};
|
||||
|
||||
# translate weekday names to selected language
|
||||
@@ -299,11 +258,8 @@ sub showDates {
|
||||
'Su' => $params->{loc}->{weekday_Su},
|
||||
};
|
||||
|
||||
my $studios = studios::get( $config, { project_id => $project_id } );
|
||||
my $studio_by_id = {};
|
||||
for my $studio (@$studios) {
|
||||
$studio_by_id->{ $studio->{id} } = $studio;
|
||||
}
|
||||
my $studios = studios::get($config, {project_id => $project_id});
|
||||
my $studio_by_id = {map {$_->{id} => $_} @$studios};
|
||||
|
||||
#remove seconds from dates
|
||||
for my $date (@$timeslot_dates) {
|
||||
@@ -313,11 +269,11 @@ sub showDates {
|
||||
$date->{end} =~ s/(\d\d\:\d\d)\:\d\d/$1/;
|
||||
|
||||
# translate weekday
|
||||
if ( $language ne 'en' ) {
|
||||
$date->{start_weekday} = $weekday->{ $date->{start_weekday} };
|
||||
$date->{end_weekday} = $weekday->{ $date->{end_weekday} };
|
||||
}
|
||||
$date->{studio_name} = $studio_by_id->{ $date->{studio_id} }->{name};
|
||||
if ($language ne 'en') {
|
||||
$date->{start_weekday} = $weekday->{$date->{start_weekday}};
|
||||
$date->{end_weekday} = $weekday->{$date->{end_weekday}};
|
||||
}
|
||||
$date->{studio_name} = $studio_by_id->{$date->{studio_id}}->{name};
|
||||
}
|
||||
my $result = {
|
||||
project_id => $project_id,
|
||||
@@ -326,60 +282,53 @@ sub showDates {
|
||||
};
|
||||
|
||||
#copy entry values to params
|
||||
for my $key ( keys %$result ) {
|
||||
$params->{$key} = $result->{$key};
|
||||
}
|
||||
$params->{$_} = $result->{$_} for keys %$result;
|
||||
|
||||
my $template = template::check( $config, 'studio-timeslot-dates' );
|
||||
template::process( $config, 'print', $template, $params );
|
||||
my $template = template::check($config, 'studio-timeslot-dates');
|
||||
template::process($config, 'print', $template, $params);
|
||||
}
|
||||
|
||||
sub check_params {
|
||||
my $config = shift;
|
||||
my $params = shift;
|
||||
($config, $params) = @_;
|
||||
|
||||
my $checked = {};
|
||||
$checked->{template} = template::check($config, $params->{template}, 'studio-timeslots');
|
||||
|
||||
#actions and roles
|
||||
if ( defined $params->{action} ) {
|
||||
if ( $params->{action} =~ /^(show|save_schedule|delete_schedule|show_dates)$/ ) {
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
$checked->{action} = $params->{action}
|
||||
if ($params->{action}//'') =~ /^(show|save_schedule|delete_schedule|show_dates)$/;
|
||||
|
||||
$checked->{exclude} = 0;
|
||||
entry::set_numbers( $checked, $params, [
|
||||
entry::set_numbers($checked, $params, [
|
||||
'id', 'project_id', 'studio_id', 'default_studio_id', 'schedule_id', 'schedule_studio_id'
|
||||
]);
|
||||
$checked->{default_studio_id} = $checked->{studio_id} // -1;
|
||||
|
||||
if ( ( defined $params->{show_date} ) && ( $params->{show_date} =~ /^(\d\d\d\d)/ ) ) {
|
||||
if (($params->{show_date}//'') =~ /^(\d\d\d\d)/) {
|
||||
$checked->{show_date} = $1;
|
||||
} else {
|
||||
my $date = time::date_to_array( time::time_to_date() );
|
||||
my $date = time::date_to_array(time::time_to_date());
|
||||
$checked->{show_date} = $date->[0];
|
||||
}
|
||||
|
||||
if ( defined $checked->{studio_id} ) {
|
||||
$checked->{default_studio_id} = $checked->{studio_id};
|
||||
} else {
|
||||
$checked->{studio_id} = -1;
|
||||
entry::set_numbers($checked, $params, ['frequency']);
|
||||
if ($params->{period_type}eq 'days') {
|
||||
$checked->{period_type} = $params->{period_type};
|
||||
}elsif($params->{period_type}eq 'week_of_month') {
|
||||
entry::set_numbers($checked, $params, ['weekday', 'week_of_month', 'month']);
|
||||
$checked->{period_type} = $params->{period_type};
|
||||
}
|
||||
|
||||
$checked->{template} = template::check( $config, $params->{template}, 'studio-timeslots' );
|
||||
|
||||
entry::set_numbers( $checked, $params, ['frequency'] );
|
||||
|
||||
for my $attr ( 'start', 'end' ) {
|
||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\d\d\d\d\-\d\d\-\d\d[ T]\d\d\:\d\d)/ ) ) {
|
||||
$checked->{$attr} = $1 . ':00';
|
||||
for my $attr ('start', 'end') {
|
||||
if (($params->{$attr}//'') =~ /(\d\d\d\d\-\d\d\-\d\d[ T]\d\d\:\d\d)/) {
|
||||
$checked->{$attr} = "$1:00";
|
||||
}
|
||||
}
|
||||
for my $attr ('end_date') {
|
||||
if ( ( defined $params->{$attr} ) && ( $params->{$attr} =~ /(\d\d\d\d\-\d\d\-\d\d)/ ) ) {
|
||||
if (($params->{$attr}//'') =~ /(\d\d\d\d\-\d\d\-\d\d)/) {
|
||||
$checked->{$attr} = $1;
|
||||
}
|
||||
}
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,18 +21,9 @@
|
||||
<!-- schedule -->
|
||||
<TMPL_IF .allow.update_schedule>
|
||||
<div id="tabs-schedule" class="panel">
|
||||
|
||||
|
||||
<!-- edit schedule -->
|
||||
<div id="edit_schedule" class="editor">
|
||||
<div class="row">
|
||||
<div class="cell" style="width:1.3em"> <TMPL_VAR .loc.weekday> </div>
|
||||
<div class="cell" style="width:10em"> <TMPL_VAR .loc.label_start> </div>
|
||||
<div class="cell" style="width:1.3em"> <TMPL_VAR .loc.weekday> </div>
|
||||
<div class="cell" style="width:10em"> <TMPL_VAR .loc.label_end> </div>
|
||||
<div class="cell" style="width:7em"> <TMPL_VAR .loc.label_frequency> </div>
|
||||
<div class="cell" style="width:8em"> <TMPL_VAR .loc.label_update_until> </div>
|
||||
<div class="cell" style="width:7em"> <TMPL_VAR .loc.label_studio></div>
|
||||
</div>
|
||||
|
||||
<TMPL_LOOP schedule>
|
||||
<div class="row schedule" id="schedule_<TMPL_VAR schedule_id>">
|
||||
@@ -40,11 +31,31 @@
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR .project_id>" />
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR .studio_id>" />
|
||||
<input type="hidden" name="schedule_id" value="<TMPL_VAR schedule_id>" />
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="start" value="<TMPL_VAR start>" class="datetimepicker start"/> </div>
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_start></div>
|
||||
<input name="start" value="<TMPL_VAR start>" class="datetimepicker start"/>
|
||||
</div>
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="end" value="<TMPL_VAR end>" class="datetimepicker end"/> </div>
|
||||
<div class="cell"><!-- <input name="frequency" value="<TMPL_VAR frequency>" class="frequency" /> -->
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_end></div>
|
||||
<input name="end" value="<TMPL_VAR end>" class="datetimepicker end"/>
|
||||
</div>
|
||||
|
||||
<div class="cell period_type">
|
||||
<div class="label"><TMPL_VAR .loc.period_type></div>
|
||||
<select name="period_type" onchange="showScheduleFields('schedule_<TMPL_VAR schedule_id>')">
|
||||
<option value="days" <TMPL_IF period_type_days>selected="selected"</TMPL_IF>
|
||||
><TMPL_VAR .loc.period_type_days></option>
|
||||
<option value="week_of_month" <TMPL_IF period_type_week_of_month>selected="selected"</TMPL_IF>
|
||||
><TMPL_VAR .loc.period_type_week_of_month></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell frequency">
|
||||
<div class="label"><TMPL_VAR .loc.frequency></div>
|
||||
<select name="frequency" value="<TMPL_VAR frequency>" class="frequency">
|
||||
<option value="1"><TMPL_VAR .loc.daily></option>
|
||||
<option value="7"><TMPL_VAR .loc.weekly></option>
|
||||
@@ -52,22 +63,65 @@
|
||||
<option value="28"><TMPL_VAR .loc.every_four_weeks></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="end_date" value="<TMPL_VAR end_date>" class="datetimepicker end_date"/> </div>
|
||||
<div class="cell">
|
||||
<select name="schedule_studio_id" class="studio">
|
||||
<TMPL_LOOP studios>
|
||||
<option value="<TMPL_VAR id>" <TMPL_IF selected>selected="selected"</TMPL_IF>><TMPL_VAR name></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
|
||||
<div class="cell week_of_month">
|
||||
<div class="label"><TMPL_VAR .loc.week_of_month></div>
|
||||
<select name="week_of_month" value="<TMPL_VAR week_of_month>" class="week_of_month">
|
||||
<option value="1"><TMPL_VAR .loc.week_1st></option>
|
||||
<option value="2"><TMPL_VAR .loc.week_2nd></option>
|
||||
<option value="3"><TMPL_VAR .loc.week_3rd></option>
|
||||
<option value="4"><TMPL_VAR .loc.week_4th></option>
|
||||
<option value="5"><TMPL_VAR .loc.week_5th></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell schedule_weekday">
|
||||
<div class="label"><TMPL_VAR .loc.weekday></div>
|
||||
<select name="weekday" value="<TMPL_VAR weekday>" class="schedule_weekday"/>
|
||||
<option value="1"><TMPL_VAR .loc.monday></option>
|
||||
<option value="2"><TMPL_VAR .loc.tuesday></option>
|
||||
<option value="3"><TMPL_VAR .loc.wednesday></option>
|
||||
<option value="4"><TMPL_VAR .loc.thursday></option>
|
||||
<option value="5"><TMPL_VAR .loc.friday></option>
|
||||
<option value="6"><TMPL_VAR .loc.saturday></option>
|
||||
<option value="7"><TMPL_VAR .loc.sunday></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell schedule_month">
|
||||
<div class="label"><TMPL_VAR .loc.every_month></div>
|
||||
<select name="month" value="<TMPL_VAR month>" class="schedule_month"/>
|
||||
<option value="1"><TMPL_VAR .loc.every_time></option>
|
||||
<option value="2"><TMPL_VAR .loc.every_2nd_time></option>
|
||||
<option value="3"><TMPL_VAR .loc.every_3rd_time></option>
|
||||
<option value="4"><TMPL_VAR .loc.every_4th_time></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_update_until></div>
|
||||
<input name="end_date" value="<TMPL_VAR end_date>" class="datetimepicker end_date"/>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_studio></div>
|
||||
<select name="schedule_studio_id" class="studio">
|
||||
<TMPL_LOOP studios>
|
||||
<option value="<TMPL_VAR id>" <TMPL_IF selected>selected="selected"</TMPL_IF>><TMPL_VAR name></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<button type="submit" name="action" value="save_schedule"><TMPL_VAR .loc.button_save></button>
|
||||
</div>
|
||||
|
||||
<div class="cell"> <button type="submit" name="action" value="save_schedule"><TMPL_VAR .loc.button_save></button> </div>
|
||||
<TMPL_IF .allow.delete_schedule>
|
||||
<div class="cell">
|
||||
<button class="text" type="submit" name="action" value="delete_schedule"
|
||||
<button class="text" type="submit" name="action" value="delete_schedule"
|
||||
onclick="commitForm('form_schedule_<TMPL_VAR schedule_id escape=js>','delete_schedule','<TMPL_VAR .loc.button_delete escape=js>');return false;"
|
||||
><TMPL_VAR .loc.button_delete></button>
|
||||
><TMPL_VAR .loc.button_delete></button>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
</form>
|
||||
@@ -75,15 +129,35 @@
|
||||
</TMPL_LOOP>
|
||||
|
||||
<!-- add schedule-->
|
||||
<div class="row">
|
||||
<form method="post" action="studio-timeslots.cgi">
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR .project_id>" />
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR .studio_id>" />
|
||||
<div class="row schedule row">
|
||||
<form id="schedule_add" method="post" action="studio-timeslots.cgi">
|
||||
<input type="hidden" name="project_id" value="<TMPL_VAR .project_id>" />
|
||||
<input type="hidden" name="studio_id" value="<TMPL_VAR .studio_id>" />
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="start" value="<TMPL_VAR start>" class="datetimepicker start"/> </div>
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_start></div>
|
||||
<input name="start" value="<TMPL_VAR start>" class="datetimepicker start"/>
|
||||
</div>
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="end" value="<TMPL_VAR end>" class="datetimepicker end"/> </div>
|
||||
<div class="cell"> <!--<input name="frequency" value="<TMPL_VAR frequency>" class="frequency"/> -->
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_end></div>
|
||||
<input name="end" value="<TMPL_VAR end>" class="datetimepicker end"/>
|
||||
</div>
|
||||
|
||||
<div class="cell period_type">
|
||||
<div class="label"><TMPL_VAR .loc.period_type></div>
|
||||
<select name="period_type" onchange="showScheduleFields('schedule_add')">
|
||||
<option value="days" <TMPL_IF period_type_days>selected="selected"</TMPL_IF>
|
||||
><TMPL_VAR .loc.period_type_days></option>
|
||||
<option value="week_of_month" <TMPL_IF period_type_week_of_month>selected="selected"</TMPL_IF>
|
||||
><TMPL_VAR .loc.period_type_week_of_month></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell frequency">
|
||||
<div class="label"><TMPL_VAR .loc.frequency></div>
|
||||
<select name="frequency" value="<TMPL_VAR frequency>" class="frequency">
|
||||
<option value="1"><TMPL_VAR .loc.daily></option>
|
||||
<option value="7"><TMPL_VAR .loc.weekly></option>
|
||||
@@ -91,17 +165,59 @@
|
||||
<option value="28"><TMPL_VAR .loc.every_four_weeks></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell"> <input name="end_date" value="<TMPL_VAR end_date>" class="datetimepicker end_date"/> </div>
|
||||
<div class="cell">
|
||||
<select name="schedule_studio_id" >
|
||||
<TMPL_LOOP studios>
|
||||
<option value="<TMPL_VAR id>" <TMPL_IF selected>selected="selected"</TMPL_IF>><TMPL_VAR name></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
|
||||
<div class="cell week_of_month">
|
||||
<div class="label"><TMPL_VAR .loc.week_of_month></div>
|
||||
<select name="week_of_month" value="<TMPL_VAR week_of_month>" class="week_of_month">
|
||||
<option value="1"><TMPL_VAR .loc.week_1st></option>
|
||||
<option value="2"><TMPL_VAR .loc.week_2nd></option>
|
||||
<option value="3"><TMPL_VAR .loc.week_3rd></option>
|
||||
<option value="4"><TMPL_VAR .loc.week_4th></option>
|
||||
<option value="5"><TMPL_VAR .loc.week_5th></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell schedule_weekday">
|
||||
<div class="label"><TMPL_VAR .loc.weekday></div>
|
||||
<select name="weekday" value="<TMPL_VAR weekday>" class="schedule_weekday"/>
|
||||
<option value="1"><TMPL_VAR .loc.monday></option>
|
||||
<option value="2"><TMPL_VAR .loc.tuesday></option>
|
||||
<option value="3"><TMPL_VAR .loc.wednesday></option>
|
||||
<option value="4"><TMPL_VAR .loc.thursday></option>
|
||||
<option value="5"><TMPL_VAR .loc.friday></option>
|
||||
<option value="6"><TMPL_VAR .loc.saturday></option>
|
||||
<option value="7"><TMPL_VAR .loc.sunday></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell schedule_month">
|
||||
<div class="label"><TMPL_VAR .loc.every_month></div>
|
||||
<select name="month" value="<TMPL_VAR month>" class="schedule_month"/>
|
||||
<option value="1"><TMPL_VAR .loc.every_time></option>
|
||||
<option value="2"><TMPL_VAR .loc.every_2nd_time></option>
|
||||
<option value="3"><TMPL_VAR .loc.every_3rd_time></option>
|
||||
<option value="4"><TMPL_VAR .loc.every_4th_time></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="cell weekday"></div>
|
||||
<div class="cell">
|
||||
<div class="label"><TMPL_VAR .loc.label_update_until></div>
|
||||
<input name="end_date" value="<TMPL_VAR end_date>" class="datetimepicker end_date"/>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<select name="schedule_studio_id" >
|
||||
<TMPL_LOOP studios>
|
||||
<option value="<TMPL_VAR id>" <TMPL_IF selected>selected="selected"</TMPL_IF>><TMPL_VAR name></option>
|
||||
</TMPL_LOOP>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<TMPL_IF .allow.update_schedule>
|
||||
<div class="cell"> <button type="submit" name="action" value="save_schedule"><TMPL_VAR .loc.button_create></button> </div>
|
||||
<div class="cell">
|
||||
<button type="submit" name="action" value="save_schedule"><TMPL_VAR .loc.button_create></button>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
</form>
|
||||
</div>
|
||||
@@ -115,12 +231,12 @@
|
||||
<div class="show_schedule_head"> <TMPL_VAR loc.label_select_range>
|
||||
<div id="show_date"> </div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="show_schedule" class="show_schedule">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user