diff --git a/README.md b/README.md index ff9f6ac..60c7fac 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ vi lutim.conf * stats\_day\_num: when you generate statistics with `script/lutim cron stats`, you will have stats for the last `stats_day_num` days (default is 365) ; * keep\_ip\_during: when you delete IP addresses of image's senders with `script/lutim cron cleanbdd`, the IP addresses of images older than `keep_ip_during` days will be deleted (default is 365) ; * broadcast\_message: put some string (not HTML) here and this message will be displayed on all LUTIm pages (not in JSON responses) ; -* allowed\_domains: array of authorized domains for API calls. Example: `['http://1.example.com', 'http://2.example.com']`. If you want to authorize everyone to use the API: `['*']`. +* allowed\_domains: array of authorized domains for API calls. Example: `['http://1.example.com', 'http://2.example.com']`. If you want to authorize everyone to use the API: `['*']` ; +* default\_delay: what is the default time limit for files? Valid values are 0, 1, 7, 30 and 365. ##Usage ``` diff --git a/lib/Lutim.pm b/lib/Lutim.pm index d15cb1f..fa759ea 100644 --- a/lib/Lutim.pm +++ b/lib/Lutim.pm @@ -126,6 +126,17 @@ sub startup { } ); + $self->helper( + is_selected => sub { + my $c = shift; + my $num = shift; + + $c->config->{default_delay} = 0 unless (defined($c->config->{default_delay})); + + return ($num == $c->config->{default_delay}) ? 'selected="selected"' : ''; + } + ); + $self->hook( before_dispatch => sub { my $c = shift; diff --git a/lib/Lutim/I18N/en.pm b/lib/Lutim/I18N/en.pm index 3b2ad53..8c4fa25 100644 --- a/lib/Lutim/I18N/en.pm +++ b/lib/Lutim/I18N/en.pm @@ -59,6 +59,11 @@ our %Lexicon = ( 'no_valid_url' => 'The URL is not valid.', 'image_url' => 'Image URL', 'upload_image_url' => 'Upload an image with its URL', + 'delay_0' => 'no time limit', + 'delay_1' => '24 hours', + 'delay_7' => '7 days', + 'delay_30' => '30 days', + 'delay_365' => '1 year', ); 1; diff --git a/lib/Lutim/I18N/fr.pm b/lib/Lutim/I18N/fr.pm index 6dba0dc..0a312dd 100644 --- a/lib/Lutim/I18N/fr.pm +++ b/lib/Lutim/I18N/fr.pm @@ -59,6 +59,11 @@ our %Lexicon = ( 'no_valid_url' => 'l\'URL n\'est pas valide.', 'image_url' => 'URL de l\'image', 'upload_image_url' => 'Déposer une image par son URL', + 'delay_0' => 'pas de limitation de durée', + 'delay_1' => '24 heures', + 'delay_7' => '7 jours', + 'delay_30' => '30 jours', + 'delay_365' => '1 an', ); 1; diff --git a/lutim.conf.template b/lutim.conf.template index 7288bc1..7fa180f 100644 --- a/lutim.conf.template +++ b/lutim.conf.template @@ -22,4 +22,5 @@ #policy_when_full => 'warn', # optional, policy when files directory is over max_total_size. Valid values are 'warn', 'stop-upload' and 'delete'. See README. #broadcast_message => 'Maintenance', #optional, the broadcast_message is displayed on all pages of LUTIm (but no in json response) #allowed_domains => ['http://1.example.com', 'http://2.example.com'], #optional, array of authorized domains for API calls. If you want to authorize everyone to use the API: ['*'] + #default_delay => 0, #optional: what is the default time limit for files? Valid values are 0, 1, 7, 30 and 365. }; diff --git a/templates/index.html.ep b/templates/index.html.ep index fc745b7..cc1deb1 100644 --- a/templates/index.html.ep +++ b/templates/index.html.ep @@ -24,17 +24,11 @@