[geeklog-cvs] geeklog: Added Breadcrumb support for Topics and Articles.

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Jan 12 14:21:00 EST 2012


changeset 8473:37ebe4bfb2ac
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/37ebe4bfb2ac
user: Tom <websitemaster at cogeco.net>
date: Thu Jan 12 14:18:36 2012 -0500
description:
Added Breadcrumb support for Topics and Articles.
Fixed problem when viewing article page if article belong to multiple topics (it would revert to the default).
Fixed link of topic image in an article (it was missing the topic id).

diffstat:

 language/english.php                                                    |    3 +-
 language/english_utf-8.php                                              |    3 +-
 public_html/article.php                                                 |    4 +
 public_html/index.php                                                   |    5 +
 public_html/layout/professional/archivestorytext.thtml                  |    1 +
 public_html/layout/professional/breadcrumbs/breadcrumb.thtml            |    5 +
 public_html/layout/professional/breadcrumbs/breadcrumb_child.thtml      |    3 +
 public_html/layout/professional/breadcrumbs/breadcrumb_nolink.thtml     |    3 +
 public_html/layout/professional/breadcrumbs/breadcrumb_root.thtml       |    1 +
 public_html/layout/professional/breadcrumbs/breadcrumbs.thtml           |    5 +
 public_html/layout/professional/featuredstorytext.thtml                 |    1 +
 public_html/layout/professional/storytext.thtml                         |    1 +
 public_html/layout/professional_css/archivestorytext.thtml              |    1 +
 public_html/layout/professional_css/breadcrumbs/breadcrumb.thtml        |    5 +
 public_html/layout/professional_css/breadcrumbs/breadcrumb_child.thtml  |    3 +
 public_html/layout/professional_css/breadcrumbs/breadcrumb_nolink.thtml |    3 +
 public_html/layout/professional_css/breadcrumbs/breadcrumb_root.thtml   |    1 +
 public_html/layout/professional_css/breadcrumbs/breadcrumbs.thtml       |    5 +
 public_html/layout/professional_css/featuredstorytext.thtml             |    1 +
 public_html/layout/professional_css/storytext.thtml                     |    1 +
 public_html/lib-common.php                                              |    6 +-
 system/classes/story.class.php                                          |   27 +-
 system/lib-story.php                                                    |    7 +-
 system/lib-topic.php                                                    |  113 +++++++++-
 24 files changed, 191 insertions(+), 17 deletions(-)

diffs (truncated from 487 to 300 lines):

diff -r 0eb758df9891 -r 37ebe4bfb2ac language/english.php
--- a/language/english.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/language/english.php	Thu Jan 12 14:18:36 2012 -0500
@@ -902,7 +902,8 @@
     45 => 'Default',
     46 => 'Your parent topic cannot be the Archive topic. Please choose a different Parent Topic.',
     47 => 'An Archive Topic cannot have any child topics. Please remove any child topics before making a topic the Archive Topic.', 
-    48 => 'Parent Topic Id not found.'
+    48 => 'Parent Topic Id not found.', 
+    'breadcrumb_seperator' => '>'
 );
 
 ###############################################################################
diff -r 0eb758df9891 -r 37ebe4bfb2ac language/english_utf-8.php
--- a/language/english_utf-8.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/language/english_utf-8.php	Thu Jan 12 14:18:36 2012 -0500
@@ -902,7 +902,8 @@
     45 => 'Default',
     46 => 'Your parent topic cannot be the Archive topic. Please choose a different Parent Topic.',
     47 => 'An Archive Topic cannot have any child topics. Please remove any child topics before making a topic the Archive Topic.', 
-    48 => 'Parent Topic Id not found.'
+    48 => 'Parent Topic Id not found.',
+    'breadcrumb_seperator' => '>'
 );
 
 ###############################################################################
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/article.php
--- a/public_html/article.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/article.php	Thu Jan 12 14:18:36 2012 -0500
@@ -102,6 +102,10 @@
     echo COM_refresh ($_CONF['site_url'] . '/index.php');
     exit();
 }
+
+// Get topic
+TOPIC_getTopic('article', $sid);
+
 if ((strcasecmp ($order, 'ASC') != 0) && (strcasecmp ($order, 'DESC') != 0)) {
     $order = '';
 }
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/index.php
--- a/public_html/index.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/index.php	Thu Jan 12 14:18:36 2012 -0500
@@ -341,6 +341,11 @@
         $story->_featured = 1;
     }
 
+    // Display breadcrumb trail
+    if (!empty($topic)) {
+        $display .= TOPIC_breadcrumbs('topic', $topic);
+    }
+
     // display first article
     $display .= STORY_renderArticle ($story, 'y');
 
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/archivestorytext.thtml
--- a/public_html/layout/professional/archivestorytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional/archivestorytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -4,6 +4,7 @@
         {print_icon}
         {edit_icon}
     </span>
+    {breadcrumb_trail}
     <h1>{story_title_link}</h1>
     <div class="story-information">
         <p>{story_date}</p>
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/breadcrumbs/breadcrumb.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/breadcrumbs/breadcrumb.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,5 @@
+<a href="{url}" itemprop="url">
+    <span itemprop="title">{name}</span>
+</a> {separator}
+{breadcrumb_child}
+
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/breadcrumbs/breadcrumb_child.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/breadcrumbs/breadcrumb_child.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,3 @@
+<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
+    {breadcrumb}
+</span>
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/breadcrumbs/breadcrumb_nolink.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/breadcrumbs/breadcrumb_nolink.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,3 @@
+    <span itemprop="title">{name}</span> {separator}
+{breadcrumb_child}
+
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/breadcrumbs/breadcrumb_root.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/breadcrumbs/breadcrumb_root.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,1 @@
+{breadcrumb_root}
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/breadcrumbs/breadcrumbs.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/breadcrumbs/breadcrumbs.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,5 @@
+<!-- Start of Breadcrumbs Navigation -->
+<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
+    {breadcrumbs_list}
+</div>
+<!-- End of Breadcrumbs Navigation -->
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/featuredstorytext.thtml
--- a/public_html/layout/professional/featuredstorytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional/featuredstorytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -4,6 +4,7 @@
         {print_icon}
         {edit_icon}
     </span>
+    {breadcrumb_trail}
     <h1>{story_title_link}</h1>
     <div class="story-information">
         <p>{story_date}</p>
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional/storytext.thtml
--- a/public_html/layout/professional/storytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional/storytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -4,6 +4,7 @@
         {print_icon}
         {edit_icon}
     </span>
+    {breadcrumb_trail}
     <h1>{story_title_link}</h1>
     <div class="story-information">
         <p>{story_date}</p>
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/archivestorytext.thtml
--- a/public_html/layout/professional_css/archivestorytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional_css/archivestorytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -2,6 +2,7 @@
 <!-- archivestorytext.thtml { -->
 
 <div class="archivestorytext">
+  {breadcrumb_trail}
   <h2>{story_title_link}</h2>
 
   <ul class="icon">
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/breadcrumbs/breadcrumb.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/breadcrumbs/breadcrumb.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,5 @@
+<a href="{url}" itemprop="url">
+    <span itemprop="title">{name}</span>
+</a> {separator}
+{breadcrumb_child}
+
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/breadcrumbs/breadcrumb_child.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/breadcrumbs/breadcrumb_child.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,3 @@
+<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
+    {breadcrumb}
+</span>
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/breadcrumbs/breadcrumb_nolink.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/breadcrumbs/breadcrumb_nolink.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,3 @@
+    <span itemprop="title">{name}</span> {separator}
+{breadcrumb_child}
+
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/breadcrumbs/breadcrumb_root.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/breadcrumbs/breadcrumb_root.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,1 @@
+{breadcrumb_root}
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/breadcrumbs/breadcrumbs.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/breadcrumbs/breadcrumbs.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -0,0 +1,5 @@
+<!-- Start of Breadcrumbs Navigation -->
+<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
+    {breadcrumbs_list}
+</div>
+<!-- End of Breadcrumbs Navigation -->
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/featuredstorytext.thtml
--- a/public_html/layout/professional_css/featuredstorytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional_css/featuredstorytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -2,6 +2,7 @@
 <!-- featuredstorytext.thtml { -->
 
 <div class="featuredstorytext">
+  {breadcrumb_trail}
   <h2>{start_storylink_anchortag}{story_title}{end_storylink_anchortag}</h2>
 
   <ul class="icon">
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/layout/professional_css/storytext.thtml
--- a/public_html/layout/professional_css/storytext.thtml	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/layout/professional_css/storytext.thtml	Thu Jan 12 14:18:36 2012 -0500
@@ -2,6 +2,7 @@
 <!-- storytext.thtml { -->
 
 <div class="storytext">
+  {breadcrumb_trail}
   <h2>{start_storylink_anchortag}{story_title}{end_storylink_anchortag}</h2>
 
   <ul class="icon">
diff -r 0eb758df9891 -r 37ebe4bfb2ac public_html/lib-common.php
--- a/public_html/lib-common.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/public_html/lib-common.php	Thu Jan 12 14:18:36 2012 -0500
@@ -934,6 +934,8 @@
         $header->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
     }
 
+    /* *************************************************** */
+    /* Tom - Not sure if this is needed anymore since topic is now retrieved from article.php
     // get topic if not on home page
     if( !isset( $_GET['topic'] ))
     {
@@ -965,7 +967,7 @@
             $numrows = DB_numRows($result);
             if ($numrows == 1) {
                 $A = DB_fetchArray($result);
-                $topic = $A['tid'];
+                $topic = $A['tid']
             }
         }
     }
@@ -973,6 +975,8 @@
     {
         $topic = COM_applyFilter( $_GET['topic'] );
     }
+    */
+    /* *************************************************** */
 
     $feed_url = array();
     if( $_CONF['backend'] == 1 ) // add feed-link to header if applicable
diff -r 0eb758df9891 -r 37ebe4bfb2ac system/classes/story.class.php
--- a/system/classes/story.class.php	Thu Jan 05 20:32:19 2012 -0500
+++ b/system/classes/story.class.php	Thu Jan 12 14:18:36 2012 -0500
@@ -115,7 +115,6 @@
     var $_postmode;
     var $_uid;
     var $_draft_flag;
-    //var $_tid;
     var $_date;
     var $_hits;
     var $_numemails;
@@ -143,6 +142,7 @@
     var $_fullname;
     var $_photo;
     var $_email;
+    var $_tid;
     var $_topic;
     var $_imageurl;
 
@@ -178,7 +178,6 @@
            'sid' => 1,
            'uid' => 1,
            'draft_flag' => 1,
-           //'tid' => 1,
            'date' => 1,
            'title' => 1,
            'page_title' => 1, 
@@ -208,6 +207,7 @@
            'perm_members' => 1,
            'perm_anon' => 1,
            'imageurl' => 0,
+           'tid' => 0,
            'topic' => 0,
            'access' => 0,
            'photo' => 0,
@@ -436,25 +436,31 @@
      */
     function loadFromDatabase($sid, $mode = 'edit')
     {
-        global $_TABLES, $_CONF, $_USER;
+        global $_TABLES, $_CONF, $_USER, $topic;
 
         $sid = addslashes(COM_applyFilter($sid));
 
         if (!empty($sid) && (($mode == 'edit') || ($mode == 'view') || ($mode == 'clone'))) {
+            if (empty($topic)) {
+                $topic_sql = ' AND ta.tdefault = 1';
+            } else {
+                $topic_sql = " AND ta.tid = '{$topic}'";
+            }
+            
             $sql = array();
             /* Original
             $sql['mysql'] = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, "
                 . "u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t " . "WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND (sid = '$sid')";
             */
-            $sql['mysql'] = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl 
+            $sql['mysql'] = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.tid, t.topic, t.imageurl 
                 FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta 
-                WHERE ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (sid = '$sid')";
+                WHERE ta.type = 'article' AND ta.id = sid {$topic_sql} AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (sid = '$sid')";
 
-            $sql['mssql'] = "SELECT STRAIGHT_JOIN s.sid, s.uid, s.draft_flag, s.tid, s.date, s.title, CAST(s.introtext AS text) AS introtext, CAST(s.bodytext AS text) AS bodytext, s.hits, s.numemails, s.comments, s.trackbacks, s.related, s.featured, s.show_topic_icon, s.commentcode, s.trackbackcode, s.statuscode, s.expire, s.postmode, s.frontpage, s.owner_id, s.group_id, s.perm_owner, s.perm_group, s.perm_members, s.perm_anon, s.advanced_editor_mode, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl 
+            $sql['mssql'] = "SELECT STRAIGHT_JOIN s.sid, s.uid, s.draft_flag, s.tid, s.date, s.title, CAST(s.introtext AS text) AS introtext, CAST(s.bodytext AS text) AS bodytext, s.hits, s.numemails, s.comments, s.trackbacks, s.related, s.featured, s.show_topic_icon, s.commentcode, s.trackbackcode, s.statuscode, s.expire, s.postmode, s.frontpage, s.owner_id, s.group_id, s.perm_owner, s.perm_group, s.perm_members, s.perm_anon, s.advanced_editor_mode, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.tid, t.topic, t.imageurl 
                 FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta 
                 WHERE ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (sid = '$sid')";
             
-            $sql['pgsql'] = "SELECT s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) as expireunix, UNIX_TIMESTAMP(s.comment_expire) as cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl 
+            $sql['pgsql'] = "SELECT s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) as expireunix, UNIX_TIMESTAMP(s.comment_expire) as cmt_expire_unix, u.username, u.fullname, u.photo, u.email, t.tid, t.topic, t.imageurl 
                 FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta 
                 WHERE ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 AND (s.uid = u.uid) AND (ta.tid = t.tid) AND (sid = '$sid')";
         } elseif (!empty($sid) && ($mode == 'editsubmission')) {
@@ -466,14 +472,14 @@
             $sql['pgsql'] = 'SELECT  s.*, UNIX_TIMESTAMP(s.date) AS unixdate, '
                 . 'u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, ' . 't.perm_owner, t.perm_group, t.perm_members, t.perm_anon ' . 'FROM ' . $_TABLES['storysubmission'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topics'] . ' AS t WHERE (s.uid = u.uid) AND' . ' (s.tid = t.tid) AND (sid = \'' . $sid . '\')';



More information about the geeklog-cvs mailing list