We have a jsp where we list links of tasks that open the corresponding eform.
I created the code to display the eform by exploring some XSL files in the workplace web application.
Here you have it. You'll have to adapt some parts of the code as it references to some of our custom variables and constants.
Example of use:
String token = getWorkplaceUserToken(user, pwd);
String label = "click here";
String attribs = "class=\"mylink\"";
String returnUrl = "tasksPage.jsp?refresh=true";
String eformLink = getStepProcessorLink(wob, label, attribs, returnUrl, token);
out.print(eformLink);
Code:
/**
* Gets a string with an HTML 'A' tag to open the task with the appropriate step processor.
*
* @param wob work item
* @param label label that will display the A link (can be anything that could be placed within the A tag)
* @param linkAttributes other link attributes, for example: "class ='xxx' style='yyy'" (can be null)
* @param refreshUrl usually the page that displays this link (it will be used to refresh this page when the task is closed)
* @param userToken user identification token for workplace automatic login
*/
public static String getStepProcessorLink(VWWorkObject wob, String label, String linkAttributes, String refreshUrl, String userToken) throws Exception {
String link = null;
VWStepProcessorInfo stepProcessor = wob.fetchStepProcessorInfo();
if (stepProcessor != null) {
VWStepElement stepElement = wob.fetchStepElement();
link = getStepProcessorLink(label, linkAttributes, stepProcessor.getId(), stepElement.getQueueName(), wob.getWorkObjectNumber(), stepElement.getStepName(), stepProcessor.getWidth(), stepProcessor.getHeight(), refreshUrl, userToken );
}
return link;
}
/**
* Translated from getStepProcessorUrl template in WcmProcessorInfo.xsl
*/
private static String getStepProcessorLink(String label, String linkAttributes, int stepProcId, String queueName, String wobNum, String stepName, int width, int height, String refreshUrl, String userToken) throws Exception {
String fullUrl = getStepProcessorHtmlHref(wobNum,stepName,queueName,stepProcId,userToken);
String randomNumber = WcmEncodingUtil.getRandomNumber();
String wBasePath = FilenetResources.getWorkplaceBasePath();
//WcmURLBuilder wcmurlbuilder = new WcmURLBuilder(CLOSE_STEP_WINDOW_PATH);
WcmURLBuilder wcmurlbuilder = new WcmURLBuilder(wBasePath + "/utils/CloseStepWindow.jsp");
wcmurlbuilder.addParameter("refreshUrl", WcmEncodingUtil.encodeURL(refreshUrl)); // refreshUrl is WcmUiModule.getPageUrl(null, null)
String currentPageURL = wcmurlbuilder.toString();
String returnUrl = Util.URLEncode(currentPageURL);
String hrefUrl = getItemLinkHref( fullUrl, randomNumber, width, height );
String url = fullUrl + AMP + "returnUrl=" + returnUrl;
String clickUrl = getItemLinkOnclick( url, randomNumber, width, height );
if( linkAttributes == null ) linkAttributes = "";
String link = "<a " + linkAttributes + " href=\"" + hrefUrl + "\" onClick=\"" + clickUrl + "\">" + label + "</a>";
return link;
}
/**
* Translated from getItemLinkOnclick template in ListViewJavascriptLinks.xsl
*/
private static String getItemLinkOnclick(String url, String title, int width, int height) {
String itemLinkOnclick = "var x=(screen.width-" + width + ")/2;var y=(screen.height-"
+ height + ")/2;" + "var f=" + APOS
+ "resizable=yes,scrollbars=yes,status=yes,width=" + width
+ " + height=" + height + " + top=" + APOS + "+y+ "
+ APOS + " + left=" + APOS + "+x;"
+ "var w=window.open(" + APOS + url + APOS + ","
+ APOS + title + APOS + "," + "f" + ")"
+ ";w.focus();return false;";
return itemLinkOnclick;
}
/**
* Translated from getItemLinkHref template in ListViewJavascriptLinks.xsl
*/
private static String getItemLinkHref(String url, String title, int width, int height) {
String itemLinkHref = "javascript:var x=(screen.width-" + width
+ ")/2;var y=(screen.height-" + height + ")/2;" + "var f="
+ APOS + "resizable=yes,scrollbars=yes,status=yes,width="
+ width + ",height=" + height + ",top=" + APOS + "+y+ "
+ APOS + ",left=" + APOS + "+x;" + "var w=window.open("
+ APOS + url + APOS + "," + APOS + title + APOS
+ "," + "f" + ")" + ";w.focus();";
return itemLinkHref;
}
/**
* Translated from getStepProcessorHtmlHref template in WcmProcessorInfo.xsl
*/
private static String getStepProcessorHtmlHref(String wobNum, String stepName, String queueName, int stepProcId, String userToken) throws Exception {
String encodedStepName = WcmEncodingUtil.encodeLabel(stepName);
String encodedQueueName = WcmEncodingUtil.encodeLabel(queueName);
String encodedUserToken = URLEncoder.encode(userToken, "UTF-8");
String wBasePath = FilenetResources.getWorkplaceBasePath();
String url = wBasePath
+ "/getProcessor?"
+ "processorType=" + "step"
+ AMP + "queueName=" + encodedQueueName
+ AMP + "wobNum=" + wobNum
+ AMP + "stepName=" + encodedStepName
+ AMP + "stepProcId=" + stepProcId
+ AMP + "ut=" + encodedUserToken;
return url;
}
/** Get token credentials for workplace */
public static String getWorkplaceUserToken(String user, String password) throws Exception {
String workplaceUrl = FilenetResources.getWorkplaceBasePath();
URL url = new URL(workplaceUrl + "/setCredentials?op=getUserToken&userId=" + user + "&password=" + password + "&verify=true");
URLConnection p8con = url.openConnection();
p8con.connect();
InputStream in = p8con.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
return br.readLine();
}
ecm link:http://www.ecmplace.com/viewtopic.php?f=29&t=7288
分享到:
相关推荐
eform集成开发手册 eform集成开发手册是专门为eform开发人员设计的指南,旨在帮助开发者快速了解eform的集成开发流程和技术细节。该手册涵盖了eform集成开发的各个方面,包括系统文件说明、系统表结构说明、eform ...
《eform最全中文帮忙手册》是一份详尽的指南,涵盖了eform的各个关键方面,旨在帮助用户全面理解和高效运用这款工具。手册包括了eform操作手册、eform集成开发手册、API文档以及eformstudy和eformsales的相关资料,...
**eform帮助文档(Java版本)** eForm是一款在Java平台上使用的强大表单设计和数据管理工具,它为开发者提供了一种高效的方式来构建和管理业务流程中的数据输入和处理部分。这个“eform帮助文档(Java版本)”是专...
**eform自定义表单**是北京方程软件推出的一款开源工作流解决方案,它专为程序员在工程开发中简化表单设计流程而设计。这款工具的出现,极大地提升了开发效率,减少了开发表单时的繁琐步骤,使得程序员可以更加专注...
eform.chm的中文帮助手册,我很喜欢
"eform_表单_"这个主题显然聚焦于自定义表单的设计与实现,这通常是为了满足特定业务需求,提供个性化用户体验,或者解决标准表单无法满足的复杂数据输入问题。下面将详细探讨相关知识点: 1. **自定义表单设计**:...
eform-angular-items-planning-plugin注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。翻译eform-angular-itemsplanning-plugin 语言C#部分角部分英语100% 100% 丹麦文100% 100% 德语0% ...
ORM框架,EF框架详解,资源来自来自黑马,如果有侵权,立即删除
eform-sdk-dotnet 用于与Microting eForm API v1集成的.NET SDK。 支持平台 作业系统 .Net标准2.0 .Net Core 3.1 MySQL 5.5+ / MariaDB 10.4 OSX 10.15.5 X X X OSX 10.14.2 X X X 的Ubuntu的20.04 X ...
无限制版版本仅供个人学习用,用于商业用途请联系软件厂商,个人不负任何责任,敬请注意。
eform-angular-basiccasemgmt-plugin 注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。 翻译eform-angular-basiccasemgmt-plugin 语 C#部分 角部分 英语 100% 100% 丹麦文 100% 100% ...
eform-angular-pointment-plugin 注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。 翻译eform-angular-pointing-plugin 语 C#部分 角部分 英语 100% 100% 丹麦文 0% 0% 德语 0% 0...
eform-angular-monitoring-plugin 注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。 翻译eform-angular-monitoring插件 语言 C#部分 角部分 英语 100% 100% 丹麦文 100% 100% 德语 0...
eForm Angular前端 eForm Backend是使用Angular(9.1.1)和C#.Net Core 2.2创建的 支持平台 作业系统 .Net标准2.2 MySQL / MariaDB OSX 10.14.2 X X Ubuntu 19.10 X X Ubuntu 19.04 X X Ubuntu 18.10 ...
金和c6(.net版)表单自定义平台内置的业务函数说明。其他采用eform表单平台的也可参照
eform-angular-items-group-planning-plugin 注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。 翻译eform-angular-items-group-planning-plugin 语 C#部分 角部分 英语 100% 100% 丹麦文...
eform-service-outer-inner-resource-plugin 警告! 请勿单独使用 插件自动安装 期望您在/ var / www / microting /中将eform-angular-frontend默认安装 cd /var/www/microting/ curl -s -L ...
eform-basiccasemgmt-base 注意! 这不是一个独立的项目,需要与eForm Angular Frontend一起使用。 贡献 做一个叉子 将叉子克隆到自己的计算机上 为您的相关问题结帐/创建新分支 应用您的更改和测试 提交更改并...