Skip to content

Commit ff2eb54

Browse files
committed
Fixed presentation editing with Google Drive
1 parent 5c40468 commit ff2eb54

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/Util.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public abstract class Util {
7474

7575
private static final Set<String> spreadsheetExts = new HashSet<>(Arrays.asList(".xls", ".xlsm", ".xlsx", ".ods"));
7676

77+
private static final Set<String> presentationExts = new HashSet<>(Arrays.asList(".ppt", ".pptx", ".pptm", ".odp"));
78+
7779
private static final Set<String> imageExts = new HashSet<>(
7880
Arrays.asList(".gif", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".png", ".jfif", ".webp"));
7981

@@ -301,8 +303,8 @@ public static String fileNameIcon(String iconName, int size) {
301303
long shortcutSize = Math.round(size * 0.625D);
302304
long shortcutMarginTop = Math.round(size * 0.4375D);
303305
long shortcutMarginLeft = Math.round(size * 0.6D);
304-
sb.append(IMG_SRC + fileIconUrl("shortcut.svg") + WIDTH + shortcutSize + PX_HEIGHT
305-
+ shortcutSize + "px' style='position:absolute; z-index:1; margin-top: " + shortcutMarginTop
306+
sb.append(IMG_SRC + fileIconUrl("shortcut.svg") + WIDTH + shortcutSize + PX_HEIGHT + shortcutSize
307+
+ "px' style='position:absolute; z-index:1; margin-top: " + shortcutMarginTop
306308
+ "px; margin-left:" + shortcutMarginLeft + "px'/>");
307309
}
308310

@@ -318,8 +320,8 @@ public static String fileNameIcon(String iconName, int size) {
318320
iconName = baseIconName;
319321
}
320322

321-
sb.append("<img class='filenameIcon' src='" + fileIconUrl(iconName + ".svg") + WIDTH + size
322-
+ PX_HEIGHT + size + "px' />");
323+
sb.append("<img class='filenameIcon' src='" + fileIconUrl(iconName + ".svg") + WIDTH + size + PX_HEIGHT + size
324+
+ "px' />");
323325

324326
sb.append(END_DIV);
325327
return sb.toString();
@@ -452,6 +454,10 @@ public static boolean isSpreadsheetFile(String fileName) {
452454
return spreadsheetExts.stream().anyMatch(ext -> fileName.toLowerCase().endsWith(ext));
453455
}
454456

457+
public static boolean isPresentationFile(String fileName) {
458+
return presentationExts.stream().anyMatch(ext -> fileName.toLowerCase().endsWith(ext));
459+
}
460+
455461
public static boolean isDICOMFile(String fileName) {
456462
return dicomExts.stream().anyMatch(ext -> fileName.toLowerCase().endsWith(ext));
457463
}

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/google/drive/DriveEditor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ private void reloadBody() {
9797
if (Util.isSpreadsheetFile(document.getFileName()))
9898
url = "https://docs.google.com/spreadsheets/d/" + document.getExtResId() + "/edit?hl="
9999
+ Session.get().getUser().getLanguage();
100+
if (Util.isPresentationFile(document.getFileName()))
101+
url = "https://docs.google.com/presentation/d/" + document.getExtResId() + "/edit?hl="
102+
+ Session.get().getUser().getLanguage();
100103

101104
String iframe = "<iframe src='" + url + "' style='border: 0px solid white; width:" + (getWidth() - 18)
102105
+ "px; height:" + (getHeight() - 68) + "px' scrolling='no'></iframe>";

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/google/drive/DriveMenuItem.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ private MenuItem prepareGDriveEditMenuItem(GUIFolder folder, final GUIDocument d
114114
checkoutAndUploadToGDrive(document);
115115
} else {
116116
if (document.getStatus() == 1 && document.getExtResId() != null) {
117-
DriveEditor popup = new DriveEditor(document);
118-
popup.show();
117+
new DriveEditor(document).show();
119118
} else {
120119
SC.warn(I18N.message("event.locked"));
121120
}

0 commit comments

Comments
 (0)