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-09-06 13:37:03 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2018-09-11 12:11:28 +0300
commitb6f7888cb919cdb5528074dc9f6484c3c07eb58d (patch)
tree2a82732c97dc6f4e37658efaf568992be2d8adfd
parentc8ac2d9387e95d22ae75c6b8d2478915a1d838c4 (diff)
opening for editing not OOXML (#6)
-rw-r--r--controller/settingscontroller.php2
-rw-r--r--js/settings.js6
-rw-r--r--l10n/de.js2
-rw-r--r--l10n/de.json2
-rw-r--r--l10n/de_DE.js2
-rw-r--r--l10n/de_DE.json2
-rw-r--r--l10n/es.js2
-rw-r--r--l10n/es.json2
-rw-r--r--l10n/ru.js2
-rw-r--r--l10n/ru.json2
-rw-r--r--lib/appconfig.php51
-rw-r--r--templates/settings.php24
12 files changed, 89 insertions, 10 deletions
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php
index 9011ab0..1a056ce 100644
--- a/controller/settingscontroller.php
+++ b/controller/settingscontroller.php
@@ -142,6 +142,7 @@ class SettingsController extends Controller {
$storageUrl,
$secret,
$defFormats,
+ $editFormats,
$sameTab
) {
$this->config->SetDocumentServerUrl($documentserver);
@@ -158,6 +159,7 @@ class SettingsController extends Controller {
$this->config->DropSKey();
$this->config->SetDefaultFormats($defFormats);
+ $this->config->SetEditableFormats($editFormats);
$this->config->SetSameTab($sameTab);
if ($this->checkEncryptionModule()) {
diff --git a/js/settings.js b/js/settings.js
index 3bcc1bb..4c51540 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -67,6 +67,11 @@
defFormats[this.name] = this.checked;
});
+ var editFormats = {};
+ $("input[id^=\"onlyofficeEditFormat\"]").each(function() {
+ editFormats[this.name] = this.checked;
+ });
+
var sameTab = $("#onlyofficeSameTab").is(":checked");
$.ajax({
@@ -78,6 +83,7 @@
storageUrl: onlyofficeStorageUrl,
secret: onlyofficeSecret,
defFormats: defFormats,
+ editFormats: editFormats,
sameTab: sameTab
},
success: function onSuccess(response) {
diff --git a/l10n/de.js b/l10n/de.js
index b35d318..0fd00d3 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -42,6 +42,8 @@ OC.L10N.register(
"Secret key (leave blank to disable)" : "Geheimer Schlüssel (freilassen, um zu deaktivieren)",
"Open file in the same tab" : "Datei in der gleichen Registerkarte öffnen",
"The default application for opening the format" : "Die Standardanwendung zum Öffnen des Formats",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Öffne die Datei zum Bearbeiten (aufgrund von Formateinschränkungen können die Daten beim Speichern in den Formaten aus der folgenden Liste verloren gehen)",
+ "View details" : "Details anzeigen",
"Save" : "Speichern",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für Document Server ist erforderlich."
},
diff --git a/l10n/de.json b/l10n/de.json
index d5e4500..dddb082 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -40,6 +40,8 @@
"Secret key (leave blank to disable)" : "Geheimer Schlüssel (freilassen, um zu deaktivieren)",
"Open file in the same tab" : "Datei in der gleichen Registerkarte öffnen",
"The default application for opening the format" : "Die Standardanwendung zum Öffnen des Formats",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Öffne die Datei zum Bearbeiten (aufgrund von Formateinschränkungen können die Daten beim Speichern in den Formaten aus der folgenden Liste verloren gehen)",
+ "View details" : "Details anzeigen",
"Save" : "Speichern",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für Document Server ist erforderlich."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
diff --git a/l10n/de_DE.js b/l10n/de_DE.js
index 5538e9e..ac193ac 100644
--- a/l10n/de_DE.js
+++ b/l10n/de_DE.js
@@ -42,6 +42,8 @@ OC.L10N.register(
"Secret key (leave blank to disable)" : "Geheimer Schlüssel (freilassen, um zu deaktivieren)",
"Open file in the same tab" : "Datei in der gleichen Registerkarte öffnen",
"The default application for opening the format" : "Die Standardanwendung zum Öffnen des Formats",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Öffnen Sie die Datei zum Bearbeiten (aufgrund von Formateinschränkungen können die Daten beim Speichern in den Formaten aus der folgenden Liste verloren gehen)",
+ "View details" : "Details anzeigen",
"Save" : "Speichern",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für Document Server ist erforderlich."
},
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index 3f12625..3578e30 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -40,6 +40,8 @@
"Secret key (leave blank to disable)" : "Geheimer Schlüssel (freilassen, um zu deaktivieren)",
"Open file in the same tab" : "Datei in der gleichen Registerkarte öffnen",
"The default application for opening the format" : "Die Standardanwendung zum Öffnen des Formats",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Öffnen Sie die Datei zum Bearbeiten (aufgrund von Formateinschränkungen können die Daten beim Speichern in den Formaten aus der folgenden Liste verloren gehen)",
+ "View details" : "Details anzeigen",
"Save" : "Speichern",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für Document Server ist erforderlich."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
diff --git a/l10n/es.js b/l10n/es.js
index ce0b556..0c60054 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -42,6 +42,8 @@ OC.L10N.register(
"Secret key (leave blank to disable)" : "Clave secreta (deje en blanco o desactive)",
"Open file in the same tab" : "Abrir archivo en la misma pestaña",
"The default application for opening the format" : "La aplicación predeterminada para abrir el formato",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Abrir archivo para editar (debido a las restricciones de formato los datos podrían perderse al guardar en los formatos de la siguiente lista)",
+ "View details" : "Ver detalles",
"Save" : "Guardar",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Contenido Mixto Activo no está permitido. Se requiere la dirección HTTPS para Servidor de Documentos."
},
diff --git a/l10n/es.json b/l10n/es.json
index 3ac89ad..b7cfa50 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -40,6 +40,8 @@
"Secret key (leave blank to disable)" : "Clave secreta (deje en blanco o desactive)",
"Open file in the same tab" : "Abrir archivo en la misma pestaña",
"The default application for opening the format" : "La aplicación predeterminada para abrir el formato",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Abrir archivo para editar (debido a las restricciones de formato los datos podrían perderse al guardar en los formatos de la siguiente lista)",
+ "View details" : "Ver detalles",
"Save" : "Guardar",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Contenido Mixto Activo no está permitido. Se requiere la dirección HTTPS para Servidor de Documentos."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
diff --git a/l10n/ru.js b/l10n/ru.js
index 1289d5f..9ba1ec6 100644
--- a/l10n/ru.js
+++ b/l10n/ru.js
@@ -42,6 +42,8 @@ OC.L10N.register(
"Secret key (leave blank to disable)" : "Секретный ключ (оставьте пустым для отключения)",
"Open file in the same tab" : "Открыть файл в той же вкладке",
"The default application for opening the format" : "Приложение по умолчанию для открытия формата",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Открыть файл на редактирование (из-за ограничений формата данные могут быть утеряны при сохранении в форматы из списка ниже)",
+ "View details" : "Подробнее",
"Save" : "Сохранить",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смешанное активное содержимое запрещено. Для Сервера документов необходимо использовать HTTPS-адрес."
},
diff --git a/l10n/ru.json b/l10n/ru.json
index dd931cf..a923702 100644
--- a/l10n/ru.json
+++ b/l10n/ru.json
@@ -40,6 +40,8 @@
"Secret key (leave blank to disable)" : "Секретный ключ (оставьте пустым для отключения)",
"Open file in the same tab" : "Открыть файл в той же вкладке",
"The default application for opening the format" : "Приложение по умолчанию для открытия формата",
+ "Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)" : "Открыть файл на редактирование (из-за ограничений формата данные могут быть утеряны при сохранении в форматы из списка ниже)",
+ "View details" : "Подробнее",
"Save" : "Сохранить",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смешанное активное содержимое запрещено. Для Сервера документов необходимо использовать HTTPS-адрес."
},"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);"
diff --git a/lib/appconfig.php b/lib/appconfig.php
index bf8356a..d0a719a 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -96,6 +96,13 @@ class AppConfig {
private $_defFormats = "defFormats";
/**
+ * The config key for the editable formats
+ *
+ * @var string
+ */
+ private $_editFormats = "editFormats";
+
+ /**
* The config key for the setting same tab
*
* @var string
@@ -375,6 +382,31 @@ class AppConfig {
}
/**
+ * Save an array of formats that is opened for editing
+ *
+ * @param array $formats - formats with status
+ */
+ public function SetEditableFormats($formats) {
+ $value = json_encode($formats);
+ $this->logger->info("Set editing formats: " . $value, array("app" => $this->appName));
+
+ $this->config->setAppValue($this->appName, $this->_editFormats, $value);
+ }
+
+ /**
+ * Get an array of formats opening for editing
+ *
+ * @return array
+ */
+ private function GetEditableFormats() {
+ $value = $this->config->getAppValue($this->appName, $this->_editFormats, "");
+ if (empty($value)) {
+ return array();
+ }
+ return json_decode($value, true);
+ }
+
+ /**
* Save the opening setting in a same tab
*
* @param boolean $value - same tab
@@ -452,6 +484,13 @@ class AppConfig {
}
}
+ $editFormats = $this->GetEditableFormats();
+ foreach ($editFormats as $format => $setting) {
+ if (array_key_exists($format, $result)) {
+ $result[$format]["edit"] = ($setting === true || $setting === "true");
+ }
+ }
+
return $result;
}
@@ -462,7 +501,7 @@ class AppConfig {
* @var array
*/
private $formats = [
- "csv" => [ "mime" => "text/csv", "type" => "spreadsheet", "edit" => true ],
+ "csv" => [ "mime" => "text/csv", "type" => "spreadsheet", "edit" => true, "editable" => true ],
"doc" => [ "mime" => "application/msword", "type" => "text", "conv" => true ],
"docm" => [ "mime" => "application/vnd.ms-word.document.macroEnabled.12", "type" => "text", "conv" => true ],
"docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true, "def" => true ],
@@ -471,9 +510,9 @@ class AppConfig {
"epub" => [ "mime" => "application/epub+zip", "type" => "text", "conv" => true ],
"htm" => [ "type" => "text", "conv" => true ],
"html" => [ "mime" => "text/html", "type" => "text", "conv" => true ],
- "odp" => [ "mime" => "application/vnd.oasis.opendocument.presentation", "type" => "presentation", "conv" => true ],
- "ods" => [ "mime" => "application/vnd.oasis.opendocument.spreadsheet", "type" => "spreadsheet", "conv" => true ],
- "odt" => [ "mime" => "application/vnd.oasis.opendocument.text", "type" => "text", "conv" => true ],
+ "odp" => [ "mime" => "application/vnd.oasis.opendocument.presentation", "type" => "presentation", "conv" => true, "editable" => true ],
+ "ods" => [ "mime" => "application/vnd.oasis.opendocument.spreadsheet", "type" => "spreadsheet", "conv" => true, "editable" => true ],
+ "odt" => [ "mime" => "application/vnd.oasis.opendocument.text", "type" => "text", "conv" => true, "editable" => true ],
"pdf" => [ "mime" => "application/pdf", "type" => "text" ],
"pot" => [ "type" => "presentation", "conv" => true ],
"potm" => [ "mime" => "application/vnd.ms-powerpoint.template.macroEnabled.12", "type" => "presentation", "conv" => true ],
@@ -484,8 +523,8 @@ class AppConfig {
"ppt" => [ "mime" => "application/vnd.ms-powerpoint", "type" => "presentation", "conv" => true ],
"pptm" => [ "mime" => "application/vnd.ms-powerpoint.presentation.macroEnabled.12", "type" => "presentation", "conv" => true ],
"pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true, "def" => true ],
- "rtf" => [ "mime" => "text/rtf", "type" => "text", "conv" => true ],
- "txt" => [ "mime" => "text/plain", "type" => "text", "edit" => true ],
+ "rtf" => [ "mime" => "text/rtf", "type" => "text", "conv" => true, "editable" => true ],
+ "txt" => [ "mime" => "text/plain", "type" => "text", "edit" => true, "editable" => true ],
"xls" => [ "mime" => "application/vnd.ms-excel", "type" => "spreadsheet", "conv" => true ],
"xlsm" => [ "mime" => "application/vnd.ms-excel.sheet.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
"xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true, "def" => true ],
diff --git a/templates/settings.php b/templates/settings.php
index 650ddd8..07976d3 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -68,8 +68,8 @@
<h3 class="onlyoffice-header"><?php p($l->t("The default application for opening the format")) ?></h3>
<div class="onlyoffice-exts">
- <?php foreach ($_["formats"] as $format => $setting) {
- if (array_key_exists("mime", $setting)) { ?>
+ <?php foreach ($_["formats"] as $format => $setting) { ?>
+ <?php if (array_key_exists("mime", $setting)) { ?>
<div>
<input type="checkbox" class="checkbox"
id="onlyofficeDefFormat<?php p($format) ?>"
@@ -77,8 +77,24 @@
<?php if ($setting["def"]) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeDefFormat<?php p($format) ?>"><?php p($format) ?></label>
</div>
- <?php }
- } ?>
+ <?php } ?>
+ <?php } ?>
+ </div>
+
+ <h3 class="onlyoffice-header"><?php p($l->t("Open the file for editing (due to format restrictions, the data might be lost when saving to the formats from the list below)")) ?></h3>
+ <a target="_blank" class="icon-info svg" title="" href="https://api.onlyoffice.com/editors/owncloud#editable" data-original-title="<?php p($l->t("View details")) ?>"></a>
+ <div class="onlyoffice-exts">
+ <?php foreach ($_["formats"] as $format => $setting) { ?>
+ <?php if (array_key_exists("editable", $setting)) { ?>
+ <div>
+ <input type="checkbox" class="checkbox"
+ id="onlyofficeEditFormat<?php p($format) ?>"
+ name="<?php p($format) ?>"
+ <?php if ($setting["edit"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeEditFormat<?php p($format) ?>"><?php p($format) ?></label>
+ </div>
+ <?php } ?>
+ <?php } ?>
</div>
<a id="onlyofficeSave" class="button onlyoffice-header"><?php p($l->t("Save")) ?></a>