Skip to content

Commit

Permalink
Issue 49686: return HtmlString from `WorkflowViewBase.navigationLin…
Browse files Browse the repository at this point in the history
…ks` (#68)
  • Loading branch information
labkey-susanh authored Apr 8, 2024
1 parent 9dea2a8 commit 922759e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
19 changes: 12 additions & 7 deletions src/org/labkey/workflow/view/WorkflowViewBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.labkey.api.data.Container;
import org.labkey.api.jsp.JspBase;
import org.labkey.api.util.DateUtil;
import org.labkey.api.util.HtmlString;
import org.labkey.api.util.HtmlStringBuilder;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.StringUtilsLabKey;
import org.labkey.api.view.ActionURL;
Expand Down Expand Up @@ -188,25 +190,28 @@ else if (variables.get(key) instanceof Date)

}

public String navigationLinks(@Nullable String processDefinitionName, @NotNull String processDefinitionKey, @Nullable String processInstanceId)
public HtmlString navigationLinks(@Nullable String processDefinitionName, @NotNull String processDefinitionKey, @Nullable String processInstanceId)
{
StringBuilder builder = new StringBuilder();
HtmlStringBuilder builder = HtmlStringBuilder.of();

builder.append(PageFlowUtil.link("All workflows").href(new ActionURL(WorkflowController.BeginAction.class, getContainer())));
builder.append("\n  \n");
builder.append(HtmlString.NBSP).append(HtmlString.NBSP);
if (processDefinitionName != null)
{
builder.append(PageFlowUtil.link(processDefinitionName).href(new ActionURL(WorkflowController.SummaryAction.class, getContainer()).addParameter("processDefinitionKey", processDefinitionKey)));
builder.append("\n  \n");
builder.append(HtmlString.NBSP).append(HtmlString.NBSP);

}
builder.append(PageFlowUtil.link("Process instance list").href(new ActionURL(WorkflowController.InstanceListAction.class, getContainer()).addParameter("processDefinitionKey", processDefinitionKey)));
builder.append("\n  \n");
builder.append(HtmlString.NBSP).append(HtmlString.NBSP);

if (processInstanceId != null)
{
builder.append(PageFlowUtil.link("This Process Instance").href(new ActionURL(WorkflowController.ProcessInstanceAction.class, getContainer()).addParameter("processInstanceId", processInstanceId)));
builder.append("\n  \n");
builder.append(HtmlString.NBSP).append(HtmlString.NBSP);
}
builder.append(PageFlowUtil.link("My tasks").href(new ActionURL(WorkflowController.TaskListAction.class, getContainer()).addParameter("processDefinitionKey", processDefinitionKey).addParameter("assignee", getUser().getUserId())));

return builder.toString();
return builder.getHtmlString();
}
}
4 changes: 2 additions & 2 deletions src/org/labkey/workflow/view/workflowList.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
%>

<labkey:errors></labkey:errors>
<%= unsafe(navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null)) %>
<%= navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null) %>
<br>
<br>

Expand All @@ -49,5 +49,5 @@
<%
}
%>
<%= unsafe(navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null)) %>
<%= navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null) %>

2 changes: 1 addition & 1 deletion src/org/labkey/workflow/view/workflowProcessInstance.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ There is no active process with id <%= h(bean.getId()) %>
else
{
%>
<%= unsafe(navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null)) %>
<%= navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null) %>

<br>
<br>
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/workflow/view/workflowProcessStart.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
%>
<labkey:errors></labkey:errors>

<%= unsafe(navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null)) %>
<%= navigationLinks(bean.getProcessDefinitionName(), bean.getProcessDefinitionKey(), null) %>
<br><br>
<%
if (!bean.isDeployed(getContainer()))
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/workflow/view/workflowTask.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
String changeAssigneeLabel = bean.getAssigneeId() == null ? "Assign" : "Reassign";
boolean canChangeAssignee = bean.canClaim(getUser(), getContainer()) || (bean.isDelegated() && bean.canDelegate(getUser(), getContainer())) || bean.canAssign(getUser(), getContainer());
%>
<%= unsafe(navigationLinks(bean.getProcessDefinitionName(getContainer()), bean.getProcessDefinitionKey(getContainer()), bean.getProcessInstanceId())) %>
<%= navigationLinks(bean.getProcessDefinitionName(getContainer()), bean.getProcessDefinitionKey(getContainer()), bean.getProcessInstanceId()) %>
<br>
<br>
<table class="labkey-proj">
Expand Down

0 comments on commit 922759e

Please sign in to comment.