Wiki source code of WebHomeOld

Last modified by Vincent Massol on 2013/02/09

Show last authors
1 1 FAQ
2
3 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.
4
5 ## ---------------------------------------------------
6 ## Let the user search for FAQs
7 ## ---------------------------------------------------
8
9 <form action="$xwiki.getURL("FAQ.FAQSearch")">
10 <table>
11 <tr>
12 <td>
13 <input type="text" name="text" value="$!request.text" size="30"/>
14 </td>
15 <td>
16 <input type="submit" value="Search FAQs"/>
17 </td>
18 </tr>
19 </table>
20 </form>
21
22 ## Compute number of FAQ entries
23 #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")
24 #set ($nbAnsweredFaqs = "select count(distinct doc) from XWikiDocument doc, BaseObject as obj, LargeStringProperty as prop where $whereClauseAnsweredFaqs")
25 #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")
26 #set ($nbNotAnsweredFaqs = "select count(distinct doc) from XWikiDocument doc, BaseObject as obj, LargeStringProperty as prop where $whereClauseNotAnsweredFaqs")
27
28 <table>
29 <tr>
30 <th align="center">$xwiki.search($nbAnsweredFaqs).get(0) Answered FAQs (latest first)</th>
31 <th align="center">$xwiki.search($nbNotAnsweredFaqs).get(0) Unanswered FAQs (latest first)</th>
32 </tr>
33 <tr>
34 <td style="border-right:1px dashed #CCC;border-bottom:1px dashed #CCC">
35 ## ---------------------------------------------------
36 ## Find the FAQ entries that have answers
37 ## ---------------------------------------------------
38 #set ($sql = ", BaseObject as obj, LargeStringProperty as prop where $whereClauseAnsweredFaqs")
39 #foreach ($item in $xwiki.searchDocuments($sql))
40 #set($bentrydoc = $xwiki.getDocument($item))
41 #set($bentryobj = $bentrydoc.getObject("XWiki.FAQClass", "language", $language, true))
42 #if ($bentryobj.getProperty("question").getValue().trim().length() == 0)
43 * [(Empty question)|$item]
44 #else
45 * [${bentrydoc.display("question","view", $bentryobj)}|$item]
46 #end
47 #end
48 </td>
49 <td style="vertical-align:top;">
50
51 ## ----------------------------------------------------
52 ## Find the FAQ entries that have no answers yet
53 ## ----------------------------------------------------
54 #set ($sql = ", BaseObject as obj, LargeStringProperty as prop where $whereClauseNotAnsweredFaqs")
55 #foreach ($item in $xwiki.searchDocuments($sql))
56 #set($bentrydoc = $xwiki.getDocument($item))
57 #set($bentryobj = $bentrydoc.getObject("XWiki.FAQClass", "language", $language, true))
58 #if ($bentryobj.getProperty("question").getValue().trim().length() == 0)
59 * [(Empty question)|$item]
60 #else
61 * [${bentrydoc.display("question","view", $bentryobj)}|$item]
62 #end
63 #end
64
65 </td>
66 </tr>
67 </table>
68
69 $context.setCacheDuration(10000)

Get Connected