Edit links button

merge-requests/30/head
Bob Mottram 2020-10-01 18:26:21 +01:00
parent 83847c9b99
commit 3e26f5f745
17 changed files with 157 additions and 21 deletions

View File

@ -131,6 +131,23 @@ a, u {
color: var(--main-fg-color); color: var(--main-fg-color);
} }
.editLinksBtn {
border-radius: var(--button-corner-radius);
background-color: var(--button-background);
border: none;
color: var(--button-text);
text-align: center;
font-size: var(--font-size-header);
font-family: Arial, Helvetica, sans-serif;
padding: var(--button-height-padding);
width: 90%;
max-width: 200px;
min-width: 10ch;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
a:visited{ a:visited{
color: var(--main-visited-color); color: var(--main-visited-color);
background: var(--link-bg-color); background: var(--link-bg-color);

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "تحذيرات المحتوى المُنشأ تلقائيًا", "Autogenerated Content Warnings": "تحذيرات المحتوى المُنشأ تلقائيًا",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag محظور", "Hashtag Blocked": "Hashtag محظور",
"This is a blogging instance": "هذا مثال على المدونات" "This is a blogging instance": "هذا مثال على المدونات",
"Edit Links": "تحرير الارتباطات",
"One link per line. Description followed by the link.": "رابط واحد في كل سطر. الوصف متبوع بالرابط."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Advertiments de contingut autogenerats", "Autogenerated Content Warnings": "Advertiments de contingut autogenerats",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloquejat", "Hashtag Blocked": "Hashtag bloquejat",
"This is a blogging instance": "Aquesta és una instància de blocs" "This is a blogging instance": "Aquesta és una instància de blocs",
"Edit Links": "Edita els enllaços",
"One link per line. Description followed by the link.": "Un enllaç per línia. Descripció seguida de l'enllaç."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Rhybuddion Cynnwys Autogenerated", "Autogenerated Content Warnings": "Rhybuddion Cynnwys Autogenerated",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag wedi'i Blocio", "Hashtag Blocked": "Hashtag wedi'i Blocio",
"This is a blogging instance": "Dyma enghraifft blogio" "This is a blogging instance": "Dyma enghraifft blogio",
"Edit Links": "Golygu Dolenni",
"One link per line. Description followed by the link.": "Un dolen y llinell. Disgrifiad wedi'i ddilyn gan y ddolen."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Warnungen vor automatisch generierten Inhalten", "Autogenerated Content Warnings": "Warnungen vor automatisch generierten Inhalten",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag blockiert", "Hashtag Blocked": "Hashtag blockiert",
"This is a blogging instance": "Dies ist eine Blogging-Instanz" "This is a blogging instance": "Dies ist eine Blogging-Instanz",
"Edit Links": "Links bearbeiten",
"One link per line. Description followed by the link.": "Ein Link pro Zeile. Beschreibung gefolgt vom Link."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Autogenerated Content Warnings", "Autogenerated Content Warnings": "Autogenerated Content Warnings",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocked", "Hashtag Blocked": "Hashtag Blocked",
"This is a blogging instance": "This is a blogging instance" "This is a blogging instance": "This is a blogging instance",
"Edit Links": "Edit Links",
"One link per line. Description followed by the link.": "One link per line. Description followed by the link."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Advertencias de contenido generado automáticamente", "Autogenerated Content Warnings": "Advertencias de contenido generado automáticamente",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqueada", "Hashtag Blocked": "Hashtag bloqueada",
"This is a blogging instance": "Esta es una instancia de blogs" "This is a blogging instance": "Esta es una instancia de blogs",
"Edit Links": "Editar enlaces",
"One link per line. Description followed by the link.": "Un enlace por línea. Descripción seguida del enlace."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Avertissements de contenu générés automatiquement", "Autogenerated Content Warnings": "Avertissements de contenu générés automatiquement",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqué", "Hashtag Blocked": "Hashtag bloqué",
"This is a blogging instance": "Ceci est une instance de blog" "This is a blogging instance": "Ceci est une instance de blog",
"Edit Links": "Modifier les liens",
"One link per line. Description followed by the link.": "Un lien par ligne. Description suivie du lien."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Rabhaidh Ábhar Uathghinte", "Autogenerated Content Warnings": "Rabhaidh Ábhar Uathghinte",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocáilte", "Hashtag Blocked": "Hashtag Blocáilte",
"This is a blogging instance": "Seo sampla blagála" "This is a blogging instance": "Seo sampla blagála",
"Edit Links": "Cuir Naisc in eagar",
"One link per line. Description followed by the link.": "Nasc amháin in aghaidh an líne. Cur síos agus an nasc ina dhiaidh sin."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "स्वतः प्राप्त सामग्री चेतावनी", "Autogenerated Content Warnings": "स्वतः प्राप्त सामग्री चेतावनी",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "हैशटैग अवरुद्ध", "Hashtag Blocked": "हैशटैग अवरुद्ध",
"This is a blogging instance": "यह एक ब्लॉगिंग उदाहरण है" "This is a blogging instance": "यह एक ब्लॉगिंग उदाहरण है",
"Edit Links": "लिंक संपादित करें",
"One link per line. Description followed by the link.": "प्रति पंक्ति एक लिंक। लिंक के बाद विवरण।"
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Avvisi sui contenuti generati automaticamente", "Autogenerated Content Warnings": "Avvisi sui contenuti generati automaticamente",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloccato", "Hashtag Blocked": "Hashtag bloccato",
"This is a blogging instance": "Questa è un'istanza di blog" "This is a blogging instance": "Questa è un'istanza di blog",
"Edit Links": "Modifica collegamenti",
"One link per line. Description followed by the link.": "Un collegamento per riga. Descrizione seguita dal collegamento."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "自動生成されたコンテンツの警告", "Autogenerated Content Warnings": "自動生成されたコンテンツの警告",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "ハッシュタグがブロックされました", "Hashtag Blocked": "ハッシュタグがブロックされました",
"This is a blogging instance": "これはブログのインスタンスです" "This is a blogging instance": "これはブログのインスタンスです",
"Edit Links": "リンクの編集",
"One link per line. Description followed by the link.": "1行に1つのリンク。 説明の後にリンクが続きます。"
} }

View File

@ -284,5 +284,7 @@
"Autogenerated Content Warnings": "Autogenerated Content Warnings", "Autogenerated Content Warnings": "Autogenerated Content Warnings",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocked", "Hashtag Blocked": "Hashtag Blocked",
"This is a blogging instance": "This is a blogging instance" "This is a blogging instance": "This is a blogging instance",
"Edit Links": "Edit Links",
"One link per line. Description followed by the link.": "One link per line. Description followed by the link."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Avisos de conteúdo gerado automaticamente", "Autogenerated Content Warnings": "Avisos de conteúdo gerado automaticamente",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqueada", "Hashtag Blocked": "Hashtag bloqueada",
"This is a blogging instance": "Esta é uma instância de blog" "This is a blogging instance": "Esta é uma instância de blog",
"Edit Links": "Editar Links",
"One link per line. Description followed by the link.": "Um link por linha. Descrição seguida pelo link."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "Автоматические предупреждения о содержании", "Autogenerated Content Warnings": "Автоматические предупреждения о содержании",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "Хештег заблокирован", "Hashtag Blocked": "Хештег заблокирован",
"This is a blogging instance": "Это экземпляр блога" "This is a blogging instance": "Это экземпляр блога",
"Edit Links": "Редактировать ссылки",
"One link per line. Description followed by the link.": "По одной ссылке в строке. Описание с последующей ссылкой."
} }

View File

@ -288,5 +288,7 @@
"Autogenerated Content Warnings": "自动生成的内容警告", "Autogenerated Content Warnings": "自动生成的内容警告",
"Indymedia": "Indymedia", "Indymedia": "Indymedia",
"Hashtag Blocked": "标签被阻止", "Hashtag Blocked": "标签被阻止",
"This is a blogging instance": "这是一个博客实例" "This is a blogging instance": "这是一个博客实例",
"Edit Links": "编辑连结",
"One link per line. Description followed by the link.": "每行一个链接。 描述,然后是链接。"
} }

View File

@ -1206,6 +1206,79 @@ def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool:
return False return False
def htmlEditLinks(translate: {}, baseDir: str, path: str,
domain: str, port: int, httpPrefix: str) -> str:
"""Shows the edit links screen
"""
if '/users/' not in path:
return ''
pathOriginal = path
path = path.replace('/inbox', '').replace('/outbox', '')
path = path.replace('/shares', '')
nickname = getNicknameFromActor(path)
if not nickname:
return ''
domainFull = domain
if port:
if port != 80 and port != 443:
if ':' not in domain:
domainFull = domain + ':' + str(port)
# is the user a moderator?
if not isModerator(baseDir, nickname):
return ''
cssFilename = baseDir + '/epicyon-links.css'
if os.path.isfile(baseDir + '/links.css'):
cssFilename = baseDir + '/links.css'
with open(cssFilename, 'r') as cssFile:
editCSS = cssFile.read()
if httpPrefix != 'https':
editCSS = \
editCSS.replace('https://', httpPrefix + '://')
editLinksForm = htmlHeader(cssFilename, editCSS)
editLinksForm += \
'<form enctype="multipart/form-data" method="POST" ' + \
'accept-charset="UTF-8" action="' + path + '/linksdata">\n'
editLinksForm += \
' <div class="vertical-center">\n'
editLinksForm += \
' <p class="new-post-text">' + translate['Edit Links'] + '</p>'
editLinksForm += \
' <div class="container">\n'
editLinksForm += \
' <a href="' + pathOriginal + '"><button class="cancelbtn">' + \
translate['Go Back'] + '</button></a>\n'
editLinksForm += \
' <input type="submit" name="submitLinks" value="' + \
translate['Submit'] + '">\n'
editLinksForm += \
' </div>\n'
linksFilename = baseDir + '/accounts/links.txt'
linksStr = ''
if os.path.isfile(linksFilename):
with open(linksFilename, 'r') as fp:
linksStr = fp.read()
editLinksForm = \
'<div class="container">'
editLinksForm += \
' ' + \
translate['One link per line. Description followed by the link.']
editLinksForm += \
' <textarea id="message" name="editedLinks" style="height:500px">' + \
linksStr + '</textarea>'
editLinksForm += \
'</div>'
editLinksForm += htmlFooter()
return editLinksForm
def htmlEditProfile(translate: {}, baseDir: str, path: str, def htmlEditProfile(translate: {}, baseDir: str, path: str,
domain: str, port: int, httpPrefix: str) -> str: domain: str, port: int, httpPrefix: str) -> str:
"""Shows the edit profile screen """Shows the edit profile screen
@ -5077,15 +5150,23 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str:
return '*' + label + '*' return '*' + label + '*'
def getLeftColumContent(baseDir: str, nickname: str, domain: str) -> str: def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
httpPrefix: str, translate: {}) -> str:
"""Returns html content for the left column """Returns html content for the left column
""" """
htmlStr = '' htmlStr = \
# TODO ' <center>\n' + \
' <a href="' + \
httpPrefix + '://' + domainFull + \
'/users/' + nickname + '/editlinks' + '">' + \
'<button class="editLinksBtn">' + \
translate['Edit Links'] + '</button></a>\n' + \
' </center>\n'
return htmlStr return htmlStr
def getRightColumContent(baseDir: str, nickname: str, domain: str) -> str: def getRightColumnContent(baseDir: str, nickname: str, domain: str) -> str:
"""Returns html content for the right column """Returns html content for the right column
""" """
htmlStr = '' htmlStr = ''
@ -5393,8 +5474,16 @@ def htmlTimeline(defaultTimeline: str,
tlStr += ' <col span="1" class="column-right">\n' tlStr += ' <col span="1" class="column-right">\n'
tlStr += ' </colgroup>\n' tlStr += ' </colgroup>\n'
tlStr += ' <tbody><tr>\n' tlStr += ' <tbody><tr>\n'
domainFull = domain
if port:
if port != 80 and port != 443:
domainFull = domain + ':' + str(port)
# left column # left column
leftColumnStr = getLeftColumContent(baseDir, nickname, domain) leftColumnStr = \
getLeftColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate)
tlStr += ' <td class="col-left">' + leftColumnStr + '</td>\n' tlStr += ' <td class="col-left">' + leftColumnStr + '</td>\n'
# center column containing posts # center column containing posts
tlStr += ' <td class="col-center">\n' tlStr += ' <td class="col-center">\n'
@ -5702,7 +5791,7 @@ def htmlTimeline(defaultTimeline: str,
tlStr += ' </td>\n' tlStr += ' </td>\n'
# right column # right column
rightColumnStr = getRightColumContent(baseDir, nickname, domain) rightColumnStr = getRightColumnContent(baseDir, nickname, domain)
tlStr += ' <td class="col-right">' + rightColumnStr + '</td>\n' tlStr += ' <td class="col-right">' + rightColumnStr + '</td>\n'
# benchmark 9 # benchmark 9