Skip to content

Commit

Permalink
Implemented the special export for SVGDraw and Mysystem2 steps that
Browse files Browse the repository at this point in the history
generates a zip file that contains all the student work for that step.
  • Loading branch information
geoffreykwan committed May 26, 2012
1 parent 21b220a commit 7eecba1
Show file tree
Hide file tree
Showing 12 changed files with 1,330 additions and 2 deletions.
1,133 changes: 1,133 additions & 0 deletions src/main/java/vle/web/VLEGetSpecialExport.java

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/main/java/vle/web/VLEGetXLS.java
Original file line number Diff line number Diff line change
Expand Up @@ -2318,16 +2318,17 @@ private StepWork getLatestStepWorkWithResponse(List<StepWork> stepWorks) {
*/
for(int z=stepWorks.size() - 1; z>=0; z--) {
//get a step work
stepWork = stepWorks.get(z);
StepWork tempStepWork = stepWorks.get(z);

//retrieve the student work from the step work, if any
stepWorkResponse = getStepWorkResponse(stepWork);
stepWorkResponse = getStepWorkResponse(tempStepWork);

/*
* if the step work is not empty, we are done looking
* for the latest work
*/
if(!stepWorkResponse.equals("")) {
stepWork = tempStepWork;
break;
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@
<url-pattern>/getxls.html</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>vleGetSpecialExport</servlet-name>
<servlet-class>vle.web.VLEGetSpecialExport</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>vleGetSpecialExport</servlet-name>
<url-pattern>/getSpecialExport.html</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>echopostdata</servlet-name>
<servlet-class>utils.EchoPostData</servlet-class>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/vle/gradework.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<input type="hidden" name="type" id="type" value=""/>
<input type="hidden" name="customStepsArray" id="customStepsArray" value=""/>
<input type="hidden" name="contentBaseUrl" id="contentBaseUrl" value=""/>
<input type="hidden" name="nodeId" id="nodeId" value=""/>
</form>


Expand Down
7 changes: 7 additions & 0 deletions src/main/webapp/vle/node/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,13 @@ Node.prototype.processStateConstraints = function() {
// to be overriden by child nodes
};

/**
* Returns whether this step type can be special exported
* @return a boolean value
*/
Node.prototype.canSpecialExport = function() {
return false;
};

//used to notify scriptloader that this script has finished loading
if(typeof eventManager != 'undefined'){
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/vle/node/draw/SVGDrawNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ SVGDrawNode.prototype.showSnaps = function(currNode) {
}
};

/**
* Returns whether this step type can be special exported
* @return a boolean value
*/
SVGDrawNode.prototype.canSpecialExport = function() {
return true;
};

NodeFactory.addNode('SVGDrawNode', SVGDrawNode);

//used to notify scriptloader that this script has finished loading
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/vle/node/mysystem2/Mysystem2Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ Mysystem2Node.prototype.getHTMLContentTemplate = function() {
return createContent('node/mysystem2/mysystem2.html');
};

/**
* Returns whether this step type can be special exported
* @return a boolean value
*/
Mysystem2Node.prototype.canSpecialExport = function() {
return true;
};

//Add this node to the node factory so the vle knows it exists.
NodeFactory.addNode('Mysystem2Node', Mysystem2Node);

Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/vle/util/componentloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ var componentloader = function(em, sl){
'displayGradeByTeamGradingPage':[null, null],
'displayResearcherToolsPage':[null, null],
'displayCustomExportPage':[null, null],
'displaySpecialExportPage':[null, null],
'customActivityCheckBoxClicked':[null, null],
'customSelectAllStepsCheckBoxClicked':[null, null],
'getStudentNamesExport':[null, null],
Expand All @@ -192,6 +193,7 @@ var componentloader = function(em, sl){
'getExplanationBuilderWorkExcelExport':[null, null],
'getCustomLatestStudentWorkExport':[null, null],
'getCustomAllStudentWorkExport':[null, null],
'getSpecialExport':[null, null],
'displayExportExplanation':[null, null],
'saveMaxScore':[null, null],
'showScoreSummary':[null, null],
Expand Down Expand Up @@ -235,6 +237,7 @@ var componentloader = function(em, sl){
eventManager.subscribe("displayGradeByTeamGradingPage", view.gradingDispatcher, view);
eventManager.subscribe("displayResearcherToolsPage", view.gradingDispatcher, view);
eventManager.subscribe("displayCustomExportPage", view.gradingDispatcher, view);
eventManager.subscribe("displaySpecialExportPage", view.gradingDispatcher, view);
eventManager.subscribe("customActivityCheckBoxClicked", view.gradingDispatcher, view);
eventManager.subscribe("customSelectAllStepsCheckBoxClicked", view.gradingDispatcher, view);
eventManager.subscribe("getStudentNamesExport", view.gradingDispatcher, view);
Expand All @@ -249,6 +252,7 @@ var componentloader = function(em, sl){
eventManager.subscribe("getExplanationBuilderWorkExcelExport", view.gradingDispatcher, view);
eventManager.subscribe("getCustomLatestStudentWorkExport", view.gradingDispatcher, view);
eventManager.subscribe("getCustomAllStudentWorkExport", view.gradingDispatcher, view);
eventManager.subscribe("getSpecialExport", view.gradingDispatcher, view);
eventManager.subscribe("displayExportExplanation", view.gradingDispatcher, view);
eventManager.subscribe("getProjectMetaDataComplete", view.gradingDispatcher, view);
eventManager.subscribe("getRunExtrasComplete", view.gradingDispatcher, view);
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/vle/view/grading/gradingview_dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ View.prototype.gradingDispatcher = function(type, args, obj) {
obj.displayResearcherToolsPage();
} else if(type=='displayCustomExportPage') {
obj.displayCustomExportPage();
} else if(type=='displaySpecialExportPage') {
obj.displaySpecialExportPage();
} else if(type=='saveScore') {
obj.checkAndSaveScore(args[0], args[1], args[2], args[3], args[4]);
} else if(type=='saveComment') {
Expand Down Expand Up @@ -106,6 +108,8 @@ View.prototype.gradingDispatcher = function(type, args, obj) {
obj.editGroups(args[0]);
} else if(type=='groupClicked') {
obj.groupClicked(args[0]);
} else if(type=='getSpecialExport') {
obj.getSpecialExport(args[0]);
}
};

Expand Down
94 changes: 94 additions & 0 deletions src/main/webapp/vle/view/grading/gradingview_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ View.prototype.displayResearcherToolsPage = function() {
getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='"+this.getI18NString("grading_button_export_idea_baskets")+"' onClick=\"eventManager.fire('getIdeaBasketsExcelExport')\"></input></td><td>"+this.getI18NString("grading_button_export_idea_baskets_description")+" <input class='blueButton' type='button' value='"+this.getI18NString("grading_button_explanation")+"' onClick=\"eventManager.fire('displayExportExplanation', ['ideaBaskets'])\"></input></td></tr>";
getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='"+this.getI18NString("grading_button_export_explanation_builder_work")+"' onClick=\"eventManager.fire('getExplanationBuilderWorkExcelExport')\"></input></td><td>"+this.getI18NString("grading_button_export_explanation_builder_work_description")+" <input class='blueButton' type='button' value='"+this.getI18NString("grading_button_explanation")+"' onClick=\"eventManager.fire('displayExportExplanation', ['explanationBuilder'])\"></input></td></tr>";
getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='"+this.getI18NString("grading_button_export_custom_work")+"' onClick=\"eventManager.fire('displayCustomExportPage')\"></input></td><td>"+this.getI18NString("grading_button_export_custom_work_description")+" <input class='blueButton' type='button' value='"+this.getI18NString("grading_button_explanation")+"' onClick=\"eventManager.fire('displayExportExplanation', ['custom'])\"></input></td></tr>";
getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='"+this.getI18NString("grading_button_special_export")+"' onClick=\"eventManager.fire('displaySpecialExportPage')\"></input></td><td>"+this.getI18NString("grading_button_special_export_description")+" <input class='blueButton' type='button' value='"+this.getI18NString("grading_button_explanation")+"' onClick=\"eventManager.fire('displayExportExplanation', ['special'])\"></input></td></tr>";
getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='"+this.getI18NString("grading_button_export_student_names")+"' onClick=\"eventManager.fire('getStudentNamesExport')\"></input></td><td>"+this.getI18NString("grading_button_export_student_names_description")+" <input class='blueButton' type='button' value='"+this.getI18NString("grading_button_explanation")+"' onClick=\"eventManager.fire('displayExportExplanation', ['studentNames'])\"></input></td></tr>";
//getResearcherToolsHtml += "<tr><td><input class='blueButton' type='button' value='Export Flash' onClick=\"eventManager.fire('getFlashExcelExport')\"></input></td><td>N/A <input class='blueButton' type='button' value='N/A' onClick=\"\"></input></td></tr>";
getResearcherToolsHtml += "</table>";
Expand Down Expand Up @@ -463,6 +464,99 @@ View.prototype.displayCustomExportPageHelper = function(node) {
return displayCustomExportPageHelperHtml;
};

/**
* Display the page for the teacher to choose which step in the project they want to special export
*/
View.prototype.displaySpecialExportPage = function() {

/*
* wrap everything in a div with the class 'gradingContent' so
* a scroll bar will be created for it
*/
var customExportPageHtml = "<div class='gradingContent'>";

customExportPageHtml += "<h3>Special Export Page</h3>";

//the button to go back to the previous page
customExportPageHtml += "<input class='blueButton' type='button' value='"+"Back To Researcher Tools"+"' onClick=\"eventManager.fire('displayResearcherToolsPage');\"></input>";

//the buttons to generate the excel export
customExportPageHtml += "<br>";

customExportPageHtml += "<table>";

//set the counter for the activities
this.activityNumber = 0;

//display all the activities and steps with checkboxes next to all of them
customExportPageHtml += this.displaySpecialExportPageHelper(this.getProject().getRootNode());

customExportPageHtml += "</table>";

customExportPageHtml += "<br>";

//the button to go back to the previous page
customExportPageHtml += "<input class='blueButton' type='button' value='"+"Back To Researcher Tools"+"' onClick=\"eventManager.fire('displayResearcherToolsPage');\"></input>";

customExportPageHtml += "</div>";

//fix the page height
$('#gradeWorkDiv').html(customExportPageHtml);

this.fixGradingDisplayHeight();
};

/**
* A recursive function that traverses the project and displays a button
* for steps that can be special exported
* @param node the current node we are on
* @return html that will display all the steps for the project
*/
View.prototype.displaySpecialExportPageHelper = function(node) {
var displayCustomExportPageHelperHtml = "";

//get the current node id
var nodeId = node.id;

if(node.isLeafNode()) {
//this node is a leaf/step

//get the position as seen by the student
var position = this.getProject().getVLEPositionById(nodeId);

if(node.canSpecialExport()) {
//this step type can be special exported so we will display a button
displayCustomExportPageHelperHtml += "<tr><td class='chooseStepToGradeStepTd'><input id='stepButton_" + nodeId + "' type='button' value='" + position + " " + node.getTitle() + " (" + node.type + ")' style='margin-left:20px' onClick=\"eventManager.fire('getSpecialExport', '" + nodeId + "')\"/></td></tr>";
} else {
//this step can't be special exported so we will just display the step name as text
displayCustomExportPageHelperHtml += "<tr><td class='chooseStepToGradeStepTd'><p style='display:inline;margin-left:20px'>" + position + " " + node.getTitle() + " (" + node.type + ")</p></td></tr>";
}
} else {
/*
* we need to skip the first sequence because that is always the
* master sequence. we will encounter the master sequence when
* this.activityNumber is 0, so all the subsequent activities will
* start at 1.
*/
if(this.activityNumber != 0) {
//this node is a sequence so we will display a checkbox and label for the current activity
//displayCustomExportPageHelperHtml += "<tr><td class='chooseStepToGradeActivityTd'><input id='activityCheckBox_" + this.activityNumber + "' class='stepCheckBox' type='checkbox' name='customExportActivityCheckbox' value='" + nodeId + "' onClick='eventManager.fire(\"customActivityCheckBoxClicked\", [\"activityCheckBox_" + this.activityNumber + "\"])' /><h4 style='display:inline'>Activity " + this.activityNumber + ": " + node.getTitle() + "</h4></td></tr>";
displayCustomExportPageHelperHtml += "<tr><td class='chooseStepToGradeActivityTd'><h4 style='display:inline'>Activity " + this.activityNumber + ": " + node.getTitle() + "</h4></td></tr>";
}

//increment the activity number
this.activityNumber++;

//loop through all its children
for(var x=0; x<node.children.length; x++) {
//get the html for the children
displayCustomExportPageHelperHtml += this.displaySpecialExportPageHelper(node.children[x]);
}
}

return displayCustomExportPageHelperHtml;
};

/**
* Called when a checkbox for an activity is clicked. Depending on whether
* the checkbox is checked or unchecked, it will select all or unselect all
Expand Down
50 changes: 50 additions & 0 deletions src/main/webapp/vle/view/grading/gradingview_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ View.prototype.getCustomAllStudentWorkExport = function() {
$('#getStudentXLSExport').submit();
};

/**
* Request a special export
* @param nodeId the node id for the step we will special export
*/
View.prototype.getSpecialExport = function(nodeId) {
this.setParamsForSpecialExport();
$('#exportType').val('specialExport');

//set the node id
$('#nodeId').val(nodeId);

$('#getStudentXLSExport').submit();
};

/**
* Request the student names export
*/
Expand Down Expand Up @@ -205,6 +219,42 @@ View.prototype.setParamsForXLSExport = function() {
document.getElementById('getStudentXLSExport').action = this.getConfig().getConfigParam('getXLSExportUrl');
};

/**
* Sets all the parameters that are required for the special export.
*/
View.prototype.setParamsForSpecialExport = function() {

/*
* set the run id to an element that will be passed back to the server
* when the export to xls is called
*/
document.getElementById('runId').value = this.getConfig().getConfigParam('runId');

//set the project id
document.getElementById('projectId').value = this.getConfig().getConfigParam('projectId');

//set the parent project id
document.getElementById('parentProjectId').value = this.getConfig().getConfigParam('parentProjectId');

//set the run name
document.getElementById('runName').value = this.getConfig().getConfigParam('runName');

/*
* set the project title to an element that will be passed back to the server
*/
document.getElementById('projectName').value = this.project.getTitle();

/*
* set the type for the bridge controller to inspect
*/
document.getElementById('type').value = "specialExport";

/*
* set the url for where to get the xls
*/
document.getElementById('getStudentXLSExport').action = this.getConfig().getConfigParam('getSpecialExportUrl');
};

/**
* Show the total scores of all students
* Go thru all of the classmates and get their score
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/vle/view/i18n/i18n_en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
"value":"Export Student Names",
"description":"GradingTool: Text in the Export Student Names button"
},
"grading_button_special_export":{
"value":"Special Export",
"description":"GradingTool: Text in the Special Export button"
},
"grading_button_export_latest_student_work_description":{
"value":"(Export the latest student revision)",
"description":"GradingTool: Description next the Export Student Names button"
Expand All @@ -263,6 +267,10 @@
"value":"(Export the student names along with their period, workgroup id, wise id, and login)",
"description":"GradingTool: Description next the Export Student Names button"
},
"grading_button_special_export_description":{
"value":"(Export the work for special steps as a zip file)",
"description":"GradingTool: Description next the Special Export button"
},
"grading_button_explanation":{
"value":"Explanation",
"description":"GradingTool: Text in the Explanation button"
Expand Down

0 comments on commit 7eecba1

Please sign in to comment.