-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
830 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 19 additions & 16 deletions
35
logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/ImageLightbox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
|
||
|
||
|
||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRFormItemIcon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRLightbox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
"<table border='0'><tr><td><img src='" +imageElements[0].getSrc()+"' />" | ||
+ "</td><td><a href='" + content + "' target='_blank'>" | ||
+ content + "</a></td></tr></table>"); | ||
qr1Item.setWrap(false); | ||
qr1Item.setWrapTitle(false); | ||
qr1Item.setShowTitle(false); | ||
|
||
StaticTextItem qr2Item = ItemFactory.newStaticTextItem("qr2", title, | ||
"<table border='0'><tr><td><img src='" +imageElements[1].getSrc()+"' />" | ||
+ "</td><td><a href='" + content2 + "' target='_blank'>" | ||
+ content2 + "</a></td></tr></table>"); | ||
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); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...gui/src/main/java/com/logicaldoc/gui/common/client/widgets/preview/TileImageLightbox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.