merge -r17289 from trunk to 2.4: batch manager improvements/fixes:

- when refreshing photo set, start is set to 0 (otherwise if the new set is smaller that start, it looks like it is empty)
- correct positioning of thumbnails (width/height) is done in template instead of javascript (immediate instead on ready + no reflows)
- less space lost on batch manager page
- fix wrong page title in batch manager because of global variable $title overriden
- fix language keys in element_set_ranks (capital/lowercase issue)

git-svn-id: http://piwigo.org/svn/branches/2.4@17290 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2012-08-01 17:00:07 +00:00
parent a7895bf67b
commit 4b181b746f
7 changed files with 98 additions and 116 deletions

View file

@ -50,7 +50,7 @@ check_input_parameter('selection', $_POST, true, PATTERN_ID);
if (isset($_POST['submitFilter']))
{
// echo '<pre>'; print_r($_POST); echo '</pre>';
unset($_REQUEST['start']); // new photo set must reset the page
$_SESSION['bulk_manager_filter'] = array();
if (isset($_POST['filter_prefilter_use']))
@ -335,16 +335,16 @@ $page['cat_elements_id'] = $current_set;
// category. For exampe, $page['start'] = 12 means we must show elements #12
// and $page['nb_images'] next elements
if (!isset($_GET['start'])
or !is_numeric($_GET['start'])
or $_GET['start'] < 0
or (isset($_GET['display']) and 'all' == $_GET['display']))
if (!isset($_REQUEST['start'])
or !is_numeric($_REQUEST['start'])
or $_REQUEST['start'] < 0
or (isset($_REQUEST['display']) and 'all' == $_REQUEST['display']))
{
$page['start'] = 0;
}
else
{
$page['start'] = $_GET['start'];
$page['start'] = $_REQUEST['start'];
}
// +-----------------------------------------------------------------------+

View file

@ -472,8 +472,9 @@ $template->assign(
'filter' => $_SESSION['bulk_manager_filter'],
'selection' => $collection,
'all_elements' => $page['cat_elements_id'],
'START' => $page['start'],
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
'F_ACTION'=>$base_url.get_query_string_diff(array('cat')),
'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start')),
)
);
@ -732,7 +733,6 @@ if (count($page['cat_elements_id']) > 0)
$conf['order_by'] = ' ORDER BY file, id';
}
$query = '
SELECT id,path,representative_ext,file,filesize,level,name,width,height,rotation
FROM '.IMAGES_TABLE;
@ -766,31 +766,30 @@ SELECT id,path,representative_ext,file,filesize,level,name,width,height,rotation
;';
$result = pwg_query($query);
$thumb_params = ImageStdParams::get_by_type(IMG_THUMB);
// template thumbnail initialization
while ($row = pwg_db_fetch_assoc($result))
{
$nb_thumbs_page++;
$src_image = new SrcImage($row);
$title = render_element_name($row);
if ($title != get_name_from_file($row['file']))
$ttitle = render_element_name($row);
if ($ttitle != get_name_from_file($row['file']))
{
$title.= ' ('.$row['file'].')';
$ttitle.= ' ('.$row['file'].')';
}
$template->append(
'thumbnails',
'thumbnails', array_merge($row,
array(
'ID' => $row['id'],
'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image),
'FILE' => $row['file'],
'TITLE' => $title,
'LEVEL' => $row['level'],
'thumb' => new DerivativeImage($thumb_params, $src_image),
'TITLE' => $ttitle,
'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image),
'U_EDIT' => get_root_url().'admin.php?page=photo-'.$row['id'],
)
);
));
}
$template->assign('thumb_params', $thumb_params);
}
$template->assign(

View file

@ -239,21 +239,21 @@ if (pwg_db_num_rows($result) > 0)
// image order management
$sort_fields = array(
'' => '',
'file' => l10n('file name, A &rarr; Z'),
'file DESC' => l10n('file name, Z &rarr; A'),
'name' => l10n('photo title, A &rarr; Z'),
'name DESC' => l10n('photo title, Z &rarr; A'),
'date_creation DESC' => l10n('date created, new &rarr; old'),
'date_creation' => l10n('date created, old &rarr; new'),
'date_available DESC' => l10n('date posted, new &rarr; old'),
'date_available' => l10n('date posted, old &rarr; new'),
'rating_score DESC' => l10n('rating score, high &rarr; low'),
'rating_score' => l10n('rating score, low &rarr; high'),
'hit DESC' => l10n('visits, high &rarr; low'),
'hit' => l10n('visits, low &rarr; high'),
'id' => l10n('numeric identifier, 1 &rarr; 9'),
'id DESC' => l10n('numeric identifier, 9 &rarr; 1'),
'rank' => l10n('manual sort order'),
'file' => l10n('File name, A &rarr; Z'),
'file DESC' => l10n('File name, Z &rarr; A'),
'name' => l10n('Photo title, A &rarr; Z'),
'name DESC' => l10n('Photo title, Z &rarr; A'),
'date_creation DESC' => l10n('Date created, new &rarr; old'),
'date_creation' => l10n('Date created, old &rarr; new'),
'date_available DESC' => l10n('Date posted, new &rarr; old'),
'date_available' => l10n('Date posted, old &rarr; new'),
'rating_score DESC' => l10n('Rating score, high &rarr; low'),
'rating_score' => l10n('Rating score, low &rarr; high'),
'hit DESC' => l10n('Visits, high &rarr; low'),
'hit' => l10n('Visits, low &rarr; high'),
'id' => l10n('Numeric identifier, 1 &rarr; 9'),
'id DESC' => l10n('Numeric identifier, 9 &rarr; 1'),
'rank' => l10n('Manual sort order'),
);
$template->assign('image_order_options', $sort_fields);

View file

@ -97,8 +97,6 @@ h3, .content, .throw, .row1 { background-color: #ddd; }
UL.thumbnails span.wrap2:hover { background-color:#7CBA0F; color:#999; }
UL.thumbnails span.wrap2 {
padding: 4px;
border-radius: 4px;
background-color:#ddd;
}
@ -111,7 +109,7 @@ TEXTAREA { cursor:text; font-size: 13px; }
.tagSelected LABEL {color:black;}
.content ul.categoryActions a img { margin-left: 10px; }
ul.thumbnails input { border:3px double #666; color:#666; font-size:10px; margin:0; background-color:#bbb; text-align: center;}
ul.thumbnails input { color:#666; font-size:10px; margin:0; background-color:#bbb; text-align: center;}
INPUT.bigbutton:hover { background-color: #ddd; color:#0cc; border: 0; }
.throw { font-size: 120%; line-height: 26px; padding-top: 10px; font-weight: bold; }
label { cursor:pointer }

View file

@ -50,6 +50,7 @@ jQuery(document).ready(function() {
$(this).click(function(event) {console.log(event.shiftKey);$(this).triggerHandler("shclick",event)});
});
}
$('ul.thumbnails').enableShiftClick();
});
{/literal}{/footer_script}
@ -481,17 +482,7 @@ $(document).ready(function() {
checkPermitAction()
});
jQuery(window).load(function() {
var max_w=0, max_h=0;
$(".thumbnails img").each(function () {
max_w = Math.max(max_w, $(this).width() );
max_h = Math.max(max_h, $(this).height() );
});
max_w += 10;
max_h += 35;
$("ul.thumbnails span, ul.thumbnails label").css('width', max_w+'px').css('height', max_h+'px');
$('ul.thumbnails').enableShiftClick();
});
{/literal}{/footer_script}
<div id="batchManagerGlobal">
@ -499,6 +490,7 @@ jQuery(window).load(function() {
<h2>{'Batch Manager'|@translate}</h2>
<form action="{$F_ACTION}" method="post">
<input type="hidden" name="start" value="{$START}">
<fieldset>
<legend>{'Filter'|@translate}</legend>
@ -510,7 +502,7 @@ jQuery(window).load(function() {
{'Predefined filter'|@translate}
<select name="filter_prefilter">
{foreach from=$prefilters item=prefilter}
<option value="{$prefilter.ID}" {if $filter.prefilter eq $prefilter.ID}selected="selected"{/if}>{$prefilter.NAME}</option>
<option value="{$prefilter.ID}" {if isset($filter.prefilter) && $filter.prefilter eq $prefilter.ID}selected="selected"{/if}>{$prefilter.NAME}</option>
{/foreach}
</select>
</li>
@ -528,9 +520,9 @@ jQuery(window).load(function() {
<input type="checkbox" name="filter_tags_use" class="useFilterCheckbox" {if isset($filter.tags)}checked="checked"{/if}>
{'Tags'|@translate}
<select id="tagsFilter" name="filter_tags">
{foreach from=$filter_tags item=tag}
{if isset($filter_tags)}{foreach from=$filter_tags item=tag}
<option value="{$tag.id}">{$tag.name}</option>
{/foreach}
{/foreach}{/if}
</select>
<label><span><input type="radio" name="tag_mode" value="AND" {if !isset($filter.tag_mode) or $filter.tag_mode eq 'AND'}checked="checked"{/if}> {'All tags'|@translate}</span></label>
<label><span><input type="radio" name="tag_mode" value="OR" {if isset($filter.tag_mode) and $filter.tag_mode eq 'OR'}checked="checked"{/if}> {'Any tag'|@translate}</span></label>
@ -546,7 +538,7 @@ jQuery(window).load(function() {
</li>
</ul>
<p class="actionButtons" style="">
<p class="actionButtons">
<select id="addFilter">
<option value="-1">{'Add a filter'|@translate}</option>
<option disabled="disabled">------------------</option>
@ -586,32 +578,34 @@ jQuery(window).load(function() {
<input type="checkbox" name="setSelected" style="display:none" {if count($selection) == $nb_thumbs_set}checked="checked"{/if}>
</p>
<ul class="thumbnails">
{foreach from=$thumbnails item=thumbnail}
{if in_array($thumbnail.ID, $selection)}
{assign var='isSelected' value=true}
{else}
{assign var='isSelected' value=false}
{/if}
<li>
<span class="wrap1">
<label>
<span class="wrap2{if $isSelected} thumbSelected{/if}">
<div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> &middot; <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div>
{if $thumbnail.LEVEL > 0}
<em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
<em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
{/if}
<span>
<img src="{$thumbnail.TN_SRC}" alt="{$thumbnail.FILE}" title="{$thumbnail.TITLE|@escape:'html'}" class="thumbnail">
</span>
</span>
<input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
</label>
</span>
</li>
{/foreach}
</ul>
<ul class="thumbnails">
{html_style}
UL.thumbnails SPAN.wrap2{ldelim}
width: {$thumb_params->max_width()+2}px;
}
UL.thumbnails SPAN.wrap2 {ldelim}
height: {$thumb_params->max_height()+25}px;
}
{/html_style}
{foreach from=$thumbnails item=thumbnail}
{assign var='isSelected' value=$thumbnail.id|@in_array:$selection}
<li>
<span class="wrap1">
<label>
<input type="checkbox" name="selection[]" value="{$thumbnail.id}" {if $isSelected}checked="checked"{/if}>
<span class="wrap2{if $isSelected} thumbSelected{/if}">
<div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> &middot; <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div>
{if $thumbnail.level > 0}
<em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.level))}</em>
<em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.level))}</em>
{/if}
<img src="{$thumbnail.thumb->get_url()}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE|@escape:'html'}" {$thumbnail.thumb->get_size_htm()}>
</span>
</label>
</span>
</li>
{/foreach}
</ul>
{if !empty($navbar) }
<div style="clear:both;">
@ -713,7 +707,7 @@ jQuery(window).load(function() {
<!-- del_tags -->
<div id="action_del_tags" class="bulkAction">
{$DEL_TAG_SELECTION}
{if !empty($DEL_TAG_SELECTION)}{$DEL_TAG_SELECTION}{/if}
</div>
<!-- author -->

View file

@ -42,12 +42,13 @@ UL.thumbnails li.rank-of-image {
float: left;
background-color: #333;
color: #666;
-moz-border-radius: 5px;
border-radius: 5px;
display: block;
width: 104px;
height: 104px;
width: 120px;
height: 120px;
cursor: move;
margin: 10px;
margin: 4px;
overflow: hidden;
}
.clipwrapper {
position:relative;
@ -58,8 +59,7 @@ UL.thumbnails li.rank-of-image {
.clip {
position:absolute;
}
UL.thumbnails li.rank-of-image input {
}
UL.thumbnails SPAN.wrap1 {
margin: 5px;
display: table-cell; display: inline-table;
@ -71,25 +71,28 @@ UL.thumbnails SPAN.wrap2 {
margin: 0; /* important reset the margins */
display: table-cell; /* block prevents vertical-align here */
vertical-align: middle; /* Ok with Opera and Geko not IE6 */
border-radius: 4px;
}
UL.thumbnails LABEL { display: block; border-bottom: none; }
UL.thumbnails LABEL {
position: relative;
display: block;
border-bottom: none;
}
UL.thumbnails IMG {
margin-bottom: -4px; /* why ??? something wrong with Geko and Opera ignored by IE6*/
vertical-align: middle;
margin-top: 12px;
}
UL.thumbnails LABEL { position: relative; }
UL.thumbnails INPUT {
position: relative; /* <= Opera can handle relative here */
top: -20px;
}
:root UL.thumbnails INPUT { /* hide from Opera */
position: absolute; /* <= Opera hide 1 checkbox over 2 !!! */
position: absolute;
left: 2px; top: 2px;
}
UL.thumbnails .levelIndicatorB {
display:block; position:absolute; z-index:100;padding:0px 0 0 14px; color:black; font-weight:bold; font-size:120%;
display:block; position:absolute; z-index:100; padding:7px 0 0 2px; color:black; font-weight:bold; font-size:120%;
}
UL.thumbnails .levelIndicatorF {
display:block; position:absolute; z-index:101;padding:1px 0 0 15px; color:white; font-weight:bold; font-size:120%;
display:block; position:absolute; z-index:101; padding:8px 0 0 3px; color:white; font-weight:bold; font-size:120%;
}
/* default-layout.css */
@ -297,7 +300,7 @@ text-align: left;
font-size: 150%;
font-weight: normal;
font-style:italic;
padding: 8px 0 0 10px;
padding: 2px 0 0 10px;
margin: 0;
float:left;
}
@ -306,7 +309,7 @@ float:left;
#pwgHead A {color:#ccc;}
#pwgHead A:hover {color:#fff;border-bottom:1px solid #fff}
#headActions {float:right; height:46px; line-height:46px; margin-right:10px;}
#headActions {float:right; height:36px; line-height:36px; margin-right:10px;}
A {
text-decoration:none;
@ -589,7 +592,7 @@ img.ui-datepicker-trigger {
#pwgHead {
background-color:#464646;
height:46px;
height: 36px;
}
html, body {height:100%; margin:0; padding:0;}
@ -603,11 +606,12 @@ html, body {height:100%; margin:0; padding:0;}
position:absolute;
bottom:0;
width:100%;
height:46px;
background: url(images/logo.png) no-repeat 7px 8px;
background-color:#464646;
height: 34px;
line-height: 34px;
background-repeat: no-repeat;
background-position: 7px 2px;
background-color:#464646;
color:#aaa;
line-height:46px;
}
#footer A {color:#ccc;}
@ -768,17 +772,6 @@ BODY {
#thePopuphelpPage #pwgHead {display:none}
#thePopuphelpPage #footer {display:none}
/* Set some sizes according to your maximum thumbnail width and height */
UL.thumbnails SPAN,
UL.thumbnails SPAN.wrap2 A,
UL.thumbnails LABEL {
width: 140px; /* max thumbnail width + 2px */
}
UL.thumbnails SPAN.wrap2 {
height: 140px; /* max thumbnail height + 2px */
}
.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; -moz-border-radius:5px; overflow:hidden; }
.themeBox IMG {border:1px solid white; margin:0 15px;}
@ -978,7 +971,7 @@ LEGEND {
#batchManagerGlobal ul.thumbnails div.actions a {color:#fff;}
#batchManagerGlobal ul.thumbnails div.actions a:hover {border-color:#fff;}
#batchManagerGlobal ul.thumbnails span.wrap1:hover div.actions {display:block;}
#batchManagerGlobal #selectedMessage {padding:5px; -moz-border-radius:5px;-webkit-border-radius:5px;}
#batchManagerGlobal #selectedMessage {padding:5px; border-radius:5px;}
#batchManagerGlobal #selectSet a {border-bottom:1px dotted;}
#batchManagerGlobal #applyOnDetails {font-style:italic;}
#batchManagerGlobal .actionButtons {text-align:left;}

View file

@ -64,8 +64,6 @@ h3, .row2, .content { background-color: #222; }
UL.thumbnails span.wrap2:hover { background-color#7CBA0F; color:#666; }
UL.thumbnails span.wrap2 {
padding: 4px;
border-radius: 4px;
background-color:#333;
}
@ -80,7 +78,7 @@ TEXTAREA { cursor:text; font-size: 13px; }
.tagSelection LI.tagSelected {background-color:#aaa;}
.tagSelected LABEL {color:#000;}
.content ul.categoryActions a img { margin-left: 10px; }
ul.thumbnails input { border:3px double #999; color:#999; font-size:10px; margin:0; background-color:#444; text-align: center;}
ul.thumbnails input { color:#999; font-size:10px; margin:0; background-color:#444; text-align: center;}
INPUT[type="submit"]:hover , INPUT[type="reset"]:hover { cursor: pointer; }
INPUT.bigbutton:hover { background-color: #222; color:#f33; border: 0; }
.throw { font-size: 120%; line-height: 26px; padding-top: 10px; font-weight: bold; color: #ff3363; }