PublicPersonalProfile: Anlegen neuer Navigations-Items und Löschen derselben funktioniert jetzt.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1034 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
b5a0cbb11e
commit
233e1e991f
|
|
@ -7,7 +7,8 @@
|
|||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||
<ccm:requires name="ccm-cms-assets-relatedlink" version="6.6.0" release="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:directories>
|
||||
<ccm:directory name="pdl"/>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<table name="cms_related_links"/>
|
||||
<initalizer class="com.arsdigita.cms.Initializer"/>
|
||||
<initalizer class="com.arsdigita.cms.contentassets.RelatedLinkInitializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="ct_public_personal_profiles"/>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public class PublicPersonalProfile extends ContentPage {
|
|||
|
||||
public static final String OWNER = "owner";
|
||||
public static final String PROFILE_URL = "profileUrl";
|
||||
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.PublicPersonalProfile";
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class PublicPersonalProfileNavItem extends DomainObject {
|
|||
public static final String ORDER = "navItemOrder";
|
||||
public static final String GENERATOR_CLASS = "generatorClass";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.PublicPersonalProfileNavItem";
|
||||
"com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItem";
|
||||
|
||||
public PublicPersonalProfileNavItem() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class PublicPersonalProfileNavItemCollection extends DomainCollection {
|
|||
}
|
||||
|
||||
public final void addLanguageFilter(final String language) {
|
||||
languageFilter = this.addEqualsFilter(PublicPersonalProfileNavItem.KEY,
|
||||
languageFilter = this.addEqualsFilter(PublicPersonalProfileNavItem.LANG,
|
||||
language);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
|
|
@ -11,10 +13,19 @@ import com.arsdigita.bebop.form.SingleSelect;
|
|||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||
import com.arsdigita.cms.contenttypes.Link;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItem;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItemCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.mimetypes.MimeType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -37,8 +48,17 @@ public class PublicPersonalProfileNavigationAddForm
|
|||
private SimpleEditStep editStep;
|
||||
|
||||
public PublicPersonalProfileNavigationAddForm(
|
||||
ItemSelectionModel itemModel,
|
||||
SimpleEditStep editStep) {
|
||||
final ItemSelectionModel itemModel,
|
||||
final SimpleEditStep editStep) {
|
||||
this("PublicPersonalProfileNavAddForm", itemModel, editStep);
|
||||
this.itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
}
|
||||
|
||||
public PublicPersonalProfileNavigationAddForm(
|
||||
final String formName,
|
||||
final ItemSelectionModel itemModel,
|
||||
final SimpleEditStep editStep) {
|
||||
super("PublicPersonalProfileNavAddForm", itemModel);
|
||||
this.itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
|
|
@ -46,24 +66,41 @@ public class PublicPersonalProfileNavigationAddForm
|
|||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String) PublicPersonalProfileGlobalizationUtil.
|
||||
globalize("publicpersonalprofile.ui.nav.select_nav_item").
|
||||
add(new Label((String) PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.select_nav_item").
|
||||
localize()));
|
||||
ParameterModel navItemModel = new StringParameter("navItemName");
|
||||
ParameterModel navItemModel =
|
||||
new StringParameter(PublicPersonalProfileNavItem.KEY);
|
||||
SingleSelect navItemSelect = new SingleSelect(navItemModel);
|
||||
navItemSelect.addValidationListener(new NotNullValidationListener());
|
||||
final String[] mockNav = new String[]{"Allgemein", "Beruflich",
|
||||
"Forschung", "Lehre", "Projekte",
|
||||
"Publikationen"};
|
||||
for (String nav : mockNav) {
|
||||
navItemSelect.addOption(new Option(nav));
|
||||
|
||||
PublicPersonalProfileNavItemCollection navItems =
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
if (showGenerated()) {
|
||||
navItems.addFilter("generatorClass is not null");
|
||||
} else {
|
||||
navItems.addFilter("generatorClass is null");
|
||||
}
|
||||
|
||||
add(new Label((String) PublicPersonalProfileGlobalizationUtil.
|
||||
globalize("publicpersonalprofile.ui.nav.select_target").
|
||||
localize()));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH);
|
||||
add(this.itemSearch);
|
||||
PublicPersonalProfileNavItem navItem;
|
||||
while (navItems.next()) {
|
||||
navItem = navItems.getNavItem();
|
||||
|
||||
navItemSelect.addOption(new Option(navItem.getKey(),
|
||||
navItem.getLabel()));
|
||||
}
|
||||
add(navItemSelect);
|
||||
|
||||
if (!showGenerated()) {
|
||||
add(new Label((String) PublicPersonalProfileGlobalizationUtil.
|
||||
globalize(
|
||||
"publicpersonalprofile.ui.nav.select_target").
|
||||
localize()));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH);
|
||||
add(this.itemSearch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,5 +109,53 @@ public class PublicPersonalProfileNavigationAddForm
|
|||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
PageState state = fse.getPageState();
|
||||
FormData data = fse.getFormData();
|
||||
|
||||
String navKey = (String) data.get(PublicPersonalProfileNavItem.KEY);
|
||||
|
||||
PublicPersonalProfile profile = (PublicPersonalProfile) itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
RelatedLink link = new RelatedLink();
|
||||
link.setLinkListName(PublicPersonalProfile.LINK_LIST_NAME);
|
||||
link.setLinkOwner(profile);
|
||||
|
||||
link.setResourceSize("");
|
||||
link.setResourceType(MimeType.loadMimeType("text/html"));
|
||||
|
||||
PublicPersonalProfileNavItemCollection navItems =
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
navItems.addKeyFilter(navKey);
|
||||
navItems.next();
|
||||
PublicPersonalProfileNavItem navItem = navItems.getNavItem();
|
||||
|
||||
link.setTitle(navItem.getKey());
|
||||
link.setDescription("");
|
||||
link.setOrder(navItem.getOrder());
|
||||
link.setTargetType(Link.INTERNAL_LINK);
|
||||
|
||||
ContentItem targetItem;
|
||||
if (showGenerated()) {
|
||||
//For generated content the target is the profile itself.
|
||||
targetItem = profile;
|
||||
} else {
|
||||
targetItem = (ContentItem) data.get(ITEM_SEARCH);
|
||||
}
|
||||
|
||||
if (targetItem.getParent() instanceof ContentBundle) {
|
||||
targetItem = (ContentItem) targetItem.getParent();
|
||||
}
|
||||
|
||||
link.setTargetItem(targetItem);
|
||||
link.setTargetWindow("");
|
||||
|
||||
link.save();
|
||||
}
|
||||
|
||||
protected boolean showGenerated() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PublicPersonalProfileNavigationGeneratedAddForm extends PublicPersonalProfileNavigationAddForm {
|
||||
|
||||
public PublicPersonalProfileNavigationGeneratedAddForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final SimpleEditStep editStep) {
|
||||
super("PublicPersonalProfileNavGeneratedAddForm", itemModel, editStep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showGenerated() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,32 +12,47 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|||
* @version $Id$
|
||||
*/
|
||||
public class PublicPersonalProfileNavigationStep extends SimpleEditStep {
|
||||
|
||||
public static final String EDIT_NAV_SHEET_NAME = "editNav";
|
||||
|
||||
|
||||
public static final String EDIT_NAV_ITEM_SHEET_NAME = "editNavItem";
|
||||
public static final String EDIT_NAV_GENERATED_ITEM_SHEET_NAME =
|
||||
"editGeneratedNavItem";
|
||||
|
||||
public PublicPersonalProfileNavigationStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public PublicPersonalProfileNavigationStep(
|
||||
|
||||
public PublicPersonalProfileNavigationStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm editNavSheet = new PublicPersonalProfileNavigationAddForm(itemModel, this);
|
||||
add(EDIT_NAV_SHEET_NAME,
|
||||
(String) PublicPersonalProfileGlobalizationUtil.globalize("publicpersonalprofile.ui.profile.nav_add").localize(),
|
||||
new WorkflowLockedComponentAccess(editNavSheet, itemModel),
|
||||
editNavSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
PublicPersonalProfileNavigationTable navTable = new PublicPersonalProfileNavigationTable(itemModel, this);
|
||||
setDisplayComponent(navTable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm editNavItemSheet =
|
||||
new PublicPersonalProfileNavigationAddForm(itemModel,
|
||||
this);
|
||||
add(EDIT_NAV_ITEM_SHEET_NAME,
|
||||
(String) PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.profile.content.add").localize(),
|
||||
new WorkflowLockedComponentAccess(editNavItemSheet, itemModel),
|
||||
editNavItemSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
BasicItemForm editGeneratedNavItemSheet =
|
||||
new PublicPersonalProfileNavigationGeneratedAddForm(
|
||||
itemModel,
|
||||
this);
|
||||
add(EDIT_NAV_GENERATED_ITEM_SHEET_NAME,
|
||||
(String) PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.profile.generated_content.add").
|
||||
localize(),
|
||||
new WorkflowLockedComponentAccess(editGeneratedNavItemSheet,
|
||||
itemModel),
|
||||
editGeneratedNavItemSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
PublicPersonalProfileNavigationTable navTable =
|
||||
new PublicPersonalProfileNavigationTable(
|
||||
itemModel, this);
|
||||
setDisplayComponent(navTable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.Table;
|
||||
import com.arsdigita.bebop.event.TableActionEvent;
|
||||
|
|
@ -11,10 +13,23 @@ import com.arsdigita.bebop.table.TableColumn;
|
|||
import com.arsdigita.bebop.table.TableColumnModel;
|
||||
import com.arsdigita.bebop.table.TableModel;
|
||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItem;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItemCollection;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -29,18 +44,19 @@ public class PublicPersonalProfileNavigationTable
|
|||
private static final Logger logger = Logger.getLogger(
|
||||
PublicPersonalProfileNavigationTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_TARGET = "table_col_target";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private ItemSelectionModel itemModel;
|
||||
private SimpleEditStep editStep;
|
||||
|
||||
public PublicPersonalProfileNavigationTable(ItemSelectionModel itemModel,
|
||||
SimpleEditStep editStep) {
|
||||
SimpleEditStep editStep) {
|
||||
super();
|
||||
this.itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
|
||||
setEmptyView(new Label(PublicPersonalProfileGlobalizationUtil.
|
||||
globalize("publicpersonalprofile.ui.nav.empty")));
|
||||
setEmptyView(new Label(PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.empty")));
|
||||
|
||||
TableColumnModel colModel = getColumnModel();
|
||||
colModel.add(new TableColumn(
|
||||
|
|
@ -48,9 +64,16 @@ public class PublicPersonalProfileNavigationTable
|
|||
PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.target").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
|
||||
colModel.add(new TableColumn(
|
||||
1,
|
||||
PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.targetitem").localize(),
|
||||
TABLE_COL_TARGET));
|
||||
|
||||
colModel.add(new TableColumn(
|
||||
2,
|
||||
PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
|
|
@ -58,7 +81,8 @@ public class PublicPersonalProfileNavigationTable
|
|||
itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new TargetCellRenderer());
|
||||
colModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
|
@ -77,7 +101,10 @@ public class PublicPersonalProfileNavigationTable
|
|||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
return new PublicPersonalProfileNavigationTableModel(table, state);
|
||||
PublicPersonalProfile profile = (PublicPersonalProfile) itemModel.
|
||||
getSelectedObject(state);
|
||||
return new PublicPersonalProfileNavigationTableModel(
|
||||
table, state, profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,10 +117,16 @@ public class PublicPersonalProfileNavigationTable
|
|||
"Publikationen"};
|
||||
private int index = -1;
|
||||
private String mockNavItem;
|
||||
private PublicPersonalProfile profile;
|
||||
private DataCollection linkCollection;
|
||||
private PublicPersonalProfileNavItemCollection navItems;
|
||||
|
||||
public PublicPersonalProfileNavigationTableModel(Table table,
|
||||
PageState state) {
|
||||
public PublicPersonalProfileNavigationTableModel(
|
||||
Table table, PageState state, PublicPersonalProfile profile) {
|
||||
this.table = table;
|
||||
linkCollection = RelatedLink.getRelatedLinks(
|
||||
profile, PublicPersonalProfile.LINK_LIST_NAME);
|
||||
navItems = new PublicPersonalProfileNavItemCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -103,20 +136,38 @@ public class PublicPersonalProfileNavigationTable
|
|||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
if (index < (mockNav.length - 1)) {
|
||||
index++;
|
||||
return true;
|
||||
/*if (index < (mockNav.length - 1)) {
|
||||
index++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
return linkCollection.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
RelatedLink link = new RelatedLink(linkCollection.getDataObject());
|
||||
String key = link.getTitle();
|
||||
ContentItem targetItem = link.getTargetItem();
|
||||
PublicPersonalProfileNavItem navItem;
|
||||
|
||||
navItem = navItems.getNavItem(key, DispatcherHelper.
|
||||
getNegotiatedLocale().
|
||||
getLanguage());
|
||||
navItems.reset();
|
||||
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return mockNav[index];
|
||||
//return mockNav[index];
|
||||
return navItem.getLabel();
|
||||
case 1:
|
||||
if (navItem.getGeneratorClass() == null) {
|
||||
return targetItem;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
case 2:
|
||||
return PublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"publicpersonalprofile.ui.nav.remove").localize();
|
||||
default:
|
||||
|
|
@ -126,7 +177,8 @@ public class PublicPersonalProfileNavigationTable
|
|||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return index;
|
||||
RelatedLink link = new RelatedLink(linkCollection.getDataObject());
|
||||
return link.getID();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +200,47 @@ public class PublicPersonalProfileNavigationTable
|
|||
}
|
||||
}
|
||||
|
||||
private class TargetCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int column) {
|
||||
if (value == null) {
|
||||
return new Label("");
|
||||
} else {
|
||||
final ContentPage item = (ContentPage) value;
|
||||
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
|
||||
final boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
item);
|
||||
|
||||
if (canEdit) {
|
||||
final ContentSection section = CMS.getContext().
|
||||
getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
|
||||
Link link = new Link(item.getTitle(),
|
||||
resolver.generateItemURL(
|
||||
state, item, section, item.getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
return new Label(item.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DeleteCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
|
@ -162,25 +255,25 @@ public class PublicPersonalProfileNavigationTable
|
|||
int col) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
/*Publication publication = (Publication) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
PublicPersonalProfile profile = (PublicPersonalProfile) itemModel.
|
||||
getSelectedObject(
|
||||
state);
|
||||
|
||||
boolean canDelete = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
publication);
|
||||
|
||||
state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||
profile);
|
||||
|
||||
if (canDelete) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) PublicationGlobalizationUtil.
|
||||
globalize(
|
||||
"publications.ui.authors.author.confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {*/
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
//}
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) PublicPersonalProfileGlobalizationUtil.
|
||||
globalize("publicpersonalprofile.ui.nav.remove.confirm").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,6 +286,12 @@ public class PublicPersonalProfileNavigationTable
|
|||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
final BigDecimal linkId = new BigDecimal(
|
||||
event.getRowKey().toString());
|
||||
|
||||
RelatedLink link = new RelatedLink(linkId);
|
||||
|
||||
link.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue