use of com.gitblit.wicket.panels.BasePanel.JavascriptTextPrompt in project gitblit by gitblit.
the class TicketPage method createCopyFragment.
protected Fragment createCopyFragment(String wicketId, String text) {
if (app().settings().getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {
// clippy: flash-based copy & paste
Fragment copyFragment = new Fragment(wicketId, "clippyPanel", this);
String baseUrl = WicketUtils.getGitblitURL(getRequest());
ShockWaveComponent clippy = new ShockWaveComponent("clippy", baseUrl + "/clippy.swf");
clippy.setValue("flashVars", "text=" + StringUtils.encodeURL(text));
copyFragment.add(clippy);
return copyFragment;
} else {
// javascript: manual copy & paste with modal browser prompt dialog
Fragment copyFragment = new Fragment(wicketId, "jsPanel", this);
ContextImage img = WicketUtils.newImage("copyIcon", "clippy.png");
img.add(new JavascriptTextPrompt("onclick", "Copy to Clipboard (Ctrl+C, Enter)", text));
copyFragment.add(img);
return copyFragment;
}
}
Aggregations