Skip to content
Snippets Groups Projects
Commit 54aac019 authored by Tim Steiner's avatar Tim Steiner
Browse files

Merging /branches/popups back into /branches/redesign

parent c68eba93
No related branches found
No related tags found
No related merge requests found
Showing
with 990 additions and 240 deletions
......@@ -9,6 +9,7 @@ class Courses_EditController extends App_Controller_Action
$course = $session->course;
$request = $session->request;
$this->view->terms = $this->_getFutureTerms();
$this->view->course = $course;
$this->view->parentCourse = $session->parentCourse;
$this->view->request = $request;
......@@ -17,6 +18,35 @@ class Courses_EditController extends App_Controller_Action
$layout = Zend_Layout::getMvcInstance();
}
public function helpAction()
{
}
protected function _getFutureTerms()
{
$now = new Zend_Date();
$month = $now->get(Zend_Date::MONTH);
$thisYear = $now->get(Zend_Date::YEAR);
$nextYear = $thisYear + 1;
$prefix = 'No sooner than ';
$terms = array();
if ($month < 3) {
$terms[$thisYear . '3'] = $prefix . 'Summer ' . $thisYear;
}
if ($month < 8) {
$terms[$nextYear . '1'] = $prefix . 'Fall ' . $thisYear;
}
for ($year = $nextYear; $year < $thisYear + 5; $year++) {
$terms[$year . '2'] = $prefix . 'Spring ' . $year;
$terms[$year . '3'] = $prefix . 'Summer ' . $year;
$terms[($year + 1) . '1'] = $prefix . 'Fall ' . $year;
}
return $terms;
}
public function editPostAction()
{
......@@ -117,6 +147,10 @@ class Courses_EditController extends App_Controller_Action
}
$request->setJustification($rawIn['request']['justification']);
if ($rawIn['effectiveSemester']) {
$session->course->setEffectiveSemester($rawIn['effectiveSemester']);
}
$fileTypes = array(
Requests_RequestModel::FILE_TYPE_SYLLABUS,
......@@ -224,9 +258,6 @@ class Courses_EditController extends App_Controller_Action
$in = $this->getRequest()->getParams();
$session = new Zend_Session_Namespace('Edit Request ' . $in['id']);
if ($in['effectiveSemester']) {
$session->course->setEffectiveSemester($in['effectiveSemester']);
}
if ($in['submitType'] == 'Save for Later Submission') {
$this->_saveForLater();
......
......@@ -102,7 +102,6 @@ class Courses_ViewController extends App_Controller_Action
$this->view->user = $user;
$this->view->initialRequest = $initialRequest;
$this->view->preview = $preview;
$this->view->terms = $this->_getFutureTerms();
$this->view->isRequestValid = $course->isValid() && $request->isValid();
$this->view->prevRequestId = $prevRequestId;
$this->view->nextRequestId = $nextRequestId;
......@@ -150,28 +149,5 @@ class Courses_ViewController extends App_Controller_Action
$this->_helper->layout->setLayout('naked-layout');
}
protected function _getFutureTerms()
{
$now = new Zend_Date();
$month = $now->get(Zend_Date::MONTH);
$thisYear = $now->get(Zend_Date::YEAR);
$nextYear = $thisYear + 1;
$terms = array();
if ($month < 3) {
$terms[$thisYear . '3'] = 'Summer ' . $thisYear;
}
if ($month < 8) {
$terms[$nextYear . '1'] = 'Fall ' . $thisYear;
}
for ($year = $nextYear; $year < $thisYear + 5; $year++) {
$terms[$year . '2'] = 'Spring ' . $year;
$terms[$year . '3'] = 'Summer ' . $year;
$terms[($year + 1) . '1'] = 'Fall ' . $year;
}
return $terms;
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -27,7 +27,7 @@
'subject' => $this->subject,
'courseNumber' => $this->courseNumber,
'courseLetter' => $this->courseLetter)); ?>">
<b>Change</b> to an existing course
<b>Change</b> existing course
</a>
</li>
<?php /* <li>
......@@ -46,7 +46,7 @@
'subject' => $this->subject,
'courseNumber' => $this->courseNumber,
'courseLetter' => $this->courseLetter)); ?>">
<b>ACE Certification</b> <em>only</em> for this course
<b>ACE Certification</b> <em>only</em>
</a>
</li>
<li>
......@@ -55,7 +55,7 @@
'subject' => $this->subject,
'courseNumber' => $this->courseNumber,
'courseLetter' => $this->courseLetter)); ?>">
<b>Change</b> to an existing course and <b>ACE Certification</b>
<b>Change</b> existing course and <b>ACE Certification</b>
</a>
</li>
<?php } else if ($this->isAce) { ?>
......@@ -93,7 +93,7 @@
'subject' => $this->subject,
'courseNumber' => $this->courseNumber,
'courseLetter' => $this->courseLetter)); ?>">
That this course be <b>removed</b>
<b>Removal of existing course</b>
</a>
</li>
<?php if ($this->isAdmin) { ?>
......@@ -103,7 +103,7 @@
'subject' => $this->subject,
'courseNumber' => $this->courseNumber,
'courseLetter' => $this->courseLetter)); ?>">
To make an <b>administrative edit</b>
<b>Administrative edit</b>
</a>
</li>
<?php } ?>
......
......@@ -12,7 +12,7 @@
<div class="content">
<form id="search_form" action="<?php echo $this->baseUrl(); ?>/courses/new/search.post" method="post">
<fieldset>
<label>Subject Area (Usually four letters)</label>
<label>Subject Code (Usually four letters)</label>
<input type="text" id="subject" name="subject" />
</fieldset>
<fieldset>
......
......@@ -187,7 +187,7 @@
<?php } ?>
<table id="otherInfo">
<caption>Other Information</caption>
<caption>Additional Information</caption>
<tr>
<th>DF Removal</th>
<td><?php echo $course->getDfRemoval(); ?></td>
......
......@@ -19,19 +19,6 @@ $this->layout()->breadcrumbs = array($breadcrumb . ': ' . $this->course->getCour
<?php if ($this->preview) { ?>
<form method="post" action="<?php echo $this->baseUrl(); ?>/courses/edit/submit.post/id/<?php echo $this->id; ?>">
<fieldset>
<label>
Effective no sooner than:
<?php
echo $this->formSelect(
'effectiveSemester',
$this->course->effectiveSemester,
array('id' => 'effectiveSemester'),
$this->terms
);
?>
</label>
</fieldset>
<?php if ($this->initialRequest) { ?>
<?php if ($this->isRequestValid) { ?>
<input id="submit_request" type="submit" name="submitType" value="Submit" />
......
......@@ -13,6 +13,7 @@ $staticBaseUrl .= $_SERVER['HTTP_HOST']
$this->headLink()->appendStylesheet($this->baseUrl() . '/css/index.css', 'all');
$this->headLink()->appendStylesheet($this->baseUrl() . '/css/print.css', 'print');
$this->headLink()->appendStylesheet('http://jquery-ui.googlecode.com/svn/tags/1.7.2/themes/base/ui.all.css', 'all');
$this->headScript()->prependFile($this->baseUrl() . '/javascript/index.js');
$this->headScript()->prependFile('http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js');
$this->headScript()->prependFile('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js');
......
......@@ -6,6 +6,12 @@
font-weight: bold;
}
#helpLinkBox {
padding: 0.5em;
margin: 0 0 1em 0;
text-align: right;
}
#bulletinPreview {
width: 210px;
}
......
@CHARSET "UTF-8";
#editHelp h3 {text-align: center; font-weight: bold; font-size: 1.2em; color: #000;}
#editHelp h4 {display: inline; font-weight: bold; font-size: 1em; color: #000; font-family: inherit; line-height: 1em;}
#editHelp em {text-decoration: underline; font-style: normal;}
#editHelp #editHeading {text-align: right; font-size: 9px; list-style-type: none; line-height: 1.2em;}
\ No newline at end of file
addLoadEvent(onEditWrapperLoad);
function onEditWrapperLoad()
{
var addButtons = getElementsByClass('add_record_button');
for(var i = 0; i < addButtons.length; i++) {
addButtons[i].onclick = handleAddRecord;
}
var removeButtons = getElementsByClass('remove_record_button');
for(var i = 0; i < removeButtons.length; i++) {
removeButtons[i].onclick = handleRemoveRecord;
}
var subjectNode = document.getElementById('subject');
if (subjectNode) {
subjectNode.previousValue = subjectNode.value;
subjectNode.onchange = handleChangeSubject;
}
if (document.getElementById('courseNumber')) {
document.getElementById('courseNumber').onchange = handleChangeCourseNumber;
}
if (document.getElementById('courseLetter')) {
document.getElementById('courseLetter').onchange = handleChangeCourseLetter;
}
$(document).ready(function() {
$('.add_record_button').click(handleAddRecord);
$('.remove_record_button').click(handleRemoveRecord);
$('#subject').change(handleChangeHomeSubject);
$('#courseNumber').change(handleChangeHomeCourseNumber);
$('#courseLetter').change(handleChangeHomeCourseLetter);
if (document.getElementById('aceOutcomeList')) {
var outcomesChecked = 0;
......@@ -53,12 +35,79 @@ function onEditWrapperLoad()
}
}
}
$('.courseCodeInput').change(handleCourseCodeInputChange);
$('.courseNumberInput').change(handleChangeCourseNumber);
$('.courseLetterInput').change(handleChangeCourseLetter);
$('.activitySelect').change(handleChangeActivity);
$('#credits input').change(handleChangeCredits);
$('.dfRemovalRadio').change(handleChangeDfRemoval);
$('#dialog').dialog({
autoOpen: false,
modal: true,
beforeclose: dequeuePopup
});
$('[target=helpWindow]').click(helpLinkClicked);
});
function helpLinkClicked()
{
var href = this.href;
var helpWindow = $(document).attr('helpWindow');
if (!helpWindow || helpWindow.closed) {
helpWindow = window.open(href, 'helpWindow', "height=600,width=1000,scrollbars=yes,alwaysRaised=yes")
} else {
helpWindow.location = href;
}
helpWindow.focus();
$(document).attr('helpWindow', helpWindow);
return false;
}
function queuePopup(htmlContent, buttons, helpAnchor)
{
var dialog = $('#dialog');
var queue = dialog.data('queue');
if (!dialog.data('queue')) {
queue = [];
}
if (helpAnchor) {
htmlContent = '<div>' + htmlContent + '</div>'
+ '<div><a href="' + baseUrl + '/courses/edit/help#' + helpAnchor + '" target="helpWindow">Policy Details</a></div>';
}
var courseCodeInputs = getElementsByClass('courseCodeInput');
for (var i = 0; i != courseCodeInputs.length; i++) {
courseCodeInputs[i].onchange = handleCourseCodeInputChange;
queue.push({htmlContent: htmlContent, buttons: buttons});
dialog.data('queue', queue);
if (!dialog.dialog('isOpen')) {
dequeuePopup();
}
}
function dequeuePopup()
{
var dialog = $('#dialog');
var queue = dialog.data('queue');
if (queue.length == 0) {
return true;
}
var args = queue.shift();
dialog.data('queue', queue);
dialog.html(args.htmlContent);
dialog.dialog('option', 'buttons', args.buttons);
dialog.dialog('open');
$('[target=helpWindow]').click(helpLinkClicked);
return false;
}
function handleAddRecord()
......@@ -116,13 +165,29 @@ function handleAddRecord()
newNode.childNodes[13].childNodes[1].readOnly = true;
newNode.childNodes[15].childNodes[1].id = removeButtonId;
newNode.className = 'grad_tie_in_row';
if ($('#courseNumber').val() < 400) {
queuePopup(
'"800" grad courses cannot be tied to 100, 200, or 300 undergraduate courses',
{
'Reset': function() {
$(newNode.childNodes[15].childNodes[1]).click();
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
'crosslistings'
);
}
}
var courseCodeInputs = getElementsByClass('courseCodeInput');
for (var i = 0; i != courseCodeInputs.length; i++) {
courseCodeInputs[i].onchange = handleCourseCodeInputChange;
}
$('.courseCodeInput').change(handleCourseCodeInputChange);
$('.courseNumberInput').change(handleChangeCourseNumber);
$('.courseLetterInput').change(handleChangeCourseLetter);
$('.activitySelect').change(handleChangeActivity);
return false;
}
......@@ -142,13 +207,9 @@ function handleRemoveRecord()
return false;
}
function handleChangeSubject()
function handleChangeHomeSubject()
{
var previousSubject = this.previousValue;
var previousSubject = this.defaultValue;
var currentSubject = this.value;
this.previousValue = currentSubject;
......@@ -178,27 +239,302 @@ function handleChangeSubject()
}
function handleChangeCourseNumber()
function handleChangeHomeCourseNumber()
{
var gradNumber = 800 + (this.value % 100);
var gradTieInRows = getElementsByClass('grad_tie_in_row');
for (var i = 0; i != gradTieInRows.length; i++) {
gradTieInRows[i].childNodes[7].childNodes[1].value = gradNumber;
}
}
function handleChangeCourseLetter()
function handleChangeHomeCourseLetter()
{
var gradLetter = this.value;
var gradTieInRows = getElementsByClass('grad_tie_in_row');
for (var i = 0; i != gradTieInRows.length; i++) {
gradTieInRows[i].childNodes[11].childNodes[1].value = gradLetter;
}
}
function handleChangeCourseNumber()
{
var courseNumber = this.value;
var message = '';
switch (courseNumber % 100) {
case 90:
case 93:
message = 'Courses with _90 or _93 are reserved for workshops/seminars.';
break;
case 91:
case 92:
message = 'Courses with _91 or _92 are reserved for special topis/seminars/tours.';
break;
case 94:
message = 'Courses with _94 are reserved for independent study.';
break;
case 95:
message = 'Courses with _95 are reserved for internships.';
break;
case 96:
message = 'Courses with _96 are reserved for independent study.';
break;
case 97:
message = 'Courses with _97 are reserved for practicums (field type courses).';
break;
case 98:
message = 'Courses with _98 are reserved for research.';
break;
}
switch (courseNumber) {
case 899:
message = 'Courses with 899 are reserved for graduate (Masters) theses.';
break;
case 999:
message = 'Courses with 999 are reserved for graduate (Doctorate) courses.';
break;
}
var homeCourseNumber = $('#courseNumber').val();
if (homeCourseNumber % 100 != courseNumber % 100) {
message = 'The last two digits of the course number should be the same as the home department course number.'
}
if (message) {
var courseNumberNode = this;
queuePopup(
message,
{
'Reset': function() {
courseNumberNode.value = courseNumberNode.defaultValue;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
'courseNumbering'
);
}
}
function handleChangeCourseLetter()
{
var courseLetter = this.value;
var message = '';
switch (courseLetter) {
case 'L':
message = '"L" represents a laboratory class.';
break;
case 'H':
message = '"L" represents an honors class.';
break;
case 'X':
message = '"L" represents an independent study class.';
break;
case 'G':
message = '"L" represents professional courses for graduate credit.';
break;
case 'C':
case 'D':
case 'F':
case 'I':
case 'O':
case 'S':
case 'Z':
message = '"C, D, F, I, O, S and Z" cannot be used as suffixes.';
break;
}
if (message) {
var courseLetterNode = this;
queuePopup(
message,
{
'Reset': function() {
courseLetterNode.value = courseLetterNode.defaultValue;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
'courseNumbering'
);
}
}
function handleChangeActivity()
{
var message = '';
switch($(this).val()) {
case 'quz':
message = 'QUZ is always taught in conjunction with Lecture and can be taught with Lecture/Lab, Lab (for credit) or Lecture/REC. Never taught alone.';
break;
case 'rct':
message = 'RCT is always taught with Lecture and can be taught in conjunction with Lecture/Lab, Lab (for credit) or Lecture/QUZ. Never taught alone.';
break;
case 'stu':
message = 'STU is stand-alone activity.';
break;
case 'fld':
message = 'FLD is stand-alone activity.';
break;
case 'ind':
message = 'IND is stand-alone activity.';
break;
}
if (message) {
var activitySelectNode = this;
queuePopup(
message,
{
'Reset': function() {
activitySelectNode.selectedIndex = 0;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
'activityType'
);
}
}
function handleChangeCredits()
{
var message = '';
var helpAnchor = 'creditAlternate';
switch (this.id) {
case 'creditsSingleValues':
var values = this.value.split(',');
values = jQuery.map(values, function(a) {return jQuery.trim(a);});
if (values.inArray('0') && $('#courseNumber').val() >= 100) {
message = 'Courses with "0" credit must have a course number beginning with "0". The only exception is Military Science.';
helpAnchor = 'creditSingle';
}
if (values.length > 0 && $('#courseNumber').val() % 100 >= 90) {
message = 'Course #s with "9" as the middle number normally have credit in a range.';
helpAnchor = 'creditRange';
}
jQuery.each(values, function(i, value) {
if (value > 25) {
message = 'Max credit hours for undergraduate courses is 24 credit hours.';
helpAnchor = 'creditHoursMaxPerDegree';
}
});
break;
case 'creditsRangeMax':
$('#creditsDegreeMax').val(this.value);
//break omitted intentionally
case 'creditsRangeMin':
jQuery.each($('#activities select'), function(i, value) {
if (['lab', 'quz', 'rct'].inArray(value.value)) {
message = 'Credit ranges apply only to the following activities: Lec, Lab, Fld, Ind, PSI, or Stu.';
helpAnchor = 'creditsAlternate';
}
});
break;
case 'creditsSemesterMax':
message = 'Max per semester is the maximum credit hours per semester that a student can take the course in a given semester. Mini-courses and alpha sub-area courses would fall into this category.';
helpAnchor = 'creditHoursMaxPerSemester';
break;
case 'creditsDegreeMax':
if ($('#creditsSingleValues').val() || $('#creditsRangeMin').val() || $('#creditsRangeMax').val()) {
message = 'Max per degree should indicate only those courses that can be repeated more than once toward the degree.';
helpAnchor = 'creditHoursMaxPerDegree';
}
break;
}
if (this.value > 24) {
if (this.id == 'creditsDegreeMax') {
message = 'Max repeat possible for any undergraduate course is 24 credit hours.';
helpAnchor = 'creditHoursMaxPerDegree';
} else {
message = 'Max credit hours for undergraduate cuorses is 24 credit hours.';
helpAnchor = 'creditHoursMaxPerDegree';
}
}
if (message) {
var creditNode = this;
queuePopup(
message,
{
'Reset': function() {
creditNode.value = creditNode.defaultValue;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
helpAnchor
);
}
}
function handleChangeDfRemoval()
{
var message = '';
switch (this.value) {
case 'no':
message = 'A change in course will normally remove the grade factor from a previously "failed" course for calculating the GPA. An exception would be if the revised course is fewer credit hours than the previous course <span style="text-decoration: underline;">OR</span> if the middle number in the course number is "9" <span style="text-decoration: underline;">OR</span> if course content has significantly changed.';
break;
case 'yes':
if ($('#courseNumber').val() % 100 >= 90) {
message = 'Courses with "9" in the middle do not have automatic D/F Removal.';
}
break;
}
if (message) {
var dfRemovalNode = this;
queuePopup(
message,
{
'Reset': function() {
dfRemovalNode.checked = false;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
},
'dfRemoval'
);
}
}
function handleOutcomeClicked()
{
this.blur();
......@@ -286,15 +622,32 @@ var courseCodeAvailableAjaxResponder = AjaxClient.extend(
var message = 'The course code '
+ this.subjectNode.value + ' ' + this.courseNumberNode.value + this.courseLetterNode.value
+ ' belongs to an active course. Click OK if you are you sure you want to continue.';
+ ' belongs to an active course. Click "Ignore" if you are you sure you want to continue.';
/*
if (confirm(message)) {
return;
}
*/
var subjectNode = this.subjectNode;
var courseNumberNode = this.courseNumberNode;
var courseLetterNode = this.courseLetterNode;
this.subjectNode.value = '';
this.courseNumberNode.value = '';
this.courseLetterNode.value = '';
queuePopup(
message,
{
'Reset': function() {
subjectNode.value = subjectNode.defaultValue;
courseNumberNode.value = courseNumberNode.defaultValue;
courseLetterNode.value = courseLetterNode.defaultValue;
$(this).dialog('close');
},
'Ignore': function() {
$(this).dialog('close');
}
}
);
},
getUrl: function() {
......@@ -303,7 +656,8 @@ var courseCodeAvailableAjaxResponder = AjaxClient.extend(
+ '/id/' + document.formSessionId
+ '/subject/' + this.subjectNode.value
+ '/courseNumber/' + this.courseNumberNode.value
+ '/courseLetter/' + this.courseLetterNode.value;
+ '/courseLetter/' + this.courseLetterNode.value;
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment