html_picture_menu customization issue html_picture_menu customization issue
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

html_picture_menu customization issue

Started by LoganSix, July 30, 2007, 10:19:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LoganSix

This may be a bug, but I am not sure.

When I was trying to modify the Admin menu for the intermediate file, I got an error that the function "html_picture_menu()" had already been declared in the displayimage.php file.  When I checked the file, I noticed it didn't have a "is_defined" function around it. So, in order for the html_picture_menu() function to be cusomizable on the theme.php file, it needs an update on the displayimage.php file.

Current 

function html_picture_menu()
{
    global $lang_display_image_php, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $CONFIG;

    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
    $picmenu = '';

  if (false) { //(!($mime_content['content']=='image')) {
    $picmenu = <<<EOT
     <a href="#" onclick="return MM_openBrWindow('setplayer.php?={$mime_content['extension']}','Set_Player','scrollbars=no,toolbar=no,status=no,resizable=no')" class="admin_menu" >{$lang_display_image_php['set_player']}</a>
EOT;
  }

  if ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {
    $picmenu .= <<<EOT
     <a href="javascript:;" onclick="return MM_openBrWindow('picEditor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" class="admin_menu" >{$lang_display_image_php['crop_pic']}</a> <a href="editOnePic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"  class="admin_menu">{$lang_display_image_php['edit_pic']}</a> <a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"  class="admin_menu" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; ">{$lang_display_image_php['del_pic']}</a>
EOT;
  }

  return $picmenu;
}


Changed
if (!function_exists('html_picture_menu')){
function html_picture_menu()
{
global $lang_display_image_php, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $CONFIG;

$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
$picmenu = '';

  if (false) { //(!($mime_content['content']=='image')) {
$picmenu = <<<EOT
<a href="#" onclick="return MM_openBrWindow('setplayer.php?={$mime_content['extension']}','Set_Player','scrollbars=no,toolbar=no,status=no,resizable=no')" class="admin_menu" >{$lang_display_image_php['set_player']}</a>
EOT;
  }

  if ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {
$picmenu .= <<<EOT
<a href="javascript:;" onclick="return MM_openBrWindow('picEditor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" class="admin_menu" >{$lang_display_image_php['crop_pic']}</a> <a href="editOnePic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"  class="admin_menu">{$lang_display_image_php['edit_pic']}</a> <a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"  class="admin_menu" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; ">{$lang_display_image_php['del_pic']}</a>
EOT;
  }

  return $picmenu;
}
}



This will allow for customizations in the theme.php file.
Example theme
function html_picture_menu() {
  global $lang_display_image_php, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $CONFIG;

  $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
  $picmenu = '';

  if (false) { //(!($mime_content['content']=='image')) {
    $picmenu = <<<EOT
     <a href="#" onclick="return MM_openBrWindow('setplayer.php?={$mime_content['extension']}','Set_Player','scrollbars=no,toolbar=no,status=no,resizable=no')" class="admin_menu" >{$lang_display_image_php['set_player']}</a>
EOT;
  }

  if ((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) {
    $picmenu .= <<<EOT
     <a href="javascript:;" onclick="return MM_openBrWindow('picEditor.php?id={$CURRENT_PIC_DATA['pid']}','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" class="admin_menu" ><img src="themes/life-is-a-byte/images/crop.png" alt="{$lang_display_image_php['crop_pic']}" /></a>
<a href="editOnePic.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture" class="admin_menu"><img src="themes/life-is-a-byte/images/edit.png" alt="{$lang_display_image_php['edit_pic']}" /></a>
<a href="delete.php?id={$CURRENT_PIC_DATA['pid']}&amp;what=picture"  class="admin_menu" onclick="return confirm('{$lang_display_image_php['confirm_del']}'); return false; "><img src="themes/life-is-a-byte/images/delete.png" alt="{$lang_display_image_php['del_pic']}" /></a>
EOT;
  }

  return $picmenu;
}


If I am totally off on this, please let me know what the correct solution is.

Nibbler

I don't think that function is intended to be part of the overridable theme system. You could say this about any of the functions used in Coppermine.

Joachim Müller

When trying to edit the admin menu, why don't you edit $template_gallery_admin_menu ?

LoganSix

The $template_gallery_admin_menu doesn't edit the menu I am talking about.

QuoteI don't think that function is intended to be part of the overridable theme system.
I just don't like the text menu options below the pictures.  I know it doesn't make a big difference, it just looks cleaner with some icons.
I attached a screen shot with the default menu on the left and the customized menu on the right.

I guess I will be running into this situation with other parts.

I was wondering, would you consider adding a "Admin Template"?  The current template adjust the user look and feel, but you don't have a way (without doing what I am doing to the functions) to adjust the Admin screens.  Unless I can get the admin screens without the full template layout, they don't fit correctly into my template. If there was a "admin-theme.php" file for a template, the admin screens could be modified and also the admin menu options.  By adding a second theme file it would make it easier to modified because the items would be separate.