Change comment:
Fixed Title, Added TOC
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Creating a FAQ Application - Content
-
... ... @@ -1,10 +1,10 @@ 1 - =Creatinga FAQ Application=1 +{{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}} 2 2 3 3 This tutorial will show you how to build a Frequently Asked Questions (FAQs) Application 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. It also uses a technique that you may frequently use as the basis for several different kinds of applications. 4 4 5 5 All through this tutorial you should refer to the [[XWiki Data Model>>DevGuide.DataModel]] for information on XWiki's data model. You might also use the [[XWiki Scripting Guide>>DevGuide.Scripting]] to get you started with scripting in XWiki and manipulating XWiki objects. In addition, this tutorial will introduce the concepts of Authoring Templates and Page Design Sheets, patterns that you will find particularly useful in creating XWiki applications. Completing this tutorial is a recommended prerequisite for anyone who wants to build custom applications on the XWiki engine. 6 6 7 -= =Application Overview ==7 += Application Overview = 8 8 9 9 The FAQ application allows users to post a question by entering the question into a simple form field and then submitting the form. The question then appears in a list along with all other questions that have been previously posted. Users can click on the questions to view both the question and answer in a consistently styled view. If the question has not yet been answered, any user can post an answer to the question by editing the page. In edit mode, the page will display a web form that is the same for every FAQ page. 10 10 ... ... @@ -14,7 +14,7 @@ 14 14 * [[A Question and Answer Page in Display Mode>>attach:FAQSheetView.png]] 15 15 * [[A Question and Answer Page in Edit Mode>>attach:FAQSheetEdit.png]] 16 16 17 -= =Authoring Templates and Page Design Sheets ==17 += Authoring Templates and Page Design Sheets = 18 18 19 19 An Authoring Template is a template for creating documents of a specific type. Unlike a regular content page in edit mode with one field for freeform editing, an Authoring Template presents a custom set of form fields for creating a document with specific type of data. These form elements are defined by the properties of a class. 20 20 ... ... @@ -24,11 +24,11 @@ 24 24 25 25 The Page Design Sheet is like a style sheet that defines what each document will look like when rendered. Even though the unique object instances will have different values for their properties, they will always have a consistent presentation display because they will be rendered through the Page Design Sheet. The XWiki API available in scripting languages provides a mechanism that will help us use the same sheet for both editing and view modes. We will see how we can achieve this once we get to the FAQ Design Sheet section. 26 26 27 -= =Go to the Class Editor Wizard ==27 += Go to the Class Editor Wizard = 28 28 29 29 Five pages, which collectively make up a Class Editor Wizard application, have been developed to assist you in this process. Enter a search query for the keyword "XWikiClasses". This should return a document called XWikiClasses in the XWiki space (i.e. XWiki.XWikiClasses). This is the homepage of the class wizard creator: you are now ready to start building your FAQs application. 30 30 31 -= =Create the FAQ Class ==31 += Create the FAQ Class = 32 32 33 33 * On the Class Editor wizard entry page (XWiki.XWikiClasses), under the heading "Create a new data type", enter the following web space and class name: 34 34 ** Space: FAQ ... ... @@ -62,7 +62,7 @@ 62 62 63 63 image:FAQClass1.PNG 64 64 65 -= =Add Properties to the Class ==65 += Add Properties to the Class = 66 66 67 67 Under the page title, you should see the words "The class does not have any properties yet. You can use the __class editor__ to define them." Let's just follow those instructions! 68 68 ... ... @@ -76,7 +76,7 @@ 76 76 77 77 image:AddQuestionProperty.PNG 78 78 79 -* Configure this property with the following values (actually, if you are using the current XWiki version, you don't need to change anything but the Pretty name –all the rest are the default values):79 +* Configure this property with the following values (actually, if you are using the current XWiki version, you don't need to change anything but the Pretty name ? all the rest are the default values): 80 80 81 81 image:QuestionProperty.PNG 82 82 ... ... @@ -84,7 +84,7 @@ 84 84 * Choose it from the property list on the left and configure this property with the same values as the "question" property, except for the //name// and //pretty name// which will, obviously, match the new property we're creating 85 85 * When you are done adding and configuring the properties, click the "Save & View" button. 86 86 87 -= =Create the Page Design Sheet ==87 += Create the Page Design Sheet = 88 88 89 89 * After the previous step you are now on the FAQClass page which should look like this: 90 90 ... ... @@ -129,7 +129,7 @@ 129 129 130 130 * Click "Save & View" 131 131 132 -= =Create the Authoring Template ==132 += Create the Authoring Template = 133 133 134 134 * Click on "FAQClass" in the breadcrumb. The document should look like this: 135 135 ... ... @@ -152,7 +152,7 @@ 152 152 153 153 image:FAQClass4.PNG 154 154 155 -= =Create a home page for the FAQ application ==155 += Create a home page for the FAQ application = 156 156 157 157 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. 158 158 ... ... @@ -159,7 +159,7 @@ 159 159 * Use the Create top level menu (when using the Colibri skin) or the Create Panel to create the FAQ.WebHome page (Space = FAQ, Page = WebHome). Alternatively you can navigate to the wiki dashboard page (the home page) and click on the FAQ space which should have a question mark (that's because you've created documents in the FAQ space above but there's no WebHome page created yet). 160 160 * Edit the page in Wiki model and input a title such as "FAQs" in the title field 161 161 162 -== =Displaying existing FAQ entries ===162 +== Displaying existing FAQ entries == 163 163 164 164 You will need to write the following code: 165 165 ... ... @@ -194,7 +194,7 @@ 194 194 * Click "Save and View" 195 195 * New FAQ entries will now be displayed on the page once you create them 196 196 197 -== =Creating new FAQ entries ===197 +== Creating new FAQ entries == 198 198 199 199 Now you need to write some code to let your users create new FAQ entries. To do this, you will have to create a form in which the user can enter the name of the questions she wants to create. Once typed in, the form calls the same page to trigger the new document creation based on the parameters entered by the user: 200 200 ... ... @@ -248,7 +248,7 @@ 248 248 * Click "Save and View" 249 249 * A form to create new FAQ entries is now available on the page 250 250 251 -= =Test the Application ==251 += Test the Application = 252 252 253 253 Now let's just create a new document in our application to test it out. 254 254 ... ... @@ -263,7 +263,7 @@ 263 263 264 264 * Go back to the "FAQ.WebHome" page to see the list of existing questions 265 265 266 -= =Conclusion ==266 += Conclusion = 267 267 268 268 This tutorial has shown how to use the Class Wizard app and it has detailed the concepts of classes, objects, properties and introduced the authoring templates and page design sheets. You may also have learned a little bit about Velocity scripting in documents. You can use these basic concepts to build custom applications at the document or presentation layer of XWiki without having to compile or deploy code. 269 269