Skip to content

Commit

Permalink
Merge pull request #484 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/9.3.1
  • Loading branch information
LinneyS authored Jul 1, 2024
2 parents f8cd959 + 4a55869 commit ec96853
Show file tree
Hide file tree
Showing 49 changed files with 317 additions and 211 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 9.3.1
## Changed
- creating and editing pdf form

## 9.1.1
## Added
- support of user avatar in editor
Expand Down
1 change: 0 additions & 1 deletion appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function () {
$detector->registerType("ott", "application/vnd.oasis.opendocument.text-template");
$detector->registerType("ots", "application/vnd.oasis.opendocument.spreadsheet-template");
$detector->registerType("otp", "application/vnd.oasis.opendocument.presentation-template");
$detector->registerType("docxf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf");

$previewManager = $container->query(IPreview::class);
if ($this->appConfig->getPreview()) {
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>ONLYOFFICE connector allows you to view, edit and collaborate on text documents, spreadsheets and presentations within ownCloud using ONLYOFFICE Docs. This will create a new Edit in ONLYOFFICE action within the document library for Office documents. This allows multiple users to co-author documents in real time from the familiar web interface and save the changes back to your file storage.</description>
<licence>apl2</licence>
<author>Ascensio System SIA</author>
<version>9.1.1</version>
<version>9.3.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand Down
2 changes: 1 addition & 1 deletion assets/document-formats
2 changes: 1 addition & 1 deletion assets/document-templates
Submodule document-templates updated 85 files
+0 −3 README.md
+ ar-SA/new.docxf
+ ar-SA/new.pdf
+ az-Latn-AZ/new.docxf
+ az-Latn-AZ/new.pdf
+ az-Latn-AZ/new.xlsx
+ bg-BG/new.docxf
+ bg-BG/new.pdf
+ cs-CZ/new.docxf
+ cs-CZ/new.pdf
+ de-DE/new.docxf
+ de-DE/new.pdf
+ el-GR/new.docxf
+ el-GR/new.pdf
+ el-GR/new.xlsx
+ en-GB/new.docxf
+ en-GB/new.pdf
+ en-US/new.docxf
+ en-US/new.pdf
+ es-ES/new.docxf
+ es-ES/new.pdf
+ es-ES/new.xlsx
+ eu-ES/new.docxf
+ eu-ES/new.pdf
+ fr-FR/new.docxf
+ fr-FR/new.pdf
+ fr-FR/new.xlsx
+ gl-ES/new.docxf
+ gl-ES/new.pdf
+ hy-AM/new.docxf
+ hy-AM/new.pdf
+ it-IT/new.docxf
+ it-IT/new.pdf
+ it-IT/new.xlsx
+ ja-JP/new.docxf
+ ja-JP/new.pdf
+ ja-JP/new.xlsx
+ ko-KR/new.docxf
+ ko-KR/new.pdf
+ ko-KR/new.xlsx
+ lv-LV/new.docxf
+ lv-LV/new.pdf
+ lv-LV/new.xlsx
+ ms-MY/new.docxf
+ ms-MY/new.pdf
+ nl-NL/new.docxf
+ nl-NL/new.pdf
+ nl-NL/new.pptx
+ pl-PL/new.docxf
+ pl-PL/new.pdf
+ pl-PL/new.xlsx
+ pt-BR/new.docxf
+ pt-BR/new.pdf
+ pt-BR/new.xlsx
+ pt-PT/new.docxf
+ pt-PT/new.pdf
+ ru-RU/new.docxf
+ ru-RU/new.pdf
+ si-LK/new.docxf
+ si-LK/new.pdf
+ sk-SK/new.docxf
+ sk-SK/new.pdf
+ sk-SK/new.xlsx
+ sr-Cyrl-RS/new.docx
+ sr-Cyrl-RS/new.pdf
+ sr-Cyrl-RS/new.pptx
+ sr-Cyrl-RS/new.xlsx
+ sr-Latn-RS/new.docxf
+ sr-Latn-RS/new.pdf
+ sv-SE/new.docxf
+ sv-SE/new.pdf
+ sv-SE/new.xlsx
+ tr-TR/new.docxf
+ tr-TR/new.pdf
+ uk-UA/new.docxf
+ uk-UA/new.pdf
+ uk-UA/new.xlsx
+ vi-VN/new.docxf
+ vi-VN/new.pdf
+ vi-VN/new.xlsx
+ zh-CN/new.docxf
+ zh-CN/new.pdf
+ zh-CN/new.xlsx
+ zh-TW/new.docxf
+ zh-TW/new.pdf
6 changes: 5 additions & 1 deletion controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,11 @@ function () use ($file, $newData) {
$changes = null;
if (!empty($changesurl)) {
$changesurl = $this->config->replaceDocumentServerUrlToInternal($changesurl);
$changes = $documentService->request($changesurl);
try {
$changes = $documentService->request($changesurl);
} catch (\Exception $e) {
$this->logger->logException($e, ["message" => "Failed to download changes", "app" => $this->appName]);
}
}
FileVersions::saveHistory($file->getFileInfo(), $history, $changes, $prevVersion);
}
Expand Down
12 changes: 9 additions & 3 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ public function fillempty($fileId) {
* @param bool $desktop - desktop label
* @param bool $template - file is template
* @param string $anchor - anchor link
* @param bool $forceEdit - open editing
*
* @return JSONResponse
*
* @NoAdminRequired
* @PublicPage
* @CORS
*/
public function config($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $desktop = false, $template = false, $anchor = null) {
public function config($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $desktop = false, $template = false, $anchor = null, $forceEdit = false) {
$user = $this->userSession->getUser();
$userId = null;
$accountId = null;
Expand Down Expand Up @@ -380,8 +381,8 @@ public function config($fileId, $filePath = null, $shareToken = null, $version =
&& $file->isUpdateable()
&& !$isPersistentLock
&& (empty($shareToken) || ($share->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE);
$params["document"]["permissions"]["edit"] = $editable;
if (($editable || $restrictedEditing) && $canEdit || $canFillForms) {
$params["document"]["permissions"]["edit"] = $editable && ($forceEdit || !$canFillForms);
if (($editable || $restrictedEditing) && ($canEdit || $canFillForms)) {
$ownerId = null;
$owner = $file->getOwner();
if (!empty($owner)) {
Expand All @@ -399,6 +400,11 @@ public function config($fileId, $filePath = null, $shareToken = null, $version =
$params["document"]["permissions"]["protect"] = false;
}

if ($canFillForms) {
$params["document"]["permissions"]["fillForms"] = true;
$params["canEdit"] = $canEdit && $editable;
}

$hashCallback = $this->crypt->getHash(["userId" => $userId, "ownerId" => $ownerId, "fileId" => $file->getId(), "filePath" => $filePath, "shareToken" => $shareToken, "action" => "track"]);
$callback = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.track", ["doc" => $hashCallback]);

Expand Down
13 changes: 8 additions & 5 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function create($name, $dir, $templateId = null, $targetPath = null, $sha
$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
$documentService = new DocumentService($this->trans, $this->config);
try {
$newFileUri = $documentService->getConvertedUri($fileUrl, $targetExt, $ext, $targetKey);
$newFileUri = $documentService->getConvertedUri($fileUrl, $targetExt, $ext, $targetKey, $ext === "pdf");
} catch (\Exception $e) {
$this->logger->logException($e, ["message" => "getConvertedUri: " . $targetFile->getId(), "app" => $this->appName]);
return ["error" => $e->getMessage()];
Expand Down Expand Up @@ -1278,6 +1278,7 @@ public function download($fileId, $toExtension = null, $template = false) {
* @param string $shareToken - access token
* @param integer $version - file version
* @param bool $inframe - open in frame
* @param bool $forceEdit - open editing
* @param bool $template - file is template
* @param string $anchor - anchor for file content
*
Expand All @@ -1286,7 +1287,7 @@ public function download($fileId, $toExtension = null, $template = false) {
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $template = false, $anchor = null) {
public function index($fileId, $filePath = null, $shareToken = null, $version = 0, $inframe = false, $forceEdit = false, $template = false, $anchor = null) {
$this->logger->debug("Open: $fileId ($version) $filePath", ["app" => $this->appName]);

if (empty($shareToken) && !$this->userSession->isLoggedIn()) {
Expand Down Expand Up @@ -1326,7 +1327,8 @@ public function index($fileId, $filePath = null, $shareToken = null, $version =
"version" => $version,
"template" => $template,
"inframe" => false,
"anchor" => $anchor
"anchor" => $anchor,
"forceEdit" => $forceEdit
];

if ($inframe === true) {
Expand Down Expand Up @@ -1357,15 +1359,16 @@ public function index($fileId, $filePath = null, $shareToken = null, $version =
* @param string $shareToken - access token
* @param integer $version - file version
* @param bool $inframe - open in frame
* @param bool $forceEdit - open editing
*
* @return TemplateResponse
*
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
*/
public function publicPage($fileId, $shareToken, $version = 0, $inframe = false) {
return $this->index($fileId, null, $shareToken, $version, $inframe);
public function publicPage($fileId, $shareToken, $version = 0, $inframe = false, $forceEdit = false) {
return $this->index($fileId, null, $shareToken, $version, $inframe, $forceEdit);
}

/**
Expand Down
5 changes: 2 additions & 3 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
.icon-onlyoffice-new-pptx {
background-image: url("../img/new-pptx.svg");
}
.icon-onlyoffice-new-docxf {
background-image: url("../img/new-docxf.svg");
.icon-onlyoffice-new-pdf {
background-image: url("../img/new-pdf.svg");
}
.icon-onlyoffice-open,
.icon-onlyoffice-convert,
.icon-onlyoffice-download,
.icon-onlyoffice-fill,
.icon-onlyoffice-create {
background-image: url("../img/app-dark.svg");
}
Expand Down
16 changes: 8 additions & 8 deletions img/new-docxf.svg → img/new-pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/pdf.ico
Binary file not shown.
22 changes: 22 additions & 0 deletions js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
OCA.Onlyoffice.template = $("#iframeEditor").data("template");
OCA.Onlyoffice.inframe = !!$("#iframeEditor").data("inframe");
OCA.Onlyoffice.anchor = $("#iframeEditor").attr("data-anchor");
OCA.Onlyoffice.forceEdit = $("#iframeEditor").attr("data-forceEdit");
OCA.Onlyoffice.currentWindow = window;

if (OCA.Onlyoffice.inframe) {
Expand Down Expand Up @@ -84,6 +85,10 @@
params.push("anchor=" + encodeURIComponent(OCA.Onlyoffice.anchor));
}

if (OCA.Onlyoffice.forceEdit) {
params.push("forceEdit=true");
}

if (OCA.Onlyoffice.Desktop) {
params.push("desktop=true");
}
Expand Down Expand Up @@ -181,6 +186,12 @@
config.events.onRequestSharingSettings = OCA.Onlyoffice.onRequestSharingSettings;
}

if (!config.document.permissions.edit
&& config.document.permissions.fillForms
&& config.canEdit) {
config.events.onRequestEditRights = OCA.Onlyoffice.onRequestEditRights;
}

OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config);

if (config.type === "mobile" && $("#app > iframe").css("position") === "fixed"
Expand All @@ -203,6 +214,17 @@
});
};

OCA.Onlyoffice.onRequestEditRights = function () {
if (OCA.Onlyoffice.inframe) {
window.parent.postMessage({
method: "onRequestEditRights"
},
"*");
return;
}
location.href += "&forceEdit=true";
};

OCA.Onlyoffice.onRequestHistory = function (version) {
$.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/history?fileId={fileId}",
{
Expand Down
9 changes: 8 additions & 1 deletion js/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@

OCA.Onlyoffice.onShowMessage = function (messageObj) {
OC.Notification.show(messageObj.message, messageObj.props);
}
};

OCA.Onlyoffice.onRequestEditRights = function () {
$("#onlyofficeFrame").attr("src", $("#onlyofficeFrame").attr("src") + "&forceEdit=true");
};

window.addEventListener("message", function (event) {
if ($("#onlyofficeFrame")[0]) {
Expand Down Expand Up @@ -148,6 +152,9 @@
break;
case "onShowMessage":
OCA.Onlyoffice.onShowMessage(event.data.param);
break;
case "onRequestEditRights":
OCA.Onlyoffice.onRequestEditRights();
}
}, false);

Expand Down
38 changes: 17 additions & 21 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@

fileList.add(response, { animate: true });
if (open) {
OCA.Onlyoffice.OpenEditor(response.id, dir, response.name, 0, winEditor);
let fileName = response.name;
let extension = OCA.Onlyoffice.GetFileExtension(fileName);
let forceEdit = OCA.Onlyoffice.setting.formats[extension].fillForms;
OCA.Onlyoffice.OpenEditor(response.id, dir, fileName, 0, winEditor, forceEdit);
}

OCA.Onlyoffice.context = { fileList: fileList };
Expand All @@ -82,7 +85,7 @@
);
};

OCA.Onlyoffice.OpenEditor = function (fileId, fileDir, fileName, version, winEditor) {
OCA.Onlyoffice.OpenEditor = function (fileId, fileDir, fileName, version, winEditor, forceEdit) {
var filePath = "";
if (fileName) {
filePath = fileDir.replace(new RegExp("\/$"), "") + "/" + fileName;
Expand All @@ -101,6 +104,10 @@
});
}

if (forceEdit) {
url += "&forceEdit=true";
}

if (version > 0) {
url += "&version=" + version;
}
Expand Down Expand Up @@ -357,17 +364,6 @@
});
}

if (config.fillForms) {
OCA.Files.fileActions.registerAction({
name: "onlyofficeFill",
displayName: t(OCA.Onlyoffice.AppName, "Fill in form in ONLYOFFICE"),
mime: mime,
permissions: OC.PERMISSION_UPDATE,
iconClass: "icon-onlyoffice-fill",
actionHandler: OCA.Onlyoffice.FileClick
});
}

if (config.createForm) {
OCA.Files.fileActions.registerAction({
name: "onlyofficeCreateForm",
Expand Down Expand Up @@ -450,25 +446,25 @@
});

menu.addMenuEntry({
id: "onlyofficeDocxf",
id: "onlyofficePdf",
displayName: t(OCA.Onlyoffice.AppName, "PDF form"),
templateName: t(OCA.Onlyoffice.AppName, "PDF form"),
iconClass: "icon-onlyoffice-new-docxf",
fileType: "docxf",
iconClass: "icon-onlyoffice-new-pdf",
fileType: "pdf",
actionHandler: function (name) {
OCA.Onlyoffice.CreateFile(name + ".docxf", fileList);
OCA.Onlyoffice.CreateFile(name + ".pdf", fileList);
}
});

if (!$("#isPublic").val()) {
menu.addMenuEntry({
id: "onlyofficeDocxfExist",
id: "onlyofficePdfExist",
displayName: t(OCA.Onlyoffice.AppName, "PDF form from existing text file"),
templateName: t(OCA.Onlyoffice.AppName, "PDF form from existing text file"),
iconClass: "icon-onlyoffice-new-docxf",
fileType: "docxf",
iconClass: "icon-onlyoffice-new-pdf",
fileType: "pdf",
actionHandler: function (name) {
OCA.Onlyoffice.OpenFormPicker(name + ".docxf", fileList);
OCA.Onlyoffice.OpenFormPicker(name + ".pdf", fileList);
}
});
}
Expand Down
24 changes: 21 additions & 3 deletions l10n/bg_BG.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ OC.L10N.register(
"review" : "преглед",
"form filling" : "попълване на формуляр",
"comment" : "коментар",
"download" : "изтегли",
"global filter": "световен филтър",
"download": "изтегли",
"Server settings" : "Настройки на сървъра",
"Common settings" : "Общи настройки",
"Editor customization settings" : "Персонализиращи настройки на редактора",
Expand Down Expand Up @@ -99,11 +100,28 @@ OC.L10N.register(
"Notification sent successfully": "Успешно изпратено известие",
"%1\$s mentioned in the %2\$s: \"%3\$s\".": "%1\$s, Ви спомена във %2\$s: \"%3\$s\".",
"Choose a format to convert {fileName}": "Изберете формат за конвертиране {fileName}",
"PDF form": "PDF формуляр",
"PDF form from existing text file": "PDF формуляр от съществуващ текстов файл",
"Create form": "Създайте формуляр",
"Fill in form in ONLYOFFICE": "Попълнете формуляр в ONLYOFFICE",
"Create new PDF form": "Създайте нов PDF формуляр",
"Security": "Сигурност",
"Run document macros": "Изпълнение на макроси на документи",
"Light": "Светла",
"Classic Light": "Класически светла",
"Dark": "Тъмна"
"Dark": "Тъмна",
"Enable plugins": "Активирайте плъгини",
"Enable document protection for": "Активирайте защита на документи за",
"All users": "Всички потребители",
"Owner only": "Само собственик",
"Authorization header (leave blank to use default header)": "Заглавка за упълномощаване (оставете празно, за да използвате заглавка по подразбиране)",
"ONLYOFFICE server is not available": "ONLYOFFICE сървърът не е достъпен",
"Please check the settings to resolve the problem.": "Моля, проверете настройките, за да разрешите проблема.",
"View settings": "Виж настройки",
"ONLYOFFICE Docs Cloud": "ONLYOFFICE Docs Cloud",
"Select file to combine": "Избери файл за комбиниране",
"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": "Домейнът в URL адреса на файла не съвпада с домейна на сървъра за документи"
},
"nplurals=2; plural=(n != 1);");
Loading

0 comments on commit ec96853

Please sign in to comment.