Hi Vincent, On Thu, Nov 3, 2011 at 12:56 PM, Vincent Massol <[email protected]> wrote:
> Hi devs, > > I'm implementing the LinkChecker UI and I want to be able to add a Tab in > AllDocs. Right now I've coded it with a hardcoded #if but I really hate > this. > > So here's my proposal: > > * Create the following modules: > xwiki-platform-uiextension/ > |_ xwiki-platform-uiextension-ui/ > |_ xwiki-platform-uiextension-api/ > > where: > * xwiki-platform-uiextension-ui/: contains XWiki.UIExtensionClass page > * xwiki-platform-uiextension-api/: contains a ScriptService to get > UIExtension data + contains an EventListener that refreshes the UI > Extension Cache when an UIExtensionClass object is modified (this is for > performance reasons) > > So how would this work exactly? Each UI (skin, xwiki bundled application, user application, etc.) defines these extension points that any other application can contribute to by using the "type" field in an XWiki.UIExtensionClass instance? This would, of course, mean a great deal of rewriting, but once done, it would be a good investment. > To start with I'm proposing to have the following fields for > UIExtensionClass: > * type: String, represents the type of the extension (for example for the > AllDocs needs, I'll use a "IndexTab" type (or "AllDocsTab" type) > * id: String, the technical name of the extension, which can be used for > example as suffix for HTML class or ids. > * name: String, the name of the extension, which can be used for > displaying. For example for the AllDocs needs, it would be used as the name > of the Tab > * content: Textarea: the content of the extension. For example for the > AllDocs needs, it would be used as the content to display when clicking on > a tab > Depending on the specifics of the extension point, the content gets treated differently? Also, I`m assuming this will generally be velocity/wiki syntax, right? Another thing that might be useful (maybe in future iterations) would be some kind of parameters that the extension could supply to its hook. In your particular use case, a tab extension could say to the AllDocs page that it wants its content to be loaded asynchronously, when the tab is selected. Another case would be a menu extension that wants the menu item to open in a new window when clicked or that wants to be placed before entry X or after entry Y. Etc. > I'd like to implement this ASAP and thus stop hardcoding UI Extensions > from now on. > The only downside I see is the performance penalty once everything starts being extra extensible, but maybe using some smart caching (which you already mentioned something about) we can limit the damage. The extension content still needs to be evaluated every time (unless maybe otherwise stated by the extension itself), but at least the list of extensions can be easily cached. > Here's my +1 > > +1 if I understood it correctly. Thanks, Eduard > Thanks > -Vincent > > PS: If you find a better than "uiextension" I'm all ears. A name without > "extension" would be great to not confuse it with our Extensions (and with > xwiki-platform-extension). > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

