Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: moving albmgr from admin menu to sys menu  (Read 5577 times)

0 Members and 1 Guest are viewing this topic.

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
moving albmgr from admin menu to sys menu
« on: October 10, 2007, 08:27:26 am »

Hi Boyz,

I am trying to add album manager link to the sys_menu from the admin_menu

I added in theme.php (copied over sample theme to my waterdrop mod) after

Code: [Select]
    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
this
Code: [Select]
    addbutton($sys_menu_buttons,'{ALBMGR_LNK}','{ALBMGR_TITLE}','{ALBMGR_TGT}','albmgr_link','');

and then after around line 2630
Code: [Select]
        '{FAQ_TGT}' => "faq.php",

        '{FAQ_TITLE}' => $lang_main_menu['faq_title'],

        '{FAQ_LNK}' => $lang_main_menu['faq_lnk'],

this
Code: [Select]
// MY MOD FOR ALBMGR

'{ALBMGR_TGT}' => "albmgr.php",

'{ALBMGR_TITLE}' => $lang_user_admin_menu['albmgr_lnk'],

'{ALBMGR_LNK}' => $lang_user_admin_menu['albmgr_lnk'],

        );

Yet, the $lang_user_admin_menu['albmgr_lnk'] is not recognized. Is it because it is not in the main menu lang section?
« Last Edit: October 11, 2007, 07:51:59 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: moving albmgr from admin menu to sys menu
« Reply #1 on: October 10, 2007, 08:42:00 am »

Rename your custom theme.php to theme.php.txt and attach it to your posting so that we can see what you did so far. The high line numbers in your custom theme are an indicator that you did something wrong. Are you per chance trying to modify include/themes.inc.php? Don't do that. Undo your changes there. Your changes should go into themes/yourtheme/theme.php
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: moving albmgr from admin menu to sys menu
« Reply #2 on: October 10, 2007, 10:50:20 am »

Hey Gaugau,

Thanks for replying.

The reason why my theme.php is so big, is because I copied the entire theme.php, as copying bits and pieces seemed to be a hit and miss for me :)

Anyway, here is the attachment.
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: moving albmgr from admin menu to sys menu
« Reply #3 on: October 10, 2007, 02:31:16 pm »

I meant to say I copied the entire theme.php from the samples dir...
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: moving albmgr from admin menu to sys menu
« Reply #4 on: October 10, 2007, 03:10:29 pm »

I meant to say I copied the entire theme.php from the samples dir...
That's wrong and exactly what you're not supposed to do! In fact it's the opposite of what you're supposed to do. Do not copy the the entire content of the sample theme into your custom theme, as you override all existing default functions with custom ones, although they don't differ at all. Only copy the bits from themes/sample/theme.php into themes/yourtheme/theme.php that you actually want to see changed.

Replace your custom theme.php with this:
Code: [Select]
<?php

// HTML template for sub_menu
$template_sub_menu $template_sys_menu;

if (!
defined('THEME_HAS_NO_SYS_MENU_BUTTONS')) {

  
// HTML template for template sys_menu spacer
  
$template_sys_menu_spacer ="::";

  
// HTML template for template sys_menu buttons
  
$template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  
// HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    
addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
    
addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
    
// Login and Logout don't have a spacer as only one is shown, and either would be the last option.
    
addbutton($sys_menu_buttons,'{ALBMGR_LNK}','{ALBMGR_TITLE}','{ALBMGR_TGT}','albmgr_link','');

  
$params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  
$template_sys_menu template_eval($template_sys_menu,$params);
}

if (!
defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  
// HTML template for template sub_menu spacer
  
$template_sub_menu_spacer $template_sys_menu_spacer;

  
// HTML template for template sub_menu buttons
  
$template_sub_menu_button$template_sys_menu_button;

  
// HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    
addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    
addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  
$params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  
$template_sub_menu template_eval($template_sub_menu,$params);
}


// Function for creating a main menu (SYS_MENU or SUB_MENU)
function theme_main_menu($which)
{
    global 
$AUTHORIZED$CONFIG$album$actual_cat$cat$REFERER;
    global 
$lang_main_menu$template_sys_menu$template_sub_menu$lang_user_admin_menu;


    static 
$sys_menu ''$sub_menu '';
    if ($
$which != '') {
        return $
$which;
    }

    
$album_l = isset($album) ? "?album=$album'';
    
$cat_l = (isset($actual_cat))? "?cat=$actual_cat: (isset($cat) ? "?cat=$cat'');
    
$cat_l2 = isset($cat) ? "&amp;cat=$cat'';
    
$my_gallery_id FIRST_USER_CAT USER_ID;



  if (
$which == 'sys_menu' ) {
    if (
USER_ID) {
        
template_extract_block($template_sys_menu'login');
    } else {
        
template_extract_block($template_sys_menu'logout');
        
template_extract_block($template_sys_menu'my_profile');
    }

    if (!
USER_IS_ADMIN) {
        
template_extract_block($template_sys_menu'enter_admin_mode');
        
template_extract_block($template_sys_menu'leave_admin_mode');
    } else {
        if (
GALLERY_ADMIN_MODE) {
            
template_extract_block($template_sys_menu'enter_admin_mode');
        } else {
            
template_extract_block($template_sys_menu'leave_admin_mode');
        }
    }

    if (!
USER_CAN_CREATE_ALBUMS) {
        
template_extract_block($template_sys_menu'my_gallery');
    }

    if (
USER_CAN_CREATE_ALBUMS) {
        
template_extract_block($template_sys_menu'my_profile');
    }

    if (!
USER_CAN_UPLOAD_PICTURES) {
        
template_extract_block($template_sys_menu'upload_pic');
    }

    if (
USER_ID || !$CONFIG['allow_user_registration']) {
        
template_extract_block($template_sys_menu'register');
    }

    if (!
USER_ID || !$CONFIG['allow_memberlist']) {
        
template_extract_block($template_sys_menu'allow_memberlist');
    }

    if (!
$CONFIG['display_faq']) {
        
template_extract_block($template_sys_menu'faq');
    }

    
$param = array(
        
'{HOME_TGT}' => $CONFIG['home_target'],
        
'{HOME_TITLE}' => $lang_main_menu['home_title'],
        
'{HOME_LNK}' => $lang_main_menu['home_lnk'],
        
'{MY_GAL_TGT}' => "index.php?cat=$my_gallery_id",
        
'{MY_GAL_TITLE}' => $lang_main_menu['my_gal_title'],
        
'{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'],
        
'{MEMBERLIST_TGT}' => "usermgr.php",
        
'{MEMBERLIST_TITLE}' => $lang_main_menu['memberlist_title'],
        
'{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'],
        
'{MY_PROF_TGT}' => "profile.php?op=edit_profile",
        
'{MY_PROF_TITLE}' => $lang_main_menu['my_prof_title'],
        
'{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'],
        
'{ADM_MODE_TGT}' => "mode.php?admin_mode=1&amp;referer=$REFERER",
        
'{ADM_MODE_TITLE}' => $lang_main_menu['adm_mode_title'],
        
'{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'],
        
'{USR_MODE_TGT}' => "mode.php?admin_mode=0&amp;referer=$REFERER",
        
'{USR_MODE_TITLE}' => $lang_main_menu['usr_mode_title'],
        
'{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'],
        
'{UPL_PIC_TGT}' => "upload.php",
        
'{UPL_PIC_TITLE}' => $lang_main_menu['upload_pic_title'],
        
'{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'],
        
'{REGISTER_TGT}' => "register.php",
        
'{REGISTER_TITLE}' => $lang_main_menu['register_title'],
        
'{REGISTER_LNK}' => $lang_main_menu['register_lnk'],
        
'{LOGIN_TGT}' => "login.php?referer=$REFERER",
        
'{LOGIN_TITLE}' => $lang_main_menu['login_title'],
        
'{LOGIN_LNK}' => $lang_main_menu['login_lnk'],
        
'{LOGOUT_TGT}' => "logout.php?referer=$REFERER",
        
'{LOGOUT_TITLE}' => $lang_main_menu['logout_title'],
        
'{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" stripslashes(USER_NAME) . "]",
        
'{FAQ_TGT}' => "faq.php",
        
'{FAQ_TITLE}' => $lang_main_menu['faq_title'],
        
'{FAQ_LNK}' => $lang_main_menu['faq_lnk'],
'{ALBMGR_TGT}' => "albmgr.php",// MY MOD FOR ALBMGR
'{ALBMGR_TITLE}' => $lang_user_admin_menu['albmgr_lnk'],// MY MOD FOR ALBMGR
'{ALBMGR_LNK}' => $lang_user_admin_menu['albmgr_lnk'],// MY MOD FOR ALBMGR
        
);

        
$sys_menu template_eval($template_sys_menu$param);
  } else {

    if (!
$CONFIG['custom_lnk_url']) {
        
template_extract_block($template_sub_menu'custom_link');
    }

    
$param = array(
        
'{ALB_LIST_TGT}' => "index.php$cat_l",
        
'{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
        
'{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
        
'{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'],
        
'{CUSTOM_LNK_TITLE}' => $CONFIG['custom_lnk_name'],
        
'{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'],
        
'{LASTUP_TGT}' => "thumbnails.php?album=lastup$cat_l2",
        
'{LASTUP_TITLE}' => $lang_main_menu['lastup_title'],
        
'{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'],
        
'{LASTCOM_TGT}' => "thumbnails.php?album=lastcom$cat_l2",
        
'{LASTCOM_TITLE}' => $lang_main_menu['lastcom_title'],
        
'{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'],
        
'{TOPN_TGT}' => "thumbnails.php?album=topn$cat_l2",
        
'{TOPN_TITLE}' => $lang_main_menu['topn_title'],
        
'{TOPN_LNK}' => $lang_main_menu['topn_lnk'],
        
'{TOPRATED_TGT}' => "thumbnails.php?album=toprated$cat_l2",
        
'{TOPRATED_TITLE}' => $lang_main_menu['toprated_title'],
        
'{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'],
        
'{FAV_TGT}' => "thumbnails.php?album=favpics",
        
'{FAV_TITLE}' => $lang_main_menu['fav_title'],
        
'{FAV_LNK}' => $lang_main_menu['fav_lnk'],
        
'{SEARCH_TGT}' => "search.php",
        
'{SEARCH_TITLE}' => $lang_main_menu['search_title'],
        
'{SEARCH_LNK}' => $lang_main_menu['search_lnk'],
        );
    
$sub_menu template_eval($template_sub_menu$param);
  }

    return $
$which;
}


?>


Yet, the $lang_user_admin_menu['albmgr_lnk'] is not recognized. Is it because it is not in the main menu lang section?
Since the menu is composed within a function, where the array $lang_user_admin_menu by default is not defined (global), you'll have to globalize it. I did so in above code (which is ready for copy'n paste) by replacing
Code: [Select]
    global $lang_main_menu, $template_sys_menu, $template_sub_menu;with
Code: [Select]
    global $lang_main_menu, $template_sys_menu, $template_sub_menu, $lang_user_admin_menu;. I attached the modified theme.php as well for ease of use.
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: moving albmgr from admin menu to sys menu
« Reply #5 on: October 10, 2007, 04:27:25 pm »

Wow, thanks GauGau very much! I will check this when I arrive home tonight :)

This is greatly appreciated.
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: moving albmgr from admin menu to sys menu
« Reply #6 on: October 11, 2007, 07:11:12 am »

Hey Gaugau,

It worked :)

It was complaining of a few missing functions and missing blocks (http://forum.coppermine-gallery.net/index.php?topic=26897.0) , so I added them, and also moved picmgr there

I attach it here as well
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 20 queries.