[geeklog-cvs] geeklog: Category Editor now uses Topic library function for dis...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Jan 5 20:32:47 EST 2012


changeset 8472:0eb758df9891
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/0eb758df9891
user: Tom <websitemaster at cogeco.net>
date: Thu Jan 05 20:32:19 2012 -0500
description:
Category Editor now uses Topic library function for displaying topics.
Updated phpblock_topic_categories and phpblock_topic_links functions to display block when all topics is selected.

diffstat:

 plugins/links/autoinstall.php                      |   2 +-
 plugins/links/functions.inc                        |  53 ++++++++++++---------
 plugins/links/templates/admin/categoryeditor.thtml |   2 +-
 public_html/admin/plugins/links/category.php       |   6 ++-
 4 files changed, 38 insertions(+), 25 deletions(-)

diffs (118 lines):

diff -r ce6057508f9a -r 0eb758df9891 plugins/links/autoinstall.php
--- a/plugins/links/autoinstall.php	Thu Jan 05 12:20:27 2012 -0500
+++ b/plugins/links/autoinstall.php	Thu Jan 05 20:32:19 2012 -0500
@@ -52,7 +52,7 @@
         'pi_name'         => $pi_name,
         'pi_display_name' => $pi_display_name,
         'pi_version'      => '2.1.2',
-        'pi_gl_version'   => '1.8.0',
+        'pi_gl_version'   => '1.9.0',
         'pi_homepage'     => 'http://www.geeklog.net/'
     );
 
diff -r ce6057508f9a -r 0eb758df9891 plugins/links/functions.inc
--- a/plugins/links/functions.inc	Thu Jan 05 12:20:27 2012 -0500
+++ b/plugins/links/functions.inc	Thu Jan 05 20:32:19 2012 -0500
@@ -1519,18 +1519,22 @@
 
     if (!empty($topic)) {
         $tid = addslashes($topic);
-        $result = DB_query("SELECT l.lid, l.title, l.url, c.cid FROM {$_TABLES['links']} AS l LEFT JOIN {$_TABLES['linkcategories']} AS c ON l.cid=c.cid WHERE c.tid='{$tid}' OR c.tid='all'" . COM_getPermSQL('AND', 0, 2, 'c'));
-        $nrows = DB_numRows($result);
-        if ($nrows > 0) {
-            for ($i = 0; $i < $nrows; $i++) {
-                $A = DB_fetchArray($result);
-                $content = stripslashes($A['title']);
-                $url = COM_buildUrl($_CONF['site_url']
-                     . '/links/portal.php?what=link&item=' . $A['lid']);
-                $retval .= COM_createLink($content, $url,
-                                          array('title' => $A['url']))
-                        . '<br' . XHTML . '>';
-            }
+        $topic_sql = "(c.tid='{$tid}' OR c.tid='" . TOPIC_ALL_OPTION . "') ";
+    } else {
+        $topic_sql = "(c.tid='" . TOPIC_ALL_OPTION . "') ";
+    }        
+        
+    $result = DB_query("SELECT l.lid, l.title, l.url, c.cid FROM {$_TABLES['links']} AS l LEFT JOIN {$_TABLES['linkcategories']} AS c ON l.cid=c.cid WHERE " . $topic_sql . COM_getPermSQL('AND', 0, 2, 'c'));
+    $nrows = DB_numRows($result);
+    if ($nrows > 0) {
+        for ($i = 0; $i < $nrows; $i++) {
+            $A = DB_fetchArray($result);
+            $content = stripslashes($A['title']);
+            $url = COM_buildUrl($_CONF['site_url']
+                 . '/links/portal.php?what=link&item=' . $A['lid']);
+            $retval .= COM_createLink($content, $url,
+                                      array('title' => $A['url']))
+                    . '<br' . XHTML . '>';
         }
     }
 
@@ -1551,16 +1555,21 @@
 
     if (!empty($topic)) {
         $tid = addslashes($topic);
-        $result = DB_query("SELECT category, cid FROM {$_TABLES['linkcategories']} WHERE tid='{$tid}' OR tid='all'" . COM_getPermSQL ('AND'));
-        $nrows = DB_numRows($result);
-        if ($nrows > 0) {
-            for ($i = 0; $i < $nrows; $i++) {
-                $A = DB_fetchArray($result);
-                $content = stripslashes($A['category']);
-                $url = $_CONF['site_url'] . '/links/index.php?category='
-                                          . rawurlencode($A['cid']);
-                $retval .= COM_createLink($content, $url) . '<br' . XHTML . '>';
-            }
+        $topic_sql = "(tid='{$tid}' OR tid='" . TOPIC_ALL_OPTION . "') ";
+    } else {
+        $topic_sql = "(tid='" . TOPIC_ALL_OPTION . "') ";
+    } 
+    
+
+    $result = DB_query("SELECT category, cid FROM {$_TABLES['linkcategories']} WHERE " . $topic_sql . COM_getPermSQL ('AND'));
+    $nrows = DB_numRows($result);
+    if ($nrows > 0) {
+        for ($i = 0; $i < $nrows; $i++) {
+            $A = DB_fetchArray($result);
+            $content = stripslashes($A['category']);
+            $url = $_CONF['site_url'] . '/links/index.php?category='
+                                      . rawurlencode($A['cid']);
+            $retval .= COM_createLink($content, $url) . '<br' . XHTML . '>';
         }
     }
 
diff -r ce6057508f9a -r 0eb758df9891 plugins/links/templates/admin/categoryeditor.thtml
--- a/plugins/links/templates/admin/categoryeditor.thtml	Thu Jan 05 12:20:27 2012 -0500
+++ b/plugins/links/templates/admin/categoryeditor.thtml	Thu Jan 05 20:32:19 2012 -0500
@@ -20,7 +20,7 @@
             </tr>
             <tr>
                 <td align="right" style="white-space:nowrap;">{lang_topic}:</td>
-                <td>{topic_selection}<td>
+                <td><select name="tid">{topic_selection}</select><td>
             </tr>
             <tr>
                 <td align="right" style="white-space:nowrap;">{lang_num_links}:</td>
diff -r ce6057508f9a -r 0eb758df9891 public_html/admin/plugins/links/category.php
--- a/public_html/admin/plugins/links/category.php	Thu Jan 05 12:20:27 2012 -0500
+++ b/public_html/admin/plugins/links/category.php	Thu Jan 05 20:32:19 2012 -0500
@@ -261,8 +261,9 @@
     }
 
     if (!isset($A['tid'])) {
-        $A['tid'] = 'all';
+        $A['tid'] = TOPIC_ALL_OPTION;
     }
+    /*
     $topics = COM_topicList('tid,topic', $A['tid'], 1, true);
     $T->set_var('topic_list', $topics);
     $alltopics = '<option value="all"';
@@ -272,6 +273,9 @@
     $alltopics .= '>' . $LANG_LINKS_ADMIN[35] . '</option>' . LB;
     $T->set_var('topic_selection', '<select name="tid">' . $alltopics
                                    . $topics . '</select>');
+    */
+    $T->set_var('topic_selection', TOPIC_getTopicListSelect($A['tid'], 2, true));        
+    
 
     if (empty($cid)) {
         $num_links = $LANG_ADMIN['na'];



More information about the geeklog-cvs mailing list