ProductReview Example

From DataFlex Wiki
Revision as of 14:35, 14 May 2011 by Jka (talk | contribs)
Jump to navigationJump to search

ProductReview Example page under construction

Introduction

This is yet another example of how to create a AJAX solution using Visual DataFlex.

In this example the overall goal is to be able to see what users think about a particular item . As an added benefit - users can also share information about where to buy the particular items.

To accomplish this, then users should be able to:

  • login
  • choose an item from a list (use a AJAX Lookup List )
  • enter information about a known item ( AJAX Form )
    • supply information about the place where an item was bought.
  • supply a rating of an item
  • Overview supplied ratings from other users
  • Find out where to buy the requested item

Data Dictionaries

We want to store information about users, places, purchases and known items. The other tables should hold sufficient information about the items purchased and how the users liked them.

Create these tables in the database builder and create the associated data dictionaries .

The following data dictionaries should now be available:

UserInfo

  • User_id
  • FirstName
  • LastName
  • StreetAddress
  • City
  • ZIPCode
  • EmailAddress

Place

  • Place_id
  • StoreName
  • StreetAddress
  • City
  • ZIPCode
  • Administrator (identify if the user is administrator)

Item

  • Item_id
  • Name
  • Manufacturer
  • Price

Purchase

  • Item_id
  • Place_Id
  • User_id
  • DateTime
  • Price

Rating

  • Item_Id
  • User_id
  • Place_Id
  • Rating

VDF Ajax implementation

The implementation will be split up into Data Dictionaries, Web Service Objects and web markup . All of these should be familiar to you if you have taken the time to look at the other examples in the VDF Ajax library

Web Service objects

Create a AJAX WebService Object to call from the clientside VDF Ajax lib. This webservice will be responsible for handling the serverside calls.

The Web Service object should provide the following functionality for session management.

  • UserLogin: checking if the supplied password is correct. Use UserInfo_DD
  • HasRights: does the logged in user have the rights to perform the chosen function. Use UserInfo_DD

The HasRights function should identify whether the user is administrator or not.

Web Browser Objects

  • SessionManager.wo: Handle session related information
  • item.wo : handling information about items.
  • userinfo.wo : handling information about users
  • place.wo: handling info about places
  • purchase.wo: handle information about places
  • rating.wo: handle information about ratings

The Web Object should use the corresponding data dictionaries

Access restrictions

"ordinary" users should only be allowed to alter information about themselves - e.g "Joe" should not be allowed to alter the address of "Bob". only "Administrators" should be allowed to add new products and places to the database. E.g "Joe" should not be able to add all his favourite places and products to the list. "Ordinary" users should only be able to rate an item allready in the system .

Web markup

The web markup should be designed around forms, that evolve around the web objects.

Version 1.1 of the AJAX Library has wizards to create most of this functionality.

  • login.asp: a page showing a login box
  • frontpage.asp: display a greeting after a successfull login
  • Rating.asp: a list of items with detailed ratings. show details about related users and items.
    • Should use a AJAX Lookup list to choose the item to supply a rating for
    • Should use a AJAX Form to supply details about the rating
  • RateItem.asp: a form to supply rating information about a particular item ( AJAX Form )
  • Item.asp: Information about an item
  • Place.asp: information about a place where items can be bought ( AJAX Form )
  • EditItem.asp: edit info about an item
  • EditPlace.asp: edit info about a place
  • EditUser.asp: edit info about a user

UI specifics

  • "Administrators" have a different ui than "ordinary" users.