From f33fdc91b2a5cb4ce0681df52b37ca5781660503 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 4 Apr 2006 00:35:12 +0000 Subject: [PATCH] fix: sql query erros when: no items for the selected tag, search returns no result, caddie is empty fix: tag cloud was showing least used tags fix: strip html tags from head/title element on the page (tag index page title contained ...) improvement: added 5 tag levels in css for "ready to use" tags fix: corrected png icon calendar_created.png for IE fix: english language for nbm git-svn-id: http://piwigo.org/svn/trunk@1120 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/element_set_global.php | 46 ++++++++++++----------- include/config_default.inc.php | 2 +- include/page_header.php | 2 +- include/section_init.inc.php | 24 ++++++++---- index.php | 36 ++++++++---------- language/en_UK.iso-8859-1/admin.lang.php | 30 +++++++-------- tags.php | 4 +- template/yoga/default-layout.css | 12 +++++- template/yoga/icon/calendar_created.png | Bin 1084 -> 1230 bytes 9 files changed, 85 insertions(+), 71 deletions(-) diff --git a/admin/element_set_global.php b/admin/element_set_global.php index f4b8aae2b..22ea2df13 100644 --- a/admin/element_set_global.php +++ b/admin/element_set_global.php @@ -92,7 +92,7 @@ DELETE ;'; pwg_query($query); } - + if ($_POST['associate'] != 0 and count($collection) > 0) { $datas = array(); @@ -330,29 +330,31 @@ $template->assign_vars( ) ); -// remove tags -$query = ' -SELECT tag_id, name, url_name, count(*) counter - FROM '.IMAGE_TAG_TABLE.' - INNER JOIN '.TAGS_TABLE.' ON tag_id = id - WHERE image_id IN ('.implode(',', $page['cat_elements_id']).') - GROUP BY tag_id - ORDER BY name ASC -;'; -$result = pwg_query($query); - -$tags = array(); -while($row = mysql_fetch_array($result)) +if (count($page['cat_elements_id']) > 0) { - array_push($tags, $row); + // remove tags + $query = ' + SELECT tag_id, name, url_name, count(*) counter + FROM '.IMAGE_TAG_TABLE.' + INNER JOIN '.TAGS_TABLE.' ON tag_id = id + WHERE image_id IN ('.implode(',', $page['cat_elements_id']).') + GROUP BY tag_id + ORDER BY name ASC + ;'; + $result = pwg_query($query); + + $tags = array(); + while($row = mysql_fetch_array($result)) + { + array_push($tags, $row); + } + + $template->assign_vars( + array( + 'DEL_TAG_SELECTION' => get_html_tag_selection($tags, 'del_tags'), + ) + ); } - -$template->assign_vars( - 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']; diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 57a4520c3..72363d85d 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -448,7 +448,7 @@ $conf['full_tag_cloud_items_number'] = 200; // tags_levels: number of levels to use for display. Each level is bind to a // CSS class tagLevelX. -$conf['tags_levels'] = 10; +$conf['tags_levels'] = 5; // +-----------------------------------------------------------------------+ // | Notification by mail | diff --git a/include/page_header.php b/include/page_header.php index 778d5661c..f9b130c3c 100644 --- a/include/page_header.php +++ b/include/page_header.php @@ -48,7 +48,7 @@ $template->assign_vars( $page['body_id'] : '', 'CONTENT_ENCODING' => $lang_info['charset'], - 'PAGE_TITLE' => $title, + 'PAGE_TITLE' => strip_tags($title), 'LANG'=>$lang_info['code'], 'DIR'=>$lang_info['direction'], diff --git a/include/section_init.inc.php b/include/section_init.inc.php index e2ed07b42..176ebf0f0 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -161,7 +161,7 @@ else if (0 === strpos($tokens[$next_token], 'tag')) break; } } - + array_push( $page['tags'], array( @@ -305,7 +305,7 @@ if ('categories' == $page['section']) 'cat_id_uppercat' => $result['id_uppercat'], 'uppercats' => $result['uppercats'], - 'title' => get_cat_display_name($result['name'], null, false), + 'title' => get_cat_display_name($result['name'], '', false), ) ); @@ -360,7 +360,7 @@ else // permissions depends on category, so to only keep images that are // reachable to the connected user, we need to check category // associations - if (!empty($user['forbidden_categories'])) + if (!empty($user['forbidden_categories']) and !empty($items) ) { $query = ' SELECT image_id @@ -381,7 +381,7 @@ SELECT name, url_name, id ;'; $result = pwg_query($query); $tag_infos = array(); - + while ($row = mysql_fetch_array($result)) { $tag_infos[ $row['id'] ]['name'] = $row['name']; @@ -428,20 +428,28 @@ SELECT name, url_name, id { include_once( PHPWG_ROOT_PATH .'include/functions_search.inc.php' ); - $query = ' + $search_items = get_search_items($page['search']); + if ( !empty($search_items) ) + { + $query = ' SELECT DISTINCT(id) FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id - WHERE id IN ('.implode(',', get_search_items($page['search'])).') + WHERE id IN ('.implode(',', $search_items).') AND '.$forbidden.' '.$conf['order_by'].' -;'; +;'; + $page['items'] = array_from_query($query, 'id'); + } + else + { + $page['items'] = array(); + } $page = array_merge( $page, array( 'title' => $lang['search_result'], - 'items' => array_from_query($query, 'id'), 'thumbnails_include' => 'include/category_default.inc.php', ) ); diff --git a/index.php b/index.php index 784832623..4ca48385d 100644 --- a/index.php +++ b/index.php @@ -110,15 +110,7 @@ include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('index'=>'index.tpl') ); //-------------------------------------------------------------- category title -if (isset($page['category'])) -{ - $template_title = get_cat_display_name( $page['cat_name'], '', false ); -} -else -{ - $template_title = $page['title']; -} - +$template_title = $page['title']; if (isset($page['cat_nb_images']) and $page['cat_nb_images'] > 0) { $template_title.= ' ['.$page['cat_nb_images'].']'; @@ -225,9 +217,13 @@ if (count($conf['links']) > 0) if ('tags' == $page['section']) { $template->assign_block_vars('tags', array()); - + // display tags associated to currently tagged items, less current tags - $query = ' + $tags = array(); + + if ( !empty($page['items']) ) + { + $query = ' SELECT tag_id, name, url_name, count(*) counter FROM '.IMAGE_TAG_TABLE.' INNER JOIN '.TAGS_TABLE.' ON tag_id = id @@ -236,13 +232,11 @@ SELECT tag_id, name, url_name, count(*) counter GROUP BY tag_id ORDER BY name ASC ;'; - $result = pwg_query($query); - - $tags = array(); - - while($row = mysql_fetch_array($result)) - { - array_push($tags, $row); + $result = pwg_query($query); + while($row = mysql_fetch_array($result)) + { + array_push($tags, $row); + } } $tags = add_level_to_tags($tags); @@ -276,16 +270,16 @@ SELECT tag_id, name, url_name, count(*) counter ) ) ), - + 'NAME' => $tag['name'], - + 'TITLE' => l10n('See pictures linked to this tag only'), 'TITLE_ADD' => sprintf( l10n('%d pictures are also linked to current tags'), $tag['counter'] ), - + 'CLASS' => 'tagLevel'.$tag['level'] ) ); diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index abfd89a85..73cc386c2 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -258,12 +258,12 @@ $lang['nbm_content_goto'] = 'Go to %s %s.'; $lang['nbm_content_hello'] = 'Hello %s'; $lang['nbm_content_new_elements'] = 'New elements were added on %s'; $lang['nbm_content_new_elements_between'] = 'New elements were added between %s and %s'; -$lang['nbm_content_subscribe_by_admin'] = 'You are subcribed by webmaster for the notification by mail'; -$lang['nbm_content_subscribe_by_himself'] = 'You are subcribed for the notification by mail'; +$lang['nbm_content_subscribe_by_admin'] = 'The webmaster has subcribed you for receiving notifications by mail'; +$lang['nbm_content_subscribe_by_himself'] = 'You have subcribed to receiving notifications by mail'; $lang['nbm_content_subscribe_link'] = 'To subscribe, click on %s .'; -$lang['nbm_content_subscribe_unsubscribe_contact'] = 'On problems or questions, send a message to %s.'; -$lang['nbm_content_unsubscribe_by_admin'] = 'You are unsubcribed by webmaster for the notification by mail'; -$lang['nbm_content_unsubscribe_by_himself'] = 'You are unsubcribed for the notification by mail'; +$lang['nbm_content_subscribe_unsubscribe_contact'] = 'If you encounter problems or have any question, please send a message to %s.'; +$lang['nbm_content_unsubscribe_by_admin'] = 'The webmaster has unsubcribed you from receiving notifications by mail'; +$lang['nbm_content_unsubscribe_by_himself'] = 'You have unsubcribed from receiving notifications by mail'; $lang['nbm_content_unsubscribe_link'] = 'To unsubscribe, click on %s .'; $lang['nbm_info_send_mail_as'] = 'With blank value, gallery title will be used'; $lang['nbm_item_notification'] = 'Notification'; @@ -274,11 +274,11 @@ $lang['nbm_msg_no_mail_to_send'] = '%d mails were not sent.'; $lang['nbm_nbm_break_send_mail'] = 'Sent mail is limited to %d send by pass. Others mails are skipped.'; $lang['nbm_no_mail_to_send'] = 'No mail to send.'; $lang['nbm_no_user_available_to_send_L1'] = 'No user are available in order to send mail.'; -$lang['nbm_no_user_available_to_send_L2'] = 'A user is available, if the are news elements to notify'; +$lang['nbm_no_user_available_to_send_L2'] = 'A user is available, if there are new elements to notify'; $lang['nbm_no_user_to send_notifications_by_mail'] = 'No user to send notifications by mail.'; $lang['nbm_object_news'] = 'New elements added'; -$lang['nbm_object_subcribe'] = 'Subcribe of notification by mail'; -$lang['nbm_object_unsubcribe'] = 'Unsubcribe of notification by mail'; +$lang['nbm_object_subcribe'] = 'Subcribe to notification by mail'; +$lang['nbm_object_unsubcribe'] = 'Unsubcribe from notification by mail'; $lang['nbm_param_mode'] = 'Parameter'; $lang['nbm_send_check_all'] = 'Check All'; $lang['nbm_send_complementary_mail_content'] = 'Complementary mail content'; @@ -292,18 +292,18 @@ $lang['nbm_send_uncheck_all'] = 'Uncheck All'; $lang['nbm_subscribe_col'] = 'Subscribed'; $lang['nbm_subscribe_mode'] = 'Subscribe'; $lang['nbm_title_param'] = 'Parameters'; -$lang['nbm_title_send'] = 'Select sendings'; -$lang['nbm_title_subscribe'] = 'Subscribe/unscribe users'; +$lang['nbm_title_send'] = 'Select recipients'; +$lang['nbm_title_subscribe'] = 'Subscribe/unsubscribe users'; $lang['nbm_unsubscribe_col'] = 'Unsubcribed'; $lang['nbm_updated_param_count'] = '%d parameters are updated.'; $lang['nbm_user_change_enabled_error_on_updated_data_count'] = '%d user(s) are not updated.'; -$lang['nbm_user_change_enabled_false'] = 'User %s [%s] removed of subscribe list.'; -$lang['nbm_user_change_enabled_true'] = 'User %s [%s] added to subscribe list.'; +$lang['nbm_user_change_enabled_false'] = 'User %s [%s] removed from the subscription list.'; +$lang['nbm_user_change_enabled_true'] = 'User %s [%s] added to the subscription list.'; $lang['nbm_user_change_enabled_updated_data_count'] = '%d user(s) are updated.'; -$lang['nbm_user_not_change_enabled_false'] = 'User %s [%s] not removed of subscribe list.'; -$lang['nbm_user_not_change_enabled_true'] = 'User %s [%s] not added to subscribe list.'; +$lang['nbm_user_not_change_enabled_false'] = 'User %s [%s] not removed from the subscription list.'; +$lang['nbm_user_not_change_enabled_true'] = 'User %s [%s] not added to the subscription list.'; $lang['nbm_user_x_added'] = 'User %s [%s] added.'; -$lang['nbm_warning_subscribe_unsubcribe'] = 'Warning, subscribe or unscribe send mails to users'; +$lang['nbm_warning_subscribe_unsubcribe'] = 'Warning: subscribing or unsubcribing will send mails to users'; $lang['no_write_access'] = 'no write access'; $lang['order_by'] = 'order by'; $lang['path'] = 'path'; diff --git a/tags.php b/tags.php index e61ee1f24..bd6a53b90 100644 --- a/tags.php +++ b/tags.php @@ -36,7 +36,7 @@ function counter_compare($a, $b) return tag_id_compare($a, $b); } - return ($a['counter'] < $b['counter']) ? -1 : 1; + return ($a['counter'] < $b['counter']) ? +1 : -1; } function tag_id_compare($a, $b) @@ -102,7 +102,7 @@ foreach ($tags as $tag) ), ) ), - + 'NAME' => $tag['name'], 'TITLE' => $tag['counter'], 'CLASS' => 'tagLevel'.$tag['level'], diff --git a/template/yoga/default-layout.css b/template/yoga/default-layout.css index a5637c17e..85f9f774b 100644 --- a/template/yoga/default-layout.css +++ b/template/yoga/default-layout.css @@ -269,4 +269,14 @@ UL.tagSelection { UL.tagSelection LI { display: inline; white-space: nowrap; -} \ No newline at end of file +} + +#fullTagCloud { font-size: 140%; } + +#fullTagCloud LI { display: inline; } + +.tagLevel5 { font-size: 150%; } +.tagLevel4 { font-size: 140%; } +.tagLevel3 { font-size: 120%; } +.tagLevel2 { font-size: 100%; } +.tagLevel1 { font-size: 90%; } \ No newline at end of file diff --git a/template/yoga/icon/calendar_created.png b/template/yoga/icon/calendar_created.png index 63eb69bd41f570442335a28f7758958f628584e7..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