survey.php3 7.49 KB
Newer Older
Chad Barb's avatar
Chad Barb committed
1 2 3 4 5 6 7 8 9 10 11 12
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");

#
# Only known and logged in users can do this.
#
13 14 15 16 17 18 19 20 21 22
$effuid = "unknown";
$uidnotes = "No UID Provided.";
$uid = GETUID(); 
# GETLOGIN();

if ($uid) {
  $effuid = $uid; 
  $uidnotes = "Checklogin returned " . CHECKLOGIN($uid) . ".";
}

23 24
$intro = "How would adding the following to Emulab affect you, now or in future?";

Chad Barb's avatar
Chad Barb committed
25
$answers = array(
26 27 28 29
  'Choose one',
  'Not necessary',
  'Might help me a little, but not that much',
  'Would definitely help',
Chad Barb's avatar
Chad Barb committed
30 31 32 33
  'Would let me do experiments I want to do, but can\'t'
);

$questions = array(
34
  'More nodes',
Chad Barb's avatar
Chad Barb committed
35
    '"There are not enough free when I need them."',
36
  'More nodes',
37
    '"I want to run experiments with more nodes than Emulab has (170)."',
38
  'More powerful nodes',
39
    'Faster, more RAM, bigger disks, etc (add specifics in text box below)',
40
  'Gigabit Ethernet links',
41
    'If you want faster than Gbit, say so in text box below.',
42
  'Nodes with more physical network interfaces',
Chad Barb's avatar
Chad Barb committed
43
    '',
44 45
  'Virtual links/nodes <i>instead of</i> more physical resources',
    'Approx 10 virtual per each physical link/node, without performance guarantees',
46
  '"Real" commercial routers instead of just PCs',
Chad Barb's avatar
Chad Barb committed
47 48 49
    '',
  'Better user support',
    '',
50 51
  'Better/more organized documentation',
    ''
Chad Barb's avatar
Chad Barb committed
52 53 54
);

$followups = array(
Jay Lepreau's avatar
Jay Lepreau committed
55
'Any elaborations, comments, or suggestions?',
Chad Barb's avatar
Chad Barb committed
56

57 58
'If we were to expand as you suggested above, what kinds
 of qualitatively new experiments could you perform, if any?',
Chad Barb's avatar
Chad Barb committed
59

Jay Lepreau's avatar
Jay Lepreau committed
60 61 62
'Besides scale, are there any Emulab characteristics you were forced to
 "work around," or that prevented you from performing an experiment you
 wanted to?',
Chad Barb's avatar
Chad Barb committed
63

64 65
'What are we doing right?<br />Are there things we do well that you
 would like us to continue to focus on?'
Chad Barb's avatar
Chad Barb committed
66 67 68 69
);

PAGEHEADER("Emulab Survey");  

70 71
# echo "<h1>I think you are $effuid</h1>";

Chad Barb's avatar
Chad Barb committed
72
if ($submit) {
73
    global $TB_PROJECT_READINFO;
Chad Barb's avatar
Chad Barb committed
74

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
    if ($uid && ! $anonymous) {
	TBUserInfo($uid,$name,$mail);
	if ($name != "" && $mail != "") {
	    $from = "\"$name\" <$mail>";
	    $q = DBQueryWarn("select usr_affil from users where uid='$uid'");
	    $r = mysql_fetch_array($q);
	    $affil = $r['usr_affil'];
	    $plist = TBProjList($uid,$TB_PROJECT_READINFO);
	    $projects = "";
	    foreach ($plist as $proj => $grplist) {
		if ($projects != "") { $projects .= ", "; }
		$projects .= $proj;
		if (count($grplist)>1) {
		    $grps = "";
		    foreach ($grplist as $grp) {
			if ($grp==$proj) { continue; }
			if ($grps != "") { $grps .= ", "; }
			$grps .= "$grp";
		    }
		    $projects .= " (sub-group(s) $grps)";
		}
	    }
	} else {
	    $from = "$uid@emulab.net";
	}
    } else {
	$from = "$TBMAIL_OPS";
    }
    
104
    $mesg = "";
Chad Barb's avatar
Chad Barb committed
105
    if ($anonymous) {
106 107
	$mesg .= "\nSurvey Responder:    *Anonymous* (uid hash ='" . md5($effuid) . "' )\n";
	$mesg .= "Auth notes:          $uidnotes\n";
Chad Barb's avatar
Chad Barb committed
108
    } else {
109 110 111 112 113
        $mesg .= "\nSurvey Responder:    $effuid\n";
	$mesg .= "Auth notes:          $uidnotes\n";
	$mesg .= "Institution:         $affil\n";
	$mesg .= "Emulab Projects:     $projects\n";
	$mesg .= "Remote IP:           $REMOTE_ADDR\n";
Chad Barb's avatar
Chad Barb committed
114
    }
115
    if (strcmp($name,"")) {
116
    	$mesg .= "User-supplied name:  $name\n";
117 118 119 120
    }
    if (strcmp($email,"")) {
    	$mesg .= "User-supplied email: $email\n";
    }
121 122 123
    # Debugging...
    #print "\n<pre>\n$mesg\n</pre>\n"; return;
    $mesg .= "\n\n> Multiple Choice:\n";
Chad Barb's avatar
Chad Barb committed
124 125 126
    $foo = 0;
    for( $n = 0; $n < count($questions) - 1; $n += 2) {
	$foo++;
127
	$questionWord =  $questions[$n];
Chad Barb's avatar
Chad Barb committed
128

129 130 131 132 133 134 135 136
	$answerVar = "opt$n";
	$answerNum = $$answerVar;
	$answerWord = $answers[$answerNum];

	$questionWord = wordwrap( preg_replace( "/[\r\n\t ]+/", " ", $questionWord ), 70, "\n>    ");

	$mesg .= "> ($foo) " . $questionWord . "\n" .
		 "$answerNum. " . $answerWord   . "\n\n";
Chad Barb's avatar
Chad Barb committed
137 138
    }

139
    $mesg .= "\n\n> Free Response:\n";
Chad Barb's avatar
Chad Barb committed
140 141 142
    $foo = 0;
    for( $n = 0; $n < count($followups); $n++) {
	$foo++;
143 144 145 146 147 148 149 150 151
	$questionWord = $followups[$n];
	$answerVar = "fu$n";
	$answerWord = $$answerVar;

	$questionWord = wordwrap( preg_replace( "/[\r\n\t ]+/", " ", $questionWord ), 70, "\n>    ");
	$answerWord   = wordwrap( preg_replace( "/[\r\n\t ]+/", " ", $answerWord ),   70, "\n");

	$mesg .= "> (FR$foo) " . $questionWord . "\n\n" .
		 $answerWord . "\n\n\n";
Chad Barb's avatar
Chad Barb committed
152 153
    }

Mac Newbold's avatar
Mac Newbold committed
154 155 156 157
    if ($uid && ! $anonymous) {
	TBUserInfo($uid,$name,$mail);
	if ($name != "" && $mail != "") {
	    $from = "\"$name\" <$mail>";
158 159 160
	    $q = DBQueryWarn("select usr_affil from users where uid='$uid'");
	    $r = mysql_fetch_array($q);
	    $affil = $r['usr_affil'];
Mac Newbold's avatar
Mac Newbold committed
161 162 163 164 165 166 167
	} else {
	    $from = "$uid@emulab.net";
	}
    } else {
	$from = "$TBMAIL_OPS";
    }
    
Chad Barb's avatar
Chad Barb committed
168
#   testbed-survey@emulab.net
169
#    TBMAIL("newbold@flux.utah.edu",
170
    TBMAIL("testbed-survey@emulab.net",
Chad Barb's avatar
Chad Barb committed
171 172
	   "Survey Answers",
	   $mesg,
Mac Newbold's avatar
Mac Newbold committed
173
	   "From: $from\n".
174
	   "Reply-To: $TBMAIL_OPS");
Chad Barb's avatar
Chad Barb committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188

    if ($anonymous) {
	echo "<i>Answers reported anonymously.</i><br />\n";
    }

    echo "<h2>Thank you for filling out the survey!</h2>".
         "<h4>Please feel free to ".
	 "<a href='mailto:testbed-ops@flux.utah.edu'>".
         "Email testbed-ops</a> with any further comments.</h4>";

    PAGEFOOTER();
    return;
}

189 190
echo "<form action='survey.php3' method='post'>";

191 192
if (0 == strcmp($effuid, "unknown")) {
    echo "<h3>If you have an account, please ";
193
    echo "<a href=\"$TBBASE/login.php3?refer=1\">log in</a>. ";
194 195
    echo "If you don't have an account or don't remember your password, ";
    echo "don't worry-- fill out the form anyway!</h3>\n";
196 197 198 199 200 201 202
    echo "<p>If you don't have an account, you can\n";
    echo "provide the following infomation: (<i>Not Required)</i></p>\n";
    echo "<center><table>";
    echo "<tr><th>Name</th><td><input name=\"name\"\></td></tr>\n";
    echo "<tr><th>Email</th><td><input name=\"email\"\></td>\n";
    echo "</table></center>";

203 204
}

Chad Barb's avatar
Chad Barb committed
205
echo "<p>";
206 207 208 209
echo "We are planning to grow the Emulab cluster and need you to tell us what's
    important to you-- or why it still won't be much good for your research or
    teaching.  Please answer at least the multiple choice section; it's quick!
    If you've never used Emulab, be sure to tell us why, in a text box below.";
Chad Barb's avatar
Chad Barb committed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
  
echo "</p>";

echo "<center>";
echo "<input type='checkbox' name='anonymous' value='1'><b>Report my answers anonymously</b></input>";
echo "<h2>$intro</h2>";
echo "<table>";


for( $n = 0; $n < count($questions) - 1; $n += 2) {
    $q =  $questions[$n];
    $q2 = $questions[$n + 1];
    echo "<tr>";
    echo "<td>";
    echo "<font size='-1'><b>$q</b></font><br />\n";
    echo "<font size='-2'>$q2</font></td>";

    echo "<td>
          <select name='opt$n'>";
    $an = 0;
    $foo = "selected";
    foreach ($answers as $a) {
	echo "<option value='$an' $foo>$a</option>\n";
	$foo = "";
	$an++;
    }
    echo "</select></td>";
    echo "</tr>";
}

echo "</table>";
echo "<br><br>";
echo "<table class='stealth' cellpadding=0 cellspacing=0 border=0 width=50%>";
for( $n = 0; $n < count($followups); $n++) {
    $fu = $followups[$n];
    echo "<tr><td align='center' class='stealth'>";
    echo "<b>$fu</b>";
    echo "</td></tr><tr><td align='center' class='stealth'>";
    echo "<textarea name='fu$n' cols='60' rows='8'></textarea>";
    echo "</td></tr>";
    echo "<tr><td class='stealth'><br />&nbsp;</tr></tr>";
}
echo "</table>";

echo "<div style='border: 1px solid #000000; padding: 8px; background-color: #FFFFE7;'>";
echo "<font size='+1'><b>Thanks for your feedback!</b></font><br /><br />\n";

echo "<input type='submit' name='submit' value='   Submit   '>";
echo "</div>";
echo "</form>";
echo "</center>";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>