Re-worked templating to use a master template.
10
Makefile
@ -38,12 +38,10 @@ else
|
||||
fi
|
||||
@install -m 0755 gallery.cgi $(DESTDIR)
|
||||
@if [ ! -d $(DESTDIR)/templates ] || [ "$(FORCE)" = "1" ]; then \
|
||||
install -m 0755 -d $(DESTDIR)/templates; \
|
||||
for t in templates/*.cs; do \
|
||||
install -m 0644 "templates/$$t" \
|
||||
"$(DESTDIR)/templates/$$t" \
|
||||
install -m 0755 -d $(DESTDIR)/templates/images; \
|
||||
find templates -type f -exec \
|
||||
install -m 0644 "{}" "$(DESTDIR)/{}" \; \
|
||||
|| exit 1; \
|
||||
done; \
|
||||
else \
|
||||
echo "Template directory already exists."; \
|
||||
echo "I'll skip installing templates to prevent"; \
|
||||
@ -52,7 +50,7 @@ else
|
||||
echo "WWWGID=$(WWWGID) FORCE=1"; \
|
||||
echo "to force installation."; \
|
||||
fi; \
|
||||
@if [ "$(FORCE)" = "1" ]; then \
|
||||
if [ "$(FORCE)" = "1" ]; then \
|
||||
echo "Template installation forced. If your site breaks, you"; \
|
||||
echo "get to keep the pieces. ;-)"; \
|
||||
fi
|
||||
|
@ -334,7 +334,9 @@ void write_template( const char* template_name ) {
|
||||
puts( json_object_to_json_string( cgi_json ) );
|
||||
} else {
|
||||
char* template = construct_path( "s/s", cstemp_dir, template_name );
|
||||
NEOERR* err = cgi_display( cgi, template );
|
||||
char* master = construct_path( "s/s", cstemp_dir, "master.cs" );
|
||||
hdf_set_value( cgi->hdf, "template", template );
|
||||
NEOERR* err = cgi_display( cgi, master );
|
||||
if ( err != STATUS_OK ) {
|
||||
cgi_neo_error(cgi, err);
|
||||
nerr_log_error(err);
|
||||
|
@ -1,20 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>gallery: <?cs var:gallery.title ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><?cs var:gallery.title ?></h1>
|
||||
<p><?cs var:gallery.desc ?></p>
|
||||
<?cs def:html_head() ?>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin-top: 240px;
|
||||
}
|
||||
</style>
|
||||
<title>Gallery: <?cs var:gallery.title ?></title>
|
||||
<?cs /def ?>
|
||||
<?cs def:html_body() ?>
|
||||
<table width="100%" class="controls">
|
||||
<tr>
|
||||
<td class="status"><a class="button" accesskey="i" href="<?cs var:CGI.ScriptName ?>" target="_top"><img alt="Index" src="/images/top.png" border="0" align="absmiddle" /></a></td>
|
||||
|
||||
<p>
|
||||
<?cs if:photos > 0 ?>
|
||||
<?cs each:p = photo ?>
|
||||
<a href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:p.name ?>">
|
||||
<img src="<?cs var:uri ?>/<?cs var:p.thumbnail ?>"
|
||||
alt="<?cs var:p.annotation ?>" />
|
||||
</a>
|
||||
<?cs /each ?>
|
||||
<?cs /if ?>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="status" colspan="7">
|
||||
<h1 align="center"><?cs var:gallery.title ?></h1>
|
||||
<p align="center"><?cs var:gallery.desc ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p align="center">
|
||||
<?cs if:photos > 0 ?>
|
||||
<?cs each:p = photo ?>
|
||||
<a href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:p.name ?>">
|
||||
<img src="<?cs var:uri ?>/<?cs var:p.thumbnail ?>"
|
||||
alt="<?cs var:html_strip(p.annotation) ?>" />
|
||||
</a>
|
||||
<?cs /each ?>
|
||||
<?cs /if ?>
|
||||
</p>
|
||||
<?cs /def ?>
|
||||
|
BIN
templates/images/back.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
templates/images/configure.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
templates/images/finish.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
templates/images/forward.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
templates/images/start.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
templates/images/top.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
templates/images/up.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
@ -1,18 +1,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>gallery index</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>index</h1>
|
||||
<ul>
|
||||
<?cs if:galleries > 0 ?>
|
||||
<?cs each:g = gallery ?>
|
||||
<li>
|
||||
<h2><a href="<?cs var:CGI.ScriptName ?>/<?cs var:g.name ?>"><?cs var:g.title ?></a></h2>
|
||||
<p><?cs var:g.desc ?></p>
|
||||
</li>
|
||||
<?cs /each ?>
|
||||
<?cs /if ?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
<?cs def:html_head() ?>
|
||||
<title><?cs var:CGI.ServerName ?> Galleries</title>
|
||||
<?cs /def ?>
|
||||
<?cs def:html_body() ?>
|
||||
<h1 align="center"><?cs var:CGI.ServerName ?> Galleries</h1>
|
||||
|
||||
<?cs if:galleries > 0 ?>
|
||||
<?cs each:g = gallery ?>
|
||||
<div style="border: 1px solid #ccc; display: block;">
|
||||
<h2><a style="display: block; text-align: center; padding: 0.5em;"
|
||||
href="<?cs var:CGI.ScriptName ?>/<?cs var:g.name ?>"><?cs var:g.title ?></a></h2>
|
||||
<p style="padding-left: 1em; padding-right: 1em; text-align: center;"><?cs var:g.desc ?></p>
|
||||
</div>
|
||||
<div style="height: 1em;"></div>
|
||||
<?cs /each ?>
|
||||
<?cs /if ?>
|
||||
<?cs /def ?>
|
||||
|
12
templates/master.cs
Normal file
@ -0,0 +1,12 @@
|
||||
<?cs include:template ?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<?cs call:html_head() ?>
|
||||
</head>
|
||||
<body>
|
||||
<?cs call:html_body() ?>
|
||||
</body>
|
||||
</html>
|
@ -1,21 +1,38 @@
|
||||
<html>
|
||||
<head>
|
||||
<title><?cs var:gallery.title ?>: <?cs var:photo.name ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<p align="center">
|
||||
<img
|
||||
lowsrc="<?cs var:uri ?>/<?cs var:photo.thumbnail ?>"
|
||||
src="<?cs var:uri ?>/<?cs var:photo.resized ?>"
|
||||
width="<?cs var:photo.width ?>"
|
||||
height="<?cs var:photo.height ?>"
|
||||
alt="<?cs var:photo.annotation ?>" /><br />
|
||||
<?cs var:photo.name ?>:
|
||||
<?cs var:photo.annotation ?><br />
|
||||
<?cs def:html_head() ?>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin-top: 120px;
|
||||
}
|
||||
</style>
|
||||
<title>Image: <?cs var:html_strip(photo.annotation) ?> (<?cs var:photo.name ?>)</title>
|
||||
<?cs /def ?>
|
||||
<?cs def:html_body() ?>
|
||||
<table width="100%" class="controls">
|
||||
<tr>
|
||||
<td class="prevlink"><a class="button" accesskey="," href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:photo.previous ?>"><img alt="<- Prev" src="/images/back.png" border="0" align="absmiddle" /></a></td>
|
||||
<td class="status"><a class="button" accesskey="l" href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>" target="_top"><img alt="Album" src="/images/up.png" border="0" align="absmiddle" /></a></td>
|
||||
<td class="status"><a class="button" accesskey="i" href="<?cs var:CGI.ScriptName ?>" target="_top"><img alt="Index" src="/images/top.png" border="0" align="absmiddle" /></a></td>
|
||||
<td class="nextlink"><a class="button" accesskey="." href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:photo.next ?>"><img alt="-> Next" src="/images/forward.png" border="0" align="absmiddle" /></a></td>
|
||||
|
||||
<a href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:photo.previous ?>">prev</a> |
|
||||
<a href="<?cs var:uri ?>/<?cs var:gallery.name ?>/<?cs var:photo.name ?>">original size</a> |
|
||||
<a href="<?cs var:CGI.ScriptName ?>/<?cs var:gallery.name ?>/<?cs var:photo.next ?>">next</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="status" colspan="7">
|
||||
<?cs var:photo.annotation ?> (<?cs var:photo.name ?>)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="center"><img width="<?cs var:photo.width ?>" height="<?cs var:photo.height ?>"
|
||||
src="<?cs var:uri ?>/<?cs var:photo.resized ?>"
|
||||
alt="<?cs var:html_strip(photo.annotation) ?>"
|
||||
lowsrc="<?cs var:uri ?>/<?cs var:photo.thumbnail ?>" /></p>
|
||||
<form>
|
||||
<p align="center">
|
||||
Resize: <input type="text" name="width" value="<?cs var:photo.width ?>" size="3" /> x
|
||||
<input type="text" name="height" value="<?cs var:photo.height ?>" size="3" />
|
||||
Rotation:
|
||||
<input type="text" name="rotation" value="0.000" size="3" />
|
||||
Quality: <input type="text" name="quality" value="60" size="3" /> (100% = PNG)
|
||||
<input type="submit" value="Go" />
|
||||
</p>
|
||||
</form>
|
||||
<?cs /def ?>
|
||||
|
79
templates/style.css
Normal file
@ -0,0 +1,79 @@
|
||||
@media screen {
|
||||
body {
|
||||
margin-top: 20px;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #333;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.controls {
|
||||
position: fixed;
|
||||
background-color: #333;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: block;
|
||||
text-align: center;
|
||||
background-color: #333;
|
||||
border: 1px solid white;
|
||||
color: white;
|
||||
padding: 0.5em;
|
||||
text-decoration: none;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #666;
|
||||
color: #fc9;
|
||||
}
|
||||
|
||||
td.firstlink, td.prevlink, td.nextlink, td.lastlink {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #c96;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #ffc;
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
||||
.controls {
|
||||
visibility: hidden;
|
||||
position: fixed;
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
border: 2px solid #ccc;
|
||||
}
|
||||
|
||||
.thumbnail:hover {
|
||||
border: 2px solid #fec;
|
||||
}
|
||||
|
||||
.status {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
li {
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|