1<?php
2
3function paperForm( $Conf, $title="", $abstract="", $authorInfo="", $collaborators="", $topics=array(), $preferredReviewers=array() )
4{
5?>
6<table border="0" width="100%" bgcolor="<?php echo $Conf->bgOne ?>">
7<tr>
8  <td valign="top"><P><STRONG>Title</STRONG></P></td>
9  <td valign="top"> <input type="text" name="title" size="75"
10	value="<?php echo stripslashes($title)?>"
11	MAXLENGTH=200></td>
12</tr>
13
14<tr>
15<td valign="top"><P><STRONG>Abstract</STRONG></P> <P>Maximum 200 words.</P> </td>
16<td valign="top"><textarea rows="30" name="abstract" cols="75"><?php echo stripslashes($abstract)?></textarea> </td>
17</tr>
18
19<tr>
20  <td valign="top"><P><STRONG>Author Information</STRONG></P>
21      <P>List all authors and their affiliation in order of appearance.
22Please list one author per line.</P></td>
23  <td valign="top"> <textarea rows=10 name="authorInfo" cols=75><?php echo stripslashes($authorInfo)?></textarea></td>
24</tr>
25
26<tr>
27  <td valign="top"><P><STRONG>Collaborators and Other Affiliations for <EM>ALL</EM>
28Authors of the Paper</STRONG></P>
29<P>List all persons in alphabetical order (including their current
30affiliations) who are currently, or who have been collaborators or
31co-authors in the past.  This includes your advisor, students,
32and collaborators.  Be sure to include PC members in that list of collaborators. Please list one person per line.  This is
33used to avoid conflicts of interest when papers are assigned.</P>
34</td>
35  <td valign="top"> <textarea rows=20 name="collaborators" cols=75><?php echo stripslashes($collaborators)?></textarea></td>
36</tr>
37<TR><TD BGCOLOR='White' COLSPAN=2></TD></TR>
38<?php
39$query="SELECT TopicArea.topicAreaId, TopicArea.topicName FROM TopicArea ";
40$result = $Conf->q($query);
41if ( DB::isError($result) ) {
42  $Conf->errorMsg("Error in query " . $result->getMessage());
43} else if ($result->numRows() > 0) {
44?>
45 <tr>
46    <td valign="top" width="16%" height="19"><P><STRONG>Topics</STRONG></P> <P>Please mark
47              all topics that apply to your submission.  This will
48              be used to help match reviewers to your
49              paper.  Select at least one.</P></td>
50    <td valign="top" width="84%" height="19">
51<?php
52  while ($row = $result->fetchRow()) {
53    $id = $row[0];
54    $topic = $row[1];
55    if (IsSet($topics[$id])) {
56      $checked = " CHECKED ";
57    } else {
58      $checked ="";
59    }
60    print "<INPUT type=checkbox name=topics[] value=$id $checked> $topic <br>";
61  }
62?>
63</td>
64</tr>
65<?php
66	      }
67
68 if ( $Conf->allowReviewerPreferences ) {
69?>
70
71<TR><TD BGCOLOR='White' COLSPAN=2></TD></TR>
72<?php
73$query="SELECT ContactInfo.contactId, ContactInfo.firstName, ContactInfo.lastName, ContactInfo.email "
74  . " FROM ContactInfo, PCMember WHERE ContactInfo.contactId=PCMember.contactId "
75  . " ORDER BY ContactInfo.lastName";
76
77$result = $Conf->qe($query);
78if ( DB::isError($result) ) {
79  $Conf->errorMsg("Error in query " . $result->getMessage());
80} else if ($result->numRows() > 0) {
81?>
82 <tr>
83    <td valign="top" width="16%" height="19"><P><STRONG>Reviewer preferences of PC Members</STRONG></P> <P>Please mark
84              all PC members that you have a preference for reviewing you paper.  This will
85              be used to help match reviewers to your
86              paper.  Select at least one, or the "NO PREFERENCE" box at the end of the list.</P></td>
87    <td valign="top" width="84%" height="19">
88<?php
89  while ($row = $result->fetchRow()) {
90    $id = $row[0];
91    $fn = $row[1];
92    $ln = $row[2];
93    $em = $row[3];
94    if (IsSet($preferredReviewers[$id])) {
95      $checked = " CHECKED ";
96    } else {
97      $checked ="";
98    }
99    print "<INPUT type=checkbox name=preferredReviewers[] value=$id $checked> $fn $ln ($em) <br>";
100  }
101?>
102</td>
103</tr>
104<?php
105              }
106 }
107?>
108
109</table>
110<?php
111}
112
113
114function setPreferredReviewers($paperId, $contactList = array())
115{
116  //
117  // Remove old preferred reviewers for this paper
118  //
119  global $Conf;
120  $Conf->qe("DELETE FROM PaperReviewerPreference WHERE paperId='"
121	    . $_REQUEST[paperId] . "'");
122  for ($i = 0; $i < sizeof($_REQUEST[preferredReviewers]); $i++) {
123    $thisconflict=$_REQUEST[preferredReviewers][$i];
124    $query="INSERT into PaperReviewerPreference SET "
125      . " contactId='$thisconflict', "
126      . " paperId='$_REQUEST[paperId]' "
127      ;
128    $result2 = $Conf->q($query);
129    if ( DB::isError($result2) ) {
130      $Conf->errorMsg("I was unable to associate one of your preferences "
131		      . "with your paper due to a database error. "
132		      . "The message was " . $result2->getMessage()
133		      );
134    }
135  }
136}
137
138function getPreferredReviewers($paperId)
139{
140  global $Conf;
141
142  $prefs = array();
143  $query="SELECT contactId FROM PaperReviewerPreference WHERE paperId='$paperId'";
144  $result = $Conf->q($query);
145  if ( ! DB::isError($result) ) {
146    while ($row = $result->fetchRow()) {
147      $p = $row[0];
148      $prefs[$p] = 1;
149    }
150  }
151  return $prefs;
152}
153
154function setTopics($paperId, $topics=array())
155{
156  global $Conf;
157  //
158  // Delete any old topic associations
159  //
160  $query="DELETE FROM PaperTopic WHERE paperId=$paperId";
161  $Conf->q($query);
162  //
163  // Now, update the paper topics..
164  //
165  for ($i = 0; $i < sizeof($topics); $i++) {
166    $thistopic=$topics[$i];
167    $query="INSERT into PaperTopic SET "
168      . " topicId='$thistopic', "
169      . " paperId='$paperId' "
170      ;
171    $result = $Conf->q($query);
172    if ( DB::isError($result) ) {
173      $Conf->errorMsg("I was unable to associate one of your topics "
174		      . "with your paper due to a database error. "
175		      . "The message was " . $result->getMessage()
176		      );
177    }
178  }
179}
180
181function getTopics($paperId)
182{
183  global $Conf;
184
185  $query="SELECT PaperTopic.topicId FROM PaperTopic "
186    . " WHERE PaperTopic.paperId=$_REQUEST[paperId] ";
187  $result = $Conf->q($query);
188  $topics=array();
189  if ( DB::isError($result) ) {
190    $Conf->errorMsg("Error in query " . $result->getMessage());
191  } else if ($result->numRows() > 0) {
192    while($row=$result->fetchRow()) {
193      $topic=$row[0];
194      $topics[$topic] = 1;
195    }
196  }
197  return $topics;
198}
199
200?>
201
202