| 1 | <% import MaKaC.webinterface.urlHandlers as urlHandlers %> |
|---|
| 2 | <% from MaKaC.common.timezoneUtils import nowutc %> |
|---|
| 3 | <% from MaKaC.conference import ContribStatusNone %> |
|---|
| 4 | |
|---|
| 5 | <% dueDateFormat = "%a %d %b %Y" %> |
|---|
| 6 | <% color = '' %> |
|---|
| 7 | <% if not ConfReview.hasReviewing(): %> |
|---|
| 8 | <p style="padding-left: 25px;"><font color="gray"><%= _("Type of reviewing has not been chosen yet")%></font></p> |
|---|
| 9 | <% end %> |
|---|
| 10 | <% else: %> |
|---|
| 11 | <% if len(Conference.getContributionListSortedById()) == 0: %> |
|---|
| 12 | <p style="padding-left: 25px;"><font color="gray"><%= _("There are no contributions to assign.")%></font></p> |
|---|
| 13 | <% end %> |
|---|
| 14 | <%else:%> |
|---|
| 15 | <table> |
|---|
| 16 | <tr> |
|---|
| 17 | <td align="bottom"> |
|---|
| 18 | <div id="showHideFilteringHelp" style="padding-top:30px; margin-left:20px;"><div id="showHideFiltering" style="display:inline"></div></div> |
|---|
| 19 | </td> |
|---|
| 20 | <td align="bottom" style="padding-left:10px; padding-top:27px;"> |
|---|
| 21 | <div><%= _("Displaying ")%><span id="contributionsToShow" style="font-size:15px; font-weight: bold;"></span></div> |
|---|
| 22 | </td> |
|---|
| 23 | <td align="bottom" style="padding-top:27px;"> |
|---|
| 24 | <div id="totalContributions" style="display:none;"><span><%=_(" ( Total: ")%></span><span style="font-size:15px; font-weight: bold;"><%= len(Conference.getContributionListSortedById()) %></span> |
|---|
| 25 | <span><%=_(" )")%></span> |
|---|
| 26 | </div> |
|---|
| 27 | </td> |
|---|
| 28 | </tr> |
|---|
| 29 | </table> |
|---|
| 30 | <br/> |
|---|
| 31 | <table id="filteringTable" class="shadowRectangle" width="95%%" align="left" style="margin-left:20px; margin-bottom: 20px;"> |
|---|
| 32 | <thead> |
|---|
| 33 | <tr style="text-align:left;"> |
|---|
| 34 | <td nowrap class="titleCellFormat" style="border-bottom:1px solid #BBBBBB;"> |
|---|
| 35 | <%= _("types ")%><img src="<%= Config.getInstance().getSystemIconURL("checkAll") %>" alt="Select all" title="Select all" onclick="selectAll('selTypes')" style="border:none;"><img src="<%= Config.getInstance().getSystemIconURL("uncheckAll") %>" alt="Deselect all" title="Deselect all" onclick="deselectAll('selTypes')" style="border:none;"> |
|---|
| 36 | </td> |
|---|
| 37 | <td nowrap class="titleCellFormat" style="border-bottom:1px solid #BBBBBB;"> |
|---|
| 38 | <%= _("sessions")%><img src="<%= Config.getInstance().getSystemIconURL("checkAll") %>" alt="Select all" title="Select all" onclick="selectAll('selSessions')" style="border:none;"><img src="<%= Config.getInstance().getSystemIconURL("uncheckAll") %>" alt="Deselect all" title="Deselect all" onclick="deselectAll('selSessions')" style="border:none;"> |
|---|
| 39 | </td> |
|---|
| 40 | <td nowrap class="titleCellFormat" style="border-bottom:1px solid #BBBBBB;"> |
|---|
| 41 | <%= _("tracks")%><img src="<%= Config.getInstance().getSystemIconURL("checkAll") %>" alt="Select all" title="Select all" onclick="selectAll('selTracks')" style="border:none;"><img src="<%= Config.getInstance().getSystemIconURL("uncheckAll") %>" alt="Deselect all" title="Deselect all" onclick="deselectAll('selTracks')" style="border:none;"> |
|---|
| 42 | </td> |
|---|
| 43 | <td nowrap class="titleCellFormat" style="border-bottom:1px solid #BBBBBB;"> |
|---|
| 44 | <%= _("assign status")%> |
|---|
| 45 | </td> |
|---|
| 46 | </tr> |
|---|
| 47 | </thead> |
|---|
| 48 | <tbody> |
|---|
| 49 | <tr style="vertical-align:top"> |
|---|
| 50 | <td> |
|---|
| 51 | <table cellpadding="0px" cellspacing="0px" border="0px"> |
|---|
| 52 | <tr> |
|---|
| 53 | <td><input type="checkbox" id="typeShowNoValue" name="selTypes" value="not specified" checked/></td> |
|---|
| 54 | <td> --<%= _("not specified")%>--</td> |
|---|
| 55 | </tr> |
|---|
| 56 | <% for type in self._conf.getContribTypeList(): %> |
|---|
| 57 | <tr> |
|---|
| 58 | <td><input type="checkbox" name="selTypes" value="<%=type.getId()%>" checked></td> |
|---|
| 59 | <td><%= type.getName() %></td> |
|---|
| 60 | </tr> |
|---|
| 61 | <% end %> |
|---|
| 62 | </table> |
|---|
| 63 | </td> |
|---|
| 64 | <td> |
|---|
| 65 | <table cellpadding="0px" cellspacing="0px" border="0px"> |
|---|
| 66 | <tr> |
|---|
| 67 | <td><input type="checkbox" id="sessionShowNoValue" name="selSessions" value="not specified" checked/></td> |
|---|
| 68 | <td> --<%= _("not specified")%>--</td> |
|---|
| 69 | </tr> |
|---|
| 70 | <% for s in self._conf.getSessionListSorted(): %> |
|---|
| 71 | <tr> |
|---|
| 72 | <td><input type="checkbox" name="selSessions" value="<%=s.getId()%>" checked></td> |
|---|
| 73 | <td><%= s.getTitle() %></td> |
|---|
| 74 | </tr> |
|---|
| 75 | <% end %> |
|---|
| 76 | </table> |
|---|
| 77 | </td> |
|---|
| 78 | <td> |
|---|
| 79 | <table cellpadding="0px" cellspacing="0px" border="0px"> |
|---|
| 80 | <tr> |
|---|
| 81 | <td><input type="checkbox" id="trackShowNoValue" name="selTracks" value="not specified" checked/></td> |
|---|
| 82 | <td> --<%= _("not specified")%>--</td> |
|---|
| 83 | </tr> |
|---|
| 84 | <% for t in Conference.getTrackList(): %> |
|---|
| 85 | <tr> |
|---|
| 86 | <td><input type="checkbox" name="selTracks" value="<%=t.getId()%>" checked></td> |
|---|
| 87 | <td><%= t.getTitle() %></td> |
|---|
| 88 | </tr> |
|---|
| 89 | <% end %> |
|---|
| 90 | </table> |
|---|
| 91 | </td> |
|---|
| 92 | <td> |
|---|
| 93 | <table style="list-style-type:none"> |
|---|
| 94 | <% if not IsOnlyReferee: %> |
|---|
| 95 | <tr><td><input type="checkbox" id="showWithReferee" checked/> <%= _("With Referee assigned")%></td></tr> |
|---|
| 96 | <% end %> |
|---|
| 97 | <tr><td><input type="checkbox" id="showWithEditor" checked/> <%= _("With Layout Reviewer assigned")%></td></tr> |
|---|
| 98 | <tr><td><input type="checkbox" id="showWithReviewer" checked/> <%= _("With at least 1 Content Reviewer assigned")%></td></tr> |
|---|
| 99 | |
|---|
| 100 | </table> |
|---|
| 101 | </td> |
|---|
| 102 | </tr> |
|---|
| 103 | <tr> |
|---|
| 104 | <td id="applyFilterHelp" colspan="4" style="text-align:center; padding-top:5px;"> |
|---|
| 105 | <input id="applyFilter" type="button" class="popUpButton" value="Apply filter"/> |
|---|
| 106 | </td> |
|---|
| 107 | </tr> |
|---|
| 108 | </tbody> |
|---|
| 109 | </table> |
|---|
| 110 | |
|---|
| 111 | <table class="shadowRectangleSoft" width="95%%"> |
|---|
| 112 | <% if not IsOnlyReferee and not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 113 | <tr> |
|---|
| 114 | <td><%= _("Referee")%>:</td> |
|---|
| 115 | <td id="assignRefereeHelp"> |
|---|
| 116 | <a id="assignRefereeButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 117 | <span id="assignMenu_referee_top" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 118 | <a id="assignRefereePerTrackButton_top" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 119 | </a> |
|---|
| 120 | </span>| |
|---|
| 121 | <a id="removeRefereeButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a> |
|---|
| 122 | </td> |
|---|
| 123 | </tr> |
|---|
| 124 | <% end %> |
|---|
| 125 | <%if not (ConfReview.getChoice() == 2 or ConfReview.getChoice() == 1):%> |
|---|
| 126 | <tr> |
|---|
| 127 | <td><%= _("Layout Reviewer")%>:</td> |
|---|
| 128 | <td id="assignEditorHelp"> |
|---|
| 129 | <a id="assignEditorButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 130 | <span id="assignMenu_editor_top" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 131 | <a id="assignEditorPerTrackButton_top" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 132 | </a> |
|---|
| 133 | </span>| |
|---|
| 134 | <a id="removeEditorButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a> |
|---|
| 135 | </td> |
|---|
| 136 | </tr> |
|---|
| 137 | <% end %> |
|---|
| 138 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 139 | <tr> |
|---|
| 140 | <td><%= _("Content Reviewers")%>:</td> |
|---|
| 141 | <td id="assignReviewerHelp"> |
|---|
| 142 | <a id="addReviewerButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 143 | <span id="assignMenu_reviewer_top" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 144 | <a id="assignReviewerPerTrackButton_top" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 145 | </a> |
|---|
| 146 | </span>| |
|---|
| 147 | <a id="removeReviewerButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a>| |
|---|
| 148 | <a id="removeAllReviewersButton_top" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove All")%> |
|---|
| 149 | </td> |
|---|
| 150 | </tr> |
|---|
| 151 | <% end %> |
|---|
| 152 | </table> |
|---|
| 153 | <!-- and not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1) --> |
|---|
| 154 | |
|---|
| 155 | <table style="padding-left:40px;"> |
|---|
| 156 | <tr> |
|---|
| 157 | <td style="padding-bottom: 5px; padding-top: 5px"> |
|---|
| 158 | <%= _("Select:") %> |
|---|
| 159 | </td> |
|---|
| 160 | <td nowrap class="titleCellFormat" style="padding-bottom: 20px; padding-top: 20px; border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF"> |
|---|
| 161 | <span onclick="selectAll('selectedContributions')" align="left" style="cursor:pointer;padding-bottom:5px;color:#0B63A5;list-style-type:none;" onmouseover="this.style.color='#E25300'" onmouseout="this.style.color='#0B63A5'"> |
|---|
| 162 | <%= _("All")%> |
|---|
| 163 | </span>, |
|---|
| 164 | <span onclick="deselectAll('selectedContributions')" align="left" style="cursor:pointer;padding-bottom:5px;color:#0B63A5;list-style-type:none;" onmouseover="this.style.color='#E25300'" onmouseout="this.style.color='#0B63A5'"> |
|---|
| 165 | <%= _("None")%> |
|---|
| 166 | </span> |
|---|
| 167 | </td> |
|---|
| 168 | </tr> |
|---|
| 169 | </table> |
|---|
| 170 | <table class="Revtab" width="95%%" cellspacing="0" align="center" border="0" style="padding-left:20px; margin-bottom:1em"> |
|---|
| 171 | <!-- |
|---|
| 172 | <tr> |
|---|
| 173 | <td nowrap class="groupTitle" colspan=4>Contributions to judge as Referee</td> |
|---|
| 174 | </tr> |
|---|
| 175 | --> |
|---|
| 176 | <thead> |
|---|
| 177 | <tr> |
|---|
| 178 | <td></td> |
|---|
| 179 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 180 | <%= _("Id")%> |
|---|
| 181 | </td> |
|---|
| 182 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 183 | <%= _("Title")%> |
|---|
| 184 | </td> |
|---|
| 185 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 186 | <%= _("Type")%> |
|---|
| 187 | </td> |
|---|
| 188 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 189 | <%= _("Track")%> |
|---|
| 190 | </td> |
|---|
| 191 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 192 | <%= _("Session")%> |
|---|
| 193 | </td> |
|---|
| 194 | <!-- |
|---|
| 195 | <td nowrap class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;"> |
|---|
| 196 | State |
|---|
| 197 | </td> |
|---|
| 198 | --> |
|---|
| 199 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 200 | <%= _("Reviewing team")%> |
|---|
| 201 | </td> |
|---|
| 202 | <td nowrap class="subGroupTitleAssignContribution" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 203 | <%= _("Deadline")%> |
|---|
| 204 | </td> |
|---|
| 205 | </tr> |
|---|
| 206 | <tr> |
|---|
| 207 | <td colspan="8" style="border-bottom: 1px solid grey"></td> |
|---|
| 208 | </tr> |
|---|
| 209 | </thead> |
|---|
| 210 | |
|---|
| 211 | <tbody id="tablebody"> |
|---|
| 212 | <% for c in Conference.getContributionListSortedById(): %> |
|---|
| 213 | <% rm = c.getReviewManager() %> |
|---|
| 214 | <% if not isinstance(c.getStatus(), ContribStatusNone): %> |
|---|
| 215 | <tr valign="top"> |
|---|
| 216 | <td></td> |
|---|
| 217 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 218 | <%= c.getId() %> |
|---|
| 219 | </td> |
|---|
| 220 | |
|---|
| 221 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 222 | <a href="<%= urlHandlers.UHContributionModifReviewing.getURL(c) %>"> |
|---|
| 223 | <%= c.getTitle() %> |
|---|
| 224 | </a> |
|---|
| 225 | </td> |
|---|
| 226 | |
|---|
| 227 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 228 | <% if c.getType(): %> |
|---|
| 229 | <%= c.getType().getName() %> |
|---|
| 230 | <% end %> |
|---|
| 231 | </td> |
|---|
| 232 | |
|---|
| 233 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 234 | <% if c.getTrack(): %> |
|---|
| 235 | <%= c.getTrack().getTitle() %> |
|---|
| 236 | <% end %> |
|---|
| 237 | </td> |
|---|
| 238 | |
|---|
| 239 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 240 | <% if c.getSession(): %> |
|---|
| 241 | <%= c.getSession().getTitle() %> |
|---|
| 242 | <% end %> |
|---|
| 243 | </td> |
|---|
| 244 | |
|---|
| 245 | <!-- |
|---|
| 246 | <td style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;"> |
|---|
| 247 | <% if rm.getLastReview().getRefereeJudgement().isSubmitted(): %> |
|---|
| 248 | <span style="color:green;"> |
|---|
| 249 | Judged: <%= rm.getLastReview().getRefereeJudgement().getJudgement() %> |
|---|
| 250 | </span> |
|---|
| 251 | <% end %> |
|---|
| 252 | <% else: %> |
|---|
| 253 | <span style="color:red;">Not judged yet<br> |
|---|
| 254 | <%= "<br>".join(rm.getLastReview().getReviewingStatus()) %> |
|---|
| 255 | </span> |
|---|
| 256 | <% end %> |
|---|
| 257 | </td> |
|---|
| 258 | --> |
|---|
| 259 | <td> |
|---|
| 260 | <ul> |
|---|
| 261 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 262 | <li> |
|---|
| 263 | <em><%= _("Referee")%>:</em> |
|---|
| 264 | </li> |
|---|
| 265 | <% end %> |
|---|
| 266 | <li> |
|---|
| 267 | <em><%= _("Layout Reviewer")%>:</em> |
|---|
| 268 | </li> |
|---|
| 269 | <li> |
|---|
| 270 | <em><%= _("Content Reviewers")%>:</em> |
|---|
| 271 | <ul> |
|---|
| 272 | <% for reviewer in rm.getReviewersList() :%> |
|---|
| 273 | <li>a</li> |
|---|
| 274 | <% end %> |
|---|
| 275 | </ul> |
|---|
| 276 | </li> |
|---|
| 277 | </ul> |
|---|
| 278 | </td> |
|---|
| 279 | |
|---|
| 280 | <td style="border-right:5px solid #FFFFFF; border-left:5px solid #FFFFFF;"> |
|---|
| 281 | <% date = rm.getLastReview().getAdjustedRefereeDueDate() %> |
|---|
| 282 | <% if date is None: %> |
|---|
| 283 | <%= _("Deadline not set.")%> |
|---|
| 284 | <% end %> |
|---|
| 285 | <% else: %> |
|---|
| 286 | <%= date.strftime(dueDateFormat) %> |
|---|
| 287 | <% end %> |
|---|
| 288 | </td> |
|---|
| 289 | </tr> |
|---|
| 290 | <% end %> |
|---|
| 291 | <% end %> |
|---|
| 292 | </tbody> |
|---|
| 293 | </table> |
|---|
| 294 | |
|---|
| 295 | <table class="shadowRectangleSoft" width="95%%" style="margin-top:10px;"> |
|---|
| 296 | <% if not IsOnlyReferee and not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 297 | <tr> |
|---|
| 298 | <td><%= _("Referee")%>:</td> |
|---|
| 299 | <td id="assignRefereeHelp"> |
|---|
| 300 | <a id="assignRefereeButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 301 | <span id="assignMenu_referee_bottom" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 302 | <a id="assignRefereePerTrackButton_top" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 303 | </a> |
|---|
| 304 | </span>| |
|---|
| 305 | <a id="removeRefereeButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a> |
|---|
| 306 | </td> |
|---|
| 307 | </tr> |
|---|
| 308 | <% end %> |
|---|
| 309 | <%if not (ConfReview.getChoice() == 2 or ConfReview.getChoice() == 1):%> |
|---|
| 310 | <tr> |
|---|
| 311 | <td><%= _("Layout Reviewer")%>:</td> |
|---|
| 312 | <td id="assignEditorHelp"> |
|---|
| 313 | <a id="assignEditorButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 314 | <span id="assignMenu_editor_bottom" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 315 | <a id="assignEditorPerTrackButton_bottom" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 316 | </a> |
|---|
| 317 | </span>| |
|---|
| 318 | <a id="removeEditorButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a> |
|---|
| 319 | </td> |
|---|
| 320 | </tr> |
|---|
| 321 | <% end %> |
|---|
| 322 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 323 | <tr> |
|---|
| 324 | <td><%= _("Content Reviewers")%>:</td> |
|---|
| 325 | <td id="assignReviewerHelp"> |
|---|
| 326 | <a id="addReviewerButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign")%></a>| |
|---|
| 327 | <span id="assignMenu_reviewer_bottom" onmouseover="this.className = 'mouseover'" onmouseout="this.className = ''"> |
|---|
| 328 | <a id="assignReviewerPerTrackButton_bottom" class="dropDownMenu fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Assign per ...")%> |
|---|
| 329 | </a> |
|---|
| 330 | </span>| |
|---|
| 331 | <a id="removeReviewerButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove")%></a>| |
|---|
| 332 | <a id="removeAllReviewersButton_bottom" class="fakeLink" style="margin-left: 15px; margin-right: 15px"><%= _("Remove All")%> |
|---|
| 333 | </td> |
|---|
| 334 | </tr> |
|---|
| 335 | <% end %> |
|---|
| 336 | </table> |
|---|
| 337 | |
|---|
| 338 | <div id="userSelection_bottom" style="margin-top: 1em"> |
|---|
| 339 | <span id="userSelectionMessage_bottom"></span> |
|---|
| 340 | <ul id="userList_bottom"> |
|---|
| 341 | </ul> |
|---|
| 342 | </div> |
|---|
| 343 | |
|---|
| 344 | |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | <script type="text/javascript"> |
|---|
| 348 | var assignPerTrackMenus = function(role, place){ |
|---|
| 349 | var assignMenu = $E('assignMenu'+'_'+role+'_'+place); |
|---|
| 350 | var order = 'assign'; |
|---|
| 351 | if(role=='reviewer'){ |
|---|
| 352 | order = 'add'; |
|---|
| 353 | } |
|---|
| 354 | assignMenu.observeClick(function(e) { |
|---|
| 355 | var menuItems = {}; |
|---|
| 356 | |
|---|
| 357 | menuItems[$T('Track')] = function(){ fetchUsersPerAttribute(order, role, 'track'); }; |
|---|
| 358 | menuItems[$T('Session')] = function(){ fetchUsersPerAttribute(order, role, 'session'); }; |
|---|
| 359 | menuItems[$T('Type')] = function(){ fetchUsersPerAttribute(order, role, 'type'); }; |
|---|
| 360 | |
|---|
| 361 | var menu = new PopupMenu(menuItems, [assignMenu], "popupList"); |
|---|
| 362 | var pos = assignMenu.getAbsolutePosition(); |
|---|
| 363 | menu.open(pos.x, pos.y + 20); |
|---|
| 364 | return false; |
|---|
| 365 | }); |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | var contributions = $L(); // watchlist of contribution objects, pickled from Indico Contribution objects |
|---|
| 369 | var contributionsIndexes = []; //array that maps contribution ids to the index of the contribution in the 'contributions' watchlist |
|---|
| 370 | var action = ''; // stores which button has been pressed, in order to know which list of users has to be retrieved |
|---|
| 371 | |
|---|
| 372 | /** |
|---|
| 373 | * Returns a contribution object given its id. |
|---|
| 374 | * The contribution object is obtained from the 'contributions' watchlist. |
|---|
| 375 | * @param {Object} id The id of the contribution. |
|---|
| 376 | */ |
|---|
| 377 | var getContribution = function (id) { |
|---|
| 378 | return contributions.item(contributionsIndexes[id]); |
|---|
| 379 | } |
|---|
| 380 | |
|---|
| 381 | /** |
|---|
| 382 | * Selects all the checkboxes of a given name |
|---|
| 383 | */ |
|---|
| 384 | var selectAll = function (name) { |
|---|
| 385 | var checkBoxes = document.getElementsByName(name); |
|---|
| 386 | if ( checkBoxes ) { // true if there is at least 1 checkbox |
|---|
| 387 | if ( !checkBoxes.length) { // true if there is only 1 checkbox |
|---|
| 388 | checkBoxes.checked=true; |
|---|
| 389 | if (checkBoxes.name == "selectedContributions") { |
|---|
| 390 | isSelected(checkBoxes.id.split('b')[1]); |
|---|
| 391 | } |
|---|
| 392 | } else { // there is more than 1 checkbox |
|---|
| 393 | for (i = 0; i < checkBoxes.length; i++) { |
|---|
| 394 | checkBoxes[i].checked=true; |
|---|
| 395 | if (checkBoxes[i].name == "selectedContributions") { |
|---|
| 396 | isSelected(checkBoxes[i].id.split('b')[1]); |
|---|
| 397 | } |
|---|
| 398 | } |
|---|
| 399 | } |
|---|
| 400 | } |
|---|
| 401 | } |
|---|
| 402 | |
|---|
| 403 | /** |
|---|
| 404 | * Deselects all the contributions by unticking their checkboxes |
|---|
| 405 | */ |
|---|
| 406 | var deselectAll = function(name) { |
|---|
| 407 | var checkBoxes = document.getElementsByName(name) |
|---|
| 408 | if ( checkBoxes ) { // true if there is at least 1 checkbox |
|---|
| 409 | if ( !checkBoxes.length) { // true if there is only 1 checkbox |
|---|
| 410 | checkBoxes.checked=false; |
|---|
| 411 | if (checkBoxes.name == "selectedContributions") { |
|---|
| 412 | isSelected(checkBoxes.id.split('b')[1]); |
|---|
| 413 | } |
|---|
| 414 | } else { // there is more than 1 checkbox |
|---|
| 415 | for (i = 0; i < checkBoxes.length; i++) { |
|---|
| 416 | checkBoxes[i].checked=false; |
|---|
| 417 | if (checkBoxes[i].name == "selectedContributions") { |
|---|
| 418 | isSelected(checkBoxes[i].id.split('b')[1]); |
|---|
| 419 | } |
|---|
| 420 | } |
|---|
| 421 | } |
|---|
| 422 | } |
|---|
| 423 | } |
|---|
| 424 | |
|---|
| 425 | /** |
|---|
| 426 | * Builds the 'link' to show and hide the filtering options. |
|---|
| 427 | */ |
|---|
| 428 | var buildShowHideFiltering = function() { |
|---|
| 429 | var option = new Chooser({ |
|---|
| 430 | showFiltering: command(function(){ |
|---|
| 431 | $E('filteringTable').dom.style.display = ''; |
|---|
| 432 | option.set('hideFiltering'); |
|---|
| 433 | }, $T('Show Filters')), |
|---|
| 434 | hideFiltering: command(function(){ |
|---|
| 435 | $E('filteringTable').dom.style.display = 'none'; |
|---|
| 436 | option.set('showFiltering'); |
|---|
| 437 | }, $T('Hide Filters')) |
|---|
| 438 | }); |
|---|
| 439 | option.set('showFiltering'); |
|---|
| 440 | |
|---|
| 441 | $E('showHideFiltering').set(Widget.link(option)); |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | /** |
|---|
| 445 | * Builds a table row element from a contribution object, pickled from an Indico's Contribution object |
|---|
| 446 | * @param {Object} contribution |
|---|
| 447 | */ |
|---|
| 448 | var backgroundColorOver = function() { |
|---|
| 449 | var cbId = "cb" + this.id.split('_')[1]; |
|---|
| 450 | var checkbox = $E(cbId); |
|---|
| 451 | if (!checkbox.dom.checked) { |
|---|
| 452 | IndicoUI.Widgets.Generic.tooltip(this.style.backgroundColor='#FFF6DF'); |
|---|
| 453 | } |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | var backgroundColorOut = function() { |
|---|
| 457 | var cbId = "cb" + this.id.split('_')[1]; |
|---|
| 458 | var checkbox = $E(cbId); |
|---|
| 459 | if (!checkbox.dom.checked) { |
|---|
| 460 | IndicoUI.Widgets.Generic.tooltip(this.style.backgroundColor='transparent'); |
|---|
| 461 | } |
|---|
| 462 | } |
|---|
| 463 | |
|---|
| 464 | |
|---|
| 465 | function isSelected(numId) { |
|---|
| 466 | var rowId = "row_" + numId; |
|---|
| 467 | var elem = $E(rowId); |
|---|
| 468 | var checkboxId = "cb" + numId; |
|---|
| 469 | var checkbox = $E(checkboxId); |
|---|
| 470 | if (checkbox.dom.checked == true) { |
|---|
| 471 | elem.dom.style.backgroundColor = '#CDEB8B'; |
|---|
| 472 | } else { |
|---|
| 473 | elem.dom.style.backgroundColor = 'transparent'; |
|---|
| 474 | } |
|---|
| 475 | } |
|---|
| 476 | |
|---|
| 477 | |
|---|
| 478 | |
|---|
| 479 | var contributionTemplate = function(contribution) { |
|---|
| 480 | |
|---|
| 481 | var row = Html.tr(); |
|---|
| 482 | var rowId = "row_" + contribution.id; |
|---|
| 483 | row.dom.id = rowId; |
|---|
| 484 | row.dom.onmouseover = backgroundColorOver; |
|---|
| 485 | row.dom.onmouseout = backgroundColorOut; |
|---|
| 486 | |
|---|
| 487 | // Cell1: checkbox to select this contribution |
|---|
| 488 | var cell1 = Html.td({style:{"textAlign":"center", "width":"0px"}}); |
|---|
| 489 | var id = ("cb" + contribution.id); |
|---|
| 490 | var name = ("selectedContributions"); |
|---|
| 491 | |
|---|
| 492 | /* |
|---|
| 493 | //creating the checkbox IE way |
|---|
| 494 | if (document.all) { |
|---|
| 495 | var checkbox = document.createElement('<input name='+name+'>'); |
|---|
| 496 | checkbox.type = "checkbox"; |
|---|
| 497 | checkbox.id = id ; |
|---|
| 498 | } |
|---|
| 499 | //the other browsers |
|---|
| 500 | else { |
|---|
| 501 | var checkbox = Html.checkbox({id: id, name:name}); |
|---|
| 502 | } |
|---|
| 503 | cell1.set(checkbox); |
|---|
| 504 | //checkbox.dom.value = contribution.id; // has to be added after constructor because of IE |
|---|
| 505 | */ |
|---|
| 506 | var checkbox = Html.input('checkbox', {id: id, name:name, onchange:"isSelected("+contribution.id+");"}); |
|---|
| 507 | checkbox.dom.value = contribution.id; |
|---|
| 508 | |
|---|
| 509 | cell1.set(checkbox); |
|---|
| 510 | |
|---|
| 511 | row.append(cell1); |
|---|
| 512 | |
|---|
| 513 | // Cell2: contribution id |
|---|
| 514 | var cell2 = Html.td({className:'contributionDataCell',style:{"textAlign":"center", "width":"0px"}}); |
|---|
| 515 | cell2.set(contribution.id) |
|---|
| 516 | row.append(cell2); |
|---|
| 517 | |
|---|
| 518 | // Cell3: contribution title |
|---|
| 519 | var cell3 = Html.td({className:'contributionDataCell'}); |
|---|
| 520 | // Sadly this hack is necessary to get the link since getURL() needs a Contribution object (from Indico, not the local one from Javascript) |
|---|
| 521 | // and contributions are loaded asynchronously... |
|---|
| 522 | linkString = "<%= urlHandlers.UHContributionModifReviewing.getURL() %>" + "?contribId=" + contribution.id + "&confId=<%= Conference.getId()%>" |
|---|
| 523 | var link = Html.a({href: linkString}); |
|---|
| 524 | link.set(contribution.title); |
|---|
| 525 | cell3.set(link); |
|---|
| 526 | row.append(cell3); |
|---|
| 527 | |
|---|
| 528 | // Cell4: contribution type |
|---|
| 529 | var cell4 = Html.td({className:'contributionDataCell',style:{"marginLeft":"5px"}}); |
|---|
| 530 | cell4.set(contribution.type ? contribution.type : "") |
|---|
| 531 | row.append(cell4); |
|---|
| 532 | |
|---|
| 533 | // Cell5: contribution track |
|---|
| 534 | var cell5 = Html.td({className:'contributionDataCell',style:{"marginLeft":"5px"}}); |
|---|
| 535 | cell5.set(contribution.track ? contribution.track : "") |
|---|
| 536 | row.append(cell5); |
|---|
| 537 | |
|---|
| 538 | // Cell6: contribution session |
|---|
| 539 | var cell6 = Html.td({className:'contributionDataCell',style:{"marginLeft":"5px"}}); |
|---|
| 540 | cell6.set(contribution.session ? contribution.session : "") |
|---|
| 541 | row.append(cell6); |
|---|
| 542 | |
|---|
| 543 | /* |
|---|
| 544 | // Cell7: contribution status |
|---|
| 545 | var cell7 = Html.td(); |
|---|
| 546 | |
|---|
| 547 | if (contribution.reviewManager.lastReview.refereeJudgement.isSubmitted) { |
|---|
| 548 | var span = Html.span(); |
|---|
| 549 | span.dom.style.color = 'green'; |
|---|
| 550 | span.set("Judged" + contribution.reviewManager.lastReview.refereeJudgement.judgement); |
|---|
| 551 | cell7.set(span); |
|---|
| 552 | |
|---|
| 553 | } else { |
|---|
| 554 | var ul = Html.ul(); |
|---|
| 555 | ul.dom.style.color = 'red'; |
|---|
| 556 | ul.dom.style.listStyleType = 'none'; |
|---|
| 557 | ul.dom.style.padding = 0; |
|---|
| 558 | ul.dom.style.marginLeft = '5px'; |
|---|
| 559 | |
|---|
| 560 | var li = Html.li(); |
|---|
| 561 | li.set("Not judged yet"); |
|---|
| 562 | ul.append(li); |
|---|
| 563 | |
|---|
| 564 | statusList = contribution.reviewManager.lastReview.reviewingStatus; |
|---|
| 565 | for (j in statusList) { |
|---|
| 566 | var li = Html.li(); |
|---|
| 567 | li.set(statusList[j]) |
|---|
| 568 | ul.append(li) |
|---|
| 569 | } |
|---|
| 570 | |
|---|
| 571 | cell7.set(ul); |
|---|
| 572 | } |
|---|
| 573 | |
|---|
| 574 | row.append(cell7); |
|---|
| 575 | */ |
|---|
| 576 | |
|---|
| 577 | // Cell8: reviewing team assigned to the contribution |
|---|
| 578 | var cell8 = Html.td({className:'contributionDataCell'}); |
|---|
| 579 | |
|---|
| 580 | var ul = Html.ul(); |
|---|
| 581 | ul.dom.style.listStyleType = 'none'; |
|---|
| 582 | ul.dom.style.padding = 0; |
|---|
| 583 | ul.dom.style.marginLeft = '5px'; |
|---|
| 584 | |
|---|
| 585 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 586 | var li1 = Html.li(); |
|---|
| 587 | var span1 = Html.span({}, $T('Referee: ')) |
|---|
| 588 | var span2 = contribution.reviewManager.referee ? |
|---|
| 589 | Html.span({id: ("creferee" + contribution.id), style:{"fontWeight":"bolder"}}, contribution.reviewManager.referee) : |
|---|
| 590 | Html.span({id: ("creferee" + contribution.id)},$T('No referee')); |
|---|
| 591 | li1.set(Widget.block([span1,span2])); |
|---|
| 592 | ul.append(li1); |
|---|
| 593 | <% end %> |
|---|
| 594 | |
|---|
| 595 | <% if not (ConfReview.getChoice() == 2 or ConfReview.getChoice() == 1): %> |
|---|
| 596 | var li2 = Html.li(); |
|---|
| 597 | var span1 = Html.span({}, $T('Layout reviewer: ')) |
|---|
| 598 | var span2 = contribution.reviewManager.editor ? |
|---|
| 599 | Html.span({id: ("ceditor" + contribution.id), style:{"fontWeight":"bolder"}}, contribution.reviewManager.editor) : |
|---|
| 600 | Html.span({id: ("ceditor" + contribution.id)},$T('No layout reviewer')); |
|---|
| 601 | li2.set(Widget.block([span1,span2])); |
|---|
| 602 | ul.append(li2); |
|---|
| 603 | <% end %> |
|---|
| 604 | |
|---|
| 605 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 606 | var li3 = Html.li(); |
|---|
| 607 | var span = Html.span({id : ("creviewerstitle" + contribution.id)}, $T('Content reviewers: ')); |
|---|
| 608 | li3.append(span); |
|---|
| 609 | |
|---|
| 610 | |
|---|
| 611 | var ulReviewers = Html.ul(); |
|---|
| 612 | if (contribution.reviewManager.reviewersList.length > 0){ |
|---|
| 613 | for (j in contribution.reviewManager.reviewersList) { |
|---|
| 614 | var li = Html.li({id: ("creviewer" + contribution.id + "_" + contribution.reviewManager.reviewersList[j].id), style:{"fontWeight":"bolder"}}); |
|---|
| 615 | li.set(contribution.reviewManager.reviewersList[j].name); |
|---|
| 616 | ulReviewers.append(li); |
|---|
| 617 | } |
|---|
| 618 | li3.append(ulReviewers); |
|---|
| 619 | } else { |
|---|
| 620 | var span = Html.span({id: ("creviewer" + contribution.id)},$T('No content reviewers' )); |
|---|
| 621 | li3.append(span); |
|---|
| 622 | } |
|---|
| 623 | ul.append(li3); |
|---|
| 624 | <% end %> |
|---|
| 625 | |
|---|
| 626 | cell8.set(ul); |
|---|
| 627 | row.append(cell8); |
|---|
| 628 | |
|---|
| 629 | // Cell9: due date of the contribution |
|---|
| 630 | var cell9 = Html.td({className:'contributionDataCell'}); |
|---|
| 631 | if (contribution.reviewManager.lastReview.refereeDueDate == null) { |
|---|
| 632 | cell9.set(""); |
|---|
| 633 | } |
|---|
| 634 | else { |
|---|
| 635 | var date = contribution.reviewManager.lastReview.refereeDueDate.date; |
|---|
| 636 | var newDate = date.split('-')[2] + '-' + date.split('-')[1] + '-' + date.split('-')[0]; |
|---|
| 637 | cell9.set(newDate); |
|---|
| 638 | } |
|---|
| 639 | row.append(cell9); |
|---|
| 640 | |
|---|
| 641 | return row; |
|---|
| 642 | } |
|---|
| 643 | |
|---|
| 644 | |
|---|
| 645 | /** |
|---|
| 646 | * Updates the display of the contribution row. |
|---|
| 647 | * @param {Object} id The id of the contribution. |
|---|
| 648 | */ |
|---|
| 649 | var updateContribution = function (id) { |
|---|
| 650 | index = contributionsIndexes[id]; |
|---|
| 651 | var c = contributions.item(index); |
|---|
| 652 | contributions.removeAt(index); |
|---|
| 653 | contributions.insert(c, index); |
|---|
| 654 | } |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | /** |
|---|
| 658 | * Returns a list of checkbox values, for a given checkbox name |
|---|
| 659 | * ('name' attribute of an 'input' HTML element) |
|---|
| 660 | * The list only contains the checkboxes who are selected. |
|---|
| 661 | * The first checkbox ('--not specified--' one) is discarded. |
|---|
| 662 | * @param {Object} checkboxName |
|---|
| 663 | */ |
|---|
| 664 | var getCheckedBoxes = function(checkboxName) { |
|---|
| 665 | |
|---|
| 666 | var checkBoxes = document.getElementsByName(checkboxName); |
|---|
| 667 | var checkedIds = [] |
|---|
| 668 | for (var i=0; i<checkBoxes.length; i++) { |
|---|
| 669 | var cb = checkBoxes[i]; |
|---|
| 670 | if (cb.checked && cb.value != "not specified") { |
|---|
| 671 | checkedIds.push(cb.value) |
|---|
| 672 | } |
|---|
| 673 | } |
|---|
| 674 | return checkedIds; |
|---|
| 675 | } |
|---|
| 676 | |
|---|
| 677 | |
|---|
| 678 | /** |
|---|
| 679 | * Returns a list of contribution ids. |
|---|
| 680 | * Only the contributios whose checkbox has been selected are returned. |
|---|
| 681 | */ |
|---|
| 682 | var getCheckedContributions = function() { |
|---|
| 683 | |
|---|
| 684 | var checkBoxes = document.getElementsByName('selectedContributions'); |
|---|
| 685 | var checkedContributions = [] |
|---|
| 686 | |
|---|
| 687 | for (var i=0; i<checkBoxes.length; i++) { |
|---|
| 688 | var cb = checkBoxes[i]; |
|---|
| 689 | if (cb.checked) { |
|---|
| 690 | checkedContributions.push(cb.id.slice(2)) |
|---|
| 691 | } |
|---|
| 692 | } |
|---|
| 693 | return checkedContributions; |
|---|
| 694 | } |
|---|
| 695 | |
|---|
| 696 | /** |
|---|
| 697 | * Turns the given user orange for some seconds to indicate that it has changed |
|---|
| 698 | * @param {Object} contributionId The id of the contribution where a user has been assigned |
|---|
| 699 | * @param {Object} role The role that has been assigned |
|---|
| 700 | * @param {Object} reviewerId In case of a reviewerm the reviewerId. Otherwise leave to null. |
|---|
| 701 | */ |
|---|
| 702 | var colorify = function(contributionId, role, reviewerId) { |
|---|
| 703 | id = "c" + role + contributionId; |
|---|
| 704 | if (reviewerId) { |
|---|
| 705 | id = id + "_" + reviewerId; |
|---|
| 706 | } |
|---|
| 707 | IndicoUI.Effect.highLight(id, 'orange', 2000); |
|---|
| 708 | } |
|---|
| 709 | |
|---|
| 710 | /** |
|---|
| 711 | * Among a list of contributions (given as contribution ids), |
|---|
| 712 | * this function unchecks the checboxes of the contributions |
|---|
| 713 | * who don't ahve a refree yet. |
|---|
| 714 | * @param {array} contributions List of contribution ids |
|---|
| 715 | */ |
|---|
| 716 | var deselectWithoutReferee = function(contributions) { |
|---|
| 717 | for (i in contributions) { |
|---|
| 718 | contributionId = contributions[i]; |
|---|
| 719 | contribution = getContribution(contributionId); |
|---|
| 720 | if (contribution.reviewManager.referee == null) { |
|---|
| 721 | $E('cb' + contributionId).dom.checked = false; |
|---|
| 722 | isSelected(contributionId); |
|---|
| 723 | } |
|---|
| 724 | } |
|---|
| 725 | } |
|---|
| 726 | |
|---|
| 727 | /** |
|---|
| 728 | * Among a list of contributions (given as contribution ids), |
|---|
| 729 | * this function unchecks the checboxes of the contributions |
|---|
| 730 | * who don't have a reviewer. |
|---|
| 731 | * @param {array} contributions List of contribution ids |
|---|
| 732 | */ |
|---|
| 733 | var deselectWithoutReviewer = function(contributions) { |
|---|
| 734 | for (i in contributions) { |
|---|
| 735 | contributionId = contributions[i]; |
|---|
| 736 | contribution = getContribution(contributionId); |
|---|
| 737 | if (contribution.reviewManager.reviewersList.length == 0) { |
|---|
| 738 | $E('cb' + contributionId).dom.checked = false; |
|---|
| 739 | isSelected(contributionId); |
|---|
| 740 | } |
|---|
| 741 | } |
|---|
| 742 | } |
|---|
| 743 | |
|---|
| 744 | /** |
|---|
| 745 | * Checks that all contributions have a Referee. |
|---|
| 746 | * Returns true if all have a referee, false otherwise. |
|---|
| 747 | * If none have a referee, an alert message appear. |
|---|
| 748 | * If some have a referee and others don't, a dialog will appear offering |
|---|
| 749 | * the choice to only apply the assignment to contributions with referee. |
|---|
| 750 | * @param {Object} contributions |
|---|
| 751 | * @param {Object} order |
|---|
| 752 | * @param {Object} role |
|---|
| 753 | */ |
|---|
| 754 | var checkAllHaveReferee = function(contributions, order, role, assignPerAttribute) { |
|---|
| 755 | var contributionsWithoutReferee = [] |
|---|
| 756 | for (i in contributions) { |
|---|
| 757 | contributionId = contributions[i] |
|---|
| 758 | contribution = getContribution(contributionId) |
|---|
| 759 | if (contribution.reviewManager.referee == null) { |
|---|
| 760 | contributionsWithoutReferee.push(contributionId) |
|---|
| 761 | } |
|---|
| 762 | } |
|---|
| 763 | if (contributionsWithoutReferee.length == contributions.length) { |
|---|
| 764 | alert($T("None of the contributions you checked have a Referee.") + |
|---|
| 765 | $T("You can only add a layout reviewer or a content reviewer if the contribution has a referee.") |
|---|
| 766 | ); |
|---|
| 767 | return false; |
|---|
| 768 | } |
|---|
| 769 | |
|---|
| 770 | if (contributionsWithoutReferee.length > 0) { |
|---|
| 771 | |
|---|
| 772 | if(assignPerAttribute){ |
|---|
| 773 | alert($T("Some of the contributions you checked have a Referee.") + |
|---|
| 774 | $T("You can only add a layout reviewer or a content reviewer if the contribution has a referee.")); |
|---|
| 775 | return false; |
|---|
| 776 | } else { |
|---|
| 777 | title =$T('Contributions without referee'); |
|---|
| 778 | |
|---|
| 779 | var popup = new ExclusivePopup(title, function(){popup.close();}); |
|---|
| 780 | |
|---|
| 781 | popup.draw = function(){ |
|---|
| 782 | |
|---|
| 783 | var span1 = Html.span({}, $T("Some of the contributions you checked do not have a Referee.")); |
|---|
| 784 | var span2 = Html.span({}, $T("You can only add an editor or a reviewer if the contribution has a referee.")); |
|---|
| 785 | var span3 = Html.span({}, $T("Do you want to add that " + role + " only to the contributions with a referee?")); |
|---|
| 786 | var yesButton = Html.button('popUpButton', $T("Yes")); |
|---|
| 787 | yesButton.observeClick(function(){ |
|---|
| 788 | deselectWithoutReferee(contributions); |
|---|
| 789 | fetchUsers(order, role); |
|---|
| 790 | popup.close(); |
|---|
| 791 | }); |
|---|
| 792 | |
|---|
| 793 | var noButton = Html.button('popUpButton', $T("No")); |
|---|
| 794 | noButton.observeClick(function(){ |
|---|
| 795 | popup.close(); |
|---|
| 796 | }); |
|---|
| 797 | var buttons = Widget.inline([yesButton, noButton]) |
|---|
| 798 | var all = Widget.lines([span1, span2, span3, buttons]) |
|---|
| 799 | return this.ExclusivePopup.prototype.draw.call(this, Html.div({style: {height: '130px', width: '420px'}},[all])); |
|---|
| 800 | }; |
|---|
| 801 | popup.open(); |
|---|
| 802 | |
|---|
| 803 | return false; |
|---|
| 804 | } |
|---|
| 805 | } |
|---|
| 806 | return true; |
|---|
| 807 | } |
|---|
| 808 | |
|---|
| 809 | /** |
|---|
| 810 | * When removing a reviewer from one or more contributions this function takes care for the alert messages. |
|---|
| 811 | * Returns true if there are no warnings, returns false otherwise. |
|---|
| 812 | * If are checked contributions with no reviewers assigned, an alert message appears. |
|---|
| 813 | * If some have a reviewers and others don't, a dialog will appear offering |
|---|
| 814 | * the choice to only apply the assignment to contributions with reviewer. |
|---|
| 815 | * @param {Object} contributions |
|---|
| 816 | * @param {Object} order |
|---|
| 817 | * @param {Object} role |
|---|
| 818 | */ |
|---|
| 819 | var removeReviewersAlerts = function(contributions, role) { |
|---|
| 820 | contributionsWithoutReviewers = [] |
|---|
| 821 | for (i in contributions) { |
|---|
| 822 | contributionId = contributions[i] |
|---|
| 823 | contribution = getContribution(contributionId) |
|---|
| 824 | if (contribution.reviewManager.reviewersList.length == 0) { |
|---|
| 825 | contributionsWithoutReviewers.push(contributionId) |
|---|
| 826 | } |
|---|
| 827 | } |
|---|
| 828 | if (contributionsWithoutReviewers.length == contributions.length) { |
|---|
| 829 | alert($T("There is no assigned Content Reviewer to remove.") |
|---|
| 830 | ); |
|---|
| 831 | return false; |
|---|
| 832 | } |
|---|
| 833 | |
|---|
| 834 | /*contributionsWithoutEditor = [] |
|---|
| 835 | for (i in contributions) { |
|---|
| 836 | contributionId = contributions[i] |
|---|
| 837 | contribution = getContribution(contributionId) |
|---|
| 838 | if (contribution.reviewManager.editor = null) { |
|---|
| 839 | contributionsWithoutEditor.push(contributionId) |
|---|
| 840 | } |
|---|
| 841 | } |
|---|
| 842 | |
|---|
| 843 | if (contributionsWithoutEditor.length == contributions.length) { |
|---|
| 844 | alert($T("There is no assigned Layout Reviewer to remove.") |
|---|
| 845 | ); |
|---|
| 846 | return false; |
|---|
| 847 | } */ |
|---|
| 848 | |
|---|
| 849 | if (contributionsWithoutReviewers.length > 0) { |
|---|
| 850 | title =$T('Contributions without reviewer'); |
|---|
| 851 | |
|---|
| 852 | var popup = new ExclusivePopup(title, function(){popup.close();}); |
|---|
| 853 | |
|---|
| 854 | popup.draw = function(){ |
|---|
| 855 | |
|---|
| 856 | var span1 = Html.span({}, $T("The Content Reviewers will be removed only from the contributions that have one.")); |
|---|
| 857 | var okButton = Html.button('popUpButton', $T("OK")); |
|---|
| 858 | okButton.observeClick(function(){ |
|---|
| 859 | deselectWithoutReviewer(contributions); |
|---|
| 860 | removeUser('allReviewers'); |
|---|
| 861 | popup.close(); |
|---|
| 862 | }); |
|---|
| 863 | |
|---|
| 864 | var all = Widget.lines([span1, okButton]) |
|---|
| 865 | okButton.dom.align = 'center'; |
|---|
| 866 | return this.ExclusivePopup.prototype.draw.call(this, Html.div({style: {height: '100px', width: '250px'}},[all])); |
|---|
| 867 | }; |
|---|
| 868 | popup.open(); |
|---|
| 869 | |
|---|
| 870 | return false; |
|---|
| 871 | } |
|---|
| 872 | |
|---|
| 873 | return true; |
|---|
| 874 | } |
|---|
| 875 | |
|---|
| 876 | var removeEditorAlerts = function(contributions, role) { |
|---|
| 877 | |
|---|
| 878 | contributionsWithoutEditor = [] |
|---|
| 879 | for (i in contributions) { |
|---|
| 880 | contributionId = contributions[i] |
|---|
| 881 | contribution = getContribution(contributionId) |
|---|
| 882 | if (contribution.reviewManager.editor == null) { |
|---|
| 883 | contributionsWithoutEditor.push(contributionId) |
|---|
| 884 | } |
|---|
| 885 | } |
|---|
| 886 | |
|---|
| 887 | if (contributionsWithoutEditor.length == contributions.length) { |
|---|
| 888 | alert($T("There is no assigned Layout Reviewer to remove.") |
|---|
| 889 | ); |
|---|
| 890 | return false; |
|---|
| 891 | } |
|---|
| 892 | |
|---|
| 893 | return true; |
|---|
| 894 | |
|---|
| 895 | } |
|---|
| 896 | |
|---|
| 897 | var removeNoRefereeAlerts = function(contributions, role) { |
|---|
| 898 | |
|---|
| 899 | contributionsWithoutEditor = [] |
|---|
| 900 | for (i in contributions) { |
|---|
| 901 | contributionId = contributions[i] |
|---|
| 902 | contribution = getContribution(contributionId) |
|---|
| 903 | if (contribution.reviewManager.referee == null) { |
|---|
| 904 | contributionsWithoutEditor.push(contributionId) |
|---|
| 905 | } |
|---|
| 906 | } |
|---|
| 907 | |
|---|
| 908 | if (contributionsWithoutEditor.length == contributions.length) { |
|---|
| 909 | alert($T("There is no assigned Referee to remove.") |
|---|
| 910 | ); |
|---|
| 911 | return false; |
|---|
| 912 | } |
|---|
| 913 | |
|---|
| 914 | return true; |
|---|
| 915 | |
|---|
| 916 | } |
|---|
| 917 | |
|---|
| 918 | /** |
|---|
| 919 | * When removing a refereee from one or more contributions this function checks |
|---|
| 920 | * if there are alredy assigned reviewers or editor, or both |
|---|
| 921 | * @param {array} contributions List of contribution ids |
|---|
| 922 | */ |
|---|
| 923 | var removeRefereeAlerts = function(contributions){ |
|---|
| 924 | for (i in contributions) { |
|---|
| 925 | contributionId = contributions[i] |
|---|
| 926 | contribution = getContribution(contributionId) |
|---|
| 927 | } |
|---|
| 928 | if(contribution.reviewManager.reviewersList.length != 0 && contribution.reviewManager.editor != null) { |
|---|
| 929 | return false; |
|---|
| 930 | } |
|---|
| 931 | if(contribution.reviewManager.reviewersList.length != 0 && contribution.reviewManager.editor == null){ |
|---|
| 932 | return false; |
|---|
| 933 | } |
|---|
| 934 | if(contribution.reviewManager.reviewersList.length == 0 && contribution.reviewManager.editor != null) { |
|---|
| 935 | return false; |
|---|
| 936 | } |
|---|
| 937 | |
|---|
| 938 | return true; |
|---|
| 939 | } |
|---|
| 940 | |
|---|
| 941 | /** |
|---|
| 942 | * When removing a refereee from one or more contributions this function takes care for the alert messages. |
|---|
| 943 | * If are checked contributions with alredy assigned reviewers/editor |
|---|
| 944 | * alert message appears that a referee should be assigned |
|---|
| 945 | * @param {array} contributions List of contribution ids |
|---|
| 946 | */ |
|---|
| 947 | var removeRefereeAlertsMessage = function(contributions){ |
|---|
| 948 | for (i in contributions) { |
|---|
| 949 | contributionId = contributions[i] |
|---|
| 950 | contribution = getContribution(contributionId) |
|---|
| 951 | } |
|---|
| 952 | var warning = $T("You have to assign new referee.") |
|---|
| 953 | var message = $T("") |
|---|
| 954 | if(contribution.reviewManager.reviewersList.length != 0 && contribution.reviewManager.editor != null) { |
|---|
| 955 | message = $T("Please note that layout and content have already been assigned for this/these contributions."+ warning) |
|---|
| 956 | return message; |
|---|
| 957 | } |
|---|
| 958 | if(contribution.reviewManager.reviewersList.length != 0 && contribution.reviewManager.editor == null){ |
|---|
| 959 | message = $T("Please note that a content reviewer has already been assigned for this/these contributions."+ warning) |
|---|
| 960 | return message; |
|---|
| 961 | } |
|---|
| 962 | if(contribution.reviewManager.reviewersList.length == 0 && contribution.reviewManager.editor != null) { |
|---|
| 963 | message = $T("Please note that a layout reviewer has already been assigned for this/these contributions."+ warning) |
|---|
| 964 | return message; |
|---|
| 965 | } |
|---|
| 966 | |
|---|
| 967 | return message; |
|---|
| 968 | } |
|---|
| 969 | |
|---|
| 970 | /** |
|---|
| 971 | * Function that is called when a user (referee, editor, reviewer) is clicked. |
|---|
| 972 | * Depending on what has been sotred in the variable 'action', the user will be |
|---|
| 973 | * added as a referee, added as an editor, removed as a reviewer, etc on the checked contributions. |
|---|
| 974 | * @param {Object} user The user that has been clicked. |
|---|
| 975 | */ |
|---|
| 976 | var userSelected = function(user, contrPerAttribute){ |
|---|
| 977 | |
|---|
| 978 | var checkedContributions = getCheckedContributions() |
|---|
| 979 | |
|---|
| 980 | |
|---|
| 981 | if (checkedContributions.length > 0){ |
|---|
| 982 | var params = {conference: '<%= Conference.getId() %>',contributions: checkedContributions, user: user.id} |
|---|
| 983 | } |
|---|
| 984 | |
|---|
| 985 | |
|---|
| 986 | if(checkedContributions.length == 0 && contrPerAttribute.length > 0){ |
|---|
| 987 | var params = {conference: '<%= Conference.getId() %>',contributions: contrPerAttribute, user: user.id} |
|---|
| 988 | var checkedContributions = contrPerAttribute; |
|---|
| 989 | } |
|---|
| 990 | |
|---|
| 991 | if (checkedContributions.length > 0 || (checkedContributions.length == 0 && contrPerAttribute.length > 0)) { |
|---|
| 992 | |
|---|
| 993 | |
|---|
| 994 | |
|---|
| 995 | switch(action) { |
|---|
| 996 | case 'assign_referee': |
|---|
| 997 | var killProgress = IndicoUI.Dialogs.Util.progress(); |
|---|
| 998 | indicoRequest( |
|---|
| 999 | 'reviewing.conference.assignReferee', |
|---|
| 1000 | params, |
|---|
| 1001 | function(result,error) { |
|---|
| 1002 | if (!error) { |
|---|
| 1003 | for (i in checkedContributions) { |
|---|
| 1004 | contributionId = checkedContributions[i]; |
|---|
| 1005 | contribution = getContribution(contributionId); |
|---|
| 1006 | contribution.reviewManager.referee = user.name; |
|---|
| 1007 | updateContribution(contributionId); |
|---|
| 1008 | colorify(contributionId,'referee'); |
|---|
| 1009 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1010 | isSelected(contributionId); |
|---|
| 1011 | } |
|---|
| 1012 | killProgress(); |
|---|
| 1013 | } else { |
|---|
| 1014 | killProgress(); |
|---|
| 1015 | IndicoUtil.errorReport(error); |
|---|
| 1016 | } |
|---|
| 1017 | } |
|---|
| 1018 | ); |
|---|
| 1019 | break; |
|---|
| 1020 | |
|---|
| 1021 | case 'assign_editor': |
|---|
| 1022 | var killProgress = IndicoUI.Dialogs.Util.progress(); |
|---|
| 1023 | indicoRequest( |
|---|
| 1024 | 'reviewing.conference.assignEditor', |
|---|
| 1025 | params, |
|---|
| 1026 | function(result,error) { |
|---|
| 1027 | if (!error) { |
|---|
| 1028 | for (i in checkedContributions) { |
|---|
| 1029 | contributionId = checkedContributions[i] |
|---|
| 1030 | contribution = getContribution(contributionId) |
|---|
| 1031 | contribution.reviewManager.editor = user.name |
|---|
| 1032 | updateContribution(contributionId) |
|---|
| 1033 | colorify(contributionId,'editor'); |
|---|
| 1034 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1035 | isSelected(contributionId); |
|---|
| 1036 | } |
|---|
| 1037 | killProgress(); |
|---|
| 1038 | } else { |
|---|
| 1039 | killProgress(); |
|---|
| 1040 | IndicoUtil.errorReport(error); |
|---|
| 1041 | } |
|---|
| 1042 | } |
|---|
| 1043 | ); |
|---|
| 1044 | break; |
|---|
| 1045 | |
|---|
| 1046 | case 'add_reviewer': |
|---|
| 1047 | var killProgress = IndicoUI.Dialogs.Util.progress(); |
|---|
| 1048 | indicoRequest( |
|---|
| 1049 | 'reviewing.conference.addReviewer', |
|---|
| 1050 | params, |
|---|
| 1051 | function(result,error) { |
|---|
| 1052 | if (!error) { |
|---|
| 1053 | for (i in checkedContributions) { |
|---|
| 1054 | contributionId = checkedContributions[i] |
|---|
| 1055 | contribution = getContribution(contributionId) |
|---|
| 1056 | |
|---|
| 1057 | var present = false; |
|---|
| 1058 | for (j in contribution.reviewManager.reviewersList) { |
|---|
| 1059 | if (contribution.reviewManager.reviewersList[j].id == user.id) { |
|---|
| 1060 | present = true; |
|---|
| 1061 | break; |
|---|
| 1062 | } |
|---|
| 1063 | } |
|---|
| 1064 | if (!present) { |
|---|
| 1065 | contribution.reviewManager.reviewersList.push(user) |
|---|
| 1066 | } |
|---|
| 1067 | |
|---|
| 1068 | updateContribution(contributionId); |
|---|
| 1069 | colorify(contributionId,'reviewer', user.id); |
|---|
| 1070 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1071 | isSelected(contributionId); |
|---|
| 1072 | } |
|---|
| 1073 | killProgress(); |
|---|
| 1074 | } else { |
|---|
| 1075 | killProgress(); |
|---|
| 1076 | IndicoUtil.errorReport(error); |
|---|
| 1077 | } |
|---|
| 1078 | } |
|---|
| 1079 | ); |
|---|
| 1080 | break; |
|---|
| 1081 | |
|---|
| 1082 | case 'remove_reviewer': |
|---|
| 1083 | indicoRequest( |
|---|
| 1084 | 'reviewing.conference.removeReviewer', |
|---|
| 1085 | params, |
|---|
| 1086 | function(result, error) { |
|---|
| 1087 | notinlist2 = []; |
|---|
| 1088 | if(!error) { |
|---|
| 1089 | for (i in checkedContributions) { |
|---|
| 1090 | contributionId = checkedContributions[i] |
|---|
| 1091 | contribution = getContribution(contributionId) |
|---|
| 1092 | |
|---|
| 1093 | notinlist = false; |
|---|
| 1094 | deleted = false; |
|---|
| 1095 | for (j in contribution.reviewManager.reviewersList) { |
|---|
| 1096 | if (contribution.reviewManager.reviewersList[j].id == user.id) { |
|---|
| 1097 | contribution.reviewManager.reviewersList.splice(j,1); |
|---|
| 1098 | updateContribution(contributionId); |
|---|
| 1099 | colorify(contributionId,'reviewerstitle'); |
|---|
| 1100 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1101 | isSelected(contributionId); |
|---|
| 1102 | deleted = true; |
|---|
| 1103 | } else { |
|---|
| 1104 | notinlist = true; |
|---|
| 1105 | notinlist2.push(contributionId) |
|---|
| 1106 | $E('cb' + contributionId).dom.checked = false; |
|---|
| 1107 | isSelected(contributionId); |
|---|
| 1108 | } |
|---|
| 1109 | } |
|---|
| 1110 | } |
|---|
| 1111 | } else { |
|---|
| 1112 | IndicoUtil.errorReport(error); |
|---|
| 1113 | } |
|---|
| 1114 | } |
|---|
| 1115 | ); |
|---|
| 1116 | break; |
|---|
| 1117 | |
|---|
| 1118 | default: |
|---|
| 1119 | break; |
|---|
| 1120 | } |
|---|
| 1121 | |
|---|
| 1122 | } |
|---|
| 1123 | } |
|---|
| 1124 | |
|---|
| 1125 | |
|---|
| 1126 | |
|---|
| 1127 | /** |
|---|
| 1128 | * Requests the list of contribution from the server, |
|---|
| 1129 | * given the filtering parameters. |
|---|
| 1130 | */ |
|---|
| 1131 | var fetchContributions = function() { |
|---|
| 1132 | |
|---|
| 1133 | contributions.clear(); |
|---|
| 1134 | contributionsIndexes = [] |
|---|
| 1135 | indicoRequest('event.contributions.list', |
|---|
| 1136 | { |
|---|
| 1137 | conference: '<%= Conference.getId() %>', |
|---|
| 1138 | typeShowNoValue : $E('typeShowNoValue').dom.checked, |
|---|
| 1139 | trackShowNoValue : $E('trackShowNoValue').dom.checked, |
|---|
| 1140 | sessionShowNoValue : $E('sessionShowNoValue').dom.checked, |
|---|
| 1141 | selTypes : getCheckedBoxes('selTypes'), |
|---|
| 1142 | selTracks : getCheckedBoxes('selTracks'), |
|---|
| 1143 | selSessions : getCheckedBoxes('selSessions'), |
|---|
| 1144 | <% if not IsOnlyReferee: %> |
|---|
| 1145 | showWithReferee: $E('showWithReferee').dom.checked, |
|---|
| 1146 | <% end %> |
|---|
| 1147 | showWithEditor: $E('showWithEditor').dom.checked, |
|---|
| 1148 | showWithReviewer: $E('showWithReviewer').dom.checked |
|---|
| 1149 | }, |
|---|
| 1150 | function(result, error){ |
|---|
| 1151 | if (!error) { |
|---|
| 1152 | for (i in result) { |
|---|
| 1153 | c = result[i] |
|---|
| 1154 | contributions.append(c); |
|---|
| 1155 | contributionsIndexes[c.id] = i; |
|---|
| 1156 | } |
|---|
| 1157 | $E('contributionsToShow').dom.innerHTML = result.length; |
|---|
| 1158 | var totalContributions = <%= len(Conference.getContributionListSortedById()) %>; |
|---|
| 1159 | if (totalContributions == result.length) { |
|---|
| 1160 | $E('totalContributions').dom.style.display = 'none'; |
|---|
| 1161 | } else { |
|---|
| 1162 | $E('totalContributions').dom.style.display = ''; |
|---|
| 1163 | } |
|---|
| 1164 | } else { |
|---|
| 1165 | IndicoUtil.errorReport(error); |
|---|
| 1166 | } |
|---|
| 1167 | } |
|---|
| 1168 | ) |
|---|
| 1169 | } |
|---|
| 1170 | |
|---|
| 1171 | /** |
|---|
| 1172 | * Retrieves a list of users from the server. |
|---|
| 1173 | * @param {string} order The action that will be taken on the users: 'assign', 'remove'. |
|---|
| 1174 | * @param {string} role The role of the users: 'referee', 'editor', 'reviewer'. |
|---|
| 1175 | */ |
|---|
| 1176 | var fetchUsers = function(order, role) { |
|---|
| 1177 | |
|---|
| 1178 | var checkedContributions = getCheckedContributions(); |
|---|
| 1179 | if (checkedContributions.length == 0) { |
|---|
| 1180 | alert($T("Please select at least 1 contribution")); |
|---|
| 1181 | return; |
|---|
| 1182 | } |
|---|
| 1183 | |
|---|
| 1184 | if ((order == 'assign' && role == 'editor') || (order == 'add' && role == 'reviewer')) { |
|---|
| 1185 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 1186 | if (!checkAllHaveReferee(checkedContributions, order, role, false)) { |
|---|
| 1187 | return; |
|---|
| 1188 | } |
|---|
| 1189 | <% end %> |
|---|
| 1190 | } |
|---|
| 1191 | |
|---|
| 1192 | if (order == 'remove' && role == 'reviewer') { |
|---|
| 1193 | if (!removeReviewersAlerts(checkedContributions, role)) { |
|---|
| 1194 | return; |
|---|
| 1195 | } |
|---|
| 1196 | } |
|---|
| 1197 | |
|---|
| 1198 | |
|---|
| 1199 | indicoRequest( |
|---|
| 1200 | 'reviewing.conference.userCompetencesList', |
|---|
| 1201 | {conference: '<%= Conference.getId() %>', role: role}, |
|---|
| 1202 | function(result,error) { |
|---|
| 1203 | if (!error) { |
|---|
| 1204 | |
|---|
| 1205 | action = order + '_' + role; |
|---|
| 1206 | |
|---|
| 1207 | var title = ''; |
|---|
| 1208 | var new_assign = ''; |
|---|
| 1209 | if (role == 'editor') { |
|---|
| 1210 | title = $T('Click on a user name to ') + order + $T(' a layout reviewer:'); |
|---|
| 1211 | } |
|---|
| 1212 | if (role == 'reviewer') { |
|---|
| 1213 | title = $T('Click on a user name to ') + order + ' a ' + $T('content reviewer:'); |
|---|
| 1214 | } else { |
|---|
| 1215 | if (order == 'assign') { |
|---|
| 1216 | title = $T('Click on a user name to ') + order + ' a ' + role + ':'; |
|---|
| 1217 | } if(order == 'new_assign' && !removeRefereeAlerts(checkedContributions)) { |
|---|
| 1218 | action = 'assign_' + role; |
|---|
| 1219 | title = $T('Click on a user name to assign new ') + role + ':'; |
|---|
| 1220 | new_assign = 'True'; |
|---|
| 1221 | } |
|---|
| 1222 | } |
|---|
| 1223 | |
|---|
| 1224 | var popup = new ExclusivePopup(title, function(){popup.close();}); |
|---|
| 1225 | |
|---|
| 1226 | popup.draw = function(){ |
|---|
| 1227 | var users = $L(); |
|---|
| 1228 | var userTemplate = function(user) { |
|---|
| 1229 | var li = Html.li(); |
|---|
| 1230 | var userName = Widget.link(command(function(){ |
|---|
| 1231 | userSelected(user); |
|---|
| 1232 | var killProgress = IndicoUI.Dialogs.Util.progress() |
|---|
| 1233 | popup.close(); |
|---|
| 1234 | killProgress(); |
|---|
| 1235 | }, user.name)); |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | var userCompetences = Html.span({style:{marginLeft:'5px'}}, |
|---|
| 1239 | user.competences.length == 0 ? $T('(no competences defined)') : $T('(competences: ') + user.competences.join(', ') + ')' |
|---|
| 1240 | ); |
|---|
| 1241 | |
|---|
| 1242 | li.set(Widget.inline([userName, userCompetences])); |
|---|
| 1243 | return li; |
|---|
| 1244 | } |
|---|
| 1245 | |
|---|
| 1246 | var userList = Html.ul(); |
|---|
| 1247 | bind.element(userList, users, userTemplate); |
|---|
| 1248 | |
|---|
| 1249 | for (i in result) { |
|---|
| 1250 | users.append(result[i]); |
|---|
| 1251 | } |
|---|
| 1252 | |
|---|
| 1253 | var cancelButton = Html.button({style:{marginLeft:pixels(5)}}, $T("Cancel")); |
|---|
| 1254 | cancelButton.observeClick(function(){ |
|---|
| 1255 | popup.close(); |
|---|
| 1256 | }); |
|---|
| 1257 | |
|---|
| 1258 | var span1 = Html.span({}, ""); |
|---|
| 1259 | var message = ''; |
|---|
| 1260 | if(new_assign) { |
|---|
| 1261 | span1 = Html.span({}, removeRefereeAlertsMessage(checkedContributions)); |
|---|
| 1262 | } |
|---|
| 1263 | if(role == 'reviewer' && order == 'remove') { |
|---|
| 1264 | if (checkedContributions.length == 1){ |
|---|
| 1265 | message = $T("The Reviewer you choose will be removed only from the contribution that is assigned to him/her.") |
|---|
| 1266 | } else { |
|---|
| 1267 | message = $T("The Reviewer you choose will be removed only from the contributions that are assigned to him/her.") |
|---|
| 1268 | } |
|---|
| 1269 | span1 = Html.span({}, message); |
|---|
| 1270 | } |
|---|
| 1271 | return this.ExclusivePopup.prototype.draw.call(this, Widget.block([span1, userList, cancelButton])); |
|---|
| 1272 | }; |
|---|
| 1273 | popup.open(); |
|---|
| 1274 | |
|---|
| 1275 | } else { |
|---|
| 1276 | IndicoUtil.errorReport(error); |
|---|
| 1277 | } |
|---|
| 1278 | } |
|---|
| 1279 | ); |
|---|
| 1280 | } |
|---|
| 1281 | |
|---|
| 1282 | var fetchUsersPerAttribute = function(order, role, attribute) { |
|---|
| 1283 | |
|---|
| 1284 | var checkedContributions = getCheckedContributions(); |
|---|
| 1285 | if (checkedContributions.length > 0) { |
|---|
| 1286 | deselectAll('selectedContributions'); |
|---|
| 1287 | } |
|---|
| 1288 | |
|---|
| 1289 | |
|---|
| 1290 | indicoRequest( |
|---|
| 1291 | 'reviewing.conference.userCompetencesList', |
|---|
| 1292 | {conference: '<%= Conference.getId() %>', role: role}, |
|---|
| 1293 | function(result,error) { |
|---|
| 1294 | if (!error) { |
|---|
| 1295 | |
|---|
| 1296 | action = order + '_' + role; |
|---|
| 1297 | |
|---|
| 1298 | var title = ''; |
|---|
| 1299 | if (role == 'editor') { |
|---|
| 1300 | title = $T('Follow the steps to ') + order + $T(' a layout reviewer:'); |
|---|
| 1301 | } |
|---|
| 1302 | if (role == 'reviewer') { |
|---|
| 1303 | title = $T('Follow the steps to ') + order + $T(' a content reviewer:'); |
|---|
| 1304 | } |
|---|
| 1305 | if (role == 'referee') { |
|---|
| 1306 | title = $T('Follow the steps to ') + order + ' a ' + role + ':'; |
|---|
| 1307 | } |
|---|
| 1308 | |
|---|
| 1309 | var popup = new ExclusivePopup(title, function(){popup.close();}); |
|---|
| 1310 | |
|---|
| 1311 | popup.draw = function(){ |
|---|
| 1312 | |
|---|
| 1313 | var AttributeDiv = Html.div(); |
|---|
| 1314 | |
|---|
| 1315 | var attributeList = function () { |
|---|
| 1316 | indicoRequest( |
|---|
| 1317 | 'reviewing.conference.attributeList', |
|---|
| 1318 | {conference: '<%= Conference.getId()%>', attribute: attribute}, |
|---|
| 1319 | function(result, error){ |
|---|
| 1320 | if(!error){ |
|---|
| 1321 | var attributes = $L(); |
|---|
| 1322 | var attributeTemplate = function(att){ |
|---|
| 1323 | var li = Html.li({style:{listStyleType:"none", paddingBottom:'3px'}}); |
|---|
| 1324 | var id = (att.id); |
|---|
| 1325 | var name = ("selected"+attribute); |
|---|
| 1326 | var checkbox = Html.input('checkbox', {id: id, name: name}); |
|---|
| 1327 | var attributeName = Html.span({style:{marginLeft:'5px', fontSize: '13px'}}, att.title); |
|---|
| 1328 | |
|---|
| 1329 | li.set(Widget.inline([checkbox, attributeName])); |
|---|
| 1330 | |
|---|
| 1331 | return li; |
|---|
| 1332 | } |
|---|
| 1333 | var step1 = Html.span({style:{fontSize:'18px'}, className:'groupTitle groupTitleNoBorder'}, 'Step 1: Choose a '+ attribute); |
|---|
| 1334 | var attList = Html.ul(); |
|---|
| 1335 | bind.element(attList, attributes, attributeTemplate); |
|---|
| 1336 | if(result.length==0) { |
|---|
| 1337 | var killProgress = IndicoUI.Dialogs.Util.progress() |
|---|
| 1338 | popup.close(); |
|---|
| 1339 | killProgress(); |
|---|
| 1340 | alert('There is no '+attribute+' define.'); |
|---|
| 1341 | } |
|---|
| 1342 | for (i in result) { |
|---|
| 1343 | attributes.append(result[i]); |
|---|
| 1344 | } |
|---|
| 1345 | |
|---|
| 1346 | AttributeDiv.set(Widget.block([step1,attList])); |
|---|
| 1347 | } else { |
|---|
| 1348 | IndicoUtil.errorReport(error); |
|---|
| 1349 | } |
|---|
| 1350 | } |
|---|
| 1351 | ); |
|---|
| 1352 | } |
|---|
| 1353 | |
|---|
| 1354 | var getCheckedAttributes = function() { |
|---|
| 1355 | var checkBoxes = document.getElementsByName("selected"+attribute); |
|---|
| 1356 | var checkedAttributes = [] |
|---|
| 1357 | for (var i=0; i<checkBoxes.length; i++) { |
|---|
| 1358 | var cb = checkBoxes[i]; |
|---|
| 1359 | if (cb.checked) { |
|---|
| 1360 | checkedAttributes.push(cb.id) |
|---|
| 1361 | } |
|---|
| 1362 | } |
|---|
| 1363 | return checkedAttributes; |
|---|
| 1364 | } |
|---|
| 1365 | var assignButton = Html.button({style:{marginLeft:pixels(5)}}, $T("Assign")); |
|---|
| 1366 | |
|---|
| 1367 | var users = $L(); |
|---|
| 1368 | var contrPerAttribute = []; |
|---|
| 1369 | |
|---|
| 1370 | var contributionsIdList = function (user, chAtt){ |
|---|
| 1371 | indicoRequest( |
|---|
| 1372 | 'reviewing.conference.contributionsIdPerSelectedAttribute', |
|---|
| 1373 | {conference: '<%= Conference.getId()%>', attribute: attribute, selectedAttributes:chAtt }, |
|---|
| 1374 | function(result, error){ |
|---|
| 1375 | if(!error){ |
|---|
| 1376 | for (i in result) { |
|---|
| 1377 | contrPerAttribute.push(result[i]); |
|---|
| 1378 | } |
|---|
| 1379 | if ((order == 'assign' && role == 'editor') || (order == 'add' && role == 'reviewer')) { |
|---|
| 1380 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 1381 | if (!checkAllHaveReferee(contrPerAttribute, order, role, true)) { |
|---|
| 1382 | return; |
|---|
| 1383 | } |
|---|
| 1384 | <% end %> |
|---|
| 1385 | } |
|---|
| 1386 | userSelected(user, contrPerAttribute); |
|---|
| 1387 | } |
|---|
| 1388 | else { |
|---|
| 1389 | IndicoUtil.errorReport(error); |
|---|
| 1390 | } |
|---|
| 1391 | } |
|---|
| 1392 | ); |
|---|
| 1393 | } |
|---|
| 1394 | var userTemplate = function(user) { |
|---|
| 1395 | var li = Html.li({style:{listStyleType:"none", paddingBottom:'3px'}}); |
|---|
| 1396 | var name = ("radioBtn"); |
|---|
| 1397 | var radioButton = Html.input('radio', {id: user.id, name: name}); |
|---|
| 1398 | var userName = Html.label({style:{fontWeight: 'normal'}}, user.name); |
|---|
| 1399 | |
|---|
| 1400 | var userCompetences = Html.span({style:{marginLeft:'5px', fontSize: '11px'}}, |
|---|
| 1401 | user.competences.length == 0 ? $T('(no competences defined)') : $T('(competences: ') + user.competences.join(', ') + ')' |
|---|
| 1402 | ); |
|---|
| 1403 | |
|---|
| 1404 | li.set(Widget.inline([radioButton, userName, userCompetences])); |
|---|
| 1405 | return li; |
|---|
| 1406 | } |
|---|
| 1407 | var step2 = Html.span({style:{fontSize:'18px'}, className:'groupTitle groupTitleNoBorder'}, 'Step 2: Click on a user name to assign a '+ role); |
|---|
| 1408 | var userList = Html.ul(); |
|---|
| 1409 | bind.element(userList, users, userTemplate); |
|---|
| 1410 | |
|---|
| 1411 | for (i in result) { |
|---|
| 1412 | users.append(result[i]); |
|---|
| 1413 | } |
|---|
| 1414 | |
|---|
| 1415 | attributeList(); |
|---|
| 1416 | |
|---|
| 1417 | assignButton.observeClick(function(){ |
|---|
| 1418 | var chAtt = getCheckedAttributes(); |
|---|
| 1419 | if(chAtt.length == 0){ |
|---|
| 1420 | alert($T('You must select at least one attribute.')); |
|---|
| 1421 | } else { |
|---|
| 1422 | var checkedBtn = function(){ |
|---|
| 1423 | var allBtn = document.getElementsByName('radioBtn'); |
|---|
| 1424 | for (var i=0; i<allBtn.length; i++) { |
|---|
| 1425 | var cb = allBtn[i]; |
|---|
| 1426 | if (cb.checked) { |
|---|
| 1427 | return cb.id |
|---|
| 1428 | } |
|---|
| 1429 | } |
|---|
| 1430 | } |
|---|
| 1431 | var checkedBtnId = checkedBtn(); |
|---|
| 1432 | if(checkedBtnId == null){ |
|---|
| 1433 | alert($T('You must select at least one user.')); |
|---|
| 1434 | } else { |
|---|
| 1435 | for (var i=0; i < users.length.get(); i++) { |
|---|
| 1436 | user = users.item(i); |
|---|
| 1437 | if (user.id == checkedBtnId) { |
|---|
| 1438 | contributionsIdList(user, chAtt); |
|---|
| 1439 | } |
|---|
| 1440 | } |
|---|
| 1441 | var killProgress = IndicoUI.Dialogs.Util.progress() |
|---|
| 1442 | popup.close(); |
|---|
| 1443 | killProgress(); |
|---|
| 1444 | } |
|---|
| 1445 | } |
|---|
| 1446 | }); |
|---|
| 1447 | |
|---|
| 1448 | var cancelButton = Html.button({style:{marginLeft:pixels(5)}}, $T("Cancel")); |
|---|
| 1449 | cancelButton.observeClick(function(){ |
|---|
| 1450 | popup.close(); |
|---|
| 1451 | }); |
|---|
| 1452 | |
|---|
| 1453 | return this.ExclusivePopup.prototype.draw.call(this, Html.div({style: {height: 'auto', width: 'auto'}},Widget.block([AttributeDiv, step2, userList, assignButton, cancelButton]))); |
|---|
| 1454 | }; |
|---|
| 1455 | popup.open(); |
|---|
| 1456 | |
|---|
| 1457 | } else { |
|---|
| 1458 | IndicoUtil.errorReport(error); |
|---|
| 1459 | } |
|---|
| 1460 | } |
|---|
| 1461 | ); |
|---|
| 1462 | } |
|---|
| 1463 | |
|---|
| 1464 | /** |
|---|
| 1465 | * Removes the referee, the editor, or all the reviewers from the contributions that are selected. |
|---|
| 1466 | * @param {Object} role 'referee', 'editor', 'allReviewers' |
|---|
| 1467 | */ |
|---|
| 1468 | var removeUser = function(role) { |
|---|
| 1469 | |
|---|
| 1470 | var checkedContributions = getCheckedContributions(); |
|---|
| 1471 | if (checkedContributions.length == 0) { |
|---|
| 1472 | alert($T("Please select at least 1 contribution")); |
|---|
| 1473 | return; |
|---|
| 1474 | } |
|---|
| 1475 | |
|---|
| 1476 | var params = {conference: '<%= Conference.getId() %>',contributions: checkedContributions} |
|---|
| 1477 | |
|---|
| 1478 | switch(role) { |
|---|
| 1479 | case 'referee': |
|---|
| 1480 | indicoRequest( |
|---|
| 1481 | 'reviewing.conference.removeReferee', |
|---|
| 1482 | params, |
|---|
| 1483 | function(result,error) { |
|---|
| 1484 | if (!error) { |
|---|
| 1485 | if (!removeNoRefereeAlerts(checkedContributions, role)) { |
|---|
| 1486 | return; |
|---|
| 1487 | } |
|---|
| 1488 | for (i in checkedContributions) { |
|---|
| 1489 | contributionId = checkedContributions[i]; |
|---|
| 1490 | contribution = getContribution(contributionId); |
|---|
| 1491 | contribution.reviewManager.referee = null; |
|---|
| 1492 | updateContribution(contributionId); |
|---|
| 1493 | colorify(contributionId, 'referee') |
|---|
| 1494 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1495 | isSelected(contributionId); |
|---|
| 1496 | } |
|---|
| 1497 | if(!removeRefereeAlerts(checkedContributions)){ |
|---|
| 1498 | fetchUsers('new_assign', 'referee') |
|---|
| 1499 | } |
|---|
| 1500 | } else { |
|---|
| 1501 | IndicoUtil.errorReport(error); |
|---|
| 1502 | } |
|---|
| 1503 | } |
|---|
| 1504 | ); |
|---|
| 1505 | break; |
|---|
| 1506 | case 'editor': |
|---|
| 1507 | indicoRequest( |
|---|
| 1508 | 'reviewing.conference.removeEditor', |
|---|
| 1509 | params, |
|---|
| 1510 | function(result,error) { |
|---|
| 1511 | if (!error) { |
|---|
| 1512 | if (!removeEditorAlerts(checkedContributions, role)) { |
|---|
| 1513 | return; |
|---|
| 1514 | } |
|---|
| 1515 | for (i in checkedContributions) { |
|---|
| 1516 | contributionId = checkedContributions[i]; |
|---|
| 1517 | contribution = getContribution(contributionId); |
|---|
| 1518 | contribution.reviewManager.editor = null; |
|---|
| 1519 | updateContribution(contributionId); |
|---|
| 1520 | colorify(contributionId, 'editor') |
|---|
| 1521 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1522 | isSelected(contributionId); |
|---|
| 1523 | } |
|---|
| 1524 | } else { |
|---|
| 1525 | IndicoUtil.errorReport(error); |
|---|
| 1526 | } |
|---|
| 1527 | } |
|---|
| 1528 | ); |
|---|
| 1529 | break; |
|---|
| 1530 | case 'allReviewers': |
|---|
| 1531 | indicoRequest( |
|---|
| 1532 | 'reviewing.conference.removeAllReviewers', |
|---|
| 1533 | params, |
|---|
| 1534 | function(result,error) { |
|---|
| 1535 | if (!error) { |
|---|
| 1536 | if (!removeReviewersAlerts(checkedContributions, role)) { |
|---|
| 1537 | return; |
|---|
| 1538 | } |
|---|
| 1539 | for (i in checkedContributions) { |
|---|
| 1540 | contributionId = checkedContributions[i]; |
|---|
| 1541 | contribution = getContribution(contributionId); |
|---|
| 1542 | contribution.reviewManager.reviewersList = []; |
|---|
| 1543 | updateContribution(contributionId); |
|---|
| 1544 | colorify(contributionId, 'reviewer') |
|---|
| 1545 | $E('cb' + contributionId).dom.checked = true; //updateContribution will build a row with an unchecked checkbox |
|---|
| 1546 | isSelected(contributionId); |
|---|
| 1547 | } |
|---|
| 1548 | } else { |
|---|
| 1549 | IndicoUtil.errorReport(error); |
|---|
| 1550 | } |
|---|
| 1551 | } |
|---|
| 1552 | ); |
|---|
| 1553 | default: |
|---|
| 1554 | break; |
|---|
| 1555 | } |
|---|
| 1556 | } |
|---|
| 1557 | |
|---|
| 1558 | // Code to be executed on page load |
|---|
| 1559 | |
|---|
| 1560 | buildShowHideFiltering(); |
|---|
| 1561 | $E('filteringTable').dom.style.display = 'none'; |
|---|
| 1562 | |
|---|
| 1563 | bind.element($E("tablebody"), contributions, contributionTemplate); |
|---|
| 1564 | |
|---|
| 1565 | $E('applyFilter').observeClick(fetchContributions); |
|---|
| 1566 | |
|---|
| 1567 | <% if not IsOnlyReferee and not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 1568 | $E('assignRefereeButton_top').observeClick(function(){ fetchUsers('assign', 'referee'); }); |
|---|
| 1569 | assignPerTrackMenus('referee', 'top'); |
|---|
| 1570 | assignPerTrackMenus('referee', 'bottom'); |
|---|
| 1571 | $E('assignRefereeButton_bottom').observeClick(function(){ fetchUsers('assign', 'referee'); }); |
|---|
| 1572 | $E('removeRefereeButton_top').observeClick(function(){ removeUser('referee') }); |
|---|
| 1573 | $E('removeRefereeButton_bottom').observeClick(function(){ removeUser('referee') }); |
|---|
| 1574 | <% end %> |
|---|
| 1575 | |
|---|
| 1576 | <% if not (ConfReview.getChoice() == 2 or ConfReview.getChoice() == 1): %> |
|---|
| 1577 | $E('assignEditorButton_top').observeClick(function(){ fetchUsers('assign', 'editor'); }); |
|---|
| 1578 | assignPerTrackMenus('editor', 'top'); |
|---|
| 1579 | assignPerTrackMenus('editor', 'bottom'); |
|---|
| 1580 | $E('assignEditorButton_bottom').observeClick(function(){ fetchUsers('assign', 'editor'); }); |
|---|
| 1581 | $E('removeEditorButton_top').observeClick(function(){ removeUser('editor') }); |
|---|
| 1582 | $E('removeEditorButton_bottom').observeClick(function(){ removeUser('editor') }); |
|---|
| 1583 | <% end %> |
|---|
| 1584 | |
|---|
| 1585 | <% if not (ConfReview.getChoice() == 3 or ConfReview.getChoice() == 1): %> |
|---|
| 1586 | $E('addReviewerButton_top').observeClick(function(){ fetchUsers('add', 'reviewer'); }); |
|---|
| 1587 | assignPerTrackMenus('reviewer', 'top'); |
|---|
| 1588 | assignPerTrackMenus('reviewer', 'bottom'); |
|---|
| 1589 | $E('addReviewerButton_bottom').observeClick(function(){ fetchUsers('add', 'reviewer'); }); |
|---|
| 1590 | $E('removeReviewerButton_top').observeClick(function(){ fetchUsers('remove', 'reviewer'); }); |
|---|
| 1591 | $E('removeReviewerButton_bottom').observeClick(function(){ fetchUsers('remove', 'reviewer'); }); |
|---|
| 1592 | $E('removeAllReviewersButton_top').observeClick(function(){ removeUser('allReviewers') }); |
|---|
| 1593 | $E('removeAllReviewersButton_bottom').observeClick(function(){ removeUser('allReviewers') }); |
|---|
| 1594 | <% end %> |
|---|
| 1595 | |
|---|
| 1596 | fetchContributions(); |
|---|
| 1597 | |
|---|
| 1598 | </script> |
|---|
| 1599 | <% end %> |
|---|
| 1600 | <% end %> |
|---|