Hello,
a possible solution:
Insert following class in a fs module:
import de.adesso.firstspirit.template.AbstractExecutable;
import de.espirit.firstspirit.access.BaseContext;
import de.espirit.firstspirit.access.ClientScriptContext;
import de.espirit.firstspirit.agency.OperationAgent;
import de.espirit.firstspirit.webedit.server.ClientScriptOperation;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class OpenUrlInBrowserExecutable extends AbstractExecutable<ClientScriptContext> {
private final String PARAM_URL = "p_url";
@Override
public Object execute(){
String url = getStringFromParameters(PARAM_URL);
//ContentCreator Case
if(context.is(BaseContext.Env.WEBEDIT)){
openWindowWebEdit(url);
}
//SiteArchitect Case
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (URISyntaxException | IOException e) {
context.logError("Could not open URL '" + url + "' !", e);
}
}
return null;
}
private void openWindowWebEdit(String url){
ClientScriptOperation scriptOperation = context.requireSpecialist(OperationAgent.TYPE).getOperation(ClientScriptOperation.TYPE);
String script = "window.open('"+url + "','_blank');";
scriptOperation.perform(script, false);
}
}
Create a firstspirit script and insert the executable
<FS_BUTTON
name="pt_openUrl_button"
hFill="yes"
icon="media:question_mark"
noBreak="no"
onClick="script:sc_openurlinbrowser"
style="firstspirit"
useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="TEXT_FALLBACK" description="TEXT_FALLBACK"/>
<LANGINFO lang="DE" label="Öffne Link" description="Hilfe"/>
<LANGINFO lang="EN" label="Open link" description="Help"/>
</LANGINFOS>
<PARAMS>
<PARAM name="p_url">https://www.adesso.de/</PARAM>
</PARAMS>
</FS_BUTTON>
hope that helps...
greeting,
Christopher