Virtual Wishlist
Total Page:16
File Type:pdf, Size:1020Kb
Virtual Wishlist Figure 1: Welcome Page of the Virtual Wishlist Group project carried out by Josua Dietrich, Nils Braune and Tino Canziani created 2011 at D-ITET, ETH Zürich 21.12.2011 Contents 1 Introduction and Background 3 1.1 Idea . .3 1.2 Related Work . .3 1.3 Tools . .3 2 Concept 5 2.1 Core functions . .5 2.2 Website Layout . .5 2.3 Sessions & Proles . .7 3 Implementation 8 3.1 HTML/Login/Session (Welcome.html) . .8 3.2 MySQL server: creating a database . .9 3.3 setupConnection.php . 11 3.4 $.ajax(), getWishlists() .................. 12 3.5 Adding a prole picture . 14 4 Results and Future Steps 16 4.1 Results . 16 4.1.1 Welcome Page . 16 4.1.2 Prole Page . 16 4.1.3 my Wishes menu . 16 4.1.4 my Friends and Search Friends Menu . 16 4.1.5 Settings menu . 17 4.1.6 Friend Page . 17 4.1.7 Terms, Privacy, About, Help Page . 17 4.1.8 Process of fullling and getting wishes fullled . 17 4.1.9 Security . 17 4.2 Future steps . 18 A Server/PHP functions 20 B Screenshot of the prole page 21 C Setting up the Virtual Wishlist step by step 22 D Endnotes 23 1 Abstract In this group project we designed and implemented a virtual wish list as a social media service on the web. It enables its users to maintain a personal prole, create their own wish lists or opt to grant other friends their specic wishes. The use case of this virtual wish list will mostly tend to birthday and christmas events, social gatherings, leisure activities or work related events. For instance, a couple will be able to create a wish list for their wedding, making it accessible online to all the guests listed in their friend list. A guest may then opt to fulll any of those wishes on the wish list, which will be marked thereafter and thus making sure that no second guest will bring the same gift. The implementation is based on the web standards HTML, JavaScript, PHP and SQL. HTML describes the structure of the web page, JavaScript its dynamic interaction at run time, PHP enables the ow of information between user and database and SQL fetches or changes the entries in the database. The program- ming was done with an IDE named Aptana Studio and the implementation was built upon the very common XAMPP stack. 2 Chapter 1 Introduction and Background 1.1 Idea The general concept is simple and clear: Let people create their own wish list on the web to share them with others. This should address two kinds of problems: being in a situation where you receive a gift you aren't very happy about because you didn't want it, and the situation of not being able to gure out or nd a suitable gift for a person. Our project proposes a solution to circumvent both of these embarassing situations. It is important to note that a wish list should not necessarily have to be for a birthday party, it should be usable for an arbitrary event, such as a picnic. Attendees could then organize who brings what. 1.2 Related Work Similar concepts already exist on the web, notably websites which let you manage wedding presents, such as weddingwishlist.ie, weddingshop.com or mar- riagegiftlist.com. But we haven't come across a virtual wish list designed for an arbitrary kind of event and with the possibility to set up personal proles. The use cases were limited exclusively to specic events. Another site oering a similar service is amazon.com. Yet it is bound to its own selling platform. And there is facebook.com, as a social media service, which yet lacks the functionalities of wish lists. The idea of facilitating the organization of events was also grabbed up by doodle.com, yet addressing dierent kinds of problems, as it is a site which allows people to show their availability for dierent dates and times. 1.3 Tools To manage our code, we used a CVS (Concurrent Versions System) called SVN1 A SVN repository allows to store all code les on an external server such that all group members can update their local code (svn update) to the newest version or save it back onto the le server when nished (svn commit). Every change is tracked and can be reset at any time, while SVN automatically identies conicts in the code. The work was done on an IDE (Integrated Development Environment) called Aptana Studio 32 It is available as a standalone version as well as a eclipse plugin. The service is built upon a server called XAMPP3 It bundles an Apache server4 to display web pages with content, a PHP environment5 for server side computing as well as a MySQL database6 which stores our user data. You can run XAMPP locally for development purposes, but for deployment, there will be a signicant physical distance between web server and a user surng the web with a browser. 3 Virtual Wishlist CHAPTER 1. INTRODUCTION AND BACKGROUND The PHP functions are called upon by JavaScript through the $.ajax() method. This method is part of a set of functions in the jQuery Library7 which is freely available on the web and is used to simplify common tasks in JavaScript. This library also provides other useful functionality, such as the handling of events like mouse clicks as well as visual animation eects. 4 Chapter 2 Concept The following section describes the evolution of an idea into an implementable concept. 2.1 Core functions The core functions of the service consist of: Client Server (database) Create, edit and delete prole Store proles Create, edit and delete wish lists Store wish lists Create, edit and delete wishes Store wishes Add and delete friends Store user relationships View and/or fulll own or friends' wishes Store user-wishes and relationships Login and logout Start and end a session for a user Table 2.1: Core Functions As seen in the table 2.1 above, all actions a user proceeds requires an im- mediate action by the server. A list of necessary functions on the server side to handle the actions of the user can be found in Appendix A. Beside the core functionalities, a website layout is required, as discussed in the next section. 2.2 Website Layout The layout of the site has to follow some requirements: The website must present itself in a simple manner, everyone should im- mediately be able to use it. Content like wishes or names should be loaded dynamically into the same page, instead of loading the whole page time and time again. The service should consist of a few single webpages, rather than many dierent ones. The following page will show a diagram of the website ow 2.1. For a screen- shot of the prole page, please see Appendix B. 5 Virtual Wishlist CHAPTER 2. CONCEPT Figure 2.1: Websites Flow 6 Virtual Wishlist CHAPTER 2. CONCEPT A short description of each page: Welcome.html: Welcomes the user and allows registering and logging in to the virtual wish list service Prole.html: Shows the user's prole with his wishes, prole details and friends Friend.html: Shows a friend's prole with all his wishes, personal information and friends Registered.html: After a user registered, he will be redirected here notLoggedIn.html: If no session exists or a user logged out unexpectedly, he will be redirected to this page Privacy.html: Displays details on the privacy agreement (which has still to be written) Terms.html: Displays terms and conditions (which also have to be written yet) Help.html: Displays help About.html: Displays about 2.3 Sessions & Proles To handle user data and address privacy concerns correctly, the data needs to be stored and linked on a per-prole basis. Also, the connections to several users at the same time need to be separated in sessions. With this, and by encrypting every connection, user data can be protected from illegitimate manipulation. 7 Chapter 3 Implementation This chapter will explain the programming by highlighting and showing some code examples of some important functions. The general structure of any web page looks the following: HTML JavaScript PHP SQL Denes and Calls PHP functions Communicates Inserts data makes visible: with AJAX and with the database from the requests inputelds, handles clicks and loads the and stores data. simple texts, on buttons etc. content into the pictures etc. site Table 3.1: Language Usage When looking at the source code, these program les will be suxed .html, .js, .php and .dml/.ddl respectively. HTML will include JavaScript functions, which call PHP code in les on the server, which then again connect to our database and call SQL procedures. The starting page is called Welcome.html. If someone tries to access other web pages without logging in before, he will also be redirected to this page (as a result of his missing session). 3.1 HTML/Login/Session (Welcome.html) In our case, HTML8 merely denes the regions and containers where content is placed in. The properties and attributes of those are set in CSS9 (cascading style sheets), which we will not examine further. Following gure shows the HTML passage for the login boxes: Figure 3.1: HTML Denition loginBox It makes appear two text input elds in the top right corner. Line 1 denes a <div>, the common container for content in the HTML markup language. Line 2 adds a form, which has three inputs assigned to it, one for the email address (line 3), one for the password (line 5) and a last one being the log in button (line 8).