changing options on files_*, search, also next/prev all now use POST->redirect model, so should allow back/forward browser buttons to work - commit so we can test in PROD

This commit is contained in:
2022-01-22 21:36:58 +11:00
parent 491663f1c9
commit 0f4632e240
14 changed files with 264 additions and 77 deletions

View File

@@ -239,6 +239,7 @@ def GetEntriesInFolderView( OPT, prefix ):
def GetEntries( OPT ):
entries=[]
if OPT.path_type == 'Search' or (OPT.path_type == 'View' and OPT.orig_ptype=='Search'):
print( f"getting entries: OPT={OPT}" )
search_term=OPT.orig_search_term
if 'AI:' in search_term:
search_term = search_term.replace('AI:','')
@@ -307,6 +308,15 @@ def clear_jm_msg(id):
ClearJM_Message(id)
return redirect( url_for("main_page") )
@app.route("/ChangeFileOpts", methods=["POST"])
@login_required
def ChangeFileOpts():
# reset options based on form post, then redirect back to orig page
OPT=States( request )
for el in request.form:
print( f"{el}={request.form[el]}")
return redirect( request.referrer )
################################################################################
# /file_list -> show detailed file list of files from import_path(s)
################################################################################
@@ -577,6 +587,8 @@ def view(id):
entries=GetEntries( OPT )
eids=""
for e in entries:
print( f"id={e.id}, len(faces)={len(e.file_details.faces)}")
print(e.id)
objs[e.id]=e
eids += f"{e.id},"
# if this is a dir, we wont view it with a click anyway, so move on...
@@ -584,6 +596,7 @@ def view(id):
continue
# put locn data back into array format
for face in e.file_details.faces:
print( f"face.locn before json: {face.locn}" )
face.locn = json.loads(face.locn)
eids=eids.rstrip(",")
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT )