Wiki source code of XWikiExplorerWidget
Last modified by Ecaterina Moraru (Valica) on 2017/09/04 14:51
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 1 XWiki Explorer Widget Documentation | ||
| 2 | |||
| 3 | #toc("" "" "") | ||
| 4 | |||
| 5 | 1.1 Introduction | ||
| 6 | |||
| 7 | Since XWiki 1.8.1, XWiki provide a JavaScript widget (based on [SmartClient>http://www.smartclient.com] TreeGrid widget) that allows to browse a XWiki instance. This widget can be configured to allow browsing of a farm, a wiki or a space. | ||
| 8 | |||
| 9 | |||
| 10 | 1.1 Configuration parameters | ||
| 11 | |||
| 12 | {table} | ||
| 13 | Name | Type (Values) | ||
| 14 | wiki | String ("all" or the name of a wiki database) | ||
| 15 | space | String (the name of a space within the wiki) | ||
| 16 | page | String (the name of a page within the space) | ||
| 17 | displaySuggest | boolean (true to display a suggest field at the bottom) | ||
| 18 | displayLinks | boolean (true to display links in tree nodes) | ||
| 19 | displayAttachments | boolean (true to display attachments under page nodes) | ||
| 20 | displayAttachmentsOnTop | boolean (true to display attachments before children nodes) | ||
| 21 | {table} | ||
| 22 | ##displayAddAttachment: false, // Display a "Add Attachment" node in each Attachments meta-node. | ||
| 23 | ##displayAddAttachmentOnTop: true, // Display the "Add Attachment" node on top. | ||
| 24 | ##displayAttachmentsWhenEmpty: false, // Display attachments meta-node even if there's no attachments. | ||
| 25 | ##displayAddPage: false, // Display a "Add page" node in spaces. | ||
| 26 | ##displayAddPageOnTop: true, // Display the "Add page" node on top. | ||
| 27 | |||
| 28 | 1.1 Examples | ||
| 29 | |||
| 30 | #macro(screenshot $attachment) | ||
| 31 | <img style="border: solid 2px #CCC;" src="$doc.getAttachmentURL($attachment)"/> | ||
| 32 | #end | ||
| 33 | |||
| 34 | 1.1.1 Prerequisites | ||
| 35 | |||
| 36 | First you need to copy the following javascript includes: | ||
| 37 | |||
| 38 | {code} | ||
| 39 | ## Smartclient | ||
| 40 | $xwiki.jsfx.use("js/smartclient/initsc.js", true)## | ||
| 41 | $xwiki.jsfx.use("js/smartclient/modules/ISC_Core.js")## | ||
| 42 | $xwiki.jsfx.use("js/smartclient/modules/ISC_Foundation.js")## | ||
| 43 | $xwiki.jsfx.use("js/smartclient/modules/ISC_Containers.js")## | ||
| 44 | $xwiki.jsfx.use("js/smartclient/modules/ISC_Grids.js")## | ||
| 45 | $xwiki.jsfx.use("js/smartclient/modules/ISC_Forms.js")## | ||
| 46 | $xwiki.jsfx.use("js/smartclient/modules/ISC_DataBinding.js")## | ||
| 47 | $xwiki.jsfx.use("js/smartclient/skins/Enterprise/load_skin.js")## | ||
| 48 | ## XWikiExplorer | ||
| 49 | $xwiki.jsfx.use("js/xwiki/xwikiexplorer/xwikiexplorer.js", true)## | ||
| 50 | {code} | ||
| 51 | |||
| 52 | 1.1.1 Farm | ||
| 53 | |||
| 54 | #screenshot("Treeviewfarm.jpg") | ||
| 55 | |||
| 56 | {code} | ||
| 57 | <div id="XWEWrapper" style="height:300px;margin-right:20px;padding-bottom:30px;"></div> | ||
| 58 | <script> | ||
| 59 | isc.XWETreeGrid.create({ | ||
| 60 | defaultValue: "", | ||
| 61 | htmlElement: "XWEWrapper", // Mandatory HTML wrapper. | ||
| 62 | dataSource: isc.XWEDataSource.create({}), | ||
| 63 | }).draw(); | ||
| 64 | </script> | ||
| 65 | {code} | ||
| 66 | |||
| 67 | 1.1.1 Wiki | ||
| 68 | |||
| 69 | #screenshot("Treeviewwiki.jpg") | ||
| 70 | |||
| 71 | {code} | ||
| 72 | isc.XWETreeGrid.create({ | ||
| 73 | defaultValue: "", | ||
| 74 | htmlElement: "XWEWrapper", // Mandatory HTML wrapper. | ||
| 75 | dataSource: isc.XWEWikiDataSource.create({}), | ||
| 76 | }).draw(); | ||
| 77 | {code} | ||
| 78 | |||
| 79 | 1.1.1 Space | ||
| 80 | |||
| 81 | #screenshot("Treeviewspace.jpg") | ||
| 82 | |||
| 83 | {code} | ||
| 84 | isc.XWETreeGrid.create({ | ||
| 85 | defaultValue: "", | ||
| 86 | htmlElement: "XWEWrapper", // Mandatory HTML wrapper. | ||
| 87 | dataSource: isc.XWESpaceDataSource.create({ space: "Main" }), | ||
| 88 | }).draw(); | ||
| 89 | {code} | ||
| 90 | |||
| 91 | 1.1.1 Page | ||
| 92 | |||
| 93 | #screenshot("Treeviewpage.jpg") | ||
| 94 | |||
| 95 | {code} | ||
| 96 | isc.XWETreeGrid.create({ | ||
| 97 | defaultValue: "", | ||
| 98 | htmlElement: "XWEWrapper", // Mandatory HTML wrapper. | ||
| 99 | dataSource: isc.XWEPageDataSource.create({ space: "Main", page: "WebHome" }), | ||
| 100 | }).draw(); | ||
| 101 | {code} |