On Mon, Oct 3, 2011 at 18:33, Marius Dumitru Florea <
mariusdumitru.florea(a)xwiki.com> wrote:
Hi devs,
For the upcoming Application Within Minutes I need to enhance the
XWiki platform with the ability to generate the page name
automatically when creating a new wiki page. For some applications it
doesn't make sense to have two creation steps: (1) specify the wiki
page name (i.e. the location) and then (2) edit the new wiki page with
the specified name. Let me give you two examples:
* It would be cool to be able to create a new blog post in a single
step. The blog post name could be generated from the blog post title
specified in the edit form.
* An application that manages holiday requests doesn't need meaningful
page names (i.e. free text, like a blog post would have) but something
like Request_XYZ, where XYZ is a unique counter/identifier.
These applications should be able to create new wiki pages with
automatically generated names without writing their custom create
forms.
Since 3.2RC1 was planed for today and these changes are in the 3.2
roadmap, here's a proposal that I think I can implement quickly and
safely:
(1) Introduce two new components:
// Used to generate a document name that doesn't have to be unique
(e.g. by cleaning the document title).
DocumentReferenceGenerator#generate(DocumentModelBridge):DocumentReference
// Used to make a document name unique (by suffixing an unique
counter/identifier)
DocumentReferenceDifferentiator#differentiate(DocumentReference):DocumentReference
(2) Modify editinline.vm to store "documentReferenceGenerator" and
"documentReferenceDifferentiator" request parameters in two hidden
input fields so that they are passed to the save action. Obviously,
these are component hints.
(3) Modify editactions.vm to replace "Save & View" + "Save &
Continue"
with "Create" when "documentReferenceGenerator" or
"documentReferenceDifferentiator" (or both) request parameters are
set.
+1
(4) Modify SaveAction to take into account these two request
parameters (only if they are specified). Something along these lines:
generateDocumentReference(doc)
synchronize(lock) {
doc.copyDocument(differentiate(generatedDocumentReference)).save();
}
I'm not sure where to place the two components from (1) though. WDYT?
Thanks,
Marius
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs