Index: lams_tool_laqa/web/learning/LearnerRep.jsp =================================================================== diff -u -r272351bf9374ac9e53fea79b2c9530764dc74f7a -refbaf6ddcc506fed7b594bc9b663b81a03b1283f --- lams_tool_laqa/web/learning/LearnerRep.jsp (.../LearnerRep.jsp) (revision 272351bf9374ac9e53fea79b2c9530764dc74f7a) +++ lams_tool_laqa/web/learning/LearnerRep.jsp (.../LearnerRep.jsp) (revision efbaf6ddcc506fed7b594bc9b663b81a03b1283f) @@ -48,11 +48,92 @@ $(".tablesorter").tablesorter({ theme: 'blue', widthFixed: true, - widgets: ['zebra'] + widgets: ['zebra'], + headers : { 1 : { sorter: false } } }); $(".tablesorter").each(function() { $(this).tablesorterPager({ + // set to false otherwise it remembers setting from other jsFiddle demos + savePages: false, + // use this format: "http:/mydatabase.com?page={page}&size={size}&{sortList:col}" + // where {page} is replaced by the page number (or use {page+1} to get a one-based index), + // {size} is replaced by the number of records to show, + // {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds + // the filterList to the url into an "fcol" array. + // So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url + // and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url + ajaxUrl : "?method=getResponses&page={page}&size={size}&{sortList:column}&qaSessionId=" + $("#toolSessionID").val() + "&questionUid=" + $(this).attr('data-question-uid') + "&userId=" + $("#userID").val(), + + // modify the url after all processing has been applied + // customAjaxUrl: function(table, url) { + // manipulate the url string as you desire + // url += '&cPage=' + window.location.pathname; + // trigger my custom event + //$(table).trigger('changingUrl', url); + // send the server the current page + // return url; + // }, + ajaxProcessing: function (data) { + if (data && data.hasOwnProperty('rows')) { + var rows = [], + json = {}; + + for (i = 0; i < data.rows.length; i++){ + var userData = data.rows[i]; + + rows += ''; + rows += ''; + + if (${generalLearnerFlowDTO.userNameVisible == 'true'}) { + rows += '
'; + rows += ''; + rows += userData["userName"]; + rows += ' '; + rows += userData["attemptTime"]; + rows += '
'; + } + + rows += '
'; + if (userData["visible"] == 'true') { + rows += userData["answer"]; + } else { + rows += ''; + } + rows += '
'; + + rows += ''; + + if (${generalLearnerFlowDTO.allowRateAnswers == 'true'}) { + rows += ''; + + if (userData["visible"] == 'true') { + var responseUid = userData["responseUid"]; + + rows += '
'; + rows += '
'; + rows += '
'; + rows += '' + userData["averageRating"] +' / '; + rows += '' + userData["numberOfVotes"] +' '; + rows += ''; + rows += '
'; + rows += '
'; + rows += '
'; + } + + rows += ''; + } + + rows += ''; + } + + json.total = data.total_rows; // only allow 100 rows in total + //json.filteredRows = 100; // no filtering + json.rows = $(rows); + return json; + + } + }, container: $(this).next(".pager"), output: '{startRow} to {endRow} ({totalRows})',// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} // if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty @@ -71,22 +152,26 @@ cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option // class added to arrows when at the extremes (i.e. prev/first arrows are "disabled" when on the first page) cssDisabled: 'disabled' // Note there is no period "." in front of this class name + }) + + // bind to pager events + .bind('pagerInitialized pagerComplete', function(event, options){ + $(".rating-stars").jRating({ + phpPath : "?method=rateResponse&toolSessionID=" + $("#toolSessionID").val(), + rateMax : 5, + decimalLength : 1, + onSuccess : function(data, responseUid){ + $("#averageRating" + responseUid).html(data.averageRating); + $("#numberOfVotes" + responseUid).html(data.numberOfVotes); + $("#averageRating" + responseUid).parents(".tablesorter").trigger("update"); + }, + onError : function(){ + jError('Error : please retry'); + } + }); }); }); - $(".rating-stars").jRating({ - phpPath : "?method=rateResponse&toolSessionID=" + $("#toolSessionID").val(), - rateMax : 5, - decimalLength : 1, - onSuccess : function(data, responseUid){ - $("#averageRating" + responseUid).html(data.averageRating); - $("#numberOfVotes" + responseUid).html(data.numberOfVotes); - $("#averageRating" + responseUid).parents(".tablesorter").trigger("update"); - }, - onError : function(){ - jError('Error : please retry'); - } - }); $(".rating-stars-disabled").jRating({ rateMax : 5, isDisabled : true @@ -137,38 +222,29 @@ - - - +
+

${status.count}: - +

- - - - - - - - - -

- - - - - - -

-

- -

- -
-
-
-
+ +

+ + + + - + +

+

+ +

+ + + + +
@@ -177,15 +253,13 @@ - - - +

${status.count}: - +

- +
- - - - - - - - - - - - - - - - - -
@@ -200,48 +274,6 @@
-
- - - - - - - -
-
- - - - - - - - -
-
- - - -
@@ -269,7 +301,7 @@ - +