aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU-AD\carlsoan <carlsoan@gophersjos7275.ad.uc.edu>2017-03-08 14:32:25 -0500
committerU-AD\carlsoan <carlsoan@gophersjos7275.ad.uc.edu>2017-03-08 14:32:25 -0500
commitf47a09364ee5648f4eefb20b330aed904ef92d58 (patch)
tree57995b3d834b1ec0feae8b76841156beb9cc277c
parentf7c0c2e2d209d8458dceed41e2d8e27cb8b3550a (diff)
added makefile and m4 templates
-rw-r--r--Makefile49
-rw-r--r--assets/jquery-3.1.1.min.js (renamed from assets/js/jquery-3.1.1.min.js)0
-rw-r--r--assets/leftnav.xsl247
-rw-r--r--assets/topnav.xsl304
-rwxr-xr-xbin/siting.sh66
-rwxr-xr-xcgi-bin/sitemap.sh30
-rw-r--r--site.m45
-rwxr-xr-xsitemap.m44
8 files changed, 664 insertions, 41 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1a94bdf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+contentdb=db/content.db
+
+all: build/sitemap.xml build/site.xml
+ mkdir -p build/assets/js
+ cp assets/*js build/assets/js
+ cp assets/$$($(shell ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="template";') build
+
+clean:
+ rm -rf tmp
+ rm -rf build
+
+build/sitemap.xml: tmp/mapbody.m4 build
+ cat tmp/mapbody.m4 sitemap.m4 | m4 | sed 's/^[ \t]*//g' | grep -v '^[ \t]*$$' > build/sitemap.xml
+
+tmp/mapbody.m4: build/site.xml tmp/mapset.cnf
+ echo "define(\`URLENTRIES',\`" > tmp/mapbody.m4
+ $(shell ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT label FROM pages;' | awk '{ printf "<url>\n<loc>'"$$(grep '^URL' tmp/mapset.cnf | sed 's/^URL //g')"'/#%s</loc>\n<lastmod>'"$$(grep '^MOD' tmp/mapset.cnf | sed 's/^MOD //g')"'</lastmod>\n<changefreq>weekly</changefreq>\n<priority>0.6</priority>\n</url>\n",$$1 }' >> tmp/mapbody.m4
+ echo "')" >> tmp/mapbody.m4
+
+tmp/mapset.cnf:
+ echo "MOD $$(date -u -d "$$(stat ../site.xml | grep '^Modify' | sed 's/^Modify: //g;s/\.[0-9]*//g')" +"%Y-%m-%dT%H:%M:%S+00:00")" > tmp/mapset.cnf
+ echo "URL $$(read -p 'Enter site URL (omit trailing slash): ' siteurl ; echo $$siteurl)" >> tmp/mapset.cnf
+
+
+build/site.xml: tmp/pages.m4 tmp/top.m4 tmp/bottom.m4 build
+ cat tmp/pages.m4 tmp/top.m4 tmp/bottom.m4 site.m4 | m4 > build/site.xml
+
+tmp/pages.m4: $(contentdb) tmp
+ echo "define(\`PAGEOBJECTS',\`" > tmp/pages.m4
+ $(shell ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="homepage";' | awk 'BEGIN { FS="|" } { printf "<homepage>\n<section>\n%s</section>\n</homepage>\n",$$1 }' >> tmp/page.m4
+ $(shell ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT title,label,content FROM pages;' | awk 'BEGIN { FS="|" } { printf "<page>\n<title>%s</title>\n<label>%s</label>\n<section>\n%s\n</section>\n</page>\n",$$1,$$2,$$3 }' >> tmp/pages.m4
+ $(shell ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT title,label,content FROM subpages;' | awk 'BEGIN { FS="|" } { printf "<page>\n<title>%s</title>\n<label>%s</label>\n<section>\n%s\n</section>\n</page>\n",$$1,$$2,$$3 }' >> tmp/pages.m4
+ echo "')" >> tmp/pages.m4
+
+tmp/top.m4: $(contentdb) tmp
+ echo "define(\`STYLESHEET',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="template";')')" > tmp/top.m4
+ echo "define(\`SITETITLE',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="title";')')" >> tmp/top.m4
+ echo "define(\`HEADERTEXT',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="header";')')" >> tmp/top.m4
+ echo "define(\`THEME',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="theme";')')" >> tmp/top.m4
+
+tmp/bottom.m4: $(contentdb) tmp
+ echo "define(\`FOOTERHTML',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="footer";')')" > tmp/bottom.m4
+ echo "define(\`BELOWPAGEHTML',\`$$($$(ls /usr/bin/sqlite* | head -n1) $(contentdb) 'SELECT value FROM elements WHERE name="belowpage";')')" >> tmp/bottom.m4
+
+tmp:
+ mkdir tmp
+
+build:
+ mkdir build
diff --git a/assets/js/jquery-3.1.1.min.js b/assets/jquery-3.1.1.min.js
index 4c5be4c..4c5be4c 100644
--- a/assets/js/jquery-3.1.1.min.js
+++ b/assets/jquery-3.1.1.min.js
diff --git a/assets/leftnav.xsl b/assets/leftnav.xsl
new file mode 100644
index 0000000..8a6d27b
--- /dev/null
+++ b/assets/leftnav.xsl
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output />
+<xsl:template match="/">
+<html>
+<head>
+ <title><xsl:value-of select="site/title" /></title>
+ <script type="text/javascript" src="assets/js/jquery-3.1.1.min.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $('article.page').hide();
+
+ $('.navitem').click(function() {
+ $('article.homepage').hide();
+ $('article.page').hide();
+ $("article#" + $(this).attr('id')).fadeIn();
+ $(document).prop('title',$(this).text());
+ $('html').animate({scrollTop:0},'fast');
+ });
+
+ $('.homenav').click(function() {
+ $('article.page').hide();
+ $('article.homepage').fadeIn();
+ $(document).prop('title',$('h1#pageheader').text());
+ $('html').animate({scrollTop:0},'fast');
+ });
+
+ if (location.hash == "") {
+ $('a#homepage').click();
+ }
+ else {
+ $('a' + (location.hash)).click();
+ }
+ });
+ </script>
+ <style>
+ div.container {
+ border-radius: 25px;
+ width: 90%;
+ border: 1px solid gray;
+ margin: auto;
+ }
+
+ div header {
+ border-top-left-radius: 25px;
+ border-top-right-radius: 25px;
+ }
+
+ div footer {
+ border-bottom-left-radius: 25px;
+ border-bottom-right-radius: 25px;
+ }
+
+ div header, div footer {
+ padding: 1em;
+ color: white;
+ background-color: <xsl:for-each select="site">
+ <xsl:choose>
+ <xsl:when test="theme='blue'">#0000dd</xsl:when>
+ <xsl:when test="theme='green'">#00cc00</xsl:when>
+ <xsl:when test="theme='red'">#dd0000</xsl:when>
+ <xsl:when test="theme='purple'">#800080</xsl:when>
+ <xsl:when test="theme='gray'">#666666</xsl:when>
+ <xsl:otherwise><xsl:value-of select="theme" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>;
+ clear: left;
+ text-align: center;
+ }
+
+ footer a {
+ color: white;
+ text-decoration: none;
+ }
+
+ footer span {
+ display: inline-block;
+ width: 20px;
+ }
+
+ footer p {
+ font-size: 10pt;
+ }
+
+ belowpage {
+ padding-top: 30px;
+ display: flex;
+ margin:auto;
+ width: 300px;
+ }
+
+ belowpage div {
+ text-align: center;
+ width: 100px;
+ }
+
+ belowpage div a {
+ text-decoration: none;
+ color: #000000;
+ }
+
+ belowpage div.left {
+ float: left;
+ }
+
+ belowpage div.right {
+ float: right;
+ }
+
+ nav {
+ float: left;
+ max-width: 20%;
+ margin: 0;
+ padding: 1em;
+ }
+
+ nav ul {
+ list-style-type: none;
+ padding: 0;
+ }
+
+ nav ul li {
+ margin:3px;
+ }
+
+ nav ul li:hover {
+ background-color: <xsl:for-each select="site">
+ <xsl:choose>
+ <xsl:when test="theme='blue'">#8888dd</xsl:when>
+ <xsl:when test="theme='green'">#88cc88</xsl:when>
+ <xsl:when test="theme='red'">#dd8888</xsl:when>
+ <xsl:when test="theme='purple'">#9370DB</xsl:when>
+ <xsl:when test="theme='gray'">#999999</xsl:when>
+ <xsl:otherwise><xsl:value-of select="theme" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>;
+ }
+
+ nav ul a {
+ color: #000000;
+ text-decoration: none;
+ }
+
+ nav ul a:hover {
+ color: #ffffff;
+ }
+
+ content {
+ float: left;
+ left: 190px;
+ border-left: 0px solid gray;
+ padding: 1em;
+ overflow: hidden;
+ width:80%;
+ }
+
+ article {
+ display: none;
+ }
+
+ iframe {
+ border-width: 0px;
+ }
+
+ section div.image-right {
+ float: right;
+ }
+
+ section div.image-left {
+ float: left;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <header>
+ <h1 id="pageheader"><xsl:value-of select="site/title" /></h1>
+ </header>
+ <nav>
+ <ul>
+ <li><a href="#homepage" id="homepage" class="homenav">Home</a></li>
+ <xsl:for-each select="site/page">
+ <li><a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#',label)"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="label"/>
+ </xsl:attribute>
+ <xsl:attribute name="class">navitem</xsl:attribute>
+ <xsl:value-of select="title" />
+ </a></li>
+ </xsl:for-each>
+ </ul>
+ <xsl:for-each select="site/subpage">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#',label)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style">display:none;</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="label"/>
+ </xsl:attribute>
+ <xsl:attribute name="class">navitem</xsl:attribute>
+ <xsl:value-of select="title" />
+ </a>
+ </xsl:for-each>
+ </nav>
+ <content>
+ <xsl:for-each select="site/homepage">
+ <article>
+ <xsl:attribute name="class">homepage</xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ <xsl:for-each select="site/page">
+ <article>
+ <xsl:attribute name="class">page</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="label" /></xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ <xsl:for-each select="site/subpage">
+ <article>
+ <xsl:attribute name="class">page</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="label" /></xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ </content>
+ <xsl:copy-of select="site/footer" />
+ </div>
+ <xsl:copy-of select="site/belowpage" />
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-50366970-3', 'auto');
+ ga('send', 'pageview');
+
+ </script>
+ </body>
+</html>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/assets/topnav.xsl b/assets/topnav.xsl
new file mode 100644
index 0000000..7faa73c
--- /dev/null
+++ b/assets/topnav.xsl
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- SET BASE URL HERE -->
+<xsl:variable name="baseurl" select="'http://www.andydoestech.com'" />
+<!-- EDIT NOTHING BELOW HERE -->
+<xsl:param name="qs-sitemap" />
+<xsl:output />
+<xsl:template match="/">
+<html>
+<head>
+ <title><xsl:value-of select="site/title" /></title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <script type="text/javascript" src="assets/js/jquery-3.1.1.min.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $('article.page').hide();
+
+ $('.navitem').click(function() {
+ $('article.homepage').hide();
+ $('article.page').hide();
+ $("article#" + $(this).attr('id')).fadeIn();
+ $(document).prop('title',$(this).text());
+ $('html').animate({scrollTop:0},'fast');
+ });
+
+ $('.homenav').click(function() {
+ $('article.page').hide();
+ $('article.homepage').fadeIn();
+ $(document).prop('title',$('div.hptitle').text());
+ $('html').animate({scrollTop:0},'fast');
+ });
+
+ if (location.hash == "") {
+ $('a#homepage').click();
+ }
+ else {
+ $('a' + (location.hash)).click();
+ }
+ });
+ </script>
+ <style>
+ div.container {
+ border-radius: 25px;
+ width: 90%;
+ border: 1px solid gray;
+ margin: auto;
+ }
+
+ div header {
+ border-top-left-radius: 25px;
+ border-top-right-radius: 25px;
+ }
+
+ div footer {
+ border-bottom-left-radius: 25px;
+ border-bottom-right-radius: 25px;
+ }
+
+ div header, div footer {
+ padding: 1em;
+ color: white;
+ background-color: <xsl:for-each select="site">
+ <xsl:choose>
+ <xsl:when test="theme='blue'">#0000dd</xsl:when>
+ <xsl:when test="theme='green'">#00cc00</xsl:when>
+ <xsl:when test="theme='red'">#dd0000</xsl:when>
+ <xsl:when test="theme='purple'">#800080</xsl:when>
+ <xsl:when test="theme='gray'">#666666</xsl:when>
+ <xsl:otherwise><xsl:value-of select="theme" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>;
+ clear: left;
+ text-align: center;
+ }
+
+ div.hptitle {
+ display: none;
+ }
+
+ footer a {
+ color: white;
+ text-decoration: none;
+ }
+
+ footer span {
+ display: inline-block;
+ width: 20px;
+ }
+
+ footer p {
+ font-size: 10pt;
+ }
+
+ belowpage {
+ padding-top: 30px;
+ display: flex;
+ margin:auto;
+ width: 300px;
+ }
+
+ belowpage div {
+ text-align: center;
+ width: 100px;
+ }
+
+ belowpage div a {
+ text-decoration: none;
+ color: #000000;
+ }
+
+ belowpage div.left {
+ float: left;
+ }
+
+ belowpage div.right {
+ float: right;
+ }
+
+ nav {
+ text-align:center;
+ }
+
+ nav ul {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ overflow: hidden;
+ background-color: <xsl:for-each select="site">
+ <xsl:choose>
+ <xsl:when test="theme='blue'">#0000dd</xsl:when>
+ <xsl:when test="theme='green'">#00cc00</xsl:when>
+ <xsl:when test="theme='red'">#dd0000</xsl:when>
+ <xsl:when test="theme='purple'">#800080</xsl:when>
+ <xsl:when test="theme='gray'">#666666</xsl:when>
+ <xsl:otherwise><xsl:value-of select="theme" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>;
+ }
+
+ nav ul li {
+ float:left;
+ }
+
+ nav ul li a {
+ display: block;
+ color: white;
+ text-align: center;
+ padding: 14px 16px;
+ text-decoration: none;
+ }
+
+ nav ul li a:hover {
+ background-color: <xsl:for-each select="site">
+ <xsl:choose>
+ <xsl:when test="theme='blue'">#8888dd</xsl:when>
+ <xsl:when test="theme='green'">#88cc88</xsl:when>
+ <xsl:when test="theme='red'">#dd8888</xsl:when>
+ <xsl:when test="theme='purple'">#9370DB</xsl:when>
+ <xsl:when test="theme='gray'">#999999</xsl:when>
+ <xsl:otherwise><xsl:value-of select="theme" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>;
+ }
+
+ nav ul a {
+ color: #000000;
+ text-decoration: none;
+ }
+
+ nav ul a:hover {
+ color: #ffffff;
+ }
+
+ content {
+ float: left;
+ left: 190px;
+ border-left: 0px solid gray;
+ padding: 1em;
+ overflow: hidden;
+ width:95%;
+ }
+
+ article {
+ display: none;
+ }
+
+ iframe {
+ border-width: 0px;
+ }
+
+ section div.image-right {
+ float: right;
+ }
+
+ section div.image-left {
+ float: left;
+ }
+
+ form div {
+ top:20px;
+ }
+
+ form div span.fieldlabel {
+ left:0px;
+ top:0px;
+ }
+
+ form div input {
+ display:block;
+ position:relative;
+ left:0px;
+ top:0px;
+ }
+
+ form div textarea {
+ display:block;
+ position:relative;
+ left:0px;
+ top:0px;
+ }
+
+ form div select {
+ display:block;
+ position:relative;
+ left:0px;
+ top:0px;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="container">
+ <header>
+ <h1 id="pageheader"><xsl:value-of select="site/header" /></h1>
+ </header>
+ <nav>
+ <ul>
+ <li><a href="#homepage" id="homepage" class="homenav">Home</a></li>
+ <xsl:for-each select="site/page">
+ <li><a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#',label)"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="label"/>
+ </xsl:attribute>
+ <xsl:attribute name="class">navitem</xsl:attribute>
+ <xsl:value-of select="title" />
+ </a></li>
+ </xsl:for-each>
+ </ul>
+ <xsl:for-each select="site/subpage">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#',label)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style">display:none;</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="label"/>
+ </xsl:attribute>
+ <xsl:attribute name="class">navitem</xsl:attribute>
+ <xsl:value-of select="title" />
+ </a>
+ </xsl:for-each>
+ </nav>
+ <content>
+ <xsl:for-each select="site/homepage">
+ <article>
+ <xsl:attribute name="class">homepage</xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ <xsl:for-each select="site/page">
+ <article>
+ <xsl:attribute name="class">page</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="label" /></xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ <xsl:for-each select="site/subpage">
+ <article>
+ <xsl:attribute name="class">page</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="label" /></xsl:attribute>
+ <xsl:copy-of select="section" />
+ </article>
+ </xsl:for-each>
+ </content>
+ <xsl:copy-of select="site/footer" />
+ </div>
+ <div class="hptitle"><xsl:value-of select="site/title" /></div>
+ <xsl:copy-of select="site/belowpage" />
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-50366970-3', 'auto');
+ ga('send', 'pageview');
+
+ </script>
+ </body>
+</html>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/bin/siting.sh b/bin/siting.sh
index bce4c57..db7c6b5 100755
--- a/bin/siting.sh
+++ b/bin/siting.sh
@@ -19,7 +19,7 @@ newpage() {
if [ -z "$(cat <<<$PAGEDATA | grep -v '^[ \t]*$')" ]; then
break
elif [ $(cat <<<$PAGEDATA | grep -v '^[ \t]*$' | wc -l) -eq 2 ]; then
- $(sqlite_binary) $CONTENTDB 'INSERT INTO pages(title,label,content,ishome) VALUES("'"$TITLE"'","'"$LABEL"'","'"$CONTENT"'","no");'
+ $(sqlite_binary) $CONTENTDB 'INSERT INTO pages(title,label,content) VALUES("'"$TITLE"'","'"$LABEL"'","'"$CONTENT"'");'
break
else
dialog --msgbox "Please fill in all fields" 5 30
@@ -91,9 +91,19 @@ editsubpage() {
done
}
+selecttemplate() {
+ exec 3>&1
+ TEMPLATEID=$($(sqlite_binary) $CONTENTDB 'SELECT id,file FROM templates;' | sed 's/|/ /g' | tr '\n' ' ' | dialog --menu "Select Element" 15 40 10 $(cat -) 2>&1 1>&3)
+ exec 3>&-
+
+ if [ -n "$TEMPLATEID" ]; then
+ $(sqlite_binary) $CONTENTDB 'UPDATE elements SET value=(SELECT file FROM templates WHERE id='"$TEMPLATEID"') WHERE name="template";'
+ fi
+}
+
editelement() {
exec 3>&1
- ELEMID=$($(sqlite_binary) $CONTENTDB 'SELECT id,name FROM elements' | sed 's/|/ /g' | tr '\n' ' ' | dialog --menu "Select Element" 15 40 10 $(cat -) 2>&1 1>&3)
+ ELEMID=$($(sqlite_binary) $CONTENTDB 'SELECT id,name FROM elements WHERE name <> "template";' | sed 's/|/ /g' | tr '\n' ' ' | dialog --menu "Select Element" 15 40 10 $(cat -) 2>&1 1>&3)
exec 3>&-
if [ -n "$ELEMID" ]; then
@@ -108,23 +118,61 @@ editelement() {
fi
}
+gettemplates() {
+ $(sqlite_binary) $CONTENTDB 'DELETE FROM templates WHERE 1;'
+
+ ls $BASEDIR/../assets/*xsl | while read line; do
+ TEMPFILE=$(basename $line)
+ $(sqlite_binary) $CONTENTDB 'INSERT INTO templates(file) VALUES ("'"$TEMPFILE"'");'
+ done
+}
+
+siteinit() {
+ TITLE=$($(sqlite_binary) $CONTENTDB 'SELECT value FROM elements WHERE name="title";')
+ URL=$($(sqlite_binary) $CONTENTDB 'SELECT value FROM elements WHERE name="siteurl";')
+ if [ -z "$TITLE" ] || [ -z "$URL" ]; then
+ while true; do
+ exec 3>&1
+ PAGEDATA=$(dialog --ok-label "Create Site" --backtitle "Site Initialization" --form "Site Info" 15 50 0 "Title:" 1 1 "" 1 10 15 0 "URL:" 2 1 "" 2 10 1000 0 2>&1 1>&3)
+ exec 3>&-
+
+ TITLE=$(echo "$PAGEDATA" | head -n1)
+ URL=$(echo "$PAGEDATA" | head -n3 | tail -n1)
+ if [ -z "$(cat <<<$PAGEDATA | grep -v '^[ \t]*$')" ]; then
+ break
+ elif [ $(cat <<<$PAGEDATA | grep -v '^[ \t]*$' | wc -l) -eq 2 ]; then
+ $(sqlite_binary) $CONTENTDB 'UPDATE elements SET value="'"$URL"'" WHERE name="siteurl";'
+ $(sqlite_binary) $CONTENTDB 'UPDATE elements SET value="'"$TITLE"'" WHERE name="title";'
+ break
+ else
+ dialog --msgbox "Please fill in all fields" 5 30
+ fi
+ done
+ fi
+}
+
dbinit() {
+ [[ ! -d $(dirname $CONTENTDB) ]] && mkdir $(dirname $CONTENTDB)
if [ ! -f $CONTENTDB ]; then
cat << HERE | $(sqlite_binary) $CONTENTDB
-CREATE TABLE pages(id integer primary key autoincrement,title text, label text, content text, ishome text);
-CREATE TABLE subpage(id integer primary key autoincrement,title text, label text, content text);
+CREATE TABLE pages(id integer primary key autoincrement,title text, label text, content text);
+CREATE TABLE subpages(id integer primary key autoincrement,title text, label text, content text);
CREATE TABLE elements(id integer primary key autoincrement,name text, value text);
-INSERT INTO elements(name,value) VALUES("title",""),("header",""),("footer",""),("belowpage",""),("theme","");
+CREATE TABLE templates(id integer primary key autoincrement, file text);
+INSERT INTO elements(name,value) VALUES("homepage",""),("title",""),("header",""),("footer",""),("belowpage",""),("theme",""),("template",""),("siteurl","");
HERE
+ gettemplates
fi
}
# BEGIN PROGRAM
dbinit
+siteinit
+
while true; do
exec 3>&1
- operation=$(dialog --menu "Main Menu" 15 40 6 "1" "Create New Page" "2" "Edit Page" "3" "Create Subpage" "4" "Edit Subpage" "5" "Edit Site Element" "6" "Exit" 2>&1 1>&3)
+ operation=$(dialog --menu "Main Menu" 15 40 8 "1" "Create New Page" "2" "Edit Page" "3" "Create Subpage" "4" "Edit Subpage" "5" "Edit Site Element" "6" "Select Site Template" "7" "Rebuild Template List" "8" "Exit" 2>&1 1>&3)
exec 3>&-
case "$operation" in
@@ -144,6 +192,12 @@ while true; do
editelement
;;
"6")
+ selecttemplate
+ ;;
+ "7")
+ gettemplates
+ ;;
+ "8")
break
;;
*)
diff --git a/cgi-bin/sitemap.sh b/cgi-bin/sitemap.sh
deleted file mode 100755
index a51e75b..0000000
--- a/cgi-bin/sitemap.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-BASEURL="http://www.andydoestech.com"
-
-echo "Content-type: application/xml"
-echo ""
-
-cat << XMLHEAD
-<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-XMLHEAD
-
-SITEMOD=$(date -u -d "$(stat ../site.xml | grep '^Modify' | sed 's/^Modify: //g;s/\.[0-9]*//g')" +"%Y-%m-%dT%H:%M:%S+00:00")
-
-echo "<url>"
-echo "<loc>$BASEURL/</loc>"
-echo "<lastmod>$SITEMOD</lastmod>"
-echo "<changefreq>weekly</changefreq>"
-echo "<priority>0.6</priority>"
-echo "</url>"
-
-cat ../site.xml | grep -A1 '<page>' | grep '<label>' | sed 's/^[ \t]*//g;s/<[\/]*[a-zA-Z0-9]*>//g' | while read line; do
- echo "<url>"
- echo "<loc>$BASEURL/$line</loc>"
- echo "<lastmod>$SITEMOD</lastmod>"
- echo "<changefreq>weekly</changefreq>"
- echo "<priority>0.6</priority>"
- echo "</url>"
-done
-echo "</urlset>"
diff --git a/site.m4 b/site.m4
index a104c7d..a84a91c 100644
--- a/site.m4
+++ b/site.m4
@@ -10,10 +10,5 @@
<belowpage>
BELOWPAGEHTML
</belowpage>
- <homepage>
- <section>
- HOMEPAGEHTML
- </section>
- </homepage>
PAGEOBJECTS
</site>
diff --git a/sitemap.m4 b/sitemap.m4
new file mode 100755
index 0000000..fcfec8f
--- /dev/null
+++ b/sitemap.m4
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+URLENTRIES
+echo "</urlset>"