Loading...
 

Deployment of Category Jail

Status as of 2012: this is all mostly done and kept for historical perspectives. If you notice an issue with Category Jail for a specific feature, please file a bug report, or fix the code and commit if you can :-)



As explained in the Workspace, the category jail is a way to restrict the visible categories and listed objects. At this time, the preference has been partially deployed as a few examples, but to be an effective feature, it must be deployed on all features and all listings.

Once this task is completed, WYSIWTSN will be achieved through Perspectives.

Tools

  • $categlib->get_jail() provides the list of categories available in the jail
  • $categlib->get_jailed( $categories ) returns the list of filtered categories for the jail if activated, or the provided categories if not
  • $categlib->get_default_categories() provides the list of categories to be applied as default

Tasks

These tasks must be performed for all features (ex: file galleries, image galleries, articles, ...). They should be performed one by one.

  1. Update the Jailroot Demonstration profile to create test data for the data type.
  2. Verify that object creation uses the root categories as default values on object creation (by setting the $cat_object_exists variable before inclusion of categorize.php and categorize_list.php)
  3. Update the primary listings to respect the category jail. This usually implies setting a default category filter (get_jail) if none is applied and filtering the category filter (get_jailed). List filtering should be done in the libraries as much as possible.
  4. Update all the modules and plugins related to the feature. These might work out of the box if they used the primary listing functions. However, this is not common. If possible, the code should be converted to use the primary listing function and set the appropriate filters and orderings. Otherwise, the code will need to be updated to respect the filtering.

Progress

FeatureAssigned toStatus
Categorylphuberdeaucompleted
WikichealerDone
ArticlebenEdit and primary listing done
Image galleries
Blogsaldo
File galleriesjonny/lphcompleted
Trackersluci & SylvieDeployment of Category Jail for Trackers
CalendarbenListing done, problems with events edition
Forumslphuberdeaucompleted
Polls


Other features?

  • Multiple modules also do not respect WYSIWYCA and WYSIWTSN
    • Most critical would be "since your last visit", which can be updated by simply calling the functions instead of duplicating SQL.
  • Search -> not working as of 2009-01-09

Examples

Apply default categories on object creation
Index: tiki-editpage.php
===================================================================
--- tiki-editpage.php	(revision 20514)
+++ tiki-editpage.php	(revision 20521)
@@ -1010,6 +1010,7 @@
 	$cat_name = $_REQUEST["page"];
 	$cat_href="tiki-index.php?page=".urlencode($cat_objid);
 	$cat_lang = $_REQUEST['lang'];
+	$cat_object_exists = $tikilib->page_exists( $_REQUEST['page'] );
 	include_once("categorize.php");
 	include_once("poll_categorize.php");
 	include_once("freetag_apply.php");
@@ -1286,6 +1287,7 @@
 $cat_type = 'wiki page';
 $cat_objid = $_REQUEST["page"];
 $cat_lang = $pageLang;
+$cat_object_exists = $tikilib->page_exists( $_REQUEST['page'] );
 $smarty->assign('section',$section);
 include_once ('tiki-section_options.php');
 if ($prefs['feature_freetags'] == 'y') {


Index: tiki-edit_article.php
===================================================================
--- tiki-edit_article.php	(revision 20514)
+++ tiki-edit_article.php	(revision 20521)
@@ -434,6 +434,7 @@
 	$cat_objid = $artid;
 	$cat_desc = substr($_REQUEST["heading"], 0, 200);
 	$cat_name = $_REQUEST["title"];
+	$cat_object_exists = (bool) $artid;
 	$cat_href = "tiki-read_article.php?articleId=" . $cat_objid;
 	include_once("categorize.php");
 	include_once ("freetag_apply.php");
@@ -472,6 +473,7 @@
 
 $cat_type = 'article';
 $cat_objid = $articleId;
+$cat_object_exists = (bool) $artid;
 include_once ("categorize_list.php");
 
 if ($prefs['feature_freetags'] == 'y') {

Apply default filters and jail
Index: lib/tikilib.php
===================================================================
--- lib/tikilib.php	(revision 20514)
+++ lib/tikilib.php	(revision 20521)
@@ -3066,8 +3066,12 @@
 			$bindvars[] = $max_rating;
 		}
 
+		global $categlib; require_once('lib/categories/categlib.php');
+		if( empty( $categId ) ) {
+			$categId = $categlib->get_jail();
+		}
+
 		if ($categId) {
-			global $categlib; require_once('lib/categories/categlib.php');
 			$categlib->getSqlJoin($categId, 'article', '`tiki_articles`.`articleId`', $fromSql, $mid2, $bindvars);
 		}
 		
@@ -3952,19 +3956,28 @@
 			$mid = '';
 		}
 
+		global $categlib; require_once( 'lib/categories/categlib.php' );
+		$category_jails = $categlib->get_jail();
+
+		if( ! isset( $filter['categId'] ) && ! empty( $category_jails ) ) {
+			$filter['categId'] = $category_jails;
+		}
+
 		$distinct = '';
 		if (!empty($filter)) {
 			$tmp_mid = array();
 			foreach ($filter as $type=>$val) {
 				if ($type == 'categId') {
-					$cat_count = count( (array) $val );
+					$categories = $categlib->get_jailed( (array) $val );
+
+					$cat_count = count( $categories );
 					$join_tables .= " inner join `tiki_objects` as tob on (tob.`itemId`= tp.`pageName` and tob.`type`= ?) inner join `tiki_category_objects` as tc on (tc.`catObjectId`=tob.`objectId` and tc.`categId` IN(" . implode(', ', array_fill(0, $cat_count, '?')) . ")) ";
 
 					if( $cat_count > 1 ) {
 						$distinct = ' DISTINCT ';
 					}
 
-					$join_bindvars = array_merge(array('wiki page'), (array) $val);
+					$join_bindvars = array_merge(array('wiki page'), $categories);
 				} elseif ($type == 'lang') {
 					$tmp_mid[] = 'tp.`lang`=?';
 					$bindvars[] = $val;

Page last modified on Tuesday 26 March, 2013 14:32:36 GMT-0000

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Group
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
Theme
TikiTests
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools