Compare commits

..

26 Commits

Author SHA1 Message Date
c9baa474be python-raw: add sr-only 2023-08-11 18:42:23 +04:00
48185674d4 python-raw: up html 2023-08-11 18:42:12 +04:00
dbca11e85c python-raw: move js 2023-08-11 18:41:45 +04:00
d21a732859 python-raw: move css 2023-08-11 18:40:57 +04:00
b96a6fac53 python-raw: add js 2023-08-08 14:43:34 +04:00
b01af348a7 python-raw: add html 2023-08-08 14:43:17 +04:00
c2443d3106 python-raw: add styles 2023-08-08 14:42:56 +04:00
5fa3f4c57f python-raw: add formats endpoint 2023-08-08 14:41:58 +04:00
efd7e1b6e7 python-raw: add format methods 2023-08-08 14:41:20 +04:00
259ee63eea python-raw: temp hide server 2023-08-08 14:41:00 +04:00
453b9835b7 python-raw: fix formats 2023-08-08 14:40:27 +04:00
89e6544b79 Merge branch 'feature/python-matrix-formats' into feature/python-conversion 2023-08-04 12:31:53 +04:00
32a60c09aa python: add public and private document-server urls to the compose 2023-08-02 10:49:34 +04:00
5a03024cd3 python: add support for the internal network for the track endpoint 2023-08-02 10:49:34 +04:00
cb6416c481 python: sort imports 2023-08-02 10:49:34 +04:00
55e4247687 python: add tests for proxy manager 2023-08-02 10:49:34 +04:00
a0620905b2 python: add proxy manager to resolve the document-server url 2023-08-02 10:49:34 +04:00
3fcef4096a python: remove the strict CORS hint 2023-08-02 10:49:34 +04:00
4e5349c1c4 python: add tests for specifying public and private document-server urls 2023-08-02 10:49:34 +04:00
538eec1ff3 python: add support for specifying public and private document-server urls 2023-08-02 10:49:34 +04:00
c06f2a5a29 python: replace the previous implementation of formats 2023-07-28 18:01:05 +04:00
8aed04753c python: add tests for the format module 2023-07-28 18:01:01 +04:00
15ed02e556 python: add format module 2023-07-28 12:06:30 +04:00
fb66dc8423 python: add tests for the codable module 2023-07-28 12:06:30 +04:00
541ace8132 python: add codable module 2023-07-28 12:06:30 +04:00
8b5cebeb3f python: add document-formats submodule 2023-07-28 12:06:30 +04:00
131 changed files with 2535 additions and 721 deletions

28
.gitmodules vendored
View File

@ -1,3 +1,7 @@
[submodule "web/documentserver-example/java/src/main/resources/assets"]
path = web/documentserver-example/java/src/main/resources/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/csharp-mvc/assets"]
path = web/documentserver-example/csharp-mvc/assets
url = https://github.com/ONLYOFFICE/document-templates
@ -6,6 +10,14 @@
path = web/documentserver-example/csharp/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/ruby/public/assets"]
path = web/documentserver-example/ruby/public/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java-spring/src/main/resources/assets"]
path = web/documentserver-example/java-spring/src/main/resources/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/nodejs/public/assets/document-templates"]
path = web/documentserver-example/nodejs/public/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
@ -26,15 +38,7 @@
path = web/documentserver-example/python/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/ruby/assets/document-templates"]
path = web/documentserver-example/ruby/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java-spring/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java-spring/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/python/assets/document-formats"]
path = web/documentserver-example/python/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = master

View File

@ -1,8 +1,5 @@
# Change Log
- nodejs: onRequestOpen
- nodejs: submitForm
- nodejs: key in referenceData
- nodejs: change reference source
- php: using a repo with a list of formats
- nodejs: using a repo with a list of formats

View File

@ -35,8 +35,6 @@ import com.onlyoffice.integration.documentserver.util.file.FileUtility;
import com.onlyoffice.integration.documentserver.util.service.ServiceConverter;
import com.onlyoffice.integration.documentserver.managers.document.DocumentManager;
import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.beans.factory.annotation.Autowired;
@ -51,7 +49,6 @@ import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@ -59,20 +56,14 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@ -364,13 +355,13 @@ public class FileController {
@GetMapping("/assets")
public ResponseEntity<Resource> assets(@RequestParam("name")
final String name) { // get sample files from the assests
String fileName = Path.of("assets", "document-templates", "sample", fileUtility.getFileName(name)).toString();
String fileName = Path.of("assets", "sample", fileUtility.getFileName(name)).toString();
return downloadFile(fileName);
}
@GetMapping("/csv")
public ResponseEntity<Resource> csv() { // download a csv file
String fileName = Path.of("assets", "document-templates", "sample", "csv.csv").toString();
String fileName = Path.of("assets", "sample", "csv.csv").toString();
return downloadFile(fileName);
}
@ -537,88 +528,4 @@ public class FileController {
return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}";
}
}
@PutMapping("/restore")
@ResponseBody
public String restore(@RequestBody final JSONObject body) {
try {
String sourceBasename = (String) body.get("fileName");
Integer version = (Integer) body.get("version");
String userID = (String) body.get("userId");
String sourceStringFile = storagePathBuilder.getFileLocation(sourceBasename);
File sourceFile = new File(sourceStringFile);
Path sourcePathFile = sourceFile.toPath();
String historyDirectory = storagePathBuilder.getHistoryDir(sourcePathFile.toString());
Integer bumpedVersion = storagePathBuilder.getFileVersion(historyDirectory, false);
String bumpedVersionStringDirectory = documentManager.versionDir(historyDirectory, bumpedVersion, true);
File bumpedVersionDirectory = new File(bumpedVersionStringDirectory);
if (!bumpedVersionDirectory.exists()) {
bumpedVersionDirectory.mkdir();
}
Path bumpedKeyPathFile = Paths.get(bumpedVersionStringDirectory, "key.txt");
String bumpedKeyStringFile = bumpedKeyPathFile.toString();
File bumpedKeyFile = new File(bumpedKeyStringFile);
String bumpedKey = serviceConverter.generateRevisionId(
storagePathBuilder.getStorageLocation()
+ "/"
+ sourceBasename
+ "/"
+ Long.toString(sourceFile.lastModified())
);
FileWriter bumpedKeyFileWriter = new FileWriter(bumpedKeyFile);
bumpedKeyFileWriter.write(bumpedKey);
bumpedKeyFileWriter.close();
Integer userInnerID = Integer.parseInt(userID.replace("uid-", ""));
User user = userService.findUserById(userInnerID).get();
Path bumpedChangesPathFile = Paths.get(bumpedVersionStringDirectory, "changes.json");
String bumpedChangesStringFile = bumpedChangesPathFile.toString();
File bumpedChangesFile = new File(bumpedChangesStringFile);
JSONObject bumpedChangesUser = new JSONObject();
// Don't add the `uid-` prefix.
// https://github.com/ONLYOFFICE/document-server-integration/issues/437#issuecomment-1663526562
bumpedChangesUser.put("id", user.getId());
bumpedChangesUser.put("name", user.getName());
JSONObject bumpedChangesChangesItem = new JSONObject();
bumpedChangesChangesItem.put("created", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
bumpedChangesChangesItem.put("user", bumpedChangesUser);
JSONArray bumpedChangesChanges = new JSONArray();
bumpedChangesChanges.add(bumpedChangesChangesItem);
JSONObject bumpedChanges = new JSONObject();
bumpedChanges.put("serverVersion", null);
bumpedChanges.put("changes", bumpedChangesChanges);
String bumpedChangesContent = bumpedChanges.toJSONString();
FileWriter bumpedChangesFileWriter = new FileWriter(bumpedChangesFile);
bumpedChangesFileWriter.write(bumpedChangesContent);
bumpedChangesFileWriter.close();
String sourceExtension = fileUtility.getFileExtension(sourceBasename);
String previousBasename = "prev" + sourceExtension;
Path bumpedFile = Paths.get(bumpedVersionStringDirectory, previousBasename);
Files.move(sourcePathFile, bumpedFile);
String recoveryVersionStringDirectory = documentManager.versionDir(historyDirectory, version, true);
Path recoveryPathFile = Paths.get(recoveryVersionStringDirectory, previousBasename);
String recoveryStringFile = recoveryPathFile.toString();
FileInputStream recoveryStream = new FileInputStream(recoveryStringFile);
storageMutator.createFile(sourcePathFile, recoveryStream);
recoveryStream.close();
JSONObject responseBody = new JSONObject();
responseBody.put("error", null);
responseBody.put("success", true);
return responseBody.toJSONString();
} catch (Exception error) {
error.printStackTrace();
JSONObject responseBody = new JSONObject();
responseBody.put("error", error.getMessage());
responseBody.put("success", false);
return responseBody.toJSONString();
}
}
}

View File

@ -217,14 +217,8 @@ public class DefaultDocumentManager implements DocumentManager {
public String createDemo(final String fileExt, final Boolean sample, final String uid, final String uname) {
String demoName = (sample ? "sample." : "new.")
+ fileExt; // create sample or new template file with the necessary extension
String demoPath =
"assets"
+ File.separator
+ "document-templates"
+ File.separator
+ (sample ? "sample" : "new")
+ File.separator
+ demoName;
String demoPath = "assets" + File.separator + (sample ? "sample" : "new")
+ File.separator + demoName; // get the path to the sample document
// get a file name with an index if the file with such a name already exists
String fileName = getCorrectName(demoName);

View File

@ -172,28 +172,6 @@
}
};
function onRequestRestore(event) {
const query = new URLSearchParams(window.location.search)
const config = [[${model}]]
const payload = {
fileName: query.get('fileName'),
version: event.data.version,
userId: config.editorConfig.user.id
}
const request = new XMLHttpRequest()
request.open('PUT', 'restore')
request.setRequestHeader('Content-Type', 'application/json')
request.send(JSON.stringify(payload))
request.onload = function () {
if (request.status != 200) {
response = JSON.parse(request.response)
innerAlert(response.error)
return
}
document.location.reload()
}
}
config.width = "100%";
config.height = "100%";
config.events = {
@ -206,7 +184,6 @@
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
"onRequestRestore": onRequestRestore
};
var histArray = [[${fileHistory}]];

View File

@ -48,7 +48,6 @@ import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
@ -58,9 +57,7 @@ import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
@ -129,9 +126,6 @@ public class IndexServlet extends HttpServlet {
case "reference":
reference(request, response, writer);
break;
case "restore":
restore(request, response, writer);
break;
default:
break;
}
@ -457,7 +451,7 @@ public class IndexServlet extends HttpServlet {
private static void csv(final HttpServletRequest request,
final HttpServletResponse response,
final PrintWriter writer) {
String fileName = "assets/document-templates/sample/csv.csv";
String fileName = "assets/sample/csv.csv";
URL fileUrl = Thread.currentThread().getContextClassLoader().getResource(fileName);
Path filePath = null;
try {
@ -472,7 +466,7 @@ public class IndexServlet extends HttpServlet {
private static void assets(final HttpServletRequest request,
final HttpServletResponse response,
final PrintWriter writer) {
String fileName = "assets/document-templates/sample/" + FileUtility.getFileName(request.getParameter("name"));
String fileName = "assets/sample/" + FileUtility.getFileName(request.getParameter("name"));
URL fileUrl = Thread.currentThread().getContextClassLoader().getResource(fileName);
Path filePath = null;
try {
@ -734,97 +728,6 @@ public class IndexServlet extends HttpServlet {
}
}
private static void restore(final HttpServletRequest request,
final HttpServletResponse response,
final PrintWriter writer) {
try {
Scanner scanner = new Scanner(request.getInputStream());
scanner.useDelimiter("\\A");
String bodyString = scanner.hasNext() ? scanner.next() : "";
scanner.close();
JSONParser parser = new JSONParser();
JSONObject body = (JSONObject) parser.parse(bodyString);
String sourceBasename = (String) body.get("fileName");
Integer version = ((Long) body.get("version")).intValue();
String userID = (String) body.get("userId");
String sourceStringFile = DocumentManager.storagePath(sourceBasename, null);
File sourceFile = new File(sourceStringFile);
Path sourcePathFile = sourceFile.toPath();
String historyDirectory = DocumentManager.historyDir(sourceStringFile);
Integer bumpedVersion = DocumentManager.getFileVersion(historyDirectory);
String bumpedVersionStringDirectory = DocumentManager.versionDir(historyDirectory, bumpedVersion);
File bumpedVersionDirectory = new File(bumpedVersionStringDirectory);
if (!bumpedVersionDirectory.exists()) {
bumpedVersionDirectory.mkdir();
}
Path bumpedKeyPathFile = Paths.get(bumpedVersionStringDirectory, "key.txt");
String bumpedKeyStringFile = bumpedKeyPathFile.toString();
File bumpedKeyFile = new File(bumpedKeyStringFile);
String bumpedKey = ServiceConverter.generateRevisionId(
DocumentManager.curUserHostAddress(null)
+ "/"
+ sourceBasename
+ "/"
+ Long.toString(sourceFile.lastModified())
);
FileWriter bumpedKeyFileWriter = new FileWriter(bumpedKeyFile);
bumpedKeyFileWriter.write(bumpedKey);
bumpedKeyFileWriter.close();
User user = Users.getUser(userID);
Path bumpedChangesPathFile = Paths.get(bumpedVersionStringDirectory, "changes.json");
String bumpedChangesStringFile = bumpedChangesPathFile.toString();
File bumpedChangesFile = new File(bumpedChangesStringFile);
JSONObject bumpedChangesUser = new JSONObject();
bumpedChangesUser.put("id", user.getId());
bumpedChangesUser.put("name", user.getName());
JSONObject bumpedChangesChangesItem = new JSONObject();
bumpedChangesChangesItem.put("created", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
bumpedChangesChangesItem.put("user", bumpedChangesUser);
JSONArray bumpedChangesChanges = new JSONArray();
bumpedChangesChanges.add(bumpedChangesChangesItem);
JSONObject bumpedChanges = new JSONObject();
bumpedChanges.put("serverVersion", null);
bumpedChanges.put("changes", bumpedChangesChanges);
String bumpedChangesContent = bumpedChanges.toJSONString();
FileWriter bumpedChangesFileWriter = new FileWriter(bumpedChangesFile);
bumpedChangesFileWriter.write(bumpedChangesContent);
bumpedChangesFileWriter.close();
String sourceExtension = FileUtility.getFileExtension(sourceBasename);
String previousBasename = "prev" + sourceExtension;
Path bumpedFile = Paths.get(bumpedVersionStringDirectory, previousBasename);
Files.move(sourcePathFile, bumpedFile);
String recoveryVersionStringDirectory = DocumentManager.versionDir(historyDirectory, version);
Path recoveryPathFile = Paths.get(recoveryVersionStringDirectory, previousBasename);
String recoveryStringFile = recoveryPathFile.toString();
FileInputStream recoveryStream = new FileInputStream(recoveryStringFile);
DocumentManager.createFile(sourcePathFile, recoveryStream);
recoveryStream.close();
JSONObject responseBody = new JSONObject();
responseBody.put("error", null);
responseBody.put("success", true);
String responseContent = responseBody.toJSONString();
writer.write(responseContent);
} catch (Exception error) {
error.printStackTrace();
JSONObject responseBody = new JSONObject();
responseBody.put("error", error.getMessage());
responseBody.put("success", false);
String responseContent = responseBody.toJSONString();
writer.write(responseContent);
}
}
// process get request
@Override
protected void doGet(final HttpServletRequest request,
@ -839,12 +742,6 @@ public class IndexServlet extends HttpServlet {
processRequest(request, response);
}
@Override
protected void doPut(final HttpServletRequest request,
final HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
// get servlet information
@Override
public String getServletInfo() {

View File

@ -306,12 +306,7 @@ public final class DocumentManager {
String demoName = (sample ? "sample." : "new.") + fileExt;
// get the path to the sample document
String demoPath = "assets"
+ File.separator
+ "document-templates"
+ File.separator
+ (sample ? "sample" : "new")
+ File.separator;
String demoPath = "assets" + File.separator + (sample ? "sample" : "new") + File.separator;
// get a file name with an index if the file with such a name already exists
String fileName = getCorrectName(demoName, null);

View File

@ -173,26 +173,6 @@
}
};
function onRequestRestore(event) {
const query = new URLSearchParams(window.location.search)
const payload = {
fileName: query.get('fileName'),
version: event.data.version,
userId: config.editorConfig.user.id
}
const request = new XMLHttpRequest()
request.open('PUT', 'IndexServlet?type=restore')
request.send(JSON.stringify(payload))
request.onload = function () {
if (request.status != 200) {
response = JSON.parse(request.response)
innerAlert(response.error)
return
}
document.location.reload()
}
}
config = JSON.parse('<%= FileModel.serialize(Model) %>');
config.width = "100%";
config.height = "100%";
@ -206,7 +186,6 @@
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
"onRequestRestore": onRequestRestore
};
<%

View File

@ -1,4 +1,4 @@
/**
/**
*
* (c) Copyright Ascensio System SIA 2023
*
@ -521,14 +521,12 @@ app.post('/reference', (req, res) => { // define a handler for renaming file
const data = {
fileType: fileUtility.getFileExtension(fileName).slice(1),
key: req.DocManager.getKey(fileName),
url: req.DocManager.getDownloadUrl(fileName, true),
directUrl: req.body.directUrl ? req.DocManager.getDownloadUrl(fileName) : null,
referenceData: {
fileKey: JSON.stringify({ fileName, userAddress: req.DocManager.curUserHostAddress() }),
instanceId: req.DocManager.getServerUrl(),
},
link: `${req.DocManager.getServerUrl()}/editor?fileName=` + encodeURIComponent(fileName),
path: fileName,
};
@ -713,18 +711,18 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
const downloadExt = `.${body.fileType}`;
const isSubmitForm = body.forcesavetype === 3; // SubmitForm
let correctName = fileName;
let correctName = '';
let forcesavePath = '';
if (isSubmitForm) {
// new file
if (newFileName) {
correctName = req.DocManager.getCorrectName(
`${fileUtility.getFileName(fileName, true)}-form${downloadExt}`, userAddress);
correctName = req.DocManager.getCorrectName(`${fileUtility.getFileName(fileName, true)}
-form${downloadExt}`, userAddress);
} else {
const ext = fileUtility.getFileExtension(fileName);
correctName = req.DocManager.getCorrectName(
`${fileUtility.getFileName(fileName, true)}-form${ext}`, userAddress);
correctName = req.DocManager.getCorrectName(`${fileUtility.getFileName(fileName, true)}
-form${ext}`, userAddress);
}
forcesavePath = req.DocManager.storagePath(correctName, userAddress);
} else {
@ -949,7 +947,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
if (!canEdit && mode === 'edit') {
mode = 'view';
}
const submitForm = mode === 'fillForms' && userid === 'uid-1';
const submitForm = mode === 'fillForms' && userid === 'uid-1' && !1;
// file config data
const argss = {

View File

@ -52,7 +52,7 @@ const descrUser1 = [
'The file favorite state is undefined',
'Can create files from templates using data from the editor',
'Can see the information about all users',
'Can submit forms'
// "Can submit forms"
];
const descrUser2 = [
@ -62,7 +62,7 @@ const descrUser2 = [
'This file is marked as favorite',
'Can create new files from the editor',
'Can see the information about users from Group2 and users who dont belong to any group',
'Cant submit forms'
// "Cant submit forms"
];
const descrUser3 = [
@ -75,7 +75,7 @@ const descrUser3 = [
'Cant print the file',
'Can create new files from the editor',
'Can see the information about Group2 users',
'Cant submit forms'
// "Cant submit forms"
];
const descrUser0 = [
@ -91,7 +91,7 @@ const descrUser0 = [
'Can\'t view chat',
'Can\'t protect file',
'View file without collaboration',
'Cant submit forms'
// "Cant submit forms"
];
const users = [

View File

@ -1,12 +1,12 @@
{
"name": "OnlineEditorsExampleNodeJS",
"version": "1.6.0",
"version": "4.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "OnlineEditorsExampleNodeJS",
"version": "1.6.0",
"version": "4.1.0",
"license": "Apache",
"dependencies": {
"body-parser": "^1.19.0",

View File

@ -211,43 +211,19 @@
innerAlert("onRequestSendNotify: " + data);
};
var onRequestOpen = function(event) { // user open external data source
innerAlert("onRequestOpen");
var windowName = event.data.windowName;
requestReference(event.data, function (data) {
if (data.error) {
var winEditor = window.open("", windowName);
winEditor.close();
innerAlert(data.error, true);
return;
}
var link = data.link;
window.open(link, windowName);
});
};
var onRequestReferenceData = function(event) { // user refresh external data source
innerAlert("onRequestReferenceData");
requestReference(event.data, function (data) {
docEditor.setReferenceData(data);
});
};
var requestReference = function(data, callback) {
innerAlert(data);
innerAlert(event.data);
event.data.directUrl = !!config.document.directUrl;
let xhr = new XMLHttpRequest();
xhr.open("POST", "reference");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(data));
xhr.send(JSON.stringify(event.data));
xhr.onload = function () {
innerAlert(xhr.responseText);
callback(JSON.parse(xhr.responseText));
docEditor.setReferenceData(JSON.parse(xhr.responseText));
}
};
@ -346,7 +322,6 @@
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
"onRequestOpen": onRequestOpen,
};
if (<%- JSON.stringify(editor.userid) %> != null) {

View File

@ -1,14 +0,0 @@
FROM php:8.2.8-fpm-alpine3.18 AS example
WORKDIR /srv
COPY . .
RUN \
chown -R www-data:www-data /srv && \
apk update && \
apk add --no-cache \
composer \
make && \
make prod
CMD ["make", "server-prod"]
FROM nginx:1.23.4-alpine3.17 AS proxy
COPY proxy/nginx.conf /etc/nginx/nginx.conf

View File

@ -4,16 +4,16 @@ ADDRESS := $(ADDRESS)
PORT := $(PORT)
.PHONY: help
help: # Show help message for each of the Makefile recipes.
help: # Show help message for each of the Makefile recipes.
@grep -E "^[a-z-]+: #" $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ": # "}; {printf "%s: %s\n", $$1, $$2}'
.PHONY: dev
dev: # Install development dependencies.
dev: # Install development dependencies.
@composer install
.PHONY: prod
prod: # Install production dependencies.
prod: # Install production dependencies.
@composer install --no-dev
ifeq ($(ADDRESS),)
@ -33,7 +33,7 @@ server-dev: \
endif
.PHONY: server-dev
server-dev: # Start the development server on localhost at $PORT (default: 9000).
server-dev: # Start the development server on localhost at $PORT (default: 9000).
@php --server $(ADDRESS):$(PORT)
ifeq ($(ADDRESS),)
@ -53,20 +53,15 @@ server-prod: \
endif
.PHONY: server-prod
server-prod: # Start the production server on 0.0.0.0 at $PORT (default: 9000).
server-prod: # Start the production server on 0.0.0.0 at $PORT (default: 9000).
@php-fpm --fpm-config php-fpm.conf
.PHONY: compose-prod
compose-prod: # Up containers in a production environment.
@docker-compose build
@docker-compose up --detach
.PHONY: lint
lint: # Lint the source code for the style.
lint: # Lint the source code for the style.
@./vendor/bin/phpcs .
.PHONY: test
test: # Run tests recursively.
test: # Run tests recursively.
@./vendor/bin/phpunit \
--test-suffix "Tests.php" \
--display-incomplete \
@ -74,4 +69,12 @@ test: # Run tests recursively.
--display-errors \
--display-notices \
--display-warnings \
src
common
@./vendor/bin/phpunit \
--test-suffix "Tests.php" \
--display-incomplete \
--display-deprecations \
--display-errors \
--display-notices \
--display-warnings \
configuration

View File

@ -15,14 +15,14 @@
* limitations under the License.
*/
namespace Example;
namespace OnlineEditorsExamplePhp;
use Exception;
use Example\Common\Path;
use Example\Configuration\ConfigurationManager;
use Example\Helpers\ConfigManager;
use Example\Helpers\ExampleUsers;
use Example\Helpers\JwtManager;
use OnlineEditorsExamplePhp\Common\Path;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Helpers\ConfigManager;
use OnlineEditorsExamplePhp\Helpers\ExampleUsers;
use OnlineEditorsExamplePhp\Helpers\JwtManager;
/**
* Check if the request is an AJAX request
@ -340,7 +340,7 @@ function files()
function assets()
{
$fileName = basename($_GET["name"]);
$filePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' .
$filePath = dirname(__FILE__) .
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "document-templates"
. DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
downloadFile($filePath);
@ -354,7 +354,7 @@ function assets()
function csv()
{
$fileName = "csv.csv";
$filePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' .
$filePath = dirname(__FILE__) .
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "document-templates"
. DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
downloadFile($filePath);

View File

@ -15,7 +15,7 @@
// limitations under the License.
//
namespace Example\Common;
namespace OnlineEditorsExamplePhp\Common;
enum HTTPStatus: int {
case not_found = 404;

View File

@ -15,7 +15,7 @@
// limitations under the License.
//
namespace Example\Common;
namespace OnlineEditorsExamplePhp\Common;
final class Path {
private string $separator = DIRECTORY_SEPARATOR;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\Path;
use OnlineEditorsExamplePhp\Common\Path;
final class PathAbsolutePOSIXTests extends TestCase {
public function test_recognizes_an_empty_as_a_non_absolute() {

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\Path;
use OnlineEditorsExamplePhp\Common\Path;
final class PathJoinPOSIXTests extends TestCase {
public function test_joins_a_relative_to_an_empty_one() {

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\Path;
use OnlineEditorsExamplePhp\Common\Path;
final class PathNormalizePOSIXTests extends TestCase {
public function test_normalizes() {

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\Path;
use OnlineEditorsExamplePhp\Common\Path;
final class PathStringPOSIXTests extends TestCase {
public function test_generates_with_an_empty() {

View File

@ -15,7 +15,7 @@
// limitations under the License.
//
namespace Example\Common;
namespace OnlineEditorsExamplePhp\Common;
final class URL {
private string $string;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\URL;
use OnlineEditorsExamplePhp\Common\URL;
final class URLFromComponentsTests extends TestCase {
public function test_creates() {

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\URL;
use OnlineEditorsExamplePhp\Common\URL;
final class URLJoinPathTests extends TestCase {
public function test_joins_a_relative_to_an_empty_one() {

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Common\URL;
use OnlineEditorsExamplePhp\Common\URL;
final class URLStringTests extends TestCase {
public function test_generates() {

View File

@ -9,10 +9,11 @@
},
"autoload": {
"psr-4": {
"Example\\Common\\": "src/common/",
"Example\\Configuration\\" : "src/configuration/",
"Example\\Helpers\\" : "src/helpers/",
"Example\\Views\\" : "src/views/"
"OnlineEditorsExamplePhp\\" : "",
"OnlineEditorsExamplePhp\\Common\\": "common/",
"OnlineEditorsExamplePhp\\Configuration\\" : "configuration/",
"OnlineEditorsExamplePhp\\Helpers\\" : "helpers/",
"OnlineEditorsExamplePhp\\Views\\" : "views/"
}
}
}

View File

@ -15,10 +15,10 @@
// limitations under the License.
//
namespace Example\Configuration;
namespace OnlineEditorsExamplePhp\Configuration;
use Example\Common\Path;
use Example\Common\URL;
use OnlineEditorsExamplePhp\Common\Path;
use OnlineEditorsExamplePhp\Common\URL;
final class ConfigurationManager {
public string $version = '1.6.0';
@ -98,7 +98,6 @@ final class ConfigurationManager {
$storage_string_directory = $storage_directory->string();
$current_directory = new Path(__DIR__);
$directory = $current_directory
->join_path('..')
->join_path('..')
->join_path($storage_string_directory);
return $directory->normalize();

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerConversionTimeoutTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerDocumentServerAPIURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerDocumentServerCommandURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerDocumentServerConverterURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerDocumentServerPreloaderURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerDocumentServerURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerExampleURLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerJWTHeaderTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerJWTSecretTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerJWTUseForRequest extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerMaximumFileSizeTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerSSLTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerSingleUserTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerStoragePathTests extends TestCase {
public array $env;

View File

@ -16,7 +16,7 @@
//
use PHPUnit\Framework\TestCase;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class ConfigurationManagerTests extends TestCase {
public function test_corresponds_the_latest_version() {

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View File

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 757 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 593 B

View File

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 738 B

View File

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 477 B

View File

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View File

Before

Width:  |  Height:  |  Size: 992 B

After

Width:  |  Height:  |  Size: 992 B

View File

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 1004 B

View File

Before

Width:  |  Height:  |  Size: 379 B

After

Width:  |  Height:  |  Size: 379 B

View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

View File

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 631 B

View File

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

View File

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 488 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 790 B

View File

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

View File

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 549 B

View File

Before

Width:  |  Height:  |  Size: 438 B

After

Width:  |  Height:  |  Size: 438 B

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -151,19 +151,19 @@ label .checkbox {
}
.try-editor.word {
background-image: url("/assets/images/file_docx.svg");
background-image: url("images/file_docx.svg");
}
.try-editor.cell {
background-image: url("/assets/images/file_xlsx.svg");
background-image: url("images/file_xlsx.svg");
}
.try-editor.slide {
background-image: url("/assets/images/file_pptx.svg");
background-image: url("images/file_pptx.svg");
}
.try-editor.form {
background-image: url("/assets/images/file_docxf.svg");
background-image: url("images/file_docxf.svg");
}
.side-option {
@ -235,7 +235,7 @@ label .checkbox {
}
.file-upload {
background: url("/assets/images/file_upload.svg") no-repeat 0 transparent;
background: url("images/file_upload.svg") no-repeat 0 transparent;
cursor: pointer;
display: block;
font-size: 14px;
@ -308,7 +308,7 @@ label .checkbox {
}
.error-message {
background: url("/assets/images/error.svg") no-repeat scroll 4px 10px;
background: url("images/error.svg") no-repeat scroll 4px 10px;
color: #CB0000;
display: none;
line-height: 160%;
@ -329,15 +329,15 @@ label .checkbox {
}
.current {
background-image: url("/assets/images/loader16.gif");
background-image: url("images/loader16.gif");
}
.done {
background-image: url("/assets/images/done.svg");
background-image: url("images/done.svg");
}
.error {
background-image: url("/assets/images/notdone.svg");
background-image: url("images/notdone.svg");
}
.step-descr {
@ -451,17 +451,17 @@ footer table tr td:first-child {
.stored-edit.word,
.uploadFileName.word {
background-image: url("/assets/images/icon_docx.svg");
background-image: url("images/icon_docx.svg");
}
.stored-edit.cell,
.uploadFileName.cell {
background-image: url("/assets/images/icon_xlsx.svg");
background-image: url("images/icon_xlsx.svg");
}
.stored-edit.slide,
.uploadFileName.slide {
background-image: url("/assets/images/icon_pptx.svg");
background-image: url("images/icon_pptx.svg");
}
.stored-edit span {
@ -490,7 +490,7 @@ footer table tr td:first-child {
}
.dialog-close {
background: url("/assets/images/close.svg") no-repeat scroll left top;
background: url("images/close.svg") no-repeat scroll left top;
cursor: pointer;
float: right;
font-size: 1px;
@ -766,4 +766,4 @@ html {
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
}

View File

@ -1,40 +0,0 @@
version: "3.8"
services:
document-server:
container_name: document-server
image: onlyoffice/documentserver:7.3.3.50
expose:
- "80"
environment:
- JWT_SECRET=your-256-bit-secret
example:
container_name: example
build:
context: .
target: example
expose:
- "80"
volumes:
- "example:/srv"
environment:
- ADDRESS=0.0.0.0
- DOCUMENT_SERVER_URL=http://localhost:8080/
- EXAMPLE_URL=http://proxy
- JWT_SECRET=your-256-bit-secret
- PORT=80
proxy:
container_name: proxy
build:
context: .
target: proxy
ports:
- "80:80"
- "8080:8080"
volumes:
- "example:/srv"
volumes:
example:

View File

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View File

@ -15,14 +15,14 @@
* limitations under the License.
*/
namespace Example;
namespace OnlineEditorsExamplePhp;
use Exception;
use Example\Configuration\ConfigurationManager;
use Example\Helpers\ConfigManager;
use Example\Helpers\ExampleUsers;
use Example\Helpers\JwtManager;
use Example\Helpers\Users;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Helpers\ConfigManager;
use OnlineEditorsExamplePhp\Helpers\ExampleUsers;
use OnlineEditorsExamplePhp\Helpers\JwtManager;
use OnlineEditorsExamplePhp\Helpers\Users;
/**
* Put log files into the log folder
@ -159,7 +159,7 @@ function getInternalExtension($filename)
function getTemplateImageUrl($filename)
{
$ext = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$path = serverPath(true) . "/assets/images/";
$path = serverPath(true) . "/css/images/";
$configManager = new ConfigManager();
foreach ($configManager->getSuppotredFormats() as $format) {
@ -827,7 +827,6 @@ function tryGetDefaultByType($createExt, $user)
$sample = isset($_GET["sample"]) && $_GET["sample"];
$demoName = ($sample ? "sample." : "new.") . $createExt;
$demoPath =
'..' . DIRECTORY_SEPARATOR .
"assets" . DIRECTORY_SEPARATOR .
"document-templates" . DIRECTORY_SEPARATOR .
($sample ? "sample" : "new") . DIRECTORY_SEPARATOR;

View File

@ -1,6 +1,6 @@
<?php
namespace Example\Helpers;
namespace OnlineEditorsExamplePhp\Helpers;
/**
* (c) Copyright Ascensio System SIA 2023

View File

@ -1,8 +1,8 @@
<?php
namespace Example\Helpers;
namespace OnlineEditorsExamplePhp\Helpers;
use function Example\sendlog;
use function OnlineEditorsExamplePhp\sendlog;
/**
* (c) Copyright Ascensio System SIA 2023

View File

@ -1,6 +1,6 @@
<?php
namespace Example\Helpers;
namespace OnlineEditorsExamplePhp\Helpers;
/**
* (c) Copyright Ascensio System SIA 2023
@ -20,7 +20,7 @@ namespace Example\Helpers;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use Example\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
final class JwtManager
{

View File

@ -1,6 +1,6 @@
<?php
namespace Example\Helpers;
namespace OnlineEditorsExamplePhp\Helpers;
/**
* (c) Copyright Ascensio System SIA 2023

View File

@ -15,18 +15,18 @@
* limitations under the License.
*/
namespace Example;
namespace OnlineEditorsExamplePhp;
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/src/ajax.php';
require_once __DIR__ . '/src/functions.php';
require_once __DIR__ . '/src/trackmanager.php';
require_once __DIR__ . '/ajax.php';
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/trackmanager.php';
use Example\Common\HTTPStatus;
use Example\Common\URL;
use Example\Configuration\ConfigurationManager;
use Example\Views\DocEditorView;
use Example\Views\IndexView;
use OnlineEditorsExamplePhp\Common\HTTPStatus;
use OnlineEditorsExamplePhp\Common\URL;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Views\DocEditorView;
use OnlineEditorsExamplePhp\Views\IndexView;
function configure() {
$config_manager = new ConfigurationManager();

View File

@ -1,47 +0,0 @@
worker_processes auto;
events {
worker_connections 512;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
root /srv;
server_name localhost;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass example:80;
}
}
server {
listen 8080;
server_name localhost;
location / {
client_max_body_size 100m;
proxy_http_version 1.1;
proxy_pass http://document-server;
proxy_redirect off;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_x_forwarded_host;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Real-IP $remote_addr;
}
}
}

View File

@ -6,7 +6,7 @@
maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<link rel="icon" href="assets/images/{docType}.ico" type="image/x-icon" />
<link rel="icon" href="css/images/{docType}.ico" type="image/x-icon" />
<title>ONLYOFFICE</title>
<style>

View File

@ -5,21 +5,21 @@
<meta name="viewport" content="width=device-width" />
<title>ONLYOFFICE Document Editors</title>
<link rel="icon" href="assets/images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:900,
800,700,600,500,400,300&subset=latin,cyrillic-ext,cyrillic,latin-ext" />
<link rel="stylesheet" type="text/css" href="assets/css/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="assets/css/media.css">
<link rel="stylesheet" type="text/css" href="assets/css/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="css/media.css">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
</head>
<body>
<form id="form1">
<header>
<div class="center">
<a href="">
<img src ="assets/images/logo.svg" alt="ONLYOFFICE" />
<img src ="css/images/logo.svg" alt="ONLYOFFICE" />
</a>
</div>
</header>
@ -66,7 +66,7 @@
<tr>
<td valign="middle">
<span class="select-user">Username</span>
<img id="info" class="info" src="assets/images/info.svg" />
<img id="info" class="info" src="css/images/info.svg" />
<select class="select-user" id="user">
{userOpts}
</select>
@ -77,7 +77,7 @@
<span class="select-user">Language</span>
<img class="info info-tooltip" data-id="language"
data-tooltip="Choose the language for ONLYOFFICE editors interface"
src="assets/images/info.svg" />
src="css/images/info.svg" />
<select class="select-user" id="language">
{langs}
</select>
@ -92,7 +92,7 @@
data-id="directUrlInfo" data-tooltip=
"Some files can be opened in the user's
browser without connecting to the document server."
src="assets/images/info.svg" />
src="css/images/info.svg" />
</label>
</td>
</tr>
@ -203,14 +203,14 @@
</footer>
</form>
<script type="text/javascript" src="assets/js/jquery-3.6.4.min.js"></script>
<script type="text/javascript" src="assets/js/jquery-migrate-3.4.1.min.js"></script>
<script type="text/javascript" src="assets/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.blockUI.js"></script>
<script type="text/javascript" src="assets/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="assets/js/jquery.fileupload.js"></script>
<script type="text/javascript" src="assets/js/jquery.dropdownToggle.js"></script>
<script type="text/javascript" src="assets/js/jscript.js"></script>
<script type="text/javascript" src="js/jquery-3.6.4.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-3.4.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.blockUI.js"></script>
<script type="text/javascript" src="js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="js/jquery.fileupload.js"></script>
<script type="text/javascript" src="js/jquery.dropdownToggle.js"></script>
<script type="text/javascript" src="js/jscript.js"></script>
<script type="text/javascript">
var FillFormsExtList = '{fillFormsExtList}';
var ConverExtList = '{converExtList}';

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
namespace Example;
namespace OnlineEditorsExamplePhp;
use Exception;
use Example\Configuration\ConfigurationManager;
use Example\Helpers\ConfigManager;
use Example\Helpers\JwtManager;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Helpers\ConfigManager;
use OnlineEditorsExamplePhp\Helpers\JwtManager;
/**
* Read request body

View File

@ -15,25 +15,25 @@
* limitations under the License.
*/
namespace Example\Views;
namespace OnlineEditorsExamplePhp\Views;
use Example\Configuration\ConfigurationManager;
use Example\Helpers\ConfigManager;
use Example\Helpers\ExampleUsers;
use Example\Helpers\JwtManager;
use function Example\doUpload;
use function Example\fileUri;
use function Example\getCallbackUrl;
use function Example\getCreateUrl;
use function Example\getDocEditorKey;
use function Example\getDocumentType;
use function Example\getDownloadUrl;
use function Example\getHistory;
use function Example\getStoragePath;
use function Example\getTemplateImageUrl;
use function Example\serverPath;
use function Example\tryGetDefaultByType;
use function Example\getCurUserHostAddress;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Helpers\ConfigManager;
use OnlineEditorsExamplePhp\Helpers\ExampleUsers;
use OnlineEditorsExamplePhp\Helpers\JwtManager;
use function OnlineEditorsExamplePhp\doUpload;
use function OnlineEditorsExamplePhp\fileUri;
use function OnlineEditorsExamplePhp\getCallbackUrl;
use function OnlineEditorsExamplePhp\getCreateUrl;
use function OnlineEditorsExamplePhp\getDocEditorKey;
use function OnlineEditorsExamplePhp\getDocumentType;
use function OnlineEditorsExamplePhp\getDownloadUrl;
use function OnlineEditorsExamplePhp\getHistory;
use function OnlineEditorsExamplePhp\getStoragePath;
use function OnlineEditorsExamplePhp\getTemplateImageUrl;
use function OnlineEditorsExamplePhp\serverPath;
use function OnlineEditorsExamplePhp\tryGetDefaultByType;
use function OnlineEditorsExamplePhp\getCurUserHostAddress;
final class DocEditorView extends View
{
@ -191,11 +191,11 @@ final class DocEditorView extends View
// an image for inserting
$dataInsertImage = $isEnableDirectUrl ? [
"fileType" => "png",
"url" => serverPath(true) . "/assets/images/logo.png",
"directUrl" => serverPath(false) . "/assets/images/logo.png",
"url" => serverPath(true) . "/css/images/logo.png",
"directUrl" => serverPath(false) . "/css/images/logo.png",
] : [
"fileType" => "png",
"url" => serverPath(true) . "/assets/images/logo.png",
"url" => serverPath(true) . "/css/images/logo.png",
];
// a document for comparing

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
namespace Example\Views;
namespace OnlineEditorsExamplePhp\Views;
use function Example\getStoredFiles;
use function Example\getFileVersion;
use function Example\getHistoryDir;
use function Example\getStoragePath;
use function OnlineEditorsExamplePhp\getStoredFiles;
use function OnlineEditorsExamplePhp\getFileVersion;
use function OnlineEditorsExamplePhp\getHistoryDir;
use function OnlineEditorsExamplePhp\getStoragePath;
class IndexStoredListView extends View
{
@ -58,35 +58,35 @@ class IndexStoredListView extends View
$layout .= ' <td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user=' . htmlentities($user).$directUrlArg.
'&action=edit&type=desktop" target="_blank">'.
'<img src="assets/images/desktop.svg" alt="Open in editor for full size screens"'.
'<img src="css/images/desktop.svg" alt="Open in editor for full size screens"'.
' title="Open in editor for full size screens"/></a></td>'.
' <td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user=' . htmlentities($user).$directUrlArg.
'&action=edit&type=mobile" target="_blank">'.
'<img src="assets/images/mobile.svg" alt="Open in editor for mobile devices"'.
'<img src="css/images/mobile.svg" alt="Open in editor for mobile devices"'.
' title="Open in editor for mobile devices" /></a></td>'.
' <td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=comment&type=desktop" target="_blank">'.
' <img src="assets/images/comment.svg" alt="Open in editor for comment"'.
' <img src="css/images/comment.svg" alt="Open in editor for comment"'.
' title="Open in editor for comment" /></a></td>';
if ($storeFile->documentType == "word") {
$layout .= '<td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=review&type=desktop" target="_blank">'.
' <img src="assets/images/review.svg" alt="Open in editor for review"'.
' <img src="css/images/review.svg" alt="Open in editor for review"'.
' title="Open in editor for review" /></a></td>'.
' <td class="contentCells contentCells-icon "> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=blockcontent&type=desktop" target="_blank">'.
' <img src="assets/images/block-content.svg"'.
' <img src="css/images/block-content.svg"'.
' alt="Open in editor without content control modification"'.
' title="Open in editor without content control modification"</a></td>';
} elseif ($storeFile->documentType == "cell") {
$layout .= '<td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=filter&type=desktop" target="_blank">'.
' <img src="assets/images/filter.svg" alt="Open in editor without access to change the filter"'.
' <img src="css/images/filter.svg" alt="Open in editor without access to change the filter"'.
' title="Open in editor without access to change the filter" /></a></td>';
} else {
$layout .= '<td class="contentCells contentCells-icon"></td>';
@ -98,7 +98,7 @@ class IndexStoredListView extends View
' <a href="editor?fileID='.urlencode($storeFile->name).
'&user='.htmlentities($user).$directUrlArg.
'&action=fillForms&type=desktop" target="_blank">'.
' <img src="assets/images/fill-forms.svg" alt="Open in editor for filling in forms"'.
' <img src="css/images/fill-forms.svg" alt="Open in editor for filling in forms"'.
' title="Open in editor for filling in forms" /></a></td>';
} else {
$layout .= '<td class="contentCells contentCells-shift contentCells-icon'.
@ -108,7 +108,7 @@ class IndexStoredListView extends View
$layout .= '<td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=fillForms&type=desktop" target="_blank">'.
' <img src="assets/images/mobile-fill-forms.svg" alt="Open in editor for filling in forms'.
' <img src="css/images/mobile-fill-forms.svg" alt="Open in editor for filling in forms'.
'for mobile devices" title="Open in editor for filling in forms for mobile devices" /></a></td>'.
'<td class="contentCells contentCells-icon"></td>'.
'<td class="contentCells contentCells-icon"></td>'.
@ -116,7 +116,7 @@ class IndexStoredListView extends View
'<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">'.
'<a href="editor?fileID='.urlencode($storeFile->name).'&user='.htmlentities($user).
$directUrlArg.'&action=fillForms&type=desktop" target="_blank">'.
'<img src="assets/images/fill-forms.svg" alt="Open in editor for filling in forms"'.
'<img src="css/images/fill-forms.svg" alt="Open in editor for filling in forms"'.
' title="Open in editor for filling in forms"/></a></td>';
} else {
$layout .= '<td class="contentCells contentCells-shift contentCells-icon' .
@ -125,25 +125,25 @@ class IndexStoredListView extends View
$layout .= '<td class="contentCells contentCells-icon firstContentCellViewers">'.
' <a href="editor?fileID='.urlencode($storeFile->name).'&user='.htmlentities($user).
$directUrlArg.'&action=view&type=desktop" target="_blank">'.
' <img src="assets/images/desktop.svg" alt="Open in viewer for full size screens"'.
' <img src="css/images/desktop.svg" alt="Open in viewer for full size screens"'.
' title="Open in viewer for full size screens" /></a></td>'.
' <td class="contentCells contentCells-icon"> <a href="editor?fileID='.
urlencode($storeFile->name).'&user='.htmlentities($user).$directUrlArg.
'&action=view&type=mobile" target="_blank">'.
' <img src="assets/images/mobile.svg" alt="Open in viewer for mobile devices"'.
' <img src="css/images/mobile.svg" alt="Open in viewer for mobile devices"'.
' title="Open in viewer for mobile devices" /></a></td>'.
' <td class="contentCells contentCells-icon contentCells-shift">'.
' <a href="editor?fileID='.urlencode($storeFile->name).'&user='.htmlentities($user).
$directUrlArg.'&action=embedded&type=embedded" target="_blank">'.
' <img src="assets/images/embeded.svg" alt="Open in embedded mode"'.
' <img src="css/images/embeded.svg" alt="Open in embedded mode"'.
' title="Open in embedded mode" /></a>'.
' <td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">'.
'<a href="download?fileName='.urlencode($storeFile->name).'">'.
' <img class="icon-download" src="assets/images/download.svg" alt="Download" title="Download"'.
' <img class="icon-download" src="css/images/download.svg" alt="Download" title="Download"'.
' /></a></td>'.
'<td class="contentCells contentCells-icon contentCells-shift">'.
' <a class="delete-file" data="'.$storeFile->name.'">'.
' <img class="icon-delete" src="assets/images/delete.svg" alt="Delete" title="Delete" /></a>'.
' <img class="icon-delete" src="css/images/delete.svg" alt="Delete" title="Delete" /></a>'.
'</td></tr>';
}
}

View File

@ -15,12 +15,12 @@
* limitations under the License.
*/
namespace Example\Views;
namespace OnlineEditorsExamplePhp\Views;
use Example\Configuration\ConfigurationManager;
use Example\Helpers\ConfigManager;
use Example\Helpers\ExampleUsers;
use function Example\getStoredFiles;
use OnlineEditorsExamplePhp\Configuration\ConfigurationManager;
use OnlineEditorsExamplePhp\Helpers\ConfigManager;
use OnlineEditorsExamplePhp\Helpers\ExampleUsers;
use function OnlineEditorsExamplePhp\getStoredFiles;
final class IndexView extends View
{

Some files were not shown because too many files have changed in this diff Show More