Jk-voting

From AOLserver Wiki
Revision as of 05:53, 24 March 2006 by 69.121.200.97 (talk)
Jump to navigation Jump to search

Database Backed Voting Booth In theory, this is a well commented walk-through of how one might impliment a flexible voting booth in AOLserver. My purpose isn't to provide a plug-in voting booth module but rather to demonstrate one style of AOLserver programming. I don't know what the best way to present this is, so feel free to edit (after all, that's what a wiki is all about). ns_register_proc GET /voting vote_subjects ns_register_proc GET /voting/new_subject new_subject ns_register_proc GET /voting/place_vote place_vote ns_register_proc GET /voting/delete_subject delete_subject ns_register_proc GET /voting/dovote dovote ns_register_proc GET /voting/view view_vote Ok, mockery of my questionably named procedures aside here is the overview. My preference is to have each .tcl file impliment one collection of related functions. In this case all the code specific to the Voting booth is in one file. I like to put all the ns_register_proc's right at the top so I always know where to look when correlating a URL with it's procedure. Six URL's for a voting booth might seem excessive, let me explain the purpose of each first and then we'll get to the code itself (the code is the easy part). /voting -- this is the top-level url for the voting booth. It presents the first voting-related page I want the end users to see. Some folks might prefer /voting.html (which has some advantages, even the dumbest browsers won't have any trouble mime-typing it) but I like to only use .html extentions for static pages. Maybe that's weird. /voting/new_subject -- When a user wants to add a new subject for voting this is the URL called in the...