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: ADD "add to favorites" on thumbnail view  (Read 10544 times)

0 Members and 1 Guest are viewing this topic.

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
ADD "add to favorites" on thumbnail view
« on: December 16, 2004, 10:15:54 am »

How can I include the "add to favorites" information on the thumbnail view page (and also on the My Favorites display page)? I have modified my English theme file to change the default text to a button with/without a checkbox (looks nice). I'd like to have this show up under the thumbnails view as well so that people can easily add several photos at once from a gallery to their favorites. Thanks!
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: ADD "add to favorites" on thumbnail view
« Reply #1 on: December 16, 2004, 12:33:38 pm »

Nice one, had not thougt of this myself.

Would indeed speed up adding favourite pictures to MyFavourites if one were able to select the pictures from the thumbnail page.

No clue how to code this but maybe one of the more skilled coders could do his/her magic to this. Imho many galleries can benefit from
a hack or mod to give that option to visitors.
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #2 on: December 17, 2004, 03:05:57 am »

I'm glad you agree. I also have a hack that I'd like to post that allows for the sorting of favorites and then a special Emailing of the thumbnails (modified E-Card). I use it like a shopping cart of sorts for images. I'll try to find where I need to post them and make it happen.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: ADD "add to favorites" on thumbnail view
« Reply #3 on: December 19, 2004, 06:35:10 am »

post your modification in the support board that matches your coppermine version, a moderator will move it to the mods/hacks section if applicable.

Joachim
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: ADD "add to favorites" on thumbnail view
« Reply #4 on: December 23, 2004, 06:40:37 am »

I posted a modification to add the "add to favorites" link to the img_nav_bar, adding it elsewhere would be similar.

http://forum.coppermine-gallery.net/index.php?topic=12854.msg58480#msg58480
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #5 on: January 24, 2005, 05:15:08 pm »

I just tried implementing this today and I'm not really sure where I should add the code referenced. Specifically, I can't figure out where to add

Code: [Select]
                <td align="center" valign="middle" class="navmenu" width="48">
                        {FAVORITE}
                </td>

...

I'm thinking it needs to go somewhere in here?

Code: [Select]
// HTML template for thumbnails display
$template_thumbnail_view = <<<EOT

<!-- BEGIN header -->
        <tr>
<!-- END header -->
<!-- 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}
{FIL_SET_ORDER}
                                        {ADMIN_MENU}
{FAVORITE}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->
<!-- BEGIN empty_cell -->
                <td valign="top" class="thumbnails" align="center">&nbsp;</td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>
        <tr>
<!-- END row_separator -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                        {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="17" /><br />
<!-- END spacer -->

EOT;

did I add it in the right spot?
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #6 on: January 24, 2005, 05:28:46 pm »

OK, all that did was add {FAVORITE} under my thumbnails. It's a start.

I suspect I need to add something like into thumbnails.php or another file?

Code: [Select]
    // Create the add to fav link
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>';
    }

Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: ADD "add to favorites" on thumbnail view
« Reply #7 on: January 25, 2005, 04:37:53 am »

I did this with classic, your theme may differ slightly.

thumbnails.php; find:
Code: [Select]
define('INDEX_PHP', true);

Add after it:
Code: [Select]
define('DISPLAYIMAGE_PHP', true);     // Favorite MOD (you need access to $lang_picinfo)

include/functions.inc.php; function display_thumbnails; find:
Code: [Select]
                       $thumb_list[$i]['aid'] = $row['aid'];

add after it:
Code: [Select]
                       $thumb_list[$i]['pid'] = $row['pid'];

theme.php; $template_thumbnail_view; find:
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 -->

replace with:
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}
                                        {FAVORITE}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->

theme.php; function theme_display_thumbnails; find:
Code: [Select]
   global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view;

add after it:
Code: [Select]
   global $lang_picinfo, $FAVPICS;  // Favorite MOD

theme.php; function theme_display_thumbnails; find:
Code: [Select]
   foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {

replace it with:
Code: [Select]
   foreach($thumb_list as $thumb) {
        $i++;
        // Favorite MOD
        if (!in_array($thumb['pid'], $FAVPICS)) {
            $favorite = "<a href=\"addfav.php?pid=" . $thumb['pid'] . "\">" . $lang_picinfo['addFav'] . '</a>';
        } else {
            $favorite = "<a href=\"addfav.php?pid=" . $thumb['pid'] . "\">" . $lang_picinfo['remFav'] . '</a>';
        }
        // Favorite MOD
        if ($mode == 'thumb') {

theme.php; function theme_display_thumbnails; find:
Code: [Select]
       if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $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 {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        }

replace it with:
Code: [Select]
       if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{FAVORITE}' => $favorite,       // Favorite MOD
                    );
            } else {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{FAVORITE}' => $favorite,       // Favorite MOD
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => '',
                '{FAVORITE}' => $favorite,       // Favorite MOD
                );
        }

Hope that helps.

FYI (Radio buttons wont work here, this does one image at a time.)

I think you could do a form by placing it in the header and footers of $template_thumbnail_view
but then your going to have to work passing that info and parsing it with addfav.php.

You could also probably manipulate referrer with addfav to send you back to the same album.

Thats currently a little larger project than I want to take on for 1.3x.

If you love this functionality perhaps some folks can put it in a feature request, perhaps I'd do it for a future version if there were enough interest.
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #8 on: January 25, 2005, 04:46:28 am »

Thank you for the speedy reply. I'll have to wait until the AM to test it, but as soon as I do I'll post my results. Your help is greatly appreciated.
Logged

ScenicNH

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: ADD "add to favorites" on thumbnail view
« Reply #9 on: March 08, 2005, 02:11:50 pm »

Will this code work in 1.3x. or just classic? To add "add to favorites" under the thumbnail view
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: ADD "add to favorites" on thumbnail view
« Reply #10 on: March 08, 2005, 02:54:36 pm »

"1.3.x" is the coppermine version, "classic" is the theme used. Those terms are not antonyms nor synonyms. If you drive a "Ford Escort" in red, a question like "do these tires fit on an escort or a red car?" simply doesn't apply.

As donnoman suggested: the code he mentioned will work with slight customizations for any theme. As favorites didn't exist in older versions than cpg1.3.0 and there's no support yet for cpg1.4.x, your question on the coppermine version simply doesn't apply.

Joachim
Logged

ScenicNH

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: ADD "add to favorites" on thumbnail view
« Reply #11 on: March 09, 2005, 01:01:10 pm »


I am very sorry for the stupid question........ I thought "Classic" was a older verison of Coppermine. I guess if I was a project manager of coppermine  I would know this.
Kinda like did you see that classic red escort driving down the road. The classic escort would be any older version on the escort.
A simple mistake on my part......Very Sorry.........

http://forum.coppermine-gallery.net/index.php?topic=15569.msg72491#msg72491
ScenicNH
Logged

d1zz13

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • My Gallery
Re: ADD "add to favorites" on thumbnail view
« Reply #12 on: March 09, 2005, 01:53:30 pm »

Don't really have much to say on this topic, I think that "add to favorites" option from the thumbnail page is superb.

I just wanted to say that I love the comparisons being used  :D

Quote
I thought "Classic" was a older verison of Coppermine. I guess if I was a project manager of coppermine  I would know this.
Kinda like did you see that classic red escort driving down the road. The classic escort would be any older version on the escort.
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #13 on: March 17, 2005, 03:03:11 am »

Yes, this simple mod can really open doors with creative programmers for turning coppermine into a makeshift shopping cart, even though I think there is a mod specifically for this already.
Logged

JoeBen

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: ADD "add to favorites" on thumbnail view
« Reply #14 on: April 09, 2005, 10:58:58 am »

Hi donnoman  -  Thank you very much for posting a solution to this.  It works awesome.  I am a newbie and am wondering how I can make it so that when a user clicks on add to favorites in the thumbnail view the view stays in the thumbnail view instead of switching to the display image view.  I think I have to change this line but I do not know what to change it to.

$location = "displayimage.php?pos=" . (- $pic);

Thank you very much,

JoeBen
Logged

JoeBen

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: ADD "add to favorites" on thumbnail view
« Reply #15 on: April 09, 2005, 11:04:44 am »

Two more things I forgot to mention:

1.  You can go to my site at www.vientodelmar.com to see what I am talking about.  If you are in a thumbnail view and you click on add to download queue it will take you to the detail view for that image.  I would like it to stay in the thumbnail view.

2.  I think I need to change the following line in addfav.php but I am not sure if that is right or how to change it.

$location = "displayimage.php?pos=" . (- $pic);

Thank you!
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #16 on: April 25, 2005, 05:39:58 pm »

Code: [Select]
$location = "thumbnails.php?album=" . (- $album);
I changed it to this, but I'm not getting the album variable passed. Can somebody assist?
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #17 on: April 25, 2005, 06:12:07 pm »

theme.php

Code: [Select]
        // Favorite MOD
        if (!in_array($thumb['pid'], $FAVPICS)) {
            $favorite = "<a href=\"addfav.php?pid=" . $thumb['pid'] . ";album=" . $thumb['aid'] . "\">" . $lang_picinfo['addFav'] . '</a>';
        } else {
            $favorite = "<a href=\"addfav.php?pid=" . $thumb['pid'] . ";album=" . $thumb['aid'] . "\">" . $lang_picinfo['remFav'] . '</a>';
        }

Would I need to change this modification to include the passing of the $album variable? Then I can refer to it in the addfav.php file as I indicated above.
« Last Edit: April 25, 2005, 06:17:46 pm by radianation »
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: ADD "add to favorites" on thumbnail view
« Reply #18 on: April 25, 2005, 06:18:28 pm »

then you need to add this to your addfav.php

$album = (int)$HTTP_GET_VARS['aid'];
Logged
Pages: [1]   Go Up
 

Page created in 0.036 seconds with 20 queries.