Skip to content

Commit

Permalink
#13469 fix to handle multiple langs for tasks (#13569)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdotcms authored and jgambarios committed Feb 6, 2018
1 parent 8f9dc08 commit 893700d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
WorkflowAPI wapi = APILocator.getWorkflowAPI();
List<WorkflowTask> tasks = searcher.findTasks();
List<Long> langs = new ArrayList<Long>();
for(Language l : APILocator.getLanguageAPI().getLanguages()){
langs.add(l.getId());
}
Language defaultLang = APILocator.getLanguageAPI().getDefaultLanguage();
langs.remove(defaultLang.getId());
langs.add(0, defaultLang.getId());
java.util.Map params = new java.util.HashMap();
params.put("struts_action", new String[] { "/ext/workflows/view_workflow_tasks" });
Expand Down Expand Up @@ -157,7 +150,7 @@
</td>
</tr>
<%} %>
<%for(WorkflowTask task : tasks){ %>
<%for(WorkflowTask task : tasks) { %>
<%
Role assignedRole = APILocator.getRoleAPI().loadRoleById(task.getAssignedTo());
String assignedRoleName = "";
Expand All @@ -166,20 +159,17 @@
}
%>
<%Contentlet contentlet = new Contentlet();
for(Long lang : langs){
try{
contentlet = APILocator.getContentletAPI().findContentletByIdentifier(task.getWebasset(),false,lang, APILocator.getUserAPI().getSystemUser(), true);
contentlet = APILocator.getContentletAPI().findContentletByIdentifier(task.getWebasset(), false, task.getLanguageId(), APILocator.getUserAPI().getSystemUser(), true);
//contentlet = APILocator.getContentletAPI().search("+identifier: "+task.getWebasset(), 0, -1, null, APILocator.getUserAPI().getSystemUser(), true).get(0);
}
catch(Exception e){
Logger.debug(this.getClass(), e.getMessage());
}
if(contentlet != null && UtilMethods.isSet(contentlet.getInode())){
break;
if(contentlet == null || !UtilMethods.isSet(contentlet.getInode())){
continue;
}
}
%>
<%WorkflowStep step = APILocator.getWorkflowAPI().findStep(task.getStatus()); %>
<tr class="alternate_1">
Expand All @@ -205,9 +195,7 @@
User u = APILocator.getUserAPI().loadUserById(APILocator.getVersionableAPI().getLockedBy(contentlet), APILocator.getUserAPI().getSystemUser(), false); %>
<span class="lockIcon" title="<%=UtilMethods.javaScriptify(u.getFullName()) %>"></span>
<%} %>




</td>


Expand All @@ -222,7 +210,9 @@


</tr>
<%} %>
<%
}
%>
</table>

<table width="95%" align="center" style="margin:10px;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
WorkflowTask task = APILocator.getWorkflowAPI().findTaskById(request.getParameter("taskId"));
//Search for the contentlet (Using the same way the view_tasks_list use to find the contentlet on each WorkflowTask and show it in the list)
Contentlet contentlet = APILocator.getContentletAPI().search( "+identifier: " + task.getWebasset(), 0, -1, null, APILocator.getUserAPI().getSystemUser(), true ).get( 0 );
Contentlet contentlet = APILocator.getContentletAPI().search( "+identifier: " + task.getWebasset() + " +languageId:" + task.getLanguageId(), 0, -1, null, APILocator.getUserAPI().getSystemUser(), true ).get( 0 );
if ( contentlet == null ) {
out.println( LanguageUtil.get( pageContext, "the-selected-content-cannot-be-found" ) );
return;
Expand Down

0 comments on commit 893700d

Please sign in to comment.