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:08:14 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2018-03-20 14:08:14 +0300
commitc5237c3e01c58c56daf4a1cada6521110c65a674 (patch)
tree7f59e21fb8b69d18b940ac458aa075bd20487fae /js
parentcc366ce2a661cfc3dbc197671853499b7819a0ba (diff)
parenta3df6a8ffcb452176d0bc6e36222fa3c39c57385 (diff)
Merge branch 'develop' into feature/share-link
# Conflicts: # controller/editorcontroller.php
Diffstat (limited to 'js')
-rw-r--r--js/editor.js2
-rw-r--r--js/main.js74
2 files changed, 48 insertions, 28 deletions
diff --git a/js/editor.js b/js/editor.js
index fa1e466..f8e77dc 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -66,7 +66,7 @@
if (docIsChanged !== event.data) {
var titleChange = function () {
- window.document.title = config.document.title + (event.data ? " *" : "") + ' - ' + oc_defaults.title;
+ window.document.title = config.document.title + (event.data ? " *" : "") + " - " + oc_defaults.title;
docIsChanged = event.data;
};
diff --git a/js/main.js b/js/main.js
index 891e7ee..b3bfefd 100644
--- a/js/main.js
+++ b/js/main.js
@@ -91,7 +91,7 @@
OCA.Onlyoffice.FileClick = function (fileName, context, attr) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
var fileList = context.fileList;
- if (!attr.conv) {
+ if (!attr.conv || (fileList.dirInfo.permissions & OC.PERMISSION_CREATE) !== OC.PERMISSION_CREATE) {
OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
return;
}
@@ -100,6 +100,7 @@
t(OCA.Onlyoffice.AppName, "Convert and open document"),
function (convert) {
if (!convert) {
+ OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
return;
}
@@ -128,38 +129,54 @@
});
};
+ OCA.Onlyoffice.GetSettings = function (callbackSettings) {
+ if (OCA.Onlyoffice.setting.formats) {
+
+ callbackSettings();
+
+ } else {
+
+ $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings"),
+ function onSuccess(settings) {
+ OCA.Onlyoffice.setting = settings;
+
+ callbackSettings();
+ }
+ );
+
+ }
+ };
+
OCA.Onlyoffice.FileList = {
attach: function (fileList) {
if (fileList.id == "trashbin") {
return;
}
- $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings"),
- function onSuccess(settings) {
- OCA.Onlyoffice.setting = settings;
- var mimes = OCA.Onlyoffice.setting.formats;
-
- OCA.Onlyoffice.mimes = mimes;
- $.each(mimes, function (ext, attr) {
- fileList.fileActions.registerAction({
- name: "onlyofficeOpen",
- displayName: t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE"),
- mime: attr.mime,
- permissions: OC.PERMISSION_READ,
- icon: function () {
- return OC.imagePath(OCA.Onlyoffice.AppName, "app-dark");
- },
- actionHandler: function (fileName, context) {
- OCA.Onlyoffice.FileClick(fileName, context, attr);
- }
- });
-
- if (attr.def) {
- fileList.fileActions.setDefault(attr.mime, "onlyofficeOpen");
+ var register = function() {
+ var mimes = OCA.Onlyoffice.setting.formats;
+
+ $.each(mimes, function (ext, attr) {
+ fileList.fileActions.registerAction({
+ name: "onlyofficeOpen",
+ displayName: t(OCA.Onlyoffice.AppName, "Open in ONLYOFFICE"),
+ mime: attr.mime,
+ permissions: OC.PERMISSION_READ,
+ icon: function () {
+ return OC.imagePath(OCA.Onlyoffice.AppName, "app-dark");
+ },
+ actionHandler: function (fileName, context) {
+ OCA.Onlyoffice.FileClick(fileName, context, attr);
}
});
- }
- );
+
+ if (attr.def) {
+ fileList.fileActions.setDefault(attr.mime, "onlyofficeOpen");
+ }
+ });
+ }
+
+ OCA.Onlyoffice.GetSettings(register);
}
};
@@ -205,7 +222,10 @@
});
}
};
+
+
+ OC.Plugins.register("OCA.Files.FileList", OCA.Onlyoffice.FileList);
+ OC.Plugins.register("OCA.Files.NewFileMenu", OCA.Onlyoffice.NewFileMenu);
+
})(OCA);
-OC.Plugins.register("OCA.Files.FileList", OCA.Onlyoffice.FileList);
-OC.Plugins.register("OCA.Files.NewFileMenu", OCA.Onlyoffice.NewFileMenu);