1<?php 2include('../Code/confHeader.inc'); 3$_SESSION[Me] -> goIfInvalid("../index.php"); 4$_SESSION[Me] -> goIfNotChair('../index.php'); 5$Conf -> connect(); 6include("../Author/PaperForm.inc"); 7?> 8 9<html> 10<?php $Conf->header("Modify Paper #$_REQUEST[paperId] for $Conf->shortName") ?> 11 12<body> 13<?php 14if (!IsSet($_REQUEST[paperId]) ) { 15 $Conf -> errorMsg("You didn't specify a paper to modify."); 16 exit; 17} 18// 19// Process any updates 20// 21if (IsSet($_REQUEST[submit])) { 22 if (!IsSet($_REQUEST[title]) || !IsSet($_REQUEST[abstract]) || !IsSet($_REQUEST[authorInfo]) || !IsSet($_REQUEST[contactId])) { 23 $Conf->errorMsg("One or more of the required fields is not set. " 24 . "Please press BACK and correct this. "); 25 } else if ($_REQUEST[contactId] == -1) { 26 $Conf->errorMsg("You forgot to set the Contact Email"); 27 } else { 28 if (!IsSet($_REQUEST[finalized])) { 29 $_REQUEST[finalized] = 0; 30 } 31 32 if (!IsSet($_REQUEST[withdrawn])) { 33 $_REQUEST[withdrawn] = 0; 34 } 35 36 $_REQUEST[title] = addslashes($_REQUEST[title]); 37 $_REQUEST[abstract] = addslashes($_REQUEST[abstract]); 38 $_REQUEST[authorInfo] = addslashes($_REQUEST[authorInfo]); 39 $_REQUEST[authorsResponse] = addslashes($_REQUEST[authorsResponse]); 40 $query="UPDATE Paper SET " 41 . "contactId='$_REQUEST[contactId]', " 42 . "title='$_REQUEST[title]', " 43 . "abstract='$_REQUEST[abstract]', " 44 . "acknowledged='$_REQUEST[finalized]', " 45 . "withdrawn='$_REQUEST[withdrawn]', " 46 . "authorsResponse='$_REQUEST[authorsResponse]', " 47 . "authorInformation='$_REQUEST[authorInfo]' " 48 . "WHERE paperId=$_REQUEST[paperId] "; 49 ; 50 51 $result = $Conf->q($query); 52 if (DB::isError($result)) { 53 $Conf->errorMsg("Update failed: " . $result->getMessage()); 54 exit; 55 } else { 56 $Conf->infoMsg("Updated information for #$_REQUEST[paperId]"); 57 58 $Conf->log("Updated paper information for $_REQUEST[paperId]", $_SESSION[Me]); 59 60 if ( ! IsSet($_FILES[uploadedFile]) || $_FILES[uploadedFile] == "none" || !file_exists($_FILES[uploadedFile][tmp_name])) { 61 $Conf->errorMsg("Did NOT change the paper itself"); 62 } else { 63 $Conf->errorMsg("Paper #$_REQUEST[paperId] being updated"); 64 $fn = fopen($_FILES[uploadedFile][tmp_name], "r"); 65 66 if ( ! $fn ) { 67 $Conf->errorMsg("There was an error opening the file to store your paper." 68 . "Please press BACK and try again."); 69 } else { 70 71 $result = $Conf->q("DELETE FROM PaperStorage " 72 . " WHERE ( PaperStorage.paperId='$_REQUEST[paperId]' )"); 73 74 if (! $result) { 75 $Conf->errorMsg("Could not delete the paper, may be necessary for replacing."); 76 } 77 else { 78 79 $result = $Conf -> storePaper($_FILES[uploadedFile], 80 $_FILES[uploadedFile][type], 81 $_REQUEST[paperId]); 82 83 if (DB::isError($result)) { 84 $Conf->errorMsg("There was an error opening the file to store your paper." 85 . "Please press BACK and try again."); 86 $Conf->errorMsg("msg is " . $result->getMessage()); 87 } else { 88 $Conf->infoMsg("Looks like paper #$_REQUEST[paperId] was updated, but confirm it"); 89 90 $Conf->log("Replace paper $_REQUEST[paperId]", $_SESSION[Me]); 91 } 92 93 } 94 } 95 } 96 97 if ( IsSet($_REQUEST[topics]) ) { 98 setTopics($_REQUEST[paperId], 99 $_REQUEST[topics]); 100 } 101 102 if ( IsSet($_REQUEST[preferredReviewers]) ) { 103 setPreferredReviewers($_REQUEST[paperId], 104 $_REQUEST[preferredReviewers]); 105 } 106 } 107 } 108} 109 110 111 $query = "SELECT title, abstract, authorInformation, " 112 . " acknowledged, withdrawn, contactId, authorsResponse " 113 . " FROM Paper " 114 . " WHERE Paper.paperId=$_REQUEST[paperId]"; 115 116 $result = $Conf->q($query); 117 if (DB::isError($result) ) { 118 $Conf->errorMsg("Unable to read information about paper: " 119 . $result->getMessage()); 120 exit; 121 } 122 123$row = $result->fetchRow(); 124$_REQUEST[title]=$row[0]; 125$_REQUEST[abstract]=$row[1]; 126$_REQUEST[authorInfo]=$row[2]; 127$_REQUEST[finalized]=$row[3]; 128$_REQUEST[withdrawn]=$row[4]; 129$_REQUEST[contactId]=$row[5]; 130$_REQUEST[authorsResponse]=$row[6]; 131$_REQUEST[topics] = getTopics($_REQUEST[paperId]); 132$_REQUEST[preferredReviewers] = getPreferredReviewers($_REQUEST[paperId]); 133 134?> 135 136<p> 137Modify any of the following information, and then hit "Update Paper" 138at the top or bottom of the page. 139</p> 140 141<table> 142<tr> 143<td> 144<?php 145$Conf->buttonWithPaperId("Click here to go back to viewing the paper", 146 "../PC/PCAllAnonReviewsForPaper.php", 147 $_REQUEST[paperId]); 148 149print "</td><td>"; 150$Conf->textButton("Click here to go to the paper list", 151 "../Assistant/AssistantListPapers.php"); 152?> 153</td> 154</tr> 155</table> 156 157<form method="POST" action="<?php echo $_SERVER[PHP_SELF] ?>" 158ENCTYPE="multipart/form-data" > 159<?php echo $Conf->mkHiddenVar('paperId', $_REQUEST[paperId])?> 160<center> <input type="submit" value="Update" name="submit"> </center> 161 162<table border="0" width="100%" bgcolor="<?php echo $Conf->bgOne ?>"> 163 164<tr> 165<th align=left> Contact Email </th> 166<td> 167<SELECT name=contactId SINGLE> 168 <?php 169 $q2 = "SELECT ContactInfo.contactId, ContactInfo.firstName, ContactInfo.lastName, ContactInfo.email " 170. " FROM ContactInfo ORDER BY ContactInfo.email"; 171 $r2 = $Conf->qe($q2); 172 print "<OPTION VALUE=\"-1\"> Remember to select a contact!</OPTION>"; 173 if ($r2) { 174 while($row2=$r2->fetchRow()) { 175 print "<OPTION VALUE=\"$row2[0]\" "; 176 if ( $row2[0] == $_REQUEST[contactId]) { 177 print " SELECTED "; 178 } 179 print "> $row2[1] $row2[2] ($row2[3]) </OPTION>"; 180 } 181 } 182?> 183</SELECT> 184</td> 185</tr> 186<tr> 187<th align=left> Finalized? </th> 188<td> 189<INPUT type=checkbox name=finalized value=1 190<?php if ($_REQUEST[finalized]) echo "CHECKED"?> Yes 191</td> 192</tr> 193 194<tr> 195<th align=left> Withdrawn? </th> 196<td> 197<INPUT type=checkbox name=withdrawn value=1 198<?php if ($_REQUEST[withdrawn]) echo "CHECKED"?> Yes 199</td> 200</tr> 201 202<tr> 203 <th align=left>Location of PDF or PostScript File</th> 204 <td> <input type="file" name="uploadedFile" ACCEPT="text/pdf" size="69"></td> 205</tr> 206<?php 207// 208// Rest is standard form -- this will cause submit button " 209// 210paperForm($Conf, $_REQUEST[title], $_REQUEST[abstract], $_REQUEST[authorInfo], 211 $_REQUEST[collaborators], $_REQUEST[topics], $_REQUEST[preferredReviewers]); 212?> 213<div align="center"> <center> 214<p> <input type="submit" value="Update" name="submit"> </p> 215</center> </div> 216</form> 217 218<?php $Conf->footer() ?> 219 220</body> 221 222</html> 223