Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-10-04 16:52:13 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-10-04 16:53:36 +0300
commitd6b65b79835bc499f720d15bb6c00441079b2fd6 (patch)
treecfd89c186eeab232dcb8d3586c47aebd6b5b5bf5 /js
parent63c74865f0a8911b1e211e14f336b68ee54bb96d (diff)
bccu#2033 Respect WOPI action names
Don't assume that the action name is 'edit' all the time. Instead, if it's view, then initialize leaflet with permission=readonly.
Diffstat (limited to 'js')
-rw-r--r--js/documents.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/js/documents.js b/js/documents.js
index 2fe101c8..105926ba 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -33,6 +33,7 @@ $.widget('oc.documentGrid', {
.attr('title', document.path)
.attr('original-title', document.path)
.attr('urlsrc', document.urlsrc)
+ .attr('action', document.action)
.attr('lolang', document.lolang)
.find('label').text(document.name)
;
@@ -408,7 +409,7 @@ var documentsMain = {
$('#revisionsContainer li').first().find('.versionPreview').click();
},
- showEditor : function(title){
+ showEditor : function(title, action){
if (documentsMain.isGuest){
// !Login page mess wih WebODF toolbars
$(document.body).attr('id', 'body-user');
@@ -420,7 +421,7 @@ var documentsMain = {
}
if (!documentsMain.renderComplete) {
- setTimeout(function() { documentsMain.UI.showEditor(title); }, 500);
+ setTimeout(function() { documentsMain.UI.showEditor(title, action); }, 500);
console.log('Waiting for page to render ...');
return;
}
@@ -454,6 +455,9 @@ var documentsMain = {
"&lang=" + $('li[data-id='+ documentsMain.fileId +']>a').attr('lolang') +
"&closebutton=1" +
"&revisionhistory=1";
+ if (action === "view") {
+ urlsrc += "&permission=readonly";
+ }
// access_token - must be passed via a form post
var access_token = encodeURIComponent(result.token);
@@ -785,7 +789,8 @@ var documentsMain = {
},
loadDocument: function() {
- documentsMain.UI.showEditor(documentsMain.fileName);
+ var action = $('li[data-id='+ documentsMain.fileId +']>a').attr('action');
+ documentsMain.UI.showEditor(documentsMain.fileName, action);
},
renameDocument: function(name) {