templates/viewModule.html
$def with (moduleInfo, allAySems, allFutureAysems, targetAySem, fixedMountingPlan, tentaMountingPlan, numberOfStudentsPlanning, isStarred, prereq, preclude)
$ moduleCode = moduleInfo[0]
$ moduleName = moduleInfo[1]
$ moduleDescription = moduleInfo[2]
$ moduleMC = moduleInfo[3]
$ moduleStatus = moduleInfo[4]
$code:
# get number of students who plan to take the module in a certain AY and Sem
def getNumStudents(acadYearSem):
for mounting in numberOfStudentsPlanning:
if mounting[1] == acadYearSem:
return mounting[0]
return 0
$ title_string = 'View Info for ' + moduleCode
<script type="text/javascript">
var sem_1_quota = [];
$for subplan in tentaMountingPlan[-2::-2]:
$ aySem = subplan[0]
$ quota = subplan[2]
$if quota is None or quota == "-":
$ quota = 0
sem_1_quota.push({y: $quota, label: "$aySem[9:]"+"\'s Quota"});
$for subplan in fixedMountingPlan[0::2]:
$ aySem = subplan[0]
$ quota = subplan[2]
$if quota is None or quota == "-":
$ quota = 0
sem_1_quota.push({y: $quota, label: "$aySem[9:]"+"\'s Quota"});
var sem_1_demand = [];
$for subplan in tentaMountingPlan[-2::-2]:
$ aySem = subplan[0]
$ numberTaking = getNumStudents(aySem)
sem_1_demand.push({y: $numberTaking, label: "$aySem[9:]"+"\'s Demand"});
$for subplan in fixedMountingPlan[0::2]:
$ aySem = subplan[0]
$ numberTaking = getNumStudents(aySem)
sem_1_demand.push({y: $numberTaking, label: "$aySem[9:]"+"\'s Demand"});
var sem_2_quota = [];
$for subplan in tentaMountingPlan[-1::-2]:
$ aySem = subplan[0]
$ quota = subplan[2]
$if quota is None or quota == "-":
$ quota = 0
sem_2_quota.push({y: $quota, label: "$aySem[9:]"+"\'s Quota"});
$for subplan in fixedMountingPlan[1::2]:
$ aySem = subplan[0]
$ quota = subplan[2]
$if quota is None or quota == "-":
$ quota = 0
sem_2_quota.push({y: $quota, label: "$aySem[9:]"+"\'s Quota"});
var sem_2_demand = [];
$for subplan in tentaMountingPlan[-1::-2]:
$ aySem = subplan[0]
$ numberTaking = getNumStudents(aySem)
sem_2_demand.push({y: $numberTaking, label: "$aySem[9:]"+"\'s Demand"});
$for subplan in fixedMountingPlan[1::2]:
$ aySem = subplan[0]
$ numberTaking = getNumStudents(aySem)
sem_2_demand.push({y: $numberTaking, label: "$aySem[9:]"+"\'s Demand"});
var filler = [];
$for subplan in tentaMountingPlan[-1::-2]:
$ aySem = subplan[0]
filler.push({y: 0, label: "$aySem[0:8]"});
$for subplan in fixedMountingPlan[1::2]:
$ aySem = subplan[0]
filler.push({y: 0, label: "$aySem[0:8]"})
</script>
<script type="text/javascript" src="static/javascripts/viewModule.js"></script>
$var title:$title_string
$ home = ['/', 'Home']
$ moduleInfo = ['/modules', 'Module Information']
$ viewModule = ['#', moduleCode]
$var hierarchy = [home, moduleInfo, viewModule]
<div class="container container-block">
<div class="row">
<div class="col-md-12">
<div class="row">
<!--title-->
<h1 class="text-center"><b>Module Info Overview</b></h1>
<hr>
</div>
<div class="row">
<!--module info-->
<div class="col-md-12 module-header">
<div class="row">
<div class="page-header">
<h1><b>$moduleCode</b>
$if isStarred:
<a href="/starModule?code=$moduleCode&action=unstar&return_path=/viewModule?code=$moduleCode" class="star">
<span class="glyphicon glyphicon-star"></span>
</a>
$else:
<a href="/starModule?code=$moduleCode&action=star&return_path=/viewModule?code=$moduleCode" class="star">
<span class="glyphicon glyphicon-star-empty"></span>
</a>
</h1>
<h3>$moduleName ($moduleMC MCs)</h3>
<br>
<div class="btn-group">
<button type="button" class="btn btn-primary btn-lg dropdown-toggle dropdown-btn-custom-main" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More Actions <span class="caret"></span></button>
<div class="dropdown-menu">
<div class="dropdown-item text-center">
<form id="edit-module-button" name="edit-module-button" action="/editModule" method="get" class="no-padding-margin">
<input type="hidden" name="code" value="$moduleCode">
<input class="dropdown-btn-custom" type="submit" value="Edit General Module Info" data-toggle="tooltip" data-placement="right" title="Edit the module's name, description, MC, pre-requisites and preclusions">
</form>
</div>
<div class="dropdown-item text-center">
<button type="button" id="edit-specific-info" class="dropdown-btn-custom no-padding-margin" data-toggle="tooltip" data-placement="right" title="Edit the module's mounting and quota">Edit Specific Module Info</button>
</div>
<div role="separator" class="dropdown-divider"></div>
<div class="dropdown-item text-center">
<form id="view-students-planning-to-take-module" name="view-students-planning-to-take-module" action="/studentsAffectedByModule" method="get" class="no-padding-margin">
<input type="hidden" name="code" value="$moduleCode">
<input type="hidden" name="aysem" value="$aySem">
<button type="button" class="dropdown-btn-custom" data-toggle="tooltip" data-placement="right" title="Show list of students who have taken, are currently taking, or are planning to take this module">View Students Taking This Module</button>
</form>
</div>
<div class="dropdown-item text-center">
<form id="view-overlapping-with-module" name="view-overlapping-with-module" action="/overlappingWithModule" method="get" class="no-padding-margin">
<input type="hidden" name="code" value="$moduleCode">
<button type="button" class="dropdown-btn-custom" data-toggle="tooltip" data-placement="right" title="Show modules that are also taken with this module">View Modules Overlapping With This Module</button>
</form>
</div>
</div>
</div>
<button type="button" class="btn btn-lg btn-primary" onclick="window.location='/modules';">Back to Module List</button>
</div>
</div>
<div id="myModal" class="modal">
<div id="edit-specific-info-modal" class="modal-content text-center">
<span class="closeModal" onclick="closeModal();">×</span>
<h2>Edit Specific Info</h2>
<form id="edit-specific-info-modal-form" class="form-inline aysem-dropdown" action="/editMounting" method="get">
<p>Please select the AY-Semester that you wish to edit:<br>
<i style="font-size:12px;">(Note: Only semesters in Future AYs can be edited)</i></p>
<br>
<input class="form-inline form-control" type="hidden" name="code" value="$moduleCode">
<select class="form-inline form-control" name="aysem">
<option value="" disabled selected>Choose an AY-Semester</option>
$for aysem in allFutureAysems:
$if targetAySem == aysem:
<option value="$aysem" selected>$aysem</option>
$else:
<option value="$aysem">$aysem</option>
</select>
<input class="form-inline form-control" type="submit">
</form>
<br>
<br>
</div>
<div id="overlapping-mods-modal" class="modal-content text-center">
<span class="closeModal" onclick="closeModal();">×</span>
<h2>View Overlapping Modules</h2>
<form id="overlapping-mods-modal-form" class="form-inline aysem-dropdown" action="/overlappingWithModule" method="get">
<p>Please select the AY-Semester(s) that you wish to view:</p>
<br>
<input class="form-inline form-control" type="hidden" name="code" value="$moduleCode">
<select class="form-inline form-control" name="aysem">
<option value="" selected>All Semesters</option>
$for aysem in allAySems:
$if targetAySem == aysem:
<option value="$aysem" selected>$aysem</option>
$else:
<option value="$aysem">$aysem</option>
</select>
<input class="form-inline form-control" type="submit">
</form>
<br>
<br>
<br>
<br>
</div>
<div id="students-taking-modal" class="modal-content text-center">
<span class="closeModal" onclick="closeModal();">×</span>
<h2>View Students Taking This Module</h2>
<form id="students-taking-modal-form" class="form-inline aysem-dropdown" action="/studentsAffectedByModule" method="get">
<p>Please select the AY-Semester that you wish to view:</p>
<br>
<input class="form-inline form-control" type="hidden" name="code" value="$moduleCode">
<select class="form-inline form-control" name="aysem">
<option value="" selected disabled>Choose an AY-Semester</option>
$for aysem in allAySems:
$if targetAySem == aysem:
<option value="$aysem" selected>$aysem</option>
$else:
<option value="$aysem">$aysem</option>
</select>
<input class="form-inline form-control" type="submit">
</form>
<br>
<br>
<br>
<br>
</div>
</div>
<div class="row">
<h4><b>Module Status:</b> $moduleStatus</h4>
<br>
<h4><b>Module Description:</b></h4>
<p>
$moduleDescription
</p>
<br>
<h4><b>Module Preclusions:</b></h4>
$if preclude == "":
<p>None</p>
$else:
<p>$preclude</p>
<br>
<h4><b>Module Prerequisites:</b></h4>
$if prereq == "":
<p>None</p>
$else:
<p>$prereq</p>
<br>
</div>
<div class="row">
<!--mountingAndQuota-->
<h4><b>Information for Current AY (Fixed)</b></h4>
$if moduleStatus[0:3] == "New":
<h4 style="margin-top: 20px; margin-bottom: 40px;"><i>N.A. (This is a new module)</i></h4>
$else:
<table class="table table-bordered table-hover text-center module-view-aysemInfoTable">
<thead>
<tr>
<th style="width:25%;">AY/Sem</th>
<th>Mounted</th>
<th>Quota</th>
<th style="width:30%;">Number of Students Taking</th>
</tr>
</thead>
<tbody>
$for entry in fixedMountingPlan:
$ aysem = entry[0]
$ mountingStatus = entry[1]
$ quota = entry[2]
<tr>
<td>
<a href="/individualModuleInfo?code=$moduleCode&aysem=$aysem">
<span data-toggle="tooltip" data-placement="bottom" title="Click to go to $aysem View">$aysem</span>
</a>
</td>
$if mountingStatus == 1:
<td>
<span class="glyphicon glyphicon-ok" data-toggle="tooltip" data-placement="bottom" title="Mounted"></span>
</td>
$elif mountingStatus == 0:
<td>
<span class="glyphicon glyphicon-remove" data-toggle="tooltip" data-placement="bottom" title="Unmounted"></span>
</td>
$elif mountingStatus == -1:
<td>
<span class="glyphicon glyphicon-minus" data-toggle="tooltip" data-placement="bottom" title="Not Mounted"></span>
</td>
$ numberTaking = getNumStudents(aysem)
$if True:
$if quota is None:
<td>
?
</td>
$else:
<td>
$quota
</td>
<td>
$numberTaking
$if ((quota is None and numberTaking > 0) or (quota is not None and numberTaking > quota)):
<span class="glyphicon glyphicon-info-sign oversub-warning" data-toggle="tooltip" data-placement="bottom" data-html="true"
title="Oversubscribed!<br>(Demand > Supply)"></span>
$elif (quota == '-' and numberTaking > 0):
<span class="glyphicon glyphicon-info-sign unmounted-warning" data-toggle="tooltip" data-placement="bottom" data-html="true"
title="Oversubscribed!<br>(Unmounted but still has demand)"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<h4 id="infoTentaHeader"><b>Information for Future AYs (Tentative):</b></h4>
<table class="table table-bordered table-hover module-view-aysemInfoTable" style="text-align:center">
<thead>
<tr>
<th style="width:25%;">AY/Sem</th>
<th>Mounted</th>
<th>Quota</th>
<th style="width:30%;">Number of Students Planning to Take</th>
</tr>
</thead>
<tbody>
$for entry in tentaMountingPlan:
$ aysem = entry[0]
$ mountingStatus = entry[1]
$ quota = entry[2]
<tr>
<td>
<a href="/individualModuleInfo?code=$moduleCode&aysem=$aysem">
<span data-toggle="tooltip" data-placement="bottom" title="Click to go to $aysem View">$aysem</span>
</a>
</td>
$if mountingStatus == 1:
<td>
<span class="glyphicon glyphicon-ok" data-toggle="tooltip" data-placement="bottom" title="Mounted"></span>
</td>
$elif mountingStatus == 0:
<td>
<span class="glyphicon glyphicon-remove" data-toggle="tooltip" data-placement="bottom" title="Unmounted"></span>
</td>
$elif mountingStatus == -1:
<td>
<span class="glyphicon glyphicon-minus" data-toggle="tooltip" data-placement="bottom" title="Not Mounted"></span>
</td>
$ numberTaking = getNumStudents(aysem)
$if True:
$if quota is None:
<td>
?
</td>
$else:
<td>
$quota
</td>
<td>
$numberTaking
$if ((quota is None and numberTaking > 0) or (quota is not None and numberTaking > quota)):
<span class="glyphicon glyphicon-info-sign oversub-warning" data-toggle="tooltip" data-placement="bottom" data-html="true"
title="Oversubscribed!<br>(Demand > Supply)"></span>
$elif (quota == '-' and numberTaking > 0):
<span class="glyphicon glyphicon-info-sign unmounted-warning" data-toggle="tooltip" data-placement="bottom" data-html="true"
title="Oversubscribed!<br>(Unmounted but still has demand)"></span>
</td>
</tbody>
</table>
</div>
<h3 class="text-center">Module's Quota/Demand for each AY-Sem</h3>
<div class="row" id="quota-demand-chart"></div>
<div class="row" style="height: 30px;">
</div>
</div>
</div>
</div>
</div>