Integrated r1948,r1949,r1950,r1951 (ccm-cms)
- Display of information about index items is now more informative and accurate - Upload option can now be turned off for text assets using com.arsdigita.cms.hide_text_asset_upload_file configuration property - Can hide the action for creating a content item from the content sections list - Users were adding brackets () to the Name field of a content item in basic properties resulting in "page not found" error when you try to open the published item git-svn-id: https://svn.libreccm.org/ccm/trunk@254 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d79d3985f1
commit
dec240bf3b
|
|
@ -151,6 +151,8 @@ public final class ContentSectionConfig extends AbstractConfig {
|
|||
private final Parameter m_deleteWorkflowNotificationsWhenSent;
|
||||
private final Parameter m_hasContactsAuthoringStep;
|
||||
private final Parameter m_categoryTreeOrdering;
|
||||
private final Parameter m_hideTextAssetUploadFile;
|
||||
private final Parameter m_allowContentCreateInSectionListing;
|
||||
|
||||
/**
|
||||
* Do not instantiate this class directly.
|
||||
|
|
@ -397,6 +399,15 @@ public final class ContentSectionConfig extends AbstractConfig {
|
|||
("com.arsdigita.cms.has_contacts_authoring_step",
|
||||
Parameter.REQUIRED, new Boolean(false));
|
||||
|
||||
m_hideTextAssetUploadFile = new BooleanParameter(
|
||||
"com.arsdigita.cms.hide_text_asset_upload_file",
|
||||
Parameter.REQUIRED,
|
||||
new Boolean(false));
|
||||
|
||||
m_allowContentCreateInSectionListing = new BooleanParameter(
|
||||
"com.arsdigita.cms.allow_content_create_in_section_listing",
|
||||
Parameter.REQUIRED,
|
||||
new Boolean(true));
|
||||
|
||||
register(m_templateRootPath);
|
||||
register(m_defaultItemTemplatePath);
|
||||
|
|
@ -445,6 +456,8 @@ public final class ContentSectionConfig extends AbstractConfig {
|
|||
register(m_deleteWorkflowNotificationsWhenSent);
|
||||
register(m_categoryTreeOrdering);
|
||||
register(m_hasContactsAuthoringStep);
|
||||
register(m_hideTextAssetUploadFile);
|
||||
register(m_allowContentCreateInSectionListing);
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
|
|
@ -806,5 +819,12 @@ public final class ContentSectionConfig extends AbstractConfig {
|
|||
public boolean getHasContactsAuthoringStep() {
|
||||
return ((Boolean) get(m_hasContactsAuthoringStep)).booleanValue();
|
||||
}
|
||||
|
||||
|
||||
public final boolean getHideTextAssetUploadFile() {
|
||||
return ((Boolean) get(m_hideTextAssetUploadFile)).booleanValue();
|
||||
}
|
||||
|
||||
public final boolean getAllowContentCreateInSectionListing() {
|
||||
return ((Boolean) get(m_allowContentCreateInSectionListing)).booleanValue();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,3 +232,13 @@ com.arsdigita.cms.has_contacts_authoring_step.title=Contacts for content items
|
|||
com.arsdigita.cms.has_contacts_authoring_step.purpose=Allows you to add a Contact authoring step to all items
|
||||
com.arsdigita.cms.has_contacts_authoring_step.example=false
|
||||
com.arsdigita.cms.has_contacts_authoring_step.format=[boolean]
|
||||
|
||||
com.arsdigita.cms.hide_text_asset_upload_file.title=Hide upload file link for text assets
|
||||
com.arsdigita.cms.hide_text_asset_upload_file.purpose=Hide the upload file link in the editing of a text asset
|
||||
com.arsdigita.cms.hide_text_asset_upload_file.example=false
|
||||
com.arsdigita.cms.hide_text_asset_upload_file.format=[boolean]
|
||||
|
||||
com.arsdigita.cms.allow_content_create_in_section_listing.title=Allow content creation in section listing
|
||||
com.arsdigita.cms.allow_content_create_in_section_listing.purpose=Allows you to turn off the ability to create content in the section listing
|
||||
com.arsdigita.cms.allow_content_create_in_section_listing.example=true
|
||||
com.arsdigita.cms.allow_content_create_in_section_listing.format=[boolean]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
package com.arsdigita.cms.ui;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
|
|
@ -55,8 +57,6 @@ import com.arsdigita.util.Assert;
|
|||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.web.Web;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Displays all the content sections in table, with links to the admin
|
||||
* and public pages. Also displays a form for each content section to
|
||||
|
|
@ -107,15 +107,15 @@ public class ContentSectionContainer extends CMSContainer {
|
|||
m_typeSel = typeSel;
|
||||
m_sectionSel = sectionSel;
|
||||
|
||||
m_formContainer = new FormContainer();
|
||||
add(m_formContainer);
|
||||
m_formContainer = new FormContainer();
|
||||
add(m_formContainer);
|
||||
m_table = new ContentSectionTable();
|
||||
add(m_table);
|
||||
}
|
||||
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
p.setVisibleDefault(m_formContainer, false);
|
||||
p.setVisibleDefault(m_formContainer, false);
|
||||
}
|
||||
|
||||
private class FormContainer extends CMSContainer {
|
||||
|
|
@ -208,7 +208,7 @@ public class ContentSectionContainer extends CMSContainer {
|
|||
* @pre ( state != null && id != null )
|
||||
**/
|
||||
public void setSectionId(PageState state, BigDecimal id) {
|
||||
Assert.assertNotNull(id);
|
||||
Assert.exists(id);
|
||||
m_sectionIDParamWidget.setValue(state, id);
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ public class ContentSectionContainer extends CMSContainer {
|
|||
**/
|
||||
public ContentSection getContentSection(PageState state) {
|
||||
BigDecimal id = getContentSectionID(state);
|
||||
Assert.assertNotNull(id);
|
||||
Assert.exists(id);
|
||||
ContentSection section;
|
||||
try {
|
||||
section = new ContentSection(id);
|
||||
|
|
@ -435,7 +435,8 @@ public class ContentSectionContainer extends CMSContainer {
|
|||
// If the user has no access, return an empty Label
|
||||
SecurityManager sm = new SecurityManager(section);
|
||||
|
||||
if (! sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder)) {
|
||||
if (! sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder)
|
||||
|| !ContentSection.getConfig().getAllowContentCreateInSectionListing()) {
|
||||
return new Label(" ", false);
|
||||
} else {
|
||||
// set the value of the sectionIdParameter in the form
|
||||
|
|
|
|||
|
|
@ -168,7 +168,8 @@ public abstract class BasicItemForm extends FormSection
|
|||
nameWidget.setOnBlur(
|
||||
"if (this.value == '') " +
|
||||
"{ defaulting = true; this.value = urlize(this.form." + TITLE +
|
||||
".value) }"
|
||||
".value) } " +
|
||||
" else { this.value = urlize(this.value); }"
|
||||
);
|
||||
add(nameWidget);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.Asset;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentSectionConfig;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||
|
|
@ -101,6 +102,11 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
|
|||
private StringParameter m_streamlinedCreationParam;
|
||||
private static final String STREAMLINED = "_streamlined";
|
||||
private static final String STREAMLINED_DONE = "1";
|
||||
|
||||
private static final ContentSectionConfig s_config = new ContentSectionConfig();
|
||||
static {
|
||||
s_config.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new TextPageBody component
|
||||
|
|
@ -128,10 +134,12 @@ public abstract class TextAssetBody extends SecurityPropertyEditor
|
|||
new StringParameter(parent == null ? "item" :
|
||||
parent.getContentType().getAssociatedObjectType() + "_body_done");
|
||||
|
||||
PageFileForm f = getPageFileForm();
|
||||
addFileWidgets(f);
|
||||
add(FILE_UPLOAD, "Upload a file", f,
|
||||
f.getSaveCancelSection().getCancelButton());
|
||||
if (!s_config.getHideTextAssetUploadFile()) {
|
||||
PageFileForm f = getPageFileForm();
|
||||
addFileWidgets(f);
|
||||
add(FILE_UPLOAD, "Upload a file", f,
|
||||
f.getSaveCancelSection().getCancelButton());
|
||||
}
|
||||
|
||||
PageTextForm t = new PageTextForm();
|
||||
addTextWidgets(t);
|
||||
|
|
|
|||
|
|
@ -78,8 +78,10 @@ public class TextPageBody extends TextAssetBody {
|
|||
|
||||
// Set the right component access on the forms
|
||||
Component f = getComponent(FILE_UPLOAD);
|
||||
setComponentAccess(FILE_UPLOAD,
|
||||
new WorkflowLockedComponentAccess(f, itemModel));
|
||||
if (f != null) {
|
||||
setComponentAccess(FILE_UPLOAD,
|
||||
new WorkflowLockedComponentAccess(f, itemModel));
|
||||
}
|
||||
Component t = getComponent(TEXT_ENTRY);
|
||||
setComponentAccess(TEXT_ENTRY,
|
||||
new WorkflowLockedComponentAccess(t, itemModel));
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ class BaseCategoryForm extends BaseForm {
|
|||
m_url.setOnFocus("defaulting = false");
|
||||
m_url.setOnBlur("if (this.value == '') " +
|
||||
"{ defaulting = true; this.value = urlize(this.form." + NAME +
|
||||
".value) }");
|
||||
".value) } " +
|
||||
"else { this.value = urlize(this.value); }");
|
||||
addField(gz("cms.ui.category.url"),m_url);
|
||||
|
||||
addAction(new Finish());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.arsdigita.bebop.form.Submit;
|
|||
import com.arsdigita.categorization.CategorizationConfig;
|
||||
import com.arsdigita.categorization.CategorizedCollection;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.categorization.CategoryCollection;
|
||||
import com.arsdigita.categorization.CategoryNotFoundException;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
|
|
@ -55,7 +56,6 @@ import com.arsdigita.persistence.DataObject;
|
|||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.toolbox.ui.ActionGroup;
|
||||
import com.arsdigita.toolbox.ui.PropertyList;
|
||||
import com.arsdigita.toolbox.ui.PropertyList.Property;
|
||||
import com.arsdigita.toolbox.ui.Section;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.Web;
|
||||
|
|
@ -267,10 +267,23 @@ class CategoryItemPane extends BaseItemPane {
|
|||
final Category category = m_category.getCategory(state);
|
||||
final ACSObject item = category.getDirectIndexObject();
|
||||
|
||||
String itemTitle = "";
|
||||
String itemTitle = "None";
|
||||
|
||||
if (item != null) {
|
||||
itemTitle = item.getDisplayName();
|
||||
} else if (!category.ignoreParentIndexItem()
|
||||
&& category.getParentCategoryCount() > 0)
|
||||
{
|
||||
Category ancestor = findParentCategoryWithNonInheritedIndexItem(category);
|
||||
if (ancestor != null) {
|
||||
if (ancestor.getIndexObject() != null) {
|
||||
itemTitle = ancestor.getIndexObject().getDisplayName();
|
||||
}
|
||||
itemTitle += " (Inherited from "
|
||||
+ ancestor.getDisplayName() + ")";
|
||||
} else {
|
||||
// The complete hierarchy is set to inherit.
|
||||
// Just leave the itemTitle as None.
|
||||
}
|
||||
|
||||
props.add(new Property(gz("cms.ui.name"),
|
||||
|
|
@ -293,6 +306,27 @@ class CategoryItemPane extends BaseItemPane {
|
|||
return props;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over the parents and recurse up the hierarchy the find the first
|
||||
// parent with an explicit index item ignoreParentIndexItem is true.
|
||||
private Category findParentCategoryWithNonInheritedIndexItem(Category c) {
|
||||
if (c.getParentCategoryCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
CategoryCollection parents = c.getParents();
|
||||
while (parents.next()) {
|
||||
Category p = parents.getCategory();
|
||||
if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) {
|
||||
return p;
|
||||
}
|
||||
// Try the parents of this parent.
|
||||
Category gp = findParentCategoryWithNonInheritedIndexItem(p);
|
||||
if (gp != null) {
|
||||
return gp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Quasimodo: BEGIN
|
||||
|
|
|
|||
|
|
@ -147,7 +147,8 @@ public class CategoryLocalizationForm extends BaseForm {
|
|||
m_url.setOnFocus("defaulting = false");
|
||||
m_url.setOnBlur("if (this.value == '') " +
|
||||
"{ defaulting = true; this.value = urlize(this.form." + NAME +
|
||||
".value) }");
|
||||
".value) } " +
|
||||
"else { this.value = urlize(this.value); }");
|
||||
addField(gz("cms.ui.category.url"),m_url);
|
||||
|
||||
addAction(new Finish());
|
||||
|
|
|
|||
|
|
@ -88,57 +88,53 @@ public class IndexItemSelectionForm extends CMSForm {
|
|||
m_options = new RadioGroup(new StringParameter("items"));
|
||||
try {
|
||||
m_options.addPrintListener(new PrintListener() {
|
||||
public void prepare(PrintEvent event) {
|
||||
RadioGroup group = (RadioGroup)event.getTarget();
|
||||
PageState state = event.getPageState();
|
||||
Category category = getCategory(event.getPageState());
|
||||
CategorizedCollection children = category.getObjects
|
||||
(ContentItem.BASE_DATA_OBJECT_TYPE);
|
||||
public void prepare(PrintEvent event) {
|
||||
RadioGroup group = (RadioGroup)event.getTarget();
|
||||
PageState state = event.getPageState();
|
||||
Category category = getCategory(event.getPageState());
|
||||
CategorizedCollection children = category.getObjects
|
||||
(ContentItem.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
boolean valueSet = false;
|
||||
// option for NO index Object
|
||||
group.addOption(new Option(NONE_OPTION_VALUE,
|
||||
new Label(NONE_OPTION_VALUE)));
|
||||
|
||||
// option for NO index Object
|
||||
group.addOption(new Option(NONE_OPTION_VALUE,
|
||||
new Label(NONE_OPTION_VALUE)));
|
||||
|
||||
while (children.next()) {
|
||||
ACSObject item =
|
||||
(ACSObject) children.getDomainObject();
|
||||
|
||||
if ((item instanceof ContentItem) &&
|
||||
((ContentItem) item).getVersion().equals(ContentItem.DRAFT)) {
|
||||
|
||||
group.addOption
|
||||
(new Option(item.getID().toString(),
|
||||
((ContentItem)item).getName()));
|
||||
}
|
||||
}
|
||||
// get currently selected item
|
||||
ACSObject indexItem =
|
||||
category.getDirectIndexObject();
|
||||
if (indexItem != null && indexItem instanceof ContentItem) {
|
||||
group.setValue
|
||||
(state,
|
||||
((ContentItem)indexItem)
|
||||
.getWorkingVersion()
|
||||
.getID().toString());
|
||||
valueSet = true;
|
||||
}
|
||||
else{
|
||||
group.setValue(state, NONE_OPTION_VALUE);
|
||||
valueSet = true;
|
||||
}
|
||||
|
||||
if (category.getParentCategoryCount() > 0) {
|
||||
group.addOption
|
||||
(new Option(NULL_OPTION_VALUE, new Label
|
||||
("Inherit Index from Parent Categoy")));
|
||||
if (!valueSet) {
|
||||
group.setValue(state, NULL_OPTION_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// option for inheriting from the parent category
|
||||
if (category.getParentCategoryCount() > 0) {
|
||||
group.addOption
|
||||
(new Option(NULL_OPTION_VALUE,
|
||||
new Label("Inherit Index from Parent Category")));
|
||||
}
|
||||
|
||||
while (children.next()) {
|
||||
ACSObject item =
|
||||
(ACSObject) children.getDomainObject();
|
||||
|
||||
if ((item instanceof ContentItem) &&
|
||||
((ContentItem) item).getVersion().equals(ContentItem.DRAFT))
|
||||
{
|
||||
group.addOption
|
||||
(new Option(item.getID().toString(),
|
||||
((ContentItem)item).getName()));
|
||||
}
|
||||
}
|
||||
// get currently selected item
|
||||
ACSObject indexItem = category.getDirectIndexObject();
|
||||
if (indexItem != null && indexItem instanceof ContentItem) {
|
||||
group.setValue(state, ((ContentItem) indexItem)
|
||||
.getWorkingVersion()
|
||||
.getID().toString());
|
||||
} else {
|
||||
String value = NONE_OPTION_VALUE;
|
||||
if (!category.ignoreParentIndexItem()
|
||||
&& category.getParentCategoryCount() > 0)
|
||||
{
|
||||
value = NULL_OPTION_VALUE;
|
||||
}
|
||||
group.setValue(state, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (java.util.TooManyListenersException e) {
|
||||
s_log.error("Error adding init listener to Radio Group", e);
|
||||
throw new UncheckedWrapperException(e);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ abstract class FolderBaseForm extends CMSForm {
|
|||
"if (this.value == '') {" +
|
||||
" defaulting = true;" +
|
||||
" this.value = urlize(this.form." + TITLE + ".value)" +
|
||||
"} else {" +
|
||||
" this.value = urlize(this.value);" +
|
||||
"}";
|
||||
|
||||
private Label m_script = new Label("<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>", false);
|
||||
|
|
|
|||
|
|
@ -91,8 +91,10 @@ public class TemplateBody extends TextAssetBody {
|
|||
// Set the right component access on the forms -
|
||||
// FIXME: Update this for templating permissions !
|
||||
Component f = getComponent(FILE_UPLOAD);
|
||||
setComponentAccess(FILE_UPLOAD,
|
||||
new WorkflowLockedComponentAccess(f, itemModel));
|
||||
if (f != null) {
|
||||
setComponentAccess(FILE_UPLOAD,
|
||||
new WorkflowLockedComponentAccess(f, itemModel));
|
||||
}
|
||||
Component t = getComponent(TEXT_ENTRY);
|
||||
setComponentAccess(TEXT_ENTRY,
|
||||
new WorkflowLockedComponentAccess(t, itemModel));
|
||||
|
|
|
|||
Loading…
Reference in New Issue