From 6ee66d829b5508e4f9a98e33164d32aedfeb9ec9 Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 2 Feb 2011 09:35:48 +0000 Subject: bug 2172 fixed: the "sort order" options are removed from the album administration main page. bug 2173 fixed: rename "manual order" into "automatic order" and "by rank" into "manual order" bug 2174 fixed: only show the automatic order options when it's relevant new icon for the "manage photo order" screen hide the numeric rank below the thumbnail (it is confusing for users) tell users that you can drag'n drop to reorder photos bug fixed: the "apply to sub-albums" options for photo orders was not working git-svn-id: http://piwigo.org/svn/trunk@9051 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/cat_modify.php | 90 ++------------------- admin/element_set_ranks.php | 34 +++++--- admin/themes/clear/icon/ranks.png | Bin 423 -> 682 bytes admin/themes/clear/theme.css | 4 + admin/themes/default/template/cat_modify.tpl | 22 +---- .../themes/default/template/element_set_ranks.tpl | 26 +++--- admin/themes/default/thumbnails.css | 13 +-- 7 files changed, 54 insertions(+), 135 deletions(-) diff --git a/admin/cat_modify.php b/admin/cat_modify.php index df39683aa..8f99a9155 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -44,26 +44,6 @@ if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) ) //--------------------------------------------------------- form criteria check if (isset($_POST['submit'])) { - $image_order = null; - if ( !isset($_POST['image_order_default']) ) - { - for ($i=1; $i<=3; $i++) - { - if ( !empty($_POST['order_field_'.$i]) ) - { - if (! empty($image_order) ) - { - $image_order .= ','; - } - $image_order .= $_POST['order_field_'.$i]; - if ($_POST['order_direction_'.$i]=='DESC') - { - $image_order .= ' DESC'; - } - } - } - } - $data = array( 'id' => $_GET['cat_id'], @@ -72,7 +52,6 @@ if (isset($_POST['submit'])) 'comment' => $conf['allow_html_descriptions'] ? @$_POST['comment'] : strip_tags(@$_POST['comment']), - 'image_order' => $image_order, ); mass_updates( @@ -87,14 +66,6 @@ if (isset($_POST['submit'])) // retrieve cat infos before continuing (following updates are expensive) $cat_info = get_cat_info($_GET['cat_id']); - if (isset($_POST['image_order_subcats'])) - { - $query = ' -UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':'\''.$image_order.'\'').' - WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\''; - pwg_query($query); - } - if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) ) { set_cat_visible(array($_GET['cat_id']), $_POST['visible']); @@ -244,9 +215,6 @@ $template->assign( 'CAT_VISIBLE' => boolean_to_string($category['visible']), 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']), - 'IMG_ORDER_DEFAULT' => empty($category['image_order']) ? - 'checked="checked"' : '', - 'U_JUMPTO' => make_index_url( array( 'category' => $category @@ -277,12 +245,13 @@ if ($category['has_images']) 'U_MANAGE_ELEMENTS', $base_url.'batch_manager&cat='.$category['id'] ); - $template->assign( - 'U_MANAGE_RANKS', - $base_url.'element_set_ranks&cat_id='.$category['id'] - ); } +$template->assign( + 'U_MANAGE_RANKS', + $base_url.'element_set_ranks&cat_id='.$category['id'] + ); + if ($category['is_virtual']) { $template->assign( @@ -303,55 +272,6 @@ else ); } -// image order management - -$sort_fields = array( - '' => '', - 'date_creation' => l10n('Creation date'), - 'date_available' => l10n('Post date'), - 'average_rate' => l10n('Average rate'), - 'hit' => l10n('Most visited'), - 'file' => l10n('File name'), - 'id' => 'Id', - 'rank' => l10n('Rank'), - ); - -$sort_directions = array( - 'ASC' => l10n('ascending'), - 'DESC' => l10n('descending'), - ); - -$template->assign( 'image_order_field_options', $sort_fields); -$template->assign( 'image_order_direction_options', $sort_directions); - -$matches = array(); -if ( !empty( $category['image_order'] ) ) -{ - preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i', - $category['image_order'], $matches); -} - -for ($i=0; $i<3; $i++) // 3 fields -{ - $tpl_image_order_select = array( - 'ID' => $i+1, - 'FIELD' => array(''), - 'DIRECTION' => array('ASC'), - ); - - if ( isset($matches[1][$i]) ) - { - $tpl_image_order_select['FIELD'] = array($matches[1][$i]); - } - - if (isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0) - { - $tpl_image_order_select['DIRECTION'] = array('DESC'); - } - $template->append( 'image_orders', $tpl_image_order_select); -} - - // representant management if ($category['has_images'] or !empty($category['representative_picture_id'])) diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php index f4b45e970..edb802b58 100644 --- a/admin/element_set_ranks.php +++ b/admin/element_set_ranks.php @@ -89,17 +89,20 @@ $image_order_choice = 'default'; if (isset($_POST['submit'])) { - asort($_POST['rank_of_image'], SORT_NUMERIC); + if (isset($_POST['rank_of_image'])) + { + asort($_POST['rank_of_image'], SORT_NUMERIC); - save_images_order( - $page['category_id'], - array_keys($_POST['rank_of_image']) - ); + save_images_order( + $page['category_id'], + array_keys($_POST['rank_of_image']) + ); - array_push( - $page['infos'], - l10n('Images manual order was saved') - ); + array_push( + $page['infos'], + l10n('Images manual order was saved') + ); + } $image_order = null; if (!empty($_POST['image_order_choice']) @@ -134,6 +137,19 @@ if (isset($_POST['submit'])) UPDATE '.CATEGORIES_TABLE.' SET image_order=\''.$image_order.'\' WHERE id='.$page['category_id']; pwg_query($query); + + if (isset($_POST['image_order_subcats'])) + { + $cat_info = get_cat_info($page['category_id']); + + $query = ' +UPDATE '.CATEGORIES_TABLE.' + SET image_order = '.(isset($image_order) ? '\''.$image_order.'\'' : 'NULL').' + WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\''; + pwg_query($query); + } + + array_push($page['infos'], l10n('Your configuration settings are saved')); } // +-----------------------------------------------------------------------+ diff --git a/admin/themes/clear/icon/ranks.png b/admin/themes/clear/icon/ranks.png index f48b394aa..e0a308f2b 100644 Binary files a/admin/themes/clear/icon/ranks.png and b/admin/themes/clear/icon/ranks.png differ diff --git a/admin/themes/clear/theme.css b/admin/themes/clear/theme.css index f9454346c..37502efba 100644 --- a/admin/themes/clear/theme.css +++ b/admin/themes/clear/theme.css @@ -261,3 +261,7 @@ display:block; height:85px; left:225px; position:relative; top:-42px; width:313p .languageBox {background-color:#ddd;} .languageName {color:black;} .languageDefault {background-color:#dbe8f3;} + +UL.thumbnails li.rank-of-image { + background-color: #ddd; +} \ No newline at end of file diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl index 4c6ebe7fb..8c51785e2 100644 --- a/admin/themes/default/template/cat_modify.tpl +++ b/admin/themes/default/template/cat_modify.tpl @@ -14,8 +14,8 @@ {/if} {if isset($U_MANAGE_ELEMENTS) }
  • {'Photos'|@translate}
  • -
  • {'ranks'|@translate}
  • {/if} +
  • {'ranks'|@translate}
  • {'sub-albums'|@translate}
  • {if isset($U_MANAGE_PERMISSIONS) }
  • {'Permissions'|@translate}
  • @@ -88,26 +88,6 @@ -
    - {'Sort order'|@translate} - - -
    - - -
    - - {foreach from=$image_orders item=order} - -
    - {/foreach} - -
    -

    diff --git a/admin/themes/default/template/element_set_ranks.tpl b/admin/themes/default/template/element_set_ranks.tpl index 84fc33b40..808f35531 100644 --- a/admin/themes/default/template/element_set_ranks.tpl +++ b/admin/themes/default/template/element_set_ranks.tpl @@ -36,12 +36,13 @@ jQuery(document).ready(function() {

    {$CATEGORIES_NAV}

    -{if !empty($thumbnails)}
    +{if !empty($thumbnails)}

    - {'Edit ranks'|@translate} + {'Manual order'|@translate} {if !empty($thumbnails)} +

    {'Drag to re-order'|@translate}

      {foreach from=$thumbnails item=thumbnail}
    • @@ -50,12 +51,13 @@ jQuery(document).ready(function() { - +
    • {/foreach}
    {/if}
    +{/if}
    {'Sort order'|@translate} @@ -65,11 +67,11 @@ jQuery(document).ready(function() {

    - +

    - +

    {foreach from=$image_orders item=order}

    @@ -83,10 +85,12 @@ jQuery(document).ready(function() { {/foreach}

    -

    -
    - +

    + -{else} -

    {'No photo in this album'|@translate}

    -{/if} + +

    + diff --git a/admin/themes/default/thumbnails.css b/admin/themes/default/thumbnails.css index 993c21535..b43edd752 100644 --- a/admin/themes/default/thumbnails.css +++ b/admin/themes/default/thumbnails.css @@ -6,19 +6,18 @@ UL.thumbnails { UL.thumbnails LI { display: inline } UL.thumbnails li.rank-of-image { float: left; - background-color: #111; - border: 1px solid #666; + background-color: #333; color: #666; - -moz-border-radius: 4px; + -moz-border-radius: 5px; display: block; width: 104px; - height: 128px; + height: 104px; cursor: move; margin: 10px; } UL.thumbnails li.rank-of-image img { margin: 0 20px; - padding: 4px 2px; + padding: 8px 2px; float: left; } .clipwrapper { @@ -30,10 +29,6 @@ UL.thumbnails li.rank-of-image img { position:absolute; } UL.thumbnails li.rank-of-image input { - height: 12px; - width: 50px; - position: relative; - top: 4px; } UL.thumbnails SPAN.wrap1 { margin: 0 5px 5px 5px; -- cgit v1.2.3