config cache issues
By default the configuration cached by the mod_perl2 instance. You can disable cache by setting cache/config=0. You should disable cache only if you have multiple calcms instances running on the same mod_perl2 server with different configuration. The Location of the configuration will be determined by config module now.
This commit is contained in:
@@ -1417,6 +1417,7 @@ sub print_event {
|
||||
|
||||
my $attr = '';
|
||||
if ( $class =~ /play/ ) {
|
||||
#$event->{rms_image}=~s/\.png/.svg/;
|
||||
$attr .= ' rms="' . $event->{rms_image} . '"' if defined $event->{rms_image};
|
||||
$attr .= ' start="' . $event->{start} . '"' if defined $event->{start};
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ my $user_presets = uac::get_user_presets(
|
||||
);
|
||||
$params->{default_studio_id} = $user_presets->{studio_id};
|
||||
$params->{studio_id} = $params->{default_studio_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
if ( !defined $params->{action} ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||
$params->{project_id} = $user_presets->{project_id}
|
||||
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
|
||||
if ( !defined $params->{action} ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' );
|
||||
|
||||
#print STDERR $params->{project_id}."\n";
|
||||
my $request = {
|
||||
@@ -87,9 +87,14 @@ sub show_events {
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{assign_series_events} == 1 ) {
|
||||
uac::permissions_denied('assign_series_events');
|
||||
uac::permissions_denied('read_events');
|
||||
return;
|
||||
}
|
||||
|
||||
my $events = getDates( $config, $request );
|
||||
$params->{events} = $events;
|
||||
$params->{total} = scalar(@$events);
|
||||
$params->{action} = 'show';
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
|
||||
}
|
||||
@@ -106,6 +111,31 @@ sub create_events {
|
||||
}
|
||||
|
||||
print STDERR "create events\n";
|
||||
my $dates = getDates( $config, $request );
|
||||
|
||||
print STDERR "<pre>found " . ( scalar @$dates ) . " dates\n";
|
||||
my $events = [];
|
||||
for my $date (@$dates) {
|
||||
|
||||
#print STDERR $date->{start}."\n";
|
||||
push @$events, createEvent( $config, $request, $date );
|
||||
}
|
||||
$params->{events} = $events;
|
||||
$params->{total} = scalar(@$events);
|
||||
$params->{action} = 'created';
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
}
|
||||
|
||||
sub getDates {
|
||||
my $config = shift;
|
||||
my $request = shift;
|
||||
|
||||
my $params = $request->{params}->{checked};
|
||||
my $permissions = $request->{permissions};
|
||||
unless ( $permissions->{read_event} == 1 ) {
|
||||
uac::permissions_denied('read_event');
|
||||
return;
|
||||
}
|
||||
|
||||
my $project_id = $params->{project_id};
|
||||
my $studio_id = $params->{studio_id};
|
||||
@@ -126,8 +156,7 @@ sub create_events {
|
||||
}
|
||||
$params->{from_date} = $from_date;
|
||||
$params->{till_date} = $till_date;
|
||||
|
||||
print STDERR "create events from $from_date to $till_date\n";
|
||||
print STDERR "$0: get events from $from_date to $till_date\n";
|
||||
|
||||
my $dates = series_dates::getDatesWithoutEvent(
|
||||
$config,
|
||||
@@ -138,16 +167,8 @@ sub create_events {
|
||||
till => $till_date
|
||||
}
|
||||
);
|
||||
print STDERR "<pre>found " . ( scalar @$dates ) . " dates\n";
|
||||
my $events = [];
|
||||
for my $date (@$dates) {
|
||||
|
||||
#print STDERR $date->{start}."\n";
|
||||
push @$events, createEvent( $config, $request, $date );
|
||||
}
|
||||
$params->{created_events} = $events;
|
||||
$params->{created_total} = scalar(@$events);
|
||||
template::process( $config, 'print', $params->{template}, $params );
|
||||
return $dates;
|
||||
}
|
||||
|
||||
sub createEvent {
|
||||
@@ -191,7 +212,7 @@ sub check_params {
|
||||
#actions and roles
|
||||
$checked->{action} = '';
|
||||
if ( defined $params->{action} ) {
|
||||
if ( $params->{action} =~ /^(create_events)$/ ) {
|
||||
if ( $params->{action} =~ /^(create_events|show_events)$/ ) {
|
||||
$checked->{action} = $params->{action};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,17 @@
|
||||
<TMPL_IF .allow.scan_series_events>
|
||||
|
||||
<script type="text/javascript">
|
||||
<TMPL_IF .getBack>
|
||||
$(document).ready(
|
||||
function(){
|
||||
getBack()
|
||||
}
|
||||
);
|
||||
</TMPL_IF>
|
||||
|
||||
function assign_series(project_id, studio_id){
|
||||
if (project_id == '') return false;
|
||||
if (studio_id == '') return false;
|
||||
|
||||
var url="create_events.cgi?project_id="+project_id+'&studio_id='+studio_id+'&action=create_events';
|
||||
$('#create_event_form').submit();
|
||||
return false;
|
||||
}
|
||||
<TMPL_IF .allow.read_event> <script type="text/javascript">
|
||||
<TMPL_IF .getBack>
|
||||
$(document).ready(function() {
|
||||
getBack()
|
||||
});
|
||||
</TMPL_IF>
|
||||
</script>
|
||||
|
||||
|
||||
<h1>create events from schedule</h1>
|
||||
|
||||
<form id="create_event_form">
|
||||
<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="action" value="create_events">
|
||||
|
||||
duration
|
||||
<form id="create_event_form" method="post">
|
||||
<input type="hidden" name="project_id"
|
||||
value="<TMPL_VAR .project_id>"> <input type="hidden"
|
||||
name="studio_id" value="<TMPL_VAR .studio_id>"> duration
|
||||
<select name="duration">
|
||||
<option value="7">1 week</option>
|
||||
<option value="14">2 weeks</option>
|
||||
@@ -35,20 +19,25 @@ function assign_series(project_id, studio_id){
|
||||
<option value="28">4 weeks</option>
|
||||
</select>
|
||||
|
||||
<button target="_blank"
|
||||
onclick="assign_series('<TMPL_VAR .project_id>', '<TMPL_VAR .studio_id>');return false;"
|
||||
>create</button>
|
||||
<TMPL_IF .allow.read_event>
|
||||
<button target="_blank" type='submit' name="action" value="show">show</button>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF .allow.assign_series_events>
|
||||
<button target="_blank" type='submit' name="action"
|
||||
value="create_events">create</button>
|
||||
</TMPL_IF>
|
||||
</form>
|
||||
|
||||
<div class="view" style="clear:both">
|
||||
created <TMPL_VAR created_total> events from <TMPL_VAR from_date> till <TMPL_VAR till_date><br>
|
||||
<TMPL_LOOP created_events> events created
|
||||
<TMPL_var start><TMPL_var full_title><br>
|
||||
</TMPL_LOOP>
|
||||
<div class="view" style="clear: both">
|
||||
<TMPL_VAR action> <TMPL_VAR created_total>
|
||||
events from <TMPL_VAR from_date> till <TMPL_VAR till_date>
|
||||
<br>
|
||||
|
||||
</view>
|
||||
<TMPL_LOOP events> <TMPL_var start> <TMPL_var
|
||||
full_title> <br></TMPL_LOOP> </view>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<TMPL_ELSE> missing permission to read events
|
||||
</TMPL_IF>
|
||||
|
||||
Reference in New Issue
Block a user