// courseFormat.js -- functions dealing w/course variables (found
//	in the courseInfo.js file in each directory) and semester
//	variables (found here, or in this directory)
//
// Kurt Schmidt
//
// 12/4/03
//
// REVISIONS
//



//&&&&&&&&   Functions   &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

//////////////////////////////////////////////////////////////////////////
// setTitle - sets the title of the page
// depend:  gCourseNr, gCourseTitle, gTerm, gYear (local courseInfo.js)

function setTitle()
{
	document.title = gCourseNr + " -- " + gCourseTitle + 
			", " + gTerm + " " + gYear
}

//////////////////////////////////////////////////////////////////////////
// writeTitle - sets the title of the page
// depend:  gCourseNr, gCourseTitle, gTerm, gYear (local courseInfo.js)

function writeTitle()
{
	var title = "<title>" + gCourseNr + " -- " + gCourseTitle + 
			", " + gTerm + " " + gYear + "</title>"
	document.write( title )
}
//////////////////////////////////////////////////////////////////////////
// withdrawalDate - sets the title of the page
// depend:  gWithdrawalDeadline (courseInfo.js)

function withdrawalDate()
{
	document.writeln( gWithdrawalDeadline )
}

//////////////////////////////////////////////////////////////////////////
// syllabusTitle - sets the title of the syllabus
// depend:  gCourseNr, gTerm, gYear (local courseInfo.js)

function syllabusTitle()
{
	document.title = "Syllabus -- " + gCourseNr +  ", " + gTerm + " " + gYear
}

//////////////////////////////////////////////////////////////////////////
// courseTitle - Prints the course # and title
// depend:  gCourseNr, gCourseTitle (local courseInfo.js)

function courseTitle()
{
	document.write( gCourseNr )
	document.write( " -- " )
	document.write( gCourseTitle )
}

//////////////////////////////////////////////////////////////////////////
// term - prints the term (term year)
// depend:  gTerm, gYear (local courseInfo.js)

function term()
{
	document.write( gTerm )
	document.write( " " )
	document.write( gYear )
}

//////////////////////////////////////////////////////////////////////////
// header - just prints the top of the file (course, term, etc.)
// depend:  gCourseNr, gCourseTitle, gTerm, gYear (local courseInfo.js)

function header()
{
	with( document )
	{
		write( "<center><font size='+3'>" )
		write( gCourseNr )
		write( " - " )
		write( gCourseTitle )
		write( "</font>\n<br><font size='+1'>" )
		write( gTerm )
		write( " " )
		write( gYear )
		write( "</font></center>\n" )
	}
}

//////////////////////////////////////////////////////////////////////////
// pageLink - prints a link to this course's page
// depend:  gPage (local courseInfo.js)

function pageLink()
{
	with( document )
	{
		write( "<a target='" )
		write( gCourseNr )
		write( "' href='http://" )
		write( gPage )
		write( "'>" )
		write( gPage )
		write( "</a>" )
	}
}

//////////////////////////////////////////////////////////////////////////
// listReqdText - prints a table of the req'd text books
// depend:  gReqdText (local courseInfo.js)

function listReqdText()
{
	with( document )
	{
		write( "<table>\n<tr><th align='left'>Required</th></tr>" )
		if( gReqdTexts.length > 0 )
		{
			for( i=0; i < gReqdTexts.length; ++i )
			{
				write( "\t<tr><td>\n\t\t" )
				write( gReqdTexts[i] )
				write( "\n\t</td></tr>\n" )
			}	// for
		}	// if
		else
		{
			write( "<tr><td><i>none</i></td></tr>\n" )
		}
		write( "</table>\n" )
	}	// while
}

//////////////////////////////////////////////////////////////////////////
// listOptText - prints a table of the req'd text books
// depend:  gOptText (local courseInfo.js)

function listOptText()
{
	with( document )
	{
		write( "<table>\n<tr><th align='left'>Optional</th></tr>" )
		if( gOptTexts.length > 0 )
		{
			for( i=0; i < gOptTexts.length; ++i )
			{
				write( "\t<tr><td>\n\t\t" )
				write( gOptTexts[i] )
				write( "\n\t</td></tr>\n" )
			}	// for
		}	// if
		else
		{
			write( "<tr><td><i>none</i></td></tr>\n" )
		}
		write( "</table>\n" )
	}	// while
}

//////////////////////////////////////////////////////////////////////////
// listTas - prints a table of the TA(s)
// depend:  gTaList, gCourseNr (local courseInfo.js)

function listTas()
{
	with( document )
	{
		write( "<table>\n\t<tr>\n" )
		if( gTaList.length > 0 )
		{
			for( i=0; i < gTaList.length; ++i )
			{
				write( "\t\t<td><table>\n\t\t\t<tr><td align='center'>" )
				write( gTaList[i++] )
				write( "</td></tr>\n\t\t\t\t<tr><td align='center'>" )
				write( "<a href='mailto:" )
				write( gTaList[i] )
				write( "?subject=" )
				write( gCourseNr )
				write( " &lt;meaningful subject&gt;'>" )
				write( gTaList[i++] )
				write( "</a></td></tr>\n\t\t\t\t<tr><td align='center'>" )
				if( gTaList[i].length == 0 )
					write( "&nbsp;" )
				else
				{
					write( "<a target='ta' href='http://" )
					write( gTaList[i] )
					write( "'>" )
					write( gTaList[i] )
					write( "</a>" )
				}
				write( "</td></tr>\n\t\t\t</tr>\n\t\t</table></td>\n" )
			}	// for
		}	// if
		else
		{
			write( "\t<tr><td><i>none</i></td></tr>\n" )
		}
		write( "</table>\n" )
	}	// while
}


//////////////////////////////////////////////////////////////////////////////
// honestyStmt - prints out the entire section on cheating
// depend: none

function honestyStmt()
{
	with( document )
	{
		write( "<h2>Statement on academic honesty:</h2>" )

		write(
		"See the <a target='DuStudHandbook' href=\n"
		+ "'http://www.drexel.edu/studentlife/docs/handbook/shindex.html'>section\n"
		+ "on academic dishonesty</a> in the Drexel University Student Handbook.\n"
		+ "Any form of academic dishonesty related to an assignment will result\n"
		+ "in a score of zero for the assignment for the first infraction.\n"
		+ "Subsequent infractions may result in an F for the term.\n"

		+ "<p>My take on it, simply:  <b>Your work <i>must</i> be your own.</b>\n"
		+ "You may not \"write a program together\" unless group work is\n"
		+ "specified.  You may not lend your work to others to view, for any\n"
		+ "reason.  You may not reproduce any other person's work.  This\n"
		+ "includes code gotten from the Web.  The two exceptions are code that\n"
		+ "appears in the course text, and code that I give you.\n"

		+ "<p>I encourage discussion of topics covered in class.  Further, you\n"
		+ "are allowed to discuss the problem statement for a given assignment.\n"
		+ "E.g., \"What does Kurt mean when he say he wants...?\".  You may\n"
		+ "discuss particular basic skills, such as \"How do we time a loop?\"\n"
		+ "or \"Is there a function that...?\", as long as answers are\n"
		+ "<b>not</b> framed in the context of the given assignment.  If there\n"
		+ "is a question in your mind, then you're probably on thin ice, and\n"
		+ "should at least ask me.\n"

		+ "<p>Your code is checked.  Changing identifier names is irrelevant.\n"
		+ "Inexperienced programmers who've only known each other a short while\n"
		+ "do <b>not</b> write semantically identical code, unless there has\n"
		+ "been collaboration.\n"

		+ "<p>I also expect (and will check) that any directories on public\n"
		+ "servers containing anything that looks like code from my assignments\n"
		+ "be closed.\n"

		+ "<p>If you post code, in the context of a given assignment, publicly,\n"
		+ "you will receive a zero for that assignment.\n"

		+ "<p>This serves as your warning.  I've been teaching since 1989, and\n"
		+ "teaching programming since 1995.  I don't care to discuss this topic\n"
		+ "further, other than to clarify questions you might have.\n"
		)
	}
}	// function honestyStmt


//////////////////////////////////////////////////////////////////////////
// submissionStmt - Writes out submission instructions
// depend:  gWebctLink	(

function submissionStmt()
{
	with( document )
	{
		write( "<h2>How to Submit</h2>" )

		write( gSubmissionText )
	}
}	// function submissionStmt()


//////////////////////////////////////////////////////////////////////////
// cms - list (and link to) the current course mgt. system
// depend:  None

function cms()
{
	var s
	with( document )
	{
		s = "<a target='blank'" +
			"href='http://learning.drexel.edu'>Blackboard Vista</a>"
		write( s )
	}
}

//////////////////////////////////////////////////////////////////////////
// printPath - appends argument to correct course directory
// depend:  gCourseNr

function printPath( suff )
{
	var path
	with( document )
	{
		path = gPage + "/" + suff
		write( path )
	}
}

