Wiki source code of WebHomeOld
Version 1.2 by Vincent Massol on 2013/02/09
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | 1 FAQ | ||
2 | |||
3 | #error("We're currently migrating to a new FAQ application and we're moving FAQ entries one by one to the new application. Make sure to check the [new FAQ Application>FAQ.WebHomeNew].") | ||
4 | |||
5 | In order to find the information you're looking for, you can use the search feature of your browser to search for FAQ entries displayed on this page or use the search box below. | ||
6 | |||
7 | ## --------------------------------------------------- | ||
8 | ## Let the user search for FAQs | ||
9 | ## --------------------------------------------------- | ||
10 | |||
11 | <form action="$xwiki.getURL("FAQ.FAQSearch")"> | ||
12 | <table> | ||
13 | <tr> | ||
14 | <td> | ||
15 | <input type="text" name="text" value="$!request.text" size="30"/> | ||
16 | </td> | ||
17 | <td> | ||
18 | <input type="submit" value="Search FAQs"/> | ||
19 | </td> | ||
20 | </tr> | ||
21 | </table> | ||
22 | </form> | ||
23 | |||
24 | ## Compute number of FAQ entries | ||
25 | #set ($whereClauseAnsweredFaqs = "obj.name=doc.fullName and obj.name<>'XWiki.FAQClassTemplate' and obj.className='XWiki.FAQClass' and prop.id.id = obj.id and prop.id.name='answer' and prop.value <> '' order by doc.creationDate desc") | ||
26 | #set ($nbAnsweredFaqs = "select count(distinct doc) from XWikiDocument doc, BaseObject as obj, LargeStringProperty as prop where $whereClauseAnsweredFaqs") | ||
27 | #set ($whereClauseNotAnsweredFaqs = "obj.name=doc.fullName and obj.name<>'XWiki.FAQClassTemplate' and obj.className='XWiki.FAQClass' and prop.id.id = obj.id and prop.id.name='answer' and prop.value='' order by doc.creationDate desc") | ||
28 | #set ($nbNotAnsweredFaqs = "select count(distinct doc) from XWikiDocument doc, BaseObject as obj, LargeStringProperty as prop where $whereClauseNotAnsweredFaqs") | ||
29 | |||
30 | <table> | ||
31 | <tr> | ||
32 | <th align="center">$xwiki.search($nbAnsweredFaqs).get(0) Answered FAQs (latest first)</th> | ||
33 | <th align="center">$xwiki.search($nbNotAnsweredFaqs).get(0) Unanswered FAQs (latest first)</th> | ||
34 | </tr> | ||
35 | <tr> | ||
36 | <td style="border-right:1px dashed #CCC;border-bottom:1px dashed #CCC"> | ||
37 | ## --------------------------------------------------- | ||
38 | ## Find the FAQ entries that have answers | ||
39 | ## --------------------------------------------------- | ||
40 | #set ($sql = ", BaseObject as obj, LargeStringProperty as prop where $whereClauseAnsweredFaqs") | ||
41 | #foreach ($item in $xwiki.searchDocuments($sql)) | ||
42 | #set($bentrydoc = $xwiki.getDocument($item)) | ||
43 | #set($bentryobj = $bentrydoc.getObject("XWiki.FAQClass", "language", $language, true)) | ||
44 | #if ($bentryobj.getProperty("question").getValue().trim().length() == 0) | ||
45 | * [(Empty question)|$item] | ||
46 | #else | ||
47 | * [${bentrydoc.display("question","view", $bentryobj)}|$item] | ||
48 | #end | ||
49 | #end | ||
50 | </td> | ||
51 | <td style="vertical-align:top;"> | ||
52 | |||
53 | ## ---------------------------------------------------- | ||
54 | ## Find the FAQ entries that have no answers yet | ||
55 | ## ---------------------------------------------------- | ||
56 | #set ($sql = ", BaseObject as obj, LargeStringProperty as prop where $whereClauseNotAnsweredFaqs") | ||
57 | #foreach ($item in $xwiki.searchDocuments($sql)) | ||
58 | #set($bentrydoc = $xwiki.getDocument($item)) | ||
59 | #set($bentryobj = $bentrydoc.getObject("XWiki.FAQClass", "language", $language, true)) | ||
60 | #if ($bentryobj.getProperty("question").getValue().trim().length() == 0) | ||
61 | * [(Empty question)|$item] | ||
62 | #else | ||
63 | * [${bentrydoc.display("question","view", $bentryobj)}|$item] | ||
64 | #end | ||
65 | #end | ||
66 | |||
67 | </td> | ||
68 | </tr> | ||
69 | </table> | ||
70 | |||
71 | $context.setCacheDuration(10000) |