added viewing recycle bin via folders, added comments, cleaned up TODO to note this is done

This commit is contained in:
2021-05-26 18:32:52 +10:00
parent 8dc98dd368
commit 9b926938e4
4 changed files with 75 additions and 28 deletions

View File

@@ -134,8 +134,10 @@ def ViewingOptions( request ):
size=128
if 'files_sp' in request.path:
folders=True
# this is the default as 'Storage' is the path_type in the DB
cwd='static/Storage'
elif 'files_rbp' in request.path:
folders=True
cwd='static/Bin'
else:
folders=False
cwd=None
@@ -181,7 +183,7 @@ def files_ip():
noo, grouping, how_many, offset, size, folders, cwd, root = ViewingOptions( request )
entries=[]
# per import path, add entries to view
# per import path, add entries to view
settings=Settings.query.first()
paths = settings.import_path.split("#")
for path in paths:
@@ -206,7 +208,7 @@ def files_sp():
print( f"cwd={cwd}" )
# per storage path, add entries to view
# per storage path, add entries to view
settings=Settings.query.first()
paths = settings.storage_path.split("#")
for path in paths:
@@ -220,6 +222,33 @@ def files_sp():
entries+=Entry.query.join(Dir).join(EntryDirLink).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).order_by(Entry.name).offset(offset).limit(how_many).all()
return render_template("files.html", page_title='View Files (Storage Path)', entry_data=entries, noo=noo, grouping=grouping, how_many=how_many, offset=offset, size=size, folders=folders, cwd=cwd, root=root )
################################################################################
# /files -> show thumbnail view of files from storage_path
################################################################################
@app.route("/files_rbp", methods=["GET", "POST"])
def files_rbp():
noo, grouping, how_many, offset, size, folders, cwd, root = ViewingOptions( request )
entries=[]
print( f"cwd={cwd}" )
# per recyle bin path, add entries to view
settings=Settings.query.first()
paths = settings.recycle_bin_path.split("#")
for path in paths:
prefix = SymlinkName("Bin",path,path+'/')
if noo == "Oldest":
entries+=Entry.query.join(File).join(EntryDirLink).join(Dir).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).order_by(File.year,File.month,File.day,Entry.name).offset(offset).limit(how_many).all()
else:
entries+=Entry.query.join(File).join(EntryDirLink).join(Dir).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).order_by(File.year.desc(),File.month.desc(),File.day.desc(),Entry.name).offset(offset).limit(how_many).all()
entries+=Entry.query.join(Dir).join(EntryDirLink).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).order_by(Entry.name).offset(offset).limit(how_many).all()
print( f"dirs={Entry.query.join(Dir).join(EntryDirLink).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).order_by(Entry.name).offset(offset).limit(how_many).all()}" )
return render_template("files.html", page_title='View Files (Bin Path)', entry_data=entries, noo=noo, grouping=grouping, how_many=how_many, offset=offset, size=size, folders=folders, cwd=cwd, root=root )
################################################################################
# /search -> show thumbnail view of files from import_path(s)
################################################################################