From 96ed5f2696df93a5a3cf29e69300c3c85aaee3ec Mon Sep 17 00:00:00 2001
From: Bob Mottram '
+ # show rss links
+ iconsDir = getIconsDir(baseDir)
+ blogStr += ' '
- blogStr += ''
- blogStr += ''
+ blogStr += ''
+ blogStr += ''
- # blogStr += ''
- # blogStr += ''
+ # blogStr += ''
+ # blogStr += ''
- blogStr += '
' - if pageNumber > 1: - # show previous button - navigateStr += '' + \ - '\n' - if len(timelineJson['orderedItems']) >= noOfItems: - # show next button - navigateStr += '' + \ - '\n' - navigateStr += '
' - blogStr += navigateStr - - for item in timelineJson['orderedItems']: - if item['type'] != 'Create': - continue - - blogStr += htmlBlogPostContent(authorized, baseDir, - httpPrefix, translate, - nickname, domain, - domainFull, item, - None, True) - - if len(timelineJson['orderedItems']) >= noOfItems: - blogStr += navigateStr - - # show rss link - blogStr += '' - - blogStr += '' - blogStr += '' - - # blogStr += '' - # blogStr += '' - - blogStr += '
' + blogStr = htmlHeaderWithExternalStyle(cssFilename) + htmlBlogRemoveCwButton(blogStr, translate) + blogsIndex = baseDir + '/accounts/' + \ + nickname + '@' + domain + '/tlblogs.index' + if not os.path.isfile(blogsIndex): return blogStr + htmlFooter() - return None + + timelineJson = createBlogsTimeline(session, baseDir, + nickname, domain, port, + httpPrefix, + noOfItems, False, + pageNumber) + + if not timelineJson: + return blogStr + htmlFooter() + + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) + + # show previous and next buttons + if pageNumber is not None: + iconsDir = getIconsDir(baseDir) + navigateStr = '' + if pageNumber > 1: + # show previous button + navigateStr += '' + \ + '\n' + if len(timelineJson['orderedItems']) >= noOfItems: + # show next button + navigateStr += '' + \ + '\n' + navigateStr += '
' + blogStr += navigateStr + + for item in timelineJson['orderedItems']: + if item['type'] != 'Create': + continue + + blogStr += htmlBlogPostContent(authorized, baseDir, + httpPrefix, translate, + nickname, domain, + domainFull, item, + None, True) + + if len(timelineJson['orderedItems']) >= noOfItems: + blogStr += navigateStr + + # show rss link + blogStr += '' + + blogStr += '' + blogStr += '' + + # blogStr += '' + # blogStr += '' + + blogStr += '
' + return blogStr + htmlFooter() def htmlBlogPageRSS2(authorized: bool, session, @@ -678,40 +671,37 @@ def htmlBlogView(authorized: bool, cssFilename = baseDir + '/epicyon-profile.css' if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' - with open(cssFilename, 'r') as cssFile: - blogCSS = cssFile.read() - blogStr = htmlHeader(cssFilename, blogCSS) + blogStr = htmlHeaderWithExternalStyle(cssFilename) - if noOfBlogAccounts(baseDir) <= 1: - nickname = singleBlogAccountNickname(baseDir) - if nickname: - return htmlBlogPage(authorized, session, - baseDir, httpPrefix, translate, - nickname, domain, port, - noOfItems, 1) + if noOfBlogAccounts(baseDir) <= 1: + nickname = singleBlogAccountNickname(baseDir) + if nickname: + return htmlBlogPage(authorized, session, + baseDir, httpPrefix, translate, + nickname, domain, port, + noOfItems, 1) - domainFull = domain - if port: - if port != 80 and port != 443: - domainFull = domain + ':' + str(port) + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) - for subdir, dirs, files in os.walk(baseDir + '/accounts'): - for acct in dirs: - if '@' not in acct: - continue - if 'inbox@' in acct: - continue - accountDir = os.path.join(baseDir + '/accounts', acct) - blogsIndex = accountDir + '/tlblogs.index' - if os.path.isfile(blogsIndex): - blogStr += '' - blogStr += '' + acct + '' - blogStr += '
' + for subdir, dirs, files in os.walk(baseDir + '/accounts'): + for acct in dirs: + if '@' not in acct: + continue + if 'inbox@' in acct: + continue + accountDir = os.path.join(baseDir + '/accounts', acct) + blogsIndex = accountDir + '/tlblogs.index' + if os.path.isfile(blogsIndex): + blogStr += '' + blogStr += '' + acct + '' + blogStr += '
' - return blogStr + htmlFooter() - return None + return blogStr + htmlFooter() def htmlEditBlog(mediaInstance: bool, translate: {}, @@ -744,10 +734,6 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, cssFilename = baseDir + '/epicyon-profile.css' if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' - with open(cssFilename, 'r') as cssFile: - editBlogCSS = cssFile.read() - if httpPrefix != 'https': - editBlogCSS = editBlogCSS.replace('https://', httpPrefix+'://') if '?' in path: path = path.split('?')[0] @@ -794,7 +780,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, dateAndLocation += '' dateAndLocation += '' - editBlogForm = htmlHeader(cssFilename, editBlogCSS) + editBlogForm = htmlHeaderWithExternalStyle(cssFilename) editBlogForm += \ '