Updated blocks to deal with no topic assignments HEAD
authorTom <websitemaster@cogeco.net>
Mon, 10 Oct 2011 14:01:15 -0400
branchHEAD
changeset 84428ca4f11166ba
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
     1.1 --- a/public_html/admin/block.php	Mon Oct 10 13:57:56 2011 -0400
     1.2 +++ b/public_html/admin/block.php	Mon Oct 10 14:01:15 2011 -0400
     1.3 @@ -102,6 +102,8 @@
     1.4      }
     1.5      if ($tid == TOPIC_ALL_OPTION || $tid == TOPIC_HOMEONLY_OPTION) {
     1.6          $access = 3;
     1.7 +    } elseif ($tid == '') { // No topic assigned, Can happen if topic gets deleted
     1.8 +        $access = 3;
     1.9      } else {
    1.10          $access = SEC_hasTopicAccess ($tid);
    1.11          for ($i = 1; $i < $nrows; $i++) {
    1.12 @@ -374,7 +376,7 @@
    1.13          $block_templates->set_var('selectedtopics_checked', 'checked');
    1.14      }
    1.15      $block_templates->set_var('topic_options',
    1.16 -                              COM_topicList ('tid,topic', $A['tid'], 1, true));
    1.17 +                              TOPIC_getListSelect($A['tid'], false));    
    1.18      $block_templates->set_var('lang_side', $LANG21[39]);
    1.19      $block_templates->set_var('lang_left', $LANG21[40]);
    1.20      $block_templates->set_var('lang_right', $LANG21[41]);
     2.1 --- a/system/lib-admin.php	Mon Oct 10 13:57:56 2011 -0400
     2.2 +++ b/system/lib-admin.php	Mon Oct 10 14:01:15 2011 -0400
     2.3 @@ -705,7 +705,9 @@
     2.4              } elseif ($A['tid'] == TOPIC_HOMEONLY_OPTION) {
     2.5                  $retval = $LANG21[43];    
     2.6              } else {
     2.7 -                if ($nrows > 1) {
     2.8 +                if ($nrows == 0) {
     2.9 +                    $retval = $LANG21[47]; // None
    2.10 +                } elseif ($nrows > 1) {
    2.11                      $retval = $LANG21[44]; // Multiple
    2.12                  } else {
    2.13                      $retval = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$A['tid']}'");