INSTALL_HOST = einstein
INSTALL_USER = wking
-INSTALL_DIR = public_html/courses/phys201_s09
+INSTALL_DIR = public_html/courses/test
SOURCE_DIR := $(INSTALL_DIR)/source # := to avoid shifting with $INSTALL_DIR
FRAMEWORK_SUBDIR = html
-CONTENT_SUBDIRS = announcements latex
+CONTENT_SUBDIRS = #announcements latex
SUBDIRS = $(FRAMEWORK_SUBDIR) $(CONTENT_SUBDIRS)
export INSTALL_HOST
This is an attempt at an organized, open source, course website. The
idea is that a course website consists of a static HTML framework and
-a bunch of content that is gradually filled in as the semester/quarter
-progresses. I've put the HTML framework in the HTML directory, along
-with some of the write-once-per-course content (e.g. Prof & TA info).
-See html/README for more information on the layout of the HTML.
+a bunch of content that is gradually filled in as the term progresses.
+I've put the HTML framework in the HTML directory, along with some of
+the write-once-per-course content (e.g. Prof & TA info). See
+html/README for more information on the layout of the HTML.
The rest of the directories contain the code for compiling material
that is deployed as the course progresses. The announcements
--- /dev/null
+Course Web-admin,
+
+This is the framework I used for the Phys201 course in the winter of
+2008-2009, and I think it works pretty well. The workflow is,
+however, a bit different than anything I've found elsewhere, so I'll
+explain how it works for me below. Feel free to email me with any
+questions or problems.
+
+~/src/
+======
+
+The source for the website (and a bunch of LaTeX problems/solutions
+I've written up over the last few years as a TA), are all over in
+~/src/, and in my own work I make all my changes there and then run
+"make" in the ~/src/ directory to push the changes to ~/public_html,
+which is the actively served directory. This is mostly to allow
+automatic compiling and installation of my LaTeX solutions. You can
+look around in ~/src/ if you like, but if it's too confusing, I
+suggest you stick to handling ~/public_html directory.
+
+~/public_html/ and overview
+===========================
+
+~/public_html/ contains assorted *.shtml files, each of which
+corresponds to one of the course pages. They all use Server Side
+Includes (SSI) to include headers and footers stored in
+ ~/public_html/shared/
+which take care of a lot of HTML boilerplate. If you want to add
+content to any of the pages, just hack away on the appropriate *.shtml
+file (for example, see labs.shtml). You'll definitely want to flesh
+out the content in index.shtml (the main page) with appropriate course
+details.
+
+Inside many of the *.shtml files are <?php ?> tags. These tags use
+PHP to include all the site's dynamic content. I suggest you leave
+them alone. You won't have to worry about the PHP code itself, but
+you will have to supply those scripts with content to parse. This
+content lives in ~/public_html/xml/ and ~/public_html/docs.
+
+~/public_html/xml/
+==================
+
+profs.xml, TAs.xml, and course.xml are pretty clear. Just fill in the
+XML as appropriate for the course. webmaster.xml is even easier,
+since you don't have to look up your own information.
+
+atom.xml is an atom feed (which is also parsed by atom.php to fill in
+the announcements page). I wrote a command line atom feed generator
+"atomgen", which I've installed for you. Run
+ atomgen --help
+and
+ atomgen add --help
+to see information about how to add to the atom.xml I've already
+created. For example, to add a comment saying you'd posted the
+first set of homework solutions, you might run
+ echo "Homework 1 solutions posted. Hope you didn't have too much trouble." | \
+ atomgen -o ~/public_html/xml/atom.xml add -i ~/public_html/atom.xml \
+ "Homework 1 solutions posted." \
+ "http://www.physics.drexel.edu/~phys201admin/homeworks.shtml#s1"
+where we use echo and the pipe (|) to pass the content for the post in
+via atomgen's stdin.
+
+~/public_html/doc/
+==================
+
+Each of the *.shtml pages except index.shtml, content.shtml, and
+announcements.shtml (whose content we've already discussed) has a call
+to printSectionDocs() in its PHP. This call links in data from the
+~/public_html/doc/. The syntax is
+ printSectionDocs($title, $directory, $startswith, $maxnum);
+for example
+ printSectionDocs('Lecture', 'doc/lec', 'lec', 20);
+which searches through $directory (doc/lec) for any files of the form
+$startswith$index_* (lec5_slides.pdf) and links to them, calling them
+* (slides.pdf). $maxnum makes it easy for printSectionDocs() to
+reference the files newest-to-oldest, finding files with
+0 < $index <= $maxnum. $title sets the headings of the per-index
+blurbs.
+
+To make the system work, you just drop your content into (for example)
+ ~/public_html/doc/lec/
+with appropriate file names, and links show up on lectures.shtml
+automatically. Because of the automatic linking, make sure you it's
+OK to post the information (e.g. exam solutions) BEFORE you place them
+in the doc/ tree.
+
+To keep everything organized, I've also added doc/note to store things
+like a course syllabus.pdf, and write the link by hand in index.html's
+list of course resources.
+
+In the past, I've used
+ doc/lec/ for lecture notes/slides.
+ doc/rec/ for recitation problems and solutions.
+ doc/lab/ for lab procedures and prelabs.
+ doc/hwk/ for homework problems and solutions.
+ doc/exams/ for exam solutions.
+but it should be pretty clear what to change if you want to fiddle
+with that layout.
+
+style
+=====
+
+I haven't spent much time making everything look all pretty, so
+there's surely room for improvement if you like playing with CSS.
+
+
+And that's it!
+
+Good luck,
+Trevor
+
+
+p.s. don't worry about what's in ~/bin/ or ~/lib/ unless you want to.
+They're there so you have atomgen and it works, but are not important
+for website maintenance.
--- /dev/null
+#!/bin/bash
+#
+# I've occasionally had problems with .shtml inclusion for the header
+# and footer. Since there's not any processing going on in those
+# files, they can be straight .html instead. This script makes the
+# necessary adjustments.
+#
+# In one installation, the errors raised in the apache logs were
+# unable to include potential exec
+# since the SSI handler was attempting to parse the header/footer as
+# well. I'm not sure why it had a problem with that, but changing
+# them to .html files means the SSI handler will no longer try to
+# parse them and you avoid the problem.
+#
+#
+# Usage: ./html-includes.sh
+
+set -e # exit immediately on failed command
+set -o pipefail # pipes fail if any stage fails
+set -v # verbose, echo commands to stdout
+
+
+for FILE in $(ls html/shared/ | grep '.shtml$'); do
+ mv -v "html/shared/${FILE}" "html/shared/${FILE/shtml/html}"
+ for CALLER in html/*.shtml; do
+ # correct links for callers
+ sed -i "s/shared\/$FILE/shared\/${FILE/shtml/html}/" "$CALLER"
+ done
+done
+
** Course Information **
Add appropriate entries to the course.xml file in the xml directory.
-The course xml file is formatted by quarter.php, and maybe a few more
-in the future.
+The course xml file is read by course.php. See the title of
+index.shtml for an example of how to use this information dynamically
+in your HTML.
**** Dynamic information ****
<!--#include virtual="shared/header.shtml"-->
<?php
-include ("php/atom.php");
-$s=simplexml_load_file('xml/atom.xml');
+include ('php/atom.php');
+if (file_exists('xml/atom.xml'))
+ $s=simplexml_load_file('xml/atom.xml');
+else
+ $s=NULL;
printAtom("Announcements", $s, "Feed purpose");
?>
<h3>Labs</h3>
<ul>
- <li>All students should be present in Disque-820A - Phys201
- Laboratory - a few minutes before the start of their scheduled lab.
+ <li>All students should be present in ROOM ... a few minutes before
+ the start of their scheduled lab.
</li>
<li>Please note that pre-lab work must be completed before you go to
the lab to perform the experiment.
<!--#include virtual="shared/header.shtml"-->
-<h2>Physics 201 - Fundamentals of Physics III</h2>
-<?php include ("php/quarter.php") ?>
+<?php
+// Automatically get the course id and title from xml/course.xml
+include ("php/course.php");
+$course = course(0);
+$cid = $course->course_id();
+echo '<h2>'.$cid.' - '.$course->title.'</h2>'."\n";
+echo $course->term."\n";
+?>
<p>
-This is my personal Phys 201 course page, for things specific to my
-two recitations. I'll probably just be posting homework solutions,
-but I'll email you and post an announcement if that changes.
+This is my personal <?=$cid?> page, for things specific to my two
+recitations. I'll probably just be posting homework solutions, but
+I'll email you and post an announcement if that changes...
</p>
<h4>Resources</h4>
<li><a href="announcements.shtml">Announcements</a></li>
<li><a href="recitations.shtml">Recitations</a></li>
<li><a href="homeworks.shtml">Homeworks</a></li>
- <li><a href="../contact.shtml">Contact</a></li>
+ <li><a href="contact.shtml">Contact</a></li>
</ul>
function printAtom($feed_title, $feed, $ignored_title){
echo "<h3>$feed_title</h3><p></p>\n\n";
+ if ($feed == NULL) {
+ echo "<p>No entries yet</p>\n";
+ return;
+ }
+
/* convert entries to an array (from some sort of iterable) */
$entries = array();
foreach($feed->entry as $entry)
--- /dev/null
+<?php
+
+class Course {
+ public $title = "Fundamentals of Physics I";
+ public $subject_code = "Physics";
+ public $number = "101";
+ public $term = "Fall 2009";
+
+ public function __construct($path_to_course_xml) {
+ $s=simplexml_load_file($path_to_course_xml);
+ $this->title = $s->title;
+ $this->subject_code = $s->subjectcode;
+ $this->number = $s->number;
+ $this->term = $s->term;
+ $this->url = $s->url;
+ }
+ public function course_id() { // (e.g. "Physics 101")
+ return $this->subject_code.' '.$this->number;
+ }
+}
+
+// index.shtml lives in level 0, shared/header.shtml lives in level 1, etc.
+function course($level=0) {
+ $path = 'xml/course.xml';
+ while ($level > 0) {
+ $path = '../'.$path;
+ $level -= 1;
+ }
+ return new Course($path);
+}
+
+?>
+++ /dev/null
-<?php
-// return a string representing the current quarter
-echo "Spring 2009";
-?>
<?php
/*
simplexml_load_file idea from 2008 courselist page
- http://www.physics.drexel.edu/students/courses/
- COPYRIGHT© 2008 DREXEL UNIVERSITY DEPARTMENT OF PHYSICS
- Design by Daniel J. Cross
+ http://www.physics.drexel.edu/students/courses/
+ COPYRIGHT© 2008 DREXEL UNIVERSITY DEPARTMENT OF PHYSICS
+ Design by Daniel J. Cross
*/
$s=simplexml_load_file('xml/webmaster.xml');
$name=$s->name;
<!-- need to make the shtml file executable ($ chmod 744 filename) -->
<!-- if XBitHack On, or give footer a .shtml extension. -->
<p>
- Copyright © W. Trevor King. <br />
- This material is released under the <a href="/~wking/shared/GNU_FDL.txt">GNU FDL</a>.
+ This website is based on W. Trevor King's <a
+ href="/~wking/code/course-site">course-site</a> package, Copyright
+ © W. Trevor King.<br />
+ Released under the <a href="/~wking/shared/GNU_FDL.txt">GNU FDL</a>.
</p>
<p>
Validate <a href="http://validator.w3.org/check?uri=referer">xhtml</a>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<!--
- Copyright (c) 2008 W. Trevor King
+ Copyright (C) 2008, 2009 W. Trevor King.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
+
+ Part of W. Trevor King's course-site project.
+ http://www.physics.drexel.edu/~wking/code/course-site/
-->
<!-- XHTML 1.1 removes the 'name' attribute from 'a' tags,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -->
+<?php
+// Automatically get the course id and url (used later) from ../xml/course.xml
+include ("../php/course.php");
+$course = course(1);
+$cid = $course->course_id();
+?>
+
<head>
<meta http-equiv="content-type"
content="text/html; charset=utf-8" />
-<meta name="description" content="Physics 201" />
-<meta name="keywords" content="drexel,physics,phys201" />
+<meta name="description" content="<?=$cid?>" />
+<meta name="keywords" content="drexel,physics,<?=$cid?>" />
<meta name="robots" content="all" />
<link rel="stylesheet" href="shared/style.css" type="text/css" />
<link rel="icon" href="shared/favicon.ico" type="image/x-icon" />
<link rel="alternate" href="./xml/atom.xml" type="application/atom+xml" title="Atom 1.0"/>
-<title>Phys201</title>
+<title><?=$cid?></title>
</head>
<body>
<a id="top" name="top" />
</p>
<div id="header">
- <h3>Physics 201</h3>
- <a href="/students/courses/physics-201">Official Homepage</a>
+ <h3><?=$cid?></h3>
+<?php
+echo ' <a href="'.$course->url.'">Official Homepage</a>'."\n";
+?>
|
<a href="index.shtml">Homepage</a>
|
<!-- |
<a href="exams.shtml">Exams</a> -->
|
- <a href="../contact.shtml">Contact</a>
+ <a href="contact.shtml">Contact</a>
|
<a href="/">Department</a>
<hr />
<?xml version="1.0" encoding="utf-8"?>
<people>
<person>
- <name>Farnaza Neville Batliwalla</name>
- <email>fnb23 at drexel dot edu</email>
- <picture>/students/courses/current/physics-201/faculty/farnaza.jpg</picture>
- </person>
- <person>
- <name>Benjamin Coy</name>
- <email>btc24 at drexel dot edu</email>
- <office>Disque 916</office>
- <extension>1546</extension>
- <picture>/directory/graduate/small/coy.benjamin.jpg</picture>
- </person>
- <person>
- <name>Edward Damon</name>
- <email>ead54 at drexel dot edu</email>
- <office>Disque 705</office>
- <extension>2732</extension>
- <picture>/directory/graduate/small/damon.edward.jpg</picture>
- </person>
- <person>
- <name>Nandita Ganesh</name>
- <email>ng97 at drexel dot edu</email>
- <picture>/students/courses/current/physics-201/faculty/nandita.jpg</picture>
- </person>
- <person>
- <name>Travis Hoppe</name>
- <email>travis.aaron.hoppe at drexel dot edu</email>
- <office>Disque 819A</office>
- <extension>2057</extension>
- <url>http://www.physics.drexel.edu/~thoppe</url>
- <picture>/directory/graduate/small/hoppe.travis.jpg</picture>
- </person>
- <person>
- <name>Trevor King</name>
- <email>wtk25 at drexel dot edu</email>
+ <name>Jane Doe...</name>
+ <email>jdoe1 at drexel dot edu</email>
<office>Disque 927</office>
- <extension>1818</extension>
- <url>http://www.physics.drexel.edu/~wking</url>
- <picture>/directory/graduate/small/king.trevor.jpg</picture>
- </person>
- <person>
- <name>Anitha Manohar</name>
- <office>Disque 912</office>
- <email>am627 at drexel dot edu</email>
- <picture>/students/courses/current/physics-201/faculty/anitha.jpg</picture>
- </person>
- <person>
- <name>Greeshma Manomohan</name>
- <email>gm322 at drexel dot edu</email>
- <picture>/students/courses/current/physics-201/faculty/greeshma.jpg</picture>
- </person>
- <person>
- <name>Ryan Michaluk</name>
- <email>rmm622 at drexel dot edu</email>
- <office>Disque 916</office>
- <extension>1546</extension>
- <picture>/directory/graduate/small/michaluk.ryan.jpg</picture>
- </person>
- <person>
- <name>Pavithra Ramakrishnan</name>
- <office>Disque 915</office>
- <extension>2739</extension>
- <email>pr323 at drexel.edu</email>
- <picture>/students/courses/current/physics-201/faculty/pavithra.jpg</picture>
+ <extension>1234</extension>
+ <url>http://www.physics.drexel.edu/~jdoe</url>
+ <picture>/directory/graduate/small/nophoto.jpg</picture>
</person>
<person>
- <name>John Schreck</name>
- <email>jss74@drexel.edu</email>
- <office>Disque 705</office>
- <extension>2732</extension>
- <picture>/directory/graduate/small/schreck.john.jpg</picture>
+ <name>John Doe</name>
+ <email>jdoe2 at drexel dot edu</email>
+ <picture>/directory/graduate/small/nophoto.jpg</picture>
</person>
</people>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<course>
+ <title>Fundamentals of Physics I...</title>
+ <subjectcode>Physics</subjectcode>
+ <number>101</number>
+ <term>Fall 2009</term>
+ <url>/students/courses/physics-101</url>
+</course>
<?xml version="1.0" encoding="utf-8"?>
<people>
<person>
- <name>T. S. Venkataraman</name>
- <office>Disque 912</office>
- <hours>Open Door Policy Every Term</hours>
- <email>venkat at drexel dot edu</email>
- <extension>2721</extension>
- <url>/directory/faculty/homepage.html?name=Venkat</url>
- <picture>/students/courses/current/physics-201/faculty/venkatMATE.bmp</picture>
+ <name>P.B Anjay...</name>
+ <office>Dining hall</office>
+ <hours>Noon to 1pm</hours>
+ <email>pbj at drexel dot edu</email>
+ <extension>4321</extension>
+ <url>/directory/faculty/homepage.html?name=Anjay</url>
+ <picture>/directory/graduate/small/nophoto.jpg</picture>
</person>
</people>
<?xml version="1.0" encoding="utf-8"?>
<person>
- <name>Trevor King</name>
- <email></email>
+ <name>John J.J. Smith...</name>
+ <email>jjjsmith at big dot edu</email>
</person>
--- /dev/null
+#!/bin/bash
+#
+# By default, this website is setup for remote installation via SSH.
+# This works well if you've setup SSH keys for passwordless login, but
+# is annoying otherwise.
+#
+# An alternative setup would be to keep the source code on the same
+# machine as the webserver, and use local CP calls to push the data
+# into the hosted directory. This script converts the default
+# codebase into such a local installation.
+#
+# Usage: ./local-install.sh
+
+set -e # exit immediately on failed command
+set -o pipefail # pipes fail if any stage fails
+set -v # verbose, echo commands to stdout
+
+echo -e "\nRemove the INSTALL_HOST/USER lines in ./Makefile.\n"
+sed -i 's/^INSTALL_HOST =.*//' ./Makefile
+sed -i 's/^INSTALL_USER =.*//' ./Makefile
+sed -i 's/^export INSTALL_HOST.*//' ./Makefile
+sed -i 's/^export INSTALL_USER.*//' ./Makefile
+
+echo -e "\nReplace the SCP with a local CP in all Makefiles.\n"
+sed -i 's/scp -p \(.*\) \$(INSTALL_USER)@\$(INSTALL_HOST):\(.*\)$/cp -up \1 \2/' \
+ $(find . -name Makefile)
+
+
+echo -e "\nNo need to SSH into installation host to make directories.\n"
+# merge first two lines of multi-line SSH calls
+sed -i '
+# look for multi-line SSH calls
+/ssh \$(INSTALL_USER)@\$(INSTALL_HOST) \\/ {
+# got one, read in the next line
+ N
+# concatenate the two lines
+ s/\\\n\t *//
+}' $(find . -name Makefile)
+# fix the single-line calls (now all the calls)
+sed -i 's/ssh \$(INSTALL_USER)@\$(INSTALL_HOST) \(.*\)$/\1/' \
+ $(find . -name Makefile)
+
+
+echo -e "\nCorrect a few particular details.\n"
+# correct a comment
+sed -i 's/INSTALL_USER, INSTALL_HOST, //' latex/notes/topics/linear_algebra/Makefile
+# adjust shell ecscaping for newly non-SSHed command
+sed -i "/cd \\\$(INSTALL_DIR) '&&' rm/ { s/'&&'/\&\&/g }" html/Makefile
+#sed -i "s/'&&'/\&\&/" html/Makefile
+
+
+echo -e "\nStandardize INSTALL_DIR destination in ./Makefile.\n"
+sed -i 's/^INSTALL_DIR = .*/INSTALL_DIR = ~\/public_html\//' Makefile