From a08cd1a583cdda6a1175b9e1e4c9c184f3112c5d Mon Sep 17 00:00:00 2001 From: nikrou Date: Thu, 22 Jun 2006 19:21:56 +0000 Subject: svn merge -r1366:1371 from branch 1.6 into trunk git-svn-id: http://piwigo.org/svn/trunk@1377 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/common.inc.php | 10 +- include/config_default.inc.php | 7 + include/menubar.inc.php | 304 ++++++++++++++++++++++++++++ index.php | 268 +----------------------- template/yoga/header.tpl | 5 +- template/yoga/index.tpl | 122 +---------- template/yoga/menubar.tpl | 121 +++++++++++ template/yoga/theme/clear/themeconf.inc.php | 3 +- template/yoga/theme/dark/themeconf.inc.php | 3 +- 9 files changed, 453 insertions(+), 390 deletions(-) create mode 100755 include/menubar.inc.php create mode 100644 template/yoga/menubar.tpl diff --git a/include/common.inc.php b/include/common.inc.php index 8aeafb7bf..2c9364d38 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -198,7 +198,15 @@ if ($user['is_the_guest']) } // include template/theme configuration -list($user['template'], $user['theme']) = explode('/', $user['template']); +if (defined('IN_ADMIN') and IN_ADMIN) +{ + list($user['template'], $user['theme']) = explode('/', $conf['admin_layout']); +// TODO : replace $conf['admin_layout'] by $user['admin_layout'] +} +else +{ + list($user['template'], $user['theme']) = explode('/', $user['template']); +} // TODO : replace initial $user['template'] by $user['layout'] include( diff --git a/include/config_default.inc.php b/include/config_default.inc.php index ec432f210..1b0b7b6bb 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -480,4 +480,11 @@ $conf['nbm_list_all_enabled_users_to_send'] = false; // Max mails sended on one pass $conf['nbm_max_treatment_timeout_percent'] = 0.8; +// +-----------------------------------------------------------------------+ +// | Set default admin layout | +// +-----------------------------------------------------------------------+ + +// Must be user setable in future +$conf['admin_layout']='yoga/dark'; + ?> diff --git a/include/menubar.inc.php b/include/menubar.inc.php new file mode 100755 index 000000000..367d3a961 --- /dev/null +++ b/include/menubar.inc.php @@ -0,0 +1,304 @@ +set_filenames( + array( + 'menubar' => 'menubar.tpl', + ) + ); + +$template->assign_vars( + array( + 'NB_PICTURE' => $user['nb_total_images'], + 'USERNAME' => $user['username'], + 'MENU_CATEGORIES_CONTENT' => get_categories_menu(), + 'F_IDENTIFY' => get_root_url().'identification.php', + 'U_HOME' => make_index_URL(), + 'U_REGISTER' => get_root_url().'register.php', + 'U_LOST_PASSWORD' => get_root_url().'password.php', + 'U_LOGOUT' => add_url_params(make_index_URL(), array('act'=>'logout') ), + 'U_ADMIN'=> get_root_url().'admin.php', + 'U_PROFILE'=> get_root_url().'profile.php', + ) + ); + +//-------------------------------------------------------------- external links +if (count($conf['links']) > 0) +{ + $template->assign_block_vars('links', array()); + + foreach ($conf['links'] as $url => $label) + { + $template->assign_block_vars( + 'links.link', + array( + 'URL' => $url, + 'LABEL' => $label + ) + ); + } +} +//------------------------------------------------------------------------ tags +if ('tags' == $page['section']) +{ + $template->assign_block_vars('tags', array()); + + // display tags associated to currently tagged items, less current tags + $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 + WHERE image_id IN ('.implode(',', $items).') + AND tag_id NOT IN ('.implode(',', $page['tag_ids']).') + GROUP BY tag_id + ORDER BY name ASC +;'; + $result = pwg_query($query); + while($row = mysql_fetch_array($result)) + { + array_push($tags, $row); + } + } + + $tags = add_level_to_tags($tags); + + foreach ($tags as $tag) + { + $template->assign_block_vars( + 'tags.tag', + array( + 'URL_ADD' => make_index_URL( + array( + 'tags' => array_merge( + $page['tags'], + array( + array( + 'id' => $tag['tag_id'], + 'url_name' => $tag['url_name'], + ), + ) + ) + ) + ), + + 'URL' => make_index_URL( + array( + 'tags' => array( + array( + 'id' => $tag['tag_id'], + 'url_name' => $tag['url_name'], + ), + ) + ) + ), + + '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'] + ) + ); + } +} +//---------------------------------------------------------- special categories +// favorites categories +if ( !$user['is_the_guest'] ) +{ + $template->assign_block_vars('username', array()); + + $template->assign_block_vars( + 'special_cat', + array( + 'URL' => make_index_URL(array('section' => 'favorites')), + 'TITLE' => $lang['favorite_cat_hint'], + 'NAME' => $lang['favorite_cat'] + )); +} +// most visited +$template->assign_block_vars( + 'special_cat', + array( + 'URL' => make_index_URL(array('section' => 'most_visited')), + 'TITLE' => $lang['most_visited_cat_hint'], + 'NAME' => $lang['most_visited_cat'] + )); +// best rated +if ($conf['rate']) +{ + $template->assign_block_vars( + 'special_cat', + array( + 'URL' => make_index_URL(array('section' => 'best_rated')), + 'TITLE' => $lang['best_rated_cat_hint'], + 'NAME' => $lang['best_rated_cat'] + ) + ); +} +// random +$template->assign_block_vars( + 'special_cat', + array( + 'URL' => get_root_url().'random.php', + 'TITLE' => $lang['random_cat_hint'], + 'NAME' => $lang['random_cat'] + )); +// recent pics +$template->assign_block_vars( + 'special_cat', + array( + 'URL' => make_index_URL(array('section' => 'recent_pics')), + 'TITLE' => $lang['recent_pics_cat_hint'], + 'NAME' => $lang['recent_pics_cat'] + )); +// recent cats +$template->assign_block_vars( + 'special_cat', + array( + 'URL' => make_index_URL(array('section' => 'recent_cats')), + 'TITLE' => $lang['recent_cats_cat_hint'], + 'NAME' => $lang['recent_cats_cat'] + )); + +// calendar +$template->assign_block_vars( + 'special_cat', + array( + 'URL' => + make_index_URL( + array( + 'chronology_field' => ($conf['calendar_datefield']=='date_available' + ? 'posted' : 'created'), + 'chronology_style'=> 'monthly', + 'chronology_view' => 'calendar' + ) + ), + 'TITLE' => $lang['calendar_hint'], + 'NAME' => $lang['calendar'] + ) + ); +//--------------------------------------------------------------------- summary + +if ($user['is_the_guest']) +{ + $template->assign_block_vars('register', array()); + $template->assign_block_vars('login', array()); + + $template->assign_block_vars('quickconnect', array()); + if ($conf['authorize_remembering']) + { + $template->assign_block_vars('quickconnect.remember_me', array()); + } +} +else +{ + $template->assign_block_vars('hello', array()); + + if (is_autorize_status(ACCESS_CLASSIC)) + { + $template->assign_block_vars('profile', array()); + } + + // the logout link has no meaning with Apache authentication : it is not + // possible to logout with this kind of authentication. + if (!$conf['apache_authentication']) + { + $template->assign_block_vars('logout', array()); + } + + if (is_admin()) + { + $template->assign_block_vars('admin', array()); + } +} + +// tags link +$template->assign_block_vars( + 'summary', + array( + 'TITLE' => l10n('See available tags'), + 'NAME' => l10n('Tags'), + 'U_SUMMARY'=> get_root_url().'tags.php', + ) + ); + +// search link +$template->assign_block_vars( + 'summary', + array( + 'TITLE'=>$lang['hint_search'], + 'NAME'=>$lang['search'], + 'U_SUMMARY'=> get_root_url().'search.php', + 'REL'=> 'rel="search"' + ) + ); + +// comments link +$template->assign_block_vars( + 'summary', + array( + 'TITLE'=>$lang['hint_comments'], + 'NAME'=>$lang['comments'], + 'U_SUMMARY'=> get_root_url().'comments.php', + ) + ); + +// about link +$template->assign_block_vars( + 'summary', + array( + 'TITLE' => $lang['about_page_title'], + 'NAME' => $lang['About'], + 'U_SUMMARY' => get_root_url().'about.php', + ) + ); + +// notification +$template->assign_block_vars( + 'summary', + array( + 'TITLE'=>l10n('notification'), + 'NAME'=>l10n('Notification'), + 'U_SUMMARY'=> get_root_url().'notification.php', + 'REL'=> 'rel="nofollow"' + ) + ); +$template->assign_var_from_handle('MENUBAR', 'menubar'); +?> diff --git a/index.php b/index.php index c48242e68..474543a0d 100644 --- a/index.php +++ b/index.php @@ -168,24 +168,14 @@ else array('URL' => $url ) ); } +// include menubar +include(PHPWG_ROOT_PATH.'include/menubar.inc.php'); $template->assign_vars( array( - 'NB_PICTURE' => $user['nb_total_images'], 'TITLE' => $template_title, - 'USERNAME' => $user['username'], - 'TOP_NUMBER' => $conf['top_number'], - 'MENU_CATEGORIES_CONTENT' => get_categories_menu(), - - 'F_IDENTIFY' => get_root_url().'identification.php', - 'T_RECENT' => $icon_recent, - - 'U_HOME' => make_index_URL(), - 'U_REGISTER' => get_root_url().'register.php', - 'U_LOST_PASSWORD' => get_root_url().'password.php', - 'U_LOGOUT' => add_url_params(make_index_URL(), array('act'=>'logout') ), - 'U_ADMIN'=> get_root_url().'admin.php', - 'U_PROFILE'=> get_root_url().'profile.php', + 'TOP_NUMBER' => $conf['top_number'], // still used ? + 'T_RECENT' => $icon_recent, // still used ? ) ); @@ -198,256 +188,6 @@ if ('search' == $page['section']) ) ); } -//-------------------------------------------------------------- external links -if (count($conf['links']) > 0) -{ - $template->assign_block_vars('links', array()); - - foreach ($conf['links'] as $url => $label) - { - $template->assign_block_vars( - 'links.link', - array( - 'URL' => $url, - 'LABEL' => $label - ) - ); - } -} -//------------------------------------------------------------------------ tags -if ('tags' == $page['section']) -{ - $template->assign_block_vars('tags', array()); - - // display tags associated to currently tagged items, less current tags - $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 - WHERE image_id IN ('.implode(',', $items).') - AND tag_id NOT IN ('.implode(',', $page['tag_ids']).') - GROUP BY tag_id - ORDER BY name ASC -;'; - $result = pwg_query($query); - while($row = mysql_fetch_array($result)) - { - array_push($tags, $row); - } - } - - $tags = add_level_to_tags($tags); - - foreach ($tags as $tag) - { - $template->assign_block_vars( - 'tags.tag', - array( - 'URL_ADD' => make_index_URL( - array( - 'tags' => array_merge( - $page['tags'], - array( - array( - 'id' => $tag['tag_id'], - 'url_name' => $tag['url_name'], - ), - ) - ) - ) - ), - - 'URL' => make_index_URL( - array( - 'tags' => array( - array( - 'id' => $tag['tag_id'], - 'url_name' => $tag['url_name'], - ), - ) - ) - ), - - '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'] - ) - ); - } -} -//---------------------------------------------------------- special categories -// favorites categories -if ( !$user['is_the_guest'] ) -{ - $template->assign_block_vars('username', array()); - - $template->assign_block_vars( - 'special_cat', - array( - 'URL' => make_index_URL(array('section' => 'favorites')), - 'TITLE' => $lang['favorite_cat_hint'], - 'NAME' => $lang['favorite_cat'] - )); -} -// most visited -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => make_index_URL(array('section' => 'most_visited')), - 'TITLE' => $lang['most_visited_cat_hint'], - 'NAME' => $lang['most_visited_cat'] - )); -// best rated -if ($conf['rate']) -{ - $template->assign_block_vars( - 'special_cat', - array( - 'URL' => make_index_URL(array('section' => 'best_rated')), - 'TITLE' => $lang['best_rated_cat_hint'], - 'NAME' => $lang['best_rated_cat'] - ) - ); -} -// random -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => get_root_url().'random.php', - 'TITLE' => $lang['random_cat_hint'], - 'NAME' => $lang['random_cat'] - )); -// recent pics -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => make_index_URL(array('section' => 'recent_pics')), - 'TITLE' => $lang['recent_pics_cat_hint'], - 'NAME' => $lang['recent_pics_cat'] - )); -// recent cats -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => make_index_URL(array('section' => 'recent_cats')), - 'TITLE' => $lang['recent_cats_cat_hint'], - 'NAME' => $lang['recent_cats_cat'] - )); - -// calendar -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => - make_index_URL( - array( - 'chronology_field' => ($conf['calendar_datefield']=='date_available' - ? 'posted' : 'created'), - 'chronology_style'=> 'monthly', - 'chronology_view' => 'calendar' - ) - ), - 'TITLE' => $lang['calendar_hint'], - 'NAME' => $lang['calendar'] - ) - ); -//--------------------------------------------------------------------- summary - -if ($user['is_the_guest']) -{ - $template->assign_block_vars('register', array()); - $template->assign_block_vars('login', array()); - - $template->assign_block_vars('quickconnect', array()); - if ($conf['authorize_remembering']) - { - $template->assign_block_vars('quickconnect.remember_me', array()); - } -} -else -{ - $template->assign_block_vars('hello', array()); - - if (is_autorize_status(ACCESS_CLASSIC)) - { - $template->assign_block_vars('profile', array()); - } - - // the logout link has no meaning with Apache authentication : it is not - // possible to logout with this kind of authentication. - if (!$conf['apache_authentication']) - { - $template->assign_block_vars('logout', array()); - } - - if (is_admin()) - { - $template->assign_block_vars('admin', array()); - } -} - -// tags link -$template->assign_block_vars( - 'summary', - array( - 'TITLE' => l10n('See available tags'), - 'NAME' => l10n('Tags'), - 'U_SUMMARY'=> get_root_url().'tags.php', - ) - ); - -// search link -$template->assign_block_vars( - 'summary', - array( - 'TITLE'=>$lang['hint_search'], - 'NAME'=>$lang['search'], - 'U_SUMMARY'=> get_root_url().'search.php', - 'REL'=> 'rel="search"' - ) - ); - -// comments link -$template->assign_block_vars( - 'summary', - array( - 'TITLE'=>$lang['hint_comments'], - 'NAME'=>$lang['comments'], - 'U_SUMMARY'=> get_root_url().'comments.php', - ) - ); - -// about link -$template->assign_block_vars( - 'summary', - array( - 'TITLE' => $lang['about_page_title'], - 'NAME' => $lang['About'], - 'U_SUMMARY' => get_root_url().'about.php', - ) - ); - -// notification -$template->assign_block_vars( - 'summary', - array( - 'TITLE'=>l10n('notification'), - 'NAME'=>l10n('Notification'), - 'U_SUMMARY'=> get_root_url().'notification.php', - 'REL'=> 'rel="nofollow"' - ) - ); if (isset($page['category']) and is_admin()) { diff --git a/template/yoga/header.tpl b/template/yoga/header.tpl index d432d7b63..8ba0ce6b3 100644 --- a/template/yoga/header.tpl +++ b/template/yoga/header.tpl @@ -9,11 +9,12 @@ the "text/nonsense" prevents gecko based browsers to load it --> +{themeconf:local_head} @@ -23,7 +24,7 @@ the "text/nonsense" prevents gecko based browsers to load it --> {GALLERY_TITLE}:{PAGE_TITLE} diff --git a/template/yoga/index.tpl b/template/yoga/index.tpl index becf011ce..f09bd748b 100644 --- a/template/yoga/index.tpl +++ b/template/yoga/index.tpl @@ -1,125 +1,5 @@ - - +{MENUBAR}
    diff --git a/template/yoga/menubar.tpl b/template/yoga/menubar.tpl new file mode 100644 index 000000000..dc6b0c48f --- /dev/null +++ b/template/yoga/menubar.tpl @@ -0,0 +1,121 @@ + + diff --git a/template/yoga/theme/clear/themeconf.inc.php b/template/yoga/theme/clear/themeconf.inc.php index 10b5d104b..369818a1c 100644 --- a/template/yoga/theme/clear/themeconf.inc.php +++ b/template/yoga/theme/clear/themeconf.inc.php @@ -4,6 +4,7 @@ $themeconf = array( 'theme' => 'clear', 'icon_dir' => 'template/yoga/icon', 'admin_icon_dir' => 'template/yoga/icon/admin', - 'mime_icon_dir' => 'template/yoga/icon/mimetypes/' + 'mime_icon_dir' => 'template/yoga/icon/mimetypes/', + 'local_head' => '' ); ?> diff --git a/template/yoga/theme/dark/themeconf.inc.php b/template/yoga/theme/dark/themeconf.inc.php index 9785a2916..1051e5f3e 100644 --- a/template/yoga/theme/dark/themeconf.inc.php +++ b/template/yoga/theme/dark/themeconf.inc.php @@ -4,6 +4,7 @@ $themeconf = array( 'theme' => 'dark', 'icon_dir' => 'template/yoga/icon', 'admin_icon_dir' => 'template/yoga/icon/admin', - 'mime_icon_dir' => 'template/yoga/icon/mimetypes/' + 'mime_icon_dir' => 'template/yoga/icon/mimetypes/', + 'local_head' => '' ); ?> -- cgit v1.2.3