Skip to content

Commit

Permalink
layout update
Browse files Browse the repository at this point in the history
Issue #450
  • Loading branch information
rsoika committed Jun 30, 2021
1 parent a3ee804 commit 4d81f82
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 204 deletions.
16 changes: 10 additions & 6 deletions imixs-office-workflow-app/src/main/webapp/pages/notes_board.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$(document).ready(
function() {
// set navigation cookie
document.cookie = "imixs.office.navigation=/pages/notes_board.jsf?processref=#{boardController.processRef}&page=#{boardController.pageIndex}&phrase=#{boardController.phrase};path=#{facesContext.externalContext.requestContextPath}/";
document.cookie = "imixs.office.navigation=/pages/notes_board.jsf?processref=#{boardController.processRef}&page=#{boardController.pageIndex}&phrase=#{boardController.phraseEncoded};path=#{facesContext.externalContext.requestContextPath}/";
// refresh portlets every 5 minutes
setInterval(function() {
$(".imixs-portlet-refresh").click()
Expand All @@ -34,7 +34,8 @@

function search() {
var phrase=$("input.search_input").val();
document.location.href="/pages/notes_board.jsf?processref=#{boardController.processRef}&page=0&phrase="+phrase;
//alert('go:'+encodeURI(phrase));
document.location.href="/pages/notes_board.jsf?processref=#{boardController.processRef}&page=0&phrase="+encodeURI(phrase);
}

/*]]>*/
Expand All @@ -56,6 +57,9 @@
value="#{boardController.phrase}"
onfocus="this.value='';" />
<a href="javascript:search();" title="#{message.refresh}" styleClass="search_link"><span class="typcn typcn-zoom" style="margin-left:4px;"></span></a>



<!-- dummy botton to hit enter -->
<span class="extended-search">
<h:link outcome="/pages/workitems/worklist?processref=#{boardController.processRef}">#{message['nav.search_extended']}<span class="typcn typcn-zoom-in" style="margin-left:4px;"></span></h:link>
Expand All @@ -72,12 +76,12 @@

<!-- refresh -->
<h:link title="#{message.refresh}" styleClass="imixs-portlet-refresh"
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=0&amp;phrase=#{boardController.phrase}">
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=0&amp;phrase=#{boardController.phraseEncoded}">
<span class="typcn typcn-arrow-sync"></span>
</h:link>
<!-- prev -->
<h:link title="#{message.prev}" disabled="#{boardController.pageIndex==0}" style="margin-left:8px;"
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{boardController.pageIndex-1}&amp;phrase=#{boardController.phrase}">
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{boardController.pageIndex-1}&amp;phrase=#{boardController.phraseEncoded}">
<span
class="typcn #{(boardController.pageIndex == 0)?'typcn-media-rewind-outline':'typcn-media-rewind'}"></span>
</h:link>
Expand All @@ -86,14 +90,14 @@
<!-- show page numbers... -->
<c:forEach begin="0" end="#{boardController.pageMax-1}" varStatus="loop">
<h:link rendered="#{loop.index ne boardController.pageIndex}" style="margin:0 4px 0 4px;font-size:0.65em;"
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{loop.index}&amp;phrase=#{boardController.phrase}"><span >#{loop.index+1}</span>
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{loop.index}&amp;phrase=#{boardController.phraseEncoded}"><span >#{loop.index+1}</span>
</h:link>
<h:outputText style="margin:0 4px 0 4px;font-size:0.75em;font-weight:bold;" rendered="#{loop.index eq boardController.pageIndex}" value="#{loop.index+1}"/>
</c:forEach>

<!-- next -->
<h:link title="#{message.next}" disabled="#{boardController.endOfList}" style="margin-left:8px;"
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{boardController.pageIndex+1}&amp;phrase=#{boardController.phrase}">
outcome="/pages/notes_board?processref=#{boardController.processRef}&amp;page=#{boardController.pageIndex+1}&amp;phrase=#{boardController.phraseEncoded}">
<span class="typcn #{(boardController.endOfList)?'typcn-media-fast-forward-outline':'typcn-media-fast-forward'}"></span>
</h:link>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
package org.imixs.workflow.office.views;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
Expand Down Expand Up @@ -88,7 +90,7 @@ public class BoardController implements Serializable {
private int pageMax = 0;

private boolean endOfList = false;
private String query;
//private String query;
private String view;
private String title;

Expand Down Expand Up @@ -116,6 +118,9 @@ public class BoardController implements Serializable {
@Inject
@ConfigProperty(name = "boardcontroller.categorysize", defaultValue = "5")
int categoryPageSize;

@Inject
SearchController searchController;

public BoardController() {
super();
Expand All @@ -127,6 +132,7 @@ public BoardController() {
*/
@PostConstruct
public void init() {
searchController.reset();
// extract the processref and page from the query string
FacesContext fc = FacesContext.getCurrentInstance();
Map<String, String> paramMap = fc.getExternalContext().getRequestParameterMap();
Expand Down Expand Up @@ -194,6 +200,18 @@ public void setProcessRef(String processRef) {
public String getPhrase() {
return phrase;
}
public String getPhraseEncoded() {
if (phrase==null) {
return null;
}
try {
return URLEncoder.encode(phrase,"UTF-8");
} catch (UnsupportedEncodingException e) {

e.printStackTrace();
return phrase;
}
}

public void setPhrase(String _phrase) {
phrase = _phrase;
Expand Down Expand Up @@ -250,39 +268,28 @@ public void setTitle(String title) {
*
* @return
*/
public String getQuery() {
// set default query
if (getProcessRef().isEmpty()) {
// build query form view type...
if ("worklist.creator".equals(getView())) {
query = "(type:\"workitem\" AND $creator:\"" + loginController.getRemoteUser() + "\")";
} else {
query = "(type:\"workitem\" AND $owner:\"" + loginController.getRemoteUser() + "\")";
}
} else {
query = "(type:\"workitem\" AND $uniqueidref:\"" + getProcessRef() + "\")";
}

// Search phrase....
String searchphrase = getPhrase();
if (searchphrase != null && !searchphrase.isEmpty()) {
// escape search phrase
searchphrase = schemaService.normalizeSearchTerm(searchphrase);
if (searchphrase != null && !"".equals(searchphrase)) {
// trim
searchphrase = searchphrase.trim();
// lower case....
searchphrase = searchphrase.toLowerCase();
query = query + " AND (" + searchphrase + ") ";
}
}

return query;
}

public void setQuery(String query) {
this.query = query;
}
// public String getQuery() {
// // set default query
// searchController.reset();
//
// if (getProcessRef().isEmpty()) {
// searchController.getSearchFilter().setItemValue("my_requests",true);
// } else {
// searchController.getSearchFilter().setItemValue("ProcessRef",getProcessRef());
// }
//
//
// searchController.getSearchFilter().setItemValue("phrase",getPhrase());
//
// query=searchController.getQuery();
//
// logger.info("Board Query=" + query);
// return query;
// }
//
// public void setQuery(String query) {
// this.query = query;
// }

/**
* This method discards the cache an reset the current ref.
Expand Down Expand Up @@ -420,11 +427,31 @@ private void readWorkList() {
boolean bReverse = setupController.getSortReverse();
List<ItemCollection> taskList;
try {
taskList = documentService.findStubs(getQuery(), getPageSize(), getPageIndex(), sortBy, bReverse);

// set default query
searchController.reset();

if (getProcessRef().isEmpty()) {
searchController.getSearchFilter().setItemValue("my_requests",true);
} else {
searchController.getSearchFilter().setItemValue("ProcessRef",getProcessRef());
}


searchController.getSearchFilter().setItemValue("phrase",getPhrase());

// query=searchController.getQuery();

// logger.info("Board Query=" + query);
// return query;
//
String query=searchController.getQuery();

taskList = documentService.findStubs(query, getPageSize(), getPageIndex(), sortBy, bReverse);

// count pages only once...
if (pageMax == 0) {
pageMax = documentService.countPages(getQuery(), getPageSize());
pageMax = documentService.countPages(query, getPageSize());
}
} catch (QueryException e) {
logger.warning("failed to read task list: " + e.getMessage());
Expand Down
Loading

0 comments on commit 4d81f82

Please sign in to comment.