Advanced search  

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

Pages: [1]   Go Down

Author Topic: [Done]: Enhanced Breadcrumbs in Meta Albums  (Read 12810 times)

0 Members and 1 Guest are viewing this topic.

jesusarmy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 34
[Done]: Enhanced Breadcrumbs in Meta Albums
« on: January 10, 2008, 05:37:30 pm »

Breadcrumbs in CPG's meta-albums (last additions, last comments, most viewed, search etc) can be misleading in image display mode. The breadcrumb trail displayed is the normal route to the picture, not the one via the meta album, while the navigation buttons (thumbnail view, next, previous) and title bar use the meta album.

These changes correct that behaviour to the one that I feel is more intuitive, so that the breadcrumb trail shares the same behaviour as the navigation buttons and title bar.

See below for the code
« Last Edit: December 15, 2008, 05:40:35 am by Paver »
Logged

jesusarmy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 34
Re: Enhanced Breadcrumbs in Meta Albums
« Reply #1 on: January 10, 2008, 05:56:22 pm »

Breadcrumbs in CPG's meta-albums (last additions, last comments, most viewed, search etc) can be misleading in image display mode. The breadcrumb trail displayed is the normal route to the picture, not the one via the meta album, while the navigation buttons (thumbnail view, next, previous) and title bar use the meta album.

These changes correct that behaviour to the one that I feel is more intuitive, so that the breadcrumb trail shares the same behaviour as the navigation buttons and title bar.

In include/functions.inc.php, find:

Code: [Select]
function breadcrumb($cat, &$breadcrumb, &$BREADCRUMB_TEXT)
{
        global $album, $lang_errors, $lang_list_categories;
and change to:
Code: [Select]
function breadcrumb($cat, &$breadcrumb, &$BREADCRUMB_TEXT)
{
        global $album, $lang_errors, $lang_list_categories,$lang_meta_album_names;

a line or two later, after:
Code: [Select]
          global $CONFIG,$CURRENT_ALBUM_DATA, $CURRENT_CAT_NAME;
add
Code: [Select]
         if ($_GET['uid'] != 0) {
           $user_name = get_username($_GET['uid']);
           if (!$user_name) $user_name = 'Mr. X';
           $lang_meta_album_names['lastupby'] = $lang_meta_album_names['lastup']." (" . $user_name . ")";
           $lang_meta_album_names['lastcomby'] = $lang_meta_album_names['lastcom']." (" . $user_name . ")";
          }

then find a few lines lower down:

Code: [Select]
        foreach ($category_array as $category)
        {
            $breadcrumb_links[$cat_order] = "<a href=\"index.php?cat={$category[0]}\">{$category[1]}</a>";
            $BREADCRUMB_TEXTS[$cat_order] = $category[1];
            $cat_order += 1;
        }

        //Add Link for album if aid is set
        if (isset($CURRENT_ALBUM_DATA['aid']))
        {
            $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
            $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
        }

and change to:

Code: [Select]
        foreach ($category_array as $category)
        {
            $breadcrumb_links[$cat_order] = "<a href=\"index.php?cat={$category[0]}\">{$category[1]}</a>";
            $BREADCRUMB_TEXTS[$cat_order] = $category[1];
            $cat_order += 1;
            $cat_link = $category[0];
        }

        //Add Link for album if aid is set
        if (isset($CURRENT_ALBUM_DATA['aid']))
        {
            $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
            $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
            $cat_link = -$CURRENT_ALBUM_DATA['aid'];
        }

        //Add Meta album link
        if (isset($album) && !is_numeric($album)) {
          if (isset($_GET['cat']) && $_GET['cat'] < 0) $cat_order += 1; //Does meta album link overwrite album?
          $set_uid = isset($_GET['uid']) ? "&amp;uid=".$_GET['uid'] : '';
          if ($cat != 0) {
            $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$album."&cat={$cat_link}".$set_uid."\">".$lang_meta_album_names[$album]."</a>";
          } else {
            $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$album.$set_uid."\">".$lang_meta_album_names[$album]."</a>";
          }
          $BREADCRUMB_TEXTS[$cat_order] = $lang_meta_album_names[$album];
        }

In thumbnails.php

find:
Code: [Select]
} elseif (isset($cat) && $cat) { // Meta albums, we need to restrict the albums to the current category
change to:
Code: [Select]
} elseif (isset($cat) && $cat && $album !="lastupby" && $album != "lastcomby") { // Meta albums, we need to restrict the albums to the current category
// except lastupby and lastcomby as CPG currently restricts these to the user's albums

In displayimage.php, find:
Code: [Select]
$album = isset($_GET['album']) ? $_GET['album'] : '';after add:
Code: [Select]
$cat = isset($_GET['uid']) && ($album == "lastupby" || $album == "lastcomby") ? 0 : $cat;
// Lastupby and lastcomby meta albums need category restriction removed as CPG currently restricts to the user's albums

and find:
Code: [Select]
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
    }
and change to:
Code: [Select]
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        if ($cat < 0) {
          breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);//breadcrumbs for meta albums in categories
        } else {
          breadcrumb($cat, $breadcrumb, $breadcrumb_text);//breadcrumbs for meta albums in albums
      }
    }


I'm sure this could be improved but I hope someone else finds this useful. :-)

« Last Edit: January 11, 2008, 06:21:28 pm by jesusarmy »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Enhanced Breadcrumbs in Meta Albums
« Reply #2 on: January 11, 2008, 07:49:52 am »

Thanks for sharing. Moving to bugs board to make sure this suggestion is not going to be forgotten.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Enhanced Breadcrumbs in Meta Albums
« Reply #3 on: December 15, 2008, 05:39:41 am »

Nice work.  Committed to 1.5. 

This is not really a bug but a poorly-designed feature of 1.4, so maybe this thread should be moved to "Feature Requests" and marked "Done" for future reference?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Done]: Enhanced Breadcrumbs in Meta Albums
« Reply #4 on: December 15, 2008, 06:53:37 am »

Did as you suggested.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.