diff --git a/app/getannot.py b/app/getannot.py
index 69e39df..aa23cee 100644
--- a/app/getannot.py
+++ b/app/getannot.py
@@ -57,19 +57,20 @@ def get_annot_results(annot,name):
return res
def get_annot_book(annot,name):
- bannot=[]
- annot=get_annotations()
+ res=[]
for item in annot['rows']:
if 'selector' in item['target'][0]:
if len(item['target'][0]['selector'])>2:
- if name==item['uri']:
+ string=item['uri']
+ if name==string.replace('http://localhost:8080/uploads/',''):
data={'text': item['text'],'extract':item['target'][0]['selector'][2]['exact'],'title':item['document']['title'], 'url':item['uri']}
- bannot.append(data)
+ res.append(data)
else:
- if name in item['uri']:
+ string=item['uri']
+ if name==string.replace('http://localhost:8080/uploads/',''):
data={'text': item['text'],'extract':item['target'][0]['selector'][1]['exact'],'title':item['document']['title'], 'url':item['uri']}
- bannot.append(data)
- return bannot
+ res.append(data)
+ return res
diff --git a/app/templates/results_annot.html b/app/templates/results_annot.html
index 96f959f..e6d008f 100644
--- a/app/templates/results_annot.html
+++ b/app/templates/results_annot.html
@@ -18,7 +18,6 @@
{% for row in res %}
-
{%for book in books%}
{%if book.file == row.url|replace('http://localhost:8080/uploads/','')%}
Book
diff --git a/app/templates/show_book_detail.html b/app/templates/show_book_detail.html
index f9b73a8..23b9fc2 100755
--- a/app/templates/show_book_detail.html
+++ b/app/templates/show_book_detail.html
@@ -66,6 +66,34 @@
+
+
+
Annotations for {{book.title}}:
+{% for row in res%}
+
Extract
+
+ "{{ row.extract }}"
+
+
Annotation
+{%if 'https://www.youtube.com'in row.text %}
+
{{row.text}}
+
+ {%elif '.jpg' in row.text%}
+
+
+ {%else%}
+
{{row.text}}
+
+ {% endif %}
+{% endfor %}
+
+
+
+
+
+
+
+
Instances:
@@ -88,6 +116,11 @@
+
+
+
+
+
{% if book.file %}
@@ -114,30 +147,7 @@
-{% for row in bannot %}
- {%for book in books%}
- {%if book.file == row.uri%}
-
{{book.title}}
- {% endif %}
- {% endfor %}
-
{{row.title}}
-
-
Extracts:
-
- "{{ row.extract }}"
-
Annotations:
-{%if 'https://www.youtube.com'in row.text %}
-
{{row.text}}
-
- {%elif '.jpg' in row.text%}
-
-
- {%else%}
-
{{row.text}}
-
- {% endif %}
- {%endfor%}
{% endblock %}
diff --git a/app/views.py b/app/views.py
index 1cfbb63..6e93ea1 100755
--- a/app/views.py
+++ b/app/views.py
@@ -154,6 +154,12 @@ def show_book_by_id(id):
if id == edge:
nextbook = None
+ name= book.file
+ annot = get_annotations()
+ res = get_annot_book(annot,name)
+
+
+
userin = UserIns.query.filter_by(title="lastViewed").first()
if userin != None:
userin.info = book.title
@@ -165,17 +171,10 @@ def show_book_by_id(id):
if not book:
return render_template('red_link.html', id=id)
else:
- return render_template('show_book_detail.html', book=book, previousbook = previousbook, nextbook = nextbook, all_instances=all_instances)
+ return render_template('show_book_detail.html', book=book, previousbook = previousbook, nextbook = nextbook, all_instances=all_instances, name=name, annot=annot, res=res)
-@app.route('/books/
/annotations', methods=['POST', 'GET'])
-def book_annot():
- books = db.session.query(Book).all()
- name=book.file
- annot = get_annotations()
- res = get_annot_book(annot,name)
- return redirect(url_for('show_book_detail'), name=name, annot=annot, res=res, books=books)
@app.route('/books//delete', methods=['POST', 'GET'])
@@ -593,13 +592,10 @@ def search_results(searchtype, query, viewby):
@app.route('/search_annot', methods=['POST', 'GET'])
def search_annot():
books = db.session.query(Book).all()
- if request.method=='POST':
- return redirect (url_for('annotations'))
- else:
- name=str(request.args.get('query'))
- annot = get_annotations()
- res = get_annot_results(annot,name)
- return render_template('results_annot.html', name=name, annot=annot, res=res, books=books)
+ name=str(request.args.get('query'))
+ annot = get_annotations()
+ res = get_annot_results(annot,name)
+ return render_template('results_annot.html', name=name, annot=annot, res=res, books=books)
@app.route('/add_to_stack/', methods=['GET', 'POST'])