Kleinere Formatierungen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@536 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-09-19 22:12:46 +00:00
parent e072ca1200
commit 9609ee2850
7 changed files with 72 additions and 56 deletions

View File

@ -35,7 +35,6 @@ import org.apache.log4j.Logger;
* *
* @author sseago@redhat.com * @author sseago@redhat.com
* @version $Id: FileAttachment.java 1112 2006-04-18 14:02:10Z apevec $ * @version $Id: FileAttachment.java 1112 2006-04-18 14:02:10Z apevec $
*
*/ */
public class FileAttachment extends FileAsset { public class FileAttachment extends FileAsset {
@ -160,11 +159,10 @@ public class FileAttachment extends FileAsset {
} }
/** /**
* This method is only used for setting initial sort keys for * This method is only used for setting initial sort keys for attachments
* attachments which exist without them. This is called by swapKeys * which exist without them. This is called by swapKeys instead of
* instead of attempting to swap if the key found is * attempting to swap if the key found is null. This implementation sorts all
* null. This implementation sorts all FileAttachments owned by this * FileAttachments owned by this FileAttachment's "fileOwner" by file name.
* FileAttachment's "fileOwner" by file name.
*/ */
public void alphabetize() { public void alphabetize() {
int sortKey = maxOrder(); int sortKey = maxOrder();
@ -263,7 +261,8 @@ public class FileAttachment extends FileAsset {
} }
DataOperation operation = SessionManager.getSession() DataOperation operation = SessionManager.getSession()
.retrieveDataOperation("com.arsdigita.cms.contentassets.swapFileAttachmentOrder"); .retrieveDataOperation(
"com.arsdigita.cms.contentassets.swapFileAttachmentOrder");
operation.setParameter("ownerID", fileOwner.getID()); operation.setParameter("ownerID", fileOwner.getID());
operation.setParameter("fileOrder", currentKey); operation.setParameter("fileOrder", currentKey);
operation.setParameter("nextFileOrder", otherKey); operation.setParameter("nextFileOrder", otherKey);

View File

@ -9,23 +9,33 @@ import com.arsdigita.util.parameter.Parameter;
public class FileAttachmentConfig extends AbstractConfig { public class FileAttachmentConfig extends AbstractConfig {
/**
* A form which should be used for editing file asset properties.
* Default implementation edits Assets.description property.
*/
Parameter editFormClass; Parameter editFormClass;
/**
* Optional parameter if set to TRUE will disply the asset URL instead of
* the description on AttachFile Authroing step. Default: FALSE
*/
Parameter showAssetID; Parameter showAssetID;
/** /**
* Constructor, don't use is directly! * Constructor, don't use it directly!
*/ */
public FileAttachmentConfig() { public FileAttachmentConfig() {
editFormClass = new SpecificClassParameter ("com.arsdigita.cms.contentassets.file_edit_form", editFormClass = new SpecificClassParameter(
Parameter.REQUIRED, "com.arsdigita.cms.contentassets.file_edit_form",
FileDescriptionForm.class, Parameter.REQUIRED,
FormSection.class FileDescriptionForm.class,
); FormSection.class
showAssetID = new BooleanParameter("com.arsdigita.cms.contentassets.file_show_asset_id", );
Parameter.OPTIONAL, showAssetID = new BooleanParameter(
Boolean.FALSE "com.arsdigita.cms.contentassets.file_show_asset_id",
); Parameter.OPTIONAL,
Boolean.FALSE
);
register(editFormClass); register(editFormClass);
register(showAssetID); register(showAssetID);

View File

@ -52,6 +52,11 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
public void init(DomainInitEvent evt) { public void init(DomainInitEvent evt) {
super.init(evt); super.init(evt);
/*
* Register with kernel's URLservice so for an instance of it the
* complete path to its location in the sites URL tree, based on its OID,
* can be build.
*/
URLService.registerFinder( URLService.registerFinder(
FileAttachment.BASE_DATA_OBJECT_TYPE, FileAttachment.BASE_DATA_OBJECT_TYPE,
new FileAttachmentURLFinder()); new FileAttachmentURLFinder());
@ -67,7 +72,7 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
* their specific adapters * their specific adapters
* *
* chris.gilbert@westsussex.gov.uk * chris.gilbert@westsussex.gov.uk
*/ */
MetadataProviderRegistry.registerAdapter( MetadataProviderRegistry.registerAdapter(
FileAttachment.BASE_DATA_OBJECT_TYPE, FileAttachment.BASE_DATA_OBJECT_TYPE,
new FileAttachmentMetadataProvider()); new FileAttachmentMetadataProvider());
@ -88,13 +93,12 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
} }
/** /**
* Returns the path to the XML file defintions for the * Returns the path to the XML file defintions for the asset, eg:
* asset, * /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
* eg /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/ */
public String getTraversalXML() { public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/" return "/WEB-INF/traversal-adapters/com/arsdigita/"
+ "cms/contentassets/FileAttachment.xml"; + "cms/contentassets/FileAttachment.xml";
} }
/** /**
@ -114,7 +118,7 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The label for the authoring step * The label for the authoring step
* @deprecated has to be replaced to provide LabelKey, see contgentAssetInitializer * @deprecated has to be replaced to provide LabelKey, see ContentAssetInitializer
*/ */
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return FileAttachmentGlobalize.AuthoringStepLabel(); return FileAttachmentGlobalize.AuthoringStepLabel();
@ -125,7 +129,7 @@ public class FileAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The description for the authoring step * The description for the authoring step
* @deprecated has to be replaced to provide DesciptionKey, see contgentAssetInitializer * @deprecated has to be replaced to provide DesciptionKey, see ContentAssetInitializer
*/ */
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return FileAttachmentGlobalize.AuthoringStepDescription(); return FileAttachmentGlobalize.AuthoringStepDescription();

View File

@ -73,7 +73,8 @@ public class FileAttachmentMetadataProvider extends AssetMetadataProvider {
"", "",
"/redirect/", map ).getURL(); "/redirect/", map ).getURL();
summary.append("A file attached to <a href=\"" + url + "\">" + title + "</a>"); summary.append("A file attached to <a href=\"" + url + "\">" +
title + "</a>");
} else { } else {
// draft - don't give a live link because stylesheets // draft - don't give a live link because stylesheets

View File

@ -119,9 +119,8 @@ public abstract class ContentAssetInitializer extends CompoundInitializer {
public abstract String getBaseType(); public abstract String getBaseType();
/** /**
* Returns the path to the XML file defintions for the * Returns the path to the XML file defintions for the asset, eg
* asset, * /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
* eg /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/ */
public abstract String getTraversalXML(); public abstract String getTraversalXML();

View File

@ -29,34 +29,32 @@ import java.util.HashMap;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
*
* Supports generically locating a domain object on the site. * Supports generically locating a domain object on the site.
* The URLService can produce the path (relative to the root URL) to a page * The URLService can produce the path (relative to the root URL) to a page
* that displays the domain object identified by a given OID. * that displays the domain object identified by a given OID.
* <P> * <P>
* The service * The service works by delegating to a <em>URLFinder</em> based on the object
* works by delegating to a URLFinder based on the object type of the * type of the given OID.
* given OID. A URLFinder must be registered with the URLService for the * A URLFinder must be registered with the URLService for the object type
* object type in question or one of its supertypes. That URLFinder * in question or one of its supertypes. That URLFinder dynamically produces a
* dynamically produces a URL path by a process that potentially involves * URL path by a process that potentially involves a few database queries.</p>
* a few database queries. *
* <p> * <p>
* The URLService is only intended for single-object lookups. On pages that * The URLService is only intended for single-object lookups. On pages that
* display many objects (for example, a search results page), the URLs displayed for * display many objects (for example, a search results page), the URLs displayed
* each object should <em>not</em> be obtained from the URLService (for performance * for each object should <em>not</em> be obtained from the URLService (for
* reasons). Instead, a single "redirector page" should be the target of * performance reasons). Instead, a single "redirector page" should be the target
* all those links. The user clicks on a link, * of all those links. The user clicks on a link, which then uses the
* which then uses the URLService to find the object's URL * URLService to find the object's URL and redirect the user to the resulting
* and redirect the user to the resulting URL. An example of this process * URL. An example of this process is:</p>
* is:
* <ol> * <ol>
* <li> User searches for objects based on keywords. * <li> User searches for objects based on keywords.</li>
* <li> Search page displays matching objects, with a link for each * <li> Search page displays matching objects, with a link for each
* object. The targets of these links are all the same: * object. The targets of these links are all the same:
* .../display-result?id=:id&object_type=:object_type * .../display-result?id=:id&object_type=:object_type</li>
* <li> User clicks on one of those links. * <li> User clicks on one of those links.</li>
* <li> Display-result page uses the URLService to find the specified * <li> Display-result page uses the URLService to find the specified
* object's URL and redirect the user there. * object's URL and redirect the user there.</li>
* </ol> * </ol>
* *
* The GenericURLFinder class provides a simple URLFinder that can be * The GenericURLFinder class provides a simple URLFinder that can be
@ -65,11 +63,10 @@ import javax.servlet.http.HttpServletRequest;
* @see GenericURLFinder * @see GenericURLFinder
* *
* @author Oumi Mehrotra * @author Oumi Mehrotra
* @version $Id: URLService.java 287 2005-02-22 00:29:02Z sskracic $
**/ **/
public class URLService { public class URLService {
public static final String versionId = "$Id: URLService.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static Map s_finders = new HashMap(); private static Map s_finders = new HashMap();
/** /**

View File

@ -96,8 +96,7 @@ public class PrivilegeDescriptor {
/** /**
* * Adds a privilege, identified by a name (string), to the system.
* Adds a privilege to the system.
* *
* @exception PersistenceException when there is a persistence * @exception PersistenceException when there is a persistence
* error in saving the new privilege. * error in saving the new privilege.
@ -121,9 +120,16 @@ public class PrivilegeDescriptor {
return desc; return desc;
} }
public static void addChildPrivilege( /**
String privilegeName, * Sets up a tree structure of privileges, if privilegeName is granted,
String childPrivilegeName) { * it includes child PrivilegeName as well.
* @param privilegeName privilege name will include another privilege
* @param childPrivilegeName privilege name is included by priv...Name.
*/
public static void addChildPrivilege( String privilegeName,
String childPrivilegeName) {
DataOperation addOp = DataOperation addOp =
SessionManager.getSession().retrieveDataOperation( SessionManager.getSession().retrieveDataOperation(
"com.arsdigita.kernel.permissions.addChildPrivilege"); "com.arsdigita.kernel.permissions.addChildPrivilege");
@ -303,9 +309,9 @@ public class PrivilegeDescriptor {
} }
/** /**
*
* Determine whether or not this privilege is implied by the * Determine whether or not this privilege is implied by the
* specified privilege. * specified privilege.
*
* @return true if the privilege on which this method is invoked * @return true if the privilege on which this method is invoked
* is implied by the specified privilege, false otherwise * is implied by the specified privilege, false otherwise
*/ */