Updated blocks to deal with no topic assignments HEAD
authorTom <websitemaster@cogeco.net>
Mon, 10 Oct 2011 14:01:15 -0400
branchHEAD
changeset 8442 8ca4f11166ba
parent 8441 7ea02c9ca0d2
child 8443 d70f6f00f78b
Updated blocks to deal with no topic assignments Admin Block editor now uses topic list that displays parents
public_html/admin/block.php
system/lib-admin.php
--- a/public_html/admin/block.php	Mon Oct 10 13:57:56 2011 -0400
+++ b/public_html/admin/block.php	Mon Oct 10 14:01:15 2011 -0400
@@ -102,6 +102,8 @@
     }
     if ($tid == TOPIC_ALL_OPTION || $tid == TOPIC_HOMEONLY_OPTION) {
         $access = 3;
+    } elseif ($tid == '') { // No topic assigned, Can happen if topic gets deleted
+        $access = 3;
     } else {
         $access = SEC_hasTopicAccess ($tid);
         for ($i = 1; $i < $nrows; $i++) {
@@ -374,7 +376,7 @@
         $block_templates->set_var('selectedtopics_checked', 'checked');
     }
     $block_templates->set_var('topic_options',
-                              COM_topicList ('tid,topic', $A['tid'], 1, true));
+                              TOPIC_getListSelect($A['tid'], false));    
     $block_templates->set_var('lang_side', $LANG21[39]);
     $block_templates->set_var('lang_left', $LANG21[40]);
     $block_templates->set_var('lang_right', $LANG21[41]);
--- a/system/lib-admin.php	Mon Oct 10 13:57:56 2011 -0400
+++ b/system/lib-admin.php	Mon Oct 10 14:01:15 2011 -0400
@@ -705,7 +705,9 @@
             } elseif ($A['tid'] == TOPIC_HOMEONLY_OPTION) {
                 $retval = $LANG21[43];    
             } else {
-                if ($nrows > 1) {
+                if ($nrows == 0) {
+                    $retval = $LANG21[47]; // None
+                } elseif ($nrows > 1) {
                     $retval = $LANG21[44]; // Multiple
                 } else {
                     $retval = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$A['tid']}'");