Index: lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java =================================================================== diff -u -r755a9acfee63e78d1297e13557ce6b9c8de8443e -r1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7 --- lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 755a9acfee63e78d1297e13557ce6b9c8de8443e) +++ lams_central/src/java/org/lamsfoundation/lams/web/qb/QbCollectionController.java (.../QbCollectionController.java) (revision 1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7) @@ -145,7 +145,8 @@ // the last cell is for creating stats button String usage = showUsage ? String.valueOf(qbService.getCountQuestionActivities(question.getUid())) : null; - String[] data = { uid, WebUtil.removeHTMLtags(question.getName()).trim(), usage, uid }; + String[] data = { uid, WebUtil.removeHTMLtags(question.getName()).trim(), question.getType().toString(), + question.getVersion().toString(), usage, uid }; for (String cell : data) { Element cellElement = document.createElement(CommonConstants.ELEMENT_CELL); @@ -198,32 +199,6 @@ @ResponseBody public String changeCollectionName(@RequestParam(name = "pk") long collectionUid, @RequestParam(name = "value") String name) { -// long lessonId = WebUtil.readLongParam(request, "pk"); -// -// HttpSession ss = SessionManager.getSession(); -// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); -// if (!securityService.isLessonMonitor(lessonId, user.getUserID(), "rename lesson", false)) { -// response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); -// return null; -// } -// -// String newLessonName = request.getParameter("value"); -// if (StringUtils.isBlank(newLessonName)) { -// return null; -// } -// -// Lesson lesson = lessonService.getLesson(lessonId); -// lesson.setLessonName(newLessonName); -// userManagementService.save(lesson); -// -// ObjectNode jsonObject = JsonNodeFactory.instance.objectNode(); -// jsonObject.put("successful", true); -// response.setContentType("application/json;charset=utf-8"); -// return jsonObject.toString(); - - - - Collection collections = qbService.getUserCollections(getUserId()); name = name.trim(); for (QbCollection collection : collections) { Index: lams_central/web/qb/collection.jsp =================================================================== diff -u -r755a9acfee63e78d1297e13557ce6b9c8de8443e -r1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7 --- lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 755a9acfee63e78d1297e13557ce6b9c8de8443e) +++ lams_central/web/qb/collection.jsp (.../collection.jsp) (revision 1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7) @@ -92,12 +92,16 @@ colNames:[ "ID", "Name", + "questionType", + "questionVersion", "Used in
lessons", "Actions" ], colModel:[ {name:'id', index:'uid', sortable:true, hidden:true, width: 10}, - {name:'name', index:'name', sortable:true, search:true, autoencode:true}, + {name:'name', index:'name', sortable:true, search:true, autoencode:true, formatter: questionNameFormatter}, + {name:'questionType', index:'questionType', width:0, hidden: true}, + {name:'questionVersion', index:'questionVersion', width:0, hidden: true}, {name: 'usage', index: 'usage', sortable:false, width: 10, align: "center"}, // formatter gets just question uid and creates a button {name:'actions', index:'actions', classes: "stats-cell", sortable:false, width: 13, align: "center", formatter: actionsFormatter} @@ -144,7 +148,7 @@ }); }); - // Creates a button to display question statistics + // auxiliary formatter for jqGrid's question statistics column function actionsFormatter(cellvalue){ var cellhtml = ""; @@ -155,6 +159,49 @@ return cellhtml; } + //auxiliary formatter for jqGrid's question column + function questionNameFormatter (cellvalue, options, rowObject) { + var questionTypeInt = rowObject[2].textContent; + var questionType; + switch (questionTypeInt) { + case '1': + questionType = ""; + break; + case '2': + questionType = ""; + break; + case '3': + questionType = ""; + break; + case '4': + questionType = ""; + break; + case '5': + questionType = ""; + break; + case '6': + questionType = ""; + break; + case '7': + questionType = ""; + break; + case '8': + questionType = ""; + break; + } + + var questionVersion = rowObject[3].textContent; + + var text = cellvalue; + text += ""; + text += "v. " + questionVersion; + text += ""; + text += ""; + text += questionType; + text += ""; + + return text; + } // remove a collection function removeCollection() { Index: lams_central/web/qb/collectionList.jsp =================================================================== diff -u -rba61b266e61e39c4c77682bb50921d3758c4524b -r1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7 --- lams_central/web/qb/collectionList.jsp (.../collectionList.jsp) (revision ba61b266e61e39c4c77682bb50921d3758c4524b) +++ lams_central/web/qb/collectionList.jsp (.../collectionList.jsp) (revision 1dcc990ddb1ab499f9afb8435f9b9e6fdb0481a7) @@ -72,17 +72,21 @@ colNames:[ "ID", "Name", + "questionType", + "questionVersion", // this column is hidden, so data coming from controller can be the same as for single collection view "Used in # of lessons", "Stats" ], colModel:[ - {name:'id', index:'uid', sortable:true, width: 10}, - {name:'name', index:'name', sortable:true, search:true, autoencode:true}, - {name: 'usage', index: 'usage', hidden: true}, - // formatter gets just question uid and creates a button - {name:'stats', index:'stats', classes: "stats-cell", sortable:false, width: 10, align: "center", formatter: statsLinkFormatter} - ], + {name:'id', index:'uid', sortable:true, width: 10}, + {name:'name', index:'name', sortable:true, search:true, autoencode:true}, + {name:'questionType', index:'questionType', width:0, hidden: true}, + {name:'questionVersion', index:'questionVersion', width:0, hidden: true}, + {name: 'usage', index: 'usage', hidden: true}, + // formatter gets just question uid and creates a button + {name:'stats', index:'stats', classes: "stats-cell", sortable:false, width: 10, align: "center", formatter: statsLinkFormatter} + ], beforeSelectRow: function(rowid, e) { // do not select rows at all return false;