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

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2018-03-20 14:50:16 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2018-03-20 17:27:30 +0300
commitc3f17a93b1b8920ba00c94aed7ce31b039ada2c4 (patch)
tree3fc0c3ea41d4fa264d074c635c0ee98aaaa70a34 /js
parentd473501c9b09b7cf425983ac92de9e1c03b2daee (diff)
shared link to folder
Diffstat (limited to 'js')
-rw-r--r--js/editor.js2
-rw-r--r--js/main.js44
2 files changed, 24 insertions, 22 deletions
diff --git a/js/editor.js b/js/editor.js
index f8e77dc..803edee 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -39,7 +39,7 @@
var fileId = $("#iframeEditor").data("id");
var fileToken = $("#iframeEditor").data("token");
- if (!fileId) {
+ if (!fileId && !fileToken) {
displayError(t(OCA.Onlyoffice.AppName, "FileId is empty"));
return;
}
diff --git a/js/main.js b/js/main.js
index 257f0d9..32b2c29 100644
--- a/js/main.js
+++ b/js/main.js
@@ -79,6 +79,10 @@
fileId: fileId
});
+ if ($("#isPublic").val()) {
+ url += "?token=" + encodeURIComponent($("#sharingToken").val());
+ }
+
if (winEditor && winEditor.location) {
winEditor.location.href = url;
} else if (!OCA.Onlyoffice.setting.sameTab) {
@@ -91,7 +95,7 @@
OCA.Onlyoffice.FileClick = function (fileName, context, attr) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
var fileList = context.fileList;
- if (!attr.conv || (fileList.dirInfo.permissions & OC.PERMISSION_CREATE) !== OC.PERMISSION_CREATE) {
+ if (!attr.conv || (fileList.dirInfo.permissions & OC.PERMISSION_CREATE) !== OC.PERMISSION_CREATE || $("#isPublic").val()) {
OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
return;
}
@@ -224,31 +228,29 @@
};
- if ($("#isPublic").val()) {
- if (!$("#dir").val().length) {
- var fileName = $("#filename").val();
- var extension = fileName.substr(fileName.lastIndexOf(".") + 1);
+ if ($("#isPublic").val() && !$("#dir").val().length) {
+ var fileName = $("#filename").val();
+ var extension = fileName.substr(fileName.lastIndexOf(".") + 1);
- var initSharedButton = function() {
- var mimes = OCA.Onlyoffice.setting.formats;
+ var initSharedButton = function() {
+ var mimes = OCA.Onlyoffice.setting.formats;
- var conf = mimes[extension];
- if (conf) {
- var button = document.createElement("a");
- button.href = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + $("#sharingToken").val());
- button.className = "button";
- button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE")
-
- if (!OCA.Onlyoffice.setting.sameTab) {
- button.target = "_blank";
- }
+ var conf = mimes[extension];
+ if (conf) {
+ var button = document.createElement("a");
+ button.href = OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/s/" + encodeURIComponent($("#sharingToken").val()));
+ button.className = "button";
+ button.innerText = t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE")
- $("#preview").append(button);
+ if (!OCA.Onlyoffice.setting.sameTab) {
+ button.target = "_blank";
}
- };
- OCA.Onlyoffice.GetSettings(initSharedButton);
- }
+ $("#preview").append(button);
+ }
+ };
+
+ OCA.Onlyoffice.GetSettings(initSharedButton);
} else {
OC.Plugins.register("OCA.Files.FileList", OCA.Onlyoffice.FileList);
OC.Plugins.register("OCA.Files.NewFileMenu", OCA.Onlyoffice.NewFileMenu);