#!/usr/local/bin/perl print "Content-type: text/html\n\n"; print qq~ Survey Administration Page Tour - Survey-Hosting.com
Survey-Hosting.com

Example Survey Administration Page

~; # sub accountstats { my %accountstats; open(INI, "<../checks/account.ini"); flock(INI, 1); while() { chomp; (my $key, my $value) = split(/=/, $_); $accountstats{$key} = $value; } close(INI); return %accountstats; } # end accountstats(); sub printtabs { print ""; $style = " class='whiteboxText'"; $offcolor = 'whitesmoke'; @menus = ('main', 'links', 'data', 'images', 'options'); %titles=('main'=>'Main','links'=>'Links','data'=>'Data','images'=>'Images','options'=>'Account Options'); %colors=('main'=>$offcolor,'links'=>$offcolor,'data'=>$offcolor,'images'=>$offcolor,'options'=>$offcolor); #print $_[0]; foreach(@menus) { if($_ eq $_[0]) { $colors{$_} = 'gainsboro'; } print ""; } print "
".$titles{$_}."
"; #print "
".$titles{$_[0]}."
"; } #end printtabs; sub readrecord { open(USRDEL, "<../checks/files.record"); flock(USRDEL, 1); my @userfiles = ; close(USRDEL); return @userfiles; } $localpath = $ENV{HTTP_HOST}; my %accountstats = accountstats(); $password = $accountstats{'PASSWORD'}; $accountname = substr($localpath, 0, -19); ################################################################# #MAIN MENU #$input = error/warning from move.pl, deletesurvey.pl, or deletefile.pl $input = $ENV{'QUERY_STRING'}; if($input eq '' || $input =~ /^main/) { $section = 'main'; printtabs($section); print""; ################################################################# # #Ask if user has a project to upload print ""; #print ""; print ""; # # ################################################################# #check for files in the upload directory # # use File::Glob ':glob'; @list = bsd_glob('../upload/*'); $cnt = scalar @list; foreach(@list) { if($_ =~ /.ini/ && $_ !~ /cgi.ini/) { push(@projectnames, $_); } } #count number of active surveys and compare to getmaxsurveys @list = bsd_glob('*.ini'); foreach(@list) { if($_ !~ /cgi.ini/) { push(@active, $_); } } print ""; } # # print""; print qq~ ~; # ################################################################# #print row for all .ini files that represent active surveys # # foreach(@active) { print""; print""; $hasreport = substr($_, 0, -4)."2.rep"; if(-e $hasreport) { print""; }else { print""; } print""; } print"

Step #3 - upload files

"; print "

If you have a survey project to upload, you can 'drag-and-drop' the project files onto Survey-Hosting.com.

"; print "
  • Click on the 'Open upload window' link located to the right (it may take up to 30 seconds for this new window to open).
  • Select ALL of the files in your project file folder (C:\\shUPLOAD\\... created in Step #2 when you publish).
  • Drag and drop the files into the upload (ftp://...) window that opens after you click the link.
  • Close both the upload window and the project file folder when the transfer is finished.
"; $ftplink = "ftp://".$accountname.":".$password."@".$accountname.".survey-hosting.com"; #print $ftplink; print "
"; #improve JavaScript to open a temp window that indicates FTP is connecting. print""; print""; #print "

Step #4 - activate survey

"; if($input =~ /main_live/) { print "The survey you are trying to upload has the same name as an active survey. You need to delete the existing survey before you can activate the new one. Surveys can be deleted from the Data menu."; }elsif(@active >= $accountstats{'MAXSURVEYS'}) { print " Your account can hold a maximum of ".$accountstats{'MAXSURVEYS'}." surveys. Delete a survey to make room for a new one. Surveys can be deleted from the Data menu."; }elsif($input =~ /^main_multi/) { print"There are files for more than one project in the upload window. You can only upload one project at a time. If you are sharing this account, make sure that you are not uploading project files at the same time as another user. Click on the name of the project that you want to upload."; print""; }else{ if($input =~ /^main_missing/) { print"Some of the required project files are not in the upload window. Make sure you have moved all project files into the upload window, then click ACTIVATE. "; print"

"; #The missing project files are: } if($input =~ /^main_noini/) { print"There are no project files in the upload window, or the project (.ini) settings file is missing. Make sure you have moved all project files into the upload window, then click ACTIVATE."; print"

"; } if($input =~ /^main_duplicate/) { print"There were some extra file(s) included in the upload window along with your project. Your project has been activated. If you need to have the other file(s) in your account, you can upload them on the Images menu."; print"

"; } print"To activate an uploaded survey, click:"; #JavaScript print""; print""; print"
  • Make sure all files have been transfered in Step #3 before activation!

Step #5 - live surveys

Survey Name View Survey Summary Stat. Report
--
".substr($_, 0, -4)."
SURVEY
REPORT
--
--
"; use File::Glob ':glob'; @list = bsd_glob('CGItemp*'); $cnt = unlink @list; #print"Temp files removed ="; #print $cnt; }#end of main ################################################################# #LINKS if($input =~ /^links/) { $section = 'links'; printtabs($section); print qq~ ~; # #print "localpath="; #print $localpath; #print "

accountname="; #print $accountname; #print "

"; # ################################################################# #look for all .ini files that represent active surveys # #Modify so that survey URL's aren't links, and replace for loop with foreach() use File::Glob ':glob'; @list = bsd_glob('*.ini'); for($i=0; $i <= $#list; $i++) { if(@list[$i] !~ /cgi.ini/) { print"

"; $hasreport = substr(@list[$i], 0, -4)."2.rep"; if(-e $hasreport) { print""; }else { print""; } } } print"

Links

Survey Name -- --
".substr(@list[$i], 0, -4)."Survey URL:http://".$accountname.".survey-hosting.com/ezs.cgi?DATABASE=".substr(@list[$i], 0, -4)."
Report URL:http://".$accountname.".survey-hosting.com/ezs.cgi?DATABASE=".substr(@list[$i], 0, -4)."&_ACTION=REPORT
Report URL:
--
"; }# end links ################################################################# #DATA if($input =~ /^data/) { $section = 'data'; printtabs($section); print qq~ ~; use File::Glob ':glob'; @list = bsd_glob('*.ini'); @archives = bsd_glob('archive_*'); foreach(@list) { if($_ !~ /cgi.ini/) { print ""; print""; #remove the delete function if there is an archived data file for the same project. if(-e "archive_".substr($_, 0, -4).".asc") { print""; } else { print""; } print""; } } print""; print""; print"

Data

Survey Name Data (Right-click and choose
"Save As" to download)
Delete this survey
".substr($_, 0, -4)."".substr($_, 0, -4)."\.asc
archive exists

Archived Data

"; print""; foreach(@archives) { print""; } print"
"; print"".$_.""; print""; print"
"; print"
"; print"
"; }#end DATA ################################################################# #IMAGES if($input =~ /^images/) { $section = 'images'; printtabs($section); use URI::Escape; #read this from the files.record #use File::Glob ':glob'; my @userfiles = readrecord(); my @images; my @files; foreach(@userfiles) { chomp($_); $lcname = lc($_); if($lcname =~ /(jpg|gif|jpeg)/) { push(@images, $_); } if($lcname =~ /(asc|html|htm)/ && $lcname !~ /^archive/) { push(@files, $_); } } #make sure the top upload cell fills across the page. my $colspan; if (@images < 4) { $colspan = @images; }else { $colspan=4; } print ""; # print ""; print ""; print ""; #make thumbnails of all images $count = 1; foreach(@images) { $imagesize = (stat($_))[7]; $encode = uri_escape($_); if($imagesize <20000) { print ""; }else { print ""; } $count++; if($count > 4) { print""; $count=1; } } print ""; print "

Images"; if(@images >= $accountstats{'MAXIMAGES'}) { print" ... Account limit reached Account limit reached: Maximum number of images. "; } print"

Delete an image by clicking on the icon. "; print " Maximum number of images: ".$accountstats{'MAXIMAGES'}.""; print " Maximum image size you can upload: ".$accountstats{'IMAGESIZE'}."KB"; print "
"; print "
"; print "Upload: "; print ""; print " "; print "
"; print "
"; print "
".$_."
".$_."

HTML and ASC files"; if(@files >= $accountstats{'MAXFILES'}) { print" ... Account limit reached Account limit reached: Maximum number of HTML and ASC files. "; } print"

"; #output a listing of all uploded html, htm and asc files foreach(@files) { print ""; } print "
$_
"; print "
"; }#end images ################################################################# #OPTIONS if($input =~ /^options/) { $section = 'options'; printtabs($section); print qq~ ~; print"

Account Options

"; print "Maximum number of concurrent surveys: ".$accountstats{'MAXSURVEYS'}; print"
"; print "Maximum number of images: ".$accountstats{'MAXIMAGES'}; print"
"; print "Maximum image size: ".$accountstats{'IMAGESIZE'}."KB"; print"
"; print "Maximum number of additional html and asc files: ".$accountstats{'MAXFILES'}; print"
"; print "Maximum file size: ".$accountstats{'IMAGESIZE'}."KB"; print"
"; }#end options print'© Copyright 2009 Survey-Hosting.com|Club Membership Surveys|Club Marketing '; print"";