Skip to content

Commit

Permalink
#1191 Enable edit with Office in context menu on tab Append Documents in
Browse files Browse the repository at this point in the history
workflow
  • Loading branch information
car031 committed Jul 12, 2023
1 parent 239297b commit b6c8977
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.logicaldoc.gui.common.client.Constants;
import com.logicaldoc.gui.common.client.Feature;
import com.logicaldoc.gui.common.client.Session;
import com.logicaldoc.gui.common.client.beans.GUIDocument;
import com.logicaldoc.gui.common.client.beans.GUIFolder;
Expand Down Expand Up @@ -832,8 +833,12 @@ public void onSuccess(GUIFolder folder) {

final MenuItem checkin = prepareCheckinContextMenuItem(selectedDocument);

final MenuItem office = prepareOfficeContextMenuItem(selectedDocument);

if (readOnly)
contextMenu.setItems(preview, download, open);
else if (Feature.visible(Feature.OFFICE))
contextMenu.setItems(preview, download, checkout, checkin, unlock, office, open, remove);
else
contextMenu.setItems(preview, download, checkout, checkin, unlock, open, remove);

Expand All @@ -860,6 +865,10 @@ public void onSuccess(GUIFolder folder) {
unlock.setEnabled(selectedDocument.getStatus() != Constants.DOC_UNLOCKED
&& Session.get().getUser().getId() == selectedDocument
.getLockUserId());
office.setEnabled(Feature.enabled(Feature.OFFICE)
&& folder.hasPermission(Constants.PERMISSION_WRITE)
&& folder.hasPermission(Constants.PERMISSION_DOWNLOAD)
&& Util.isOfficeFile(selectedDocument.getFileName()));
}

contextMenu.showContextMenu();
Expand Down Expand Up @@ -931,6 +940,12 @@ public void onSuccess(Void result) {
return checkout;
}

private MenuItem prepareOfficeContextMenuItem(final GUIDocument selectedDocument) {
final MenuItem office = new MenuItem(I18N.message("editwithoffice"));
office.addClickHandler(event -> Util.openEditWithOffice(selectedDocument.getId()));
return office;
}

private MenuItem prepareRemoveContextMenuItem(final GUIDocument selectedDocument) {
final MenuItem remove = new MenuItem();
remove.setTitle(I18N.message("remove"));
Expand Down

0 comments on commit b6c8977

Please sign in to comment.