- feature admin element set: recently posted images (nice if you forget add to caddie during synchro phase)
git-svn-id: http://piwigo.org/svn/trunk@2579 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
01f78a2feb
commit
351d3558b1
4 changed files with 34 additions and 22 deletions
|
|
@ -87,6 +87,7 @@ $template->assign(
|
|||
'U_WAITING'=> $link_start.'comments',
|
||||
'U_RATING'=> $link_start.'rating',
|
||||
'U_CADDIE'=> $link_start.'element_set&cat=caddie',
|
||||
'U_RECENT_SET'=> $link_start.'element_set&cat=recent',
|
||||
'U_TAGS'=> $link_start.'tags',
|
||||
'U_THUMBNAILS'=> $link_start.'thumbnail',
|
||||
'U_USERS'=> $link_start.'user_list',
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@
|
|||
/**
|
||||
* Management of elements set. Elements can belong to a category or to the
|
||||
* user caddie.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PHPWG_ROOT_PATH'))
|
||||
{
|
||||
die('Hacking attempt!');
|
||||
|
|
@ -102,7 +102,7 @@ DELETE
|
|||
|
||||
// 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'] =
|
||||
|
|
@ -111,7 +111,7 @@ if (is_numeric($_GET['cat']))
|
|||
PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id=',
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
$query = '
|
||||
SELECT image_id
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
|
|
@ -122,7 +122,7 @@ SELECT image_id
|
|||
else if ('caddie' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = l10n('caddie');
|
||||
|
||||
|
||||
$query = '
|
||||
SELECT element_id
|
||||
FROM '.CADDIE_TABLE.'
|
||||
|
|
@ -133,7 +133,7 @@ SELECT element_id
|
|||
else if ('not_linked' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = l10n('Elements_not_linked');
|
||||
|
||||
|
||||
// we are searching elements not linked to any virtual category
|
||||
$query = '
|
||||
SELECT id
|
||||
|
|
@ -159,37 +159,46 @@ SELECT DISTINCT(image_id)
|
|||
|
||||
$page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
|
||||
}
|
||||
else
|
||||
{
|
||||
$page['cat_elements_id'] = array();
|
||||
}
|
||||
}
|
||||
else if ('duplicates' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = l10n('Duplicates');
|
||||
|
||||
|
||||
// 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
|
||||
;';
|
||||
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.'
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE file IN (\''.implode("','", $duplicate_files).'\')
|
||||
ORDER BY file, id
|
||||
;';
|
||||
|
||||
$page['cat_elements_id'] = array_from_query($query, 'id');
|
||||
$page['cat_elements_id'][] = 0;
|
||||
}
|
||||
elseif ('recent'== $_GET['cat'])
|
||||
{
|
||||
$page['title'] = l10n('recent_pics_cat');
|
||||
$query = 'SELECT MAX(date_available) AS date
|
||||
FROM '.IMAGES_TABLE;
|
||||
if ($row=mysql_fetch_array( pwg_query($query) ) )
|
||||
{
|
||||
$query = 'SELECT id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE date_available BETWEEN DATE_SUB("'.$row['date'].'", INTERVAL 1 DAY) AND "'.$row['date'].'"';
|
||||
$page['cat_elements_id'] = array_from_query($query, 'id');
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | first element to display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ jQuery().ready(function(){ldelim}
|
|||
<li><a href="{$U_RATING}">{'Rating'|@translate}</a></li>
|
||||
<li><a href="{$U_TAGS}">{'Tags'|@translate}</a></li>
|
||||
<li><a href="{$U_CADDIE}">{'Caddie'|@translate}</a></li>
|
||||
<li><a href="{$U_RECENT_SET}">{'recent_pics_cat'|@translate}</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -17,14 +17,15 @@ function selected_admin_menu()
|
|||
case 'cat_modify':
|
||||
case 'cat_move':
|
||||
case 'cat_options':
|
||||
case 'element_set':
|
||||
case 'cat_perm':
|
||||
case 'permalinks':
|
||||
case 'picture_modify':
|
||||
if (isset($_GET['cat']) and $_GET['cat']=='caddie') {
|
||||
return 3;
|
||||
}
|
||||
return 2;
|
||||
case 'element_set':
|
||||
if (isset($_GET['cat']) and is_numeric($_GET['cat']) ) {
|
||||
return 2;
|
||||
}
|
||||
case 'picture_modify':
|
||||
return 3;
|
||||
case 'comments':
|
||||
case 'upload':
|
||||
case 'thumbnail':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue