Citations pseudo-array

merge-requests/30/head
Bob Mottram 2020-11-06 10:27:19 +00:00
parent 0f37e78d17
commit a8e3bb1764
2 changed files with 10 additions and 12 deletions

View File

@ -3115,10 +3115,11 @@ class PubServer(BaseHTTPRequestHandler):
extractTextFieldsInPOST(postBytes, boundary, debug) extractTextFieldsInPOST(postBytes, boundary, debug)
print('citationstest: ' + str(fields)) print('citationstest: ' + str(fields))
citations = [] citations = []
for dateStr, item in newswire.items(): for ctr in range(0, 128):
if fields.get(dateStr): fieldName = 'newswire' + str(ctr)
if fields[dateStr] == 'on': if not fields.get(fieldName):
citations.append(dateStr) continue
citations.append(fields[fieldName])
if citations: if citations:
citationsFilename = \ citationsFilename = \
@ -10884,8 +10885,7 @@ class PubServer(BaseHTTPRequestHandler):
# was the citations button pressed on the newblog screen? # was the citations button pressed on the newblog screen?
citationsButtonPress = False citationsButtonPress = False
if postType == 'newblog' and fields.get('submitCitations'): if postType == 'newblog' and fields.get('submitCitations'):
if fields['submitCitations'] == \ if fields['submitCitations'] == 'Submit':
self.server.translate['Citations']:
citationsButtonPress = True citationsButtonPress = True
if not citationsButtonPress: if not citationsButtonPress:
@ -10894,7 +10894,7 @@ class PubServer(BaseHTTPRequestHandler):
not fields.get('imageDescription'): not fields.get('imageDescription'):
return -1 return -1
if fields.get('submitPost'): if fields.get('submitPost'):
if fields['submitPost'] != self.server.translate['Submit']: if fields['submitPost'] != 'Submit':
return -1 return -1
else: else:
return 2 return 2

View File

@ -3002,8 +3002,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
translate['Citations'] + '">\n' translate['Citations'] + '">\n'
newPostForm += \ newPostForm += \
' <input type="submit" name="submitPost" value="' + \ ' <input type="submit" name="submitPost" value="Submit">\n'
translate['Submit'] + '">\n'
newPostForm += ' </center></div>\n' newPostForm += ' </center></div>\n'
@ -5908,8 +5907,7 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
' <input type="hidden" name="blogContent" value="' + \ ' <input type="hidden" name="blogContent" value="' + \
blogContent + '">\n' blogContent + '">\n'
htmlStr += \ htmlStr += \
' <input type="submit" name="submitCitations" value="' + \ ' <input type="submit" name="submitCitations" value="Submit">\n'
translate['Submit'] + '">\n'
htmlStr += ' </center>\n' htmlStr += ' </center>\n'
# list of newswire items # list of newswire items
@ -5924,7 +5922,7 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
link = item[1] link = item[1]
htmlStr += \ htmlStr += \
'<input type="checkbox" name="' + dateStr + \ '<input type="checkbox" name="newswire' + str(ctr) + \
'" value="' + dateStr + '"/>' + \ '" value="' + dateStr + '"/>' + \
'<a href="' + link + '">' + title + '</a> ' '<a href="' + link + '">' + title + '</a> '
htmlStr += '<span class="newswireDate">' + \ htmlStr += '<span class="newswireDate">' + \