coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: LoganSix on July 30, 2007, 10:19:57 PM

Title: html_picture_menu customization issue
Post by: LoganSix on July 30, 2007, 10:19:57 PM
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.
Title: Re: html_picture_menu customization issue
Post by: Nibbler on July 31, 2007, 12:43:57 AM
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.
Title: Re: html_picture_menu customization issue
Post by: Joachim Müller on July 31, 2007, 06:53:52 AM
When trying to edit the admin menu, why don't you edit $template_gallery_admin_menu ?
Title: Re: html_picture_menu customization issue
Post by: LoganSix on July 31, 2007, 01:35:18 PM
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.