[geeklog-hg] geeklog: Default topic is now used by topic control (bug #0001448)

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Jun 1 11:37:09 EDT 2012


changeset 8710:857366d594c3
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/857366d594c3
user: Tom <websitemaster at cogeco.net>
date: Fri Jun 01 11:14:06 2012 -0400
description:
Default topic is now used by topic control (bug #0001448)

diffstat:

 public_html/admin/plugins/staticpages/index.php |  14 ++++++++++----
 public_html/admin/story.php                     |  22 ----------------------
 system/lib-topic.php                            |  10 +++++++---
 3 files changed, 17 insertions(+), 29 deletions(-)

diffs (99 lines):

diff -r e6000e0b6561 -r 857366d594c3 public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Wed May 30 21:40:53 2012 +0200
+++ b/public_html/admin/plugins/staticpages/index.php	Fri Jun 01 11:14:06 2012 -0400
@@ -59,11 +59,11 @@
 /**
 * Displays the static page editor form
 *
-* @param    array   $A  Data to display
-* @return   string      HTML for the static page editor
+* @param    array   $A      Data to display
+* @return   string          HTML for the static page editor
 *
 */
-function staticpageeditor_form($A, $error = false)
+function staticpageeditor_form($A)
 {
     global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id,
            $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG01, $LANG24,
@@ -349,8 +349,14 @@
     
     $sp_template->set_var('lang_topic', $LANG_STATIC['topic']);
     if ($mode != 'clone') {
+        // want to use default topic selection if new staticpage so pass in blank id
+        $topic_sp_id = $A['sp_id'];
+        if (empty($sp_id) && $mode=='edit') { // means new
+            $topic_sp_id = '';    
+        }
+
         $sp_template->set_var('topic_selection',
-                              TOPIC_getTopicSelectionControl ('staticpages', $A['sp_id'], true, false, true));
+                              TOPIC_getTopicSelectionControl ('staticpages',  $topic_sp_id, true, false, true));
     } else {
         $sp_template->set_var('topic_selection',
                               TOPIC_getTopicSelectionControl ('staticpages', $A['clone_sp_id'], true, false, true));
diff -r e6000e0b6561 -r 857366d594c3 public_html/admin/story.php
--- a/public_html/admin/story.php	Wed May 30 21:40:53 2012 +0200
+++ b/public_html/admin/story.php	Fri Jun 01 11:14:06 2012 -0400
@@ -559,21 +559,6 @@
     }
     $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
     
-    
-    
-    
-    
-    
-    
-    /* Tom
-    if(empty($currenttopic) && ($story->EditElements('tid') == '')) {
-        $story->setTid(DB_getItem($_TABLES['topics'], 'tid',
-                                  'is_default = 1' . COM_getPermSQL('AND')));
-    } elseif ($story->EditElements('tid') == '') {
-        $story->setTid($currenttopic);
-    }
-    */
-    
     if ($mode == 'preview') {
         $tlist = TOPIC_getTopicSelectionControl('article', '', false, true, true);
     } else {        
@@ -585,13 +570,6 @@
         return $display;
     }
     $story_templates->set_var('topic_selection', $tlist);
-    
-    
-    
-    
-    
-    
-    
 
     $story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
     if ($story->EditElements('show_topic_icon') == 1) {
diff -r e6000e0b6561 -r 857366d594c3 system/lib-topic.php
--- a/system/lib-topic.php	Wed May 30 21:40:53 2012 +0200
+++ b/system/lib-topic.php	Fri Jun 01 11:14:06 2012 -0400
@@ -836,15 +836,19 @@
     
     // Do they have any access to topics first?
     
-    
     // Retrieve Topic options
     $from_db = true;
     if (empty($type) || empty($id)) {
-        $from_db = false;
+        $from_db = false; 
     }
     if (!$from_db) {    
         TOPIC_getDataTopicSelectionControl($topic_option, $tids, $inherit_tids, $default_tid);
-    } else {        
+        
+        // Figure out if we need to set the default topic for the list
+        if ($topic_option == TOPIC_SELECTED_OPTION AND empty($tids)) {
+            $tids = (DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND')));
+        }
+    } else {    
         $sql = "SELECT * FROM {$_TABLES['topic_assignments']} WHERE type = '$type' AND id ='$id'";
     
         $result = DB_query($sql);



More information about the geeklog-cvs mailing list