Loading...
 

Category Defaults don't work as designed

Status
Open
Subject
Category Defaults don't work as designed
Version
9.x
Category
  • Usability
Feature
Category
Submitted by
David Carter
Lastmod by
Pascal St-Jean
Rating
(0)
Description

So I've been vexed by the "category_defaults" tiki preference settings since they got expanded in version 9.x to include object name and object type. Supposedly you can add filters to set the default category based on the object name using a regex, and additionally set the default category to only assign if the object type is a wiki page. This is a fantastic feature! However, I've never been able to get it to work. The syntax is confusing and poorly documented (naturally), but the real problem is that even when you get it exactly right, the feature's still broken.

I am not a coder, and even though I have commit privs, I don't think I'm prepared to "fix" this in the source, so maybe somebody can help the community out with this information.

Workaround

After revisiting the problem today, I have come up with two issues that are at the root of this problem. The first and most painfully obvious is that the object name and object type variables for this setting are nulled out in the array that is build for them by the Manipulator.php file located at /lib/core/Category/. On line 31, you've got:

Manipulator.php
function addRequiredSet(array $categories, $default, $filter=null, $type=null)

Once I took the "=null" bits out it actually did parse these two elements into the array. Brilliant. No more beating my head against a wall.

The second issue is that the preference box at Admin > Categories for Category Defaults doesn't record the setting properly. I had to go look in my database using phpMyAdmin and see what was actually written there in the tiki_preferences table for the category_defaults row. Apparently the first line of the text area gets parsed incorrectly, and if you don't have any object name filter to specify, it chokes on the second colon and takes your input for object type as being the variable for object name. I was able to replicate this bug in both 9.3 and 9.4. The second line of text (and presumably additional lines - I only checked two) get parsed correctly, but since the first line is munged up, the whole thing breaks.

For example, in my environment this is the correct setting I was striving for in Category Defaults:

Category Defaults
*1/3::wiki page
*11/12::wiki page

I don't have any object name filter, but I only want the categories assigned to wiki pages. Unfortunately, saving this data records the following in the database:

Broken category_defaults
a:2:{i:0;a:4:{s:10:"categories";a:1:{i:0;s:2:"*1";}s:7:"default";s:1:"3";s:6:"filter";s:11:":wiki page
";s:4:"type";s:0:"";}i:1;a:4:{s:10:"categories";a:1:{i:0;s:3:"*11";}s:7:"default";s:2:"12";s:6:"filter";s:0:"";s:4:"type";s:9:"wiki page";}}

As you can see, the first "filter" setting is ":wiki page" with a line feed and carriage return embedded behind it. Compare it to the second line, which gets parsed correctly. I had to manually edit my record to be like this:

Working category_defaults
a:2:{i:0;a:4:{s:10:"categories";a:1:{i:0;s:2:"*1";}s:7:"default";s:1:"3";s:6:"filter";s:0:"";s:4:"type";s:9:"wiki page";}i:1;a:4:{s:10:"categories";a:1:{i:0;s:3:"*11";}s:7:"default";s:2:"12";s:6:"filter";s:0:"";s:4:"type";s:9:"wiki page";}}

This, my friends, works as expected.

Why does the text area input not get parsed correctly into the database for the first line? That is an exercise for the reader, I guess.

Importance
5
Easy to solve?
5
Priority
25
Demonstrate Bug
Please demonstrate your bug on show2.tikiwiki.org
 About show2.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tikiwiki.org instance. To start, simply select a version and click on "Create show2.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tikiwiki.org.

Version: Create show2.tikiwiki.org instance
Ticket ID
4442
Created
Wednesday 24 April, 2013 20:47:53 GMT-0000
LastModif
Tuesday 10 September, 2013 20:04:57 GMT-0000

Attachments

 filenamecreatedhitscommentversionfiletype 
No attachments for this item


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
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
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
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