Index: lams_tool_laqa/web/learning/mobile/LearnerRep.jsp
===================================================================
diff -u -r6c5d0c6b8ff17d661580df2c265f2dcabfe7d76c -r4606a90972c3824568c8f9648f3ffaf47030ed7d
--- lams_tool_laqa/web/learning/mobile/LearnerRep.jsp (.../LearnerRep.jsp) (revision 6c5d0c6b8ff17d661580df2c265f2dcabfe7d76c)
+++ lams_tool_laqa/web/learning/mobile/LearnerRep.jsp (.../LearnerRep.jsp) (revision 4606a90972c3824568c8f9648f3ffaf47030ed7d)
@@ -55,6 +55,77 @@
$(".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(),
+
+ 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
@@ -73,21 +144,33 @@
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").each(function() {
+ //make sure jRating gets applied only once
+ if ($(this)[0].innerHTML.indexOf("jRatingColor") > -1) {
+ return;
+ }
+
+ $(this).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);
- },
- onError : function(){
- jError('Error : please retry');
- }
- });
$(".rating-stars-disabled").jRating({
rateMax : 5,
isDisabled : true
@@ -141,7 +224,7 @@
-
+
@@ -162,36 +245,28 @@
-
-
-
+
-
+
- :
-
+ ${status.count}:
+
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
+
+ -
+
+
+
+
+
+
+
+
+
+
-
+
@@ -200,16 +275,15 @@
-
-
+
-
- :
-
+ ${status.count}:
+
-
+
@@ -223,46 +297,6 @@
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
-
-
-
-
-
-