Merge remote-tracking branch 'remotes/origin/develop' into force-conversion-correct-formats

This commit is contained in:
Sergey Linnik
2024-11-21 17:05:25 +03:00
297 changed files with 15032 additions and 728 deletions

View File

@ -289,9 +289,10 @@ public class IndexServlet extends HttpServlet {
FileType fileType = FileUtility.getFileType(fileName);
// get an auto-conversion extension from the request body or set it to the ooxml extension
String conversionExtension = body.get("fileExt") != null ? (String) body.get("fileExt") : "ooxml";
Boolean keepOriginal = body.get("keepOriginal") != null ? (Boolean) body.get("keepOriginal") : false;
// check if the file with such an extension can be converted
if (DocumentManager.getConvertExts().contains(fileExt)) {
if (DocumentManager.getConvertExts().contains(fileExt) || body.get("fileExt") != null) {
// generate document key
String key = ServiceConverter.generateRevisionId(fileUri);
@ -299,17 +300,25 @@ public class IndexServlet extends HttpServlet {
Map<String, String> newFileData = ServiceConverter
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
String newFileUri = newFileData.get("fileUrl");
String newFileType = "." + newFileData.get("fileType");
String newFileType = newFileData.get("fileType");
if (newFileUri.isEmpty()) {
writer.write("{ \"step\" : \"0\", \"filename\" : \"" + fileName + "\"}");
return;
}
if (!new FormatManager().getFormats().stream().anyMatch(
f -> newFileType.equals(f.getName()) && f.getType() != null
)) {
writer.write("{ \"step\" : \"100\", \"filename\" : \"" + newFileUri
+ "\", \"error\":\"FileTypeIsNotSupported\"}");
return;
}
/* get a file name of an internal file extension with an index if the file
with such a name already exists */
String correctName = DocumentManager.getCorrectName(FileUtility
.getFileNameWithoutExtension(fileName) + newFileType, null);
.getFileNameWithoutExtension(fileName) + "." + newFileType, null);
URL url = new URL(newFileUri);
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
@ -333,9 +342,11 @@ public class IndexServlet extends HttpServlet {
connection.disconnect();
// remove source file
File sourceFile = new File(DocumentManager.storagePath(fileName, null));
sourceFile.delete();
if (!keepOriginal) {
// remove source file
File sourceFile = new File(DocumentManager.storagePath(fileName, null));
sourceFile.delete();
}
fileName = correctName;
@ -343,6 +354,9 @@ public class IndexServlet extends HttpServlet {
User user = Users.getUser(cm.getCookie("uid"));
DocumentManager.createMeta(fileName, user.getId(), user.getName(), null);
writer.write("{ \"step\" : \"100\", \"filename\" : \"" + fileName + "\"}");
return;
}
writer.write("{ \"filename\" : \"" + fileName + "\"}");

View File

@ -1,4 +1,22 @@
.center {
/**
*
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
.center {
width: auto;
}

View File

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4285 13C14.4102 13 14 13 14 13.5V15H6C5.44772 15 5 15.4477 5 16V17C5 17.5523 5.44771 18 6 18H14V19.5C14 20 14.3816 20 14.4285 20C14.6359 20 15.0099 19.9113 15.2172 19.7363L18.6207 17.0833C19.1264 16.6566 19.1264 16.3434 18.6207 15.9167L15.2172 13.2637C15.0099 13.0887 14.6359 13 14.4285 13Z" fill="#444444"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5715 4C9.58984 4 10 4 10 4.50002V6H18C18.5523 6 19 6.44772 19 7V8C19 8.55228 18.5523 9 18 9H10V10.5C10 11 9.61841 11 9.57151 11C9.36409 11 8.99012 10.9113 8.78279 10.7363L5.37934 8.08333C4.87356 7.65662 4.87356 7.34338 5.37934 6.91667L8.78279 4.26366C8.99012 4.08874 9.36409 4 9.5715 4Z" fill="#444444"/>
</svg>

After

Width:  |  Height:  |  Size: 821 B

View File

@ -1 +1 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#1E7AAA"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#000" fill-opacity=".25"/><path d="M6 15h18v1H6v-1zM6 19h18v1H6v-1zM6 23h18v1H6v-1zM6 27h18v1H6v-1z" fill="#fff"/></svg>
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2.5C0 1.11929 1.11929 0 2.5 0H21l9 9v28.5c0 1.3807-1.1193 2.5-2.5 2.5h-25C1.11929 40 0 38.8807 0 37.5v-35Z" fill="#287CA9"/><path d="m21 0 9 9h-7.3636C21.7326 9 21 8.26737 21 7.36364V0Z" fill="#000" fill-opacity=".25"/><rect x="6" y="16" width="18" height="1.5" rx=".75" fill="#fff"/><rect x="6" y="22" width="18" height="1.5" rx=".75" fill="#fff"/><rect x="6" y="28" width="11" height="1.5" rx=".75" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 527 B

View File

@ -1,5 +1 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 3C0 1.34315 1.34315 0 3 0H23L30 7V37C30 38.6569 28.6569 40 27 40H3C1.34315 40 0 38.6569 0 37V3Z" fill="#9E1919"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0062 15V16.0065H24V15H17.0062ZM17.0062 19V20.0163H24V19H17.0062ZM24 23H17.0062V24.0261H24V23ZM6 28V27.0293H24V28H6ZM7 16H14V23H7V16ZM6 15H7H14H15V16V23V24H14H7H6V23V16V15Z" fill="white"/>
<path d="M23 0L30 7H26C24.3431 7 23 5.65685 23 4V0Z" fill="black" fill-opacity="0.25"/>
</svg>
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2.5C0 1.11929 1.11929 0 2.5 0H21l9 9v28.5c0 1.3807-1.1193 2.5-2.5 2.5h-25C1.11929 40 0 38.8807 0 37.5v-35Z" fill="#E54D39"/><rect x="6" y="28" width="18" height="1.5" rx=".75" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 16c-.41421 0-.75.3358-.75.75v6c0 .3624.25709.6648.59885.7348.04882.01.09937.0152.15115.0152h6.5c.4142 0 .75-.3358.75-.75v-6c0-.4142-.3358-.75-.75-.75h-6.5Zm5.75 1.5h-5V22h5v-4.5Z" fill="#fff"/><rect x="18" y="22" width="6" height="1.5" rx=".75" fill="#fff"/><rect x="18" y="16" width="6" height="1.5" rx=".75" fill="#fff"/><path d="m21 0 9 9h-7.3636C21.7326 9 21 8.26737 21 7.36364V0Z" fill="#000" fill-opacity=".25"/></svg>

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 775 B

View File

@ -1 +1 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#F36700"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#000" fill-opacity=".25"/><path stroke="#fff" stroke-opacity=".95" d="M6.5 15.5h17v12h-17z"/></svg>
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2.5C0 1.11929 1.11929 0 2.5 0H21l9 9v28.5c0 1.3807-1.1193 2.5-2.5 2.5h-25C1.11929 40 0 38.8807 0 37.5v-35Z" fill="#F36700"/><path d="m21 0 9 9h-7.3636C21.7326 9 21 8.26737 21 7.36364V0Z" fill="#000" fill-opacity=".25"/><rect x="6" y="16" width="18" height="1.5" rx=".75" fill="#fff"/><rect x="6" y="28" width="18" height="1.5" rx=".75" fill="#fff"/><rect x="7.5" y="16" width="13.5" height="1.5" rx=".75" transform="rotate(90 7.5 16)" fill="#fff"/><rect x="24" y="16" width="13.5" height="1.5" rx=".75" transform="rotate(90 24 16)" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 658 B

View File

@ -1 +1 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#D0D5DA"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#646464"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 23c-.27614 0-.5.2239-.5.5v4c0 .2761.22386.5.5.5h15c.2761 0 .5-.2239.5-.5v-4c0-.2761-.2239-.5-.5-.5h-2c-.2761 0-.5-.2239-.5-.5s.2239-.5.5-.5h2c.8284 0 1.5.6716 1.5 1.5v4c0 .8284-.6716 1.5-1.5 1.5h-15c-.82843 0-1.5-.6716-1.5-1.5v-4c0-.8284.67157-1.5 1.5-1.5h2c.27614 0 .5.2239.5.5s-.22386.5-.5.5h-2z" fill="#646464"/><path fill-rule="evenodd" clip-rule="evenodd" d="M20 20.0001L15 14l-5 6.0001h3v4c0 .5523.4477 1 1 1h2c.5523 0 1-.4477 1-1v-4h3z" fill="#646464"/></svg>
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3Z" fill="#D0D5DA"/><path d="m23 0 7 7h-4c-1.6569 0-3-1.34315-3-3V0Z" fill="#646464"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 23c-.27614 0-.5.2239-.5.5v4c0 .2761.22386.5.5.5h15c.2761 0 .5-.2239.5-.5v-4c0-.2761-.2239-.5-.5-.5h-2c-.2761 0-.5-.2239-.5-.5s.2239-.5.5-.5h2c.8284 0 1.5.6716 1.5 1.5v4c0 .8284-.6716 1.5-1.5 1.5h-15c-.82843 0-1.5-.6716-1.5-1.5v-4c0-.8284.67157-1.5 1.5-1.5h2c.27614 0 .5.2239.5.5s-.22386.5-.5.5h-2Z" fill="#646464"/><path fill-rule="evenodd" clip-rule="evenodd" d="M20 20.0001 15 14l-5 6.0001h3v4c0 .5522.4477 1 1 1h2c.5523 0 1-.4478 1-1v-4h3Z" fill="#646464"/></svg>

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 797 B

View File

@ -1 +1 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#6AAA1E"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#000" fill-opacity=".25"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6 15h18v13H7.00001v-1H12v-3H7v4H6V15zm7 12h4v-3h-4v3zm5 0h5v-3h-5v3zm5-7v3h-5v-3h5zm-6 0v3h-4v-3h4zm-5 0v3H7v-3h5zm11-1v-3h-5v3h5zm-10-3h4v3h-4v-3zm-1 3v-3H7v3h5z" fill="#fff" fill-opacity=".95"/></svg>
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 2.5C0 1.11929 1.11929 0 2.5 0H21l9 9v28.5c0 1.3807-1.1193 2.5-2.5 2.5h-25C1.11929 40 0 38.8807 0 37.5v-35Z" fill="#3AA133"/><path d="m21 0 9 9h-7.3636C21.7326 9 21 8.26737 21 7.36364V0Z" fill="#000" fill-opacity=".25"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 16c-.41421 0-.75.3358-.75.75v11.5c0 .0877.01504.1718.04268.25-.02764.0782-.04268.1623-.04268.25 0 .4142.33579.75.75.75h16.5c.4142 0 .75-.3358.75-.75 0-.0877-.015-.1718-.0427-.25.0277-.0782.0427-.1623.0427-.25v-11.5c0-.4142-.3358-.75-.75-.75H6.75Zm5.75 1.5h-5V22h5v-4.5ZM14 22v-4.5h8.5V22H14Zm-1.5 1.5h-5V28h5v-4.5ZM14 28v-4.5h8.5V28H14Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 738 B

View File

@ -1,12 +1 @@
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.84616 1H10.8462L14.8462 5V15H2.84616V1Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.8462 5L10.8462 1H2.84616V15H14.8462V5ZM10.8462 0L15.8462 5V16H1.84616V0H10.8462Z" fill="#BFBFBF"/>
<rect x="3.84616" y="10" width="10" height="4" fill="#3779A6"/>
<path d="M3.84616 4H4.84616V5H3.84616V4Z" fill="#BFBFBF"/>
<path d="M3.84616 6H4.84616V7H3.84616V6Z" fill="#BFBFBF"/>
<path d="M4.84616 8H3.84616V9H4.84616V8Z" fill="#BFBFBF"/>
<path d="M12.8462 8H5.84616V9H12.8462V8Z" fill="#BFBFBF"/>
<path d="M7.84616 6H5.84616V7H7.84616V6Z" fill="#BFBFBF"/>
<path d="M12.8462 4H5.84616V5H12.8462V4Z" fill="#BFBFBF"/>
<path opacity="0.3" d="M9.84616 1H10.8462V4H14.8462L15.8462 5H9.84616V1Z" fill="#333333"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1c0-.276142.22386-.5.5-.5h7.2929L13.5 3.70711V15c0 .2761-.2239.5-.5.5H3c-.27614 0-.5-.2239-.5-.5V1Z" fill="#fff" stroke="#BBB"/><path d="M9.5 1v2.7c0 .28003 0 .42004.0545.527.04793.09408.12442.17057.2185.2185.10696.0545.247.0545.527.0545H13" stroke="#BBB"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7H5v1h6V7ZM5 9h4v1H5V9Zm0 2h4v1H5v-1Z" fill="#287CA9"/><path d="M10 9h5v5h-5V9Z" fill="#287CA9"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11 10h1v1.2163h1V10h1v3h-3v-3Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 617 B

View File

@ -1 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 1h8l4 4v10H2V1z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5l-4-4H2v14h12V5zm-4-5l5 5v11H1V0h9z" fill="#BFBFBF"/><path fill="#9E1919" d="M3 10h10v4H3z"/><path d="M7 7V2H3v5h4zM8 3V2h2v1H8zM8 5V4h5v1H8zM13 6H8v1h5V6zM13 8H3v1h10V8z" fill="#BFBFBF"/><path opacity=".3" d="M9 1h1v3h4l1 1H9V1z" fill="#333"/></svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1c0-.276142.22386-.5.5-.5h7.2929L13.5 3.70711V15c0 .2761-.2239.5-.5.5H3c-.27614 0-.5-.2239-.5-.5V1Z" fill="#fff" stroke="#BBB"/><path d="M9.5 1v2.7c0 .28003 0 .42004.0545.527.04793.09408.12442.17057.2185.2185.10696.0545.247.0545.527.0545H13" stroke="#BBB"/><path d="M10 9h5v5h-5V9Z" fill="#E52910"/><path fill="#fff" d="M11 12h1v1h-1zM12 10h1v1h-1zM12 11h1v1h-1zM13 11h1v1h-1z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7H5v1h6V7ZM5 9h4v1H5V9Zm0 2h4v1H5v-1Z" fill="#E52910"/></svg>

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 602 B

View File

@ -1,12 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 1H10L14 5V15H2V1Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 5L10 1H2V15H14V5ZM10 0L15 5V16H1V0H10Z" fill="#BFBFBF"/>
<rect x="3" y="10" width="10" height="4" fill="#F36700"/>
<path d="M3 4H4V5H3V4Z" fill="#BFBFBF"/>
<path d="M3 6H4V7H3V6Z" fill="#BFBFBF"/>
<path d="M4 8H3V9H4V8Z" fill="#BFBFBF"/>
<path d="M12 8H5V9H12V8Z" fill="#BFBFBF"/>
<path d="M7 6H5V7H7V6Z" fill="#BFBFBF"/>
<path d="M12 4H5V5H12V4Z" fill="#BFBFBF"/>
<path opacity="0.3" d="M9 1H10V4H14L15 5H9V1Z" fill="#333333"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1c0-.276142.22386-.5.5-.5h7.2929L13.5 3.70711V15c0 .2761-.2239.5-.5.5H3c-.27614 0-.5-.2239-.5-.5V1Z" fill="#fff" stroke="#BBB"/><path d="M9.5 1v2.7c0 .28003 0 .42004.0545.527.04793.09408.12442.17057.2185.2185.10696.0545.247.0545.527.0545H13" stroke="#BBB"/><path d="M5.25 9c-.13807 0-.25161-.11236-.2344-.24935.02224-.17697.0681-.35054.13664-.51602.10051-.24265.24783-.46313.43355-.64884.18571-.18572.40619-.33304.64884-.43355.16548-.06854.33905-.1144.51602-.13664C6.88764 6.99839 7 7.11193 7 7.25v1.5c0 .13807-.11193.25-.25.25h-1.5Z" fill="#ED771C"/><path d="M5.25 10c-.13807 0-.25108.1121-.23959.2497.0422.5053.21197.9932.49518 1.417.32965.4934.79818.8779 1.34636 1.1049.54818.2271 1.15138.2865 1.73332.1708.58194-.1158 1.11649-.4015 1.53603-.8211.4196-.4195.7053-.9541.8211-1.536.1157-.582.0563-1.18517-.1708-1.73335-.227-.54818-.6115-1.01671-1.10489-1.34636-.42386-.28321-.91169-.45298-1.41699-.49518C8.11213 6.99892 8 7.11193 8 7.25v2.5c0 .13807-.11193.25-.25.25h-2.5Z" fill="#F8C9A4"/><path d="M10 9h5v5h-5V9Z" fill="#ED771C"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11 10h2.7305v2H12v1h-1v-3Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,12 +1 @@
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.84592 1H10.8459L14.8459 5V15H2.84592V1Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.8459 5L10.8459 1H2.84592V15H14.8459V5ZM10.8459 0L15.8459 5V16H1.84592V0H10.8459Z" fill="#BFBFBF"/>
<rect x="3.84592" y="10" width="10" height="4" fill="#78A73B"/>
<path d="M3.84592 4H4.84592V5H3.84592V4Z" fill="#BFBFBF"/>
<path d="M3.84592 6H4.84592V7H3.84592V6Z" fill="#BFBFBF"/>
<path d="M4.84592 8H3.84592V9H4.84592V8Z" fill="#BFBFBF"/>
<path d="M12.8459 8H5.84592V9H12.8459V8Z" fill="#BFBFBF"/>
<path d="M7.84592 6H5.84592V7H7.84592V6Z" fill="#BFBFBF"/>
<path d="M12.8459 4H5.84592V5H12.8459V4Z" fill="#BFBFBF"/>
<path opacity="0.3" d="M9.84592 1H10.8459V4H14.8459L15.8459 5H9.84592V1Z" fill="#333333"/>
</svg>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1c0-.276142.22386-.5.5-.5h7.2929L13.5 3.70711V15c0 .2761-.2239.5-.5.5H3c-.27614 0-.5-.2239-.5-.5V1Z" fill="#fff" stroke="#BBB"/><path d="M9.5 1v2.7c0 .28003 0 .42004.0545.527.04793.09408.12442.17057.2185.2185.10696.0545.247.0545.527.0545H13" stroke="#BBB"/><path fill-rule="evenodd" clip-rule="evenodd" d="M9 7h3v1H9V7ZM8 9H5v1h3V9Zm0 2H5v1h3v-1Zm0-4H5v1h3V7Z" fill="#3AA133"/><path d="M10 9h5v5h-5V9Z" fill="#3AA133"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11 10h1v1h-1v-1Zm2 1h-1v1h-1v1h1v-1h1v1h1v-1h-1v-1Zm0 0v-1h1v1h-1Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 665 B

View File

@ -42,10 +42,14 @@
}
.tableHeaderCellViewers {
width: 29%;
width: 18%;
text-align: right;
}
.tableHeaderCellAction {
width: 23%;
}
.tableHeaderCellDownload {
width: 21%;
padding-right: 18px;
@ -210,7 +214,7 @@
}
.tableHeaderCellFileName {
width: 16%;
width: 9%;
}
.tableHeaderCellEditors {
@ -219,7 +223,12 @@
.tableHeaderCellViewers {
text-align: right;
width: 37%;
width: 9%;
}
.tableHeaderCellAction{
width: 11%;
padding-right: 82px;
}
.tableHeaderCellDownload {
@ -234,19 +243,24 @@
}
.tableHeaderCellEditors {
width: 26%;
width: 15%;
text-align: left;
}
.tableHeaderCellFileName {
width: 17%;
width: 28%;
}
.tableHeaderCellViewers {
width: 27%;
width: 6%;
text-align: right;
}
.tableHeaderCellAction{
width: 18%;
padding-right: 54px;
}
.tableHeaderCellDownload {
padding-right: 18px;
width: 20%;
@ -267,17 +281,22 @@
.tableRow td:first-child {
flex-grow: 0;
width: 15%;
width: 25%;
margin-right: auto;
}
.contentCells-icon {
width: 3%;
}
.firstContentCellViewers {
margin-left: 0;
}
}
@media (max-width: 890px) and (min-width: 769px ) {
.contentCells-shift {
padding-right: 28px;
padding-right: 27px;
}
.main-panel {
@ -310,11 +329,16 @@
.tableHeaderCellEditors {
text-align: left;
width: 31%;
width: 1%;
}
.tableHeaderCellViewers {
width: 18%;
width: 19%;
}
.tableHeaderCellAction {
width: 19%;
padding-right: 45px;
}
}
@ -415,8 +439,8 @@
.downloadContentCellShift {
max-width: 7%;
margin-right: -11px;
margin-left: auto;
margin-right: 24px;
margin-left: 0;
}
.contentCells-icon {
@ -424,13 +448,13 @@
}
.tableRow td:last-child {
width: 12%;
padding-right: 40px;
width: 7%;
padding-right: 0px;
border: none;
}
.contentCells-shift {
padding-right: 35px;
padding-right: 0px;
}
.downloadContentCellShift:after {
@ -516,6 +540,15 @@
height: 56px;
margin-bottom: 24px !important;
}
.button.hoar{
width: 18%;
height: 27px;
margin-bottom: 7px !important;
}
.button.converting{
width: 126px;
margin-top: 0;
}
}
@media (max-width: 560px) and (min-width: 510px) {
@ -524,7 +557,7 @@
}
.downloadContentCellShift {
padding-right: 45px;
padding-right: 16px;
max-width: 4%;
}
}
@ -544,7 +577,7 @@
.downloadContentCellShift {
max-width: 6%;
padding-right: 37px;
padding-right: 6px;
}
.firstContentCellShift {
@ -570,12 +603,12 @@
.downloadContentCellShift {
max-width: 3%;
padding-right: 37px;
padding-right: 0px;
padding-left: 0;
}
.firstContentCellShift {
margin-left: 1px;
margin-left: 2px;
flex-basis: 14%;
}
@ -605,7 +638,7 @@
.downloadContentCellShift {
max-width: 4%;
margin-right: -18px;
margin-right: 18px;
margin-left: -1px;
}
@ -614,7 +647,7 @@
}
.contentCells-icon{
width: 10%;
width: 12%;
}
footer table td {
margin: 0;

View File

@ -238,6 +238,52 @@ label .checkbox {
color: #FF6F3D;
}
.button.converting {
margin-top: -20px;
padding: 16px 16px;
}
.button.converting.wide {
padding: 16px 29px;
}
.button.hoar {
background: #EFEFEF;
border: 1px solid #EFEFEF;
margin-right: 7px;
margin-bottom: 7px;
width: 13%;
padding-left: 0;
padding-right: 0;
font-size: 11px;
}
.button.hoar.disable {
opacity: 30%;
cursor: default;
}
.button.hoar:not(.disable):hover {
background: #FF6F3D;
border: 1px solid #FF6F3D;
color: #FFFFFF;
}
.button.hoar.orange {
background: #FF6F3D;
border: 1px solid #FF6F3D;
color: #FFFFFF;
cursor: default;
}
.button.hoar.orange.disable {
background: #444444;
border: 1px solid #444444;
color: #FFFFFF;
cursor: default;
opacity: 100%;
}
.button.file-type {
font-size: 11px;
color: #FFFFFF;
@ -380,6 +426,32 @@ label .checkbox {
display: none;
}
#convertingProgress {
color: #333333;
display: none;
font-size: 12px;
margin: 30px 35px;
}
#convertingProgress .convertFileName{
background-position: left center;
background-repeat: no-repeat;
display: block;
font-size: 14px;
line-height: 160%;
overflow: hidden;
padding-left: 28px;
margin-bottom: 16px;
text-overflow: ellipsis;
white-space: nowrap;
}
#convertingProgress .describeUpload {
line-height: 150%;
letter-spacing: -0.02em;
padding: 16px 0;
}
.error-message {
background: url(img/error.svg) no-repeat scroll 4px 10px;
color: #CB0000;
@ -401,6 +473,10 @@ label .checkbox {
padding-left: 35px;
}
.waiting {
opacity: 30%;
}
.current {
background-image: url("img/loader16.gif");
}
@ -413,6 +489,12 @@ label .checkbox {
background-image: url("img/notdone.svg");
}
.convertPercent {
color: #FF6F3D;
font-weight: 700;
display: inline;
}
.step-descr {
display: block;
margin-left: 35px;
@ -420,6 +502,10 @@ label .checkbox {
line-height: 188%;
}
.step-descr.disable {
display: none;
}
.progress-descr {
letter-spacing: -0.02em;
line-height: 150%;
@ -524,21 +610,25 @@ footer table tr td:first-child {
white-space: nowrap;
}
.convertFileName.word,
.stored-edit.word,
.uploadFileName.word {
background-image: url("img/icon_docx.svg");
}
.convertFileName.cell,
.stored-edit.cell,
.uploadFileName.cell {
background-image: url("img/icon_xlsx.svg");
}
.convertFileName.slide,
.stored-edit.slide,
.uploadFileName.slide {
background-image: url("img/icon_pptx.svg");
}
.convertFileName.pdf,
.stored-edit.pdf,
.uploadFileName.pdf {
background-image: url("img/icon_pdf.svg");
@ -595,6 +685,11 @@ footer table tr td:first-child {
visibility: hidden;
}
.convertTable {
margin-top: 10px;
margin-left: 35px;
}
.tableRow {
background: transparent;
-moz-transition: all 0.2s ease-in-out;
@ -641,6 +736,12 @@ footer table tr td:first-child {
width: 11%;
}
.tableHeaderCellAction{
width: 13%;
text-align: right;
padding-right: 88px;
}
.tableHeaderCellDownload{
width: 13%;
text-align: right;
@ -665,7 +766,7 @@ footer table tr td:first-child {
}
.contentCells-shift {
padding-right: 44px;
padding-right: 43px;
}
.contentCells-icon {
@ -729,7 +830,7 @@ footer table tr td:first-child {
width: 100%;
}
.icon-delete {
.icon-action {
cursor: pointer;
}
@ -812,6 +913,13 @@ html {
position: relative;
}
.typeButtonsRow {
width: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: row;
position: relative;
}
.tableRow td:first-child {
display: flex;
@ -820,11 +928,11 @@ html {
}
.tableHeaderCellFileName {
width: 30%;
width: 20%;
}
.tableHeaderCellEditors {
width: 28%;
width: 20%;
}
.tableHeaderCellViewers {

View File

@ -187,8 +187,7 @@
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
<td class="tableHeaderCell tableHeaderCellAction">Action</td>
</tr>
</thead>
</table>
@ -305,14 +304,22 @@
<img src="css/img/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode"/>
</a>
</td>
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
<% if (!docType.equals(null)) { %>
<td class="contentCells contentCells-icon">
<a class="convert-file" data="<%= files[i].getName() %>" data-type="<%= docType %>">
<img class="icon-action" src="css/img/convert.svg" alt="Convert" title="Convert" /></a>
</td>
<% } else { %>
<td class="contentCells contentCells-icon downloadContentCellShift"></td>
<% } %>
<td class="contentCells contentCells-icon downloadContentCellShift">
<a href="IndexServlet?type=download&fileName=<%=URLEncoder.encode(files[i].getName(), "UTF-8")%>">
<img class="icon-download" src="css/img/download.svg" alt="Download" title="Download" />
</a>
</td>
<td class="contentCells contentCells-icon contentCells-shift">
<a class="delete-file" data-filename="<%= files[i].getName() %>">
<img class="icon-delete" src="css/img/delete.svg" alt="Delete" title="Delete" />
<img class="icon-action" src="css/img/delete.svg" alt="Delete" title="Delete" />
</a>
</td>
</tr>
@ -381,6 +388,32 @@
</div>
</div>
<div id="convertingProgress">
<div id="convertingSteps">
<span id="convertFileName" class="convertFileName"></span>
<span id="convertStep1" class="step">1. Select a format file to convert</span>
<span class="step-descr">The converting speed depends on file size and additional elements it contains.</span>
<table cellspacing="0" cellpadding="0" width="100%" class="convertTable">
<tbody>
<tr class="typeButtonsRow" id="convTypes"></tr>
</tbody>
</table>
<br />
<span id="convertStep2" class="step">2. File conversion</span>
<span class="step-descr disable" id="convert-descr">The file is converted <div class="convertPercent" id="convertPercent">0 %</div></span>
<span class="step-error hidden" id="convert-error"></span>
<div class="describeUpload">Note the speed of all operations depends on your connection quality and server location.</div>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
</div>
<br />
<div class="buttonsMobile">
<div id="downloadConverted" class="button converting orange disable">DOWNLOAD</div>
<div id="beginViewConverted" class="button converting wide gray disable">VIEW</div>
<div id="beginEditConverted" class="button converting wide gray disable">EDIT</div>
<div id="cancelEdit" class="button converting gray">CANCEL</div>
</div>
</div>
<span id="loadScripts" data-docs="<%= ConfigManager.getProperty("files.docservice.url.site") + ConfigManager.getProperty("files.docservice.url.preloader") %>"></span>
<footer>

View File

@ -1,3 +1,21 @@
/**
*
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
function deleteFile(event) {
let filename = event.currentTarget.getAttribute("data");
filename = encodeURIComponent(filename);

View File

@ -301,6 +301,134 @@ if (typeof jQuery !== "undefined") {
jq("#embeddedView").attr("src", url);
});
jq(document).on("click", "#beginEditConverted:not(.disable)", function () {
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
var url = UrlEditor + "?mode=edit&fileName=" + fileId;
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginViewConverted:not(.disable)", function () {
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
var url = UrlEditor + "?mode=view&fileName=" + fileId;
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#downloadConverted:not(.disable)", function () {
var fileId = jq('#hiddenFileName').attr("data");
if (jq("#downloadConverted").attr("data") == "fromConverter") window.location.assign(fileId);
else window.open("IndexServlet?type=download&fileName=" + encodeURIComponent(fileId), "_blank");
});
jq(document).on("click", ".convert-file", function () {
const currentElement = jq(this);
var fileName = currentElement.attr("data");
var type = currentElement.attr("data-type");
jq.blockUI({
theme: true,
title: "Converting file" + "<div class=\"dialog-close\"></div>",
message: jq("#convertingProgress"),
overlayCSS: { "background-color": "#aaa" },
themedCSS: { width: "539px", top: "20%", left: "50%", marginLeft: "-269px" }
});
jq("#convertFileName").text(decodeURIComponent(fileName));
jq("#convertFileName").removeClass("word slide cell");
jq("#convertFileName").addClass(type);
jq("#convTypes").empty();
let format = formatManager.findByExtension(fileName.split('.').pop());
if (format) {
format.convert.forEach(ext => {
jq("#convTypes").append(jq(`<td name="convertingTypeButton" id="wordTo${ext}" class="button hoar" data="${ext}">${ext}</td>`));
});
}
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
jq(document).on("click", "td[name='convertingTypeButton']:not(.disable, .orange)", function () {
const currentElement = jq(this);
let id = currentElement[0].id;
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
jq("#convertPercent").text("0 %");
jq("#hiddenFileName").attr("placeholder",fileExt);
jq("#downloadConverted").addClass("disable");
jq("#beginEditConverted").addClass("disable");
jq("#beginViewConverted").addClass("disable");
mustReload = true;
convertFile();
});
function convertFile (filePass) {
let fileName = decodeURIComponent(jq("#hiddenFileName").val());
let fileExt = jq("#hiddenFileName").attr("placeholder");
filePass = filePass ? filePass : null;
if (timer != null) {
clearTimeout(timer);
}
timer = setTimeout(function () {
jq.ajax({
async: true,
contentType: "text/xml",
type: "post",
dataType: "json",
data: JSON.stringify({filename: fileName, filePass: filePass, lang: language, fileExt: fileExt, keepOriginal: true}),
url: UrlConverter,
complete: function (data) {
try {
var response = jq.parseJSON(data.responseText);
} catch (e) {
response = { error: e };
}
if (!response.filename && !response.step && response.error) {
jq("#convertStep2").removeClass("current").addClass("error");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#convert-error").removeClass("hidden");
jq("#convert-error").text(`${response.error}`);
jq("td[name='convertingTypeButton']").removeClass("disable orange");
return;
}
if (response.step != undefined && response.step != 100) {
jq("#convertPercent").text(`${response.step} %`);
convertFile();
} else {
jq("#convertPercent").text(`${response.step} %`);
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
if (response.error !== "FileTypeIsNotSupported") {
jq("#hiddenFileName").attr("data",response.filename);
jq("#beginEditConverted").removeClass("disable");
jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage");
} else {
let newFilename = fileName.split('.').slice(0,-1).join('.')
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter");
}
jq("td[name='convertingTypeButton']").removeClass("disable orange");
}
}
});
}, 1000);
}
jq(document).on("click", "#cancelEdit, .dialog-close", function () {
jq('#hiddenFileName').val("");
jq("#embeddedView").attr("src", "");