Löschen-Link im FolderBrowser korrigiert (#1066)

FolderBrowser#isDeletable() angepaßt und ContentItem#hasLiveInstance() eingeführt. Nun wird nicht mehr nur die primäre Instanz geprüft, sondern das ContentBundle. LÖschen wird nun nur angezeigt, wenn keine Version mehr veröffentlich ist. Löschen eines Items mit mehreren Sprachversionen aus dem FolderBrowser heraus, löscht alle Items in allen Sprachen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1578 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2012-04-11 08:36:26 +00:00
parent ca3337c6d9
commit f6809e1567
2 changed files with 44 additions and 28 deletions

View File

@ -1061,9 +1061,9 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
}
/**
* Returns true if this item has a publicly viewable version. This item is
* not necessarily the live version nor is this method to be confused with
* isPublished.
* Returns true if this language version of this item has a publicly viewable
* version. This item is not necessarily the live version nor is this
* method to be confused with isPublished.
*
* @return < code>true<code> if this content item has a live
* version, or if it <em>is</em> the live version
@ -1072,6 +1072,19 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
return getLiveVersion() != null;
}
// Added by: Quasimodo
/**
* Returns true if this item has a publicly viewable version in any language.
* This item is not necessarily the live version nor is this method
* to be confused with isPublished.
*
* @return < code>true<code> if this content bundle item has a live
* version
*/
public boolean hasLiveInstance() {
return getBundle().getLiveVersion() != null;
}
/**
* Makes an item live or not live.
*

View File

@ -70,6 +70,7 @@ import javax.servlet.ServletException;
* item selection model is updated.
*
* @author <a href="mailto:lutter@arsdigita.com">David Lutterkort</a>
* @author Sören Bernstein <sbernstein@zes.uni-bremen.de>
* @version $Id: FolderBrowser.java 2017 2009-10-04 09:03:45Z pboy $
*/
public class FolderBrowser extends Table {
@ -506,7 +507,7 @@ public class FolderBrowser extends Table {
/**
* Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de>
*
*
* Produce links to view an item in a specific language and show all
* existing language version and the live status in the folder browser.
*/
@ -577,12 +578,12 @@ public class FolderBrowser extends Table {
} else {
ItemResolver resolver = section.getItemResolver();
container.add(
new Link(langLabel,
resolver.generateItemURL(state,
ci.getID(),
name,
section,
coll.getVersion())));
new Link(langLabel,
resolver.generateItemURL(state,
ci.getID(),
name,
section,
coll.getVersion())));
}
if (languages.hasNext()) {
container.add(new Label("&nbsp;", false));
@ -785,35 +786,37 @@ public class FolderBrowser extends Table {
s_log.debug("Checking to see if " + this + " is deletable");
}
if (m_itemColl.isLive()) {
if (s_log.isDebugEnabled()) {
s_log.debug("The item is live; it cannot be deleted");
}
return false;
}
if (m_itemColl.isFolder()) {
if (!m_itemColl.hasChildren()) {
if (s_log.isDebugEnabled()) {
s_log.debug("The item is an empty folder; it may be "
+ "deleted");
s_log.debug("The item is an empty folder; it may be deleted");
}
return true;
} else {
if (s_log.isDebugEnabled()) {
s_log.debug("The folder is not empty; it cannot be "
+ "deleted");
s_log.debug("The folder is not empty; it cannot be deleted");
}
return false;
}
} else {
if (m_itemColl.getContentItem().hasLiveInstance()) {
if (s_log.isDebugEnabled()) {
s_log.debug("This item has a live instance; it cannot be deleted");
}
return false;
}
} else {
if (s_log.isDebugEnabled()) {
s_log.debug("The item is not a folder; it may be deleted");
}
return true;
}
if (s_log.isDebugEnabled()) {
s_log.debug("The item is not a folder and doesn't have a live instance; it may be deleted");
}
return true;
}
public Object getKeyAt(int columnIndex) {