Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 49686: return HtmlString from WorkflowViewBase.navigationLinks #68

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.BR);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional to use HtmlString.BR instead of HtmlString.NBSP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not intentional. Thanks.

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.BR);

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

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.BR);
}
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