MenuBar reform
- MenuBars are now easier programmatically extensible (easier to maintain)
- refactored code, reduced scatted definitions (a… Show more
- MenuBars are now easier programmatically extensible (easier to maintain)
- refactored code, reduced scatted definitions (a… Show more
MenuBar reform- MenuBars are now easier programmatically extensible (easier to maintain)- refactored code, reduced scatted definitions (all configurations at the same place)- unified templating: use body property @body.folderHTML@ instead of @folderhtml@From the former API calls only "update_items" has changed,all existing configurations (i.e. via folders or package parameter)should continue to work.== Changes:One can now extend menubars via menu entry definition {config -use YOURCONFIG -class YOURCLASS}in two directions:a) subclassing define your own menubar class YOURCLASS, which should be a subclass of ::xowiki::MenuBarb) provide your own configuration method to provide a more tailored configuration. This is performed by defining a method "config=YOURCONFIG" for ::xowiki::MenuBarThe latter method is used for test-items, which can define atest item folder by using -- extra_menu_entries --- {config -use test-items}instead of -- extra_menu_entries --- {entry -name New.Item.TextInteraction -form en:edit-interaction.wf -query p.item_type=Text} {entry -name New.Item.ShortTextInteraction -form en:edit-interaction.wf -query p.item_type=ShortText} {entry -name New.Item.SCInteraction -form en:edit-interaction.wf -query p.item_type=SC} {entry -name New.Item.MCInteraction -form en:edit-interaction.wf -query p.item_type=MC} {entry -name New.Item.ReorderInteraction -form en:edit-interaction.wf -query p.item_type=Reorder} {entry -name New.Item.UploadInteraction -form en:edit-interaction.wf -query p.item_type=Upload} {entry -name New.App.OnlineExam -form en:online-exam.wf} {entry -name New.App.InclassQuiz -form en:inclass-quiz.wf} {entry -name New.App.InclassExam -form en:inclass-exam.wf}See below for the definition of the "test-items" configuration method,which is based on the default definitions. In general, the definitionin this method can be performed via menu-entries (same syntax as inother menu entries) or via the MenuBar API (e.g. calling":add_menu_item ...").All configurations follow the following definition orderwhere later entries can refine earlier entries: - package level: package parameter ExtraMenuEntries - configuration method: use standard or tailored confguration methods - per-folder definition: content of the extra_menu_entriesNote that the menu entry definition language supports as welladding/clearing menus, etc., so almost everything can be refined.I've noticed that the tlf* code has several scattered menudefinitions, which are as well done in every case differently.By these definition one can define e.g. a learning-app folder (where"New" can be used to define new app folders), and the app folders canprovide their own "New" entries, e.g. for clickers andothers. E.g. For "clickers" there is already on non-oo definition toachieve similar things (which should be altered to the new method),but on other places, there are some hard-coded definitions for rootfolders, etc. The menubars of the learning-apps should be made thisway more consistent with the rest (e.g. using "New", supporting "tableof contents" for clipboard interactions, etc.)namespace eval ::xowiki { ::xowiki::MenuBar instproc config=test-items { {-bind_vars {}} -current_page:required -package_id:required -folder_link:required -return_url } { :config=default \ -bind_vars $bind_vars \ -current_page $current_page \ -package_id $package_id \ -folder_link $folder_link \ -return_url $return_url return { {clear_menu -menu New} {entry -name New.Item.TextInteraction -form en:edit-interaction.wf -query p.item_type=Text} {entry -name New.Item.ShortTextInteraction -form en:edit-interaction.wf -query p.item_type=ShortText} {entry -name New.Item.SCInteraction -form en:edit-interaction.wf -query p.item_type=SC} {entry -name New.Item.MCInteraction -form en:edit-interaction.wf -query p.item_type=MC} {entry -name New.Item.ReorderInteraction -form en:edit-interaction.wf -query p.item_type=Reorder} {entry -name New.Item.UploadInteraction -form en:edit-interaction.wf -query p.item_type=Upload} {entry -name New.App.OnlineExam -form en:online-exam.wf} {entry -name New.App.InclassQuiz -form en:inclass-quiz.wf} {entry -name New.App.InclassExam -form en:inclass-exam.wf} } }}
Show less
|