From f33fdc91b2a5cb4ce0681df52b37ca5781660503 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 4 Apr 2006 00:35:12 +0000 Subject: 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 | 44 ++++++++++++++++--------------- 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, 84 insertions(+), 70 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); -$template->assign_vars( - array( - 'DEL_TAG_SELECTION' => get_html_tag_selection($tags, 'del_tags'), - ) - ); + $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'), + ) + ); +} // 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 63eb69bd4..14a84c43c 100644 Binary files a/template/yoga/icon/calendar_created.png and b/template/yoga/icon/calendar_created.png differ -- cgit v1.2.3