diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/Feature.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/Feature.java index b68ed0067..748d9f623 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/Feature.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/Feature.java @@ -216,11 +216,11 @@ public class Feature { public static final int READING_CONFIRMATION = 102; public static final int TECHNICAL_SUPPORT = 103; - + public static final int CHATGPT = 104; - + public static final int GOOGLE_CALENDAR = 105; - + public static final int ONLYOFFICE = 107; private static Set features = new HashSet<>(); @@ -264,4 +264,8 @@ public static boolean showDisabled() { public static boolean showLicensee() { return enabled(SHOW_DISABLED); } + + public static boolean isCommercial() { + return enabled(ADDITIONAL_FORMATS); + } } \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/ItemFactory.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/ItemFactory.java index fc9ab46cd..6569c175a 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/ItemFactory.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/ItemFactory.java @@ -61,6 +61,7 @@ import com.logicaldoc.gui.common.client.widgets.DocumentSelector; import com.logicaldoc.gui.common.client.widgets.FolderSelector; import com.logicaldoc.gui.common.client.widgets.PasswordGenerator; +import com.logicaldoc.gui.common.client.widgets.QRFormItemIcon; import com.logicaldoc.gui.common.client.widgets.UserSelector; import com.logicaldoc.gui.common.client.widgets.automation.AutomationItemEditor; import com.logicaldoc.gui.common.client.widgets.automation.HtmlItemEditor; @@ -885,7 +886,7 @@ public static SelectItem newUserSelector(String name, String title, String group boolean skipDisabled) { return newUserSelector(name, title, groupIdOrName, !required, skipDisabled, true); } - + public static SelectItem newUserSelector(String name, String title, String groupIdOrName, boolean required, boolean skipDisabled, boolean withClear) { return new UserSelector(name, title, groupIdOrName, !required, skipDisabled, withClear, null); @@ -1145,7 +1146,8 @@ public static SelectItem newEventsSelector(String name, String title, final Chan select.setHeight(250); select.setMultipleAppearance(MultipleAppearance.GRID); select.setMultiple(true); - select.setOptionDataSource(new EventsDS(options.isFolder(), options.isWorkflow(), options.isUser(), options.isImportfolder(), options.isOcr(), options.isWebservice(), options.isAllOption())); + select.setOptionDataSource(new EventsDS(options.isFolder(), options.isWorkflow(), options.isUser(), + options.isImportfolder(), options.isOcr(), options.isWebservice(), options.isAllOption())); select.setValueField("code"); select.setDisplayField(LABEL); if (handler != null) @@ -1164,11 +1166,13 @@ public static SelectItem newEventsSelector(String name, String title, final Chan return select; } - public static SelectItem newEventSelector(String name, String title, final ChangedHandler handler, EventSelectorOptions options) { + public static SelectItem newEventSelector(String name, String title, final ChangedHandler handler, + EventSelectorOptions options) { final SelectItem select = newSelectItem(originalItemName(name), title); select.setWidth(350); select.setMultiple(false); - select.setOptionDataSource(new EventsDS(options.isFolder(), options.isWorkflow(), options.isUser(), options.isImportfolder(), options.isOcr(), options.isWebservice(), options.isAllOption())); + select.setOptionDataSource(new EventsDS(options.isFolder(), options.isWorkflow(), options.isUser(), + options.isImportfolder(), options.isOcr(), options.isWebservice(), options.isAllOption())); select.setValueField("code"); select.setDisplayField(LABEL); if (handler != null) @@ -1883,8 +1887,16 @@ public static LinkItem newLinkItem(String name, String title, String linkTitle, if (url != null) linkItem.setValue(url); - linkItem.setIcons(new CopyTextFormItemIcon(textToCopy != null ? textToCopy : url, - textToCopy != null ? "copytext" : "copylink")); + QRFormItemIcon qrFormItemIcon = new QRFormItemIcon(); + + final CopyTextFormItemIcon copyTextFormItemIcon = new CopyTextFormItemIcon( + textToCopy != null ? textToCopy : url, textToCopy != null ? "copytext" : "copylink"); + + if (Feature.isCommercial()) + linkItem.setIcons(copyTextFormItemIcon, qrFormItemIcon); + else + linkItem.setIcons(copyTextFormItemIcon); + return linkItem; } diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/Util.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/Util.java index 5bd2d3232..e5f161810 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/Util.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/Util.java @@ -175,6 +175,18 @@ public static void downloadTicket(String ticketId) { download(downloadTicketURL(ticketId)); } + public static String qrURL(String content, int size) { + return Util.contextPath() + "barcode?label=false&format=QR_CODE&width=" + size + "&height=" + size + "&code=" + + content; + } + + public static String qrImg(String content, int size) { + if (Feature.isCommercial()) + return ""; + else + return ""; + } + public static String displayURL(Long docId, Long folderId) { String url = contextPath() + "display?"; if (docId != null) @@ -1159,7 +1171,7 @@ public void run() { } /** - * Converts some HTML specific cahrd into it's entity + * Converts some HTML specific chars into it's entity * * @param originalText the original string to filter * diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/CopyTextFormItemIcon.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/CopyTextFormItemIcon.java index e93c58ec3..cab8e2b49 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/CopyTextFormItemIcon.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/CopyTextFormItemIcon.java @@ -21,7 +21,7 @@ public class CopyTextFormItemIcon extends FormItemIcon { public CopyTextFormItemIcon(String text, String tooltip) { setName("copy"); setPrompt(I18N.message(tooltip)); - setSrc("[SKIN]/page_white_paste.png"); + setSrc("[SKIN]/paste.svg"); setWidth(16); setHeight(16); addFormItemClickHandler(event -> { diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/ImageLightbox.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/ImageLightbox.java index 96d24dfca..0527f1518 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/ImageLightbox.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/ImageLightbox.java @@ -1,29 +1,32 @@ package com.logicaldoc.gui.common.client.widgets; -import com.logicaldoc.gui.common.client.Session; -import com.logicaldoc.gui.common.client.util.Util; +import com.google.gwt.widgetideas.graphics.client.ImageLoader; +import com.logicaldoc.gui.common.client.i18n.I18N; import com.smartgwt.client.types.HeaderControls; +import com.smartgwt.client.types.ImageStyle; +import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Window; public class ImageLightbox extends Window { - public ImageLightbox(long docId, String title) { - int size = 800; - if (Session.get().getConfig("gui.tile.size") != null) - size = Integer.parseInt(Session.get().getConfig("gui.tile.size")); - int windowHeight = size + 10; - if (windowHeight > com.google.gwt.user.client.Window.getClientHeight()) - windowHeight = com.google.gwt.user.client.Window.getClientHeight(); - + public ImageLightbox(String imageUrl, String title, int size) { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); - setTitle(title); - setWidth("50%"); - setHeight(windowHeight); + setTitle(I18N.message(title)); setCanDragResize(true); setIsModal(true); setShowModalMask(true); + setAutoSize(true); centerInPage(); - HTMLPanel html = new HTMLPanel(Util.tileImageHTML(docId, null, null, size)); - addItem(html); + ImageLoader.loadImages(new String[] { imageUrl }, + imageElements -> { + Img img = new Img(imageUrl); + img.setImageWidth(size); + img.setImageHeight(size); + img.setImageType(ImageStyle.NORMAL); + addItem(img); + }); + + + } -} +} \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRFormItemIcon.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRFormItemIcon.java new file mode 100644 index 000000000..441bf970e --- /dev/null +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRFormItemIcon.java @@ -0,0 +1,59 @@ +package com.logicaldoc.gui.common.client.widgets; + +import com.logicaldoc.gui.common.client.Feature; +import com.logicaldoc.gui.common.client.i18n.I18N; +import com.smartgwt.client.widgets.form.fields.FormItemIcon; + +/** + * An icon to be used display a QR Code + * + * @author Marco Meschieri - LogicalDOC + * @since 9.1.1 + */ +public class QRFormItemIcon extends FormItemIcon { + + /** + * The constructor. + * + * @param code the text to render in the QR Code + * @param tooltip the tooltip to display + */ + public QRFormItemIcon(String code, String tooltip) { + setName("qrcode"); + if (Feature.isCommercial()) { + setPrompt(I18N.message(tooltip)); + setSrc("[SKIN]/qrcode.svg"); + setWidth(16); + setHeight(16); + + addFormItemClickHandler(event -> { + String content = code; + if (content == null) + content = event.getItem().getValue().toString(); + new QRLightbox(content, "qrcode", 150).show(); + }); + } else { + setSrc("[SKIN]/blank.png"); + setText(""); + setWidth(16); + setHeight(16); + setDisabled(true); + } + } + + /** + * The constructor. + * + * @param code the text to render in the QR Code + */ + public QRFormItemIcon(String code) { + this(code, "qrcode"); + } + + /** + * The constructor, the current item's text will be user for the QR Code + */ + public QRFormItemIcon() { + this(null); + } +} diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRLightbox.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRLightbox.java new file mode 100644 index 000000000..985905b4f --- /dev/null +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRLightbox.java @@ -0,0 +1,81 @@ +package com.logicaldoc.gui.common.client.widgets; + +import com.google.gwt.widgetideas.graphics.client.ImageLoader; +import com.logicaldoc.gui.common.client.Session; +import com.logicaldoc.gui.common.client.i18n.I18N; +import com.logicaldoc.gui.common.client.util.ItemFactory; +import com.logicaldoc.gui.common.client.util.Util; +import com.smartgwt.client.types.HeaderControls; +import com.smartgwt.client.types.ImageStyle; +import com.smartgwt.client.types.TitleOrientation; +import com.smartgwt.client.widgets.Img; +import com.smartgwt.client.widgets.Window; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.StaticTextItem; + +/** + * A light box to show a barcode. If the barcode is a link and the provided + * content + * + * @author Marco Meschieri - LogicalDOC + * @since 9.1.1 + * + */ +public class QRLightbox extends Window { + public QRLightbox(String content, String title, int size) { + setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); + setTitle(I18N.message(title)); + setCanDragResize(true); + setIsModal(true); + setShowModalMask(true); + setAutoSize(true); + centerInPage(); + + String qrUrl1 = Util.qrURL(content, size); + if ((content.startsWith("http") || content.startsWith("https")) && content.startsWith(Util.contextPath()) + && !content.startsWith(Session.get().getConfig("server.url"))) { + + // We are not accessing from the declared server.url so display the additional QR with server.url + final StringBuilder content2 = new StringBuilder(Session.get().getConfig("server.url")); + if (!content2.toString().endsWith("/")) + content2.append("/"); + content2.append(content.substring(Util.contextPath().length())); + + String qrUrl2 = Util.qrURL(content2.toString(), size); + + ImageLoader.loadImages(new String[] { qrUrl1, qrUrl2 }, imageElements -> { + StaticTextItem qr1Item = ItemFactory.newStaticTextItem("qr1", title, + "
" + + "" + + content + "
"); + qr1Item.setWrap(false); + qr1Item.setWrapTitle(false); + qr1Item.setShowTitle(false); + + StaticTextItem qr2Item = ItemFactory.newStaticTextItem("qr2", title, + "
" + + "" + + content2 + "
"); + qr2Item.setWrap(false); + qr2Item.setWrapTitle(false); + qr2Item.setShowTitle(false); + + DynamicForm form = new DynamicForm(); + form.setMargin(2); + form.setNumCols(1); + form.setTitleOrientation(TitleOrientation.LEFT); + form.setItems(qr1Item, qr2Item); + addItem(form); + }); + } else { + // We are accessing from the declared server.url so just display the QR + ImageLoader.loadImages(new String[] { qrUrl1 }, imageElements -> { + Img img = new Img(qrUrl1); + img.setImageWidth(size); + img.setImageHeight(size); + img.setImageType(ImageStyle.NORMAL); + addItem(img); + }); + } + } +} \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/PreviewTile.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/PreviewTile.java index e2162b298..6e66c269d 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/PreviewTile.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/PreviewTile.java @@ -3,7 +3,6 @@ import com.logicaldoc.gui.common.client.Session; import com.logicaldoc.gui.common.client.i18n.I18N; import com.logicaldoc.gui.common.client.util.Util; -import com.logicaldoc.gui.common.client.widgets.ImageLightbox; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.widgets.Canvas; @@ -46,7 +45,7 @@ private void initGUI() { HTMLFlow thumbnailImage = new HTMLFlow(html); thumbnailImage.addClickHandler(event -> { if (Session.get().isShowThumbnail()) { - new ImageLightbox(docId, title).show(); + new TileImageLightbox(docId, title).show(); } }); diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/TileImageLightbox.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/TileImageLightbox.java new file mode 100644 index 000000000..6ecd76441 --- /dev/null +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/TileImageLightbox.java @@ -0,0 +1,30 @@ +package com.logicaldoc.gui.common.client.widgets.preview; + +import com.logicaldoc.gui.common.client.Session; +import com.logicaldoc.gui.common.client.util.Util; +import com.logicaldoc.gui.common.client.widgets.HTMLPanel; +import com.smartgwt.client.types.HeaderControls; +import com.smartgwt.client.widgets.Window; + +public class TileImageLightbox extends Window { + public TileImageLightbox(long docId, String title) { + int size = 800; + if (Session.get().getConfig("gui.tile.size") != null) + size = Integer.parseInt(Session.get().getConfig("gui.tile.size")); + int windowHeight = size + 10; + if (windowHeight > com.google.gwt.user.client.Window.getClientHeight()) + windowHeight = com.google.gwt.user.client.Window.getClientHeight(); + + setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); + setTitle(title); + setWidth("50%"); + setHeight(windowHeight); + setCanDragResize(true); + setIsModal(true); + setShowModalMask(true); + centerInPage(); + + HTMLPanel html = new HTMLPanel(Util.tileImageHTML(docId, null, null, size)); + addItem(html); + } +} diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentDetailsPanel.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentDetailsPanel.java index 7003b2dc0..b1b39a71e 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentDetailsPanel.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentDetailsPanel.java @@ -71,7 +71,7 @@ public class DocumentDetailsPanel extends VLayout implements DocumentObserver { protected Layout securityTabPanel; - protected StandardPropertiesPanel propertiesPanel; + protected DocumentStandardPropertiesPanel propertiesPanel; protected DocumentExtendedPropertiesPanel extendedPropertiesPanel; @@ -570,7 +570,7 @@ private void prepareStandardPropertiesTab(ChangedHandler changeHandler) { } try { - propertiesPanel = new StandardPropertiesPanel(document, changeHandler); + propertiesPanel = new DocumentStandardPropertiesPanel(document, changeHandler); propertiesTabPanel.addMember(propertiesPanel); } catch (Exception t) { // Nothing to do diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentStandardPropertiesPanel.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentStandardPropertiesPanel.java new file mode 100644 index 000000000..06a44bda7 --- /dev/null +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentStandardPropertiesPanel.java @@ -0,0 +1,444 @@ +package com.logicaldoc.gui.frontend.client.document; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.logicaldoc.gui.common.client.Feature; +import com.logicaldoc.gui.common.client.Menu; +import com.logicaldoc.gui.common.client.Session; +import com.logicaldoc.gui.common.client.beans.GUIDocument; +import com.logicaldoc.gui.common.client.beans.GUIRating; +import com.logicaldoc.gui.common.client.data.TagsDS; +import com.logicaldoc.gui.common.client.i18n.I18N; +import com.logicaldoc.gui.common.client.log.GuiLog; +import com.logicaldoc.gui.common.client.util.DocUtil; +import com.logicaldoc.gui.common.client.util.ItemFactory; +import com.logicaldoc.gui.common.client.util.Util; +import com.logicaldoc.gui.common.client.widgets.QRFormItemIcon; +import com.logicaldoc.gui.common.client.widgets.preview.PreviewTile; +import com.logicaldoc.gui.frontend.client.services.DocumentService; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.types.PickerIconName; +import com.smartgwt.client.types.TitleOrientation; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.ValuesManager; +import com.smartgwt.client.widgets.form.fields.ColorItem; +import com.smartgwt.client.widgets.form.fields.FormItem; +import com.smartgwt.client.widgets.form.fields.FormItemIcon; +import com.smartgwt.client.widgets.form.fields.LinkItem; +import com.smartgwt.client.widgets.form.fields.MultiComboBoxItem; +import com.smartgwt.client.widgets.form.fields.PickerIcon; +import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.StaticTextItem; +import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; +import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.Layout; +import com.smartgwt.client.widgets.layout.VLayout; + +/** + * Shows document's standard properties and read-only data + * + * @author Marco Meschieri - LogicalDOC + * @since 6.0 + */ +public class DocumentStandardPropertiesPanel extends DocumentDetailTab { + private static final String FOLDER = "folder"; + + private static final String COLOR = "color"; + + private static final int DEFAULT_ITEM_WIDTH = 250; + + private DynamicForm form1 = new DynamicForm(); + + private DynamicForm form2 = new DynamicForm(); + + private VLayout container = new VLayout(); + + private HLayout columns = new HLayout(); + + private ValuesManager vm = new ValuesManager(); + + protected MultiComboBoxItem tagItem = null; + + private Layout thumbnail = new HLayout(); + + public DocumentStandardPropertiesPanel(final GUIDocument document, ChangedHandler changedHandler) { + super(document, changedHandler); + setWidth100(); + setHeight100(); + container.setWidth100(); + container.setMembersMargin(5); + addMember(container); + + columns.setWidth100(); + columns.setMembersMargin(10); + + container.setMembers(columns); + refresh(); + } + + private void refresh() { + prepareForm1(); + + StaticTextItem id = prepareIdItem(); + + StaticTextItem creation = ItemFactory.newStaticTextItem("creation", "createdon", + Util.textWithAvatar(document.getCreatorId(), Util.padLeft(I18N.formatDate(document.getCreation()) + " " + + I18N.message("by") + " " + document.getCreator(), 40))); + creation.setTooltip( + I18N.formatDate(document.getCreation()) + " " + I18N.message("by") + " " + document.getCreator()); + + StaticTextItem published = ItemFactory.newStaticTextItem("date", "publishedon", + Util.textWithAvatar(document.getPublisherId(), Util.padLeft( + I18N.formatDate(document.getDate()) + " " + I18N.message("by") + " " + document.getPublisher(), + 40))); + published.setTooltip( + I18N.formatDate(document.getDate()) + " " + I18N.message("by") + " " + document.getPublisher()); + + StaticTextItem size = ItemFactory.newStaticTextItem("size", + Util.formatSizeW7(document.getFileSize()) + " (" + Util.formatSizeBytes(document.getFileSize()) + ")"); + + StaticTextItem pages = preparePagesItem(); + + TextItem fileName = ItemFactory.newTextItem("filename", document.getFileName()); + fileName.addChangedHandler(changedHandler); + fileName.setRequired(true); + fileName.setWidth(DEFAULT_ITEM_WIDTH); + fileName.setDisabled(!updateEnabled || !document.isRename()); + + StaticTextItem wfStatus = prepareWorkflowItem(); + + StaticTextItem version = prepareVersionItem(); + + LinkItem folder = prepareFolderItem(); + + ColorItem color = ItemFactory.newColorPickerItem(document.getColor(), true, changedHandler); + color.setDisabled(!updateEnabled); + + StaticTextItem permaLink = preparePermaLink(); + + if (Feature.enabled(Feature.WORKFLOW)) + form1.setItems(id, fileName, folder, size, pages, version, creation, published, wfStatus, color, permaLink); + else + form1.setItems(id, fileName, folder, size, pages, version, creation, published, color, permaLink); + + columns.addMember(form1); + + /* + * Prepare the second form for the tags + */ + prepareRightForm(); + + /* + * Prepare the tile + */ + if (document.getId() != 0L && document.isPreview()) { + thumbnail = new PreviewTile(document.getId(), document.getFileName()); + columns.addMember(thumbnail); + } + } + + private StaticTextItem preparePermaLink() { + String downloadUrl = Util.downloadURL(document.getId()); + String displayUrl = Util.displayURL(document.getId(), null); + String perma = "" + I18N.message("download") + " | " + + "" + I18N.message("details") + ""; + + StaticTextItem permaLink = ItemFactory.newStaticTextItem("permalink", perma); + + if (Feature.isCommercial()) { + FormItemIcon qrCode = new QRFormItemIcon(); + qrCode.addFormItemClickHandler(click -> new PermaLinkDisplay(document.getId()).show()); + permaLink.setIcons(qrCode); + } + + return permaLink; + } + + private StaticTextItem prepareIdItem() { + StaticTextItem id = ItemFactory.newStaticTextItem("id", Long.toString(document.getId())); + if (!Long.toString(document.getId()).equals(document.getCustomId())) { + id.setTooltip(Long.toString(document.getId()) + " (" + document.getCustomId() + ")"); + id.setValue(Util.padLeft(Long.toString(document.getId()) + " (" + document.getCustomId() + ")", 35)); + } + + if (Feature.isCommercial()) { + StringBuilder sb = new StringBuilder("id: "); + sb.append(document.getId()); + sb.append("_CR_filename: "); + sb.append(document.getFileName()); + sb.append("_CR_version: "); + sb.append(document.getVersion()); + sb.append("_CR_fileversion: "); + sb.append(document.getFileVersion()); + sb.append("_CR_path: "); + sb.append(document.getPathExtended()); + sb.append("/"); + sb.append(document.getFileName()); + id.setIcons(new QRFormItemIcon(sb.toString())); + } + + if (document.getDocRef() != null) + id.setTooltip(I18N.message("thisisalias") + ": " + document.getDocRef()); + return id; + } + + private StaticTextItem prepareWorkflowItem() { + StaticTextItem wfStatus = ItemFactory.newStaticTextItem("wfStatus", "workflowstatus", + document.getWorkflowStatus()); + if (document.getWorkflowStatusDisplay() != null) + wfStatus.setValue("" + + document.getWorkflowStatus() + ""); + return wfStatus; + } + + private StaticTextItem prepareVersionItem() { + StaticTextItem version = ItemFactory.newStaticTextItem("version", "fileversion", + document.getFileVersion() + " (" + document.getVersion() + ")"); + version.setValue(version.getValue()); + String comment = document.getComment(); + if (comment != null && !"".equals(comment)) + version.setTooltip(comment); + return version; + } + + private void prepareForm1() { + vm.clearErrors(false); + + if (form1 != null) + form1.destroy(); + + if (thumbnail != null) + thumbnail.destroy(); + + if (Boolean.TRUE.equals(columns.contains(form1))) + columns.removeMember(form1); + + if (Boolean.TRUE.equals(columns.contains(thumbnail))) + columns.removeChild(thumbnail); + + form1 = new DynamicForm(); + form1.setNumCols(2); + form1.setValuesManager(vm); + form1.setTitleOrientation(TitleOrientation.LEFT); + form1.setWidth(DEFAULT_ITEM_WIDTH); + } + + private LinkItem prepareFolderItem() { + String path = document.getPathExtended(); + LinkItem folder = ItemFactory.newLinkItem(FOLDER, FOLDER, Util.padLeft(path, 40), + Util.displayURL(null, document.getFolder().getId()), path); + folder.setTitle(I18N.message(FOLDER)); + folder.setTooltip(path); + folder.setWrap(false); + return folder; + } + + private StaticTextItem preparePagesItem() { + StaticTextItem pages = ItemFactory.newStaticTextItem("pages", Util.formatInt(document.getPages())); + pages.setIconHSpace(2); + pages.setIconWidth(16); + pages.setIconHeight(16); + pages.setWidth("1%"); + PickerIcon countPages = new PickerIcon(PickerIconName.REFRESH, (final FormItemIconClickEvent event) -> { + event.getItem().setValue(I18N.message("computing") + "..."); + DocumentService.Instance.get().updatePages(document.getId(), new AsyncCallback<>() { + + @Override + public void onFailure(Throwable caught) { + GuiLog.serverError(caught); + } + + @Override + public void onSuccess(Integer docPages) { + if (docPages != null) { + document.setPages(docPages.intValue()); + pages.setValue(Util.formatInt(document.getPages())); + } + } + }); + }); + countPages.setPrompt(I18N.message("countpages")); + if (document.getId() != 0) + pages.setIcons(countPages); + return pages; + } + + private void prepareRightForm() { + if (Boolean.TRUE.equals(columns.contains(form2))) { + columns.removeMember(form2); + form2.destroy(); + } + + form2 = new DynamicForm(); + form2.setValuesManager(vm); + + List items = new ArrayList<>(); + + addRating(items); + + SelectItem language = ItemFactory.newLanguageSelector("language", false, false); + language.setEndRow(true); + language.addChangedHandler(changedHandler); + language.setDisabled(!updateEnabled); + language.setValue(document.getLanguage()); + items.add(language); + + if (Feature.enabled(Feature.TAGS)) { + addTags(items); + } + + form2.setItems(items.toArray(new FormItem[0])); + columns.addMember(form2); + } + + private void addTags(List items) { + String mode = Session.get().getConfig("tag.mode"); + final TagsDS ds = new TagsDS(null, true, document.getId(), null); + + tagItem = ItemFactory.newTagsComboBoxItem("tag", "tag", ds, document.getTags()); + tagItem.setEndRow(true); + tagItem.setDisabled(!updateEnabled); + tagItem.addChangedHandler(changedHandler); + + final TextItem newTagItem = prepareNewTagItem(ds); + + final StaticTextItem tagsString = ItemFactory.newStaticTextItem("tags", "tag", + Util.getTagsHTML(document.getTags())); + tagsString.setEndRow(true); + + FormItemIcon editTags = new FormItemIcon(); + editTags.setPrompt(I18N.message("edittags")); + editTags.setSrc("[SKIN]/actions/edit.png"); + editTags.setWidth(16); + editTags.setHeight(16); + editTags.addFormItemClickHandler(event -> { + tagsString.setVisible(false); + tagItem.setVisible(true); + tagItem.setEndRow(true); + if (items.contains(newTagItem)) { + newTagItem.setVisible(true); + newTagItem.setEndRow(true); + } + form2.redraw(); + }); + + if (updateEnabled) + tagsString.setIcons(editTags); + + items.add(tagsString); + items.add(tagItem); + tagItem.setVisible(false); + newTagItem.setVisible(false); + if ("free".equals(mode) && updateEnabled) + items.add(newTagItem); + } + + private TextItem prepareNewTagItem(final TagsDS ds) { + final TextItem newTagItem = ItemFactory.newTextItem("newtag", null); + newTagItem.setEndRow(true); + newTagItem.setRequired(false); + newTagItem.addKeyPressHandler(event -> { + if (Boolean.TRUE.equals(newTagItem.validate()) && newTagItem.getValue() != null + && event.getKeyName() != null && "enter".equalsIgnoreCase(event.getKeyName())) { + String input = newTagItem.getValueAsString().trim(); + newTagItem.clearValue(); + + if (!"".equals(input)) { + onAddNewTag(ds, input); + } + } + }); + return newTagItem; + } + + private void onAddNewTag(final TagsDS ds, String input) { + // replace the escapes \, with a string so the + // tokenizer will work propertly + input = input.replace("\\,", "__comma__"); + + String[] tokens = input.split("\\,"); + + int min = Integer.parseInt(Session.get().getConfig("tag.minsize")); + int max = Integer.parseInt(Session.get().getConfig("tag.maxsize")); + boolean containsInvalid = false; + List tags = new ArrayList<>(); + for (String token : tokens) { + String t = token.trim(); + + // Restore the commas inside the tag + t = t.replace("__comma__", ","); + + if (t.length() < min || t.length() > max) { + containsInvalid = true; + continue; + } + + tags.add(t); + + // Add the old tags to the new ones + String[] oldVal = tagItem.getValues(); + for (int i = 0; i < oldVal.length; i++) + if (!tags.contains(oldVal[i])) + tags.add(oldVal[i]); + + // Put the new tag in the options + Record rec = new Record(); + rec.setAttribute("index", t); + rec.setAttribute("word", t); + ds.addData(rec); + } + + // Update the tag item and trigger the change + tagItem.setValues((Object[]) tags.toArray(new String[0])); + changedHandler.onChanged(null); + + if (containsInvalid) + SC.warn(I18N.message("sometagaddedbecauseinvalid", "" + min, "" + max)); + } + + private void addRating(List items) { + StaticTextItem rating = ItemFactory.newStaticTextItem("rating", + document.getRating() > 0 ? DocUtil.getRatingIcon(document.getRating()) + : I18N.message("ratethisdocument")); + rating.setEndRow(true); + if (updateEnabled) + rating.addClickHandler( + event -> DocumentService.Instance.get().getRating(document.getId(), new AsyncCallback<>() { + @Override + public void onFailure(Throwable caught) { + GuiLog.serverError(caught); + } + + @Override + public void onSuccess(GUIRating rating) { + if (rating != null) { + RatingDialog dialog = new RatingDialog(document.getRating(), rating); + dialog.show(); + } + } + })); + rating.setDisabled(!updateEnabled); + if (Menu.enabled(Menu.BRANDING)) + items.add(rating); + } + + @SuppressWarnings("unchecked") + @Override + public boolean validate() { + Map values = vm.getValues(); + if (Boolean.TRUE.equals(vm.validate())) { + document.setFileName((String) values.get("filename")); + document.setLanguage((String) values.get("language")); + document.setColor((String) values.get(COLOR)); + document.setTags(Arrays.asList(tagItem.getValues())); + } + return !vm.hasErrors(); + } +} \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/PermaLinkDisplay.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/PermaLinkDisplay.java new file mode 100644 index 000000000..d857ba122 --- /dev/null +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/PermaLinkDisplay.java @@ -0,0 +1,76 @@ +package com.logicaldoc.gui.frontend.client.document; + +import com.google.gwt.http.client.URL; +import com.google.gwt.widgetideas.graphics.client.ImageLoader; +import com.logicaldoc.gui.common.client.Session; +import com.logicaldoc.gui.common.client.i18n.I18N; +import com.logicaldoc.gui.common.client.util.ItemFactory; +import com.logicaldoc.gui.common.client.util.Util; +import com.smartgwt.client.types.HeaderControls; +import com.smartgwt.client.types.TitleOrientation; +import com.smartgwt.client.widgets.Window; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.ButtonItem; +import com.smartgwt.client.widgets.form.fields.StaticTextItem; + +/** + * Displays the permalinks of a document + * + * @author Marco Meschieri - LogicalDOC + * @since 9.1.1 + */ +public class PermaLinkDisplay extends Window { + + private static final int QR_SIZE = 100; + + public PermaLinkDisplay(long docId) { + setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); + setTitle(I18N.message("permalink")); + setCanDragResize(true); + setIsModal(true); + setShowModalMask(true); + setAutoSize(true); + centerInPage(); + + String urlBase = Session.get().getConfig("server.url"); + if (!urlBase.endsWith("/")) + urlBase += "/"; + + String downloadUrl = Util.downloadURL(docId); + String downloadUrl2 = urlBase + "download?docId=" + docId; + + String displayUrl = Util.displayURL(docId, null); + String displayUrl2 = urlBase + "display?docId=" + docId; + + ImageLoader.loadImages(new String[] { Util.qrURL(downloadUrl, QR_SIZE), Util.qrURL(downloadUrl2, QR_SIZE), + Util.qrURL(displayUrl, QR_SIZE), Util.qrURL(displayUrl2, QR_SIZE) }, imageElements -> { + DynamicForm form = new DynamicForm(); + form.setMargin(4); + form.setTitleOrientation(TitleOrientation.LEFT); + + StaticTextItem downloadUrlItem = prepareBarcodeAndLink("download1", "download", downloadUrl); + StaticTextItem downloadUrlItem2 = prepareBarcodeAndLink("download2", "download", downloadUrl2); + downloadUrlItem2.setVisible(!downloadUrl.equals(downloadUrl2)); + + StaticTextItem displayUrlItem = prepareBarcodeAndLink("displayUrl", "details", displayUrl); + StaticTextItem displayUrlItem2 = prepareBarcodeAndLink("displayUrl2", "details", displayUrl2); + displayUrlItem2.setVisible(!downloadUrl.equals(downloadUrl2)); + + ButtonItem close = new ButtonItem("close", I18N.message("close")); + close.addClickHandler(event -> PermaLinkDisplay.this.destroy()); + + form.setItems(downloadUrlItem, downloadUrlItem2, displayUrlItem, displayUrlItem2, close); + + addItem(form); + }); + } + + private StaticTextItem prepareBarcodeAndLink(String name, String label, String url) { + StaticTextItem item = ItemFactory.newStaticTextItem(name, I18N.message(label), + "
" + Util.qrImg(URL.encode(url), QR_SIZE) + "" + url + "
"); + item.setWrap(false); + item.setWrapTitle(false); + return item; + } +} \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/TicketDisplay.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/TicketDisplay.java index bd74bef40..3106aa99b 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/TicketDisplay.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/TicketDisplay.java @@ -1,7 +1,10 @@ package com.logicaldoc.gui.frontend.client.document; +import com.google.gwt.http.client.URL; +import com.google.gwt.widgetideas.graphics.client.ImageLoader; import com.logicaldoc.gui.common.client.i18n.I18N; import com.logicaldoc.gui.common.client.util.ItemFactory; +import com.logicaldoc.gui.common.client.util.Util; import com.smartgwt.client.types.HeaderControls; import com.smartgwt.client.types.TitleOrientation; import com.smartgwt.client.widgets.Window; @@ -28,42 +31,46 @@ public TicketDisplay(String ticketId, String sampleUrl1, String sampleUrl2) { centerInPage(); setAutoSize(true); - DynamicForm form = new DynamicForm(); - form.setMargin(4); - form.setTitleOrientation(TitleOrientation.LEFT); + ImageLoader.loadImages(new String[] { Util.qrURL(sampleUrl1,100),Util.qrURL(sampleUrl2,100) }, imageElements -> { + DynamicForm form = new DynamicForm(); + form.setMargin(4); + form.setTitleOrientation(TitleOrientation.LEFT); - StaticTextItem ticketIdItem = ItemFactory.newStaticTextItem("ticketid", ticketId); - ticketIdItem.setWrap(false); - ticketIdItem.setWrapTitle(false); + StaticTextItem ticketIdItem = ItemFactory.newStaticTextItem("ticketid", ticketId); + ticketIdItem.setWrap(false); + ticketIdItem.setWrapTitle(false); - StaticTextItem sampleUrl1Item = ItemFactory.newStaticTextItem("sampleurl1", I18N.message("sampleurl"), - "" + sampleUrl1 + ""); - sampleUrl1Item.setWrap(false); - sampleUrl1Item.setWrapTitle(false); + StaticTextItem sampleUrl1Item = ItemFactory.newStaticTextItem("sampleurl1", I18N.message("sampleurl"), + "
" + Util.qrImg(URL.encode(sampleUrl1), 100) + "" + sampleUrl1 + "
"); + sampleUrl1Item.setWrap(false); + sampleUrl1Item.setWrapTitle(false); - StaticTextItem sampleUrl2Item = ItemFactory.newStaticTextItem("sampleurl2", I18N.message("anothersampleurl"), - "" + sampleUrl2 + ""); - sampleUrl2Item.setWrap(false); - sampleUrl2Item.setWrapTitle(false); + StaticTextItem sampleUrl2Item = ItemFactory.newStaticTextItem("sampleurl2", I18N.message("anothersampleurl"), + "
" + Util.qrImg(URL.encode(sampleUrl2), 100) + "" + sampleUrl2 + "
"); + sampleUrl2Item.setWrap(false); + sampleUrl2Item.setWrapTitle(false); - StaticTextItem advice = ItemFactory.newStaticTextItem("advice", - I18N.message("downloadticketdisplay", ticketId)); - advice.setColSpan(2); - advice.setShowTitle(false); - advice.setTitleOrientation(TitleOrientation.TOP); + StaticTextItem advice = ItemFactory.newStaticTextItem("advice", + I18N.message("downloadticketdisplay", ticketId)); + advice.setColSpan(2); + advice.setShowTitle(false); + advice.setTitleOrientation(TitleOrientation.TOP); - ButtonItem close = new ButtonItem("close", I18N.message("close")); - close.addClickHandler(event -> TicketDisplay.this.destroy()); + ButtonItem close = new ButtonItem("close", I18N.message("close")); + close.addClickHandler(event -> TicketDisplay.this.destroy()); - if (sampleUrl1.equalsIgnoreCase(sampleUrl2)) - form.setItems(advice, new RowSpacerItem(), ticketIdItem, sampleUrl1Item, close); - else - form.setItems(advice, new RowSpacerItem(), ticketIdItem, sampleUrl1Item, sampleUrl2Item, close); + if (sampleUrl1.equalsIgnoreCase(sampleUrl2)) + form.setItems(advice, new RowSpacerItem(), ticketIdItem, sampleUrl1Item, close); + else + form.setItems(advice, new RowSpacerItem(), ticketIdItem, sampleUrl1Item, sampleUrl2Item, close); - VLayout layout = new VLayout(); - layout.setMembersMargin(5); - layout.addMember(form); + VLayout layout = new VLayout(); + layout.setMembersMargin(5); + layout.addMember(form); - addItem(layout); + addItem(layout); + }); } } \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/folder/FolderStandardPropertiesPanel.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/folder/FolderStandardPropertiesPanel.java index b78c37c8d..cc5f5d165 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/folder/FolderStandardPropertiesPanel.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/folder/FolderStandardPropertiesPanel.java @@ -4,7 +4,6 @@ import java.util.Arrays; import java.util.List; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.logicaldoc.gui.common.client.Feature; import com.logicaldoc.gui.common.client.Session; @@ -16,10 +15,10 @@ import com.logicaldoc.gui.common.client.util.ItemFactory; import com.logicaldoc.gui.common.client.util.LD; import com.logicaldoc.gui.common.client.util.Util; +import com.logicaldoc.gui.common.client.widgets.QRFormItemIcon; import com.logicaldoc.gui.frontend.client.services.DocumentService; import com.logicaldoc.gui.frontend.client.services.FolderService; import com.smartgwt.client.data.Record; -import com.smartgwt.client.types.PickerIconName; import com.smartgwt.client.types.TitleOrientation; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; @@ -29,7 +28,6 @@ import com.smartgwt.client.widgets.form.fields.FormItemIcon; import com.smartgwt.client.widgets.form.fields.LinkItem; import com.smartgwt.client.widgets.form.fields.MultiComboBoxItem; -import com.smartgwt.client.widgets.form.fields.PickerIcon; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.SpinnerItem; import com.smartgwt.client.widgets.form.fields.StaticTextItem; @@ -75,9 +73,7 @@ private void refresh() { prepareForm1(); - StaticTextItem idItem = ItemFactory.newStaticTextItem("id", Long.toString(folder.getId())); - if (folder.getFoldRef() != null) - idItem.setTooltip(I18N.message("thisisalias") + ": " + folder.getFoldRef()); + StaticTextItem idItem = prepareIdItem(); TextItem name = prepareNameItem(); @@ -113,12 +109,6 @@ private void refresh() { LinkItem pathItem = preparePathItem(); - LinkItem barcode = ItemFactory.newLinkItem("barcode", I18N.message("generatebarcode"), - I18N.message("generatebarcode"), - GWT.getHostPageBaseURL() + "barcode?code=" + folder.getId() + "&width=400&height=150"); - barcode.setTarget("_blank"); - barcode.setTitle(I18N.message("barcode")); - final StaticTextItem documents = ItemFactory.newStaticTextItem("documents", folder.getDocumentCount() > 0 ? Util.formatLong(folder.getDocumentCount()) : "-"); documents.setIconHSpace(2); @@ -144,10 +134,7 @@ private void refresh() { List items = new ArrayList<>(); items.addAll(Arrays.asList(idItem, pathItem, name, description, store, maxVersions, creation, documents, - subfolders, size, barcode)); - - if (!Feature.enabled(Feature.BARCODES)) - items.remove(barcode); + subfolders, size)); if (!Feature.enabled(Feature.MULTI_STORE)) items.remove(store); if (folder.isDefaultWorkspace()) @@ -165,6 +152,25 @@ private void refresh() { columns.addMember(new FolderTile(folder, changedHandler)); } + private StaticTextItem prepareIdItem() { + StaticTextItem id = ItemFactory.newStaticTextItem("id", Long.toString(folder.getId())); + + StringBuilder sb = new StringBuilder("id: "); + sb.append(folder.getId()); + sb.append("_CR_name: "); + sb.append(folder.getName()); + sb.append("_CR_path: "); + sb.append(folder.getPathExtended()); + + if (Feature.isCommercial()) + id.setIcons(new QRFormItemIcon(sb.toString())); + + if (folder.getFoldRef() != null) + id.setTooltip(I18N.message("thisisalias") + ": " + folder.getFoldRef()); + + return id; + } + private SpinnerItem prepareMaxVersionsItem() { SpinnerItem maxVersions = ItemFactory.newSpinnerItem("maxversions", folder.getMaxVersions()); maxVersions.setWrapTitle(false); @@ -188,13 +194,19 @@ private void prepareForm1() { } private void addComputeStatsIcons(StaticTextItem documents, StaticTextItem subfolders, StaticTextItem size) { - PickerIcon computeStats = new PickerIcon(PickerIconName.REFRESH, computeStatsClick -> { - computeStatsClick.getItem().setValue(I18N.message("computing") + "..."); + FormItemIcon computeStats = new FormItemIcon(); + computeStats.setPrompt(I18N.message("calculatestats")); + computeStats.setSrc("[SKIN]/arrows-rotate.svg"); + computeStats.setWidth(16); + computeStats.setHeight(16); + computeStats.addFormItemClickHandler(click -> { + click.getItem().setValue(I18N.message("computing") + "..."); FolderService.Instance.get().computeStats(folder.getId(), new AsyncCallback<>() { @Override public void onFailure(Throwable caught) { GuiLog.serverError(caught); + } @Override @@ -208,7 +220,6 @@ public void onSuccess(List stats) { } }); }); - computeStats.setPrompt(I18N.message("calculatestats")); documents.setIcons(computeStats); subfolders.setIcons(computeStats); @@ -220,6 +231,7 @@ private LinkItem preparePathItem() { : FolderNavigator.get().getPath(folder.getId()); LinkItem pathItem = ItemFactory.newLinkItem("path", "path", Util.padLeft(path, 40), Util.displayURL(null, folder.getId()), path); + pathItem.setTooltip(path); pathItem.setWrap(false); return pathItem; @@ -228,10 +240,10 @@ private LinkItem preparePathItem() { private FormItemIcon prepareEnforceStore() { FormItemIcon enforceStore = new FormItemIcon(); enforceStore.setPrompt(I18N.message("enforcefilesintofolderstorage")); - enforceStore.setSrc("[SKIN]/data_into.png"); + enforceStore.setSrc("[SKIN]/boxes-stacked.svg"); enforceStore.setWidth(16); enforceStore.setHeight(16); - + enforceStore.addFormItemClickHandler(event -> { LD.ask(I18N.message("enforcementofstorage"), I18N.message("enforcefilesintofolderstorage") + ".\n" + I18N.message("doyouwanttoproceed"), yes -> { @@ -262,7 +274,8 @@ public void onSuccess(Void v) { private FormItemIcon prepareApplyStoreToSubfoldersItem() { FormItemIcon applyStoreToSubfolders = new FormItemIcon(); applyStoreToSubfolders.setPrompt(I18N.message("applytosubfolders")); - applyStoreToSubfolders.setSrc("[SKIN]/page_save.png"); + applyStoreToSubfolders.setSrc("[SKIN]/clone.svg"); + applyStoreToSubfolders.setWidth(16); applyStoreToSubfolders.setHeight(16); applyStoreToSubfolders.addFormItemClickHandler(applyStoreToSubfoldersClick -> { diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/reports/TicketsReport.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/reports/TicketsReport.java index 70e46dc81..b739485db 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/reports/TicketsReport.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/reports/TicketsReport.java @@ -61,7 +61,7 @@ protected void fillToolBar(ToolStrip toolStrip) { ToolStripButton display = new ToolStripButton(); display.setTitle(I18N.message("display")); - display.addClickHandler(event -> { + display.addClickHandler(click -> { if (Boolean.TRUE.equals(max.validate())) refresh(); }); @@ -127,7 +127,7 @@ protected void prepareListGrid() { maxViews.setCanFilter(false); maxViews.setCanGroupBy(false); - list.addDoubleClickHandler(event -> DocUtil.download(list.getSelectedRecord().getAttributeAsLong("id"), null)); + list.addDoubleClickHandler(click -> DocUtil.download(list.getSelectedRecord().getAttributeAsLong("id"), null)); list.setFields(enabled, id, ticketId, type, count, maxCount, views, maxViews, creation, expired, fileName); } @@ -158,7 +158,7 @@ protected void showContextMenu() { Menu contextMenu = new Menu(); MenuItem preview = new MenuItem(); preview.setTitle(I18N.message("preview")); - preview.addClickHandler((MenuItemClickEvent event) -> { + preview.addClickHandler(click -> { long id = Long.parseLong(rec.getAttribute(DOC_ID)); DocumentService.Instance.get().getById(id, new AsyncCallback<>() { @@ -169,8 +169,7 @@ public void onFailure(Throwable caught) { @Override public void onSuccess(GUIDocument doc) { - PreviewPopup iv = new PreviewPopup(doc); - iv.show(); + new PreviewPopup(doc).show(); } }); }); @@ -179,10 +178,8 @@ public void onSuccess(GUIDocument doc) { MenuItem download = new MenuItem(); download.setTitle(I18N.message("download")); - download.addClickHandler((MenuItemClickEvent event) -> { - String id = rec.getAttribute(DOC_ID); - WindowUtils.openUrl(GWT.getHostPageBaseURL() + "download?docId=" + id); - }); + download.addClickHandler( + click -> WindowUtils.openUrl(GWT.getHostPageBaseURL() + "download?docId=" + rec.getAttribute(DOC_ID))); MenuItem ticketURL = new MenuItem(); ticketURL.setTitle(I18N.message("ticketurl")); diff --git a/logicaldoc-gui/war/skin/images/clone.svg b/logicaldoc-gui/war/skin/images/clone.svg new file mode 100644 index 000000000..9b167c71c --- /dev/null +++ b/logicaldoc-gui/war/skin/images/clone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/logicaldoc-gui/war/skin/images/paste.svg b/logicaldoc-gui/war/skin/images/paste.svg new file mode 100644 index 000000000..3750c1c9b --- /dev/null +++ b/logicaldoc-gui/war/skin/images/paste.svg @@ -0,0 +1 @@ + \ No newline at end of file