Index: lams_gradebook/web/gradebookMonitor.jsp
===================================================================
diff -u -r12673718843ca7b082dee1c8a42e73f5fc6c805a -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077
--- lams_gradebook/web/gradebookMonitor.jsp (.../gradebookMonitor.jsp) (revision 12673718843ca7b082dee1c8a42e73f5fc6c805a)
+++ lams_gradebook/web/gradebookMonitor.jsp (.../gradebookMonitor.jsp) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077)
@@ -11,6 +11,20 @@
+
+
@@ -19,19 +33,19 @@
var marksReleased = ${marksReleased};
-
function toggleRelease() {
var conf;
if (marksReleased) {
- conf = confirm('');
+ conf = confirm('');
} else {
- conf = confirm('');
+ conf = confirm('');
}
if (conf) {
$.get("/gradebook/gradebookMonitoring.do", {dispatch:"toggleReleaseMarks", lessonID:"${lessonDetails.lessonID}"}, function(xml) {
- if (xml=="success") {
+ var str = new String(xml)
+ if (str.indexOf("success") != -1) {
if (marksReleased) {
marksReleased = false;
@@ -40,7 +54,8 @@
}
displayReleaseOption();
} else {
- alert('');
+
+ info_dialog('', '', '');
}
});
}
@@ -56,7 +71,6 @@
}
}
-
jQuery(document).ready(function(){
displayReleaseOption();
@@ -67,7 +81,7 @@
datatype: "xml",
url: "/gradebook/gradebook.do?dispatch=getUserGridData&view=monUserView&lessonID=${lessonDetails.lessonID}",
height: "100%",
- width: 700,
+ width: 670,
imgpath: 'includes/javascript/jqgrid/themes/basic/images',
cellEdit: true,
viewrecords: true,
@@ -94,7 +108,7 @@
],
loadError: function(xhr,st,err) {
jQuery("#userView").clearGridData();
- alert('');
+ info_dialog('', '', '');
},
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
@@ -106,7 +120,7 @@
datatype: "xml",
url: "/gradebook/gradebook.do?dispatch=getActivityGridData&lessonID=${lessonDetails.lessonID}&view=monUserView&userID=" + userID,
height: "100%",
- width: 650,
+ width: 620,
cellEdit:true,
imgpath: 'includes/javascript/jqgrid/themes/basic/images',
pager: subgrid_table_id + "_pager",
@@ -115,6 +129,7 @@
cellurl: "/gradebook/gradebookMonitoring.do?dispatch=updateUserActivityGradebookData&lessonID=${lessonDetails.lessonID}&view=monUserView&userID=" + userID,
colNames: [
'',
+ '',
'',
'',
'',
@@ -125,35 +140,87 @@
],
colModel: [
{name:'id', index:'id', sortable:false, hidden:true, hidedlg:true},
+ {name:'marksAvailable',index:'marksAvailable', sortable:false, editable:false, hidden:true, search:false, hidedlg:true},
{name:'rowName', index:'rowName', sortable:false, editable: false},
{name:'status', index:'status', sortable:false, editable:false, width:50, align:"center"},
- {name:'output', index:'output', sortable:false, editable: false, width:200},
+ {name:'output', index:'output', sortable:false, editable: false, width:200, hidden:true},
{name:'competences', index:'competences', sortable:false, editable: false, hidden:true},
{name:'timeTaken',index:'timeTaken', sortable:true, editable: false, width:80, align:"center"},
- {name:'feedback', index:'feedback', sortable:false, editable: true, edittype:'textarea', editoptions:{rows:'4',cols:'20'}, width:200},
+ {name:'feedback', index:'feedback', sortable:false, editable: true, edittype:'textarea', editoptions:{rows:'4',cols:'20'}, width:200, hidden:true},
{name:'mark', index:'mark', sortable:true, editable: true, editrules:{number:true}, width:50, align:"center" }
],
loadError: function(xhr,st,err) {
jQuery("#"+subgrid_table_id).clearGridData();
- alert('');
+ info_dialog('', '', '');
},
+ formatCell: function(rowid, cellname,value, iRow, iCol) {
+ if (cellname == "mark") {
+
+ var rowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
+ var string = removeHTMLTags(rowData["mark"]);
+
+
+ if (string.indexOf("-") != -1)
+ {
+ string = " ";
+
+ } else if (string.indexOf("/") != -1) {
+ splits = string.split("/");
+
+ if(splits.length == 2) {
+ tempMark = splits[0];
+ string = " ";
+ } else {
+ string = " ";
+ }
+ }
+
+ return string;
+
+ }
+ },
+ beforeSaveCell: function(rowid, cellname,value, iRow, iCol){
+ value = trim(value);
+
+ if (cellname == "mark") {
+ if (value == "") {
+ jQuery("#"+subgrid_table_id).restoreCell( iRow, iCol);
+ throw("Value required for mark.");
+ }
+
+ var currRowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
+ if (currRowData['marksAvailable'] != null && currRowData['marksAvailable'] != "") {
+ if (parseFloat(value) > parseFloat(currRowData['marksAvailable'])){
+ info_dialog('', '', '');
+ jQuery("#"+subgrid_table_id).restoreCell( iRow, iCol);
+ throw("Mark must be lower than maximum mark");
+ }
+ }
+ }
+ },
afterSaveCell: function(rowid, cellname,value, iRow, iCol) {
- // Update the total lesson mark for the user
+ var currRowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
if (cellname == "mark") {
- var ids = jQuery("#"+subgrid_table_id).getDataIDs()
- var totalMark = 0.0;
- for (var i=0; i < ids.length; i++) {
- var rowData = jQuery("#"+subgrid_table_id).getRowData(ids[i]);
- var userMark = rowData["mark"];
-
- if (userMark != "-") {
- totalMark += parseFloat(userMark);
+
+ if (cellname == "mark") {
+ if (currRowData['marksAvailable'] != null && currRowData['marksAvailable'] != "") {
+ var markStr = "" + value + "/" + currRowData['marksAvailable'] + "";
+ jQuery("#"+subgrid_table_id).setCell(rowid, "mark", markStr, "", "");
}
}
- jQuery("#userView").setCell(row_id, "mark", totalMark, "", "");
+
+ // Update the aggregated lesson mark
+ $.get("/gradebook/gradebook.do", {dispatch:"getLessonMarkAggregate", lessonID:"${lessonDetails.lessonID}", userID:row_id}, function(xml) {
+ if (xml!=null) {
+ jQuery("#userView").setCell(row_id, "mark", xml, "", "");
+ }
+ });
}
},
+ errorCell: function(serverresponse, status) {
+ info_dialog('', '', '');
+ },
gridComplete: function(){
toolTip($(".jqgrow"));
}
@@ -203,7 +270,7 @@
datatype: "xml",
url: "/gradebook/gradebook.do?dispatch=getActivityGridData&view=monActivityView&lessonID=${lessonDetails.lessonID}",
height: "100%",
- width: 700,
+ width: 670,
cellEdit: true,
pager: "activityViewPager",
rowList:[5,10,20,30],
@@ -228,7 +295,7 @@
],
loadError: function(xhr,st,err) {
jQuery("#activityView").clearGridData();
- alert('');
+ info_dialog('', '', '');
},
imgpath: 'includes/javascript/jqgrid/themes/basic/images',
subGrid: true,
@@ -243,7 +310,7 @@
datatype: "xml",
url: "/gradebook/gradebook.do?dispatch=getUserGridData&view=monActivityView&lessonID=${lessonDetails.lessonID}&activityID=" + activityID + "&groupId=" + groupID,
height: "100%",
- width: 600,
+ width: 580,
cellEdit:true,
imgpath: 'includes/javascript/jqgrid/themes/basic/images',
cellurl: "/gradebook/gradebookMonitoring.do?dispatch=updateUserActivityGradebookData&lessonID=${lessonDetails.lessonID}&view=monActivityView&activityID=" + activityID,
@@ -254,6 +321,7 @@
rowNum:10,
colNames: [
'',
+ '',
'',
'',
'',
@@ -263,43 +331,82 @@
],
colModel:[
{name:'id', index:'id', sortable:false, editable:false, hidden:true, search:false, hidedlg:true},
+ {name:'marksAvailable',index:'marksAvailable', sortable:false, editable:false, hidden:true, search:false, hidedlg:true},
{name:'rowName',index:'rowName', sortable:true, editable:false},
{name:'status', align:'center', width:30, index:'status', sortable:false, editable:false, search:false, width:50, align:"center"},
{name:'timeTaken', index:'timeTaken', sortable:true, editable: false, width:80, align:"center"},
- {name:'output', index:'output', sortable:false, editable: false, search:false, width:200},
- {name:'feedback',index:'feedback', sortable:false, editable:true, edittype:'textarea', editoptions:{rows:'4',cols:'20'} , search:false, width:200},
+ {name:'output', index:'output', sortable:false, editable: false, search:false, width:200, hidden:true},
+ {name:'feedback',index:'feedback', sortable:false, editable:true, edittype:'textarea', editoptions:{rows:'4',cols:'20'} , search:false, width:200, hidden:true},
{name:'mark',index:'mark', sortable:true, editable:true, editrules:{number:true}, search:false, width:50, align:"center"}
],
loadError: function(xhr,st,err) {
jQuery("#"+subgrid_table_id).clearGridData();
- alert('');
+ info_dialog('', '', '');
},
+ formatCell: function(rowid, cellname,value, iRow, iCol) {
+ if (cellname == "mark") {
+
+ var rowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
+ var string = removeHTMLTags(rowData["mark"]);
+
+
+ if (string.indexOf("-") != -1)
+ {
+ string = " ";
+
+ } else if (string.indexOf("/") != -1) {
+ splits = string.split("/");
+
+ if(splits.length == 2) {
+ tempMark = splits[0];
+ string = " ";
+ } else {
+ string = " ";
+ }
+ }
+
+ return string;
+
+ }
+ },
+ beforeSaveCell: function(rowid, cellname,value, iRow, iCol){
+ value = trim(value);
+
+ if (cellname == "mark") {
+ if (value == "") {
+ jQuery("#"+subgrid_table_id).restoreCell( iRow, iCol);
+ throw("Value required for mark.");
+ }
+
+ var currRowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
+ if (currRowData['marksAvailable'] != null && currRowData['marksAvailable'] != "") {
+ if (parseFloat(value) > parseFloat(currRowData['marksAvailable'])){
+ info_dialog('', '', '');
+ jQuery("#"+subgrid_table_id).restoreCell( iRow, iCol);
+ throw("Mark must be lower than maximum mark");
+ }
+ }
+ }
+ },
afterSaveCell: function(rowid, cellname,value, iRow, iCol) {
-
- // update the activity average mark
if (cellname == "mark") {
- var ids = jQuery("#"+subgrid_table_id).getDataIDs()
- var sumMarks = 0.0;
- var count = 0;
- for (var i = 0; i < ids.length; i++) {
- var rowData = jQuery("#"+subgrid_table_id).getRowData(ids[i]);
- var activityMark = rowData["mark"];
-
- if (activityMark != "-") {
- sumMarks += parseFloat(activityMark);
- count ++;
- }
- }
- var average;
- if (count>0) {
- average = sumMarks / count;
- } else {
- average = value;
- }
-
- jQuery("#activityView").setCell(row_id, "average", average, "", "");
+ var currRowData = jQuery("#"+subgrid_table_id).getRowData(rowid);
+ if (currRowData['marksAvailable'] != null && currRowData['marksAvailable'] != "") {
+ var markStr = "" + value + "/" + currRowData['marksAvailable'] + "";
+ jQuery("#"+subgrid_table_id).setCell(rowid, "mark", markStr, "", "");
+ }
+
+ // Update the average activity mark
+ $.get("/gradebook/gradebook.do", {dispatch:"getActivityMarkAverage", activityID:row_id}, function(xml) {
+ if (xml!=null) {
+ jQuery("#activityView").setCell(row_id, "avgMark", xml, "", "");
+ }
+ });
}
},
+ errorCell: function(serverresponse, status) {
+ info_dialog('', '', '');
+ },
gridComplete: function(){
toolTip($(".jqgrow")); // applying tooltips for this grid
}
@@ -351,6 +458,7 @@
+
@@ -370,7 +478,13 @@
-