Löschen-Link in der ItemLanguagesTable wird jetzt nur noch angezeigt, wenn das Item keine Live-Version hat
git-svn-id: https://svn.libreccm.org/ccm/trunk@1424 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
468c5a7f27
commit
2f23a82b3a
|
|
@ -64,9 +64,11 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
super(new LanguagesBuilder(model));
|
super(new LanguagesBuilder(model));
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
|
||||||
addColumn("cms.ui.language.header", ContentPage.LANGUAGE, false, new LanguageRenderer());
|
addColumn("cms.ui.language.header", ContentPage.LANGUAGE, false,
|
||||||
|
new LanguageRenderer());
|
||||||
addColumn("cms.title", ContentPage.TITLE);
|
addColumn("cms.title", ContentPage.TITLE);
|
||||||
m_deleteColumn = addColumn("cms.ui.action", new ActionCellRenderer(m_model));
|
m_deleteColumn = addColumn("cms.ui.action", new ActionCellRenderer(
|
||||||
|
m_model));
|
||||||
setResourceBundle(GlobalizationUtil.getBundleName());
|
setResourceBundle(GlobalizationUtil.getBundleName());
|
||||||
addTableActionListener(new InstanceDeleter());
|
addTableActionListener(new InstanceDeleter());
|
||||||
}
|
}
|
||||||
|
|
@ -85,8 +87,10 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataQuery makeDataQuery(DataTable t, PageState s) {
|
public DataQuery makeDataQuery(DataTable t, PageState s) {
|
||||||
ContentPage multiLingual = (ContentPage) m_model.getSelectedObject(s);
|
ContentPage multiLingual =
|
||||||
DataQuery q = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.getBundledItems");
|
(ContentPage) m_model.getSelectedObject(s);
|
||||||
|
DataQuery q = SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.getBundledItems");
|
||||||
q.setParameter("bundleID", multiLingual.getContentBundle().getID());
|
q.setParameter("bundleID", multiLingual.getContentBundle().getID());
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
@ -102,11 +106,14 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
private static class LanguageRenderer implements TableCellRenderer {
|
private static class LanguageRenderer implements TableCellRenderer {
|
||||||
|
|
||||||
public Component getComponent(Table table, PageState state, Object value,
|
public Component getComponent(Table table, PageState state, Object value,
|
||||||
boolean isSelected, Object key,
|
boolean isSelected, Object key,
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
BigDecimal id = (BigDecimal) key;
|
BigDecimal id = (BigDecimal) key;
|
||||||
String target = ContentItemPage.getRelativeItemURL(id, ContentItemPage.AUTHORING_TAB);
|
String target =
|
||||||
return new Link(new Label(LanguageUtil.getLangFull((String) value)), target);
|
ContentItemPage.getRelativeItemURL(id,
|
||||||
|
ContentItemPage.AUTHORING_TAB);
|
||||||
|
return new Link(new Label(LanguageUtil.getLangFull((String) value)),
|
||||||
|
target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,7 +122,8 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
*/
|
*/
|
||||||
private static class ActionCellRenderer implements TableCellRenderer {
|
private static class ActionCellRenderer implements TableCellRenderer {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ActionCellRenderer.class);
|
private static final Logger logger =
|
||||||
|
Logger.getLogger(ActionCellRenderer.class);
|
||||||
private static Label s_noAction;
|
private static Label s_noAction;
|
||||||
private static Label s_primary;
|
private static Label s_primary;
|
||||||
private static ControlLink s_link;
|
private static ControlLink s_link;
|
||||||
|
|
@ -124,9 +132,11 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
logger.debug("Static initializer is starting...");
|
logger.debug("Static initializer is starting...");
|
||||||
s_noAction = new Label(" ", false);
|
s_noAction = new Label(" ", false);
|
||||||
s_noAction.lock();
|
s_noAction.lock();
|
||||||
s_primary = new Label(GlobalizationUtil.globalize("cms.ui.primary_instance"), false);
|
s_primary = new Label(GlobalizationUtil.globalize(
|
||||||
|
"cms.ui.primary_instance"), false);
|
||||||
s_primary.lock();
|
s_primary.lock();
|
||||||
s_link = new ControlLink(new Label(GlobalizationUtil.globalize("cms.ui.delete")));
|
s_link = new ControlLink(new Label(GlobalizationUtil.globalize(
|
||||||
|
"cms.ui.delete")));
|
||||||
s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ?
|
s_link.setConfirmation("Permanently delete this item?"); // XXX G11N ?
|
||||||
logger.debug("Static initalizer finished.");
|
logger.debug("Static initalizer finished.");
|
||||||
}
|
}
|
||||||
|
|
@ -137,8 +147,8 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component getComponent(Table table, PageState state, Object value,
|
public Component getComponent(Table table, PageState state, Object value,
|
||||||
boolean isSelected, Object key,
|
boolean isSelected, Object key,
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
if (m_model.getSelectedKey(state).equals(key)) {
|
if (m_model.getSelectedKey(state).equals(key)) {
|
||||||
return s_noAction;
|
return s_noAction;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -146,10 +156,13 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
BigDecimal id = new BigDecimal(key.toString());
|
BigDecimal id = new BigDecimal(key.toString());
|
||||||
OID oid = new OID(ContentPage.BASE_DATA_OBJECT_TYPE, id);
|
OID oid = new OID(ContentPage.BASE_DATA_OBJECT_TYPE, id);
|
||||||
try {
|
try {
|
||||||
ContentPage item = (ContentPage) DomainObjectFactory.newInstance(oid);
|
ContentPage item = (ContentPage) DomainObjectFactory.
|
||||||
|
newInstance(oid);
|
||||||
if (item.getLanguage().equals(
|
if (item.getLanguage().equals(
|
||||||
item.getContentBundle().getDefaultLanguage())) {
|
item.getContentBundle().getDefaultLanguage())) {
|
||||||
return s_primary;
|
return s_primary;
|
||||||
|
} else if (item.getLiveVersion() != null) {
|
||||||
|
return s_noAction;
|
||||||
}
|
}
|
||||||
} catch (com.arsdigita.domain.DataObjectNotFoundException ex) {
|
} catch (com.arsdigita.domain.DataObjectNotFoundException ex) {
|
||||||
return s_noAction;
|
return s_noAction;
|
||||||
|
|
@ -174,7 +187,8 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
|
|
||||||
OID oid = new OID(ContentPage.BASE_DATA_OBJECT_TYPE, id);
|
OID oid = new OID(ContentPage.BASE_DATA_OBJECT_TYPE, id);
|
||||||
try {
|
try {
|
||||||
ContentPage item = (ContentPage) DomainObjectFactory.newInstance(oid);
|
ContentPage item =
|
||||||
|
(ContentPage) DomainObjectFactory.newInstance(oid);
|
||||||
ContentBundle bundle = item.getContentBundle();
|
ContentBundle bundle = item.getContentBundle();
|
||||||
bundle.removeInstance(item);
|
bundle.removeInstance(item);
|
||||||
item.delete();
|
item.delete();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue