Set up Document Web View Control for Repositories
- Last UpdatedJun 10, 2024
- 3 minute read
AVEVA Work Tasks uses ASP.NET Server Controls to render the workflow data to various participants in the workflow. This data is displayed to the participants when they are performing actions such as Approvals or working on tasks, and is entirely application specific. A class implementing the INativeWebFormUIControl, ISkeltaAddInProvider interface can be configured to display the information specific to the application, in the activity list.
To configure the default document view handler of AVEVA Work Tasks
-
Create a new html file which should be the new default document view and put that file in the [AVEVA Work Tasks Installed Path]\AVEVA\Work Tasks[ \WorkflowElements\Default\en-US\Activities\Activity\Custom folder with any name.
-
Create a class library project and add reference to the following dlls in the AVEVA Work Tasks Bin folder:
Workflow.NET.NET2.dll
Skelta.HWS.dll
Skelta.HWS.WorkListChannel.Web.dll
Create a class which implements the following interfaces
INativeWebFormUIControl
ISkeltaAddInProvider
WebControl
Inside the class, override the Render() function where you can change the default properties of the document view. In the function, change the default page url to the new page which you have created.
using System;
using System.Collections.Generic;
using System.Text;
using Workflow.NET;
using Workflow.NET.Engine;
using Workflow.NET.Interfaces;
using Skelta.HWS.WorkListChannel.Web;
using Skelta.HWS;
using Skelta.Core;
using Skelta.Events;
using System.Web.UI.WebControls;
using System.Web.UI;
namespace CustomDocView
{
public class docview :WebControl, INativeWebFormUIControl, ISkeltaAddInProvider
{
#region INativeWebFormUIControl Members
private WorkItem _WorkItem;
private Context _Context;
private string _Settings;
private Guid _Id;
private WebWorkItemAdapter _WorkItemAdapter;
private string _UserId;
public docview()
{
}
public docview(string settings)
{
this._Settings = settings;
}
public void SetContext(WorkItem workItem, string channelName, string formName)
{
_WorkItem = workItem;
_Context = _WorkItem.CurrentContext;
_WorkItemAdapter = new WebWorkItemAdapter();
_WorkItemAdapter.ProcessWebChannelRequest();
_UserId = Convert.ToString(_WorkItemAdapter.LoggedInActor.RealActorId);
}
protected override void Render(HtmlTextWriter htw)
{
Workflow.NET.Parser parseHtml = new Parser();
string strTempDirectoryPath = _WorkItem.HWSActivity.CurrentContext.ProcessDefinition.ActionsDefinition.DirTemp;
string strDirectoryPath = _WorkItem.HWSActivity.CurrentContext.ProcessDefinition.ActionsDefinition.DirSourceElements;
parseHtml.Replace("application", _WorkItem.Application.ApplicationName);
parseHtml.Replace("workflow", _WorkItem.CurrentWorkflow.WorkflowName);
parseHtml.Replace("instanceid", _WorkItem.ExecutionId.ToString());
parseHtml.Replace("submittedby", _WorkItem.CurrentContext.SubmittedBy.Properties.Name.Value.ToString());
parseHtml.Replace("executiondetailsid", _WorkItem.ExecutionDetailsId.ToString());
parseHtml.Replace("workitemid", _WorkItem.Id.ToString());
parseHtml.Replace("activityname", _WorkItem.CurrentActivity.Name);
//parseHtml.Replace("datasubmitted", _WorkItem.CurrentContext.Data);
object cssPath = Workflow.NET.TemplateExpressionBuilder.GetUrl("");
string relativeUrl = cssPath.ToString();
parseHtml.Replace("VirtualDirectory", relativeUrl);
//Change the path of the default page which should be displayed for document view by default.
//use the HTML controls instead of asp.net controls for designing the custom document page
htw.Write(parseHtml.CheckAndProcessFileGetString(strDirectoryPath + "Activities\\Activity\\CustomDocument.htm", strTempDirectoryPath + "cache", "Activities\\Activity\\"));
base.Render(htw);
}
#endregion
#region ISkeltaAddInProvider Members
public Guid Id
{
get { return _Id; }
}
public void InitializeProvider(string settings, Guid id)
{
_Settings = settings;
_Id = id;
}
public string Settings
{
get { return _Settings; }
}
#endregion
}
}
-
Compile the project and create the dll.
-
Copy the dll to the AVEVA Work Tasks bin folder.
-
The custom document view is loaded through AddInProvider. An entry has to be made to the AddInProvider table in the repository database as given below.
You will find an existing in SKAddInProviders with 'Name' as 'DocumentWebViewControl'. Rename it and execute the below Query.
INSERT INTO SKAddInProviders (Type,[Name],ClassName,[Assembly],Settings,IsGacAssembly) VALUES ('DocumentView','DocumentWebViewControl','Namespace.ClassName','bin\<DLLName>.dll','',1)
As you can see in the figure below, the document view is displayed without the 'Data Submitted By' field which is present in the default Document view.

Content for the html file CustomDocument.htm
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%#VirtualDirectory%>Common/StyleSheet/Global.css">
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="4" cellspacing="1" class='tablebg'>
<!--<tr>
<td colspan="2" bgcolor="#ffffff">
<font face="VERDANA" size="1"><b>@@Execution Details@@</b></font>
</td>
</tr>-->
<tr>
<td width="32%" class="lefttdbg"><font class="subtitle">@@Application@@</font></td>
<td width="68%" class="righttdbg"><font class="description"><%#application%></font></td>
</tr>
<tr>
<td width="32%" class="lefttdbg"><font class="subtitle">@@Workflow@@</font></td>
<td width="68%" class="righttdbg"><font class="description"><%#workflow%></font></td>
</tr>
<tr>
<td width="32%" class="lefttdbg"><font class="subtitle">@@Workflow Instance Id@@</font></td>
<td width="68%" class="righttdbg"><font class="description"><%#instanceid%> ( <b>@@Submitted By@@</b><%#submittedby%>) </font>
</td>
</tr>
<tr>
<td class="lefttdbg"><font class="subtitle">@@Execution Details Id@@</font></td>
<td class="righttdbg"><font class="description"><%#executiondetailsid%></font></td>
</tr>
<tr>
<td class="lefttdbg"><font class="subtitle">@@WorkItem Id@@</font></td>
<td class="righttdbg"><font class="description"><%#workitemid%></font></td>
</tr>
<tr>
<td class="lefttdbg"><font class="subtitle">@@Activity@@</font></td>
<td class="righttdbg"><font class="description"><%#activityname%></font></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>