Build a snapshot of a "course" from an outline of wiki pages. This: * separates not only content and presentation, but also the flow through the content * removes worry that pages will change once reviewed * can freely modify pages as they are fetched to facilitate fitting into an existing CSS framework
  • JavaScript 93.5%
  • Python 4.8%
  • CSS 1.6%
  • Shell 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-09-10 14:34:09 +12:00
css make cursor a pointer over SCAN tree 2014-10-29 00:29:28 +00:00
extras fixing missing / in Drupal embed code 2022-05-13 12:42:45 +12:00
js addressed in-page anchor URL issue, updated all references to http://wikieducator.org to https:// 2019-09-03 20:25:20 +12:00
test WP: add XMLRPC call to create OERu nav menu 2015-10-01 17:59:07 +09:00
themes updates for language management 2021-06-16 20:41:26 +12:00
.eslintrc.json Adopt Prettier. 2017-06-21 16:32:31 +09:00
.gitignore now ignoring package-lock.json 2021-04-12 21:42:07 +12:00
AMUN.example addressed in-page anchor URL issue, updated all references to http://wikieducator.org to https:// 2019-09-03 20:25:20 +12:00
ART.example addressed in-page anchor URL issue, updated all references to http://wikieducator.org to https:// 2019-09-03 20:25:20 +12:00
course-snapshot-cron adding example cron file for /etc/cron.d/ 2023-08-03 15:31:03 +12:00
course.js addressed in-page anchor URL issue, updated all references to http://wikieducator.org to https:// 2019-09-03 20:25:20 +12:00
courseWP.js removed some debugging, fixed vimeo maxwidth 'px' incursion. 2025-09-10 14:34:09 +12:00
LICENSE.txt Demo commit. 2014-05-18 06:45:12 +00:00
options.sample.json Fixes for newSplashWP theme 2015-08-04 02:08:35 +00:00
package.json wip - more or less working workflow for missing/invalid wpurl 2023-03-01 17:33:10 +13:00
README.md addressed in-page anchor URL issue, updated all references to http://wikieducator.org to https:// 2019-09-03 20:25:20 +12:00
test_fetch.js wip - more or less working workflow for missing/invalid wpurl 2023-03-01 17:33:10 +13:00
test_latinise.js adding some test scripts and modules for latinise functionality, enhanced slugify 2021-05-18 20:24:46 +12:00
test_wp_options.js working script to test xmlrpc access 2023-03-03 15:49:20 +13:00
test_wp_xmlrpc.js wip adding XML RPC client test 2023-03-09 13:20:10 +13:00
watch.py applying changes to port watch script to Python3 2023-08-03 10:38:10 +12:00

course

This is a simple demonstration of using jsdom and jQuery in Node.js to snapshot a collection (outline) of pages stored in WikiEducator. It modifies the pages as they are fetched, and writes a static tree of them to the filesystem or to a WordPress instance.

Installation

These sample scripts require Node.js 6.x.x or greater.

If you don't already have Node.js installed, using nvm is an easy way to proceed.

You can install nvm using cURL:

curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

or Wget:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Then use nvm to install a recent version of node.js:

nvm install v6.11.0

For future invocations now that Node.js is installed, you merely need to tell your shell which version to use with nvm use v6.11.0

  1. git clone https://bitbucket.org/wikieducator/course.git
  2. cd course
  3. npm install

Use

This script currently has two very different functions:

  • make a snapshot of static HTML files in the local filesystem
  • build a snapshot of the course in a WordPress installation using XMLRPC

Many of the options are actually required to produce meaningful output.

To make filesystem snapshots, you must set FILEPATH at the top of course.js before use. FILEPATH must be a top level directory that exists within your web server root (so that the course files can be served to users).

Filesystem snapshot

node course.js \
    {--prevnext} \
    --brand HEADERBRAND \
    --urlprefix first-part-of-url
    {--theme THEMENAME} \
    {--logo logopath} \
    {--link http://link-for-logo} \
    https://wikieducator.org/OutlinePage \
    /localfilesystem/path

WordPress snapshot

node courseWP.js \
    {--prevnext} \
    --brand HEADERBRAND \
    --wpurl http://wordpressURL \
    --wpuser USERNAME --wppass PASSWORD \
    {--wpmenu} \
    {--wpdelete} \
    {--theme THEMENAME} \
    {--logo logopath} \
    {--link http://link-for-logo} \
    {--siteid SITEID} \
    {--wiki base_url} \
    {--debugout} \
    https://wikieducator.org/path-to-outline-page \
    "/Course name"

N.B.

These scripts are simple examples of ways you might make snapshots of course-sized open educational resources stored in WikiEducator. I expect that different institutions (and even different courses within an institution) will have different needs, organizations, and styling.

Update 2019-07-23: added iFrame embedding capability using the new WEiFrame template on WikiEducator.

The main concern with this is that if the site you're wanting to include in the iframe has "X-Frame-Options" (in the sites website configuration, e.g. Apache or NGINX) is set to "sameorigin". That will block the iframe display.