More options for suppression delay
This commit is contained in:
Luc Didry
2014-02-16 17:34:29 +01:00
parent 992850d99b
commit 5da1e9ee03
6 changed files with 38 additions and 16 deletions
+2 -2
View File
@@ -169,7 +169,7 @@ sub startup {
mediatype => $mediatype,
footprint => digest_file_hex($path, 'SHA-512'),
enabled => 1,
delete_at_day => ($c->param('delete-day')) ? 1 : 0,
delete_at_day => ($c->param('delete-day')) ? $c->param('delete-day') : 0,
delete_at_first_view => ($c->param('first-view')) ? 1 : 0,
created_at => time(),
created_by => $ip
@@ -233,7 +233,7 @@ sub startup {
my $ip = $c->ip;
if (scalar(@images)) {
if($images[0]->delete_at_day && $images[0]->created_at + 86400 <= time()) {
if($images[0]->delete_at_day && $images[0]->created_at + $images[0]->delete_at_day * 86400 <= time()) {
# Log deletion
$c->app->log->info('[DELETION] '.$ip.' tried to view '.$images[0]->filename.' but it has been removed by expiration (path: '.$images[0]->path.')');
+6 -1
View File
@@ -44,7 +44,12 @@ our %Lexicon = (
'image_not_found' => 'Unable to find the image',
'no_more_short' => 'There is no more available URL. Retry or contact the administrator. [_1]',
'no_valid_file' => 'The file [_1] is not an image.',
'file_too_big' => 'The file exceed the size limit ([_1])'
'file_too_big' => 'The file exceed the size limit ([_1])',
'no_time_limit' => 'No time limit',
'24_hours' => '24 hours',
'7_days' => '7 days',
'30_days' => '30 days',
'1_year' => 'One year',
);
1;
+6 -1
View File
@@ -44,7 +44,12 @@ our %Lexicon = (
'image_not_found' => 'Impossible de trouver l\'image',
'no_more_short' => 'Il n\'y a plus d\'URL disponible. Veuillez réessayer ou contactez l\'administrateur. [_1].',
'no_valid_file' => 'Le fichier [_1] n\'est pas une image.',
'file_too_big' => 'Le fichier dépasse la limite de taille ([_1])'
'file_too_big' => 'Le fichier dépasse la limite de taille ([_1])',
'no_time_limit' => 'Pas de limitation de durée',
'24_hours' => '24 heures',
'7_days' => '7 jours',
'30_days' => '30 jours',
'1_year' => 'Un an',
);
1;
+1 -1
View File
@@ -200,7 +200,7 @@
//});
fd.append('format', 'json');
fd.append('first-view', ($("#first-view").prop('checked')) ? 1 : 0);
fd.append('delete-day', ($("#delete-day").prop('checked')) ? 1 : 0);
fd.append('delete-day', ($("#delete-day").val()));
widget.settings.onBeforeUpload.call(widget.element, widget.queuePos);
+1 -1
View File
@@ -10,5 +10,5 @@
// c.each(h.settings.extraData,function(i,j){f.append(i,j)});
f.append('format', 'json');
f.append('first-view', ($("#first-view").prop('checked')) ? 1 : 0);
f.append('delete-day', ($("#delete-day").prop('checked')) ? 1 : 0);
f.append('delete-day', ($("#delete-day").val()));
h.settings.onBeforeUpload.call(h.element,h.queuePos);h.queueRunning=true;c.ajax({url:h.settings.url,type:h.settings.method,dataType:h.settings.dataType,data:f,cache:false,contentType:false,processData:false,forceSync:false,xhr:function(){var i=c.ajaxSettings.xhr();if(i.upload){i.upload.addEventListener("progress",function(m){var l=0;var j=m.loaded||m.position;var k=m.total||e.totalSize;if(m.lengthComputable){l=Math.ceil(j/k*100)}h.settings.onUploadProgress.call(h.element,h.queuePos,l)},false)}return i},success:function(j,i,k){h.settings.onUploadSuccess.call(h.element,h.queuePos,j)},error:function(k,i,j){h.settings.onUploadError.call(h.element,h.queuePos,j)},complete:function(i,j){h.processQueue()}})};c.fn.dmUploader=function(f){return this.each(function(){if(!c.data(this,b)){c.data(this,b,new a(this,f))}})};c(document).on("dragenter",function(f){f.stopPropagation();f.preventDefault()});c(document).on("dragover",function(f){f.stopPropagation();f.preventDefault()});c(document).on("drop",function(f){f.stopPropagation();f.preventDefault()})})(jQuery);
+22 -10
View File
@@ -23,16 +23,22 @@
<noscript>
<form class="form" role="form" method="POST" action="<%== url_for 'add' %>" enctype="multipart/form-data">
<div class="form-group form-inline">
<span>
<label>
<select name="delete-day">
<option value=0 selected="selected">pas de limitation de durée</option>
<option value=1>24 heures</option>
<option value=7>7 jours</option>
<option value=30>30 jours</option>
<option value=365>1 an</option>
</select>
</label>
</span>
<div class="checkbox">
<label>
<input type="checkbox" name="first-view"> <%=l 'delete-first' %>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="delete-day"> <%=l 'delete-day' %>
</label>
</div>
</div>
<div class="form-group">
<label for="lutim-file"><%=l 'upload_image' %></label>
@@ -46,16 +52,22 @@
<!-- D&D Zone-->
<div class="jsonly">
<div class="form-group form-inline">
<span>
<label>
<select id="delete-day">
<option value=0 selected="selected">pas de limitation de durée</option>
<option value=1>24 heures</option>
<option value=7>7 jours</option>
<option value=30>30 jours</option>
<option value=365>1 an</option>
</select>
</label>
</span>
<div class="checkbox">
<label>
<input type="checkbox" id="first-view"> <%=l 'delete-first' %>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="delete-day"> <%=l 'delete-day' %>
</label>
</div>
</div>
<div id="drag-and-drop-zone" class="uploader">
<div><%=l 'drag-n-drop' %></div>