Skip to content

Commit

Permalink
Merge pull request 'feature/unknown-author' from feature/unknown-auth…
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Jan 14, 2025
2 parents 3874b5e + 5fe664f commit a05966d
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Change Log
## Added
- setting for setup unknown author display name

## 9.5.1
## Added
Expand Down
4 changes: 4 additions & 0 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 6 additions & 2 deletions controller/settingscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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
*/
Expand All @@ -236,7 +238,8 @@ public function saveCommon(
$help,
$toolbarNoTabs,
$reviewDisplay,
$theme
$theme,
$unknownAuthor
) {
$this->config->setDefaultFormats($defFormats);
$this->config->setEditableFormats($editFormats);
Expand All @@ -253,6 +256,7 @@ public function saveCommon(
$this->config->setCustomizationToolbarNoTabs($toolbarNoTabs);
$this->config->setCustomizationReviewDisplay($reviewDisplay);
$this->config->setCustomizationTheme($theme);
$this->config->setUnknownAuthor($unknownAuthor);

return [
];
Expand Down
2 changes: 2 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
const theme = $("input[type='radio'][name='theme']:checked")
.attr("id")
.replace("onlyofficeTheme_", "");
const unknownAuthor = $('#onlyofficeUnknownAuthor').val().trim();

$.ajax({
method: "PUT",
Expand All @@ -210,6 +211,7 @@
toolbarNoTabs,
reviewDisplay,
theme,
unknownAuthor,
},
success: function onSuccess(response) {
$(".section-onlyoffice").removeClass("icon-loading");
Expand Down
3 changes: 2 additions & 1 deletion l10n/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);");
3 changes: 2 additions & 1 deletion l10n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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);"
}
28 changes: 28 additions & 0 deletions lib/appconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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
*
Expand Down
3 changes: 3 additions & 0 deletions templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
<label for="onlyofficeCronChecker"><?php p($l->t("Enable background connection check to the editors")) ?></label>
</p>

<p class="onlyoffice-header"><?php p($l->t("Unknown author display name")) ?></p>
<p><input id="onlyofficeUnknownAuthor" value="<?php p($_["unknownAuthor"]) ?>" placeholder="" type="text"></p>

<p class="onlyoffice-header"><?php p($l->t("The default application for opening the format")) ?></p>
<div class="onlyoffice-exts">
<?php foreach ($_["formats"] as $format => $setting) { ?>
Expand Down

0 comments on commit a05966d

Please sign in to comment.