forked from indymedia/epicyon
Move news function to right column module
parent
cc2bfc1145
commit
3662105259
|
@ -140,7 +140,6 @@ from webapp_login import htmlGetLoginCredentials
|
||||||
from webapp import htmlSuspended
|
from webapp import htmlSuspended
|
||||||
from webapp import htmlFollowConfirm
|
from webapp import htmlFollowConfirm
|
||||||
from webapp import htmlUnfollowConfirm
|
from webapp import htmlUnfollowConfirm
|
||||||
from webapp import htmlEditNewsPost
|
|
||||||
from webapp import htmlTermsOfService
|
from webapp import htmlTermsOfService
|
||||||
from webapp import htmlModerationInfo
|
from webapp import htmlModerationInfo
|
||||||
from webapp import htmlHashtagBlocked
|
from webapp import htmlHashtagBlocked
|
||||||
|
@ -154,6 +153,7 @@ from webapp_column_left import htmlEditLinks
|
||||||
from webapp_column_right import htmlNewswireMobile
|
from webapp_column_right import htmlNewswireMobile
|
||||||
from webapp_column_right import htmlEditNewswire
|
from webapp_column_right import htmlEditNewswire
|
||||||
from webapp_column_right import htmlCitations
|
from webapp_column_right import htmlCitations
|
||||||
|
from webapp_column_right import htmlEditNewsPost
|
||||||
from webapp_search import htmlSkillsSearch
|
from webapp_search import htmlSkillsSearch
|
||||||
from webapp_search import htmlHistorySearch
|
from webapp_search import htmlHistorySearch
|
||||||
from webapp_search import htmlHashtagSearch
|
from webapp_search import htmlHashtagSearch
|
||||||
|
|
79
webapp.py
79
webapp.py
|
@ -14,7 +14,6 @@ from utils import getDomainFromActor
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from posts import isEditor
|
|
||||||
from shares import getValidSharedItemID
|
from shares import getValidSharedItemID
|
||||||
from webapp_utils import getAltPath
|
from webapp_utils import getAltPath
|
||||||
from webapp_utils import getIconsDir
|
from webapp_utils import getIconsDir
|
||||||
|
@ -115,84 +114,6 @@ def htmlModerationInfo(cssCache: {}, translate: {},
|
||||||
return infoForm
|
return infoForm
|
||||||
|
|
||||||
|
|
||||||
def htmlEditNewsPost(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|
||||||
domain: str, port: int,
|
|
||||||
httpPrefix: str, postUrl: str) -> str:
|
|
||||||
"""Edits a news post
|
|
||||||
"""
|
|
||||||
if '/users/' not in path:
|
|
||||||
return ''
|
|
||||||
pathOriginal = path
|
|
||||||
|
|
||||||
nickname = getNicknameFromActor(path)
|
|
||||||
if not nickname:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
# is the user an editor?
|
|
||||||
if not isEditor(baseDir, nickname):
|
|
||||||
return ''
|
|
||||||
|
|
||||||
postUrl = postUrl.replace('/', '#')
|
|
||||||
postFilename = locatePost(baseDir, nickname, domain, postUrl)
|
|
||||||
if not postFilename:
|
|
||||||
return ''
|
|
||||||
postJsonObject = loadJson(postFilename)
|
|
||||||
if not postJsonObject:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
cssFilename = baseDir + '/epicyon-links.css'
|
|
||||||
if os.path.isfile(baseDir + '/links.css'):
|
|
||||||
cssFilename = baseDir + '/links.css'
|
|
||||||
|
|
||||||
editCSS = getCSS(baseDir, cssFilename, cssCache)
|
|
||||||
if editCSS:
|
|
||||||
if httpPrefix != 'https':
|
|
||||||
editCSS = \
|
|
||||||
editCSS.replace('https://', httpPrefix + '://')
|
|
||||||
|
|
||||||
editNewsPostForm = htmlHeader(cssFilename, editCSS)
|
|
||||||
editNewsPostForm += \
|
|
||||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
|
||||||
'accept-charset="UTF-8" action="' + path + '/newseditdata">\n'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <div class="vertical-center">\n'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <p class="new-post-text">' + translate['Edit News Post'] + '</p>'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <div class="container">\n'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <a href="' + pathOriginal + '/tlnews">' + \
|
|
||||||
'<button class="cancelbtn">' + translate['Go Back'] + '</button></a>\n'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <input type="submit" name="submitEditedNewsPost" value="' + \
|
|
||||||
translate['Submit'] + '">\n'
|
|
||||||
editNewsPostForm += \
|
|
||||||
' </div>\n'
|
|
||||||
|
|
||||||
editNewsPostForm += \
|
|
||||||
'<div class="container">'
|
|
||||||
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <input type="hidden" name="newsPostUrl" value="' + \
|
|
||||||
postUrl + '">\n'
|
|
||||||
|
|
||||||
newsPostTitle = postJsonObject['object']['summary']
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <input type="text" name="newsPostTitle" value="' + \
|
|
||||||
newsPostTitle + '"><br>\n'
|
|
||||||
|
|
||||||
newsPostContent = postJsonObject['object']['content']
|
|
||||||
editNewsPostForm += \
|
|
||||||
' <textarea id="message" name="editedNewsPost" ' + \
|
|
||||||
'style="height:600px">' + newsPostContent + '</textarea>'
|
|
||||||
|
|
||||||
editNewsPostForm += \
|
|
||||||
'</div>'
|
|
||||||
|
|
||||||
editNewsPostForm += htmlFooter()
|
|
||||||
return editNewsPostForm
|
|
||||||
|
|
||||||
|
|
||||||
def htmlTermsOfService(cssCache: {}, baseDir: str,
|
def htmlTermsOfService(cssCache: {}, baseDir: str,
|
||||||
httpPrefix: str, domainFull: str) -> str:
|
httpPrefix: str, domainFull: str) -> str:
|
||||||
"""Show the terms of service screen
|
"""Show the terms of service screen
|
||||||
|
|
|
@ -10,6 +10,8 @@ import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from content import removeLongWords
|
from content import removeLongWords
|
||||||
|
from utils import locatePost
|
||||||
|
from utils import loadJson
|
||||||
from utils import getCSS
|
from utils import getCSS
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import votesOnNewswireItem
|
from utils import votesOnNewswireItem
|
||||||
|
@ -565,3 +567,81 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||||
|
|
||||||
editNewswireForm += htmlFooter()
|
editNewswireForm += htmlFooter()
|
||||||
return editNewswireForm
|
return editNewswireForm
|
||||||
|
|
||||||
|
|
||||||
|
def htmlEditNewsPost(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||||
|
domain: str, port: int,
|
||||||
|
httpPrefix: str, postUrl: str) -> str:
|
||||||
|
"""Edits a news post on the news/features timeline
|
||||||
|
"""
|
||||||
|
if '/users/' not in path:
|
||||||
|
return ''
|
||||||
|
pathOriginal = path
|
||||||
|
|
||||||
|
nickname = getNicknameFromActor(path)
|
||||||
|
if not nickname:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
# is the user an editor?
|
||||||
|
if not isEditor(baseDir, nickname):
|
||||||
|
return ''
|
||||||
|
|
||||||
|
postUrl = postUrl.replace('/', '#')
|
||||||
|
postFilename = locatePost(baseDir, nickname, domain, postUrl)
|
||||||
|
if not postFilename:
|
||||||
|
return ''
|
||||||
|
postJsonObject = loadJson(postFilename)
|
||||||
|
if not postJsonObject:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
cssFilename = baseDir + '/epicyon-links.css'
|
||||||
|
if os.path.isfile(baseDir + '/links.css'):
|
||||||
|
cssFilename = baseDir + '/links.css'
|
||||||
|
|
||||||
|
editCSS = getCSS(baseDir, cssFilename, cssCache)
|
||||||
|
if editCSS:
|
||||||
|
if httpPrefix != 'https':
|
||||||
|
editCSS = \
|
||||||
|
editCSS.replace('https://', httpPrefix + '://')
|
||||||
|
|
||||||
|
editNewsPostForm = htmlHeader(cssFilename, editCSS)
|
||||||
|
editNewsPostForm += \
|
||||||
|
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||||
|
'accept-charset="UTF-8" action="' + path + '/newseditdata">\n'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <div class="vertical-center">\n'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <p class="new-post-text">' + translate['Edit News Post'] + '</p>'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <div class="container">\n'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <a href="' + pathOriginal + '/tlnews">' + \
|
||||||
|
'<button class="cancelbtn">' + translate['Go Back'] + '</button></a>\n'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <input type="submit" name="submitEditedNewsPost" value="' + \
|
||||||
|
translate['Submit'] + '">\n'
|
||||||
|
editNewsPostForm += \
|
||||||
|
' </div>\n'
|
||||||
|
|
||||||
|
editNewsPostForm += \
|
||||||
|
'<div class="container">'
|
||||||
|
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <input type="hidden" name="newsPostUrl" value="' + \
|
||||||
|
postUrl + '">\n'
|
||||||
|
|
||||||
|
newsPostTitle = postJsonObject['object']['summary']
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <input type="text" name="newsPostTitle" value="' + \
|
||||||
|
newsPostTitle + '"><br>\n'
|
||||||
|
|
||||||
|
newsPostContent = postJsonObject['object']['content']
|
||||||
|
editNewsPostForm += \
|
||||||
|
' <textarea id="message" name="editedNewsPost" ' + \
|
||||||
|
'style="height:600px">' + newsPostContent + '</textarea>'
|
||||||
|
|
||||||
|
editNewsPostForm += \
|
||||||
|
'</div>'
|
||||||
|
|
||||||
|
editNewsPostForm += htmlFooter()
|
||||||
|
return editNewsPostForm
|
||||||
|
|
Loading…
Reference in New Issue