aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/batch_manager_global.php1
-rw-r--r--admin/cat_list.php2
-rw-r--r--admin/cat_modify.php2
-rw-r--r--admin/element_set.php247
-rw-r--r--admin/element_set_global.php490
-rw-r--r--admin/element_set_unit.php286
-rw-r--r--admin/include/functions.php14
-rw-r--r--admin/photos_add_direct.php4
-rw-r--r--admin/themes/default/template/element_set_global.tpl227
-rw-r--r--admin/themes/default/template/element_set_unit.tpl151
10 files changed, 5 insertions, 1419 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index c9305488d..2741096bf 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -42,7 +42,6 @@ check_status(ACCESS_ADMINISTRATOR);
trigger_action('loc_begin_element_set_global');
-// the $_POST['selection'] was already checked in element_set.php
check_input_parameter('del_tags', $_POST, true, PATTERN_ID);
check_input_parameter('associate', $_POST, false, PATTERN_ID);
check_input_parameter('dissociate', $_POST, false, PATTERN_ID);
diff --git a/admin/cat_list.php b/admin/cat_list.php
index b75b4d084..680550f90 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -311,7 +311,7 @@ foreach ($categories as $category)
if ( array_key_exists($category['id'], $categories_with_images) )
{
$tpl_cat['U_MANAGE_ELEMENTS']=
- $base_url.'element_set&cat='.$category['id'];
+ $base_url.'batch_manager&cat='.$category['id'];
}
if ('private' == $category['status'])
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index b6e43a3b3..a30fea4ba 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -278,7 +278,7 @@ if ($category['has_images'])
{
$template->assign(
'U_MANAGE_ELEMENTS',
- $base_url.'element_set&cat='.$category['id']
+ $base_url.'batch_manager&cat='.$category['id']
);
$template->assign(
'U_MANAGE_RANKS',
diff --git a/admin/element_set.php b/admin/element_set.php
deleted file mode 100644
index 11bbcb2ac..000000000
--- a/admin/element_set.php
+++ /dev/null
@@ -1,247 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation |
-// | |
-// | This program is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA. |
-// +-----------------------------------------------------------------------+
-
-/**
- * Management of elements set. Elements can belong to a category or to the
- * user caddie.
- *
- */
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
- die('Hacking attempt!');
-}
-
-include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-
-// +-----------------------------------------------------------------------+
-// | Check Access and exit when user status is not ok |
-// +-----------------------------------------------------------------------+
-check_status(ACCESS_ADMINISTRATOR);
-
-check_input_parameter('selection', $_POST, true, PATTERN_ID);
-
-// +-----------------------------------------------------------------------+
-// | caddie management |
-// +-----------------------------------------------------------------------+
-
-if (isset($_POST['submit_caddie']))
-{
- if (isset($_POST['caddie_action']))
- {
- switch ($_POST['caddie_action'])
- {
- case 'empty_all' :
- {
- $query = '
-DELETE FROM '.CADDIE_TABLE.'
- WHERE user_id = '.$user['id'].'
-;';
- pwg_query($query);
- break;
- }
- case 'empty_selected' :
- {
- if (isset($_POST['selection']) and count($_POST['selection']) > 0)
- {
- $query = '
-DELETE
- FROM '.CADDIE_TABLE.'
- WHERE element_id IN ('.implode(',', $_POST['selection']).')
- AND user_id = '.$user['id'].'
-;';
- pwg_query($query);
- }
- else
- {
- // TODO : add error
- }
- break;
- }
- case 'add_selected' :
- {
- if (isset($_POST['selection']) and count($_POST['selection']) > 0)
- {
- fill_caddie($_POST['selection']);
- }
- else
- {
- // TODO : add error
- }
- break;
- }
- }
- }
- else
- {
- // TODO : add error
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | initialize info about category |
-// +-----------------------------------------------------------------------+
-
-// To element_set_(global|unit).php, we must provide the elements id of the
-// managed category in $page['cat_elements_id'] array.
-$page['cat_elements_id'] = array();
-if (is_numeric($_GET['cat']))
-{
- $page['title'] =
- get_cat_display_name_from_id(
- $_GET['cat'],
- PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=',
- false
- );
-
- $query = '
-SELECT image_id
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id = '.$_GET['cat'].'
-;';
- $page['cat_elements_id'] = array_from_query($query, 'image_id');
-}
-else if ('caddie' == $_GET['cat'])
-{
- $page['title'] = l10n('caddie');
-
- $query = '
-SELECT element_id
- FROM '.CADDIE_TABLE.'
- WHERE user_id = '.$user['id'].'
-;';
- $page['cat_elements_id'] = array_from_query($query, 'element_id');
-}
-else if ('not_linked' == $_GET['cat'])
-{
- $page['title'] = l10n('Not linked elements');
- $template->assign(array('U_ACTIVE_MENU' => 5 ));
-
- // we are searching elements not linked to any virtual category
- $query = '
-SELECT id
- FROM '.IMAGES_TABLE.'
-;';
- $all_elements = array_from_query($query, 'id');
-
- $linked_to_virtual = array();
-
- $query = '
-SELECT id
- FROM '.CATEGORIES_TABLE.'
- WHERE dir IS NULL
-;';
- $virtual_categories = array_from_query($query, 'id');
- if (!empty($virtual_categories))
- {
- $query = '
-SELECT DISTINCT(image_id)
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id IN ('.implode(',', $virtual_categories).')
-;';
- $linked_to_virtual = array_from_query($query, 'image_id');
- }
-
- $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
-}
-else if ('duplicates' == $_GET['cat'])
-{
- $page['title'] = l10n('Files with same name in more than one physical album');
- $template->assign(array('U_ACTIVE_MENU' => 5 ));
-
- // we are searching related elements twice or more to physical categories
- // 1 - Retrieve Files
- $query = '
-SELECT DISTINCT(file)
- FROM '.IMAGES_TABLE.'
- GROUP BY file
-HAVING COUNT(DISTINCT storage_category_id) > 1
-;';
-
- $duplicate_files = array_from_query($query, 'file');
- $duplicate_files[]='Nofiles';
- // 2 - Retrives related picture ids
- $query = '
-SELECT id, file
- FROM '.IMAGES_TABLE.'
-WHERE file IN (\''.implode("','", $duplicate_files).'\')
-ORDER BY file, id
-;';
-
- $page['cat_elements_id'] = array_from_query($query, 'id');
-}
-elseif ('recent'== $_GET['cat'])
-{
- $page['title'] = l10n('Recent pictures');
- $query = 'SELECT MAX(date_available) AS date
- FROM '.IMAGES_TABLE;
- $row = pwg_db_fetch_assoc(pwg_query($query));
- if (!empty($row['date']))
- {
- $query = 'SELECT id
- FROM '.IMAGES_TABLE.'
- WHERE date_available BETWEEN '.pwg_db_get_recent_period_expression(1, $row['date']).' AND \''.$row['date'].'\'';
- $page['cat_elements_id'] = array_from_query($query, 'id');
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | first element to display |
-// +-----------------------------------------------------------------------+
-
-// $page['start'] contains the number of the first element in its
-// 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']))
-{
- $page['start'] = 0;
-}
-else
-{
- $page['start'] = $_GET['start'];
-}
-
-// +-----------------------------------------------------------------------+
-// | open specific mode |
-// +-----------------------------------------------------------------------+
-
-$_GET['mode'] = !empty($_GET['mode']) ? $_GET['mode'] : 'global';
-
-switch ($_GET['mode'])
-{
- case 'global' :
- {
- include(PHPWG_ROOT_PATH.'admin/element_set_global.php');
- break;
- }
- case 'unit' :
- {
- include(PHPWG_ROOT_PATH.'admin/element_set_unit.php');
- break;
- }
-}
-?>
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
deleted file mode 100644
index 26eb57ca6..000000000
--- a/admin/element_set_global.php
+++ /dev/null
@@ -1,490 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation |
-// | |
-// | This program is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA. |
-// +-----------------------------------------------------------------------+
-
-/**
- * Management of elements set. Elements can belong to a category or to the
- * user caddie.
- *
- */
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
- die('Hacking attempt!');
-}
-
-include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-
-// +-----------------------------------------------------------------------+
-// | Check Access and exit when user status is not ok |
-// +-----------------------------------------------------------------------+
-check_status(ACCESS_ADMINISTRATOR);
-
-trigger_action('loc_begin_element_set_global');
-
-// +-----------------------------------------------------------------------+
-// | deletion form submission |
-// +-----------------------------------------------------------------------+
-
-// the $_POST['selection'] was already checked in element_set.php
-check_input_parameter('del_tags', $_POST, true, PATTERN_ID);
-check_input_parameter('associate', $_POST, false, PATTERN_ID);
-check_input_parameter('dissociate', $_POST, false, PATTERN_ID);
-
-if (isset($_POST['delete']))
-{
- if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
- {
- $collection = array();
-
- switch ($_POST['target_deletion'])
- {
- case 'all' :
- {
- $collection = $page['cat_elements_id'];
- break;
- }
- case 'selection' :
- {
- if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
- {
- array_push($page['errors'], l10n('Select at least one picture'));
- }
- else
- {
- $collection = $_POST['selection'];
- }
- break;
- }
- }
-
- if (count($collection) > 0)
- {
- $deleted_count = delete_elements($collection, true);
- if ($deleted_count > 0)
- {
- array_push(
- $page['infos'],
- sprintf(
- l10n_dec(
- '%d photo was deleted',
- '%d photos were deleted',
- $deleted_count
- ),
- $deleted_count
- )
- );
- }
- else
- {
- array_push($page['errors'], l10n('No photo can be deleted'));
- }
- }
- }
- else
- {
- array_push($page['errors'], l10n('You need to confirm deletion'));
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | global mode form submission |
-// +-----------------------------------------------------------------------+
-
-if (isset($_POST['submit']))
-{
- $collection = array();
-
-// echo '<pre>';
-// print_r($_POST);
-// echo '</pre>';
-// exit();
-
- switch ($_POST['target'])
- {
- case 'all' :
- {
- $collection = $page['cat_elements_id'];
- break;
- }
- case 'selection' :
- {
- if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
- {
- array_push($page['errors'], l10n('Select at least one picture'));
- }
- else
- {
- $collection = $_POST['selection'];
- }
- break;
- }
- }
-
- if (isset($_POST['add_tags']) and count($collection) > 0)
- {
- $tag_ids = get_fckb_tag_ids($_POST['add_tags']);
- add_tags($tag_ids, $collection);
- }
-
- if (isset($_POST['del_tags']) and count($collection) > 0)
- {
- $query = '
-DELETE
- FROM '.IMAGE_TAG_TABLE.'
- WHERE image_id IN ('.implode(',', $collection).')
- AND tag_id IN ('.implode(',', $_POST['del_tags']).')
-;';
- pwg_query($query);
- }
-
- if ($_POST['associate'] != 0 and count($collection) > 0)
- {
- associate_images_to_categories(
- $collection,
- array($_POST['associate'])
- );
- }
-
- if ($_POST['dissociate'] != 0 and count($collection) > 0)
- {
- // physical links must not be broken, so we must first retrieve image_id
- // which create virtual links with the category to "dissociate from".
- $query = '
-SELECT id
- FROM '.IMAGE_CATEGORY_TABLE.'
- INNER JOIN '.IMAGES_TABLE.' ON image_id = id
- WHERE category_id = '.$_POST['dissociate'].'
- AND id IN ('.implode(',', $collection).')
- AND (
- category_id != storage_category_id
- OR storage_category_id IS NULL
- )
-;';
- $dissociables = array_from_query($query, 'id');
-
- if (!empty($dissociables))
- {
- $query = '
-DELETE
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id = '.$_POST['dissociate'].'
- AND image_id IN ('.implode(',', $dissociables).')
-';
- pwg_query($query);
-
- // we remove the dissociated images if we are currently displaying the
- // category to dissociate from.
- if (is_numeric($_GET['cat']) and $_POST['dissociate'] == $_GET['cat'])
- {
- $page['cat_elements_id'] = array_diff(
- $page['cat_elements_id'],
- $dissociables
- );
- }
- }
-
- update_category($_POST['dissociate']);
- }
-
- $datas = array();
- $dbfields = array('primary' => array('id'), 'update' => array());
-
- $formfields = array('author', 'name', 'date_creation', 'level');
- foreach ($formfields as $formfield)
- {
- if ($_POST[$formfield.'_action'] != 'leave')
- {
- array_push($dbfields['update'], $formfield);
- }
- }
-
- // updating elements is useful only if needed...
- if (count($dbfields['update']) > 0 and count($collection) > 0)
- {
- $query = '
-SELECT id
- FROM '.IMAGES_TABLE.'
- WHERE id IN ('.implode(',', $collection).')
-;';
- $result = pwg_query($query);
-
- while ($row = pwg_db_fetch_assoc($result))
- {
- $data = array();
- $data['id'] = $row['id'];
-
- if ('set' == $_POST['author_action'])
- {
- $data['author'] = $_POST['author'];
- if ('' == $data['author'])
- {
- unset($data['author']);
- }
- }
-
- if ('set' == $_POST['name_action'])
- {
- $data['name'] = $_POST['name'];
- if ('' == $data['name'])
- {
- unset($data['name']);
- }
- }
-
- if ('set' == $_POST['date_creation_action'])
- {
- $data['date_creation'] =
- $_POST['date_creation_year']
- .'-'.$_POST['date_creation_month']
- .'-'.$_POST['date_creation_day']
- ;
- }
-
- if ('set' == $_POST['level_action'])
- {
- $data['level'] = $_POST['level'];
- }
-
- array_push($datas, $data);
- }
- // echo '<pre>'; print_r($datas); echo '</pre>';
- mass_updates(IMAGES_TABLE, $dbfields, $datas);
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | template init |
-// +-----------------------------------------------------------------------+
-$template->set_filenames(
- array('element_set_global' => 'element_set_global.tpl'));
-
-$base_url = get_root_url().'admin.php';
-
-// $form_action = $base_url.'?page=element_set_global';
-
-$template->assign(
- array(
- 'CATEGORIES_NAV'=>$page['title'],
-
- 'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
-
- 'U_UNIT_MODE'
- =>
- $base_url
- .get_query_string_diff(array('mode','display'))
- .'&amp;mode=unit',
-
- 'F_ACTION'=>$base_url.get_query_string_diff(array()),
- )
- );
-
-// +-----------------------------------------------------------------------+
-// | caddie options |
-// +-----------------------------------------------------------------------+
-
-$template->assign('IN_CADDIE', 'caddie' == $_GET['cat'] ? true : false );
-
-// +-----------------------------------------------------------------------+
-// | deletion form |
-// +-----------------------------------------------------------------------+
-
-// we can only remove photos that are not remote
-if (count($page['cat_elements_id']) > 0)
-{
- $query = '
-SELECT
- COUNT(*)
- FROM '.IMAGES_TABLE.'
- WHERE id IN ('.implode(',', $page['cat_elements_id']).')
- AND path NOT LIKE \'http%\'
-;';
- list($counter) = pwg_db_fetch_row(pwg_query($query));
-
- if ($counter > 0)
- {
- $template->assign('show_delete_form', true);
- }
-}
-
-// +-----------------------------------------------------------------------+
-// | global mode form |
-// +-----------------------------------------------------------------------+
-
-// Virtualy associate a picture to a category
-$query = '
-SELECT id,name,uppercats,global_rank
- FROM '.CATEGORIES_TABLE.'
-;';
-display_select_cat_wrapper($query, array(), 'associate_options', true);
-
-// Dissociate from a category : categories listed for dissociation can
-// only represent virtual links. Links to physical categories can't be
-// broken
-if (count($page['cat_elements_id']) > 0)
-{
- $query = '
-SELECT
- DISTINCT(category_id) AS id,
- c.name,
- c.uppercats,
- c.global_rank
- FROM '.IMAGE_CATEGORY_TABLE.' AS ic
- JOIN '.CATEGORIES_TABLE.' AS c ON c.id = ic.category_id
- JOIN '.IMAGES_TABLE.' AS i ON i.id = ic.image_id
- WHERE ic.image_id IN ('.implode(',', $page['cat_elements_id']).')
- AND (
- ic.category_id != i.storage_category_id
- OR i.storage_category_id IS NULL
- )
-;';
- display_select_cat_wrapper($query, array(), 'dissociate_options', true);
-}
-
-if (count($page['cat_elements_id']) > 0)
-{
- // remove tags
- $tags = get_common_tags($page['cat_elements_id'], -1);
-
- $template->assign(
- array(
- 'DEL_TAG_SELECTION' => get_html_tag_selection($tags, 'del_tags'),
- )
- );
-}
-
-// creation date
-$day =
-empty($_POST['date_creation_day']) ? date('j') : $_POST['date_creation_day'];
-
-$month =
-empty($_POST['date_creation_month']) ? date('n') : $_POST['date_creation_month'];
-
-$year =
-empty($_POST['date_creation_year']) ? date('Y') : $_POST['date_creation_year'];
-
-$month_list = $lang['month'];
-$month_list[0]='------------';
-ksort($month_list);
-$template->assign( array(
- 'month_list' => $month_list,
- 'DATE_CREATION_DAY' => (int)$day,
- 'DATE_CREATION_MONTH'=> (int)$month,
- 'DATE_CREATION_YEAR' => (int)$year,
- )
- );
-
-// image level options
-$template->assign(
- array(
- 'level_options'=> get_privacy_level_options(),
- 'level_options_selected' => 0,
- )
- );
-
-// +-----------------------------------------------------------------------+
-// | global mode thumbnails |
-// +-----------------------------------------------------------------------+
-
-// how many items to display on this page
-if (!empty($_GET['display']))
-{
- if ('all' == $_GET['display'])
- {
- $page['nb_images'] = count($page['cat_elements_id']);
- }
- else
- {
- $page['nb_images'] = intval($_GET['display']);
- }
-}
-else
-{
- $page['nb_images'] = 20;
-}
-
-if (count($page['cat_elements_id']) > 0)
-{
- $nav_bar = create_navigation_bar(
- $base_url.get_query_string_diff(array('start')),
- count($page['cat_elements_id']),
- $page['start'],
- $page['nb_images']
- );
- $template->assign('navbar', $nav_bar);
-
- $query = '
-SELECT id,path,tn_ext,file,filesize,level
- FROM '.IMAGES_TABLE;
-
- if (is_numeric($_GET['cat']))
- {
- $category_info = get_cat_info($_GET['cat']);
-
- $conf['order_by'] = $conf['order_by_inside_category'];
- if (!empty($category_info['image_order']))
- {
- $conf['order_by'] = ' ORDER BY '.$category_info['image_order'];
- }
-
- $query.= '
- JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
- }
-
- $query.= '
- WHERE id IN ('.implode(',', $page['cat_elements_id']).')';
-
- if (is_numeric($_GET['cat']))
- {
- $query.= '
- AND category_id = '.$_GET['cat'];
- }
-
- $query.= '
- '.$conf['order_by'].'
- LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
-;';
- $result = pwg_query($query);
-
- // template thumbnail initialization
- while ($row = pwg_db_fetch_assoc($result))
- {
- $src = get_thumbnail_url($row);
-
- $template->append(
- 'thumbnails',
- array(
- 'ID' => $row['id'],
- 'TN_SRC' => $src,
- 'FILE' => $row['file'],
- 'TITLE' => get_thumbnail_title($row),
- 'LEVEL' => $row['level']
- )
- );
- }
-}
-
-trigger_action('loc_end_element_set_global');
-
-//----------------------------------------------------------- sending html code
-$template->assign_var_from_handle('ADMIN_CONTENT', 'element_set_global');
-?>
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
deleted file mode 100644
index fa89db7f2..000000000
--- a/admin/element_set_unit.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based picture gallery |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation |
-// | |
-// | This program is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA. |
-// +-----------------------------------------------------------------------+
-
-/**
- * Management of elements set. Elements can belong to a category or to the
- * user caddie.
- *
- */
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
- die('Hacking attempt!');
-}
-
-include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
-
-// +-----------------------------------------------------------------------+
-// | Check Access and exit when user status is not ok |
-// +-----------------------------------------------------------------------+
-check_status(ACCESS_ADMINISTRATOR);
-
-trigger_action('loc_begin_element_set_unit');
-
-// +-----------------------------------------------------------------------+
-// | unit mode form submission |
-// +-----------------------------------------------------------------------+
-
-if (isset($_POST['submit']))
-{
- $collection = explode(',', $_POST['element_ids']);
-
- $datas = array();
-
- $query = '
-SELECT id, date_creation
- FROM '.IMAGES_TABLE.'
- WHERE id IN ('.implode(',', $collection).')
-;';
- $result = pwg_query($query);
-
- while ($row = pwg_db_fetch_assoc($result))
- {
- $data = array();
-
- $data['id'] = $row['id'];
- $data['name'] = $_POST['name-'.$row['id']];
- $data['author'] = $_POST['author-'.$row['id']];
- $data['level'] = $_POST['level-'.$row['id']];
-
- foreach (array('name', 'level') as $field)
- {
- if (!empty($_POST[$field.'-'.$row['id']]))
- {
- $data[$field] = strip_tags($_POST[$field.'-'.$row['id']]);
- }
- }
-
- if ($conf['allow_html_descriptions'])
- {
- $data['comment'] = @$_POST['description-'.$row['id']];
- }
- else
- {
- $data['comment'] = strip_tags(@$_POST['description-'.$row['id']]);
- }
-
- if (isset($_POST['date_creation_action-'.$row['id']]))
- {
- if ('set' == $_POST['date_creation_action-'.$row['id']])
- {
- $data['date_creation'] =
- $_POST['date_creation_year-'.$row['id']]
- .'-'.$_POST['date_creation_month-'.$row['id']]
- .'-'.$_POST['date_creation_day-'.$row['id']];
- }
- else if ('unset' == $_POST['date_creation_action-'.$row['id']])
- {
- $data['date_creation'] = '';
- }
- }
- else
- {
- $data['date_creation'] = $row['date_creation'];
- }
-
- array_push($datas, $data);
-
- // tags management
- if (isset($_POST[ 'tags-'.$row['id'] ]))
- {
- $tag_ids = get_fckb_tag_ids($_POST[ 'tags-'.$row['id'] ]);
- set_tags($tag_ids, $row['id']);
- }
- }
-
- mass_updates(
- IMAGES_TABLE,
- array(
- 'primary' => array('id'),
- 'update' => array('name','author','level','comment','date_creation')
- ),
- $datas
- );
-
- array_push($page['infos'], l10n('Picture informations updated'));
-}
-
-// +-----------------------------------------------------------------------+
-// | template init |
-// +-----------------------------------------------------------------------+
-
-$template->set_filenames(
- array('element_set_unit' => 'element_set_unit.tpl'));
-
-$base_url = PHPWG_ROOT_PATH.'admin.php';
-
-$month_list = $lang['month'];
-$month_list[0]='------------';
-ksort($month_list);
-
-$template->assign(
- array(
- 'CATEGORIES_NAV'=>$page['title'],
- 'U_ELEMENTS_PAGE'
- =>$base_url.get_query_string_diff(array('display','start')),
- 'U_GLOBAL_MODE'
- =>
- $base_url
- .get_query_string_diff(array('mode','display'))
- .'&amp;mode=global',
- 'F_ACTION'=>$base_url.get_query_string_diff(array()),
- 'month_list' => $month_list,
- 'level_options' => get_privacy_level_options(),
- )
- );
-
-// +-----------------------------------------------------------------------+
-// | global mode thumbnails |
-// +-----------------------------------------------------------------------+
-
-// how many items to display on this page
-if (!empty($_GET['display']))
-{
- if ('all' == $_GET['display'])
- {
- $page['nb_images'] = count($page['cat_elements_id']);
- }
- else
- {
- $page['nb_images'] = intval($_GET['display']);
- }
-}
-else
-{
- $page['nb_images'] = 5;
-}
-
-
-
-if (count($page['cat_elements_id']) > 0)
-{
- $nav_bar = create_navigation_bar(
- $base_url.get_query_string_diff(array('start')),
- count($page['cat_elements_id']),
- $page['start'],
- $page['nb_images']
- );
- $template->assign(array('navbar' => $nav_bar));
-
- // tags
- $all_tags = get_all_tags();
-
- $element_ids = array();
-
- $query = '
-SELECT id,path,tn_ext,name,date_creation,comment,author,level,file
- FROM '.IMAGES_TABLE;
-
- if (is_numeric($_GET['cat']))
- {
- $category_info = get_cat_info($_GET['cat']);
-
- $conf['order_by'] = $conf['order_by_inside_category'];
- if (!empty($category_info['image_order']))
- {
- $conf['order_by'] = ' ORDER BY '.$category_info['image_order'];
- }
-
- $query.= '
- JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
- }
-
- $query.= '
- WHERE id IN ('.implode(',', $page['cat_elements_id']).')';
-
- if (is_numeric($_GET['cat']))
- {
- $query.= '
- AND category_id = '.$_GET['cat'];
- }
-
- $query.= '
- '.$conf['order_by'].'
- LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
-;';
- $result = pwg_query($query);
-
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($element_ids, $row['id']);
-
- $src = get_thumbnail_url($row);
-
- // creation date
- if (!empty($row['date_creation']))
- {
- list($year,$month,$day) = explode('-', $row['date_creation']);
- }
- else
- {
- list($year,$month,$day) = array('',0,0);
- }
-
- $query = '
-SELECT
- tag_id,
- name AS tag_name
- FROM '.IMAGE_TAG_TABLE.' AS it
- JOIN '.TAGS_TABLE.' AS t ON t.id = it.tag_id
- WHERE image_id = '.$row['id'].'
-;';
- $tag_selection = get_fckb_taglist($query);
-
- $template->append(
- 'elements',
- array(
- 'ID' => $row['id'],
- 'TN_SRC' => $src,
- 'LEGEND' => !empty($row['name']) ?
- $row['name'] : get_name_from_file($row['file']),
- 'U_EDIT' =>
- PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
- '&amp;image_id='.$row['id'],
- 'NAME' => !empty($row['name'])?$row['name']:'',
- 'AUTHOR' => !empty($row['author'])?htmlspecialchars($row['author']):'',
- 'LEVEL' => !empty($row['level'])?$row['level']:'0',
- 'DESCRIPTION' => !empty($row['comment'])?$row['comment']:'',
- 'DATE_CREATION_YEAR' => $year,
- 'DATE_CREATION_MONTH' => (int)$month,
- 'DATE_CREATION_DAY' => (int)$day,
- 'TAGS' => $tag_selection,
- )
- );
- }
-
- $template->assign('ELEMENT_IDS', implode(',', $element_ids));
-}
-
-trigger_action('loc_end_element_set_unit');
-
-// +-----------------------------------------------------------------------+
-// | sending html code |
-// +-----------------------------------------------------------------------+
-
-$template->assign_var_from_handle('ADMIN_CONTENT', 'element_set_unit');
-?> \ No newline at end of file
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 82c0b4804..5a949964e 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1981,19 +1981,6 @@ function get_active_menu($menu_page)
return $page['active_menu'];
}
- // specific cases
- if ('element_set' == $menu_page)
- {
- if (isset($_GET['cat']) and is_numeric($_GET['cat']))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
switch ($menu_page)
{
case 'photos_add':
@@ -2001,6 +1988,7 @@ function get_active_menu($menu_page)
case 'rating':
case 'tags':
case 'picture_modify':
+ case 'batch_manager':
return 0;
case 'cat_list':
diff --git a/admin/photos_add_direct.php b/admin/photos_add_direct.php
index 727045c6a..298fa982b 100644
--- a/admin/photos_add_direct.php
+++ b/admin/photos_add_direct.php
@@ -55,7 +55,7 @@ DELETE FROM '.CADDIE_TABLE.'
$inserts
);
- redirect(get_root_url().'admin.php?page=element_set&cat=caddie');
+ redirect(get_root_url().'admin.php?page=batch_manager&cat=caddie');
}
// +-----------------------------------------------------------------------+
@@ -294,7 +294,7 @@ SELECT
// a function get_image_name($name, $file) (if name is null, then
// compute a temporary name from filename) that would be also used in
// picture.php. UPDATE: in fact, "get_name_from_file($file)" already
- // exists and is used twice (element_set_unit + comments, but not in
+ // exists and is used twice (batch_manager_unit + comments, but not in
// picture.php I don't know why) with the same pattern if
// (empty($name)) {$name = get_name_from_file($file)}, a clean
// function get_image_name($name, $file) would be better
diff --git a/admin/themes/default/template/element_set_global.tpl b/admin/themes/default/template/element_set_global.tpl
deleted file mode 100644
index d2c08bf8b..000000000
--- a/admin/themes/default/template/element_set_global.tpl
+++ /dev/null
@@ -1,227 +0,0 @@
-{include file='include/tag_selection.inc.tpl'}
-{include file='include/datepicker.inc.tpl'}
-
-{footer_script}{literal}
- pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
-{/literal}{/footer_script}
-
-{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
-{footer_script require='jquery.fcbkcomplete'}{literal}
-jQuery(document).ready(function() {
- jQuery("#tags").fcbkcomplete({
- json_url: "admin.php?fckb_tags=1",
- cache: false,
- filter_case: false,
- filter_hide: true,
- firstselected: true,
- filter_selected: true,
- maxitems: 100,
- newel: true
- });
-});
-{/literal}{/footer_script}
-
-<h2>{'Batch management'|@translate}</h2>
-
-<h3>{$CATEGORIES_NAV}</h3>
-
-{if !empty($thumbnails)}
- <p style="text-align:center;">
- {'global mode'|@translate}
- | <a href="{$U_UNIT_MODE}">{'unit mode'|@translate}</a>
- </p>
-
- <fieldset>
-
- <legend>{'Display options'|@translate}</legend>
-
- <p>{'elements per page'|@translate}:
- <a href="{$U_DISPLAY}&amp;display=20">20</a>
- | <a href="{$U_DISPLAY}&amp;display=50">50</a>
- | <a href="{$U_DISPLAY}&amp;display=100">100</a>
- | <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
- </p>
-
- </fieldset>
-
- <form action="{$F_ACTION}" method="post">
-
- <fieldset>
-
- <legend>{'Elements'|@translate}</legend>
-
- {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
-
- {if !empty($thumbnails)}
- <ul class="thumbnails">
- {foreach from=$thumbnails item=thumbnail}
- <li><span class="wrap1">
- <label>
- <span class="wrap2">
- {if $thumbnail.LEVEL > 0}
- <em class="levelIndicatorB">{$thumbnail.LEVEL}</em>
- <em class="levelIndicatorF" title="{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}">{$thumbnail.LEVEL}</em>
- {/if}
- <span>
- <img src="{$thumbnail.TN_SRC}"
- alt="{$thumbnail.FILE}"
- title="{$thumbnail.TITLE}"
- class="thumbnail">
- </span></span>
- <input type="checkbox" name="selection[]" value="{$thumbnail.ID}">
- </label>
- </span>
- </li>
- {/foreach}
- </ul>
- {/if}
-
- </fieldset>
-
- {if isset($show_delete_form) }
- <fieldset>
- <legend>{'Deletions'|@translate}</legend>
- <p>
- {'target'|@translate}
- <label><input type="radio" name="target_deletion" value="all"> {'all'|@translate}</label>
- <label><input type="radio" name="target_deletion" value="selection" checked="checked"> {'selection'|@translate}</label>
- </p>
- <p>
- <label><input type="checkbox" name="confirm_deletion" value="1"> {'confirm'|@translate}</label>
- <input class="submit" type="submit" value="{'Delete selected photos'|@translate}" name="delete">
- </p>
- </fieldset>
- {/if}
-
- <fieldset>
-
- <legend>{'Form'|@translate}</legend>
-
- <table>
-
- <tr>
- <td>{'Associate to album'|@translate}</td>
- <td>
- <select style="width:400px" name="associate" size="1">
- <option value="0">------------</option>
- {html_options options=$associate_options }
- </select>
- </td>
- </tr>
-
- <tr>
- <td>{'Dissociate from album'|@translate}</td>
- <td>
- <select style="width:400px" name="dissociate" size="1">
- <option value="0">------------</option>
- {if !empty($dissociate_options)}{html_options options=$dissociate_options }{/if}
- </select>
- </td>
- </tr>
-
- <tr>
- <td>{'add tags'|@translate}</td>
- <td>
-<select id="tags" name="add_tags">
-</select>
- </td>
- </tr>
-
- {if !empty($DEL_TAG_SELECTION)}
- <tr>
- <td>{'remove tags'|@translate}</td>
- <td>{$DEL_TAG_SELECTION}</td>
- </tr>
- {/if}
-
- <tr>
- <td>{'Author'|@translate}</td>
- <td>
- <label><input type="radio" name="author_action" value="leave" checked="checked"> {'leave'|@translate}</label>
- <label><input type="radio" name="author_action" value="unset"> {'unset'|@translate}</label>
- <label><input type="radio" name="author_action" value="set" id="author_action_set"> {'set to'|@translate}</label>
- <input onchange="document.getElementById('author_action_set').checked = true;" type="text" class="large" name="author" value="">
- </td>
- </tr>
-
- <tr>
- <td>{'title'|@translate}</td>
- <td>
- <label><input type="radio" name="name_action" value="leave" checked="checked"> {'leave'|@translate}</label>
- <label><input type="radio" name="name_action" value="unset"> {'unset'|@translate}</label>
- <label><input type="radio" name="name_action" value="set" id="name_action_set"> {'set to'|@translate}</label>
- <input onchange="document.getElementById('name_action_set').checked = true;" type="text" class="large" name="name" value="">
- </td>
- </tr>
-
- <tr>
- <td>{'Creation date'|@translate}</td>
- <td>
- <label><input type="radio" name="date_creation_action" value="leave" checked="checked"> {'leave'|@translate}</label>
- <label><input type="radio" name="date_creation_action" value="unset"> {'unset'|@translate}</label>
- <label><input type="radio" name="date_creation_action" value="set" id="date_creation_action_set"> {'set to'|@translate}</label>
- <select id="date_creation_day" name="date_creation_day">
- <option value="0">--</option>
- {section name=day start=1 loop=32}
- <option value="{$smarty.section.day.index}" {if $smarty.section.day.index==$DATE_CREATION_DAY}selected="selected"{/if}>{$smarty.section.day.index}</option>
- {/section}
- </select>
- <select id="date_creation_month" name="date_creation_month">
- {html_options options=$month_list selected=$DATE_CREATION_MONTH}
- </select>
- <input id="date_creation_year"
- name="date_creation_year"
- type="text"
- size="4"
- maxlength="4"
- value="{$DATE_CREATION_YEAR}">
- <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled">
- </td>
- </tr>
-
- <tr>
- <td>{'Who can see these photos?'|@translate}</td>
- <td>
- <label><input type="radio" name="level_action" value="leave" checked="checked">{'leave'|@translate}</label>
- <label><input type="radio" name="level_action" value="set" id="level_action_set">{'set to'|@translate}</label>
- <select onchange="document.getElementById('level_action_set').checked = true;" name="level" size="1">
- {html_options options=$level_options selected=$level_options_selected}
- </select>
- </td>
- </tr>
-
- </table>
-
- <p>
- {'target'|@translate}
- <label><input type="radio" name="target" value="all"> {'all'|@translate}</label>
- <label><input type="radio" name="target" value="selection" checked="checked"> {'selection'|@translate}</label>
- </p>
-
-
- <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
-
- </fieldset>
-
- <fieldset>
-
- <legend>{'Caddie management'|@translate}</legend>
-
- <ul style="list-style-type:none;">
- {if ($IN_CADDIE)}
- <li><label><input type="radio" name="caddie_action" value="empty_all"> {'Empty caddie'|@translate}</label></li>
- <li><label><input type="radio" name="caddie_action" value="empty_selected"> {'Take selected elements out of caddie'|@translate}</label></li>
- {else}
- <li><label><input type="radio" name="caddie_action" value="add_selected"> {'Add selected elements to caddie'|@translate}</label></li>
- {/if}
- </ul>
-
- <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit_caddie"></p>
-
- </fieldset>
-
- </form>
-
-{else}
- <div class="infos"><p>{'Caddie is currently empty'|@translate}</p></div>
-{/if}
diff --git a/admin/themes/default/template/element_set_unit.tpl b/admin/themes/default/template/element_set_unit.tpl
deleted file mode 100644
index dd2080667..000000000
--- a/admin/themes/default/template/element_set_unit.tpl
+++ /dev/null
@@ -1,151 +0,0 @@
-
-{include file='include/autosize.inc.tpl'}
-{include file='include/datepicker.inc.tpl'}
-
-{combine_script id='jquery.fcbkcomplete' load='async' require='jquery' path='themes/default/js/plugins/jquery.fcbkcomplete.js'}
-{footer_script require='jquery.fcbkcomplete'}
-var tag_boxes_selector = "";
-{foreach from=$elements item=element name=element}
-{if $smarty.foreach.element.first}
-var prefix = "";
-{else}
-prefix = ", ";
-{/if}
- tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
-{/foreach}
-{literal}
-jQuery(document).ready(function() {
- $(tag_boxes_selector).fcbkcomplete({
- json_url: "admin.php?fckb_tags=1",
- cache: false,
- filter_case: false,
- filter_hide: true,
- firstselected: true,
- filter_selected: true,
- maxitems: 100,
- newel: true
- });
-});
-{/literal}{/footer_script}
-
-<h2>{'Batch management'|@translate}</h2>
-
-<h3>{$CATEGORIES_NAV}</h3>
-
-<p style="text-align:center;">
- <a href="{$U_GLOBAL_MODE}">{'global mode'|@translate}</a>
- | {'unit mode'|@translate}
-</p>
-
-<form action="{$F_ACTION}" method="POST">
-<fieldset>
- <legend>{'Display options'|@translate}</legend>
- <p>{'elements per page'|@translate} :
- <a href="{$U_ELEMENTS_PAGE}&amp;display=5">5</a>
- | <a href="{$U_ELEMENTS_PAGE}&amp;display=10">10</a>
- | <a href="{$U_ELEMENTS_PAGE}&amp;display=50">50</a>
- | <a href="{$U_ELEMENTS_PAGE}&amp;display=all">{'all'|@translate}</a>
- </p>
-
-</fieldset>
-
-{if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
-
-{if !empty($elements) }
-<div><input type="hidden" name="element_ids" value="{$ELEMENT_IDS}"></div>
-{foreach from=$elements item=element}
-<fieldset class="elementEdit">
- <legend>{$element.LEGEND}</legend>
-
- <a href="{$element.U_EDIT}"><img src="{$element.TN_SRC}" alt="" title="{'Edit all picture informations'|@translate}"></a>
-
- <table>
-
- <tr>
- <td><strong>{'Name'|@translate}</strong></td>
- <td><input type="text" class="large" name="name-{$element.ID}" value="{$element.NAME}"></td>
- </tr>
-
- <tr>
- <td><strong>{'Author'|@translate}</strong></td>
- <td><input type="text" class="large" name="author-{$element.ID}" value="{$element.AUTHOR}"></td>
- </tr>
-
- <tr>
- <td><strong>{'Creation date'|@translate}</strong></td>
- <td>
- <label><input type="radio" name="date_creation_action-{$element.ID}" value="unset"> {'unset'|@translate}</label>
- <label><input type="radio" name="date_creation_action-{$element.ID}" value="set" id="date_creation_action_set-{$element.ID}"> {'set to'|@translate}</label>
-
- <select id="date_creation_day-{$element.ID}" name="date_creation_day-{$element.ID}">
- <option value="0">--</option>
- {section name=day start=1 loop=32}
- <option value="{$smarty.section.day.index}" {if $smarty.section.day.index==$element.DATE_CREATION_DAY}selected="selected"{/if}>{$smarty.section.day.index}</option>
- {/section}
- </select>
- <select id="date_creation_month-{$element.ID}" name="date_creation_month-{$element.ID}">
- {html_options options=$month_list selected=$element.DATE_CREATION_MONTH}
- </select>
- <input id="date_creation_year-{$element.ID}"
- name="date_creation_year-{$element.ID}"
- type="text"
- size="4"
- maxlength="4"
- value="{$element.DATE_CREATION_YEAR}">
- <input id="date_creation_linked_date-{$element.ID}" name="date_creation_linked_date-{$element.ID}" type="hidden" size="10" disabled="disabled">
- {footer_script}
- pwg_initialization_datepicker("#date_creation_day-{$element.ID}", "#date_creation_month-{$element.ID}", "#date_creation_year-{$element.ID}", "#date_creation_linked_date-{$element.ID}", "#date_creation_action_set-{$element.ID}");
- {/footer_script}
- </td>
- </tr>
- <tr>
- <td><strong>{'Who can see this photo?'|@translate}</strong></td>
- <td>
- <select name="level-{$element.ID}">
- {html_options options=$level_options selected=$element.LEVEL}
- </select>
- </td>
- </tr>
-
- <tr>
- <td><strong>{'Tags'|@translate}</strong></td>
- <td>
-
-<select id="tags-{$element.ID}" name="tags-{$element.ID}">
-{foreach from=$element.TAGS item=tag}
- <option value="{$tag.value}" class="selected">{$tag.caption}</option>
-{/foreach}
-</select>
-
- </td>
- </tr>
-
- <tr>
- <td><strong>{'Description'|@translate}</strong></td>
- <td><textarea cols="50" rows="5" name="description-{$element.ID}" id="description-{$element.ID}" class="description">{$element.DESCRIPTION}</textarea></td>
- </tr>
-
- </table>
-
-</fieldset>
-{/foreach}
-
-<p>
- <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
- <input class="submit" type="reset" value="{'Reset'|@translate}">
-</p>
-{/if}
-
-</form>
-
-<script type="text/javascript">// <![CDATA[
-{literal}$(document).ready(function() {
- $(".elementEdit img").fadeTo("slow", 0.6); // Opacity on page load
- $(".elementEdit img").hover(function(){
- $(this).fadeTo("slow", 1.0); // Opacity on hover
- },function(){
- $(this).fadeTo("slow", 0.6); // Opacity on mouseout
- });
-});{/literal}
-// ]]>
-</script>