212 lines
12 KiB
HTML
212 lines
12 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Grid Bug</title>
|
|
|
|
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
djConfig="isDebug:false, parseOnLoad: true"></script>
|
|
|
|
<!--<script type="text/javascript" src="dojo/dojo/grid.js"></script>-->
|
|
|
|
<style type="text/css">
|
|
@import "../resources/Grid.css";
|
|
@import "../resources/tundraGrid.css";
|
|
@import "../../../dojo/resources/dojo.css";
|
|
@import "../../../dijit/themes/tundra/tundra.css";
|
|
@import "../../../dijit/tests/css/dijitTests.css";
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
dojo.require("dojox.grid.DataGrid");
|
|
dojo.require("dojo.data.ItemFileReadStore");
|
|
dojo.require("dijit.form.CheckBox");
|
|
dojo.require("dojo.date.locale");
|
|
|
|
var drc={};
|
|
drc.gridData = {
|
|
identifier: 'id',
|
|
label: 'id',
|
|
items: [
|
|
{ id: 5301, created: 1204243230266, completed: 1204244264554, status: 'COMPLETED', completion_log: null, instructor_decision: 'YES', course: 'AGB 322', section: '02', exam_date: 1204920600000, end_time: 1204925100000 },
|
|
{ id: 5401, created: 1204314408874, completed: 1204834363267, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1205176200000, end_time: 1204314408000 },
|
|
{ id: 5402, created: 1204314413361, completed: 1204834364132, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1205176200000, end_time: 1204314413000 },
|
|
{ id: 5403, created: 1204315176468, completed: 1205787777855, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1205960400000, end_time: 1204315176000 },
|
|
{ id: 5404, created: 1204335924874, completed: 1205165567663, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '03', exam_date: 1205338200000, end_time: 1204335924000 },
|
|
{ id: 5405, created: 1204741820851, completed: 1204743423882, status: 'COMPLETED', completion_log: null, instructor_decision: 'somethinginvalid', course: 'FRSC 415', section: '02', exam_date: 1206731400000, end_time: 1206746700000 },
|
|
{ id: 5406, created: 1204744307957, completed: 1205274662191, status: 'TERMINATED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '02', exam_date: 1206731400000, end_time: 1204744307000 },
|
|
{ id: 5407, created: 1204840355867, completed: 1205537683853, status: 'COMPLETED', completion_log: null, instructor_decision: 'YES', course: 'FRSC 415', section: '02', exam_date: 1206040200000, end_time: 1206055500000 },
|
|
{ id: 5504, created: 1205274223961, completed: 1205274408372, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'YES', course: 'AGB 322', section: '01', exam_date: 1207579200000, end_time: 1207586400000 },
|
|
{ id: 5505, created: 1205274698075, completed: 1205274757197, status: 'TERMINATED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '01', exam_date: 1206974400000, end_time: 1205274698000 },
|
|
{ id: 5506, created: 1205274723562, completed: 1206628811409, status: 'COMPLETED', completion_log: 'TIMEOUT', instructor_decision: null, course: 'AGB 322', section: '01', exam_date: 1206974400000, end_time: 1205274723000 },
|
|
{ id: 4807, created: 1203037851016, completed: 1204045887212, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '03', exam_date: 1204218600000, end_time: null },
|
|
{ id: 4808, created: 1203037857289, completed: 1204045888187, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '03', exam_date: 1204218600000, end_time: null },
|
|
{ id: 4809, created: 1203039859756, completed: 1203970285117, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1204143000000, end_time: null },
|
|
{ id: 4810, created: 1203039862593, completed: 1203970285693, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1204143000000, end_time: null },
|
|
{ id: 4811, created: 1203039914652, completed: 1203970286217, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '02', exam_date: 1204143000000, end_time: null },
|
|
{ id: 4812, created: 1203039917115, completed: 1203970286693, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'FRSC 415', section: '02', exam_date: 1204143000000, end_time: null },
|
|
{ id: 4813, created: 1203718608148, completed: 1204226860378, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'WVIT 463', section: '01', exam_date: 1204330200000, end_time: null },
|
|
{ id: 4816, created: 1203720084402, completed: 1207077016546, status: 'COMPLETED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1207249800000, end_time: null },
|
|
{ id: 5201, created: 1203725528974, completed: 1204243139125, status: 'TERMINATED', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '02', exam_date: 1204747800000, end_time: null },
|
|
{ id: 5702, created: 1206489796519, completed: null, status: 'RUNNING', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '01', exam_date: 1207320000000, end_time: 1206489796000 },
|
|
{ id: 5701, created: 1206462566705, completed: 1207077017340, status: 'COMPLETED', completion_log: 'TIMEOUT', instructor_decision: null, course: 'FRSC 415', section: '02', exam_date: 1207249800000, end_time: 1206462566000 },
|
|
{ id: 5703, created: 1206489800523, completed: null, status: 'RUNNING', completion_log: null, instructor_decision: null, course: 'AGB 322', section: '01', exam_date: 1207320000000, end_time: 1206489800000 },
|
|
{ id: 5704, created: 1206555988187, completed: 1207072817249, status: 'COMPLETED', completion_log: 'TIMEOUT', instructor_decision: null, course: 'FRSC 415', section: '02', exam_date: 1207245600000, end_time: 1206555988000 },
|
|
{ id: 5705, created: 1206556755331, completed: 1206557243510, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'WITH_MODS', course: 'AGB 322', section: '01', exam_date: 1207320000000, end_time: 1207324020000 },
|
|
{ id: 5706, created: 1206557320052, completed: 1206557366393, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'YES', course: 'FRSC 415', section: '02', exam_date: 1207336200000, end_time: 1207340220000 },
|
|
{ id: 5601, created: 1205522914023, completed: 1205522971080, status: 'COMPLETED', completion_log: 'REJECTED', instructor_decision: 'NO', course: 'FRSC 415', section: '02', exam_date: 1206645000000, end_time: 1205522914000 },
|
|
{ id: 5602, created: 1205522920401, completed: 1205523821411, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'WITH_MODS', course: 'FRSC 415', section: '02', exam_date: 1206645000000, end_time: 1206660300000 },
|
|
{ id: 5603, created: 1205530930988, completed: 1205537697586, status: 'COMPLETED', completion_log: 'REJECTED', instructor_decision: 'NO', course: 'AGB 322', section: '02', exam_date: 1206558600000, end_time: 1205530930000 },
|
|
{ id: 5604, created: 1205539366682, completed: 1205881854926, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'YES', course: 'WVIT 463', section: '01', exam_date: 1206745800000, end_time: 1206755700000 },
|
|
{ id: 5605, created: 1205539369772, completed: 1205539670553, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'YES', course: 'WVIT 463', section: '01', exam_date: 1206745800000, end_time: 1206755700000 },
|
|
{ id: 5606, created: 1205882032439, completed: 1205967437022, status: 'COMPLETED', completion_log: 'APPROVED', instructor_decision: 'WITH_MODS', course: 'FRSC 415', section: '03', exam_date: 1206720600000, end_time: 1206725100000 },
|
|
{ id: 5607, created: 1206035981735, completed: 1206461410540, status: 'COMPLETED', completion_log: 'TIMEOUT', instructor_decision: null, course: 'FRSC 415', section: '03', exam_date: 1206634200000, end_time: 1206035981000 },
|
|
{ id: 5608, created: 1206035986106, completed: 1206461411245, status: 'COMPLETED', completion_log: 'TIMEOUT', instructor_decision: null, course: 'FRSC 415', section: '03', exam_date: 1206634200000, end_time: 120603598600 }
|
|
]
|
|
};
|
|
|
|
drc.filterPast = true;
|
|
|
|
drc.courseFormat = function(course, rowIndex){
|
|
var item = this.grid.getItem(rowIndex);
|
|
var sec = this.grid.store.getValue(item, "section");
|
|
return course+"-"+sec;
|
|
}
|
|
|
|
drc.fullDateFormat = function(dateTime){
|
|
if(dateTime == null){
|
|
return null;
|
|
}
|
|
var d = new Date();
|
|
d.setTime(dateTime);
|
|
return dojo.date.locale.format(d, {datePattern:"MMM d y h:mm a",selector:'date'});
|
|
}
|
|
|
|
drc.timeFormat = function(dateTime){
|
|
if(dateTime == null){
|
|
return null;
|
|
}
|
|
var d = new Date();
|
|
d.setTime(dateTime);
|
|
return dojo.date.locale.format(d, {datePattern:"h:mm a",selector:'time'});
|
|
}
|
|
|
|
drc.filterPastChecked = function(value){
|
|
drc.filterPast = this.checked;
|
|
drc.grid.filter(null, true);
|
|
}
|
|
|
|
drc.statusFormat = function(value, rowIndex){
|
|
var item = this.grid.getItem(rowIndex);
|
|
var store = this.grid.store;
|
|
var state = store.getValue(item, "status");
|
|
var completion_log = store.getValue(item, "completion_log");
|
|
var instructor_decision = store.getValue(item, "instructor_decision");
|
|
var finishTime = store.getValue(item, "completed");
|
|
|
|
if(state == 'RUNNING'){
|
|
return 'Pending Instructor Approval';
|
|
}
|
|
|
|
var s = '';
|
|
if(state == 'TERMINATED'){
|
|
s += 'Canceled'
|
|
}
|
|
else if(state == 'COMPLETED'){
|
|
if(completion_log == 'APPROVED'){
|
|
s += 'Approved';
|
|
if(instructor_decision == 'WITH_MODS'){
|
|
s += ' with modifications';
|
|
}
|
|
}
|
|
else if(completion_log == 'REJECTED'){
|
|
s += 'Denied';
|
|
}
|
|
else if(completion_log == 'TIMEOUT'){
|
|
s += 'Expired';
|
|
}
|
|
else{
|
|
s += completion_log;
|
|
}
|
|
}
|
|
return s;
|
|
}
|
|
|
|
drc.onBeforeRow = function(inDataIndex, inRow){
|
|
if(inDataIndex < 0){
|
|
inRow[0].hidden = false;
|
|
return;
|
|
}
|
|
var item = this.grid.getItem(inDataIndex);
|
|
if(!item){ return; }
|
|
var store = this.grid.store;
|
|
if(inDataIndex >= 0) {
|
|
if (drc.filterPast) {
|
|
//If exam date is past, don't show
|
|
var exam_date = store.getValue(item, "exam_date");
|
|
if (exam_date < 1207088855078) { //use static time value so filter will always have something to filter
|
|
inRow[0].hidden = true;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
inRow[0].hidden=false;
|
|
}
|
|
|
|
drc.viewButtonFormat = function(value, rowIndex){
|
|
return '<a class="drc-view-button" href="'
|
|
+ drc.baseActionURL + '?submittedform=view&processId='+value+'"/>';
|
|
}
|
|
|
|
|
|
dojo.addOnLoad(function() {
|
|
console.debug("initializing...");
|
|
|
|
var check = new dijit.form.CheckBox({checked:true},"altTestingPastCheck");
|
|
dojo.connect(check,"onClick", drc.filterPastChecked);
|
|
|
|
var jsonStore = new dojo.data.ItemFileReadStore({ data: drc.gridData });
|
|
|
|
var layout = [{
|
|
onBeforeRow: drc.onBeforeRow,
|
|
noscroll: true,
|
|
cells: [
|
|
{name: 'Id',field:'id',width:3},
|
|
{name: 'Created',field:'created',formatter:drc.fullDateFormat,width:11},
|
|
{name: 'Status',field:'status',formatter:drc.statusFormat,width:13},
|
|
{name: 'Completed',field:'completed',formatter:drc.fullDateFormat,width:11},
|
|
{name: 'Course',field:'course',formatter:drc.courseFormat,width:7},
|
|
{name: 'Exam Date', field:'exam_date',formatter:drc.fullDateFormat,width:11},
|
|
{name: 'End Time', field:'end_time', formatter:drc.timeFormat,width:6},
|
|
{name: 'View',field:'id',width:3,formatter:drc.viewButtonFormat}
|
|
]
|
|
}];
|
|
|
|
|
|
drc.grid = new dojox.grid.DataGrid({store:jsonStore,structure:layout,query: { id: '*' },rowsPerPage:20,
|
|
autoHeight:true,autoWidth:true,style:"clear:both;"},"altTestingMainGrid");
|
|
drc.grid.startup();
|
|
|
|
console.debug("done.");
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tundra">
|
|
|
|
|
|
|
|
<div id="altTestingPastCheck"></div>
|
|
<label for="altTestingPastCheck">Filter past exams (Exam Date before Apr 1, 2008)</label>
|
|
|
|
<div style="background: red; padding: 10px 10px 10px 10px">
|
|
<div id="altTestingMainGrid"></div>
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html>
|