diff --git a/item/models.py b/item/models.py
index d39cd9c..fdc6ba8 100644
--- a/item/models.py
+++ b/item/models.py
@@ -35,6 +35,11 @@ class Item(models.Model):
done = models.BooleanField(default=False)
+ def editable(self, user):
+ if user.is_anonymous():
+ return False
+ return user.is_staff or self.user == user
+
def get_overlay(self):
return json.dumps(self.overlay)
diff --git a/item/views.py b/item/views.py
index 1218b4b..7488db5 100644
--- a/item/views.py
+++ b/item/views.py
@@ -3,7 +3,7 @@
# GPL 2013
from __future__ import division, with_statement
import os
-
+import json
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.template import RequestContext
@@ -88,10 +88,10 @@ def index(request):
def item(request, slug, edit=False):
item = get_object_or_404(models.Item, slug=slug)
- edit = edit and item.editable()
+ edit = edit and item.editable(request.user)
context = RequestContext(request, {
'item': item,
- 'edit': edit
+ 'edit': json.dumps(edit)
})
return render_to_response('item.html', context)
diff --git a/static/videoOverlay.js b/static/videoOverlay.js
index 3485f4e..6bf6e81 100644
--- a/static/videoOverlay.js
+++ b/static/videoOverlay.js
@@ -28,8 +28,11 @@ function getVideoOverlay(page) {
+ image.left + "px;";
div.appendChild(playButton(image.height/1.5));
div.onclick = function(event) {
+ event.preventDefault();
+ event.stopPropagation();
div.innerHTML = videoOverlay[page][id];
div.style.opacity = 1;
+ return false;
};
this.div.appendChild(div);
}
diff --git a/static/viewer.js b/static/viewer.js
index ba7419c..a8837da 100644
--- a/static/viewer.js
+++ b/static/viewer.js
@@ -2716,6 +2716,7 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
var file = params.file || DEFAULT_URL;
+ document.getElementById('openFile').setAttribute('hidden', 'true');
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
document.getElementById('openFile').setAttribute('hidden', 'true');
} else {
diff --git a/templates/item.html b/templates/item.html
index 366e6fe..481e1c3 100644
--- a/templates/item.html
+++ b/templates/item.html
@@ -33,6 +33,7 @@ limitations under the License.