From b2519fdb1ffc90189a32865e9464b51628c3c7ae Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Wed, 20 Dec 2017 13:47:26 +0300 Subject: initialization on document ready (#123) --- js/editor.js | 13 +++++-------- templates/editor.php | 6 +----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/js/editor.js b/js/editor.js index 45585f3..9ca1b8e 100644 --- a/js/editor.js +++ b/js/editor.js @@ -32,18 +32,13 @@ }; } - OCA.Onlyoffice.OpenEditor = function (fileId, error) { - + OCA.Onlyoffice.InitEditor = function () { var displayError = function (error) { $("#iframeEditor").text(error).addClass("error"); }; - if (error.length) { - displayError(error) - return; - } - - if (!fileId.length) { + var fileId = $("#iframeEditor").data("id"); + if (!fileId) { displayError(t(OCA.Onlyoffice.AppName, "FileId is empty")); return; } @@ -93,4 +88,6 @@ }); }; + $(document).ready(OCA.Onlyoffice.InitEditor); + })(jQuery, OCA); \ No newline at end of file diff --git a/templates/editor.php b/templates/editor.php index 40f1296..8fc4c9e 100644 --- a/templates/editor.php +++ b/templates/editor.php @@ -30,7 +30,7 @@
-
+
">
"); } ?> - -
-- cgit v1.2.3 From 860467f7392f0d1b5ddc1f0847cd957995b31cf9 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Sat, 23 Dec 2017 16:06:12 +0300 Subject: Removing case sensitivity in extension (#138) --- controller/editorcontroller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index 6d1c05c..b24aa01 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -221,7 +221,7 @@ class EditorController extends Controller { } $fileName = $file->getName(); - $ext = pathinfo($fileName, PATHINFO_EXTENSION); + $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); $format = $this->config->formats[$ext]; if (!isset($format)) { $this->logger->info("Format for convertion not supported: " . $fileName, array("app" => $this->appName)); @@ -349,7 +349,7 @@ class EditorController extends Controller { } $fileName = $file->getName(); - $ext = pathinfo($fileName, PATHINFO_EXTENSION); + $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); $format = $this->config->formats[$ext]; if (!isset($format)) { $this->logger->info("Format is not supported for editing: " . $fileName, array("app" => $this->appName)); @@ -378,7 +378,7 @@ class EditorController extends Controller { $params = [ "document" => [ - "fileType" => pathinfo($fileName, PATHINFO_EXTENSION), + "fileType" => $ext, "key" => DocumentService::GenerateRevisionId($key), "title" => $fileName, "url" => $fileUrl, -- cgit v1.2.3 From e4385b3010f2405a7088fc93469f9dbdd2f7714f Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Sat, 23 Dec 2017 17:23:26 +0300 Subject: reduced timeout --- lib/documentservice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/documentservice.php b/lib/documentservice.php index 3f16e9b..e118c09 100644 --- a/lib/documentservice.php +++ b/lib/documentservice.php @@ -155,7 +155,7 @@ class DocumentService { $opts = array("http" => array( "method" => "POST", - "timeout" => "120000", + "timeout" => "120", "header"=> "Content-type: application/json\r\n", "content" => $data ) @@ -270,7 +270,7 @@ class DocumentService { $opts = array("http" => array( "method" => "POST", - "timeout" => "120000", + "timeout" => "60", "header"=> "Content-type: application/json\r\n", "content" => $data ) -- cgit v1.2.3 From ff0a5e3f2298bd346779a082ef6e675307c2b73a Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 25 Dec 2017 11:11:54 +0300 Subject: detecting mobile --- controller/editorcontroller.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index b24aa01..11603df 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -104,6 +104,11 @@ class EditorController extends Controller { */ private $crypt; + /** + * Mobile regex from https://github.com/ONLYOFFICE/CommunityServer/blob/v9.1.1/web/studio/ASC.Web.Studio/web.appsettings.config#L35 + */ + const USER_AGENT_MOBILE = "/android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i"; + /** * @param string $AppName - application name * @param IRequest $request - request object @@ -376,6 +381,11 @@ class EditorController extends Controller { $callback = str_replace($this->urlGenerator->getAbsoluteURL("/"), $this->config->GetStorageUrl(), $callback); } + $type = "desktop"; + if (\OC::$server->getRequest()->isUserAgent([$this::USER_AGENT_MOBILE])) { + $type = "mobile"; + } + $params = [ "document" => [ "fileType" => $ext, @@ -397,7 +407,8 @@ class EditorController extends Controller { "id" => $userId, "name" => $this->userSession->getUser()->getDisplayName() ] - ] + ], + "type" => $type ]; if (!empty($this->config->GetDocumentServerSecret())) { -- cgit v1.2.3 From c3be641816121e898ff3588d20c9ace36927d1be Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 25 Dec 2017 15:29:59 +0300 Subject: do not open the editor with incorrect settings --- appinfo/application.php | 2 +- controller/settingscontroller.php | 1 + lib/appconfig.php | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/appinfo/application.php b/appinfo/application.php index b71b43f..4b7ba89 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -63,7 +63,7 @@ class Application extends App { $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener("OCA\Files::loadAdditionalScripts", function() { - if (!empty($this->appConfig->GetDocumentServerUrl())) { + if (!empty($this->appConfig->GetDocumentServerUrl()) && $this->appConfig->SettingsAreSuccessful()) { Util::addScript("onlyoffice", "main"); Util::addStyle("onlyoffice", "main"); } diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index 86f34f1..0726e56 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -157,6 +157,7 @@ class SettingsController extends Controller { $documentserver = $this->config->GetDocumentServerUrl(); if (!empty($documentserver)) { $error = $this->checkDocServiceUrl(); + $this->config->SetSettingsError($error); } $this->config->DropSKey(); diff --git a/lib/appconfig.php b/lib/appconfig.php index 2be5943..6979e45 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -120,6 +120,13 @@ class AppConfig { */ private $_jwtHeader = "jwt_header"; + /** + * The config key for the settings error + * + * @var string + */ + private $_settingsError = "settings_error"; + /** * @param string $AppName - application name */ @@ -366,6 +373,24 @@ class AppConfig { return $header; } + /** + * Save the status settings + * + * @param boolean $value - error + */ + public function SetSettingsError($value) { + $this->config->setAppValue($this->appName, $this->_settingsError, $value); + } + + /** + * Get the status settings + * + * @return boolean + */ + public function SettingsAreSuccessful() { + return empty($this->config->getAppValue($this->appName, $this->_settingsError, "")); + } + /** * Additional data about formats -- cgit v1.2.3 From 57de00bdaa83361a800cb8e9d3ba787f5698992d Mon Sep 17 00:00:00 2001 From: Gustavo Arnosti Neves Date: Tue, 26 Dec 2017 16:31:07 -0200 Subject: Brazilian Poruguese translation added --- l10n/pt_BR.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ l10n/pt_BR.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 l10n/pt_BR.js create mode 100644 l10n/pt_BR.json diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js new file mode 100644 index 0000000..580207e --- /dev/null +++ b/l10n/pt_BR.js @@ -0,0 +1,49 @@ +OC.L10N.register( + "onlyoffice", + { + "Access denied" : "Acesso negado", + "Invalid request" : "Solicitação inválida", + "Files not found" : "Arquivos não encontrados", + "File not found" : "Arquivo não encontrado", + "Not permitted" : "Não permitido", + "Download failed" : "Baixar arquivo falhou", + "The required folder was not found" : "A pasta requisitada não foi encontrada", + "You don't have enough permission to create" : "Você não tem permissões suficientes para criar", + "Template not found" : "Modelo não encontrado", + "Can't create file" : "Não é possível criar o arquivo", + "Format is not supported" : "Formato não suportado", + "Conversion is not required" : "Não é necessário converter", + "Failed to download converted file" : "Falha ao baixar arquivo convertido", + "ONLYOFFICE app is not configured. Please contact admin" : "Aplicação ONLYOFFICE não está configurada. Favor contatar o administrador", + "FileId is empty" : "FileId (ID de arquivo) está vazio", + "You do not have enough permissions to view the file" : "Você não tem permissões suficientes para ver o arquivo", + "Error occurred in the document service" : "Ocorreu um erro no serviço de documentos", + "Not supported version" : "Versão não suportada", + "ONLYOFFICE cannot be reached. Please contact admin" : "Não foi possível conectar ao ONLYOFFICE. Favor contatar o administrador.", + "Loading, please wait." : "Carregando, por favor aguarde.", + "File created" : "Arquivo criado", + "The document file you open will be converted to the Office Open XML format for faster viewing and editing." : "O documento será convertido para o formato Office Open XML para melhor edição e visualização.", + "Convert and open document" : "Converter e abrir o documento", + "Open in ONLYOFFICE" : "Abrir no ONLYOFFICE", + "Document" : "Documento", + "Spreadsheet" : "Planilha", + "Presentation" : "Apresentação", + "Error when trying to connect" : "Erro ao tentar conectar", + "Settings have been successfully updated" : "Configurações salvas com sucesso", + "Bad Request or timeout error" : "Pedido ruim ou erro de limite de tempo", + "Server can't read xml" : "Servidor não pode ler xml", + "Bad Response. Errors: " : "Resposta ruim. Erros:", + "Documentation" : "Documentação", + "ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '' for the server address in the below line." : "O Endereço do Serviço de Edição de Documentos especifica o servidor onde o serviço de documentos está instalado.\nPor favor mude '' para o endereço do servidor na linha abaixo.", + "Encryption App is enabled, the application cannot work. You can continue working with the application if you enable master key." : "A criptografia de arquivos está ativada, este aplicativo não pode operar. Ative a chave mestre se quiser continuar trabalhando.", + "Document Editing Service address" : "Endereço do Serviço de Edição de Documentos", + "Advanced server settings" : "Configurações avançadas do servidor", + "Document Editing Service address for internal requests from the server" : "Endereço do Serviço de Edição de Documentos para pedidos internos do servidor", + "Server address for internal requests from the Document Editing Service" : "Endereço do servidor para pedidos internos do Serviço de Edição de Documentos", + "Secret key (leave blank to disable)" : "Chave secreta (deixe em branco para desativar)", + "Open file in the same tab" : "Abrir arquivo na mesma aba", + "The default application for opening the format" : "Aplicação padrão para os formatos", + "Save" : "Salvar", + "Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Conteúdo Misto não é permitido. É necessário um endereço HTTPS para o Servidor de Documentos." +}, +"nplurals=2; plural=(n != 1);"); diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json new file mode 100644 index 0000000..943df08 --- /dev/null +++ b/l10n/pt_BR.json @@ -0,0 +1,47 @@ +{ "translations": { + "Access denied" : "Acesso negado", + "Invalid request" : "Solicitação inválida", + "Files not found" : "Arquivos não encontrados", + "File not found" : "Arquivo não encontrado", + "Not permitted" : "Não permitido", + "Download failed" : "Baixar arquivo falhou", + "The required folder was not found" : "A pasta requisitada não foi encontrada", + "You don't have enough permission to create" : "Você não tem permissões suficientes para criar", + "Template not found" : "Modelo não encontrado", + "Can't create file" : "Não é possível criar o arquivo", + "Format is not supported" : "Formato não suportado", + "Conversion is not required" : "Não é necessário converter", + "Failed to download converted file" : "Falha ao baixar arquivo convertido", + "ONLYOFFICE app is not configured. Please contact admin" : "Aplicação ONLYOFFICE não está configurada. Favor contatar o administrador", + "FileId is empty" : "FileId (ID de arquivo) está vazio", + "You do not have enough permissions to view the file" : "Você não tem permissões suficientes para ver o arquivo", + "Error occurred in the document service" : "Ocorreu um erro no serviço de documentos", + "Not supported version" : "Versão não suportada", + "ONLYOFFICE cannot be reached. Please contact admin" : "Não foi possível conectar ao ONLYOFFICE. Favor contatar o administrador.", + "Loading, please wait." : "Carregando, por favor aguarde.", + "File created" : "Arquivo criado", + "The document file you open will be converted to the Office Open XML format for faster viewing and editing." : "O documento será convertido para o formato Office Open XML para melhor edição e visualização.", + "Convert and open document" : "Converter e abrir o documento", + "Open in ONLYOFFICE" : "Abrir no ONLYOFFICE", + "Document" : "Documento", + "Spreadsheet" : "Planilha", + "Presentation" : "Apresentação", + "Error when trying to connect" : "Erro ao tentar conectar", + "Settings have been successfully updated" : "Configurações salvas com sucesso", + "Bad Request or timeout error" : "Pedido ruim ou erro de limite de tempo", + "Server can't read xml" : "Servidor não pode ler xml", + "Bad Response. Errors: " : "Resposta ruim. Erros:", + "Documentation" : "Documentação", + "ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '' for the server address in the below line." : "O Endereço do Serviço de Edição de Documentos especifica o servidor onde o serviço de documentos está instalado.\nPor favor mude '' para o endereço do servidor na linha abaixo.", + "Encryption App is enabled, the application cannot work. You can continue working with the application if you enable master key." : "A criptografia de arquivos está ativada, este aplicativo não pode operar. Ative a chave mestre se quiser continuar trabalhando.", + "Document Editing Service address" : "Endereço do Serviço de Edição de Documentos", + "Advanced server settings" : "Configurações avançadas do servidor", + "Document Editing Service address for internal requests from the server" : "Endereço do Serviço de Edição de Documentos para pedidos internos do servidor", + "Server address for internal requests from the Document Editing Service" : "Endereço do servidor para pedidos internos do Serviço de Edição de Documentos", + "Secret key (leave blank to disable)" : "Chave secreta (deixe em branco para desativar)", + "Open file in the same tab" : "Abrir arquivo na mesma aba", + "The default application for opening the format" : "Aplicação padrão para os formatos", + "Save" : "Salvar", + "Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Conteúdo Misto não é permitido. É necessário um endereço HTTPS para o Servidor de Documentos." +},"pluralForm" :"nplurals=2; plural=(n != 1);" +} -- cgit v1.2.3 From 6818d0031e101cac3551b7668953aaefd3f0ff70 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 18 Jan 2018 11:22:45 +0300 Subject: search existing file name in current folder (#147) --- controller/editorcontroller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index 11603df..e0ffd9f 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -167,7 +167,7 @@ class EditorController extends Controller { return ["error" => $this->trans->t("You don't have enough permission to create")]; } - $name = $userFolder->getNonExistingName($name); + $name = $folder->getNonExistingName($name); $filePath = $dir . DIRECTORY_SEPARATOR . $name; $ext = strtolower("." . pathinfo($filePath, PATHINFO_EXTENSION)); -- cgit v1.2.3 From 81ad0c5fad0ca61a9df178dc3cdf4ccd6724aae5 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 18 Jan 2018 11:27:11 +0300 Subject: update file samples pt-BR (#142) --- assets/pt_BR/new.docx | Bin 8466 -> 9710 bytes assets/pt_BR/new.pptx | Bin 35671 -> 30742 bytes assets/pt_BR/new.xlsx | Bin 6437 -> 6048 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/assets/pt_BR/new.docx b/assets/pt_BR/new.docx index 133b3b5..1339e2f 100644 Binary files a/assets/pt_BR/new.docx and b/assets/pt_BR/new.docx differ diff --git a/assets/pt_BR/new.pptx b/assets/pt_BR/new.pptx index 0f18234..2656449 100644 Binary files a/assets/pt_BR/new.pptx and b/assets/pt_BR/new.pptx differ diff --git a/assets/pt_BR/new.xlsx b/assets/pt_BR/new.xlsx index 3b301e7..d4c26dc 100644 Binary files a/assets/pt_BR/new.xlsx and b/assets/pt_BR/new.xlsx differ -- cgit v1.2.3 From b28438611f3ccf78964bc83d664a7bcf11ecd307 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Wed, 24 Jan 2018 10:20:53 +0300 Subject: 1.2.0 --- CHANGELOG.md | 11 +++++++++++ appinfo/info.xml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f07c1b9..df230fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 1.2.0 +## Added +- disabling for incorrect settings +- Brazilian Poruguese translation +- detecting mobile + +## Changed +- initialization script +- case sensitivity in extension +- сreating files with an existing name + ## 1.1.6 ## Changed - update description diff --git a/appinfo/info.xml b/appinfo/info.xml index 1fdb8d7..274b00b 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -7,7 +7,7 @@ ONLYOFFICE connector enables you to edit Office documents within ONLYOFFICE from the familiar web interface. This will create a new Open in ONLYOFFICE action within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to your file storage. agpl Ascensio System SIA - 1.1.6 + 1.2.0 Onlyoffice @@ -29,7 +29,7 @@ https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-owncloud/master/screenshots/settings.png - + OCA\Onlyoffice\AdminSettings -- cgit v1.2.3