diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a9187d8..e399b4e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Change Log +## Added +- setting for setup unknown author display name ## 9.5.1 ## Added diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index d59a8a9d..8bcbdabd 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -946,6 +946,10 @@ public function history($fileId) { "id" => $this->buildUserId($author["id"]), "name" => $author["name"] ]; + } elseif (!empty($this->config->getUnknownAuthor())) { + $historyItem["user"] = [ + "name" => $this->config->getUnknownAuthor() + ]; } elseif ($owner !== null) { $historyItem["user"] = [ "id" => $this->buildUserId($ownerId), diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index 072e1186..9c509544 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -134,7 +134,8 @@ public function index() { "reviewDisplay" => $this->config->getCustomizationReviewDisplay(), "theme" => $this->config->getCustomizationTheme(), "templates" => $this->getGlobalTemplates(), - "linkToDocs" => $this->config->getLinkToDocs() + "linkToDocs" => $this->config->getLinkToDocs(), + "unknownAuthor" => $this->config->getUnknownAuthor() ]; return new TemplateResponse($this->appName, "settings", $data, "blank"); } @@ -218,6 +219,7 @@ public function saveAddress( * @param bool $toolbarNoTabs - display toolbar tab * @param string $reviewDisplay - review viewing mode * @param string $theme - default theme mode + * @param string $unknownAuthor - display unknown author * * @return array */ @@ -236,7 +238,8 @@ public function saveCommon( $help, $toolbarNoTabs, $reviewDisplay, - $theme + $theme, + $unknownAuthor ) { $this->config->setDefaultFormats($defFormats); $this->config->setEditableFormats($editFormats); @@ -253,6 +256,7 @@ public function saveCommon( $this->config->setCustomizationToolbarNoTabs($toolbarNoTabs); $this->config->setCustomizationReviewDisplay($reviewDisplay); $this->config->setCustomizationTheme($theme); + $this->config->setUnknownAuthor($unknownAuthor); return [ ]; diff --git a/js/settings.js b/js/settings.js index f47561fe..6303e61e 100644 --- a/js/settings.js +++ b/js/settings.js @@ -188,6 +188,7 @@ const theme = $("input[type='radio'][name='theme']:checked") .attr("id") .replace("onlyofficeTheme_", ""); + const unknownAuthor = $('#onlyofficeUnknownAuthor').val().trim(); $.ajax({ method: "PUT", @@ -210,6 +211,7 @@ toolbarNoTabs, reviewDisplay, theme, + unknownAuthor, }, success: function onSuccess(response) { $(".section-onlyoffice").removeClass("icon-loading"); diff --git a/l10n/ru.js b/l10n/ru.js index 930280aa..cb1606a6 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -125,6 +125,7 @@ OC.L10N.register( "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", - "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов", + "Unknown author display name" : "Отображаемое имя неизвестного автора" }, "nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"); diff --git a/l10n/ru.json b/l10n/ru.json index 518f90af..d1e028d2 100644 --- a/l10n/ru.json +++ b/l10n/ru.json @@ -123,6 +123,7 @@ "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", - "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов", + "Unknown author display name" : "Отображаемое имя неизвестного автора" },"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);" } \ No newline at end of file diff --git a/lib/appconfig.php b/lib/appconfig.php index 1a32c74f..e9336949 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -195,6 +195,13 @@ class AppConfig { */ private $_customizationTheme = "customizationTheme"; + /** + * Display name of the unknown author + * + * @var string + */ + private $_unknownAuthor = "unknownAuthor"; + /** * The config key for the setting limit groups * @@ -976,6 +983,27 @@ public function getCustomizationTheme() { return "theme-classic-light"; } + /** + * Save unknownAuthor setting + * + * @param string $value - unknown author + * + * @return void + */ + public function setUnknownAuthor($value) { + $this->logger->info("Set unknownAuthor: " . trim($value), ["app" => $this->appName]); + $this->config->setAppValue($this->appName, $this->_unknownAuthor, trim($value)); + } + + /** + * Get unknownAuthor setting + * + * @return string + */ + public function getUnknownAuthor() { + return $this->config->getAppValue($this->appName, $this->_unknownAuthor, ""); + } + /** * Save macros setting * diff --git a/templates/settings.php b/templates/settings.php index 2989ccc9..2d14e9e0 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -142,6 +142,9 @@

+

t("Unknown author display name")) ?>

+

" placeholder="" type="text">

+

t("The default application for opening the format")) ?>

$setting) { ?>