Skip to content

Commit

Permalink
Prepare for JSON folder, move albums to XML source folder
Browse files Browse the repository at this point in the history
  • Loading branch information
danactive committed Nov 29, 2014
1 parent 593f227 commit dd3ae1a
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 132 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var doT = require('doT'),
response.write("<h1>Photo Galleries</h1><ul>");

for (i = 0; i < len; i+=1) {
response.write('<li><a href="gallery-' + galleries[i] + '/gallery.xml">' + galleries[i] + '</li>');
response.write('<li><a href="gallery-' + galleries[i] + '/xml/gallery.xml">' + galleries[i] + '</li>');
}
response.write("</ul>");
response.end('<a href="/admin/">Admin</a>');
Expand Down
Binary file added favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/album.xslt"?>
<?xml-stylesheet type="text/xsl" href="../../xslt/album.xslt"?>
<!-- This XML associates photos and videos with meta data: geocode, caption, friends (characters)... -->
<album gallery="demo">
<album_meta>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This XML assocaiates characters (friends) with albums -->
<character_association>
<!-- c_a is character_association; a = album_name; p = photo_id; char_id = c -->
<c_a><a>sample</a><p>2</p><c>3</c></c_a>
<c_a><a>sample</a><p>3</p><c>1</c></c_a>
<c_a><a>sample</a><p>1</p><c>3</c></c_a>
<?xml version="1.0" encoding="utf-8"?>
<!-- This XML assocaiates characters (friends) with albums -->
<character_association>
<!-- c_a is character_association; a = album_name; p = photo_id; char_id = c -->
<c_a><a>sample</a><p>2</p><c>3</c></c_a>
<c_a><a>sample</a><p>3</p><c>1</c></c_a>
<c_a><a>sample</a><p>1</p><c>3</c></c_a>
</character_association>
42 changes: 21 additions & 21 deletions gallery-demo/characters.xml → gallery-demo/xml/characters.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../xslt/characters.xslt"?>
<!-- This XML lists all characters seen in the albums -->
<characters>
<a>
<char name="a_friend" id="1"> <!-- name is unique for use in filename (name + active); id is unique for character association -->
<first>A</first> <!-- given name -->
<last>Friend</last> <!-- surname -->
<known>grade1</known> <!-- Optional one word. Where did you meet your friend? -->
<active>2006Q2</active> <!-- Year Quarter is when your friends was active for use in filename (i.e. a_friend2006Q2.jpg) -->
</char>
</a>
<h>
<char name="hurray_more" id="3">
<first>Hurray</first>
<last>More</last>
<nick>Best Friend</nick>
<known>Canadian</known>
<active>2010Q2</active>
</char>
</h>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../../xslt/characters.xslt"?>
<!-- This XML lists all characters seen in the albums -->
<characters>
<a>
<char name="a_friend" id="1"> <!-- name is unique for use in filename (name + active); id is unique for character association -->
<first>A</first> <!-- given name -->
<last>Friend</last> <!-- surname -->
<known>grade1</known> <!-- Optional one word. Where did you meet your friend? -->
<active>2006Q2</active> <!-- Year Quarter is when your friends was active for use in filename (i.e. a_friend2006Q2.jpg) -->
</char>
</a>
<h>
<char name="hurray_more" id="3">
<first>Hurray</first>
<last>More</last>
<nick>Best Friend</nick>
<known>Canadian</known>
<active>2010Q2</active>
</char>
</h>
</characters>
26 changes: 13 additions & 13 deletions gallery-demo/gallery.xml → gallery-demo/xml/gallery.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/gallery.xslt"?>
<gallery>
<album>
<gallery_id>1</gallery_id>
<album_name>sample</album_name> <!-- unique album name -->
<album_version>1.8</album_version> <!-- note for XML schema reference -->
<sort>1</sort>
<album_h1>Sample</album_h1> <!-- heading 1: album name -->
<album_h2>British Columbia</album_h2> <!-- heading 2: State/Province -->
<year>2001-2005</year> <!-- Year outputted as text in gallery view -->
<filename>2004-01-04-01.jpg</filename> <!-- must start with a four letter year; file must be hosted in the media folder > year folder (i.e. media/2004/2004-01-04-01.jpg) -->
</album>
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../xslt/gallery.xslt"?>
<gallery>
<album>
<gallery_id>1</gallery_id>
<album_name>sample</album_name> <!-- unique album name -->
<album_version>1.8</album_version> <!-- note for XML schema reference -->
<sort>1</sort>
<album_h1>Sample</album_h1> <!-- heading 1: album name -->
<album_h2>British Columbia</album_h2> <!-- heading 2: State/Province -->
<year>2001-2005</year> <!-- Year outputted as text in gallery view -->
<filename>2004-01-04-01.jpg</filename> <!-- must start with a four letter year; file must be hosted in the media folder > year folder (i.e. media/2004/2004-01-04-01.jpg) -->
</album>
</gallery>
12 changes: 6 additions & 6 deletions index.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Open this page when not running Node.js -->
<p><b><a href="gallery-demo/gallery.xml">View Photo Galleries</a></b></p>
<ul>
<li><a href="admin">Photo admin</a></li>
<li><a href="https://github.com/danactive/history">GitHub: Download code</a></li>
<li><a href="http://danactive.github.io/history/">Demo site 0.15.0</a></li>
<!-- Open this page when not running Node.js -->
<p><b><a href="gallery-demo/xml/gallery.xml">View Photo Galleries</a></b></p>
<ul>
<li><a href="admin">Photo admin</a></li>
<li><a href="https://github.com/danactive/history">GitHub: Download code</a></li>
<li><a href="http://danactive.github.io/history/">Demo site 0.15.0</a></li>
</ul>
2 changes: 1 addition & 1 deletion js/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Xml(options) {
callback = requireArg({"args": options, "name": "callback", "type": "function"}),
gallery = requireArg({"args": options, "name": "gallery", "type": "string"});

jQuery.get('../gallery-' + gallery + '/album_' + album + '.xml')
jQuery.get('../gallery-' + gallery + '/xml/album_' + album + '.xml')
.error(ajaxError)
.success(function (response) {
var json = jQuery.parseJSON(util.xml.convertToJsonString(response,''));
Expand Down
7 changes: 4 additions & 3 deletions xslt/album.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" doctype-system="about:legacy-compat" />
<xsl:variable name="galleryDir" select="/album/@gallery" />
<xsl:variable name="charAssPath" select="concat('/gallery-', $galleryDir, '/character_ass.xml')" />
<xsl:variable name="charsPath" select="concat('/gallery-', $galleryDir, '/characters.xml')" />
<xsl:variable name="charAssPath" select="concat('/gallery-', $galleryDir, '/xml/character_ass.xml')" />
<xsl:variable name="charsPath" select="concat('/gallery-', $galleryDir, '/xml/characters.xml')" />
<xsl:variable name="char_ass" select="document($charAssPath)/character_association"/>
<xsl:variable name="chars" select="document($charsPath)/characters"/>
<xsl:variable name="photo__album_name">
Expand All @@ -15,7 +15,8 @@
<head>
<meta charset="utf-8" />
<title>History - Photo Album</title>
<link href="../lib/jquery-colorbox/example1/colorbox.css" rel="stylesheet" media="screen" />
<base href="../"/>
<link href="../lib/jquery-colorbox/example1/colorbox.css" rel="stylesheet" media="screen" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
Expand Down
158 changes: 79 additions & 79 deletions xslt/gallery.xslt
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>History - Photo Album Galleries</title>
<script type="text/javascript" src="../js/global.js"></script>
<style type="text/css">
.album { float: left; width: 185px; height: 170px; padding: 10px; }
.even { background-color: peachpuff; }
.odd { background-color: linen; }
h1 { font-size: 16px; font-family: "Trebuchet MS"; }
h1 a { color: black; text-decoration:none; border-bottom: 1px dotted #666; }
h2 { font-size: 12px; color: #8B7765; font-family: Verdana; }
h3 { font-size: 14px; font-family: "Trebuchet MS"; color: #8B5A2B; margin: 0px; }
</style>
</head>
<body>
<xsl:for-each select="gallery/album">
<xsl:sort select="sort" data-type="number" />
<div>
<xsl:attribute name="class">
<xsl:text>album </xsl:text>
<xsl:choose>
<xsl:when test="position() mod 2">
<xsl:text>odd</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>even</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<div class="album_img">
<a>
<xsl:attribute name="href">
<xsl:text>album_</xsl:text>
<xsl:value-of select="album_name"/>
<xsl:text>.xml</xsl:text>
</xsl:attribute>
<img>
<xsl:attribute name="src">
<xsl:text>media/thumbs/</xsl:text>
<xsl:value-of select="substring-before(filename,'-')"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="filename"/>
</xsl:attribute>
</img>
</a>
</div>
<h1>
<a>
<xsl:attribute name="href">
<xsl:text>album_</xsl:text>
<xsl:value-of select="album_name"/>
<xsl:text>.xml</xsl:text>
</xsl:attribute>
<xsl:value-of select="album_h1"/>
</a>
</h1>
<h2>
<xsl:value-of select="album_h2"/>
</h2>
<xsl:if test="year != 'none'">
<h3>
<xsl:value-of select="year" />

<xsl:if test="album_version &gt;= 1.5">
<xsl:text> (Map)</xsl:text>
</xsl:if>
</h3>
</xsl:if>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>History - Photo Album Galleries</title>
<script type="text/javascript" src="../../js/global.js"></script>
<style type="text/css">
.album { float: left; width: 185px; height: 170px; padding: 10px; }
.even { background-color: peachpuff; }
.odd { background-color: linen; }
h1 { font-size: 16px; font-family: "Trebuchet MS"; }
h1 a { color: black; text-decoration:none; border-bottom: 1px dotted #666; }
h2 { font-size: 12px; color: #8B7765; font-family: Verdana; }
h3 { font-size: 14px; font-family: "Trebuchet MS"; color: #8B5A2B; margin: 0px; }
</style>
</head>
<body>
<xsl:for-each select="gallery/album">
<xsl:sort select="sort" data-type="number" />
<div>
<xsl:attribute name="class">
<xsl:text>album </xsl:text>
<xsl:choose>
<xsl:when test="position() mod 2">
<xsl:text>odd</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>even</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<div class="album_img">
<a>
<xsl:attribute name="href">
<xsl:text>album_</xsl:text>
<xsl:value-of select="album_name"/>
<xsl:text>.xml</xsl:text>
</xsl:attribute>
<img>
<xsl:attribute name="src">
<xsl:text>../media/thumbs/</xsl:text>
<xsl:value-of select="substring-before(filename,'-')"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="filename"/>
</xsl:attribute>
</img>
</a>
</div>
<h1>
<a>
<xsl:attribute name="href">
<xsl:text>album_</xsl:text>
<xsl:value-of select="album_name"/>
<xsl:text>.xml</xsl:text>
</xsl:attribute>
<xsl:value-of select="album_h1"/>
</a>
</h1>
<h2>
<xsl:value-of select="album_h2"/>
</h2>
<xsl:if test="year != 'none'">
<h3>
<xsl:value-of select="year" />

<xsl:if test="album_version &gt;= 1.5">
<xsl:text> (Map)</xsl:text>
</xsl:if>
</h3>
</xsl:if>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

0 comments on commit dd3ae1a

Please sign in to comment.