From 092813c70a31d4eda906b589698c0cf32944fd66 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 29 Feb 2020 20:34:44 +0000 Subject: [PATCH] Function for blog editing --- blog.py | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/blog.py b/blog.py index 0f429a43..a77939d3 100644 --- a/blog.py +++ b/blog.py @@ -529,3 +529,120 @@ def htmlBlogView(authorized: bool, \ return blogStr+htmlFooter() return None + +def htmlEditBlog(mediaInstance: bool,translate: {}, \ + baseDir: str,httpPrefix: str, \ + path: str, \ + pageNumber: int, \ + nickname: str,domain: str) -> str: + """Edit a blog post after it was created + """ + iconsDir=getIconsDir(baseDir) + + editBlogText='

'+translate['Write your post text below.']+'

' + + if os.path.isfile(baseDir+'/accounts/newpost.txt'): + with open(baseDir+'/accounts/newpost.txt', 'r') as file: + editBlogText = '

'+file.read()+'

' + + 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] + pathBase= \ + path.replace('/editblogpost','') + + editBlogImageSection ='
' + editBlogImageSection+=' ' + editBlogImageSection+=' ' + editBlogImageSection+='

' + + dateAndLocation+= \ + '

' + dateAndLocation+='' + dateAndLocation+='' + dateAndLocation+='

' + dateAndLocation+='
' + dateAndLocation+='
' + dateAndLocation+='
' + dateAndLocation+='' + dateAndLocation+='
' + + editBlogForm=htmlHeader(cssFilename,editBlogCSS) + + mentionsStr='' + + editBlogForm+= \ + '
' + editBlogForm+='
' + editBlogForm+=' ' + editBlogForm+='
' + + editBlogForm+='
' + editBlogForm+= \ + ' '+scopeDescription+'' + editBlogForm+='
' + + editBlogForm+= \ + ' '+ \
+        translate['Search for emoji']+'' + editBlogForm+='
' + editBlogForm+='
' + editBlogForm+= \ + ' ' + editBlogForm+= \ + ' ' + editBlogForm+='
' + if mediaInstance: + editBlogForm+=editBlogImageSection + editBlogForm+= \ + '
' + editBlogForm+=' ' + editBlogForm+='' + editBlogForm+='
' + messageBoxHeight=800 + + editBlogForm+= \ + ' ' + editBlogForm+=dateAndLocation + if not mediaInstance: + editBlogForm+=editBlogImageSection + editBlogForm+='
' + editBlogForm+='
' + + editBlogForm= \ + editBlogForm.replace('','') + + editBlogForm+=htmlFooter() + return editBlogForm