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: [url]Album name[/url] under lastalb thumb  (Read 10633 times)

0 Members and 1 Guest are viewing this topic.

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
[url]Album name[/url] under lastalb thumb
« on: May 09, 2010, 03:08:24 pm »

Hello,

At first I'd like to thank all Devs for great work around CPG. I'm using it for 3-4 years now (1.4x) and now I'm moving to 1.5x.

My problem is a long term issue I have. Never asked for help here because it wasn't so urgent and besides that I like founding things by myself (as possible of course). Now, when I decided to move to 1.5x with EnlargeIt plugin I started to drill the problem again.

So the problem is to have album name as a link to the album under the thumbnail in lastabl table. Before Enlargeit people used to click on thumb to get to the newest album thumb view. Now, when you click on thumb you get full sized pic without redirection. I don't want people to search the newest album in the categories, because it can be kind confusing after few years of just clicking on thumb. I was concidering to ask about enlargeit help, to disable it on main page, but as the problem is more on lastalb side I'd like to solve it that way (I needed to put some extra info under thumbs, especially lastalb panel and never accomplished).

What I tried:

-search the forum to solve my problem many times with various search queries
-mess with sample/theme.php, template.html
-mess with igames/theme.php, template.html <- my theme
-mess with includes/functions.php <- I think that's the one, but never did what I want, maybe my php knowledge is too poor.
-mess with includes/theme.inc.php

The other day I've found how to put some extra fields under thumbs in thumbview or lasthits (I found post how to remove IP from lasthits and tried to do the same (add) on lastabl but with no result). About lastalb I found various posts, but mostly about sorting etc, not my problem.

My old gallery 1.4x -> www.3git.org (polish site)
My new gallery 1.5x -> caiman.net.pl (as well polish, don't mind header from 3git, I'll mess the layout at the end)

Any ideas welcome, if you just point me what to do I'll be glad as well.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: [url]Album name[/url] under lastalb thumb
« Reply #1 on: May 09, 2010, 07:31:32 pm »

when you click on thumb you get full sized pic
Does it happen when you disable EnlargeIt!, too?
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #2 on: May 09, 2010, 10:48:27 pm »

No, it does not. That's why I'd like to have album name as a link below thumb, so people can jump into new album instead of searching it in cats. 
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #3 on: May 10, 2010, 12:32:37 am »

I think I got it working...

I changed in includes/functions.php

Code: [Select]
global $thumb;  // make $thumb accessible to plugins
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if (in_array($aid, $album_types['albums'])) {
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                       $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
                    } else {
                       $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = (is_numeric($page)) ? "&amp;page=$page" : '';
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
                }
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => $target,
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            }

        } else {  // mode != 'thumb'

            // Used for mode = 'user' from list_users() in index.php
            $params = array(
                '{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
                '{THUMB}'      => $thumb['image'],
                '{CAPTION}'    => $thumb['caption'],
                '{ADMIN_MENU}' => '',
            );

        }
to:

   
Code: [Select]
global $thumb;  // make $thumb accessible to plugins
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if (in_array($aid, $album_types['albums'])) {
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
                );
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                       $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
                    } else {
                       $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = (is_numeric($page)) ? "&amp;page=$page" : '';
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
                }
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => $target,
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
                );
            }

        } else {  // mode != 'thumb'

            // Used for mode = 'user' from list_users() in index.php
            $params = array(
                '{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
                '{THUMB}'      => $thumb['image'],
                '{CAPTION}'    => $thumb['caption'],
                '{ADMIN_MENU}' => '',
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
            );

        }

and then in same file:

Code: [Select]
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                       
{CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->

to:

Code: [Select]
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                        [b]<a href="{LINK_TGT}">{ALBUM_NAM}<br /></a>[/b] /HERE++++++++++++++++++++
{CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->

NOW, it only works for LASTALB (in LASTHITS remains blank space <- any idea?)

To work it out with EnlargeIt I changed this:

plugins/enlargeit/codebase.php

Code: [Select]
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a {LINK_ONCLICK} href="{LINK_TGT}">{THUMB}<br /></a>
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->

to

Code: [Select]
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a {LINK_ONCLICK} href="{LINK_TGT}">{THUMB}<br /></a>
<a href="{LINK_TGT}">{ALBUM_NAM}<br /></a> /HERE++++++++++++++++++++
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->


Now I need to get rid of album name from {CAPTION} and make it work on lasthits (but I don't mind it's not there)
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #4 on: May 10, 2010, 12:44:43 am »

Sorry for so many posts (can edit?)

FIRSTLY - the file to edit in previous post is themes.inc.php NOT includes/functions.php (too many windows open, my bad)

Secondly, to kick out title from {CAPTION} I edited:

includes/functions.php (for sure this time)

Code: [Select]
function build_caption(&$rowset, $must_have = array(), $mode = 'files')
{
    global $CONFIG, $THEME_DIR, $lang_date, $lang_get_pic_data, $cpg_udb;

    foreach ($rowset as $key => $row) {

        $caption = '';

        if ($CONFIG['display_filename']) {
            $caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
        }

        if (!empty($row['title'])) {
            $caption .= '<span class="thumb_title">' . $row['title'] . '</span>';
        }

to

Code: [Select]
function build_caption(&$rowset, $must_have = array(), $mode = 'files')
{
    global $CONFIG, $THEME_DIR, $lang_date, $lang_get_pic_data, $cpg_udb;

    foreach ($rowset as $key => $row) {

        $caption = '';

        if ($CONFIG['display_filename']) {
            $caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
        }

        if (!empty($row['title'])) {
            $caption .= '<span class="thumb_title"></span>'; /HERE+++++++++++++++++
        }

If any one can help with fixing lasthits I'd be glad. I mean now it does not show title of the album linked to it's thumbview.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [url]Album name[/url] under lastalb thumb
« Reply #5 on: May 10, 2010, 06:38:36 am »

Never ever edited include/themes.inc.php, as per http://documentation.coppermine-gallery.net/en/theme.htm#theme_engine
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #6 on: May 10, 2010, 06:59:22 am »

If it's really the same (theme.inc.php = theme/theme.php) I'll try to figure it out with theme.php only, but as far as I remember theme.php changes didn't work (possible?).

Anyway, thanks for the advice Joachim.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: [url]Album name[/url] under lastalb thumb
« Reply #7 on: May 10, 2010, 07:56:54 am »

Imo EnlargeIt! should be adjusted to refer to the lastalb meta album instead of opening the album thumbnail.
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #8 on: May 10, 2010, 11:51:01 am »

Yes Αndré, that's why I post here. It should at least have an option to disable on index.php or meta or whatever.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [url]Album name[/url] under lastalb thumb
« Reply #9 on: May 10, 2010, 02:41:35 pm »

But that's not a matter of theming, but a matter of plugin design, isn't it? I'm not sure if Timo (the author of enlargeIt) is aware of this thread.

Joachim
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #10 on: May 10, 2010, 03:08:43 pm »

You're right Joachim. Plugin is very good, but I'd like to customize it a little bit.

Now I've found out that when I do:

$alb_name = $thumb['title'];
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $alb_name,

besides


                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $thumb['title'],

I get right album name only for lastalb panel, but random, lasthits etc shows {ALB_NAME} below thumb. Before that (second option) I got album name under lastalb thumb and empty space in others.

Now my question is: Could anyone point me how to ask DB for right album name? So I can do something like:

$query  = "SELECT from........
$alb_name = $query

                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $alb_name,

Maybe that will help to show proper album name. One more thing, If I choose for expample $thumb['filename'] besides $thumb['title'] everything works great ;/ ...wierd.

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: [url]Album name[/url] under lastalb thumb
« Reply #11 on: May 10, 2010, 03:26:39 pm »

I'm not sure if Timo (the author of enlargeIt) is aware of this thread.

I already posted in the EnlargeIt! thread:
Timo, please note that issue.
Logged

3git

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [url]Album name[/url] under lastalb thumb
« Reply #12 on: May 10, 2010, 03:55:54 pm »

It's not just enlargeIt issue, I just want this 'album name link' under lastalb thumb (done) and metas (lasthits, random etc). EnlargeIt just made me to work on this as far as it disables thumb link to thumbnails.php.

But still, any help welcome.
Logged
Pages: [1]   Go Up
 

Page created in 0.044 seconds with 20 queries.