#!/usr/local/bin/perl -w ###!/pkg/gnu/bin/perl ################################################################################ # by Aaron Averbuch (aha1@cs.wustl.edu) # # Updated by Vincent Ferrandon (vf1@cs.wustl.edu) # # for Multi-Agent Systems Group, Washington University # # Under direction of Dr. Tuomas Sandholm (sandholm@cs.wustl.edu) # # # # Moved to CMU and updated for CMU environment by Kate Larson # # (klarson@cs.cmu.edu) # # under direction of Dr. Tuomas Sandholm (sandholm@cs.cmu.edu) # # # # Collects data from Enter exchange information page and runs a JavaSript # # program parsing the data and sending them to the applet SafeComApplet.class. # # The applet sends warning message in case of incoherent data, like # # "enter all data", "use numerical values only", "dependent items should not # # be uncountable", it then opens the input windows corresponding to the second # # step of the process. # ################################################################################ require "cgi-lib.cgi"; ################################################################################ # don't edit under here # # trick to add more rows without parsing the data. Indeed the data are treated # # by an embedded client-side JavaScript program and not a CGI file, therefore # # the input form is a full client-side application. This statment is called by # # submit(). # ################################################################################ if (&ReadParse(*input)) { &printEnterForm; } else { &printEnterForm; } ################################################################################ # Print the input form, open the html-enter.eval file. # ################################################################################ sub printEnterForm { if ($input{'whoareyou'} eq "supplier") { $supChecked = "checked"; $purchChecked = ""; } elsif ($input{'whoareyou'} eq "purchaser") { $supChecked = ""; $purchChecked = "checked"; } # print confirm print "Content-type: text/html\n\n"; open (FILE, "; close (FILE); s/\"/\\"/g; # escape quotes s/\@/\\@/g; # escape at signs print eval "\"$_\""; $num = $input{'numberOfItems'} + $input{'numberToAdd'}; if ($num <= 0) { $num = 5; # there is a minimum of 5 items on the screen -- this creates original screen correctly } for ($i = 1; $i <= $num; $i++){ $itemName = "$input{$i.' itemName'}"; $itemAmountName = "$input{$i.' itemAmountName'}"; print " $i. Countable  Uncountable  "; } ################################################################################ # The following button calls the submit() JavaScript function. # ################################################################################ print " There are more items to add. Please add more rows for items.

"; # print "

Type of Items - print "

Type of Items - example

Items Units
Dependent  Independent  Dependent  Independent 
"; ################################################################################ # Optimization modes : payments, deliveries, number of steps, sum of deliveries# # and payments. # ################################################################################ # print "

What do you want to minimize in the exchange - example

"; print "

What do you want to minimize in the exchange - example

"; print " number of steps (a step may include both a payment and a delivery) 
number of deliveries 
number of payments 
sum of deliveries and payments 
"; ################################################################################ # The button Submit calls the JavaScript function entertrans() that parses the # # data and sends them to the applet. # ################################################################################ print "

"; ################################################################################ # Applet SafeComAppletN.class, named as SafeComApplet. # ################################################################################ # print "
Applet Status Information

"; # print "\n"; # # print ""; # print ""; print "
Applet Status Information

"; print "\n"; print ""; print ""; ################################################################################ # Beginning of JavaScript program : scrolls to anchor "target". # ################################################################################ print ""; print ""; print ""; } ###############################END OF PROGRAM###################################