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
diff options
context:
space:
mode:
Diffstat (limited to 'js/main.js')
-rw-r--r--js/main.js44
1 files changed, 23 insertions, 21 deletions
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);