<
From version < 92.8 >
edited by Vincent Massol
on 2017/01/17
To version < 93.1 >
edited by Vincent Massol
on 2017/01/17
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -174,15 +174,13 @@
174 174  = Create a home page for the FAQ application =
175 175  
176 176  You want your users to be able to see a list of all existing questions and answers and to add new questions. The best way to do this is to put the FAQ application in its own space and to use that space's homepage to display existing questions.
177 -We need to create the FAQ.WebHome page
178 178  
179 -* Click on "FAQClass" in the breadcrumb
180 -* Click on the "+ Add" green button
181 -* Choose FAQ as the "Space name" and type WebHome for the "Page name" field
182 -* Click "Create"
183 -* Type in the title "FAQs" in the title field
184 -* Click "Save & View"
178 +Thus we now need to create the ##FAQ.WebHome## page
185 185  
180 +* Click on "FAQ" in the breadcrumb to navigate to ##FAQ.WebHome## and notice that the page doesn't exist.
181 +* Edit it in wiki mode
182 +* Type in the title "FAQs"
183 +
186 186  == Displaying existing FAQ entries ==
187 187  
188 188  You have 2 options when it comes to displaying existing FAQ entries:
... ... @@ -219,18 +219,17 @@
219 219  {{/velocity}}
220 220  {{/code}}
221 221  
222 -* Copy this code and paste it as Wiki content inside FAQ.WebHome
220 +* Copy this code and paste it as Wiki content (inside ##FAQ.WebHome##)
223 223  * Click "Save and View"
224 224  * New FAQ entries will now be displayed on the page once you create them
225 225  
226 -The FAQ.WebHome page should look similar to this:
224 +The ##FAQ.WebHome## page should look similar to this:
227 227  
228 228  {{image reference="FAQsLivetable.png"/}}
229 229  
230 -Notice how there are some translation keys displayed inside the livetable.
231 -Let's create a translations document and change those keys to actual text:
228 +Notice how there are some translation keys displayed inside the livetable. Let's create a translations document and change those keys to actual text:
232 232  
233 -* Create a new page inside the FAQ space called Translations
230 +* Create a new page inside the FAQ space called Translations, i.e. at ##FAQ.Translations## (using the "+" button)
234 234  * Edit it in Wiki mode and paste this content inside:(((
235 235  {{code language="none"}}
236 236  faq.question=Question
... ... @@ -238,11 +238,11 @@
238 238  faq._actions=Actions
239 239  {{/code}}
240 240  )))
241 -* Save & View
242 -* Edit FAQ.Translations in Object mode and add a new XWiki.TranslationDocumentClass object
243 -* Save & View again
238 +* Click "Save & View"
239 +* Edit it again in Object mode and add a new ##XWiki.TranslationDocumentClass## object to mark the page as a page containing translations. Make sure to select the right scope. Using "Global" means the translations would be visible to all wikis (and it requires having Programming Rights!) and "Wiki" means it's visible to the current wiki only. Choose "Wiki" as the scope.
240 +* Click "Save & View" again
244 244  
245 -Now the FAQ.WebHome page should look like this (notice the translations instead of the keys):
242 +Now the ##FAQ.WebHome## page should look like this (notice the translations instead of the keys):
246 246  
247 247  {{image reference="FAQsLivetableWithTranslations.png"/}}
248 248  
... ... @@ -250,8 +250,8 @@
250 250  
251 251  You will need to write the following code:
252 252  
253 -* A HQL query that will find all your FAQ documents
254 -** The HQL query looks for all documents that have a FAQ.FAQClass object other than the template
250 +* A XWQL query that will find all your FAQ documents
251 +** The XWQL query looks for all documents that have a ##FAQ.FAQClass## object other than the template
255 255  ** If no document has been created yet, a warning message is displayed
256 256  * A piece of velocity code to display all those documents
257 257  ** The velocity code loops in that list
... ... @@ -264,8 +264,8 @@
264 264  = Existing FAQ entries =
265 265  
266 266  {{velocity}}
267 -#set($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'FAQ.FAQClass' and obj.name <> 'FAQ.FAQTemplate'")
268 -#set($results = $xwiki.searchDocuments($sql))
264 +#set($xwql = "from doc.object(FAQ.FAQClass) as faq where doc.fullName <> 'FAQ.FAQTemplate'")
265 +#set($results = $services.query.xwql($xwql).execute())
269 269  #if($results.empty)
270 270   No FAQ has been created yet!
271 271  #else
... ... @@ -277,11 +277,11 @@
277 277  {{/velocity}}
278 278  {{/code}}
279 279  
280 -* Copy this code and paste it as Wiki content inside FAQ.WebHome
277 +* Copy this code and paste it as Wiki content inside ##FAQ.WebHome##
281 281  * Click "Save and View"
282 282  * New FAQ entries will now be displayed on the page once you create them
283 283  
284 -The FAQ.WebHome page should look similar to this:
281 +The ##FAQ.WebHome## page should look similar to this:
285 285  
286 286  {{image reference="FAQsCustomCode.png"/}}
287 287  

Get Connected