Chapter 6. Building a Wiki

Nowadays, a wiki is a well-known tool to enable people to maintain a body of knowledge in a cooperative way. Wikipedia (http://wikipedia.org) might be the most famous example of a wiki today, but countless numbers of forums use some sort of wiki and many tools and libraries exist to implement a wiki application.

In this chapter, we will develop a wiki of our own, and in doing so, we will focus on two important concepts in building web applications. The first one is the design of the data layer. We will build upon the simple framework created in the previous chapter and we will try to establish where the limitations in our current implementation lie. The wiki application we will be building is a good test case as it is considerably more complex than the book database developed earlier.

The second one is input validation. A wiki is normally a very public application that might not even employ a basic authentication scheme to identify users. This makes contributing to a wiki very simple, yet also makes a wiki vulnerable in the sense that anyone can put anything on a wiki page. It's therefore a good idea to verify the content of any submitted change. You may, for example, strip out any HTML markup or disallow external links.

Enhancing user interactions in a meaningful way is often closely related with input validation. As we saw in the previous chapter, client-side input validation helps prevent the user from entering unwanted input and is therefore a valuable addition to any application but is not a substitute for server-side input validation as we cannot trust the outside world not to try and access our server in unintended ways.

We will address both input validation and user interaction explicitly when we develop our wiki application in this chapter.

In this chapter, we will:

  • Implement a data layer for a wiki application
  • Implement a delivery layer
  • Take a good look at input validation
  • Encounter jQuery UI's dialog widget

So let's get on with it...

The data layer

A wiki consists of quite a number of distinct entities we can indentify. We will implement these entities and the relations that exist between them by reusing the Entity/Relation framework developed earlier.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.38.92