aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2014-05-28 09:33:17 +0000
committerplegall <plg@piwigo.org>2014-05-28 09:33:17 +0000
commit682148e9179d52bfc3d85a75f3e6be5bdc3c7c51 (patch)
treef19e6294c8c91aa78265eedd7f21c784264a2bb6
parentbe60fee094e10fab1bee10c90665a9c3e37062ab (diff)
feature 2616, customizations for plupload
* bug fixed, remove debug inserts in table "plupload" * display photo title as tooltip on thumbnail * hide useless .plupload_header * hide any other form fieldset until an album is selected git-svn-id: http://piwigo.org/svn/trunk@28552 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/themes/default/js/addAlbum.js2
-rw-r--r--admin/themes/default/template/photos_add_direct.tpl95
-rw-r--r--admin/themes/default/theme.css5
-rw-r--r--include/ws_functions/pwg.images.php15
4 files changed, 27 insertions, 90 deletions
diff --git a/admin/themes/default/js/addAlbum.js b/admin/themes/default/js/addAlbum.js
index dec06532e..0efdd8c95 100644
--- a/admin/themes/default/js/addAlbum.js
+++ b/admin/themes/default/js/addAlbum.js
@@ -83,7 +83,7 @@ jQuery.fn.pwgAddAlbum = function(options) {
}
albumParent.val('');
- jQuery('#albumSelection').show();
+ jQuery('#albumSelection, .selectFiles, .showFieldset').show();
},
error: function(XMLHttpRequest, textStatus, errorThrows) {
jQuery('#albumCreationLoading').hide();
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index b5b471fb9..8f7bee6e1 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -25,7 +25,7 @@ var categoriesCache = new CategoriesCache({
categoriesCache.selectize(jQuery('[data-selectize=categories]'), {
filter: function(categories, options) {
if (categories.length > 0) {
- jQuery("#albumSelection").show();
+ jQuery("#albumSelection, .selectFiles, .showFieldset").show();
options.default = categories[0].id;
}
@@ -42,70 +42,10 @@ var pwg_token = '{$pwg_token}';
var buttonText = "{'Select files'|@translate}";
var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
+var noAlbum_message = "{'Select an album'|translate}";
+
{literal}
jQuery(document).ready(function(){
- function checkUploadStart() {
- var nbErrors = 0;
- jQuery("#formErrors").hide();
- jQuery("#formErrors li").hide();
-
- if (jQuery("select[name=category]").val() == '') {
- jQuery("#formErrors #noAlbum").show();
- nbErrors++;
- }
-
- var nbFiles = 0;
- if (jQuery("#uploadBoxes").size() == 1) {
- jQuery("input[name^=image_upload]").each(function() {
- if (jQuery(this).val() != "") {
- nbFiles++;
- }
- });
- }
- else {
- nbFiles = jQuery(".uploadifyQueueItem").size();
- }
-
- if (nbFiles == 0) {
- jQuery("#formErrors #noPhoto").show();
- nbErrors++;
- }
-
- if (nbErrors != 0) {
- jQuery("#formErrors").show();
- return false;
- }
- else {
- return true;
- }
-
- }
-
- function humanReadableFileSize(bytes) {
- var byteSize = Math.round(bytes / 1024 * 100) * .01;
- var suffix = 'KB';
-
- if (byteSize > 1000) {
- byteSize = Math.round(byteSize *.001 * 100) * .01;
- suffix = 'MB';
- }
-
- var sizeParts = byteSize.toString().split('.');
- if (sizeParts.length > 1) {
- byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);
- }
- else {
- byteSize = sizeParts[0];
- }
-
- return byteSize+suffix;
- }
-
- jQuery("#hideErrors").click(function() {
- jQuery("#formErrors").hide();
- return false;
- });
-
jQuery("#uploadWarningsSummary a.showInfo").click(function() {
jQuery("#uploadWarningsSummary").hide();
jQuery("#uploadWarnings").show();
@@ -176,10 +116,12 @@ jQuery(document).ready(function(){
jQuery("#uploadedPhotos").parent("fieldset").show();
html = '<a href="admin.php?page=photo-'+data.result.image_id+'" target="_blank">';
- html += '<img src="'+data.result.src+'" class="thumbnail">';
+ html += '<img src="'+data.result.src+'" class="thumbnail" title="'+data.result.name+'">';
html += '</a> ';
jQuery("#uploadedPhotos").prepend(html);
+
+ up.removeFile(file);
}
}
});
@@ -194,6 +136,14 @@ jQuery(document).ready(function(){
<div id="photosAddContent">
+{*
+<div class="infos">
+ <ul>
+ <li>%d photos added..</li>
+ </ul>
+</div>
+*}
+
{if count($setup_errors) > 0}
<div class="errors">
<ul>
@@ -231,16 +181,7 @@ jQuery(document).ready(function(){
<p style="margin:10px"><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p>
{else}
-<div id="formErrors" class="errors" style="display:none">
- <ul>
- <li id="noAlbum">{'Select an album'|@translate}</li>
- <li id="noPhoto">{'Select at least one photo'|@translate}</li>
- </ul>
- <div class="hideButton" style="text-align:center"><a href="#" id="hideErrors">{'Hide'|@translate}</a></div>
-</div>
-
-
-<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}" class="properties">
+<form id="uploadForm" enctype="multipart/form-data" method="post" action="{$form_action}">
{if $upload_mode eq 'multiple'}
<input name="upload_id" value="{$upload_id}" type="hidden">
{/if}
@@ -255,7 +196,7 @@ jQuery(document).ready(function(){
<a href="#" data-add-album="category" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</fieldset>
- <p class="showFieldset"><a id="showPermissions" href="#">{'Manage Permissions'|@translate}</a></p>
+ <p class="showFieldset" style="display:none"><a id="showPermissions" href="#">{'Manage Permissions'|@translate}</a></p>
<fieldset id="permissions" style="display:none">
<legend>{'Who can see these photos?'|@translate}</legend>
@@ -265,7 +206,7 @@ jQuery(document).ready(function(){
</select>
</fieldset>
- <fieldset>
+ <fieldset class="selectFiles" style="display:none">
<legend>{'Select files'|@translate}</legend>
{if isset($original_resize_maxheight)}<p class="uploadInfo">{'The picture dimensions will be reduced to %dx%d pixels.'|@translate:$original_resize_maxwidth:$original_resize_maxheight}</p>{/if}
@@ -282,7 +223,7 @@ jQuery(document).ready(function(){
<div id="uploader">
- <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
+ <p>Your browser doesn't have HTML5 support.</p>
</div>
</fieldset>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index 88928807f..65d26f6a2 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -983,6 +983,11 @@ LEGEND {
#order_filters .order_by_is_custom {display:block;font-weight:normal;font-style:italic;margin-left:20px;}
/* Upload Form */
+.plupload_header {display:none;}
+#uploadForm .plupload_container {padding:0}
+#uploadForm .plupload_scroll .plupload_filelist {height:250px;}
+#uploadForm li.plupload_droptext {line-height:230px;font-size:2em;}
+
#uploadBoxes .file {margin-bottom:5px;text-align:left;}
#uploadBoxes {margin-top:20px;}
#addUploadBox {margin-bottom:2em;}
diff --git a/include/ws_functions/pwg.images.php b/include/ws_functions/pwg.images.php
index 6e224e6e4..70a7f694f 100644
--- a/include/ws_functions/pwg.images.php
+++ b/include/ws_functions/pwg.images.php
@@ -1302,18 +1302,7 @@ function ws_images_upload($params, $service)
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
- file_put_contents('/tmp/plupload.log', "[".date('c')."] ".__FUNCTION__.', '.$fileName.' '.($chunk+1).'/'.$chunks."\n", FILE_APPEND);
-
- single_insert(
- 'plupload',
- array(
- 'received_on' => date('c'),
- 'filename' => $fileName,
- 'chunk' => $chunk+1,
- 'chunks' => $chunks,
- )
- );
-
+ // file_put_contents('/tmp/plupload.log', "[".date('c')."] ".__FUNCTION__.', '.$fileName.' '.($chunk+1).'/'.$chunks."\n", FILE_APPEND);
// Open temp file
if (!$out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb"))
@@ -1369,6 +1358,7 @@ function ws_images_upload($params, $service)
$query = '
SELECT
id,
+ name,
path
FROM '.IMAGES_TABLE.'
WHERE id = '.$image_id.'
@@ -1378,6 +1368,7 @@ SELECT
return array(
'image_id' => $image_id,
'src' => DerivativeImage::thumb_url($image_infos),
+ 'name' => $image_infos['name'],
);
}
}