Topic Support

From GeeklogWiki
Revision as of 14:23, 5 February 2012 by Tom (talk | contribs)

Jump to: navigation, search

Introduction

This is a Draft

As of version 1.9.0, Geeklog now allows topics to have 1 or more child topics, blocks assigned to multiple topics, and articles assigned to multiple topics. Blocks and articles can also be inherited by the parent topic when viewed if it setup to do so. This is all done while still supporting multiple languages.

The different Topic modes (better word?) of Geeklog

Homepage All Topic (specific)

Now some objects can belong to more than one topic.

define("TOPIC_ALL_OPTION", 'all'); define("TOPIC_NONE_OPTION", 'none'); define("TOPIC_HOMEONLY_OPTION", 'homeonly'); define("TOPIC_SELECTED_OPTION", 'selectedtopics'); define("TOPIC_ROOT", 'root');

$_TOPICS Array

Notes:

Tracking of Last Topic by Session DB Variable Anonymous users are now tracked like logged in users. The session changes include the ability to track anonymous users, and the who's online block now uses a column in the session table to track online versus offline users.


Topic Assignments table

Topics Inherited Hidden

Archive Topic:

- You are allowed only one. This is the same as before but at some point we may want to change this since it doesn't work well with a multi language Geeklog install (I would assume most admins would want an archive topic per language unless there was a reason this was not added?). - Cannot be hidden - Cannot have Child Topics - Cannot be inherited - Stories that are archived can only belong to this topic and no other


Blocks Blocks can now be inherited from child topics. Remember Blocks being inherited is affected by several things including security, the language of the block, the inherited flag set for that topic assignment for the block, and if the topics themselves allow objects to be inherited.

Topic Assignment Control I have also worked out a topic selection control that is used by blocks and will be used by stories and plugins. Here are the most common functions that most plugin author will use.


Show control in edit form by assigning the retval of this function to a template variable. TOPIC_getTopicSelectionControl($type, $id, $show_options = false, $show_inherit = false, $show_default = false)

Check topic control to see if any values are selected (for saves) TOPIC_checkTopicSelectionControl()

Check if User has access to the topics selected TOPIC_hasMultiTopicAccess('topic') == 3

There is the odd time that a plugin may need to know what topics have been selected when saving. This shouldn't happen to often but if need be you can find out by using the following function to retrieve Topic data. Before running this function you should validate the data with the above functions first. TOPIC_getDataTopicSelectionControl($topic_option, $tids, $inherit_tids, $default_tid);

Save the data in the topic control to the topic assignments table TOPIC_saveTopicSelectionControl('staticpages', $sp_id);

TOPIC_deleteTopicAssignments('staticpages', $sp_id);



BreadCrumbs breadcrumbs are enabled for Topics, Articles and Staticpage plugin config options

Articles - allowing a story to have multiple topics - allowing stories to be inherited by parent topics

Admins are going to have to keep an eye on what topics are hidden and what security is set. If you remove read access for anonymous from the top topic then anonymous users will not have access to that topic only. They still would have access to child topics if their security allowed it (though these will not be displayed in the topics block since the path is broken). At some point we could add a checkbox to the Access Rights section to allow permissions to be set for child topics as well if checked and the topic was saved.

The Topics block has been updated. It now shows the tree structure of the topics. Topics have several properties that affect them being displayed in this block. These are Security, if it is Hidden, and if it is a Topic for a different language. How it works is if the visitor doesn't have access to the child topic, or if it is hidden or in another language then it is not displayed. If it is not displayed then none of its child topics are displayed (even if the visitor would have access to the topic)