Updated the new eXist-based version of the site with a whole bunch of changes and improvements. The site is feature-complete now. I've emailed CC to ask her to look at the site to make sure it all looks good to her. Once she's happy then it will move to http://francotoile.uvic.ca.
Updated the eXist version of the site to make the namespaces for the plugins (bookmarks, i18n, includes) more generic - i.e. without "francotoile" in the ULR - to make them more portable. So, a namespace that looked like this:
http://hcmc.uvic.ca/namespaces/francotoile/i18n
Now looks like this:
If you load an element on your page after page load (i.e. via AJAX), basic JQuery event listeners such as this:
$(".my-selector").click(function(event) {
...
});
won't work, because that event listener only listens to elements that appear upon completion of page load. To catch elements introduced later via AJAX, use the live
handler:
$(".my-selector").live('click', function(event) {
...
});
That will attach the 'click' event handler to all selected elements, even ones inserted into the DOM after page load. See the JQuery docs for more info: http://api.jquery.com/live/
If you want to pass Unicode characters to a URL in your eXist application, use fn:encode-for-uri
( http://demo.exist-db.org/exist/functions/fn/encode-for-uri ), which is roughly equivalent to PHP's rawurlencode()
(a stricter version of urlencode()
).
In the interests of only maintining one set of up-to-date XML files - at least for now - I've moved the data files on Pomme from LCC's (/Users/lauren) and CC's (/Users/ccaws) accounts to /Users/admin/Documents/francotoile_old so that they're safely tucked away.
The most current version of the data is on the website: http://francotoile.uvic.ca
I put the schema online at: http://francotoile.uvic.ca/includes/schema/francotoile.rng
Made a couple of minor changes to the TEI schema for the XML data files.
First, residence:
- Previously: an element containing "text of subjects's present or past place of residence"
Now: an element with up to three child elements:
- settlement: contains the name of a settlement such as a city, town, or village identified as a single geo-political or administrative unit.
- region: contains the name of an administrative unit such as a state, province, or county, larger than a settlement, but smaller than a country.
- country: contains the name of a geo-political unit, such as a nation, country, colony, or commonwealth, larger than or administratively superior to a region and smaller than a bloc.
nationality, which previously was an element with a string containing "text of subjects's nationality", will use the same structure as residence, for the same reasons.
I made these change for two reasons: to allow for greater organizational structure and separation of data, and to facilitate populating the "location" and "origin" select lists on the search page. The previous formats for residence and nationality, plain text string values (such as "Victoria, Canada"), were limited in their searchability and organization.
Wrote the bookmarking system for the eXist site, which is basically as described in my previous post. Here's a more technical breakdown of the features:
Adding a Bookmark
When a user adds a bookmark, an AJAX request with the video ID, the timestamp, and any optional comments is sent to plugins/bookmarks/ajax/add.xql. This XQuery script returns a JSON object with the ID (i.e. bookmark/@n) of the new bookmark, the timestamp, and the comments if applicable. The add.xql script actually returns XML that is passed through the eXist JSON serializer:
declare option exist:serialize "method=json media-type=text/javascript";
If the bookmark can't be added, which happens if the video ID is invalid, then a 500 error is returned.
Upon successful addition, the JSON response object is parsed by the calling Javascript, which adds a list element to the ordered list of bookmarks.
Deleting a Bookmark
Deleting a bookmark (clicking on the 'X' image next to the bookmark in the ordered list) simply removes the bookmark from the DOM. Bookmark data files are never actually deleted from the server.
Saving Bookmarks
Saving a bookmark list requires no AJAX interaction with the server. Rather, all of the bookmark IDs are gathered from the ordered list of bookmarks (each of which has an ID of bookmark-## where ## corresponds to bookmark/@n in the XML data) and then simply appended to the URL of the video page. This URL is given to the user, who can add it to their bookmark collection for later use. The ids are added as comma-separated values of a "bm" GET parameter. For example: player.xql?id=fraq1&bm=54,55,56
Loading Saved Bookmarks
When a user visits a video with a bm query string (see 'Saving Bookmarks' above), an AJAX call is sent to plugins/bookmarks/ajax/load.xql for each bookmark ID in the query string. Upon successful load of the bookmark - success means that the ID corresponds to bookmark/@n and the current video corresponds to bookmark/@videoId - a JSON-serialized XML node is returned (see 'Adding a Bookmark' above), which is then used to populate the unordered list of bookmarks.
Crib sheet with some useful reminders: http://en.wikibooks.org/wiki/XQuery/eXist_Crib_sheet
It's popped up a few times during my Google searches.