1<?php
2include('../Code/confHeader.inc');
3$_SESSION[Me] -> goIfInvalid("../index.php");
4$_SESSION[Me] -> goIfNotAuthor("../index.php");
5$Conf -> goIfInvalidActivity("authorRespondToReviews", "../index.php");
6$Conf -> connect();
7
8$word_limit = 800;
9?>
10
11<html>
12
13<?php  $Conf->header("Submit Response to paper reviews for #$_REQUEST[paperId]") ?>
14
15<body>
16
17<p>
18You can submit responses to your paper review
19<?php  echo $Conf->printTimeRange('authorRespondToReviews') ?>. <br>
20You can continue modifying or  updating the stored response until then.
21You will receive email messages each time a new review is finalized, but you
22should periodically submit your response as you revise the response to
23insure you do not miss the response deadline.  </p>
24
25
26<?php
27
28$Conf->infoMsg(
29   '<P ALIGN=CENTER>INSTRUCTIONS</P><P> ' .
30   'The "author response" should be addressed to the program ' .
31   'committee. The program committee will use this information in ' .
32   'conjunction with the reviews to reach a final determination concerning ' .
33   'the paper. You should keep your response brief and to the point, since ' .
34   'each program committee member is responsible for many papers. ' .
35   '</P><P> ' .
36   'The authors response is a mechanism to address reviewers concerns, to ' .
37   'address reviewer confusion, or to address incorrect reviews.  It is ' .
38   'not a mechanism to augment the content or form of the paper, or to ' .
39   're-argue the paper --- the conference deadline has passed and the ' .
40   'program committee must evaluate the papers on the merits of what is ' .
41   'included in the paper, not on additional information submitted at this ' .
42   'time.</P> '
43	       );
44$Conf->infoMsg(
45   'The response is limited to only ' . $word_limit . ' words.  This limit is enforced by ' .
46   'the conference review software.  Your response will not be accepted ' .
47   'until it is within the ' . $word_limit . ' limit word.  You can press on "Submit Your ' .
48   'Response" to see how many words you have in your response.  YOUR ' .
49   'RESPONSE WILL ONLY BE SAVED IF IT IS WITHIN THE ' . $word_limit . ' WORD LIMIT. '
50	       );
51
52
53if ( ! $_SESSION[Me] -> amPaperAuthor($_REQUEST[paperId], $Conf) ) {
54  $Conf->errorMsg("You aren't supposed to be able to respond for paper #$_REQUEST[paperId]. "
55		  . "If you think this is in error, contact the program chair. ");
56  exit;
57}
58
59//
60// Make certain that the author has submitted all their reviews
61// prior to viewing their own reviews
62
63if( 0 ){
64$missingReviews = $Conf->listMissingReviews($_SESSION[Me]->contactId);
65
66if ($missingReviews) {
67  $Conf->errorMsg("Before you can submit a response for your paper, "
68		  . " you must finish reviewing the papers you were "
69		  . " asked to review, or you must tell the program "
70		  . " committee member that you can not finish your "
71		  . " reviews. ");
72  exit();
73}
74}
75
76
77//
78// Process any submissions
79//
80
81if (IsSet($_REQUEST['submit'])) {
82//  $str = $_REQUEST['authorsResponse'];
83//  $_REQUEST['authorsResponse'] =
84//    preg_replace('/^(\s*(\S+\s+){' . $word_limit . '})(\S)/', "\$1 LIMIT_REACHED \$3", $str);
85//  if( $str != $_REQUEST['authorsResponse'] ){
86//    $Conf->errorMsg("Response not  updated -- limit of $word_limit words exceeded.");
87  $num_words = preg_match_all( '/\S+/', $_REQUEST['authorsResponse'], $junk );
88  if( $num_words > $word_limit ){
89    $Conf->errorMsg("Response not  updated -- limit of $word_limit words exceeded by " . ($num_words-$word_limit) . " words.");
90  } else {
91    $Conf->infoMsg("Updating the response ($num_words of $word_limit words used)");
92    $set = "authorsResponse='" . addslashes($_REQUEST[authorsResponse]) . "'";
93    $query="UPDATE Paper SET $set WHERE paperId='$_REQUEST[paperId]' and contactId='" . $_SESSION[Me]->contactId . "'";
94    $result = $Conf->qe($query);
95
96    if ( !DB::isError($result) ) {
97      $Conf->confirmMsg("Successfully updated response");
98    } else {
99      $Conf->errorMsg("Error in updating response: " . $result->getMessage());
100      $Conf->log("Error in updating response for  $_REQUEST[paperId]: " . $result->getMessage(), $_SESSION[Me]);
101    }
102  }
103} else {
104
105  //
106  // Check to see if they've already submitted a review for this paper,
107  // and if so, provide them the values from their prior review
108  //
109  $query = "SELECT authorsResponse FROM Paper WHERE paperId='$_REQUEST[paperId]'";
110
111  $result=$Conf->qe($query);
112  if (!DB::isError($result)) {
113    if ( $row=$result->fetchRow() ) {
114      $_REQUEST[authorsResponse] = stripslashes($row[0]);
115    }
116  } else {
117    $Conf->errorMsg("Error in query: " . $result->getMessage());
118  }
119}
120?>
121
122<form METHOD="POST" ACTION="<?php echo $_SERVER[PHP_SELF] ?>">
123<?php echo $Conf->mkHiddenVar('paperId', $_REQUEST[paperId])?>
124<table border=1 align=center bgcolor=<?php echo $Conf->bgOne?>>
125<tr> <td align=center>
126<INPUT TYPE=submit NAME=submit VALUE="Submit your response to the reviews">
127</td> </tr>
128<tr> <th> Response </th> </tr>
129<tr> <td>
130<textarea NAME=authorsResponse rows=30 cols=70><?php echo $_REQUEST[authorsResponse]?></textarea>
131</td> </tr>
132<tr><td align=center>
133<INPUT TYPE=submit NAME=submit VALUE="Submit your response to the reviews"><BR>
134</td></tr>
135</table>
136</form>
137</body>
138
139<?php  $Conf->footer() ?>
140</html>
141