On Wed, Sep 22, 2010 at 12:31, Marius Dumitru Florea <[email protected]> wrote: > Hi devs, > > I'm going to create a macro for previewing office attachments. It's main > usage will be: > > {{officepreview attachment="presentation.ppt" filterStyles="true"/}} > > "officepreview" is a bit long for a macro name. "preview" is shorter but > is too generic and thus can be confusing. "preview" could be the name of > a more generic macro that previews any type of attachment, based on its > mime type (so not just office documents). > > "attachment" is the only required parameter. It is also a bit long, but > "file", which is shorter, is confusing. Some users might try to preview > office documents from their file system or from the web. > > "filterStyles" is optional, and defaults to false. > > The office preview macro will be just a wrapper for the office preview > script service. This means no decorations (e.g. borders, headings, etc.) > will be added around the output of the script service: > > {{velocity}} > {{html}} > $services.officepreview.preview($attachmentReference, $filterStyles) > {{/html}} > {{/velocity}} > > I'm not sure if the office preview macro should be a wiki macro or a > Java macro. One disadvantage for wiki macros is > http://jira.xwiki.org/jira/browse/XWIKI-4262 . This means that the > attachment string reference must be resolve before calling the office > preview script service. Currently there's no clean way to resolve a > reference relative to a given document in velocity so I would have to > use groovy which raises programming rights issue. Alternative we can > extend the > http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-model/src/main/java/org/xwiki/model/internal/scripting/ModelScriptService.java > . > > There's nothing to customize so the power of wiki macros wouldn't be > used. You can create a wiki macro that wraps the office preview macro > and add decorations specific to your needs. > > One the other hand, the advantages of a Java macro are not significant > either because the macro is just a simple wrapper for the office preview > script service. > > WDYT?
+1 for Java macro since wiki macro does not bring anything here and java macro does not require to import a xar. > > Thanks, > Marius > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

