Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r2d3c74d54fc59c736099961fb33d9d1dd30263d0 -r666a01da9d0d2b4482ca00041527739b5e56b9f2
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2d3c74d54fc59c736099961fb33d9d1dd30263d0)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 666a01da9d0d2b4482ca00041527739b5e56b9f2)
@@ -980,6 +980,9 @@
label.qb.collection.unshare = Unshare
label.qb.collection.share = Share
label.qb.collection.edit = Edit
+label.qb.collection.remove.questions = Remove questions
+label.qb.collection.remove.questions.tooltip = Remove all selected questions from the collection. If they are present only in this collection, they will be permanently removed.
+label.qb.collection.remove.questions.fail = Some questions are only present in this collection, so they would be permanently removed.\\nIt is not possible as they are used in sequences.
error.form.validation.error = You have 1 error in a form. It has been highlighted
error.form.validation.errors = You have {0} errors in a form. They have been highlighted
label.authoring.choice.add.multiple.choice = Add multiple choice
Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java
===================================================================
diff -u -r21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b -r666a01da9d0d2b4482ca00041527739b5e56b9f2
--- lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 21555f88fd0c63a4a9eb3ae288a2e1d48452aa4b)
+++ lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 666a01da9d0d2b4482ca00041527739b5e56b9f2)
@@ -197,6 +197,19 @@
qbService.removeQuestionFromCollectionByQuestionId(collectionUid, qbQuestionId, true);
}
+ @RequestMapping(path = "/removeCollectionQuestions", method = RequestMethod.POST)
+ @ResponseBody
+ public String removeCollectionQuestionS(@RequestParam long collectionUid,
+ @RequestParam("qbQuestionIds[]") int[] qbQuestionIds) {
+ boolean allQuestionsRemoved = true;
+ for (int qbQuestionId : qbQuestionIds) {
+ allQuestionsRemoved &= qbService.removeQuestionFromCollectionByQuestionId(collectionUid, qbQuestionId,
+ true);
+ }
+ // if some questions could not be removed because they are in sequences, we need to let the user know
+ return allQuestionsRemoved ? "ok" : "fail";
+ }
+
@RequestMapping(path = "/addCollectionQuestion", method = RequestMethod.POST)
@ResponseBody
public void addCollectionQuestion(@RequestParam long targetCollectionUid, @RequestParam boolean copy,
Index: lams_central/web/qb/collection.jsp
===================================================================
diff -u -r40f16843e6c7aa476ebdcc7250dd4ac625167a01 -r666a01da9d0d2b4482ca00041527739b5e56b9f2
--- lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 40f16843e6c7aa476ebdcc7250dd4ac625167a01)
+++ lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 666a01da9d0d2b4482ca00041527739b5e56b9f2)
@@ -99,6 +99,9 @@
height: "100%",
autowidth:true,
shrinkToFit: true,
+ <%-- Do not allow batch removing questions from the public collection --%>
+ multiselect: !isPublicCollection,
+ multiPageSelection: !isPublicCollection,
viewrecords: true,
cellEdit: false,
cmTemplate: { title: false, search: false },
@@ -133,7 +136,7 @@
],
beforeSelectRow: function(rowid, e) {
// do not select rows at all
- return false;
+ return !isPublicCollection;
},
loadComplete: function(data) {
//init thickbox
@@ -407,6 +410,31 @@
$(document.body).append(form);
form.submit();
}
+
+
+ function removeQuestions(){
+ let questionsToRemove = $('#collection-grid').jqGrid('getGridParam','selarrrow');
+ if (questionsToRemove.length == 0){
+ return;
+ }
+ $.ajax({
+ 'url' : '