From 8a4d469c74adac4e12fe9e2056d4ed3442d65ed3 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Tue, 22 Sep 2009 15:06:34 -0400
Subject: [PATCH] Lots of changes to make installation more flexible & user
friendly.
Generalized out a lot of the leftover phys201 content, replacing it
with dummy content. Now the test coursepage doesn't reveal any email
addresses, names of real people, etc.
Moved all the course information that used to be spread through the
text of index.shtml and in quarter.php over to a new course.xml file.
This provides a centralized location for updates, which are then
included in the page bodies and headers for free :).
Tagged locations of example patter and dummy information in the html
directory with "...", so you won't miss any dummy info if you adjust
things near the locations turned up by a
grep -r '[.][.][.]' html/
Reactivated contact.shtml and redirected the Contact links to point to
it, because most users will not have a contact page in the parent
directory as I do.
announcements.shtml now handles a missing atom.xml gracefully, which I
imagine will be a common occurrence for new users.
Assorted updates to README files, as well as the addition of
REAMDE.newbie, which I phrased to be more supportive to the HTML-wary
;).
Added html-includes.sh, which adapts the standard source to handle
some SSI-parsing problems that poke up occasionally. I don't know why
yet, but the adjusted source avoids them.
Added local-install.sh, which adapts the standard source to handle
INSTALL_DIR on the same host as the source.
See the comments at the top of both shell scripts for more details.
---
Makefile | 4 +-
README | 8 +--
README.newbie | 115 ++++++++++++++++++++++++++++++
html-includes.sh | 30 ++++++++
html/README | 5 +-
html/announcements.shtml | 7 +-
html/{inactive => }/contact.shtml | 0
html/inactive/labs.shtml | 4 +-
html/index.shtml | 18 +++--
html/php/atom.php | 5 ++
html/php/course.php | 32 +++++++++
html/php/quarter.php | 4 --
html/php/webmaster.php | 6 +-
html/shared/footer.shtml | 6 +-
html/shared/header.shtml | 26 +++++--
html/xml/TAs.xml | 75 +++----------------
html/xml/course.xml | 8 +++
html/xml/profs.xml | 14 ++--
html/xml/webmaster.xml | 4 +-
local-install.sh | 53 ++++++++++++++
20 files changed, 314 insertions(+), 110 deletions(-)
create mode 100644 README.newbie
create mode 100755 html-includes.sh
rename html/{inactive => }/contact.shtml (100%)
create mode 100644 html/php/course.php
delete mode 100644 html/php/quarter.php
create mode 100644 html/xml/course.xml
create mode 100755 local-install.sh
diff --git a/Makefile b/Makefile
index 69702dd..52f85a7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
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
diff --git a/README b/README
index ba9a1be..b7b945d 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
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
diff --git a/README.newbie b/README.newbie
new file mode 100644
index 0000000..cc51fa4
--- /dev/null
+++ b/README.newbie
@@ -0,0 +1,115 @@
+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 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.
diff --git a/html-includes.sh b/html-includes.sh
new file mode 100755
index 0000000..4815fb9
--- /dev/null
+++ b/html-includes.sh
@@ -0,0 +1,30 @@
+#!/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
+
diff --git a/html/README b/html/README
index b01d1a9..5bdeeba 100644
--- a/html/README
+++ b/html/README
@@ -23,8 +23,9 @@ 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.
+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 ****
diff --git a/html/announcements.shtml b/html/announcements.shtml
index 0175860..9ae7d02 100644
--- a/html/announcements.shtml
+++ b/html/announcements.shtml
@@ -1,8 +1,11 @@
diff --git a/html/inactive/contact.shtml b/html/contact.shtml
similarity index 100%
rename from html/inactive/contact.shtml
rename to html/contact.shtml
diff --git a/html/inactive/labs.shtml b/html/inactive/labs.shtml
index 3abfa6a..e38a670 100644
--- a/html/inactive/labs.shtml
+++ b/html/inactive/labs.shtml
@@ -3,8 +3,8 @@
Labs
-
All students should be present in Disque-820A - Phys201
- Laboratory - a few minutes before the start of their scheduled lab.
+
All students should be present in ROOM ... 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.
diff --git a/html/index.shtml b/html/index.shtml
index 5a31893..340c223 100644
--- a/html/index.shtml
+++ b/html/index.shtml
@@ -1,12 +1,18 @@
-
Physics 201 - Fundamentals of Physics III
-
+course_id();
+echo '
'.$cid.' - '.$course->title.'
'."\n";
+echo $course->term."\n";
+?>
-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...
Resources
@@ -14,7 +20,7 @@ but I'll email you and post an announcement if that changes.