Last modified by Simon Urli on 2023/10/10

From version 82.1
edited by Manuel Smeria
on 2015/08/27
Change comment: There is no comment for this version
To version 84.1
edited by Manuel Smeria
on 2015/09/02
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -2,7 +2,7 @@
2 2  {{toc/}}
3 3  {{/box}}
4 4  
5 -This tutorial will show you how to build a Frequently Asked Questions (FAQs) [[Application>>platform:Features.Applications]] much like the one you can find on the [[FAQ page>>xwiki:FAQ.WebHome]]. This is a very simple application that makes use of XWiki's [[classes, properties, and objects>>platform:DevGuide.DataModel||anchor=HXWikiClasses2CObjects2CandProperties]]. It also uses a technique that you may frequently use as the basis for several different kinds of applications.
5 +This tutorial will show you how to build a Frequently Asked Questions (FAQs) [[Application>>platform:Features.Applications]] much like the one you can find on the [[FAQ page>>xwiki:FAQ.WebHome]]. This is a very simple application that makes use of XWiki's [[classes, properties, and objects>>platform:DevGuide.DataModel||anchor="HXWikiClasses2CObjects2CandProperties"]]. It also uses a technique that you may frequently use as the basis for several different kinds of applications.
6 6  
7 7  = Prerequisites for following the tutorial =
8 8  
... ... @@ -16,11 +16,11 @@
16 16  
17 17  Let us begin by taking a look at what we are going to build. The new application will have the following views:
18 18  
19 -* The FAQs Summary View
19 +* The FAQ [[Class>>xwiki:FAQ.WhatIsAClass]]
20 20  {{image reference="FAQsSummary.png"/}}
21 -* A Question and Answer Page in Display Mode
21 +* An FAQ entry in View mode
22 22  {{image reference="FAQSheetView.PNG"/}}
23 -* A Question and Answer Page in Edit Mode
23 +* An FAQ entry in Edit mode
24 24  {{image reference="FAQSheetEdit.PNG"/}}
25 25  
26 26  = Authoring Templates and Page Design Sheets =
... ... @@ -102,7 +102,7 @@
102 102  )))
103 103  * Click the first button ("Create the document sheet") to create the document sheet (the Page Design Sheet). This sheet determines how your page's objects will be rendered to the user. The document is automatically created.
104 104  * Click on "View the sheet document"
105 -* Edit that page in Object mode (make sure your user is an [[Advanced user>>platform:Features.PageEditing||anchor=HAdvancedMode]])
105 +* Edit that page in Object mode (make sure your user is an [[Advanced user>>platform:Features.PageEditing||anchor="HAdvancedMode"]])
106 106  * Add a XWiki.SheetClass object to the page
107 107  ** **Adding the XWiki.SheetClass object is important. It's because of this object that users will be sent to form edition mode when editing FAQ entries**
108 108  * Click "Save & View"
... ... @@ -127,7 +127,9 @@
127 127  As we mentioned, XWiki provides a mechanism that helps us create sheets used for both View and Edit mode.
128 128  This is the display function used in the line:
129 129  
130 -{{code language="none"}}: $doc.display($prop.getName()){{/code}}
130 +{{code language="none"}}
131 +: $doc.display($prop.getName())
132 +{{/code}}
131 131  
132 132  It detects the current mode (Edit or View) and displays the property referenced by its argument as the mode dictates:
133 133  
... ... @@ -141,6 +141,7 @@
141 141  == Bind the Class to the Sheet ==
142 142  
143 143  Next, we neet to bind our class document (FAQ.FAQClass) to this new sheet (FAQ.FAQSheet):
146 +
144 144  * Edit FAQ.FAQClass in Object mode and add a new object of type XWiki.ClassSheetBinding
145 145  * Type in FAQSheet inside the field
146 146  * Save & View
... ... @@ -162,9 +162,18 @@
162 162  * Click on "Add a FAQ object to the template ยป":(((
163 163  {{image reference="FAQObject.png"/}}
164 164  )))
165 -* Congratulations: you just created an Authoring Template! You're almost done now.(((
168 +
169 +Next we need to remove the title for the newly created template:
170 +
171 +* Navigate to FAQ.FAQTemplate
172 +* Edit this document in Wiki mode
173 +* Inside the Title field you have "FAQ Template" written -> delete this text
174 +* Save & View
175 +
176 +This step is needed so that all of our future entries don't have "FAQ Template" as their title.
177 +
178 +Congratulations: you just created an Authoring Template! You're almost done now.
166 166  {{image reference="FAQClass4.PNG"/}}
167 -)))
168 168  
169 169  = Create a home page for the FAQ application =
170 170  
... ... @@ -224,6 +224,7 @@
224 224  
225 225  Notice how there are some translation keys displayed inside the livetable.
226 226  Let's create a translations document and change those keys to actual text:
239 +
227 227  * Create a new page inside the FAQ space called Translations
228 228  * Edit it in Wiki mode and paste this content inside:(((
229 229  {{code language="none"}}
... ... @@ -230,7 +230,8 @@
230 230  faq.question=Question
231 231  faq.doc.creationDate=Creation Date
232 232  faq._actions=Actions
233 -{{/code}})))
246 +{{/code}}
247 +)))
234 234  * Save & View
235 235  * Edit FAQ.Translations in Object mode and add a new XWiki.TranslationDocumentClass object
236 236  * Save & View again
... ... @@ -281,12 +281,13 @@
281 281  == Creating new FAQ entries ==
282 282  
283 283  There are 2 ways for you to let your users create new FAQ entries:
298 +
284 284  1. Declare the FAQ as a template
285 285  1. Add a custom creation form
286 286  
287 287  === Using a Template ===
288 288  
289 -You will have to define a template provider [[as explained on this page>>extensions:Extension.Administration Application||anchor=HCreatethetemplateprovider]]
304 +You will have to define a template provider [[as explained on this page>>extensions:Extension.Administration Application||anchor="HCreatethetemplateprovider"]]
290 290  
291 291  Go to your wiki's administration interface, in the "Templates" section (Administration -> Content -> Templates). Create a new template provider in the "FAQ" space and name it "FAQTemplateProvider"
292 292  

Get Connected