# License: MIT (http://www.opensource.org/licenses/mit-license.php) import os import algaeHtmlBlocks import algaeModels import algaePython pathInfo = os.environ.get("PATH_INFO") postRequested = pathInfo[7:] thePost = algaeModels.getContentFromCleanURL(postRequested, "blogPost") print "Content-Type: text/html \n" print "<!DOCTYPE html>" print '<html lang="en">' if thePost: algaeHtmlBlocks.commonHeader(thePost.postTitle) else: algaeHtmlBlocks.commonHeader("Content Not Found") print "<body>" print '<div id="mainDiv">' algaeHtmlBlocks.titleBlock() algaeHtmlBlocks.displayNav() print '<div id="thePost" class="normalContent">' if thePost: thePost.printArticle(link=False) else: print "<h1>Content not found.</h1>" print "</div>" print "</div>" print "</body>" print "</html>"
if post.isPublished: print '<p class="textDescriptor">Published: </p><input type="checkbox" name="isPublished" checked/>' else: print '<p class="textDescriptor">Published: </p><input type="checkbox" name="isPublished"/>' print "<div class='theButtons'><input type='submit' value='Save' class='submitButton'/>" print '<a href="/editContent?contentType=delete&cType=' + cType + '&postID=' + ID + '" class="deleteButton">Delete</a></div>' print "</form>" print "</div>" def adminNav(): print '<nav>' print '<ul>' print '<li><a href="admin?edit=blogPost">Posts</a></li>' print '<li><a href="admin?edit=basicPage">Pages</a></li>' print '<li><a href="admin?edit=image">Images</a></li>' print '<li><a href="admin?edit=navLink">Navigation</a></li>' print '<li><a href="admin?edit=siteUser">Users</a></li>' print '<li><a href="admin?edit=styleSheet">CSS</a></li>' print '<li><a href="admin?edit=jScript">Javascript</a></li>' print '<li><a href="logout">Log Out</a></li>' print '</ul>' print '</nav>' form = cgi.FieldStorage() print 'Content-Type: text/html\n' print '<!DOCTYPE html>' print '<html lang="en">' algaeHtmlBlocks.commonHeader(algaeUserConfig.siteTitle.encode('utf-8') + " Admin Page") printBody() print '</html>'
#!/usr/bin/env python # Copyright (c) 2011 Evan Sonderegger # License: MIT (http://www.opensource.org/licenses/mit-license.php) import os import algaeHtmlBlocks import algaeModels import algaePython pathInfo = os.environ.get('PATH_INFO') postRequested = pathInfo[7:] thePage = algaeModels.getContentFromCleanURL(postRequested, 'basicPage') print 'Content-Type: text/html \n' print '<!DOCTYPE html>' print '<html lang="en">' if thePage: algaeHtmlBlocks.commonHeader(thePage.postTitle.encode('utf-8')) else: algaeHtmlBlocks.commonHeader('Content Not Found') print '<body>' algaeHtmlBlocks.titleBlock() algaeHtmlBlocks.displayNav() print '<article class="normalContent">' if thePage: print thePage.markdownText.encode('utf-8') else: print '<h1>Content not found.</h1>' print '</article>' print '</body>' print '</html>'
# License: MIT (http://www.opensource.org/licenses/mit-license.php) import os import algaeHtmlBlocks import algaeModels import algaePython pathInfo = os.environ.get('PATH_INFO') postRequested = pathInfo[7:] thePost = algaeModels.getContentFromCleanURL(postRequested, 'blogPost') print 'Content-Type: text/html \n' print '<!DOCTYPE html>' print '<html lang="en">' if thePost: algaeHtmlBlocks.commonHeader(thePost.postTitle) else: algaeHtmlBlocks.commonHeader('Content Not Found') print '<body>' print '<div id="mainDiv">' algaeHtmlBlocks.titleBlock() algaeHtmlBlocks.displayNav() print '<div id="thePost" class="normalContent">' if thePost: thePost.printArticle(link=False) else: print '<h1>Content not found.</h1>' print '</div>' print '</div>' print '</body>' print '</html>'
def printBody(): print '<body>' printMainDiv() print '</body>' def printMainDiv(): algaeHtmlBlocks.titleBlock() algaeHtmlBlocks.displayNav() print '<div id="thePosts" class="normalContent">' form = cgi.FieldStorage() pageNum = int(form.getfirst("page", 0)) algaeHtmlBlocks.getPostsContent(algaeUserConfig.postsPerPage, pageNum*algaeUserConfig.postsPerPage) print "</div>" postsCount = algaePython.getPostsCount() if postsCount > algaeUserConfig.postsPerPage or pageNum > 0: print "<div id='prevNextPage'>" if pageNum > 1: print '<div id="prevPage"><a href="/?page=' + str(pageNum - 1) + '">Previous Page</a></div>' elif pageNum == 1: print '<div id="prevPage"><a href="/">Previous Page</a></div>' if postsCount > algaeUserConfig.postsPerPage*pageNum + algaeUserConfig.postsPerPage: print '<div id="nextPage"><a href="/?page=' + str(pageNum + 1) + '">Next Page</a></div>' print "</div>" print 'Content-Type: text/html \n' print '<!DOCTYPE html>' print '<html lang="en">' algaeHtmlBlocks.commonHeader() printBody() print '</html>'