Hi Mark, Sorry for the delayed response. I went through the steps of creating the FAQ application per the tutorial, but I can't reproduce your issue. Questions are created in the FAQ space for me, not Main. Your code looks fine as well. Were you able to figure it out? Thanks, -Joshua- [email protected] wrote:
Hi Joshua,
(I apologize to all if this appears more than once; I haven't been successful posting to the mailing list since before yesterday. Perhaps attachments are prohibited? Trying again without.)
Thanks again, your explanation of spaces was very clear and helpful.
Now that I have a little better understanding of spaces, I'll present my problem. For some reason when I create a FAQ entry, it's not going into the FAQ space but instead into the Main space. Per the tutorial, I haven't created a FAQ space explicitly this go round.
It seems to me this can only be happening as a result of the code that adds a FAQ, or perhaps in the class definition code which specifies the default space. Looks right to me and jibes with what you've said about spaces. Here it is yanked directly out of my code .. which was simply a copy/paste from the tutorial:
FAQClass code: {{velocity}} ## Replace Main with the Space where you want your documents to be created. ## Replace the default parent with the one of your choice and save the document. ## #set($className = $doc.name.substring(0, $doc.name.indexOf("Class"))) #set($defaultParent = 'FAQ.WebHome') #set($defaultSpace = 'FAQ') {{/velocity}}
{{include document="XWiki.ClassSheet"/}}
FAQTemplate code: {{include document="FAQ.FAQSheet"/}}
FAQ WebHome code (http://localhost/xwiki/bin/edit/FAQ/WebHome?&editor=wiki ): = Existing FAQ entries =
{{velocity}} #set($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='FAQ.FAQClass' and obj.name<>'FAQ.FAQTemplate'") #set($results = $xwiki.searchDocuments($sql)) #if($results.empty) No FAQ has been created yet! #else #foreach ($item in $results) #set($faq = $xwiki.getDocument($item)) * [[${faq.display("question").replace("<p>", "").replace("</p>", "")}>>${item}]] #end #end {{/velocity}}
{{velocity}} #if("$!request.docName" != '') ## Request for creating a new instance #set($targetDocName = "${request.spaceName}.${request.docName}") #set($targetDocName = $targetDocName.replace("?", "").replace("#", "").trim()) #if(!$xwiki.exists($targetDocName) && $xwiki.hasAccessLevel('edit', $context.user, $targetDocName)) $response.sendRedirect($xwiki.getURL($targetDocName, 'inline', "template=${request.template}&parent=${request.parent}")) ## Stop processing, since we already sent a redirect. #stop #end #end
= Add a new question =
#if("$!targetDocName" != '' && $xwiki.exists($targetDocName)) {{warning}}The target document already exists. Please choose a different name, or [[view the existing document>>$targetDocName]]{{/warning}} #elseif("$!targetDocName" != '') {{warning}}You don't have permission to create that document{{/warning}} #end
{{html}} <form action="" id="newdoc" method="post"> <div> <input type="hidden" name="parent" value="${doc.fullName}"/> <input type="hidden" name="template" value="FAQ.FAQTemplate"/> <input type="hidden" name="sheet" value="1"/> <input type="hidden" name="spaceName" value="FAQ"/> Document: <input type="text" name="docName" value="Enter your question here" class="withTip" size="50"/> <span class="buttonwrapper"><input type="submit" value="Create this FAQ" class="button"/></span> </div> </form> {{/html}} {{/velocity}}
So what am I missing?
Thanks, Mark
"Rieken, Joshua" <[email protected]> Sent by: [email protected] 11/10/2009 04:37 PM Please respond to XWiki Users <[email protected]>
To XWiki Users <[email protected]> cc
Subject Re: [xwiki-users] problem with FAQ tutorial .. space assignment?
Mark,
You're very welcome. It's not necessary to explicitly create the WebHome in FAQ until later in the tutorial. Question/Answer documents that are created from the FAQ Class page will go into the FAQ space, which "comes into existence" the instant any document is placed in it.
For example, if you add a question/answer page called "FAQ.Howtoeditapage", you can still get to it regardless of whether "FAQ.WebHome" exists.
A space "disappears" when every document that is part of the space is deleted. So a space is just a collection of documents and doesn't really exist outside of those documents. It's really just a convenient way to organize your documents.
Good luck, and if you have any more questions, please don't hesitate to ask.
-Joshua-
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Tuesday, November 10, 2009 3:31 PM To: XWiki Users Cc: XWiki Users; [email protected] Subject: Re: [xwiki-users] problem with FAQ tutorial .. space assignment?
Hi Joshua,
Thanks very much for your prompt reply. It helps a lot to know the history and what WebHome means!
Am I correct then in first creating the FAQ space explicitly, even though that's not called for in the tutorial? Like so:
"I've first created the FAQ Space, then built the FAQ Class, etc, then put the code into the 'home' page for the space, ie http://localhost/xwiki/bin/view/FAQ/"
Thanks, Mark
BCBS-IL ph 312-653-4293 [email protected]
"Rieken, Joshua" <[email protected]> Sent by: [email protected] 11/10/2009 03:18 PM Please respond to XWiki Users <[email protected]>
To XWiki Users <[email protected]> cc
Subject Re: [xwiki-users] problem with FAQ tutorial .. space assignment?
Hi Mark,
http://localhost/xwiki/bin/view/FAQ/ actually takes you to http://localhost/xwiki/bin/view/FAQ/WebHome. "WebHome" is the home page for any given space. The name "WebHome" came from earlier versions of XWiki, when a Space was called a Web.
Hope this helps, -Joshua-
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of
Sent: Tuesday, November 10, 2009 3:06 PM To: [email protected] Subject: [xwiki-users] problem with FAQ tutorial .. space
assignment?
Hi,
I've followed along in the tutorial in the dev guide for creating a FAQ at http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial
Here's my first point of confusion: in section 'Create a homepage for your application' it states 'Go to the "FAQ.WebHome" page'. I do not see such a page. In the latest iterations of building the FAQ I've first created the FAQ Space, then built the FAQ Class, etc, then put the code into the 'home' page for the space, ie
http://localhost/xwiki/bin/view/FAQ/
I'm sure my problems stem from my weak understanding of this step and how spaces are created and referenced.
Thanks, Mark
BCBS-IL ph 312-653-4293 [email protected]
HCSC Company Disclaimer
The information contained in this communication is confidential, private, proprietary, or otherwise privileged and is intended only for the use of the addressee. Unauthorized use, disclosure, distribution or copying is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender
immediately at (312)
653-6000 in Illinois; (800)835-8699 in New Mexico; (918)560-3500 in Oklahoma; or (972)766-6900 in Texas. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users