Changeset ac1aa3 in indico
- Timestamp:
- 03/02/11 14:03:36 (2 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
- Children:
- ddf66a
- Parents:
- 4bd61a
- git-author:
- Alexis Castilla Hernandez <alexis.castilla.hernandez@…> (01/24/11 17:43:15)
- git-committer:
- Jose Benito <jose.benito.gonzalez@…> (03/02/11 14:03:36)
- Location:
- indico
- Files:
-
- 6 edited
-
MaKaC/review.py (modified) (3 diffs)
-
MaKaC/reviewing.py (modified) (4 diffs)
-
MaKaC/services/implementation/reviewing.py (modified) (1 diff)
-
MaKaC/webinterface/tpls/ConfModifAbstractReviewingSettings.tpl (modified) (1 diff)
-
htdocs/js/indico/Core/Dialogs/Popup.js (modified) (5 diffs)
-
htdocs/js/indico/Legacy/Widgets.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/review.py
r4bd61a rac1aa3 1121 1121 abs.recalculateRating(scaleLower, scaleHigher) 1122 1122 1123 def removeAnswersOfQuestion(self, questionId): 1124 ''' Remove a question results for each abstract ''' 1125 for abs in self.getAbstractList(): 1126 abs.removeAnswersOfQuestion(questionId) 1123 1127 1124 1128 def notifyModification(self): … … 2374 2378 self._rating = "%.2f" % (ratingSum/judNum) 2375 2379 2380 def removeAnswersOfQuestion(self, questionId): 2381 ''' Remove the answers of the question with questionId value ''' 2382 for track in self.getTrackListSorted(): 2383 for jud in self.getJudgementsHistoricalByTrack(track): 2384 jud.removeAnswer(questionId) 2385 2376 2386 2377 2387 … … 2470 2480 self._totalJudValue = self.calculateAnswersTotalValue() 2471 2481 2482 def removeAnswer(self, questionId): 2483 ''' Remove the current answers of the questionId ''' 2484 for ans in self._answers: 2485 if ans.getQuestionId() == questionId: 2486 self._answers.remove(ans) 2472 2487 2473 2488 -
indico/MaKaC/reviewing.py
r4bd61a rac1aa3 1114 1114 """ Returns the list of questions 1115 1115 """ 1116 return self._reviewingQuestions 1117 1118 def removeReviewingQuestion(self, questionId): 1116 # Filter the non visible questions 1117 visibleQuestions = [] 1118 for question in self._reviewingQuestions: 1119 if question.getVisible(): 1120 visibleQuestions.append(question) 1121 return visibleQuestions 1122 1123 def removeReviewingQuestion(self, questionId, keepJud): 1119 1124 """ Removes a question from the list 1120 1125 """ … … 1122 1127 1123 1128 if question: 1124 self._reviewingQuestions.remove(question) 1125 self.notifyModification() 1129 if keepJud: 1130 question.setVisible(False) 1131 else: 1132 self._reviewingQuestions.remove(question) 1133 self.notifyModification() 1126 1134 else: 1127 1135 raise MaKaCError("Cannot remove a question which doesn't exist") … … 1271 1279 self._id = newId 1272 1280 self._text = text 1281 self._visible = True 1273 1282 1274 1283 def getId(self): … … 1278 1287 return self._text 1279 1288 1289 def getVisible(self): 1290 return self._visible 1291 1280 1292 def setText(self, text): 1281 1293 self._text = text 1294 1295 def setVisible(self, value): 1296 self._visible = value 1282 1297 1283 1298 def notifyModification(self): -
indico/MaKaC/services/implementation/reviewing.py
r4bd61a rac1aa3 947 947 AbstractReviewingBase._checkParams(self) 948 948 self._value = self._params.get("value") # value is the question id 949 950 def _getAnswer(self): 951 self._confAbstractReview.removeReviewingQuestion(self._value) 949 self._keepJud = self._params.get("keepJud") # keep the previous judgements of the question 950 951 def _getAnswer(self): 952 # remove the question 953 self._confAbstractReview.removeReviewingQuestion(self._value, self._keepJud) 954 if not self._keepJud: 955 # Purge all the judgements already exist with answers of this question 956 self._conf.getAbstractMgr().removeAnswersOfQuestion(self._value) 957 self._conf.getAbstractMgr().recalculateAbstractsRating(self._confAbstractReview.getScaleLower(), self._confAbstractReview.getScaleHigher()) 952 958 reviewingQuestions = self._confAbstractReview.getReviewingQuestions() 959 # Build the answer 953 960 fossils = [] 954 961 for question in reviewingQuestions: -
indico/MaKaC/webinterface/tpls/ConfModifAbstractReviewingSettings.tpl
rbcaaf6 rac1aa3 45 45 'edit': 'reviewing.abstractReviewing.editQuestion'}, 46 46 {conference: '<%= abstractReview.getConference().getId() %>'},'question', 47 'Add the questions that the abstract reviewers must answer' ));47 'Add the questions that the abstract reviewers must answer', true)); 48 48 49 49 -
indico/htdocs/js/indico/Core/Dialogs/Popup.js
r8272ae rac1aa3 505 505 var self = this; 506 506 507 var okButton = Html.input('button', {style:{marginRight: pixels(3)}}, $T( 'OK'));507 var okButton = Html.input('button', {style:{marginRight: pixels(3)}}, $T(this.buttonTitle)); 508 508 okButton.observeClick(function(){ 509 509 self.close(); … … 523 523 }, 524 524 525 function(title, content, handler ) {525 function(title, content, handler, buttonTitle) { 526 526 var self = this; 527 527 528 if (buttonTitle) { 529 this.buttonTitle = buttonTitle; 530 } else { 531 this.buttonTitle = 'OK'; 532 } 528 533 this.content = content; 529 534 this.handler = handler; … … 578 583 579 584 /** 580 * Works exactly the same as the ConfirmPopup, but includes a parametermanager to perform checks when pressing OK 581 */ 582 type("ConfirmPopupWithPM", ["ExclusivePopupWithButtons"], 583 { 584 draw: function() { 585 var self = this; 586 587 var okButton = Html.input('button', {style:{marginRight: pixels(3)}}, $T('OK')); 588 okButton.observeClick(function(){ 589 checkOK = self.parameterManager.check(); 590 if(checkOK){ 591 self.handler(true); 592 } 593 }); 594 595 var cancelButton = Html.input('button', {style:{marginLeft: pixels(3)}}, $T('Cancel')); 596 cancelButton.observeClick(function(){ 597 self.close(); 598 self.handler(false); 599 }); 600 601 return this.ExclusivePopupWithButtons.prototype.draw.call(this, 602 this.content, 603 Html.div({}, okButton, cancelButton)); 604 } 605 }, 606 607 function(title, content, handler) { 608 var self = this; 609 610 this.content = content; 611 this.handler = handler; 612 this.parameterManager = new IndicoUtil.parameterManager(); 613 this.ExclusivePopupWithButtons(Html.div({style:{textAlign: 'center'}}, title), function(){ 614 self.handler(false); 615 return true; 616 }); 617 } 618 ); 619 620 * It will have a title, a close button, an SAVE button and a Cancel button. 585 * Utility function to display a three buttons popup. 586 * The difference with ConfirmButton is the existence of a third button. 587 * Apart from the title and close button, the three buttons display, two of them configurables and Cancel 621 588 * @param {Html or String} title The title of the error popup. 622 589 * @param {Element} content Anything you want to put inside. 623 * @param {function} handler A function that will be called with a booleanas argument:624 * true if the user pressers "Save", or false if the user presses"Cancel"625 */ 626 type("S avePopup", ["ExclusivePopupWithButtons"],590 * @param {function} handler A function that will be called with an Integer as argument: 591 * 1 if the user press button1, 2 for button2, 0 for "Cancel" 592 */ 593 type("SpecialRemovePopup", ["ExclusivePopupWithButtons"], 627 594 { 628 595 draw: function() { 629 596 var self = this; 630 597 631 var saveButton = Html.input('button', {style:{marginRight: pixels(3)}}, $T('Save')); 632 saveButton.observeClick(function(){ 633 self.close(); 634 self.handler(true); 598 var button1 = Html.input('button', {style:{marginRight: pixels(3)}}, $T(this.buttonTitle1)); 599 button1.observeClick(function(){ 600 self.close(); 601 self.handler(1); 602 }); 603 604 var button2 = Html.input('button', {style:{marginLeft: pixels(3), marginRight: pixels(3)}}, $T(this.buttonTitle2)); 605 button2.observeClick(function(){ 606 self.close(); 607 self.handler(2); 635 608 }); 636 609 … … 638 611 cancelButton.observeClick(function(){ 639 612 self.close(); 613 self.handler(0); 640 614 }); 641 615 642 616 return this.ExclusivePopupWithButtons.prototype.draw.call(this, 643 617 this.content, 644 Html.div({}, saveButton, cancelButton));618 Html.div({}, button1, button2, cancelButton)); 645 619 } 646 620 }, 647 621 648 function(title, content, handler ) {622 function(title, content, handler, buttonTitle1, buttonTitle2) { 649 623 var self = this; 650 624 625 this.buttonTitle1 = buttonTitle1; 626 this.buttonTitle2 = buttonTitle2; 651 627 this.content = content; 652 628 this.handler = handler; 653 629 this.ExclusivePopupWithButtons(Html.div({style:{textAlign: 'center'}}, title), function(){ 630 self.handler(0); 654 631 return true; 655 632 }); 656 633 } 657 634 ); 635 658 636 659 637 /** … … 710 688 } 711 689 ); 690 712 691 713 692 type("WarningPopup", ["AlertPopup"], -
indico/htdocs/js/indico/Legacy/Widgets.js
rbcaaf6 rac1aa3 1209 1209 @param methods: get, add, remove, edit 1210 1210 @param kindOfElement: Title of the element that you want to manage. Example 'question' 1211 @param header: Header for the table of elements 1211 @param header: Header text for the table of elements 1212 @param specialRemove: Shows if is necessary a special way to remove items 1212 1213 @return result (return of request): list of items with the fields 'text': content of the item, 'id': element id. 1213 1214 @return the content of the component. Table with list of elements and input and button to add new elements to the list 1214 1215 */ 1215 manageListOfElements: function(methods, attributes, kindOfElement, header ) {1216 manageListOfElements: function(methods, attributes, kindOfElement, header, specialRemove) { 1216 1217 1217 1218 var widgetContent = Html.div(); … … 1262 1263 }; 1263 1264 1264 // Draw the list of current questions added 1265 var drawListOfElements = function(result) { 1266 // Initialize the i counter 1267 this.i = 0; 1268 self = this; 1269 1270 // Remove previous elements 1271 if ($E('elementsDiv')) { 1272 widgetContent.remove($E('elementsDiv')); 1273 } 1274 1275 if (result.length) { 1276 var content = Html.div({id:'elementsDiv'}); 1277 var table = Html.table({className:'infoQuestionsTable', cellspacing:'0'}); 1278 content.append(table); 1279 1280 // Create the table with the required data 1281 var tr; 1282 var spanRemoveList = []; 1283 var spanEditList = []; 1284 var tdEdit; 1285 var tdRemove; 1286 1287 for (var i=0; i < result.length ; i++) { 1288 tr = Html.tr({className: 'infoTR'}); 1289 tdElement = Html.td({className: 'questionContent'}, result[i].text); 1290 tdElement.dom.id = "TEID_"+result[i].id; 1291 1292 // 'Edit' elements and functionality 1293 tdEdit = Html.td({className: 'content'}); 1294 var spanEdit = Html.span({className: 'link'},'Edit'); 1295 spanEdit.dom.id = "QEID_"+result[i].id; // Set the span id with the question id included 1296 spanEdit.dom.name = result[i].text; 1297 spanEditList.push(spanEdit); 1298 tdEdit.append(spanEdit); 1299 1300 spanEditList[i].observeClick(function(event) { 1301 var spanId = event.target.id.split('_')[1]; 1302 var previousText = $E('TEID_'+spanId).dom.textContent; 1303 var popupContent = Html.textarea({id:'modifyArea', cols:'40', rows:'7'}, previousText); 1304 var popup = new SavePopup('Edit '+kindOfElement, popupContent, 1305 function(event) { 1306 var attr = attributes; 1307 attr['id'] = spanId; 1308 attr['text'] = popupContent.dom.value; 1309 indicoRequest(methods.edit, 1310 attr, 1311 function(result, error){ 1312 if (!error) { 1313 widgetContent.append(drawListOfElements(result)); 1314 widgetContent.append(drawFooter()); 1265 // Draw the list of current questions added 1266 var drawListOfElements = function(result) { 1267 // Initialize the i counter 1268 this.i = 0; 1269 self = this; 1270 1271 // Remove previous elements 1272 if ($E('elementsDiv')) { 1273 widgetContent.remove($E('elementsDiv')); 1274 } 1275 1276 if (result.length) { 1277 var content = Html.div({id:'elementsDiv'}); 1278 var table = Html.table({className:'infoQuestionsTable', cellspacing:'0'}); 1279 content.append(table); 1280 1281 // Create the table with the required data 1282 var tr; 1283 var spanRemoveList = []; 1284 var spanEditList = []; 1285 var tdEdit; 1286 var tdRemove; 1287 1288 for (var i=0; i < result.length ; i++) { 1289 tr = Html.tr({className: 'infoTR'}); 1290 tdElement = Html.td({className: 'questionContent'}, result[i].text); 1291 tdElement.dom.id = "TEID_"+result[i].id; 1292 1293 // 'Edit' elements and functionality 1294 tdEdit = Html.td({className: 'content'}); 1295 var spanEdit = Html.span({className: 'link'},'Edit'); 1296 spanEdit.dom.id = "QEID_"+result[i].id; // Set the span id with the question id included 1297 spanEdit.dom.name = result[i].text; 1298 spanEditList.push(spanEdit); 1299 tdEdit.append(spanEdit); 1300 1301 spanEditList[i].observeClick(function(event) { 1302 var spanId = event.target.id.split('_')[1]; 1303 var previousText = $E('TEID_'+spanId).dom.textContent; 1304 var popupContent = Html.textarea({id:'modifyArea', cols:'40', rows:'7'}, previousText); 1305 var popup = new ConfirmPopup('Edit '+kindOfElement, popupContent, 1306 function(action) { 1307 if (action) { 1308 var attr = attributes; 1309 attr['id'] = spanId; 1310 attr['text'] = popupContent.dom.value; 1311 indicoRequest(methods.edit, 1312 attr, 1313 function(result, error){ 1314 if (!error) { 1315 widgetContent.append(drawListOfElements(result)); 1316 widgetContent.append(drawFooter()); 1317 } 1318 }); 1319 } 1320 }, 'Save'); 1321 popup.open(); 1322 }); 1323 1324 // 'Remove' elements and functionality 1325 tdRemove = Html.td({className: 'content'}); 1326 var spanRemove = Html.span({className: 'link'},'Remove'); 1327 spanRemove.dom.id = "QRID_"+result[i].id; // Set the span id with the question id included 1328 spanRemoveList.push(spanRemove); 1329 tdRemove.append(spanRemove); 1330 1331 spanRemoveList[i].observeClick(function(event){ 1332 var spanId = event.target.id.split('_')[1]; 1333 1334 var attr = attributes; 1335 attr['value'] = spanId; 1336 if (!specialRemove) { 1337 var popupContent = Html.span({}, 'Are you sure you want to remove the element?'); 1338 var popup = new ConfirmPopup('Remove '+kindOfElement, popupContent, 1339 function(action) { 1340 if (action) { 1341 var attr = attributes; 1342 attr['id'] = spanId; 1343 indicoRequest(methods.remove, 1344 attr, 1345 function(result, error){ 1346 if (!error) { 1347 widgetContent.append(drawListOfElements(result)); 1348 widgetContent.append(drawFooter()); 1349 } 1350 }); 1351 } 1352 }, 'Remove'); 1353 } else { 1354 var popupContent = Html.span({}, 'Do you want to keep the ratings of the judgements of this question (if they exist)?'); 1355 // For this popup we need two handlers 1356 var popup = new SpecialRemovePopup('Remove '+kindOfElement, popupContent, 1357 function(option) { 1358 if (option == 0) { 1359 // close popup option 1360 null; 1315 1361 } 1316 }); 1317 }); 1318 popup.open(); 1319 }); 1320 1321 // 'Remove' elements and functionality 1322 tdRemove = Html.td({className: 'content'}); 1323 var spanRemove = Html.span({className: 'link'},'Remove'); 1324 spanRemove.dom.id = "QRID_"+result[i].id; // Set the span id with the question id included 1325 spanRemoveList.push(spanRemove); 1326 tdRemove.append(spanRemove); 1327 1328 spanRemoveList[i].observeClick(function(event){ 1329 var spanId = event.target.id.split('_')[1]; 1330 1331 var attr = attributes; 1332 attr['value'] = spanId; 1333 1334 var popupContent = Html.span({}, 'Are you sure you want to remove the element?'); 1335 var popup = new SavePopup('Remove '+kindOfElement, popupContent, 1336 function(event) { 1337 var attr = attributes; 1338 attr['id'] = spanId; 1339 indicoRequest(methods.remove, 1340 attr, 1341 function(result, error){ 1342 if (!error) { 1343 widgetContent.append(drawListOfElements(result)); 1344 widgetContent.append(drawFooter()); 1345 } 1346 }); 1347 }); 1348 popup.open(); 1349 }); 1350 1351 1352 table.append(tr); 1353 tr.append(tdElement); 1354 tr.append(tdEdit); 1355 tr.append(tdRemove); 1356 } 1357 } 1358 return content; 1359 1360 }; 1362 if (option == 1) { 1363 // Keep ratings handler 1364 var attr = attributes; 1365 attr['id'] = spanId; 1366 attr['keepJud'] = true; 1367 indicoRequest(methods.remove, 1368 attr, 1369 function(result, error){ 1370 if (!error) { 1371 widgetContent.append(drawListOfElements(result)); 1372 widgetContent.append(drawFooter()); 1373 } 1374 }); 1375 } 1376 if (option == 2) { 1377 // Remove ratings handler 1378 var attr = attributes; 1379 attr['id'] = spanId; 1380 attr['keepJud'] = false; 1381 indicoRequest(methods.remove, 1382 attr, 1383 function(result, error){ 1384 if (!error) { 1385 widgetContent.append(drawListOfElements(result)); 1386 widgetContent.append(drawFooter()); 1387 } 1388 }); 1389 } 1390 }, 'Keep ratings', 'Remove ratings'); 1391 } 1392 popup.open(); 1393 }); 1394 1395 1396 table.append(tr); 1397 tr.append(tdElement); 1398 tr.append(tdEdit); 1399 tr.append(tdRemove); 1400 } 1401 } 1402 return content; 1403 1404 }; 1361 1405 1362 1406 return widgetContent;
Note: See TracChangeset
for help on using the changeset viewer.
