Added various documentation, enhanced formattings.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2729 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2014-06-30 20:51:46 +00:00
parent 701f905998
commit 47ddc1cebe
10 changed files with 152 additions and 66 deletions

View File

@ -4,19 +4,20 @@
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<!-- NOTE: This file is read only once during load step. Later modification
require to dreate (load) the database again (or manually modify the
require to create (load) the database again (or manually modify the
affected database tables). -->
<ctd:content-type label="FAQ Item"
description="An FAQ item type"
objectType="com.arsdigita.cms.contenttypes.FAQItem"
classname="com.arsdigita.cms.contenttypes.FAQItem">
<!-- Overwrite the standard pageCreate class to customize and include
additional content type specific widgets. -->
<ctd:authoring-kit
createComponent="com.arsdigita.cms.contenttypes.ui.authoring.FAQItemCreate">
description="An FAQ item type"
objectType="com.arsdigita.cms.contenttypes.FAQItem"
classname="com.arsdigita.cms.contenttypes.FAQItem">
<ctd:authoring-kit
<!--
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
-->
<!-- Overwrite the standard pageCreate class to customize and include
additional content type specific widgets. -->
createComponent="com.arsdigita.cms.contenttypes.ui.authoring.FAQItemCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"

View File

@ -20,6 +20,7 @@ package com.arsdigita.cms;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.persistence.CompoundFilter;
import com.arsdigita.persistence.DataCollection;
@ -161,6 +162,12 @@ public class ContentType extends ACSObject {
public String getLabel() {
return (String) get(LABEL);
}
public GlobalizedMessage getTypeLabel() {
GlobalizedMessage label = null;
return label;
}
/**
* Sets the label for this content type.

View File

@ -45,8 +45,9 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger;
/**
* A pane that contains a folder tree on the left and a folder
* manipulator on the right.
* A pane that contains a folder tree on the left and a folder manipulator on
* the right. It is a part of the content section main page and is displayed
* as the "Browse" tab.
*
* @author David LutterKort &lt;dlutter@redhat.com&gt;
* @version $Id: BrowsePane.java 1325 2006-09-22 08:11:33Z sskracic $
@ -62,6 +63,8 @@ public class BrowsePane extends LayoutPanel implements Resettable {
private final FlatItemList m_fil;
public BrowsePane() {
/* The folder tree displayed on the left side / left column */
m_tree = new BaseTree(new FolderTreeModelBuilder());
m_model = m_tree.getSelectionModel();
m_folderModel = new FolderSelectionModel(m_model);
@ -70,9 +73,8 @@ public class BrowsePane extends LayoutPanel implements Resettable {
final SegmentedPanel left = new SegmentedPanel();
setLeft(left);
final Label heading = new Label
(GlobalizationUtil.globalize("cms.ui.folder_browser"));
final Label heading = new Label(GlobalizationUtil
.globalize("cms.ui.folder_browser"));
left.addSegment(heading, m_tree);
m_fil = new FlatItemList(m_folder, m_folderModel);
@ -103,7 +105,14 @@ public class BrowsePane extends LayoutPanel implements Resettable {
// Private classes and methods
/**
*
*/
private final class ProcessListener implements FormProcessListener {
/**
*
* @param e
*/
public final void process(final FormSectionEvent e) {
final PageState state = e.getPageState();

View File

@ -36,6 +36,16 @@ import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
import com.arsdigita.ui.DebugPanel;
// ////////////////////////////////////////////////////////////////////////////
//
// Developer's Note:
// Replaced by cms.ui.contectcenter.MainPage.
// Note should be removed as soon as the migration process is competed (in-
// cluding content section pages).
//
// ////////////////////////////////////////////////////////////////////////////
/**
* <p>The Content Center main page (index page). </p>
*

View File

@ -55,6 +55,11 @@ import org.apache.log4j.Logger;
/**
* Contains the entire admin UI for a content section.
*
* Developers Note:
* It is based on the dispatcher model is is going to be replaced by the newer
* servlet based model. @see c.ad.cms.ui.contentsection.MainPage (currently
* not active).
*
* @author Jack Chung
* @author Michael Pih
@ -127,17 +132,11 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
private LayoutPanel m_csePane;
private ReportPane m_reportPane;
private static class TitlePrinter implements PrintListener {
@Override
public void prepare(PrintEvent e) {
final Label l = (Label) e.getTarget();
l.setLabel(CMS.getContext().getContentSection().getName());
}
}
/**
* Creates the content section index page containing
* - a Navigaton bar for the various tasks (items, search, images, ....)
* - a breadcrumb
* - ....
* Contains the UI for administering a content section.
*/
public ContentSectionPage() {
@ -158,6 +157,8 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
m_lifecyclePane = getLifecycleAdminPane();
m_categoryPane = getCategoryAdminPane();
m_typePane = getContentTypeAdminPane();
// userAdminPane removed, used to contain just one item (reset user
// folder) which moved to the FolderAdminPane
//m_userAdminPane = getUserAdminPane();
m_csePane = getCSEPane();
m_reportPane = getReportPane();
@ -213,6 +214,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
/**
* Creates, and then caches, the browse pane. Overriding this method to
* return null will prevent this tab from appearing.
* @return
*/
protected BrowsePane getBrowsePane() {
if (m_browsePane == null) {
@ -426,6 +428,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
*
* @param item The item from which we get the corresponding content section
* @param tab The index of the tab to display
* @return
*/
public static String getSectionURL(ContentItem item, int tab) {
// Get the content section associated with the content item.
@ -462,4 +465,22 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
final Object[] args) {
return new GlobalizedMessage(key, RESOURCE_BUNDLE, args);
}
/**
* Helper class to be able to use a PrintListener to set the titel of the
* page.
*/
private static class TitlePrinter implements PrintListener {
/**
*
* @param e
*/
@Override
public void prepare(PrintEvent e) {
final Label l = (Label) e.getTarget();
l.setLabel(CMS.getContext().getContentSection().getName());
}
}
}

View File

@ -78,8 +78,8 @@ import java.util.List;
import java.util.Map;
/**
* Encapsulates a {@link FolderManipulator} in order to create a flat
* item listing. Also contains a new item form.
* Encapsulates a {@link FolderManipulator} in order to create a flat item
* listing. Also contains a new item form.
*
* @author <a href="mailto:sfreidin@arsdigita.com">Stanislav Freidin</a>
* @version $Id: FlatItemList.java 1538 2007-03-23 16:26:36Z apevec $
@ -229,10 +229,12 @@ public class FlatItemList extends SegmentedPanel
m_removeHomeFolderAction.addActionListener(this);
browseActions.addAction(m_removeHomeFolderAction);
/* */
m_newItem = new SectionNewItemForm("newItem");
m_newItem.addProcessListener(this);
browseActions.addAction(m_newItem);
/* permission */
m_permissionsSeg = addSegment();
m_permissionsSeg.setIdAttr("folder-permissions");
@ -408,10 +410,10 @@ public class FlatItemList extends SegmentedPanel
if (e.getSource() == m_folderCreator
&& m_folderCreator.isCancelled(s)) {
browseMode(s);
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
throw new FormProcessException(GlobalizationUtil.globalize("cms.ui.cancelled"));
} else if (e.getSource() == m_folderEditor && m_folderEditor.isCancelled(s)) {
browseMode(s);
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.cancelled").localize());
throw new FormProcessException(GlobalizationUtil.globalize("cms.ui.cancelled"));
} else if (e.getSource() == m_folderManip.getTargetSelector()) {
// This only works if this submission listener is run
// after the target selector's one

View File

@ -46,6 +46,8 @@ import com.arsdigita.xml.Element;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
/**
* A form which displays a select box of all content types available under the
* given content section, and forwards to the item creation UI when the user
@ -57,26 +59,35 @@ import java.math.BigDecimal;
*/
public abstract class NewItemForm extends Form {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
* and set com.arsdigita.cms.ui.authoring.NewItemForm=DEBUG by uncommenting
* or adding the line. */
private static final Logger s_log = Logger.getLogger(NewItemForm.class);
public static String DP_TYPE_PREFIX = "com.arsdigita.dp.";
private SingleSelect m_typeWidget;
private Submit m_submit;
private Label m_emptyLabel;
private Label m_createLabel;
private final SingleSelect m_typeWidget;
private final Submit m_submit;
private final Label m_emptyLabel;
private final Label m_createLabel;
public static final String TYPE_ID = "tid";
/**
* Construct a new NewItemForm
* Construct a new NewItemForm. It sets a vertical BoxPanel as the component
* container.
*
* @param name the name attribute of the form.
*/
public NewItemForm(String name) {
//super(name, new BoxPanel(BoxPanel.HORIZONTAL));
super(name, new BoxPanel(BoxPanel.VERTICAL));
setIdAttr("new_item_form");
BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);//(BoxPanel) getPanel();
BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
panel.setWidth("2%");
panel.setBorder(0);
// create and add an "empty" component
m_emptyLabel = new Label(GlobalizationUtil
.globalize("cms.ui.authoring.no_types_registered"),
false);
@ -99,6 +110,7 @@ public abstract class NewItemForm extends Form {
OptionGroup o = (OptionGroup) e.getTarget();
PageState state = e.getPageState();
// gather the content types of this section into a list
ContentSection section = getContentSection(state);
ContentType parentType = null;
ContentTypeCollection typesCollection = null;
@ -128,21 +140,31 @@ public abstract class NewItemForm extends Form {
while (typesCollection.next()) {
boolean list = true;
ContentType type = typesCollection.getContentType();
if (PermissionService.getDirectGrantedPermissions(type.getOID()).size() > 0) {
// chris gilbert - allow restriction of some types to certain
// users/groups. No interface to do this, but group could be
// created and permission granted in a content type loader
if (PermissionService
.getDirectGrantedPermissions(type.getOID())
.size() > 0) {
// chris gilbert - allow restriction of some types
// to certain users/groups. No interface to do
// this, but group could be created and permission
// granted in a content type loader
//
// can't permission filter the collection because most types
// will have no permissions granted. This approach involves
// a small overhead getting the count of granted permissions for
// each type (mitigated by only checking DIRECT permissions)
// can't permission filter the collection because
// most types will have no permissions granted.
// This approach involves a small overhead getting
// the count of granted permissions for each type
// (mitigated by only checking DIRECT permissions)
Party party = Kernel.getContext().getParty();
if (party == null) {
party = Kernel.getPublicUser();
}
PermissionDescriptor create = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_NEW_ITEM), type, party);
PermissionDescriptor create =
new PermissionDescriptor(
PrivilegeDescriptor
.get(SecurityManager
.CMS_NEW_ITEM),
type,
party);
list = PermissionService.checkPermission(create);
}
@ -165,7 +187,7 @@ public abstract class NewItemForm extends Form {
}
});
} catch (java.util.TooManyListenersException e) {
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e);
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e);
}
panel.add(m_typeWidget);

View File

@ -35,6 +35,16 @@ import com.arsdigita.ui.DebugPanel;
import org.apache.log4j.Logger;
// ////////////////////////////////////////////////////////////////////////////
//
// Developer's Note:
// Replaces the (old) Dispatcher based Code cms.ui.CMSPageWorkspacePage
// Note should be removed as soon as the migration process is competed (in-
// cluding content section pages).
//
// ////////////////////////////////////////////////////////////////////////////
/**
* <p>The Content Center main page. </p>
*

View File

@ -60,6 +60,7 @@ import org.apache.log4j.Logger;
//
// Migration of the Content Section main page from old style dispatcher based
// UI to new style, legacy free UI based on servlet.
// Currently not yet in use!
// ////////////////////////////////////////////////////////////////////////////

View File

@ -36,10 +36,9 @@ import java.util.Iterator;
import org.apache.log4j.Logger;
/**
* Represents the visual structure of an HTML form. Forms
* can be constructed with a Container argument to specify the type
* of layout this form will adhere to. The default is a column panel.
*
* Represents the visual structure of an HTML form. Forms can be constructed
* with a Container argument to specify the type of layout this form will
* adhere to. The default is a column panel.
*
* <p> As an example, a form that accepts a first and last name may be set
* up as follows:
@ -78,9 +77,9 @@ import org.apache.log4j.Logger;
* }
* </pre>
*
* <p> This form automatically checks that the user supplied a last
* name. Only then does it call the <code>process</code> method, which
* prints the user-supplied values.
* <p> This form automatically checks that the user supplied a last name. Only
* then does it call the <code>process</code> method, which prints the
* user-supplied values.
*
* @author Karl Goldstein
* @author Uday Mathur
@ -93,6 +92,10 @@ import org.apache.log4j.Logger;
public class Form extends FormSection implements BebopConstants {
/** Internal logger instance to faciliate debugging. Enable logging output
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
* and set com.arsdigita.bebop.Form=DEBUG by uncommenting
* or adding the line. */
private static final Logger s_log = Logger.getLogger(Form.class);
/**
@ -130,15 +133,6 @@ public class Form extends FormSection implements BebopConstants {
*/
private RequestLocal m_formData;
/**
* Constructs a new form with the specified name.
* At the time of creation, instantiates a new
* form model for the form and instantiates a ColumnPanel as the default to
* contain the components.
*
* @param name the name of the form
*/
/**
* Determines whether or not a form is 'redirecting', meaning that
* it will clear the control event and redirect to the resulting
@ -147,18 +141,25 @@ public class Form extends FormSection implements BebopConstants {
*/
private boolean m_isRedirecting = false;
/**
* Constructs a new form with the specified name.
* At the time of creation, instantiates a new form model for the form and
* instantiates a default ColumnPanel to contain the components.
*
* @param name the name of the form
*/
public Form(String name) {
this(name, new GridPanel(2));
}
/**
* Constructs a new form with the specified name and container. At the time of
* at the time of creation, instantiates a new form model for the form
* and replaces the default ColumnPanel with
* the specified container as the implicit container of the components.
*
* @param name the name of the form
* Constructs a new form with the specified name and container. At the time
* of creation, instantiates a new form model for the form and replaces
* the default ColumnPanel with the specified container as the implicit
* container of the components.
*
* @param name the name attribute of the form
* @param panel the implicit container that will hold the components
*/
public Form(String name, Container panel) {
@ -189,6 +190,7 @@ public class Form extends FormSection implements BebopConstants {
* representation
* @see PageState#generateXML
*/
@Override
public void generateXML(PageState s, Element parent) {
if ( isVisible(s) ) {
Element form = generateXMLSansState(s, parent);
@ -204,6 +206,7 @@ public class Form extends FormSection implements BebopConstants {
* state information from <code>s</code>.
*
* @param s represents the curent request
* @param parent
* @return the top-level element for the form
*/
protected Element generateXMLSansState(PageState s, Element parent) {