|
||
<?xml version="1.0" encoding="utf-8" ?>
<!--
This script can be used to create custom rules to modify sandbox sections at the end
of a sandbox run.
-->
<script xmlns="Astra74.Script"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<globals>
<object type="PartOfTerm" name="C1"/>
<object type="PartOfTerm" name="D1"/>
<object type="PartOfTerm" name="AD"/>
<object type="PartOfTerm" name="BU"/>
<object type="PartOfTerm" name="FI"/>
<object type="PartOfTerm" name="RG"/>
<object type="PartOfTerm" name="CPO"/>
</globals>
<!--
This function is called ONCE at the end of the sandbox run prior to looping
across all sandbox sections in the sandbox run. It can be used to store
values that will be used in the UpdateSandboxSection function.
-->
<macro name="InitSectioningUpdate">
<params>
<object name="term" type="Term" />
</params>
<locals></locals>
<body>
<!--
Iterate through part of terms for this term. Store the
part of terms needed for later processing.
-->
<log level="info">Looking for part of terms in term ${term.Name}</log>
<foreach src="term.PartOfTerms" var="partOfTerm">
<log level="info">Processing part of term ${partOfTerm.Name}</log>
<if test="partOfTerm.Name.Contains('D1_')">
<then>
<set prop="D1" expr="partOfTerm"/>
<log level="info">Setting D1 variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('C1_')">
<then>
<set prop="C1" expr="partOfTerm"/>
<log level="info">Setting C1 variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('AD_')">
<then>
<set prop="AD" expr="partOfTerm"/>
<log level="info">Setting AD variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('BU_')">
<then>
<set prop="BU" expr="partOfTerm"/>
<log level="info">Setting BU variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('FI_')">
<then>
<set prop="FI" expr="partOfTerm"/>
<log level="info">Setting FI variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('RG_')">
<then>
<set prop="RG" expr="partOfTerm"/>
<log level="info">Setting RG variable for ${partOfTerm.Name}</log>
</then>
</if>
<if test="partOfTerm.Name.Contains('CPO_')">
<then>
<set prop="CPO" expr="partOfTerm"/>
<log level="info">Setting CPO variable for ${partOfTerm.Name}</log>
</then>
</if>
</foreach>
<return expr="true" />
</body>
</macro>
<!--
This function is called for each sandbox section in the sandbox. Custom rules can be created
to set values on the section as necessary.
-->
<macro name="UpdateSandboxSection">
<params>
<object name="section" type="SandboxSection"/>
</params>
<locals>
<string default="NULL" name="POTName"/>
</locals>
<body>
<if test="section.PartOfTermId != null">
<then>
<set prop="POTName" expr="section.PartOfTerm.Name"/>
</then>
</if>
<!--
Default all part of terms to D1
-->
<if test="D1 != null">
<then>
<set prop="section.PartOfTermId" expr="D1.Id"/>
</then>
<else>
<log level="info">Failed to set part of term for D1. D1 not set during initialization.</log>
</else>
</if>
<if test="section.CourseDeliveryMethod.DeliveryMethod.Name == 'OS' || section.CourseDeliveryMethod.DeliveryMethod.Name == 'BL'">
<then>
<if test="section.CourseDeliveryMethod.Course.Subject.SubjectCode == 'ACCT'">
<then>
<if test="section.CourseDeliveryMethod.Course.CourseNumber == '591'">
<then>
<set prop="section.PartOfTermId" expr="AD.Id"/>
</then>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '592'">
<set prop="section.PartOfTermId" expr="BU.Id"/>
</elseif>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '593'">
<set prop="section.PartOfTermId" expr="FI.Id"/>
</elseif>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '594'">
<set prop="section.PartOfTermId" expr="RG.Id"/>
</elseif>
</if>
</then>
</if>
</then>
</if>
<if test="section.CourseDeliveryMethod.DeliveryMethod.Name == 'OL'">
<then>
<if test="section.CourseDeliveryMethod.Course.Subject.SubjectCode == 'ACCT'">
<then>
<if test="section.CourseDeliveryMethod.Course.CourseNumber == '591'">
<then>
<set prop="section.PartOfTermId" expr="CPO.Id"/>
</then>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '592'">
<set prop="section.PartOfTermId" expr="CPO.Id"/>
</elseif>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '593'">
<set prop="section.PartOfTermId" expr="CPO.Id"/>
</elseif>
<elseif test="section.CourseDeliveryMethod.Course.CourseNumber == '594'">
<set prop="section.PartOfTermId" expr="CPO.Id"/>
</elseif>
</if>
</then>
</if>
</then>
</if>
<!--
All Nursing sections get CPO part of term
-->
<if test="section.CourseDeliveryMethod.Course.Subject.SubjectCode == 'NR'">
<then>
<set prop="section.PartOfTermId" expr="CPO.Id"/>
</then>
</if>
<!--
Log the part of term set to the subject/cours
-->
<log level="info">
Part of term : Subj/Course: ${section.CourseDeliveryMethod.Course.Subject.SubjectCode}${section.CourseDeliveryMethod.Course.CourseNumber} Part of Term ${section.PartOfTerm.Name}
</log>
<return expr="true" />
</body>
</macro>
</script>