Instructions: |
Based on the feedback to assignment 2, in this assignment we will build a working web-based service that is querying a (small) database of bibliographic references.
Using a PHP library, we will not only use this service as an action for a Web form, but retrieve the HTML data produced by
the form and augment it so that the service delivered to the end user is a value-added service. This assignment includes three steps, moving from a working form to a PHP Web-based service and then to this service's
extension.
- Creating a working form: Based on the bibliography query service presented in the lecture, an HTML form has to be created which implements a GUI for
all of the query facilities of the underlying service. The form should be a simple GET-based form, which is programmed against the query service directly. Use
label elements for all form controls. In addition to being a good webizen and adhering to basic accessibility guidelines you will
also get an immediate usability benefit out of this: instead of having to hit tiny radio buttons (or other small form controls
you would like to select), you can now also click on the labels to select that form field.
- Create a PHP-based intermediate service: Based on Snoopy, you should now create a PHP page which accepts form-based input, and forwards all the input to the bibliography query service.
you can start with this extremely simple form, which is sending its inputs to the following PHP code (this is the link to the PHP, but you cannot see the source code, because it is processed on the server side):
<?php
include "Snoopy.class.php";
$snoopy = new Snoopy;
import_request_variables("g", "formval_") ;
$snoopy->fetch("http://dret.net/lectures/services-fall06/a/3/query.php?author=" . urlencode($formval_author));
print $snoopy->results;
?>
This code only handles the one form field (the author field) from the extremely simple form, so you have to modify the form as well as the PHP code to handle all the fields (the form part has already been addressed
in the first step). Don't forget to install the Snoopy 1.2.3 Code, otherwise your PHP code will not work. When you are done with this step, the result will be the same as after step 1, but
now there is intermediate PHP code which can augment the original service
- Augment the original service: The original service returns a snippet of HTML (an HTML table). To turn the service's result into a proper HTML page, the
PHP code producing this table must be embedded into appropriate HTML code. Add some HTML code to turn the service's results
into proper HTML. Now think of ways how you could augment the PHP code to provide a value-added service. There are numerous
ways to do that, here are some suggestions:
- At the very least, you could provide a CSS that picks up the classes in the generated HTML (there are numerous classes you
could use) and uses them to improve the formatting of the HTML.
- If you are more ambitious, you could highlight all the search terms in the result HTML, so that users can easily see where
the matches with their query terms are. The highlighting does not have to be robust, so it is allowed to have the same disadvantages
as the simple example shown in the introductory PHP lecture. We will look at more robust ways to do this in the next assignment.
- Using simple search/replace functions on the HTML (what you get in
$snoopy->results ), you could inject some JavaScript into the HTML. One example for this could be switching the display property of abstracts on and off (this is an example how to do it and you can get JavaScript code from this page as well).
Whatever it is you are doing, there is one requirement for this last step: you have to make in configurable, so that you
include in your form (your GUI to your augmented service) a form field which controls your feature, rather than being forwarded
to the bibliography service. As the simplest example, you could have a form field in your query form which lets users choose
between different CSS stylesheets for the query results, and based on their choice, your PHP code then simply generates links
to different CSS stylesheets.
The results for this assignment should be turned in for all three steps, so please send the pure HTML form from step 1, your adaptation of this form to the intermediate PHP along with the intermediate PHP for step 2, and the augmented PHP along with the extended form to control your additional feature(s) for step 3. If you are using CSS, please don't forget to include all necessary CSS files as well. Also, please send URIs
pointing to the functional Web pages on the iSchool Web server, so that the service implementation can be tested directly.
|