diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-09-24 01:27:49 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-09-24 01:27:49 +0000 |
commit | 351d3558b1fd069f39c4eb4c4d428522284afab7 (patch) | |
tree | f8193bcff04ecbeb538b9fc52d30ee46220181ff | |
parent | 01f78a2febf84d2f502c115604f56668e869ae19 (diff) |
- 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
-rw-r--r-- | admin.php | 1 | ||||
-rw-r--r-- | admin/element_set.php | 43 | ||||
-rw-r--r-- | admin/template/goto/admin.tpl | 1 | ||||
-rw-r--r-- | admin/template/goto/theme/roma/themeconf.inc.php | 11 |
4 files changed, 34 insertions, 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', diff --git a/admin/element_set.php b/admin/element_set.php index 5513a5e64..b68715808 100644 --- a/admin/element_set.php +++ b/admin/element_set.php @@ -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 | // +-----------------------------------------------------------------------+ diff --git a/admin/template/goto/admin.tpl b/admin/template/goto/admin.tpl index 4ee3fd7c5..d41d5dda7 100644 --- a/admin/template/goto/admin.tpl +++ b/admin/template/goto/admin.tpl @@ -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> diff --git a/admin/template/goto/theme/roma/themeconf.inc.php b/admin/template/goto/theme/roma/themeconf.inc.php index 690e3e4b9..556c685b3 100644 --- a/admin/template/goto/theme/roma/themeconf.inc.php +++ b/admin/template/goto/theme/roma/themeconf.inc.php @@ -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': |