From: W. Trevor King
Date: Mon, 8 Jun 2009 18:12:57 +0000 (-0400)
Subject: Began versioning.
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=65d32ad227affcf75d7094e74a36414357f9e49a;p=course.git
Began versioning.
This course-website framework developed over the first half of 2009
while TAing for Phys201 (Modern physics for engineers) at Drexel
University. After a few false starts at versioning, I'm starting this
new repository because I think I've figured out a stable scheme.
When you start a new course, clone this repository to create a working
copy. Seperate your commits on the clone into course-specific commits
(e.g. Makefile changes when adding homework 2, atom.xml updates, etc.)
and general commits (corrections to README files, additional problem
source in /latex/problems/, etc.). Then, cherry pick the
course-specific commits back into this repo with
git remote add phys201 /home/bob/phys201
git fetch phys201
git cherry-pick 1d8fb1fe41dfc1b1eb38c7b5d574577c4b341c58
git remote rm phys201
git remote prune phys201
The benefit of cloning an independent repo over just starting up a new
branch is that most people don't care about the particular per-course
details, but lots of people may want the framework, and not want to
worry about the disk space needed for all the per-course cruft.
From a more philosophical perspective, this repo will track the history
of 'what you want for building a course website', while the per-course
repos track the history of a particular course's website (and student
grades, TA emails, etc.).
---
65d32ad227affcf75d7094e74a36414357f9e49a
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..69702dd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+INSTALL_HOST = einstein
+INSTALL_USER = wking
+INSTALL_DIR = public_html/courses/phys201_s09
+SOURCE_DIR := $(INSTALL_DIR)/source # := to avoid shifting with $INSTALL_DIR
+
+FRAMEWORK_SUBDIR = html
+CONTENT_SUBDIRS = announcements latex
+SUBDIRS = $(FRAMEWORK_SUBDIR) $(CONTENT_SUBDIRS)
+
+export INSTALL_HOST
+export INSTALL_USER
+export INSTALL_DIR
+export SOURCE_DIR
+
+install :
+ @for i in $(SUBDIRS); do \
+ echo "make install in $$i..."; \
+ (cd $$i; $(MAKE) $(MFLAGS) install); done
+
+clean :
+ @for i in $(SUBDIRS); do \
+ echo "make clean in $$i..."; \
+ (cd $$i; $(MAKE) $(MFLAGS) clean); done
+
+echo :
+ @for i in $(SUBDIRS); do \
+ echo "make echo in $$i..."; \
+ (cd $$i; $(MAKE) $(MFLAGS) echo); done
diff --git a/README b/README
new file mode 100644
index 0000000..7a2efac
--- /dev/null
+++ b/README
@@ -0,0 +1,27 @@
+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.
+
+The rest of the directories contain the code for compiling material
+that is deployed as the course progresses. The announcements
+directory contains the atom feed for the course, and possibly a list
+of email addresses of people who would like to (or should) be notified
+when new announcements are posted. The latex directory contains LaTeX
+source for the course documents for which it is available, and the pdf
+directory contains PDFs for which no other source is available
+(e.g. scans, or PDFs sent in by Profs or TAs who neglected to include
+their source code).
+
+Installation is though a recursive Makefile framework. You'll need to
+set the INSTALL_* variables once at the beginning of the course to
+make sure all the files go to the right place, and I'd strongly
+recommend setting up a ssh-keyed login from your work machine to your
+hosted web account (see http://www.physics.drexel.edu/~wking/code/#SSH ).
+
+Not posted on the website but also important to the course are the
+students' grades, which I keep in the grades directory. See the
+README files in any of the subdirectories for more details on that
+particular portion.
diff --git a/announcements/Makefile b/announcements/Makefile
new file mode 100644
index 0000000..63361ac
--- /dev/null
+++ b/announcements/Makefile
@@ -0,0 +1,9 @@
+INSTALL_FILES = atom.xml
+INSTALL_DIR := $(INSTALL_DIR)/xml
+
+clean :
+ rm -f install
+
+install : $(INSTALL_FILES)
+ scp -p $^ $(INSTALL_USER)@$(INSTALL_HOST):$(INSTALL_DIR)
+ @date > $@
diff --git a/announcements/README b/announcements/README
new file mode 100644
index 0000000..f3a7f7e
--- /dev/null
+++ b/announcements/README
@@ -0,0 +1,26 @@
+Construct the atom feed using
+ atomgen -o atom.xml
+See
+ atomgen --help
+for more information.
+
+For example:
+ atomgen -o atom.xml new --title 'Physics 201' --author 'W. Trevor King' \
+ http://www.physics.drexel.edu/~wking/phys201
+ echo "Changes to the Phys201 website will be noted in this feed." | \
+ atomgen -o atom.xml add -i atom.xml 'Feed purpose' \
+ http://www.physics.drexel.edu/~wking/phys201
+
+
+You can send automatic emails to your students when you publish new
+announcements in the atom feed. The best way I have found to date
+consists of monitoring the posted atom.xml file with rss2email
+ http://rss2email.infogami.com/
+I setup r2e to monitor the feed and email me when there's a change.
+r2e runs every 15 minutes in a cron job
+ 15 * * * * /usr/bin/r2e run
+Then I set up a procmail rule to forward the mail off to the list
+ :0
+ * ^From: "Physics 201, W. Trevor King" $
+ ! `grep -v '^#' $HOME/course/announcements/addresses.txt`
+ # ^--- Make sure those are backticks, BTW (ASCII 96) ---^
diff --git a/announcements/addresses.txt.examples b/announcements/addresses.txt.examples
new file mode 100644
index 0000000..5647f35
--- /dev/null
+++ b/announcements/addresses.txt.examples
@@ -0,0 +1,6 @@
+# Administrators
+John JJ Smith
+Johnny Appleseed
+# Students
+Jack
+Jill
diff --git a/announcements/script/course-details.sh b/announcements/script/course-details.sh
new file mode 100644
index 0000000..cfc58f9
--- /dev/null
+++ b/announcements/script/course-details.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Set-up some course-specific details for announcement/script/*.sh
+# Not intended to be used directly
+
+# No trailing slash on the course website, please.
+COURSE_WEBSITE='http://www.physics.drexel.edu/~wking/course'
+COURSE_TITLE='Physics 201'
+ATOM_AUTHOR='W. Trevor King'
diff --git a/announcements/script/initial-post.sh b/announcements/script/initial-post.sh
new file mode 100755
index 0000000..b92afd8
--- /dev/null
+++ b/announcements/script/initial-post.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Create the initial posting for a course. Use carefully, this is
+# just meant to save some typing, and it might not fit into your
+# layout without a bit of tweaking.
+#
+# From the announcements directory
+# usage: script/initial-post.sh
+
+. script/course-details.sh
+
+echo "atomgen -o atom.xml new --title \"$COURSE_TITLE\" --author \"$ATOM_AUTHOR\" \"$COURSE_WEBSITE\""
+atomgen -o atom.xml new --title "$COURSE_TITLE" --author "$ATOM_AUTHOR" "$COURSE_WEBSITE"
+
+echo "echo \"Changes to the $COURSE_TITLE website will be noted in this feed.\" | \\
+ atomgen -o atom.xml add -i atom.xml 'Feed purpose' \\
+ \"$COURSE_WEBSITE\""
+echo "Changes to the $COURSE_TITLE website will be noted in this feed." | \
+ atomgen -o atom.xml add -i atom.xml 'Feed purpose' "$COURSE_WEBSITE"
diff --git a/announcements/script/post.sh b/announcements/script/post.sh
new file mode 100755
index 0000000..2047000
--- /dev/null
+++ b/announcements/script/post.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# Create a post pointing out a change in the website. Use carefully,
+# this is just meant to save some typing, and it might not fit into
+# your layout without a bit of tweaking.
+#
+# From the announcements directory
+# usage: script/post.sh []
+# where is one of hwk, lec, rec, lab, exam;
+# is an integer; and is an optional explaination.
+#
+# For example,
+# script/post.sh rec 2 solutions
+# points out the posting of Recitation 2 solutions, and targets the URL
+# $COURSE_WEBSITE/recitations.shtml#s2
+
+. script/course-details.sh
+
+if [ "$#" -lt 2 ]; then
+ echo "usage: script/post.sh []"
+ exit 1
+fi
+
+DIR="$1"
+INDEX="$2"
+NOTE="$3"
+
+if [ -n "$NOTE" ] && [ "${NOTE:0:1}" != " " ]; then
+ NOTE=" $NOTE" # ensure leading space
+fi
+
+if [ "$DIR" == "hwk" ]; then
+ NAME="Homework"
+ PAGE="homeworks.shtml"
+elif [ "$DIR" == "lec" ]; then
+ NAME="Lecture"
+ PAGE="lectures.shtml"
+elif [ "$DIR" == "rec" ]; then
+ NAME="Recitation"
+ PAGE="recitations.shtml"
+elif [ "$DIR" == "lab" ]; then
+ NAME="Lab"
+ PAGE="labs.shtml"
+elif [ "$DIR" == "exam" ]; then
+ NAME="Exam"
+ PAGE="exams.shtml"
+else
+ echo "Unrecognized dir '$DIR'"
+ exit 1
+fi
+
+echo "echo \"$NAME $INDEX$NOTE posted.\" | \\
+ atomgen -o atom.xml add -i atom.xml \"$NAME $INDEX$NOTE posted.\" \\
+ \"$COURSE_WEBSITE/$PAGE#s$INDEX\""
+echo "$NAME $INDEX$NOTE posted." | \
+ atomgen -o atom.xml add -i atom.xml "$NAME $INDEX$NOTE posted." \
+ "$COURSE_WEBSITE/$PAGE#s$INDEX"
diff --git a/html/.htaccess b/html/.htaccess
new file mode 100644
index 0000000..f5ff39e
--- /dev/null
+++ b/html/.htaccess
@@ -0,0 +1 @@
+AddType application/x-httpd-php .shtml
diff --git a/html/Makefile b/html/Makefile
new file mode 100644
index 0000000..53fcf32
--- /dev/null
+++ b/html/Makefile
@@ -0,0 +1,45 @@
+HTML_FILES = $(shell echo *.shtml)
+EMPTY_DIRS = doc source
+DEEP_EMPYT_DIRS = doc/exam doc/hwk doc/lab doc/lec doc/rec
+HTML_DIRS = shared php xml $(EMPTY_DIRS) $(DEEP_EMPTY_DIRS)
+SOURCE_FILES = $(HTML_FILES) $(HTML_DIRS) README .htaccess
+OTHER_FILES = Makefile
+DIST_FILES = $(SOURCE_FILES) $(OTHER_FILES)
+DIST_FILE = website_framework.tar.gz
+DIST_DIR = html
+
+clean :
+ rm -rf $(DIST_FILE) $(DIST_DIR) install*
+
+$(DIST_FILE) : $(DIST_FILES) $(EMPTY_DIRS)
+ mkdir $(DIST_DIR)
+ cp -rp $^ $(DIST_DIR)
+ tar -cozf $@ $(DIST_DIR)
+ rm -rf $(DIST_DIR)
+
+install : install-html install-source
+
+# Create a new directory for the installation
+install-dir :
+ ssh $(INSTALL_USER)@$(INSTALL_HOST) mkdir $(INSTALL_DIR)
+ @date > $@
+
+# Avoid the install-dir step, but allow installation to continue
+install-override :
+ @date > install-dir
+
+# The transform removes the preceeding DIST_DIR (e.g. `html/')
+install-html : $(DIST_FILE) install-dir
+ cat $< | ssh $(INSTALL_USER)@$(INSTALL_HOST) \
+ tar --transform="s,$(DIST_DIR),.," -xzvC $(INSTALL_DIR)
+ ssh $(INSTALL_USER)@$(INSTALL_HOST) \
+ cd $(INSTALL_DIR) '&&' rm -rf $(OTHER_FILES) $(DIST_DIR)
+ @date > $@
+
+install-source : $(DIST_FILE) install-html
+ scp -p $(DIST_FILE) $(INSTALL_USER)@$(INSTALL_HOST):$(SOURCE_DIR)
+ @date > $@
+
+# Create empty directories if neccessary (Git doesn't track dirs)
+$(EMPTY_DIRS) :
+ mkdir $@
diff --git a/html/README b/html/README
new file mode 100644
index 0000000..b01d1a9
--- /dev/null
+++ b/html/README
@@ -0,0 +1,76 @@
+To manage this website:
+
+**** Static information ****
+
+This information should only need to be setup at the beginning of the
+course.
+
+** Introductory Blurbs **
+
+You should change the introductory patter in all the *.shtml files
+as necessary to suit your course.
+
+** Contact Information **
+
+Add appropriate entries to the profs.xml, TAs.xml, and webmaster.xml
+files in the xml directory.
+
+The prof and TA files are formatted into XHTML by people.php, and the
+output is included in contact.shtml. The webmaster xml file is
+formatted by webmaster.php. Because the formatting occurs at
+run-time, the served page will always reflect the current xml data.
+
+** 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.
+
+
+**** Dynamic information ****
+
+** Assignments / Section documents **
+
+This material gets added and updated as the course progresses.
+Basically, it consists of a lab, rectitation, exam, etc. files
+(e.g. problems, solutions, procedures, etc.). The contents of the
+directories in doc (e.g. labs) are scanned by section_docs.php to
+create a list of all the files in the directory (e.g. 'doc/lab/'
+beginning with a certain prefix (e.g. lab[0-9], starts with 'lab').
+So simply dumping the appropriate files into the appropriate directory
+should get them displayed on the website.
+
+If you want to add a comment to a section document section (e.g. to
+point out the due date for hwk3, or the date/time/room of exam1), just
+add the a relevant XHTML snippet to the *_comment file. For example:
+
+The Interference lab starts on Wed., April 08, 2009.
+
+Wednesday, April 8, Thursday, April 9 and Friday, April 10, 2009:
+EVEN number sections 060, 062, 064, and 66.
+
+
+Wednesday, April 15, Thursday, April 16, and Friday, April 17, 2009:
+ODD number sections 063, 065, 071, and 073.
+
+
+
+If you have something that you want to put up later (e.g. solutions)
+you can chmod it 640 (so that it's not world-readable), and the php
+parser will ignore the file. After you have collected the
+homework/exam/etc., you chan chmod 644 the file (so that it is world
+readable) and it will show up on the website.
+
+** Announcements / Atom feed **
+
+Course announcements should be formatted in an atom feed
+ http://en.wikipedia.org/wiki/Atom_(standard)
+Atom feeds may be generated with a number of tools, but a simple
+command-line generator for linux is
+ http://www.physics.drexel.edu/~wking/code#atomgen
+Once you've generated the atom.xml file, copy it into the xml
+directory so atom.php can find it, and the announcements page will be
+filled in automatically. Another benefit of this approach is that a
+feed monitor such as rss2email can be used to monitor the feed and
+send classwide emails out whenever a new announcement is posted
+(http://rss2email.infogami.com/).
diff --git a/html/announcements.shtml b/html/announcements.shtml
new file mode 100644
index 0000000..0175860
--- /dev/null
+++ b/html/announcements.shtml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/html/homeworks.shtml b/html/homeworks.shtml
new file mode 100644
index 0000000..20ef959
--- /dev/null
+++ b/html/homeworks.shtml
@@ -0,0 +1,10 @@
+
+
+Homeworks
+
+
+
+
diff --git a/html/inactive/contact.shtml b/html/inactive/contact.shtml
new file mode 100644
index 0000000..58ce033
--- /dev/null
+++ b/html/inactive/contact.shtml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+For any questions about the webpage, contact
+.
+
+
+
diff --git a/html/inactive/exams.shtml b/html/inactive/exams.shtml
new file mode 100644
index 0000000..d5927ee
--- /dev/null
+++ b/html/inactive/exams.shtml
@@ -0,0 +1,10 @@
+
+
+Exams
+
+
+
+
diff --git a/html/inactive/labs.shtml b/html/inactive/labs.shtml
new file mode 100644
index 0000000..3abfa6a
--- /dev/null
+++ b/html/inactive/labs.shtml
@@ -0,0 +1,30 @@
+
+
+Labs
+
+
+ - All students should be present in Disque-820A - Phys201
+ Laboratory - a few minutes before the start of their scheduled lab.
+
+ - Please note that pre-lab work must be completed before you go to
+ the lab to perform the experiment.
+
+ - All students in a group must actively participate in the lab work.
+
+ -
+ All pages in each report must be completed and submitted to your lab
+ instructor before you leave the laboratory. To get a feeling for
+ our expectations, consider this
+ sample lab report.
+
+ -
+ No grade will be given for incomplete pre-lab work or lab reports.
+
+
+
+
+
+
diff --git a/html/inactive/lectures.shtml b/html/inactive/lectures.shtml
new file mode 100644
index 0000000..9afd513
--- /dev/null
+++ b/html/inactive/lectures.shtml
@@ -0,0 +1,10 @@
+
+
+Lectures
+
+
+
+
diff --git a/html/index.shtml b/html/index.shtml
new file mode 100644
index 0000000..5a31893
--- /dev/null
+++ b/html/index.shtml
@@ -0,0 +1,27 @@
+
+
+Physics 201 - Fundamentals of Physics III
+
+
+
+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.
+
+
+Resources
+
+
+
+Source code
+
+For those who are interested, the source code used to generate the
+content of this page is available here.
+
+
+
diff --git a/html/php/atom.php b/html/php/atom.php
new file mode 100644
index 0000000..5990683
--- /dev/null
+++ b/html/php/atom.php
@@ -0,0 +1,43 @@
+\n$content\n
\n";
+}
+
+function printAtom($feed_title, $feed, $ignored_title){
+ echo "$feed_title
\n\n";
+
+ /* convert entries to an array (from some sort of iterable) */
+ $entries = array();
+ foreach($feed->entry as $entry)
+ $entries[] = $entry;
+
+ /* print the entries */
+ foreach(array_reverse($entries) as $entry) {
+ $title=$entry->title;
+ $link=$entry->link['href'];
+ $tpub_string=$entry->published;
+ $tpub=strtotime($tpub_string);
+ $time=strftime("%r %A, %B %d, %Y", $tpub);
+ if ($title == $ignored_title)
+ continue;
+ echo "\n";
+ printContent($entry->content->asXML());
+ }
+}
+
+?>
diff --git a/html/php/people.php b/html/php/people.php
new file mode 100644
index 0000000..e3e97d3
--- /dev/null
+++ b/html/php/people.php
@@ -0,0 +1,62 @@
+\n";
+}
+function printPeopleEnd($use_pictures){
+ if ($use_pictures == false)
+ echo "\n";
+}
+function printPeople($title, $people, $use_pictures){
+ if ($use_pictures == true)
+ echo " $title
\n";
+ else
+ echo " $title |
\n";
+ foreach($people->person as $person){
+ $name=$person->name;
+ if (strlen($person->url) > 0){
+ $href=" href=\"".$person->url."\"";
+ } else {
+ $href="";
+ }
+ $office=$person->office;
+ $email=$person->email;
+ $hours=$person->hours;
+ $picture=$person->picture;
+ $extension=$person->extension;
+ if ($use_pictures == true) {
+ echo " \n";
+ echo "
\n";
+ echo "
\n";
+ echo " $name
\n";
+ echo " Email: $email
\n";
+ echo " Office: $office
\n";
+ echo " Hours: $hours
\n";
+ echo " Extension: $extension
\n";
+ echo "
\n";
+ echo "
\n";
+ } else {
+ echo " $name | $office | $email |
\n";
+ if (strlen($hours) > 0){
+ echo " | Office hours: $hours |
\n";
+ }
+ }
+ }
+}
+?>
diff --git a/html/php/quarter.php b/html/php/quarter.php
new file mode 100644
index 0000000..59d38f2
--- /dev/null
+++ b/html/php/quarter.php
@@ -0,0 +1,4 @@
+
diff --git a/html/php/section_docs.php b/html/php/section_docs.php
new file mode 100644
index 0000000..ab20df1
--- /dev/null
+++ b/html/php/section_docs.php
@@ -0,0 +1,44 @@
+=0; $i-=1) {
+ $front = "$directory/$startswith".$i."_";
+ $frontlen = strlen($front);
+ $files = glob($front."*");
+ $comment_file = $front.'comment'; // (X)HTML fragment commenting on doc.
+ $num_readable = 0;
+ foreach ($files as $file) {
+ if (is_readable($file) && $file != $comment_file) {
+ $num_readable += 1;
+ }
+ }
+ if ($num_readable > 0 or is_readable($comment_file)) {
+ echo "$title $i
\n";
+ } // 's' b/c id attributes must begin with a letter, not a digit.
+ if (is_readable($comment_file)) {
+ readfile($comment_file);
+ }
+ if ($num_readable > 0) {
+ echo "\n";
+ foreach ($files as $file) {
+ if (!is_readable($file) or $file == $comment_file) {
+ continue;
+ }
+ $len = strlen($file);
+ $url = $file;
+ $name = substr($file, $frontlen, $len-$frontlen); // remove $front
+
+ echo " - $name$mode
\n";
+ }
+ echo "
\n";
+ }
+ }
+}
+?>
diff --git a/html/php/webmaster.php b/html/php/webmaster.php
new file mode 100644
index 0000000..fba3f4e
--- /dev/null
+++ b/html/php/webmaster.php
@@ -0,0 +1,15 @@
+name;
+$email=$s->email;
+if (strlen($email) > 0)
+ echo "$name ($email)";
+else
+ echo "$name";
+?>
diff --git a/html/recitations.shtml b/html/recitations.shtml
new file mode 100644
index 0000000..cb1a671
--- /dev/null
+++ b/html/recitations.shtml
@@ -0,0 +1,10 @@
+
+
+Recitations
+
+
+
+
diff --git a/html/shared/favicon.ico b/html/shared/favicon.ico
new file mode 100644
index 0000000..028b0f5
Binary files /dev/null and b/html/shared/favicon.ico differ
diff --git a/html/shared/feed-icon-14x14.png b/html/shared/feed-icon-14x14.png
new file mode 100644
index 0000000..b3c949d
Binary files /dev/null and b/html/shared/feed-icon-14x14.png differ
diff --git a/html/shared/footer.shtml b/html/shared/footer.shtml
new file mode 100644
index 0000000..3d5e456
--- /dev/null
+++ b/html/shared/footer.shtml
@@ -0,0 +1,25 @@
+
+
+
+
+
+