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:
-rw-r--r--appinfo/routes.php1
-rw-r--r--controller/editorcontroller.php48
-rw-r--r--js/editor.js33
-rw-r--r--l10n/bg.js3
-rw-r--r--l10n/bg.json3
-rw-r--r--l10n/de.js3
-rw-r--r--l10n/de.json3
-rw-r--r--l10n/de_DE.js3
-rw-r--r--l10n/de_DE.json3
-rw-r--r--l10n/es.js3
-rw-r--r--l10n/es.json3
-rw-r--r--l10n/fr.js3
-rw-r--r--l10n/fr.json3
-rw-r--r--l10n/pt_BR.js3
-rw-r--r--l10n/pt_BR.json3
-rw-r--r--l10n/ru.js3
-rw-r--r--l10n/ru.json3
-rw-r--r--l10n/sv.js3
-rw-r--r--l10n/sv.json3
19 files changed, 113 insertions, 17 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 11c170e..505c1f5 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -38,6 +38,7 @@ return [
["name" => "editor#create", "url" => "/ajax/new", "verb" => "POST"],
["name" => "editor#convert", "url" => "/ajax/convert", "verb" => "POST"],
["name" => "editor#save", "url" => "/ajax/save", "verb" => "POST"],
+ ["name" => "editor#url", "url" => "/ajax/url", "verb" => "GET"],
["name" => "settings#save_address", "url" => "/ajax/settings/address", "verb" => "PUT"],
["name" => "settings#save_common", "url" => "/ajax/settings/common", "verb" => "PUT"],
["name" => "settings#get_settings", "url" => "/ajax/settings", "verb" => "GET"],
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index 4fc9e3d..87166fb 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -423,6 +423,54 @@ class EditorController extends Controller {
}
/**
+ * Get presigned url to file
+ *
+ * @param string $filePath - file path
+ *
+ * @return array
+ *
+ * @NoAdminRequired
+ */
+ public function url($filePath) {
+ $this->logger->debug("Save: " . $name, array("app" => $this->appName));
+
+ if (!$this->config->isUserAllowedToUse()) {
+ return ["error" => $this->trans->t("Not permitted")];
+ }
+
+ $userId = $this->userSession->getUser()->getUID();
+ $userFolder = $this->root->getUserFolder($userId);
+
+ $file = $userFolder->get($filePath);
+
+ if ($file === NULL) {
+ $this->logger->error("File for generate presigned url was not found: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("File not found")];
+ }
+ if (!$file->isReadable()) {
+ $this->logger->error("Folder for saving file without permission: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("You do not have enough permissions to view the file")];
+ }
+
+ $fileName = $file->getName();
+ $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
+ $fileId = $file->getId();
+ $fileUrl = $this->getUrl($fileId);
+
+ $result = [
+ "fileType" => $ext,
+ "url" => $fileUrl
+ ];
+
+ if (!empty($this->config->GetDocumentServerSecret())) {
+ $token = \Firebase\JWT\JWT::encode($result, $this->config->GetDocumentServerSecret());
+ $result["token"] = $token;
+ }
+
+ return $result;
+ }
+
+ /**
* Print editor section
*
* @param integer $fileId - file identifier
diff --git a/js/editor.js b/js/editor.js
index c1bab5f..5d6a1f7 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -107,9 +107,10 @@
if (OC.currentUser) {
config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs;
+ config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage;
}
- var docEditor = new DocsAPI.DocEditor("iframeEditor", config);
+ OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config);
if (config.type === "mobile" && $("#app > iframe").css("position") === "fixed") {
$("#app > iframe").css("height", "calc(100% - 50px)");
@@ -150,6 +151,36 @@
OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Save as"), saveAs, false, "httpd/unix-directory");
};
+ OCA.Onlyoffice.onRequestInsertImage = function() {
+
+ var insertImage = function(filePath) {
+ $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}",
+ {
+ filePath: filePath
+ }),
+ function onSuccess(response) {
+ if (response.error) {
+ OC.Notification.show(response.error, {
+ type: "error",
+ timeout: 3
+ });
+ return;
+ }
+
+ OCA.Onlyoffice.docEditor.insertImage(response);
+ });
+ };
+
+ var imageMimes = [
+ "image/bmp", "image/x-bmp", "image/x-bitmap", "application/bmp",
+ "image/gif",
+ "image/jpeg", "image/jpg", "application/jpg", "application/x-jpg",
+ "image/png", "image/x-png", "application/png", "application/x-png"
+ ];
+
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"), insertImage, false, imageMimes);
+ };
+
$(document).ready(OCA.Onlyoffice.InitEditor);
})(jQuery, OCA);
diff --git a/l10n/bg.js b/l10n/bg.js
index 737256e..281b9ff 100644
--- a/l10n/bg.js
+++ b/l10n/bg.js
@@ -46,6 +46,7 @@ OC.L10N.register(
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
"Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи",
"Save as" : "Запази като",
- "File saved" : "Файлът е запазен"
+ "File saved" : "Файлът е запазен",
+ "Insert image" : "Вмъкване на изображение"
},
"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");
diff --git a/l10n/bg.json b/l10n/bg.json
index 5e0badb..cfb51f0 100644
--- a/l10n/bg.json
+++ b/l10n/bg.json
@@ -44,6 +44,7 @@
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
"Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи",
"Save as" : "Запази като",
- "File saved" : "Файлът е запазен"
+ "File saved" : "Файлът е запазен",
+ "Insert image" : "Вмъкване на изображение"
},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"
} \ No newline at end of file
diff --git a/l10n/de.js b/l10n/de.js
index 3de2cdf..5485c4a 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Hilfetaste anzeigen",
"Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
"Save as" : "Speichern als",
- "File saved" : "Datei wurde gespeichert"
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de.json b/l10n/de.json
index e11c2cd..d173e8a 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Hilfetaste anzeigen",
"Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
"Save as" : "Speichern als",
- "File saved" : "Datei wurde gespeichert"
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/l10n/de_DE.js b/l10n/de_DE.js
index 8c5353e..4758721 100644
--- a/l10n/de_DE.js
+++ b/l10n/de_DE.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Hilfetaste anzeigen",
"Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
"Save as" : "Speichern als",
- "File saved" : "Datei wurde gespeichert"
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index 3971152..ac22011 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Hilfetaste anzeigen",
"Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
"Save as" : "Speichern als",
- "File saved" : "Datei wurde gespeichert"
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/l10n/es.js b/l10n/es.js
index 997fc00..c3015f6 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Mostrar el botón de Ayuda",
"Display toolbar tabs" : "Mostrar pestañas de barra de herramientas",
"Save as" : "Guardar como",
- "File saved" : "El archivo ha sido guardado"
+ "File saved" : "El archivo ha sido guardado",
+ "Insert image" : "Insertar imagen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/es.json b/l10n/es.json
index 46d65ba..a5a05bc 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Mostrar el botón de Ayuda",
"Display toolbar tabs" : "Mostrar pestañas de barra de herramientas",
"Save as" : "Guardar como",
- "File saved" : "El archivo ha sido guardado"
+ "File saved" : "El archivo ha sido guardado",
+ "Insert image" : "Insertar imagen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/l10n/fr.js b/l10n/fr.js
index ef64ecf..2deb5bc 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Afficher le bouton du menu 'Aide'",
"Display toolbar tabs" : "Afficher les onglets de la barre d'outils",
"Save as" : "Enregistrer sous",
- "File saved" : "Le fichier a été enregistré"
+ "File saved" : "Le fichier a été enregistré",
+ "Insert image" : "Insérer une image"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/fr.json b/l10n/fr.json
index 4d15a74..747310d 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Afficher le bouton du menu 'Aide'",
"Display toolbar tabs" : "Afficher les onglets de la barre d'outils",
"Save as" : "Enregistrer sous",
- "File saved" : "Le fichier a été enregistré"
+ "File saved" : "Le fichier a été enregistré",
+ "Insert image" : "Insérer une image"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js
index ff74a50..470c555 100644
--- a/l10n/pt_BR.js
+++ b/l10n/pt_BR.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Exibir o botão do menu Ajuda",
"Display toolbar tabs" : "Exibir guias da barra de ferramentas",
"Save as" : "Salvar como",
- "File saved" : "O arquivo foi salvo"
+ "File saved" : "O arquivo foi salvo",
+ "Insert image" : "Inserir imagem"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json
index e62846f..47d82ef 100644
--- a/l10n/pt_BR.json
+++ b/l10n/pt_BR.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Exibir o botão do menu Ajuda",
"Display toolbar tabs" : "Exibir guias da barra de ferramentas",
"Save as" : "Salvar como",
- "File saved" : "O arquivo foi salvo"
+ "File saved" : "O arquivo foi salvo",
+ "Insert image" : "Inserir imagem"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/ru.js b/l10n/ru.js
index d5624f8..3191d56 100644
--- a/l10n/ru.js
+++ b/l10n/ru.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Отображать кнопку справки",
"Display toolbar tabs" : "Отображать вкладки панели инструментов",
"Save as" : "Сохранить как",
- "File saved" : "Файл сохранён"
+ "File saved" : "Файл сохранён",
+ "Insert image" : "Вставить изображение"
},
"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");
diff --git a/l10n/ru.json b/l10n/ru.json
index f20a06e..262dae4 100644
--- a/l10n/ru.json
+++ b/l10n/ru.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Отображать кнопку справки",
"Display toolbar tabs" : "Отображать вкладки панели инструментов",
"Save as" : "Сохранить как",
- "File saved" : "Файл сохранён"
+ "File saved" : "Файл сохранён",
+ "Insert image" : "Вставить изображение"
},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"
} \ No newline at end of file
diff --git a/l10n/sv.js b/l10n/sv.js
index 115b8a0..bbaa170 100644
--- a/l10n/sv.js
+++ b/l10n/sv.js
@@ -55,6 +55,7 @@ OC.L10N.register(
"Display Help menu button" : "Visa hjälp i menyn",
"Display toolbar tabs" : "Visa flikar i verktygsfältet",
"Save as" : "Spara som",
- "File saved" : "Filen har sparats"
+ "File saved" : "Filen har sparats",
+ "Insert image" : "Infoga bild"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/sv.json b/l10n/sv.json
index ecebf51..1bad190 100644
--- a/l10n/sv.json
+++ b/l10n/sv.json
@@ -53,6 +53,7 @@
"Display Help menu button" : "Visa hjälp i menyn",
"Display toolbar tabs" : "Visa flikar i verktygsfältet",
"Save as" : "Spara som",
- "File saved" : "Filen har sparats"
+ "File saved" : "Filen har sparats",
+ "Insert image" : "Infoga bild"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file