@ -109,6 +109,8 @@ def annotations():
books = db . session . query ( Book ) . all ( )
books = db . session . query ( Book ) . all ( )
# books = db.session.query(Book).order_by(Book.title)
# books = db.session.query(Book).order_by(Book.title)
# id = book.id
# id = book.id
server = request . host
rstr = ( ' http:// ' + server + ' /uploads/ ' , ' ' )
annot = get_annotations ( )
annot = get_annotations ( )
print ( annot )
print ( annot )
return render_template ( ' annotations.html ' , annot = annot , books = books )
return render_template ( ' annotations.html ' , annot = annot , books = books )
@ -121,6 +123,17 @@ def annotations_pdf():
html = render_template ( ( ' annotations.html ' ) , annot = annot )
html = render_template ( ( ' annotations.html ' ) , annot = annot )
return render_pdf ( HTML ( string = html ) )
return render_pdf ( HTML ( string = html ) )
@app.route ( ' /myannotations.pdf ' )
def myannotations_pdf ( ) :
books = db . session . query ( Book ) . all ( )
name = str ( request . args . get ( ' query ' ) )
annot = get_annotations ( )
res = get_annot_results ( annot , name )
# Make a PDF straight from HTML in a string.
html = render_template ( ' results_annot.html ' , name = name , annot = annot , res = res , books = books )
return render_pdf ( HTML ( string = html ) )
@app.route ( ' /viewpdf/<filename> ' )
@app.route ( ' /viewpdf/<filename> ' )
def viewtestfile1_file ( filename ) :
def viewtestfile1_file ( filename ) :
return redirect ( " /static/viewer/web/viewer.html?file= %2F uploads %2F " + urlquote ( filename ) )
return redirect ( " /static/viewer/web/viewer.html?file= %2F uploads %2F " + urlquote ( filename ) )
@ -673,6 +686,7 @@ def search_annot():
res = get_annot_results ( annot , name )
res = get_annot_results ( annot , name )
return render_template ( ' results_annot.html ' , name = name , annot = annot , res = res , books = books )
return render_template ( ' results_annot.html ' , name = name , annot = annot , res = res , books = books )
## STACKS!
## STACKS!
@app.route ( ' /add_to_stack/<int:id> ' , methods = [ ' GET ' , ' POST ' ] )
@app.route ( ' /add_to_stack/<int:id> ' , methods = [ ' GET ' , ' POST ' ] )