On Mon, Jul 7, 2008 at 5:27 PM, Guillaume Lerouge <[email protected]> wrote:
Hi Wang,
[snip]
I'm looking forward testing your work !
Now the plugin can work. However it's a little complicate. If you want to convert a office document 1. you first upload the document 2. copy the attachment name(because the name of document change after upload) 3. edit the page and add the velocity code to use the importer plugin 4. save and view. I think it should be more simple.
So do I :-)
There is 2 ways we can go about doing this : the page action way and the application way.
1. Page action : we add an "import" action in the menu at the top of the page (and maybe in the WYSIWYG editor as well). When clicking on the button, the user is prompted to choose a compatible file on his machine, then he clicks on "import" (with an interface similar to the one used for uploading attachments). The .../bin/import/Main/... is called, and the content from the file appended at the bottom of the existing page, with a #info('') macro at the top saying something like "The following content has been imported to the page :"
This action way is easy to implement as I can get whatever I want to use by using java. But as you said, change the xwiki-core is not a good idea. However, I can get the byte[] data of the source office doument without using attachment.
2. Application : we create an OfficeImport application with the following components : a homepage where the user is prompted to import one or multiple documents. The documents are then imported, each creting its own wiki page. Once the importation is complete, the user is prompted to move the documents to their new locations (using the Rename or the copy feature to implement this)
The application way is good and decouple. However there are some problem too. I want to get the name of the attachment after upload the office document as the name of the document changed by the xwiki.clearName(). But the util.clearName() don't provide the same result. Do I need to add another clearName model in api util? Alternately, I just provide a select type input in the importer page which contain all the attachments in the page for use to select the source attachments.
The benefits of going the page way is that it's probably more intuitive for users. However it means adding core changes = less flexibility in the long run. And the action bar already has a lot of items ;-)
OTOH going the application way woud make the application easier to setup (plugin + XAR), store all the pages in a dedicated place and make it possible to import many documents at once and sort things out at a later stage. However it makes it a bit longer to import a file to a given page and might be less intuitive...
WDYT ?
Guillaume _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Sincerely, Wang Ning