Korrektur für ein Problem mit dem ItemSearchWidget und dem persitenten Status von Bebop
git-svn-id: https://svn.libreccm.org/ccm/trunk@2367 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
26670344e3
commit
8f32e2fa15
|
|
@ -31,6 +31,7 @@ import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.RelationAttributeCollection;
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
|
|
@ -70,7 +71,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
this.personSelector = personSelector;
|
this.personSelector = personSelector;
|
||||||
|
|
||||||
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
|
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.persons.none")));
|
"cms.contenttypes.ui.genericorgaunit.persons.none")));
|
||||||
TableColumnModel tabModel = getColumnModel();
|
TableColumnModel tabModel = getColumnModel();
|
||||||
|
|
||||||
tabModel.add(new TableColumn(
|
tabModel.add(new TableColumn(
|
||||||
|
|
@ -84,21 +85,21 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
"cms.contenttypes.ui.genericorgaunit.persons.role")));
|
"cms.contenttypes.ui.genericorgaunit.persons.role")));
|
||||||
tabModel.add(
|
tabModel.add(
|
||||||
new TableColumn(
|
new TableColumn(
|
||||||
2,
|
2,
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.persons.status")));
|
"cms.contenttypes.ui.genericorgaunit.persons.status")));
|
||||||
tabModel.add(
|
tabModel.add(
|
||||||
new TableColumn(
|
new TableColumn(
|
||||||
3,
|
3,
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorganunit.persons.edit"),
|
"cms.contenttypes.ui.genericorganunit.persons.edit"),
|
||||||
TABLE_COL_EDIT_LINK));
|
TABLE_COL_EDIT_LINK));
|
||||||
tabModel.add(
|
tabModel.add(
|
||||||
new TableColumn(
|
new TableColumn(
|
||||||
4,
|
4,
|
||||||
ContenttypesGlobalizationUtil.globalize(
|
ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.persons.delete"),
|
"cms.contenttypes.ui.genericorgaunit.persons.delete"),
|
||||||
TABLE_COL_DEL));
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
setModelBuilder(
|
setModelBuilder(
|
||||||
new GenericOrganizationalUnitTableModelBuilder(itemModel));
|
new GenericOrganizationalUnitTableModelBuilder(itemModel));
|
||||||
|
|
@ -123,13 +124,13 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
|
|
||||||
public TableModel makeModel(Table table, PageState state) {
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
GenericOrganizationalUnit orgaunit =
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
(GenericOrganizationalUnit) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
return new GenericOrganizationalUnitTableModel(table,
|
return new GenericOrganizationalUnitTableModel(table,
|
||||||
state,
|
state,
|
||||||
orgaunit);
|
orgaunit);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GenericOrganizationalUnitTableModel implements TableModel {
|
private class GenericOrganizationalUnitTableModel implements TableModel {
|
||||||
|
|
@ -210,6 +211,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
public Object getKeyAt(int columnIndex) {
|
public Object getKeyAt(int columnIndex) {
|
||||||
return m_person.getID();
|
return m_person.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditCellRenderer extends LockableImpl implements
|
private class EditCellRenderer extends LockableImpl implements
|
||||||
|
|
@ -223,11 +225,10 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
Object key,
|
Object key,
|
||||||
int row,
|
int row,
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
getSecurityManager(state);
|
|
||||||
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
getSelectedObject(
|
getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
|
@ -244,17 +245,16 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
}
|
}
|
||||||
ContentSection section = person.getContentSection();//CMS.getContext().getContentSection();
|
ContentSection section = person.getContentSection();//CMS.getContext().getContentSection();
|
||||||
ItemResolver resolver = section.getItemResolver();
|
ItemResolver resolver = section.getItemResolver();
|
||||||
Link link =
|
Link link = new Link(String.format("%s",
|
||||||
new Link(String.format("%s",
|
value.toString()),
|
||||||
value.toString()),
|
resolver.generateItemURL(state,
|
||||||
resolver.generateItemURL(state,
|
person,
|
||||||
person,
|
section,
|
||||||
section,
|
person.getVersion()));
|
||||||
person.getVersion()));
|
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
GenericPerson person;
|
GenericPerson person;
|
||||||
try {
|
try {
|
||||||
person = new GenericPerson((BigDecimal) key);
|
person = new GenericPerson((BigDecimal) key);
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
|
@ -263,14 +263,15 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
ex);
|
ex);
|
||||||
return new Label(value.toString());
|
return new Label(value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Label label = new Label(String.format("%s",
|
Label label = new Label(String.format("%s",
|
||||||
value.toString(),
|
value.toString(),
|
||||||
person.getLanguage()));
|
person.getLanguage()));
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditLinkCellRenderer
|
private class EditLinkCellRenderer
|
||||||
|
|
@ -284,8 +285,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
Object key,
|
Object key,
|
||||||
int row,
|
int row,
|
||||||
int column) {
|
int column) {
|
||||||
SecurityManager securityManager =
|
SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
GenericOrganizationalUnit orgaUnit = (GenericOrganizationalUnit) m_itemModel.
|
GenericOrganizationalUnit orgaUnit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
|
@ -301,6 +301,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteCellRenderer extends LockableImpl implements
|
private class DeleteCellRenderer extends LockableImpl implements
|
||||||
|
|
@ -314,11 +315,10 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
Object key,
|
Object key,
|
||||||
int row,
|
int row,
|
||||||
int col) {
|
int col) {
|
||||||
SecurityManager securityManager =
|
SecurityManager securityManager = Utilities.getSecurityManager(state);
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
|
||||||
getSelectedObject(
|
getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
SecurityManager.DELETE_ITEM,
|
SecurityManager.DELETE_ITEM,
|
||||||
|
|
@ -327,13 +327,14 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
ControlLink link = new ControlLink(value.toString());
|
ControlLink link = new ControlLink(value.toString());
|
||||||
link.setConfirmation((String) ContenttypesGlobalizationUtil.
|
link.setConfirmation((String) ContenttypesGlobalizationUtil.
|
||||||
globalize(
|
globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.persons.confirm_delete").
|
"cms.contenttypes.ui.genericorgaunit.persons.confirm_delete").
|
||||||
localize());
|
localize());
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
return new Label(value.toString());
|
return new Label(value.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -361,7 +362,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
personSelector.setSelectedPerson(person);
|
personSelector.setSelectedPerson(person);
|
||||||
personSelector.setSelectedPersonRole(persons.getRoleName());
|
personSelector.setSelectedPersonRole(persons.getRoleName());
|
||||||
personSelector.setSelectedPersonStatus(persons.getStatus());
|
personSelector.setSelectedPersonStatus(persons.getStatus());
|
||||||
|
|
@ -380,7 +381,6 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
public void headSelected(TableActionEvent event) {
|
public void headSelected(TableActionEvent event) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getRoleAttributeName() {
|
protected String getRoleAttributeName() {
|
||||||
|
|
@ -390,4 +390,5 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
protected String getStatusAttributeName() {
|
protected String getStatusAttributeName() {
|
||||||
return "GenericOrganizationalUnitMemberStatus";
|
return "GenericOrganizationalUnitMemberStatus";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,8 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
private final Table resultsTable;
|
private final Table resultsTable;
|
||||||
private final Paginator paginator;
|
private final Paginator paginator;
|
||||||
private final StringParameter queryParam;
|
private final StringParameter queryParam;
|
||||||
private final List<String> queryFields = new ArrayList<String>();
|
private final QueryFieldsRequestLocal queryFields = new QueryFieldsRequestLocal();
|
||||||
|
//private final List<String> queryFields = new ArrayList<String>();
|
||||||
//private final Submit submit;
|
//private final Submit submit;
|
||||||
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
|
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
|
||||||
|
|
||||||
|
|
@ -130,7 +131,11 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void addQueryField(final String queryField) {
|
public void addQueryField(final String queryField) {
|
||||||
queryFields.add(queryField);
|
queryFields.addQueryField(queryField);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetQueryFields() {
|
||||||
|
queryFields.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ResultsTable extends Table {
|
private class ResultsTable extends Table {
|
||||||
|
|
@ -216,7 +221,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
"((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
||||||
ContentItem.NAME, query,
|
ContentItem.NAME, query,
|
||||||
ContentPage.TITLE, query));
|
ContentPage.TITLE, query));
|
||||||
for (String field : queryFields) {
|
for (String field : queryFields.getQueryFields()) {
|
||||||
buffer.append(String.
|
buffer.append(String.
|
||||||
format(" or (lower(%s) like lower('%%%s%%'))", field, query));
|
format(" or (lower(%s) like lower('%%%s%%'))", field, query));
|
||||||
}
|
}
|
||||||
|
|
@ -395,4 +400,30 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class QueryFieldsRequestLocal extends RequestLocal {
|
||||||
|
|
||||||
|
private List<String> queryFields = new ArrayList<String>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object initialValue(final PageState state) {
|
||||||
|
return new ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getQueryFields() {
|
||||||
|
return queryFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueryFields(final List<String> queryFields) {
|
||||||
|
this.queryFields = queryFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addQueryField(final String queryField) {
|
||||||
|
queryFields.add(queryField);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
queryFields = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,10 @@ public class ItemSearchPage extends CMSPage {
|
||||||
m_create.setEditAfterCreate((Boolean) state.getValue(new BooleanParameter("editAfterCreate")));
|
m_create.setEditAfterCreate((Boolean) state.getValue(new BooleanParameter("editAfterCreate")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.getValue(new StringParameter("queryField")) != null) {
|
if (state.getValue(new StringParameter("queryField")) == null) {
|
||||||
|
//Because of Bebops silly stateful behaviour we have to do this...
|
||||||
|
m_flatBrowse.resetQueryFields();
|
||||||
|
}else {
|
||||||
m_flatBrowse.addQueryField((String) state.getValue(new StringParameter("queryField")));
|
m_flatBrowse.addQueryField((String) state.getValue(new StringParameter("queryField")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue