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:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2018-01-24 10:23:59 +0300
committerGitHub <noreply@github.com>2018-01-24 10:23:59 +0300
commitca756a3603c923bb8ebe881df84c3baa651181c3 (patch)
tree2c29ce04f4508eea93186976a7a0b10ceb0a0fd4
parent7f2a61b5d9643cb63d22c414df34911cbd23c092 (diff)
parentb28438611f3ccf78964bc83d664a7bcf11ecd307 (diff)
Merge pull request #149 from ONLYOFFICE/developv1.2.0
Release/1.2.0
-rw-r--r--CHANGELOG.md11
-rw-r--r--appinfo/application.php2
-rw-r--r--appinfo/info.xml4
-rw-r--r--assets/pt_BR/new.docxbin8466 -> 9710 bytes
-rw-r--r--assets/pt_BR/new.pptxbin35671 -> 30742 bytes
-rw-r--r--assets/pt_BR/new.xlsxbin6437 -> 6048 bytes
-rw-r--r--controller/editorcontroller.php21
-rw-r--r--controller/settingscontroller.php1
-rw-r--r--js/editor.js13
-rw-r--r--l10n/pt_BR.js49
-rw-r--r--l10n/pt_BR.json47
-rw-r--r--lib/appconfig.php25
-rw-r--r--lib/documentservice.php4
-rw-r--r--templates/editor.php6
14 files changed, 160 insertions, 23 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/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/appinfo/info.xml b/appinfo/info.xml
index 1fdb8d7..274b00b 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -7,7 +7,7 @@
<description>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.</description>
<licence>agpl</licence>
<author>Ascensio System SIA</author>
- <version>1.1.6</version>
+ <version>1.2.0</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
@@ -29,7 +29,7 @@
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-owncloud/master/screenshots/settings.png</screenshot>
<dependencies>
<owncloud min-version="9.0" max-version="10.0" />
- <nextcloud min-version="11" max-version="12"/>
+ <nextcloud min-version="11" max-version="13"/>
</dependencies>
<settings>
<admin>OCA\Onlyoffice\AdminSettings</admin>
diff --git a/assets/pt_BR/new.docx b/assets/pt_BR/new.docx
index 133b3b5..1339e2f 100644
--- a/assets/pt_BR/new.docx
+++ b/assets/pt_BR/new.docx
Binary files differ
diff --git a/assets/pt_BR/new.pptx b/assets/pt_BR/new.pptx
index 0f18234..2656449 100644
--- a/assets/pt_BR/new.pptx
+++ b/assets/pt_BR/new.pptx
Binary files differ
diff --git a/assets/pt_BR/new.xlsx b/assets/pt_BR/new.xlsx
index 3b301e7..d4c26dc 100644
--- a/assets/pt_BR/new.xlsx
+++ b/assets/pt_BR/new.xlsx
Binary files differ
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index 6d1c05c..e0ffd9f 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -105,6 +105,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
* @param IRootFolder $root - root folder
@@ -162,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));
@@ -221,7 +226,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 +354,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));
@@ -376,9 +381,14 @@ 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" => pathinfo($fileName, PATHINFO_EXTENSION),
+ "fileType" => $ext,
"key" => DocumentService::GenerateRevisionId($key),
"title" => $fileName,
"url" => $fileUrl,
@@ -397,7 +407,8 @@ class EditorController extends Controller {
"id" => $userId,
"name" => $this->userSession->getUser()->getDisplayName()
]
- ]
+ ],
+ "type" => $type
];
if (!empty($this->config->GetDocumentServerSecret())) {
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/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/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 '<documentserver>' 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 '<documentserver>' 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 '<documentserver>' 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 '<documentserver>' 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);"
+}
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 2be5943..6979e45 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -121,6 +121,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
*/
public function __construct($AppName) {
@@ -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
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
)
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 @@
<div id="app">
- <div id="iframeEditor"></div>
+ <div id="iframeEditor" data-id="<?php p($_["fileId"]) ?>"></div>
<?php if (!empty($_["documentServerUrl"])) {
print_unescaped("<script nonce=\"") .
@@ -40,8 +40,4 @@
print_unescaped("web-apps/apps/api/documents/api.js\" type=\"text/javascript\"></script>");
} ?>
- <script type="text/javascript" nonce="<?php p(base64_encode($_["requesttoken"])) ?>">
- OCA.Onlyoffice.OpenEditor("<?php p($_["fileId"]) ?>", "<?php empty($_["error"]) ? "" : p($_["error"]) ?>");
- </script>
-
</div>