[xwiki-devs] Creating new pages from Templates/Classes?
Hello Xwiki-Devs, I am not quite sure if this one is just a stupid question I haven't been able to find an answer for, or if it is just impossible. Situation is this: If you hava a link in a page e.g. "[GrannySmith]" and and this page doesn't exist yet (so it'll get a questionmark as marker), as soon as somebody clicks on that link xwiki will suggest to create a new Page or go straight to the editor. So far so clear. Now for instance I have a xwiki class called "Apple" can I create a link that mandates that the newly created page should be of the class "Apple" (respectively should have an object of "Apple")? Or is there any other way to accomplish this? thanks and greetings Jonas
Hello Jonas, As for now, you can only create a link to a page of class Apple (I understand by that a page that contains a object of the apple class and that includes its content from a page that knows how to display apple documents, i.e. XWiki.AppleClassSheet) by writing the link yourself : <a href="$xwiki.getURL('Apples.SomeApple','inline','template=XWiki.AppleClassTemplate')">Your link</a> for instance. In the future (couple of months a priori), we plan to support custom wiki links which will allow users to chose the type (class) of page they want to write when clicking such a "natural wiki link" with question mark. Hope this helps, Regards, Jerome. PS: more on the notions of Class/Sheet/Template on Vincent's tutorial on theserverside : http://www.theserverside.com/tt/articles/article.tss?l=XWiki
Hello Xwiki-Devs,
I am not quite sure if this one is just a stupid question I haven't been able to find an answer for, or if it is just impossible.
Situation is this: If you hava a link in a page e.g. "[GrannySmith]" and and this page doesn't exist yet (so it'll get a questionmark as marker), as soon as somebody clicks on that link xwiki will suggest to create a new Page or go straight to the editor. So far so clear. Now for instance I have a xwiki class called "Apple" can I create a link that mandates that the newly created page should be of the class "Apple" (respectively should have an object of "Apple")? Or is there any other way to accomplish this?
thanks and greetings Jonas _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hello Jerome, yep that helps a lot. Also because the links are created in a Plugin, which makes it no extra effort, to use xwiki builtin functions. Furthermore it shouldn't be a problem to create a Macro that resolves that Class to ClassTemplate relation and does the thing with less parameters. thanks again and nice greetings Jonas Jerome Velociter wrote:
Hello Jonas,
As for now, you can only create a link to a page of class Apple (I understand by that a page that contains a object of the apple class and that includes its content from a page that knows how to display apple documents, i.e. XWiki.AppleClassSheet) by writing the link yourself : <a href="$xwiki.getURL('Apples.SomeApple','inline','template=XWiki.AppleClassTemplate')">Your link</a> for instance. In the future (couple of months a priori), we plan to support custom wiki links which will allow users to chose the type (class) of page they want to write when clicking such a "natural wiki link" with question mark.
Hope this helps, Regards, Jerome.
PS: more on the notions of Class/Sheet/Template on Vincent's tutorial on theserverside : http://www.theserverside.com/tt/articles/article.tss?l=XWiki
Hello Xwiki-Devs,
I am not quite sure if this one is just a stupid question I haven't been able to find an answer for, or if it is just impossible.
Situation is this: If you hava a link in a page e.g. "[GrannySmith]" and and this page doesn't exist yet (so it'll get a questionmark as marker), as soon as somebody clicks on that link xwiki will suggest to create a new Page or go straight to the editor. So far so clear. Now for instance I have a xwiki class called "Apple" can I create a link that mandates that the newly created page should be of the class "Apple" (respectively should have an object of "Apple")? Or is there any other way to accomplish this?
thanks and greetings Jonas _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Jonas von Malottki wrote:
Hello Jerome,
yep that helps a lot. Also because the links are created in a Plugin, which makes it no extra effort, to use xwiki builtin functions.
Furthermore it shouldn't be a problem to create a Macro that resolves that Class to ClassTemplate relation and does the thing with less parameters.
Note that the "edit" link should only be written when the page is new, otherwise a norma "view" link should be used. In the macro you could write something like: #macro(printCustomLink $targetDocName $templateName) #set($targetDoc = $xwiki.getDocument($targetDoc)) #if($targetDoc.isNew()) #set($targetUrl = $targetDoc.getURL("inline", "template=${templateName}")) #else #set($targetUrl = $targetDoc.getURL()) #end <a href="$targetUrl">$targetDoc.displayTitle</a> #end
Jerome Velociter wrote:
Hello Jonas,
As for now, you can only create a link to a page of class Apple (I understand by that a page that contains a object of the apple class and that includes its content from a page that knows how to display apple documents, i.e. XWiki.AppleClassSheet) by writing the link yourself : <a href="$xwiki.getURL('Apples.SomeApple','inline','template=XWiki.AppleClassTemplate')">Your link</a> for instance. In the future (couple of months a priori), we plan to support custom wiki links which will allow users to chose the type (class) of page they want to write when clicking such a "natural wiki link" with question mark.
Hope this helps, Regards, Jerome.
PS: more on the notions of Class/Sheet/Template on Vincent's tutorial on theserverside : http://www.theserverside.com/tt/articles/article.tss?l=XWiki
Hello Xwiki-Devs,
I am not quite sure if this one is just a stupid question I haven't been able to find an answer for, or if it is just impossible.
Situation is this: If you hava a link in a page e.g. "[GrannySmith]" and and this page doesn't exist yet (so it'll get a questionmark as marker), as soon as somebody clicks on that link xwiki will suggest to create a new Page or go straight to the editor. So far so clear. Now for instance I have a xwiki class called "Apple" can I create a link that mandates that the newly created page should be of the class "Apple" (respectively should have an object of "Apple")? Or is there any other way to accomplish this?
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Hello everybody, I am a newcomer of XWiki. Sorry for keeping this thread alive, but I d like to know if there is any news about this problem. I think it would be a very useful feature to add in future versions! Thank you and Greetings MrMela -- View this message in context: http://n2.nabble.com/Creating-new-pages-from-Templates-Classes--tp711950p218... Sent from the XWiki- Dev mailing list archive at Nabble.com.
participants (4)
-
Jerome Velociter -
Jonas von Malottki -
MrMela -
Sergiu Dumitriu