aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/batch_manager_global.php73
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl9
-rw-r--r--include/dblayer/functions_mysql.inc.php19
3 files changed, 27 insertions, 74 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index 64d288824..4a4ef8778 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -74,14 +74,6 @@ if (isset($_SESSION['bulk_manager_filter']['prefilter']))
$page['prefilter'] = $_SESSION['bulk_manager_filter']['prefilter'];
}
-// $page['category'] is a shortcut to test if the current filter contains a
-// given category. The idea is the same as for prefilter
-$page['category'] = -1;
-if (isset($_SESSION['bulk_manager_filter']['category']))
-{
- $page['category'] = $_SESSION['bulk_manager_filter']['category'];
-}
-
$redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
if (isset($_POST['submit']))
@@ -105,15 +97,8 @@ DELETE
;';
pwg_query($query);
- if ('caddie' == $page['prefilter'])
- {
- redirect($redirect_url);
- }
-
- // if we are here in the code, it means that the user is currently
- // displaying the caddie content, so we have to remove the current
- // selection from the current set
- $page['cat_elements_id'] = array_diff($page['cat_elements_id'], $collection);
+ // remove from caddie action available only in caddie so reload content
+ redirect($redirect_url);
}
if ('add_tags' == $action)
@@ -129,7 +114,7 @@ DELETE
if ('with no tag' == $page['prefilter'])
{
- redirect(get_root_url().'admin.php?page='.$_GET['page']);
+ redirect($redirect_url);
}
}
}
@@ -445,9 +430,7 @@ $template->set_filenames(array('batch_manager_global' => 'batch_manager_global.t
$base_url = get_root_url().'admin.php';
-$prefilters = array();
-
-array_push($prefilters,
+$prefilters = array(
array('ID' => 'caddie', 'NAME' => l10n('Caddie')),
array('ID' => 'last import', 'NAME' => l10n('Last import')),
array('ID' => 'with no album', 'NAME' => l10n('With no album')),
@@ -481,39 +464,8 @@ $template->assign(
// +-----------------------------------------------------------------------+
// | caddie options |
// +-----------------------------------------------------------------------+
+$template->assign('IN_CADDIE', 'caddie' == $page['prefilter']);
-$in_caddie = false;
-if (isset($_SESSION['bulk_manager_filter']['prefilter'])
- and 'caddie' == $_SESSION['bulk_manager_filter']['prefilter'])
-{
- $in_caddie = true;
-}
-$template->assign('IN_CADDIE', $in_caddie);
-
-// +-----------------------------------------------------------------------+
-// | deletion form |
-// +-----------------------------------------------------------------------+
-
-// we can only remove photos that have no storage_category_id, in other
-// word, it currently (Butterfly) means that the photo was added with
-// pLoader
-if (count($page['cat_elements_id']) > 0)
-{
- $query = '
-SELECT
- id
- FROM '.IMAGES_TABLE.'
- WHERE id IN ('.implode(',', $page['cat_elements_id']).')
- AND file NOT LIKE \'http%\'
- LIMIT 1
-;';
- ;
-
- if ( pwg_db_fetch_row(pwg_query($query)) )
- {
- $template->assign('show_delete_form', true);
- }
-}
// +-----------------------------------------------------------------------+
// | global mode form |
@@ -556,8 +508,10 @@ $query = '
SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE.'
;';
-display_select_cat_wrapper($query, array(), 'associate_options', true);
-display_select_cat_wrapper($query, array(), 'move_options', true);
+$categories = array_from_query($query);
+usort($categories, 'global_rank_compare');
+display_select_categories($categories, array(), 'category_full_name_options', true);
+
display_select_cat_wrapper($query, array(), 'category_parent_options');
// in the filter box, which category to select by default
@@ -570,8 +524,6 @@ if (isset($_SESSION['bulk_manager_filter']['category']))
else
{
// we need to know the category in which the last photo was added
- $selected_category = array();
-
$query = '
SELECT
category_id,
@@ -586,16 +538,11 @@ SELECT
if (pwg_db_num_rows($result) > 0)
{
$row = pwg_db_fetch_assoc($result);
-
$selected_category = array($row['category_id']);
}
}
-$query = '
-SELECT id,name,uppercats,global_rank
- FROM '.CATEGORIES_TABLE.'
-;';
-display_select_cat_wrapper($query, $selected_category, 'filter_category_options', true);
+$template->assign( 'filter_category_selected', $selected_category);
// Dissociate from a category : categories listed for dissociation can only
// represent virtual links. We can't create orphans. Links to physical
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index 821c4caef..5b031fc6b 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -15,7 +15,6 @@ jQuery(document).ready(function() {
jQuery.fn.enableShiftClick = function() {
var inputs = [];
var count=0;
- var This=$(this);
this.find('input[type=checkbox]').each(function() {
var pos=count;
inputs[count++]=this;
@@ -522,7 +521,7 @@ $(document).ready(function() {
<input type="checkbox" name="filter_category_use" class="useFilterCheckbox" {if isset($filter.category)}checked="checked"{/if}>
{'Album'|@translate}
<select style="width:400px" name="filter_category" size="1">
- {html_options options=$filter_category_options selected=$filter_category_options_selected}
+ {html_options options=$category_full_name_options selected=$filter_category_selected}
</select>
<label><input type="checkbox" name="filter_category_recursive" {if isset($filter.category_recursive)}checked="checked"{/if}> {'include child albums'|@translate}</label>
</li>
@@ -675,9 +674,7 @@ UL.thumbnails SPAN.wrap2 {ldelim}
<select name="selectAction">
<option value="-1">{'Choose an action'|@translate}</option>
<option disabled="disabled">------------------</option>
- {if isset($show_delete_form) }
<option value="delete">{'Delete selected photos'|@translate}</option>
- {/if}
<option value="associate">{'Associate to album'|@translate}</option>
<option value="move">{'Move to album'|@translate}</option>
{if !empty($dissociate_options)}
@@ -714,7 +711,7 @@ UL.thumbnails SPAN.wrap2 {ldelim}
<!-- associate -->
<div id="action_associate" class="bulkAction">
<select style="width:400px" name="associate" size="1">
- {html_options options=$associate_options }
+ {html_options options=$category_full_name_options}
</select>
<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</div>
@@ -722,7 +719,7 @@ UL.thumbnails SPAN.wrap2 {ldelim}
<!-- move -->
<div id="action_move" class="bulkAction">
<select style="width:400px" name="move" size="1">
- {html_options options=$move_options }
+ {html_options options=$category_full_name_options}
</select>
<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
</div>
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php
index a7655e544..f33d616b0 100644
--- a/include/dblayer/functions_mysql.inc.php
+++ b/include/dblayer/functions_mysql.inc.php
@@ -189,19 +189,28 @@ function pwg_db_insert_id($table=null, $column='id')
* used here
*
* @param string $query
- * @param string $fieldname
+ * @param string $fieldname optional
* @return array
*/
-function array_from_query($query, $fieldname)
+function array_from_query($query, $fieldname=false)
{
$array = array();
$result = pwg_query($query);
- while ($row = mysql_fetch_assoc($result))
+ if (false === $fieldname)
{
- $array[] = $row[$fieldname];
+ while ($row = mysql_fetch_assoc($result))
+ {
+ $array[] = $row;
+ }
+ }
+ else
+ {
+ while ($row = mysql_fetch_assoc($result))
+ {
+ $array[] = $row[$fieldname];
+ }
}
-
return $array;
}