CMPT165_28_OnlineCatalog3

CMPT165_28_OnlineCatalog3 - Online Catalog 3.0 Feature...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
–1 Online Catalog 3.0 Feature overload © Colin Stewart, 2009 New features New features • in this lecture, we'll add some new features to our online movie catalog • we'll also modify some existing features to make them easier to use
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–2 View all View all • the first feature we'll add is the ability to view all movie titles in the catalog: • the script for this will be called viewAll.py View all View all • the code for viewAll.py : from file import * import cgi form = cgi.FieldStorage() print 'Content-type: text/html' print print '<html>\n<head>\n</head>\n<body>' f = File( 'movieCatalog.data' ) if f.exists() == False : print '<h1>View all failed</h1>' print '<div>No movies in the catalog</div>' #continued on next slide
Background image of page 2
–3 View all View all #continued from previous slide else : print '<h1>Catalog</h1>' f.startRead() movieList = f.read() f.close() print '<ul>' for movie in movieList: #print each movie title print '<li>' + movie[0] + '</li>' print '</ul>' print '</body>' print '</html>' View all View all • the problem with this current system is that it shows all the catalog's movies at once • if there are many movies in the catalog, it will take a long time to show them all h for example, the Internet Movie DataBase ( imdb.com ) has over 400,000 movies h it would take up to a few minutes to show all these titles
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–4 View all View all • also, people probably won't want to see thousands of titles – it's too much information to deal with • it would be better to only show a small number of titles at once – for example, 10 titles View all View all • here's a system that shows only 10 titles at once • note that it has a "Next" link at the bottom, which allows us to see the next 10 titles
Background image of page 4
–5 View all View all • if we click the "Next" link, we'll see this: • note that we now have a "Previous" link, as well as a "Next" link View all View all • if we keep clicking "Next", we'll eventually get to the end of the catalog: • note that this last page has no "Next" link
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–6 View all View all • all of these different pages will be generated by one script • how can we tell the script to show a different selection of movie titles? View all (simplified) View all (simplified) • a simple way to do this is to have a form: • the user would type in a number, and then 10 movies would be shown, starting at that position • e.g. if the user types in 5, then movies 5 to 14 would be shown
Background image of page 6
–7 View all (simplified) View all (simplified) • in action: b View all (simplified) View all (simplified) • another example: b
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
–8 View all (simplified) View all (simplified) • the code to generate the form ( viewAllForm.py ): print 'Content-type: text/html' print print '<html>\n<head>\n</head>\n<body>' print """<h1>View the catalog</h1> <form action=" viewAll.py "> <div>Start at movie #
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/30/2009 for the course CMPT 165 taught by Professor Ramesh during the Summer '09 term at Simon Fraser.

Page1 / 23

CMPT165_28_OnlineCatalog3 - Online Catalog 3.0 Feature...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online