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: html_picture_menu customization issue  (Read 2406 times)

0 Members and 1 Guest are viewing this topic.

LoganSix

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Dean Logic
html_picture_menu customization issue
« 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 
Code: [Select]
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
Code: [Select]
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
Code: [Select]
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.
Logged

Nibbler

  • Guest
Re: html_picture_menu customization issue
« Reply #1 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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: html_picture_menu customization issue
« Reply #2 on: July 31, 2007, 06:53:52 am »

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

LoganSix

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Dean Logic
Re: html_picture_menu customization issue
« Reply #3 on: July 31, 2007, 01:35:18 pm »

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

Quote
I 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 15 queries.