Loading...
 

PluginModule interface Crash on Custom Module Insert

Status
Closed
Subject
PluginModule interface Crash on Custom Module Insert
Version
10.x
11.x
Category
  • Usability
Feature
Wiki Plugin (extends basic syntax)
Modules
Resolution status
New
Submitted by
jcarter
Volunteered to solve
manivannans
Lastmod by
Pascal St-Jean
Rating
(0)
Description

Summary
The plugin for inserting modules into a wiki page has a bug where it crashes whenever it encounters custom modules. The following JS applies some duct-tape to the issue, and prevents the crash. I didn't get too deep into the workings of it, just got it to work. Someone who has worked on it before probably has a better understanding of the whole system, and could determine if this was the way to do it or not (the change could have cascading effects on behavior of pluginModule and how it deals with custom modules?)

Note: crash outputs the following error in js console: Uncaught TypeError: Cannot read property 'params' of undefined tiki-js.js:1304

Procedure
To fix the issue, one can do the following:

Modify lib/tiki-js.js line 1303. Change the else statement to an else if, checking for the undefined object which would break things.

Note that the code in the examples below if from tiki 10, not 11, and may be a little bit different in 11, but the problem remains in 11 and the line changed is the same, and fixes it in 11 too.

So, in this block

Copy to clipboard
//For PluginModule, add selected module parameters to the plugin edit form if (type == 'module') { //isolate the module parameter object so it will be shown first in the form var onlymod = {"params":{"module": meta.params.module}}; //user has not changed the module selection since opening the form if (typeof selectedMod == 'undefined') { //pick up the parameters of the saved module parameter if (typeof pluginArgs.module != 'undefined') { //this orders the module parameter first, module related parameters second, other PluginModule parameters besides module last meta.params = $.extend(onlymod.params, tiki_module_params[pluginArgs.module].params, meta.params); //Use the module description meta.params.module.description = tiki_module_params[pluginArgs.module].description; //otherwise pick up the parameters of the first module option since that will be selected automatically } else { meta.params = $.extend(onlymod.params, tiki_module_params[meta.params.module.options[0].value].params, meta.params); meta.params.module.description = tiki_module_params[meta.params.module.options[0].value].description; } //user has selected another module while the form was open - pick up parameters for the selected module } else { meta.params = $.extend(onlymod.params, tiki_module_params[selectedMod].params, meta.params); meta.params.module.description = tiki_module_params[selectedMod].description; } }


change this statement

Copy to clipboard
} else { meta.params = $.extend(onlymod.params, tiki_module_params[selectedMod].params, meta.params); meta.params.module.description = tiki_module_params[selectedMod].description; }


to

Copy to clipboard
} else if (typeof tiki_module_params[selectedMod] != 'undefined') { meta.params = $.extend(onlymod.params, tiki_module_params[selectedMod].params, meta.params); meta.params.module.description = tiki_module_params[selectedMod].description; }


Context
The issue is caused because the module plugin tries to get the parameters for the object to display in the interface, but for custom modules there are none. The tiki_module_params object stores a parameters object for each module as the value for an attribute named after the module (e.g., tiki_module_params[mymodule] would return the params object for [mymodule]). The problem is that the if there are no parameters for the object, it sets the value for the module attribute to false, and the unmodified else statement above from lib/tiki-js.js will try to read the attribute .params from the false object, which will fail, and the js will crash.

Another possible solution to this issue could be to populate the value as an empty object instead of false, in tiki-jsmodule.php.

Solution

I had fixed "pluginModule interface Crash" issue in 12.x.

Please check this commit id: 48363

Thanks jcarter.

Updated:

commit backported to 11.x and 10.x

11.x -> commit id: 48657
10.x -> commit id: 48658

Importance
8
Easy to solve?
8
Priority
64
Demonstrate Bug (Tiki 19+)
Please demonstrate your bug on show2.tiki.org
 About show2.tiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.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.tiki.org.

Version: Create show2.tiki.org instance
Demonstrate Bug (older Tiki versions)
Please demonstrate your bug on show.tikiwiki.org
 About show.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.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 show.tikiwiki.org.

Version: Create show.tikiwiki.org instance
Ticket ID
4668
Created
Monday 19 August, 2013 19:50:26 GMT-0000
by jcarter
LastModif
Saturday 23 November, 2013 22:33:33 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
Kanban
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
Federated Timesheets
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