Guillaume Lerouge wrote:
Hi,
I've continued to make progress on the CRUD
actions (which will have to be
converted to REST).
Great.
I've created a "create" action
which allows to get a creation form. The
name of the page is automatically derived from one of the fields of the page
or by a counter as specified in the class config.
It calls to the "save" action which has been modified to handle the page
name generation as well as being compatible with validation and reloading
the create action when you came from creeate.
Also a list and create actions have been created.
Currently the these actions have to be called on the class document:
/xwiki/bin/create/XWiki/ArticleClass
would launch create on a blog article. It then create a save URL in the
default space set in the class definition and a non existant page. In case
of validation error we get to see that intermediary URL in the location bar.
I'm not especially happy about this URL since it is not in the "space" of
where the document will be created. You could get a right error after
clicking Save instead of right away showing a permission error.
I could use this type of URL
/xwiki/bin/create?class=XWiki.ArticleClass
or
/xwiki/bin/create/SpaceWhereToCreate/?class=XWiki.ArticleClass
or
/xwiki/bin/create/SpaceWhereToCreate/XWiki.ArticleClass
Given the strong link between applications and spaces (since most
well-developed XWiki applications will have one document per item, using a
space WebHome as the app homepage and space docs to store its data is quite
natural), I'd say that it would be better to have the create URL in the
space where the new item will be created.
My personal favorite would be
/xwiki/bin/create/ApplicationSpace/?class=XWiki.ApplicationClass
as it looks close to the URL we already do write most of the time.
Why not directly
/xwiki/bin/create/ApplicationSpace/
And we find the class automatically when the ?class= param is not specified
We could store the default class in the space config, or lookup the
default space field in the class config (this case causes problem if 2
classes define the same space)
Same for list and search..
Ludovic
This is the
same with the list and search URLs. Currently it's
/xwiki/bin/list/XWiki/ArticleClass
it could be
/xwiki/bin/list/?class=XWiki/ArticleClass
The "list" action would also need to work on a per-space basis, especially
since using space rights to manage application rights is quite handy. So we
would have :
/xwiki/bin/list/ApplicationSpace/?class=XWiki.ApplicationClass
We could also detect the space name and automatically find the class name
that defaults to this space for creation.
Also I currently have the save code in SaveAction. Now this make the code a
little like a hack. Should I move it to a CreateSaveAction ? or another name
?
Guillaume
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Ludovic Dubost
Blog:
http://blog.ludovic.org/
XWiki:
http://www.xwiki.com
Skype: ldubost GTalk: ldubost