aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-12-05 21:28:40 +0000
committerplegall <plg@piwigo.org>2004-12-05 21:28:40 +0000
commit9064686d9990b6830c0cd6a00d95745d3841eb9e (patch)
tree0d2bc6ee0564041f1836fb63c30cfe00738f211b
parente4ce82fc27e1e10d697815928ef06c692a3f56da (diff)
- on picture.php, related categories under the element are displayed in
global_rank order - when adding a new virtual category, initializes its global_rank - bug fixed : in admin/cat_list, false next rank - in admin/cat_modify, complete directory is calculated only if category is not virtual - admin/picture_modify rewritten : graphically nearer to admin/cat_modify, virtual associations are back - update_category partially rewritten : take an array of categories in parameter, becomes optionnaly recursive, use the set_random_representant function, set a random representant for categories with elements and no representant - bug fixed : on a search results screen, elements belonging to more than 1 category were shown more than once - bug fixed : in admin/cat_modify, changing a value in a textefield and hitting enter was setting a new random representant git-svn-id: http://piwigo.org/svn/trunk@635 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/cat_list.php53
-rw-r--r--admin/cat_modify.php13
-rw-r--r--admin/include/functions.php114
-rw-r--r--admin/picture_modify.php210
-rw-r--r--include/category_default.inc.php12
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php4
-rw-r--r--picture.php35
-rw-r--r--template/default/admin/cat_list.tpl2
-rw-r--r--template/default/admin/cat_modify.tpl6
-rw-r--r--template/default/admin/picture_modify.tpl157
10 files changed, 308 insertions, 298 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 2914901b5..72862b484 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -62,16 +62,7 @@ else if (isset($_POST['submit']))
$parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
// As we don't create a virtual category every day, let's do (far) too
// much queries
- if ($parent_id != 'NULL')
- {
- $query = '
-SELECT uppercats
- FROM '.CATEGORIES_TABLE.'
- WHERE id = '.$parent_id.'
-;';
- $parent_uppercats = array_pop(mysql_fetch_array(pwg_query($query)));
- }
-
+
// we have then to add the virtual category
$query = '
INSERT INTO '.CATEGORIES_TABLE.'
@@ -87,16 +78,41 @@ SELECT MAX(id)
FROM '.CATEGORIES_TABLE.'
;';
$my_id = array_pop(mysql_fetch_array(pwg_query($query)));
+
+ if ($parent_id != 'NULL')
+ {
+ $query = '
+SELECT uppercats, global_rank
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id = '.$parent_id.'
+;';
+ $result = pwg_query($query);
+ $row = mysql_fetch_array($result);
+
+ $parent_uppercats = $row['uppercats'];
+ $parent_global_rank = $row['global_rank'];
+ }
$query = '
UPDATE '.CATEGORIES_TABLE.'
- SET uppercats = \'';
+';
if (!empty($parent_uppercats))
{
- $query.= $parent_uppercats.',';
+ $query.= " SET uppercats = CONCAT('".$parent_uppercats."',',',id)";
+ }
+ else
+ {
+ $query.= ' SET uppercats = id';
+ }
+ if (!empty($parent_global_rank))
+ {
+ $query.= " , global_rank = CONCAT('".$parent_global_rank."','.',rank)";
+ }
+ else
+ {
+ $query.= ' , uppercats = id';
}
- $query.= $my_id;
- $query.= '\'
+ $query.= '
WHERE id = '.$my_id.'
;';
pwg_query($query);
@@ -276,9 +292,16 @@ reset($categories);
// +-----------------------------------------------------------------------+
$template->set_filenames(array('categories'=>'admin/cat_list.tpl'));
+$form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_list';
+if (isset($_GET['parent_id']))
+{
+ $form_action.= '&amp;parent_id='.$_GET['parent_id'];
+}
+
$template->assign_vars(array(
'CATEGORIES_NAV'=>$navigation,
- 'NEXT_RANK'=>count($categories)+1,
+ 'NEXT_RANK'=>max(array_keys($categories))+1,
+ 'F_ACTION'=>$form_action,
'L_ADD_VIRTUAL'=>$lang['cat_add'],
'L_SUBMIT'=>$lang['submit'],
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index fc54301d1..c230fcf94 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -101,12 +101,12 @@ foreach (array('comment','dir','site_id') as $nullable)
}
// Navigation path
-$current_category = get_cat_info($_GET['cat_id']);
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_list&amp;parent_id=';
$navigation = '<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.'admin.php?page=cat_list').'">';
$navigation.= $lang['home'].'</a> <span style="font-size:15px">&rarr;</span>';
-$navigation.= get_cat_display_name(
- $current_category['name'],
+
+$navigation.= get_cat_display_name_cache(
+ $category['uppercats'],
' <span style="font-size:15px">&rarr;</span>',
$url);
@@ -136,7 +136,6 @@ $template->assign_vars(array(
'CATEGORIES_NAV'=>$navigation,
'CAT_NAME'=>$category['name'],
'CAT_COMMENT'=>$category['comment'],
- 'CATEGORY_DIR'=>preg_replace('/\/$/', '', get_complete_dir($category['id'])),
$status=>'checked="checked"',
$lock=>'checked="checked"',
@@ -184,7 +183,11 @@ SELECT tn_ext,path
if (!empty($category['dir']))
{
- $template->assign_block_vars('storage' ,array());
+ $template->assign_block_vars(
+ 'storage',
+ array('CATEGORY_DIR'=>preg_replace('/\/$/',
+ '',
+ get_complete_dir($category['id']))));
$template->assign_block_vars('upload' ,array());
}
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 8ae7929ae..0d2972740 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -441,36 +441,74 @@ function check_favorites( $user_id )
}
/**
- * updates calculated informations about a category : date_last and
+ * updates calculated informations about a set of categories : date_last and
* nb_images. It also verifies that the representative picture is really
- * linked to the category. Recursive.
+ * linked to the category. Optionnaly recursive.
*
* @param mixed category id
+ * @param boolean recursive
* @returns void
*/
-function update_category($id = 'all')
+function update_category($ids = 'all', $recursive = false)
{
+ // retrieving all categories to update
$cat_ids = array();
$query = '
-SELECT category_id,
- COUNT(image_id) AS nb_images,
- MAX(date_available) AS date_last
- FROM '.IMAGES_TABLE.'
- INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
- if (is_numeric($id))
+SELECT id
+ FROM '.CATEGORIES_TABLE;
+ if (is_array($ids))
{
- $query.= '
- WHERE uppercats REGEXP \'(^|,)'.$id.'(,|$)\'';
+ if ($recursive)
+ {
+ foreach ($ids as $num => $id)
+ {
+ if ($num == 0)
+ {
+ $query.= '
+ WHERE ';
+ }
+ else
+ {
+ $query.= '
+ OR ';
+ }
+ $query.= 'uppercats REGEXP \'(^|,)'.$id.'(,|$)\'';
+ }
+ }
+ else
+ {
+ $query.= '
+ WHERE id IN ('.implode(',', $ids).')';
+ }
}
$query.= '
- GROUP BY category_id
;';
$result = pwg_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ array_push($cat_ids, $row['id']);
+ }
+ $cat_ids = array_unique($cat_ids);
+
+ if (count($cat_ids) == 0)
+ {
+ return false;
+ }
+
+ // calculate informations about categories retrieved
+ $query = '
+SELECT category_id,
+ COUNT(image_id) AS nb_images,
+ MAX(date_available) AS date_last
+ FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
+ WHERE category_id IN ('.implode(',', $cat_ids).')
+ GROUP BY category_id
+';
+ $result = pwg_query($query);
$datas = array();
while ( $row = mysql_fetch_array( $result ) )
{
- array_push($cat_ids, $row['category_id']);
array_push($datas, array('id' => $row['category_id'],
'date_last' => $row['date_last'],
'nb_images' => $row['nb_images']));
@@ -479,8 +517,16 @@ SELECT category_id,
'update' => array('date_last', 'nb_images'));
mass_updates(CATEGORIES_TABLE, $fields, $datas);
+ $query = '
+UPDATE '.CATEGORIES_TABLE.'
+ SET representative_picture_id = NULL
+ WHERE nb_images = 0
+;';
+ pwg_query($query);
+
if (count($cat_ids) > 0)
{
+ $categories = array();
// find all categories where the setted representative is not possible
$query = '
SELECT id
@@ -493,35 +539,23 @@ SELECT id
$result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
- // set a new representative element for this category
- $query = '
-SELECT image_id
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id = '.$row['id'].'
- ORDER BY RAND()
- LIMIT 0,1
-;';
- $sub_result = pwg_query($query);
- if (mysql_num_rows($sub_result) > 0)
- {
- list($representative) = mysql_fetch_array($sub_result);
- $query = '
-UPDATE '.CATEGORIES_TABLE.'
- SET representative_picture_id = '.$representative.'
- WHERE id = '.$row['id'].'
-;';
- pwg_query($query);
- }
- else
- {
- $query = '
-UPDATE '.CATEGORIES_TABLE.'
- SET representative_picture_id = NULL
- WHERE id = '.$row['id'].'
+ array_push($categories, $row['id']);
+ }
+ // find categories with elements and with no representant
+ $query = '
+SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ WHERE representative_picture_id IS NULL
+ AND nb_images != 0
;';
- pwg_query($query);
- }
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ array_push($categories, $row['id']);
}
+
+ $categories = array_unique($categories);
+ set_random_representant($categories);
}
}
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 476ddb359..23f4d301d 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -83,110 +83,47 @@ if (isset($_POST['submit']))
$query.= ' WHERE id = '.$_GET['image_id'];
$query.= ';';
pwg_query($query);
- // make the picture representative of a category ?
- $query = '
-SELECT DISTINCT(category_id) as category_id,representative_picture_id
- FROM '.IMAGE_CATEGORY_TABLE.' AS ic, '.CATEGORIES_TABLE.' AS c
- WHERE c.id = ic.category_id
- AND image_id = '.$_GET['image_id'].'
-;';
- $result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
- {
- // if the user ask the picture to be the representative picture of its
- // category, the category is updated in the database (without wondering
- // if this picture was already the representative one)
- if (isset($_POST['representative-'.$row['category_id']]))
- {
- $query = 'UPDATE '.CATEGORIES_TABLE;
- $query.= ' SET representative_picture_id = '.$_GET['image_id'];
- $query.= ' WHERE id = '.$row['category_id'];
- $query.= ';';
- pwg_query($query);
- }
- // if the user ask this picture to be not any more the representative,
- // we have to set the representative_picture_id of this category to NULL
- else if (isset($row['representative_picture_id'])
- and $row['representative_picture_id'] == $_GET['image_id'])
- {
- $query = '
-UPDATE '.CATEGORIES_TABLE.'
- SET representative_picture_id = NULL
- WHERE id = '.$row['category_id'].'
-;';
- pwg_query($query);
- }
- }
- $associate_or_dissociate = false;
- // associate with a new category ?
- if ($_POST['associate'] != '-1' and $_POST['associate'] != '')
- {
- // does the uppercat id exists in the database ?
- if (!is_numeric($_POST['associate']))
- {
- array_push($errors, $lang['cat_unknown_id']);
- }
- else
- {
- $query = '
-SELECT id
- FROM '.CATEGORIES_TABLE.'
- WHERE id = '.$_POST['associate'].'
-;';
- if (mysql_num_rows(pwg_query($query)) == 0)
- array_push($errors, $lang['cat_unknown_id']);
- }
- }
- if ($_POST['associate'] != '-1'
- and $_POST['associate'] != ''
- and count($errors) == 0)
+}
+// associate the element to other categories than its storage category
+if (isset($_POST['associate'])
+ and isset($_POST['cat_dissociated'])
+ and count($_POST['cat_dissociated']) > 0)
+{
+ $datas = array();
+ foreach ($_POST['cat_dissociated'] as $category_id)
{
- $query = '
-INSERT INTO '.IMAGE_CATEGORY_TABLE.'
- (category_id,image_id)
- VALUES
- ('.$_POST['associate'].','.$_GET['image_id'].')
-;';
- pwg_query($query);
- $associate_or_dissociate = true;
- update_category($_POST['associate']);
+ array_push($datas, array('image_id' => $_GET['image_id'],
+ 'category_id' => $category_id));
}
- // dissociate any category ?
- // retrieving all the linked categories
+ mass_inserts(IMAGE_CATEGORY_TABLE, array('image_id', 'category_id'), $datas);
+
+ update_category($_POST['cat_dissociated']);
+}
+// dissociate the element from categories (but not from its storage category)
+if (isset($_POST['dissociate'])
+ and isset($_POST['cat_associated'])
+ and count($_POST['cat_associated']) > 0)
+{
$query = '
-SELECT DISTINCT(category_id) as category_id
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE image_id = '.$_GET['image_id'].'
-;';
- $result = pwg_query($query);
- while ($row = mysql_fetch_array($result))
- {
- if (isset($_POST['dissociate-'.$row['category_id']]))
- {
- $query = '
DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE image_id = '.$_GET['image_id'].'
- AND category_id = '.$row['category_id'].'
-;';
- pwg_query($query);
- $associate_or_dissociate = true;
- update_category($row['category_id']);
- }
- }
- if ($associate_or_dissociate)
- {
- synchronize_all_users();
- }
+ AND category_id IN ('.implode(',',$_POST['cat_associated'] ).')
+';
+ pwg_query($query);
+ update_category($_POST['cat_associated']);
}
// retrieving direct information about picture
$query = '
-SELECT *
- FROM '.IMAGES_TABLE.'
- WHERE id = '.$_GET['image_id'].'
+SELECT i.*, c.uppercats
+ FROM '.IMAGES_TABLE.' AS i
+ INNER JOIN '.CATEGORIES_TABLE.' AS c ON i.storage_category_id = c.id
+ WHERE i.id = '.$_GET['image_id'].'
;';
$row = mysql_fetch_array(pwg_query($query));
+$storage_category_id = $row['storage_category_id'];
+
if (empty($row['name']))
{
$title = str_replace('_', ' ',get_filename_wo_extension($row['file']));
@@ -196,38 +133,23 @@ else
$title = $row['name'];
}
// Navigation path
-$current_category = get_cat_info($row['storage_category_id']);
-$dir_path = get_cat_display_name($current_category['name'], '-&gt;', '');
-
$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
$url_img .= '&amp;cat='.$row['storage_category_id'];
$date = isset($_POST['date_creation']) && empty($errors)
- ?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
-
-// retrieving all the linked categories
-$query = '
-SELECT DISTINCT(category_id) AS category_id,status,visible
- ,representative_picture_id
- FROM '.IMAGE_CATEGORY_TABLE.','.CATEGORIES_TABLE.'
- WHERE image_id = '.$_GET['image_id'].'
- AND category_id = id
-;';
-$result = pwg_query($query);
-$categories = '';
-while ($cat_row = mysql_fetch_array($result))
-{
- $cat_infos = get_cat_info($cat_row['category_id']);
- $cat_name = get_cat_display_name($cat_infos['name'], ' &gt; ', '');
- $categories.='<option value="'.$cat_row['category_id'].'">'.$cat_name.'</option>';
-}
-
+?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
+
+$storage_category = get_cat_display_name_cache($row['uppercats'],
+ ' &rarr; ',
+ '',
+ false);
//----------------------------------------------------- template initialization
$template->set_filenames(array('picture_modify'=>'admin/picture_modify.tpl'));
$template->assign_vars(array(
'TITLE_IMG'=>$title,
- 'DIR_IMG'=>$dir_path,
+ 'STORAGE_CATEGORY_IMG'=>$storage_category,
+ 'PATH_IMG'=>$row['path'],
'FILE_IMG'=>$row['file'],
'TN_URL_IMG'=>$thumbnail_url,
'URL_IMG'=>add_session_id($url_img),
@@ -241,7 +163,6 @@ $template->assign_vars(array(
'CREATION_DATE_IMG'=>$date,
'KEYWORDS_IMG'=>isset($_POST['keywords'])?$_POST['keywords']:@$row['keywords'],
'COMMENT_IMG'=>isset($_POST['comment'])?$_POST['comment']:@$row['comment'],
- 'ASSOCIATED_CATEGORIES'=>$categories,
'L_UPLOAD_NAME'=>$lang['upload_name'],
'L_DEFAULT'=>$lang['default'],
@@ -257,50 +178,47 @@ $template->assign_vars(array(
'L_DISSOCIATE'=>$lang['dissociate'],
'L_INFOIMAGE_ASSOCIATE'=>$lang['infoimage_associate'],
'L_SUBMIT'=>$lang['submit'],
+ 'L_RESET'=>$lang['reset'],
+ 'L_CAT_ASSOCIATED'=>$lang['cat_associated'],
+ 'L_CAT_DISSOCIATED'=>$lang['cat_dissociated'],
+ 'L_PATH'=>$lang['path'],
+ 'L_STORAGE_CATEGORY'=>$lang['storage_category'],
'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
));
//-------------------------------------------------------------- errors display
-if (sizeof($errors) != 0)
+if (count($errors) != 0)
{
$template->assign_block_vars('errors',array());
- for ($i = 0; $i < sizeof($errors); $i++)
+ foreach ($errors as $error)
{
- $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
+ $template->assign_block_vars('errors.error',array('ERROR'=>$error));
}
}
-// if there are linked category other than the storage category, we show
-// propose the dissociate text
-if (mysql_num_rows($result) > 0)
-{
- //$vtp->addSession($sub, 'dissociate');
- //$vtp->closeSession($sub, 'dissociate');
-}
// associate to another category ?
-//
-// We only show a List Of Values if the number of categories is less than
-// $conf['max_LOV_categories']
-$query = 'SELECT COUNT(id) AS nb_total_categories';
-$query.= ' FROM '.CATEGORIES_TABLE.';';
-$row = mysql_fetch_array(pwg_query($query));
-if ($row['nb_total_categories'] < $conf['max_LOV_categories'])
+$query = '
+SELECT id,name,uppercats,global_rank
+ FROM '.CATEGORIES_TABLE.'
+ INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = category_id
+ WHERE image_id = '.$_GET['image_id'].'
+ AND id != '.$storage_category_id.'
+;';
+display_select_cat_wrapper($query,array(),'associated_option');
+
+$result = pwg_query($query);
+$associateds = array($storage_category_id);
+while ($row = mysql_fetch_array($result))
{
- $template->assign_block_vars('associate_LOV',array());
- $template->assign_block_vars('associate_LOV.associate_cat',array(
- ));
- /*$vtp->addSession($sub, 'associate_LOV');
- $vtp->addSession($sub, 'associate_cat');
- $vtp->setVar($sub, 'associate_cat.value', '-1');
- $vtp->setVar($sub, 'associate_cat.content', '');
- $vtp->closeSession($sub, 'associate_cat');
- $page['plain_structure'] = get_plain_structure(true);
- $structure = create_structure('', array());
- display_categories($structure, '&nbsp;');
- $vtp->closeSession($sub, 'associate_LOV');*/
+ array_push($associateds, $row['id']);
}
-
+$query = '
+SELECT id,name,uppercats,global_rank
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id NOT IN ('.implode(',', $associateds).')
+;';
+display_select_cat_wrapper($query,array(),'dissociated_option');
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
?>
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 943bc7b5e..8dcbd0142 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -38,7 +38,7 @@
$array_cat_directories = array();
$query = '
-SELECT DISTINCT(id),path,file,date_available,category_id
+SELECT DISTINCT(id),path,file,date_available
,tn_ext,name,filesize,storage_category_id,average_rate
FROM '.IMAGES_TABLE.' AS i
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id
@@ -89,15 +89,7 @@ while ($row = mysql_fetch_array($result))
$thumbnail_title .= ' : '.$row['filesize'].' KB';
}
// url link on picture.php page
- $url_link = PHPWG_ROOT_PATH.'picture.php?';
- if ($page['cat'] == 'random')
- {
- $url_link.= 'cat='.$row['category_id'];
- }
- else
- {
- $url_link.= 'cat='.$page['cat'];
- }
+ $url_link = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'];
$url_link.= '&amp;image_id='.$row['id'];
if ($page['cat'] == 'search')
{
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index de76c8fc0..168aa0030 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -53,6 +53,7 @@ $lang['lock'] = 'Lock';
$lang['unlock'] = 'Unlock';
$lang['up'] = 'Move up';
$lang['down'] = 'Move down';
+$lang['path'] = 'path';
// Specific words
$lang['phpinfos'] = 'PHP Information';
@@ -345,4 +346,7 @@ $lang['cat_list_update_metadata_confirmation'] = 'files metadata updated';
$lang['cat_list_virtual_category_added'] = 'virtual category added';
$lang['cat_list_virtual_category_deleted'] = 'virtual category deleted';
$lang['set_random_representant'] = 'set new random representant';
+$lang['cat_associated'] = 'virtually associated to';
+$lang['cat_dissociated'] = 'dissociated from';
+$lang['storage_category'] = 'storage category';
?> \ No newline at end of file
diff --git a/picture.php b/picture.php
index 6dbb67739..e0af0b062 100644
--- a/picture.php
+++ b/picture.php
@@ -738,8 +738,9 @@ SELECT COUNT(rate) AS count
}
// related categories
$query = '
-SELECT category_id
+SELECT category_id,uppercats,commentable,global_rank
FROM '.IMAGE_CATEGORY_TABLE.'
+ INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
WHERE image_id = '.$_GET['image_id'];
if ($user['forbidden_categories'] != '')
{
@@ -749,19 +750,35 @@ if ($user['forbidden_categories'] != '')
$query.= '
;';
$result = pwg_query($query);
-$categories = '';
-$page['show_comments'] = false;
+$cat_array = array();
while ($row = mysql_fetch_array($result))
{
- if ($categories != '')
+ array_push($cat_array, $row);
+}
+usort($cat_array, 'global_rank_compare');
+
+$cat_output = '';
+$page['show_comments'] = false;
+foreach ($cat_array as $category)
+{
+ if ($cat_output != '')
+ {
+ $cat_output.= '<br />';
+ }
+
+ if (count($cat_array) > 3)
+ {
+ $cat_output .= get_cat_display_name_cache($category['uppercats'],
+ ' &rarr; ');
+ }
+ else
{
- $categories.= '<br />';
+ $cat_info = get_cat_info($category['category_id']);
+ $cat_output .= get_cat_display_name($cat_info['name'], ' &rarr; ');
}
- $cat_info = get_cat_info($row['category_id']);
- $categories .= get_cat_display_name($cat_info['name'], ' &gt;');
// the picture is commentable if it belongs at least to one category which
// is commentable
- if ($cat_info['commentable'])
+ if ($category['commentable'])
{
$page['show_comments'] = true;
}
@@ -770,7 +787,7 @@ $template->assign_block_vars(
'info_line',
array(
'INFO' => $lang['categories'],
- 'VALUE' => $categories
+ 'VALUE' => $cat_output
));
// metadata
if ($metadata_showable and isset($_GET['show_metadata']))
diff --git a/template/default/admin/cat_list.tpl b/template/default/admin/cat_list.tpl
index b33771222..39fbc3b20 100644
--- a/template/default/admin/cat_list.tpl
+++ b/template/default/admin/cat_list.tpl
@@ -52,7 +52,7 @@
<tr>
<!-- END category -->
</table>
-<form action="" method="post">
+<form action="{F_ACTION}" method="post">
{L_ADD_VIRTUAL} : <input type="text" name="virtual_name" />
<input type="hidden" name="rank" value="{NEXT_RANK}"/>
<input type="submit" value="{L_SUBMIT}" class="bouton" name="submit" />
diff --git a/template/default/admin/cat_modify.tpl b/template/default/admin/cat_modify.tpl
index c9b9749b3..8344b269d 100644
--- a/template/default/admin/cat_modify.tpl
+++ b/template/default/admin/cat_modify.tpl
@@ -13,6 +13,10 @@
<td class="row1"><input type="submit" name="set_random_representant" value="{L_SET_RANDOM_REPRESENTANT}" class="bouton" /></td>
</tr>
<!-- END representant -->
+ </table>
+</form>
+<form action="{F_ACTION}" method="POST">
+<table style="width:100%;">
<!-- BEGIN server -->
<tr>
<td style="width:50%;"><strong>{L_REMOTE_SITE}</strong></td>
@@ -28,7 +32,7 @@
<!-- BEGIN storage -->
<tr>
<td><strong>{L_STORAGE}</strong></td>
- <td class="row1">{CATEGORY_DIR}</td>
+ <td class="row1">{storage.CATEGORY_DIR}</td>
</tr>
<!-- END storage -->
<tr>
diff --git a/template/default/admin/picture_modify.tpl b/template/default/admin/picture_modify.tpl
index 41ee6630f..9d2237905 100644
--- a/template/default/admin/picture_modify.tpl
+++ b/template/default/admin/picture_modify.tpl
@@ -7,78 +7,55 @@
</ul>
</div>
<!-- END errors -->
-<div class="admin">{TITLE_IMG} [ {DIR_IMG} &gt; {FILE_IMG} ]</div>
-<form method="post" action="{F_ACTION}">
+<div class="admin">{TITLE_IMG}</div>
+<form action="{F_ACTION}" method="POST">
<table style="width:100%;">
- <tr valign="top">
- <td style="width:1px;">
- <a href="{URL_IMG}" class="thumbnail"><img src="{TN_URL_IMG}" alt="" class="miniature" /></a>
- </td>
- <td>
- <table>
- <tr>
- <td>{L_UPLOAD_NAME} :</td>
- <td><input type="text" name="name" value="{NAME_IMG}" /> [ {L_DEFAULT} : {DEFAULT_NAME_IMG} ]</td>
- </tr>
- <tr>
- <td>{L_FILE} :</td>
- <td>{FILE_IMG}</td>
- </tr>
- <tr>
- <td>{L_SIZE} :</td>
- <td>{SIZE_IMG}</td>
- </tr>
- <tr>
- <td>{L_FILESIZE} :</td>
- <td>{FILESIZE_IMG}</td>
- </tr>
- <tr>
- <td>{L_REGISTRATION_DATE} :</td>
- <td>{REGISTRATION_DATE_IMG}</td>
- </tr>
- <tr>
- <td>{L_AUTHOR} :</td>
- <td><input type="text" name="author" value="{AUTHOR_IMG}" /></td>
- </tr>
- <tr>
- <td>{L_CREATION_DATE} :</td>
- <td><input type="text" name="date_creation" value="{CREATION_DATE_IMG}" /></td>
- </tr>
- <tr>
- <td>{L_KEYWORDS} :</td>
- <td><input type="text" name="keywords" value="{KEYWORDS_IMG}" size="50" /></td>
- </tr>
- <tr>
- <td>{L_COMMENT} :</td>
- <td><textarea name="comment" rows="5" cols="50" style="overflow:auto">{COMMENT_IMG}</textarea></td>
- </tr>
- <tr>
- <td valign="top">{L_CATEGORIES} :</td>
- <td>
- <select style="width:280px" name="cat_data[]" multiple="multiple" size="5">
- {ASSOCIATED_CATEGORIES}
- </select>
- </td>
- </tr>
- <tr><td colspan="2">&nbsp;</td></tr>
- <tr>
- <td>{L_INFOIMAGE_ASSOCIATE}</td>
- <td>
- <!-- BEGIN associate_LOV -->
- <select name="associate">
- <!-- BEGIN associate_cat -->
- <option value="{associate_LOV.associate_cat.VALUE_CAT}">{associate_LOV.associate_cat.VALUE_CONTENT}</option>
- <!-- END associate_cat -->
- </select>
- <!-- END associate_LOV -->
- <!-- BEGIN associate_text -->
- <input type="text" name="associate" />
- <!-- END associate_text -->
- </select>
- </td>
- </tr>
- </table>
- </td>
+ <tr>
+ <td colspan="2" align="center"><a href="{URL_IMG}" class="thumbnail"><img src="{TN_URL_IMG}" alt="" class="miniature" /></a></td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_UPLOAD_NAME}</strong></td>
+ <td class="row1"><input type="text" name="name" value="{NAME_IMG}" /> [ {L_DEFAULT} : {DEFAULT_NAME_IMG} ]</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_FILE}</strong></td>
+ <td class="row1">{FILE_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_SIZE}</strong></td>
+ <td class="row1">{SIZE_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_FILESIZE}</strong></td>
+ <td class="row1">{FILESIZE_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_REGISTRATION_DATE}</strong></td>
+ <td class="row1">{REGISTRATION_DATE_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_PATH}</strong></td>
+ <td class="row1">{PATH_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_STORAGE_CATEGORY}</strong></td>
+ <td class="row1">{STORAGE_CATEGORY_IMG}</td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_AUTHOR}</strong></td>
+ <td class="row1"><input type="text" name="author" value="{AUTHOR_IMG}" /></td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_CREATION_DATE}</strong></td>
+ <td class="row1"><input type="text" name="date_creation" value="{CREATION_DATE_IMG}" /></td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_KEYWORDS}</strong></td>
+ <td class="row1"><input type="text" name="keywords" value="{KEYWORDS_IMG}" size="50" /></td>
+ </tr>
+ <tr>
+ <td style="width:50%;"><strong>{L_COMMENT}</strong></td>
+ <td class="row1"><textarea name="comment" rows="5" cols="50" style="overflow:auto">{COMMENT_IMG}</textarea></td>
</tr>
<tr>
<td colspan="2"><div style="margin-bottom:0px">&nbsp;</div></td>
@@ -86,7 +63,45 @@
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" />
+ <input type="reset" name="reset" value="{L_RESET}" class="bouton" />
</td>
</tr>
</table>
</form>
+
+<form name="form1" method="post" action="{F_ACTION}" style="text-align:center;width:800px;">
+
+ <div style="clear:both;"></div>
+
+ <div style="height:auto;">
+
+ <div style="float:left;padding:10px;width:300px;">
+ <span class="titreMenu">{L_CAT_ASSOCIATED}</span><br />
+ <select style="height:auto;width:280px" name="cat_associated[]" multiple="multiple" size="10">
+ <!-- BEGIN associated_option -->
+ <option class="{associated_option.CLASS}" {associated_option.SELECTED} value="{associated_option.VALUE}">{associated_option.OPTION}</option>
+ <!-- END associated_option -->
+ </select>
+ </div>
+
+ <div style="float:left;padding-top:80px;padding-bottom:80px;text-align:center;width:160px;" >
+ <input type="submit" value="&larr;" name="associate" style="font-size:15px;" class="bouton" /><br/>
+ <input type="submit" value="&rarr;" name="dissociate" style="font-size:15px;" class="bouton" />
+ </div>
+
+ <div style="float:right;padding:10px;width:300px;">
+ <span class="titreMenu">{L_CAT_DISSOCIATED}</span><br />
+ <select style="width:280px" name="cat_dissociated[]" multiple="multiple" size="10">
+ <!-- BEGIN dissociated_option -->
+ <option class="{dissociated_option.CLASS}" {dissociated_option.SELECTED} value="{dissociated_option.VALUE}">{dissociated_option.OPTION}</option>
+ <!-- END dissociated_option -->
+ </select>
+ </div>
+
+ </div>
+
+ <div style="clear:both;"></div>
+
+ <input type="reset" name="reset" value="{L_RESET}" class="bouton" />
+
+</form>