Weitere Einstellung "Sichtbar" für Kategorien (Ticket #1634). Dafür wird eine weitere Spalte in cat_categories benötigt. Upgrade-Skript enthalten.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2172 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
7125d102df
commit
4edddb7faa
|
|
@ -1120,3 +1120,5 @@ cms.ui.contentcenter.action=Action
|
|||
cms.ui.set_home_folder=Set as home folder
|
||||
cms.ui.go_to_home_folder=Go to home folder
|
||||
cms.ui.no_home_folder_selected=No home folder selected
|
||||
cms.ui.cateogry.is_visible=Visible?
|
||||
cms.ui.category.is_visible=Visible?
|
||||
|
|
|
|||
|
|
@ -1112,3 +1112,5 @@ cms.ui.contentcenter.action=Aktion
|
|||
cms.ui.set_home_folder=Als Start-Ordner festlegen
|
||||
cms.ui.go_to_home_folder=Zum Start-Ordner
|
||||
cms.ui.no_home_folder_selected=Kein Start-Ordner festgelegt
|
||||
cms.ui.cateogry.is_visible=Sichtbar?
|
||||
cms.ui.category.is_visible=Sichtbar?
|
||||
|
|
|
|||
|
|
@ -59,3 +59,5 @@ cms.ui.set_home_folder=Set as home folder
|
|||
cms.ui.go_to_home_folder=Go to home folder
|
||||
cms.ui.no_home_folder_selected=No home folder selected
|
||||
cms.ui.contentcenter.action=Action
|
||||
cms.ui.cateogry.is_visible=
|
||||
cms.ui.category.is_visible=
|
||||
|
|
|
|||
|
|
@ -590,3 +590,5 @@ cms.ui.contentcenter.action=
|
|||
cms.ui.set_home_folder=Set as home folder
|
||||
cms.ui.go_to_home_folder=
|
||||
cms.ui.no_home_folder_selected=No home folder selected
|
||||
cms.ui.cateogry.is_visible=
|
||||
cms.ui.category.is_visible=
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import com.arsdigita.xml.Element;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* A form which creates a new category. Extends the edit form for
|
||||
* convenience.
|
||||
|
|
@ -49,25 +48,23 @@ import org.apache.log4j.Logger;
|
|||
* @version $Id: BaseCategoryForm.java 1951 2009-06-30 04:35:04Z terry $
|
||||
*/
|
||||
class BaseCategoryForm extends BaseForm {
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(BaseCategoryForm.class);
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(BaseCategoryForm.class);
|
||||
final CategoryRequestLocal m_parent;
|
||||
final TextField m_name;
|
||||
final TextArea m_description;
|
||||
final TextField m_url;
|
||||
final RadioGroup m_isAbstract;
|
||||
final RadioGroup m_isVisible;
|
||||
final RadioGroup m_isEnabled;
|
||||
private Label m_script = new Label(
|
||||
"<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>",
|
||||
private Label m_script = new Label(
|
||||
"<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>",
|
||||
false);
|
||||
|
||||
|
||||
|
||||
private final static String NAME = "name";
|
||||
private final static String NAME = "name";
|
||||
private final static String DESCRIPTION = "description";
|
||||
private final static String URL = "url";
|
||||
private final static String URL = "url";
|
||||
private final static String IS_ABSTRACT = "isAbstract";
|
||||
private final static String IS_VISIBLE = "isVisible";
|
||||
private final static String IS_ENABLED = "isEnabled";
|
||||
|
||||
/**
|
||||
|
|
@ -86,27 +83,30 @@ class BaseCategoryForm extends BaseForm {
|
|||
m_name.setSize(30);
|
||||
m_name.setMaxLength(200);
|
||||
m_name.addValidationListener(new NotNullValidationListener());
|
||||
m_name.setOnFocus("if (this.form." + URL + ".value == '') { " +
|
||||
" defaulting = true; this.form." + URL +
|
||||
".value = urlize(this.value); }");
|
||||
m_name.setOnKeyUp("if (defaulting) { this.form." + URL +
|
||||
".value = urlize(this.value) }");
|
||||
m_name.setOnFocus("if (this.form." + URL + ".value == '') { " + " defaulting = true; this.form." + URL
|
||||
+ ".value = urlize(this.value); }");
|
||||
m_name.setOnKeyUp("if (defaulting) { this.form." + URL + ".value = urlize(this.value) }");
|
||||
|
||||
// is abstract?
|
||||
m_isAbstract = new RadioGroup(IS_ABSTRACT);
|
||||
m_isAbstract.addOption(new Option("no", new Label(gz("cms.ui.no"))));
|
||||
m_isAbstract.addOption(new Option("yes", new Label(gz("cms.ui.yes"))));
|
||||
addField(gz("cms.ui.category.is_not_abstract"),m_isAbstract);
|
||||
addField(gz("cms.ui.category.is_not_abstract"), m_isAbstract);
|
||||
|
||||
// is visible
|
||||
m_isVisible = new RadioGroup(IS_VISIBLE);
|
||||
m_isVisible.addOption(new Option("no", new Label(gz("cms.ui.no"))));
|
||||
m_isVisible.addOption(new Option("yes", new Label(gz("cms.ui.yes"))));
|
||||
addField(gz("cms.ui.category.is_visible"), m_isVisible);
|
||||
|
||||
// is enabled?
|
||||
m_isEnabled = new RadioGroup(IS_ENABLED);
|
||||
m_isEnabled.addOption(new Option("no", new Label(gz("cms.ui.no"))));
|
||||
m_isEnabled.addOption(new Option("yes", new Label(gz("cms.ui.yes"))));
|
||||
addField(gz("cms.ui.category.is_enabled"),m_isEnabled);
|
||||
addField(gz("cms.ui.category.is_enabled"), m_isEnabled);
|
||||
|
||||
|
||||
m_description = new TextArea
|
||||
(new TrimmedStringParameter(DESCRIPTION));
|
||||
m_description = new TextArea(new TrimmedStringParameter(DESCRIPTION));
|
||||
addField(gz("cms.ui.description"), m_description);
|
||||
|
||||
m_description.setWrap(TextArea.SOFT);
|
||||
|
|
@ -130,11 +130,9 @@ class BaseCategoryForm extends BaseForm {
|
|||
m_url.setMaxLength(200);
|
||||
m_url.addValidationListener(new NotNullValidationListener());
|
||||
m_url.setOnFocus("defaulting = false");
|
||||
m_url.setOnBlur("if (this.value == '') " +
|
||||
"{ defaulting = true; this.value = urlize(this.form." + NAME +
|
||||
".value) } " +
|
||||
"else { this.value = urlize(this.value); }");
|
||||
addField(gz("cms.ui.category.url"),m_url);
|
||||
m_url.setOnBlur("if (this.value == '') " + "{ defaulting = true; this.value = urlize(this.form." + NAME
|
||||
+ ".value) } " + "else { this.value = urlize(this.value); }");
|
||||
addField(gz("cms.ui.category.url"), m_url);
|
||||
|
||||
addAction(new Finish());
|
||||
addAction(new Cancel());
|
||||
|
|
@ -146,6 +144,7 @@ class BaseCategoryForm extends BaseForm {
|
|||
}
|
||||
|
||||
class NameUniqueListener implements ParameterListener {
|
||||
|
||||
private final CategoryRequestLocal m_category;
|
||||
private final Widget m_widget;
|
||||
private final int m_type;
|
||||
|
|
@ -153,8 +152,9 @@ class BaseCategoryForm extends BaseForm {
|
|||
public final static int URL_FIELD = 2;
|
||||
|
||||
NameUniqueListener(final CategoryRequestLocal category) {
|
||||
this(category,m_name,NAME_FIELD);
|
||||
this(category, m_name, NAME_FIELD);
|
||||
}
|
||||
|
||||
NameUniqueListener(final CategoryRequestLocal category,
|
||||
Widget widget, int type) {
|
||||
m_category = category;
|
||||
|
|
@ -174,14 +174,14 @@ class BaseCategoryForm extends BaseForm {
|
|||
while (children.next()) {
|
||||
final Category child = children.getCategory();
|
||||
String compField =
|
||||
(m_type == URL_FIELD) ? child.getURL() : child.getName();
|
||||
(m_type == URL_FIELD) ? child.getURL() : child.getName();
|
||||
if (compField.equalsIgnoreCase(title)
|
||||
&& (m_category == null
|
||||
|| !m_category.getCategory(state).equals(child))) {
|
||||
throw new FormProcessException
|
||||
(lz("cms.ui.category.name_not_unique"));
|
||||
&& (m_category == null
|
||||
|| !m_category.getCategory(state).equals(child))) {
|
||||
throw new FormProcessException(lz("cms.ui.category.name_not_unique"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
final class CategoryEditForm extends BaseCategoryForm {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(CategoryEditForm.class);
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(CategoryEditForm.class);
|
||||
private static final String NO = "no";
|
||||
private static final String YES = "yes";
|
||||
private final CategoryRequestLocal m_category;
|
||||
|
||||
public CategoryEditForm(final CategoryRequestLocal parent,
|
||||
|
|
@ -54,8 +54,10 @@ final class CategoryEditForm extends BaseCategoryForm {
|
|||
}
|
||||
|
||||
private class InitListener implements FormInitListener {
|
||||
|
||||
@Override
|
||||
public final void init(final FormSectionEvent e)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
final PageState state = e.getPageState();
|
||||
final Category category = m_category.getCategory(state);
|
||||
|
||||
|
|
@ -70,22 +72,32 @@ final class CategoryEditForm extends BaseCategoryForm {
|
|||
// items in this category. If the user says "yes" then the
|
||||
// category is not abstract
|
||||
if (category.isAbstract()) {
|
||||
m_isAbstract.setValue(state, "no");
|
||||
m_isAbstract.setValue(state, NO);
|
||||
} else {
|
||||
m_isAbstract.setValue(state, "yes");
|
||||
m_isAbstract.setValue(state, YES);
|
||||
}
|
||||
|
||||
if (category.isEnabled("")) {
|
||||
m_isEnabled.setValue(state, "yes");
|
||||
if (category.isVisible()) {
|
||||
m_isVisible.setValue(state, YES);
|
||||
} else {
|
||||
m_isEnabled.setValue(state, "no");
|
||||
m_isVisible.setValue(state, NO);
|
||||
}
|
||||
|
||||
|
||||
if (category.isEnabled("")) {
|
||||
m_isEnabled.setValue(state, YES);
|
||||
} else {
|
||||
m_isEnabled.setValue(state, NO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ProcessListener implements FormProcessListener {
|
||||
|
||||
@Override
|
||||
public final void process(final FormSectionEvent e)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
final PageState state = e.getPageState();
|
||||
final Category category = m_category.getCategory(state);
|
||||
|
||||
|
|
@ -93,20 +105,28 @@ final class CategoryEditForm extends BaseCategoryForm {
|
|||
category.setName((String) m_name.getValue(state));
|
||||
category.setDescription((String) m_description.getValue(state));
|
||||
category.setURL((String) m_url.getValue(state));
|
||||
String isAbstract = (String)m_isAbstract.getValue(state);
|
||||
|
||||
final String isAbstract = (String) m_isAbstract.getValue(state);
|
||||
// this seems anti-intuitive but the question is "can you place
|
||||
// items in this category. If the user says "yes" then the
|
||||
// category is not abstract
|
||||
if ("yes".equals(isAbstract)) {
|
||||
if (YES.equals(isAbstract)) {
|
||||
category.setAbstract(false);
|
||||
} else if ("no".equals(isAbstract)) {
|
||||
} else if (NO.equals(isAbstract)) {
|
||||
category.setAbstract(true);
|
||||
}
|
||||
|
||||
String isEnabled = (String)m_isEnabled.getValue(state);
|
||||
if ("yes".equals(isEnabled)) {
|
||||
final String isVisible = (String) m_isVisible.getValue(state);
|
||||
if (YES.equals(isVisible)) {
|
||||
category.setVisible(true);
|
||||
} else {
|
||||
category.setVisible(false);
|
||||
}
|
||||
|
||||
final String isEnabled = (String) m_isEnabled.getValue(state);
|
||||
if (YES.equals(isEnabled)) {
|
||||
category.setEnabled(true);
|
||||
} else if ("no".equals(isEnabled)) {
|
||||
} else if (NO.equals(isEnabled)) {
|
||||
category.setEnabled(false);
|
||||
}
|
||||
|
||||
|
|
@ -115,5 +135,6 @@ final class CategoryEditForm extends BaseCategoryForm {
|
|||
throw new AccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ class CategoryItemPane extends BaseItemPane {
|
|||
private final SimpleContainer m_detailPane;
|
||||
|
||||
public CategoryItemPane(final SingleSelectionModel model,
|
||||
final CategoryRequestLocal category,
|
||||
final ActionLink addLink,
|
||||
final ActionLink editLink,
|
||||
final ActionLink deleteLink) {
|
||||
final CategoryRequestLocal category,
|
||||
final ActionLink addLink,
|
||||
final ActionLink editLink,
|
||||
final ActionLink deleteLink) {
|
||||
m_model = model;
|
||||
m_category = category;
|
||||
|
||||
|
|
@ -106,12 +106,14 @@ class CategoryItemPane extends BaseItemPane {
|
|||
if (!super.isVisible(state)) {
|
||||
return false;
|
||||
}
|
||||
CategorizedCollection items = m_category.getCategory(state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE);
|
||||
CategorizedCollection items = m_category.getCategory(state).
|
||||
getObjects(ContentItem.BASE_DATA_OBJECT_TYPE);
|
||||
items.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE);
|
||||
boolean canOrder = items.size() > 1;
|
||||
items.close();
|
||||
return canOrder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -133,7 +135,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
|
||||
// Summary
|
||||
m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink,
|
||||
viewIndexLink, editIndexLink, orderItemsLink));
|
||||
viewIndexLink, editIndexLink, orderItemsLink));
|
||||
|
||||
// Quasimodo: BEGIN
|
||||
// Localizations
|
||||
|
|
@ -145,20 +147,21 @@ class CategoryItemPane extends BaseItemPane {
|
|||
int countSupportedLanguages = (Kernel.getConfig()).getSupportedLanguagesTokenizer()
|
||||
.countTokens();
|
||||
long countLanguages =
|
||||
m_category.getCategory(state)
|
||||
m_category.getCategory(state)
|
||||
.getCategoryLocalizationCollection().size();
|
||||
|
||||
if (m_category.getCategory(state).canEdit()
|
||||
&& countLanguages < countSupportedLanguages) {
|
||||
&& countLanguages < countSupportedLanguages) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CategoryLocalizationAddForm addCategoryLocalizationForm =
|
||||
new CategoryLocalizationAddForm(m_category);
|
||||
new CategoryLocalizationAddForm(m_category);
|
||||
m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink));
|
||||
add(addCategoryLocalizationForm);
|
||||
connect(addCategoryLocalizationLink, addCategoryLocalizationForm);
|
||||
|
|
@ -203,6 +206,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
public boolean hasPermission(PageState ps) {
|
||||
return m_category.getCategory(ps).canEdit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AdminVisible extends VisibilityComponent {
|
||||
|
|
@ -215,14 +219,15 @@ class CategoryItemPane extends BaseItemPane {
|
|||
public boolean hasPermission(PageState ps) {
|
||||
return m_category.getCategory(ps).canAdmin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class SummarySection extends Section {
|
||||
|
||||
SummarySection(final ActionLink editLink,
|
||||
final ActionLink deleteLink,
|
||||
final ActionLink indexLink,
|
||||
final ActionLink orderItemsLink) {
|
||||
final ActionLink deleteLink,
|
||||
final ActionLink indexLink,
|
||||
final ActionLink orderItemsLink) {
|
||||
setHeading(new Label(gz("cms.ui.category.details")));
|
||||
|
||||
final ActionGroup group = new ActionGroup();
|
||||
|
|
@ -241,11 +246,11 @@ class CategoryItemPane extends BaseItemPane {
|
|||
* the user to view and edit the content index item.
|
||||
*/
|
||||
SummarySection(final ActionLink editLink,
|
||||
final ActionLink deleteLink,
|
||||
final ActionLink indexLink,
|
||||
final BaseLink viewIndexItem,
|
||||
final BaseLink editIndexItem,
|
||||
final ActionLink orderItemsLink) {
|
||||
final ActionLink deleteLink,
|
||||
final ActionLink indexLink,
|
||||
final BaseLink viewIndexItem,
|
||||
final BaseLink editIndexItem,
|
||||
final ActionLink orderItemsLink) {
|
||||
setHeading(new Label(gz("cms.ui.category.details")));
|
||||
|
||||
final ActionGroup group = new ActionGroup();
|
||||
|
|
@ -274,14 +279,14 @@ class CategoryItemPane extends BaseItemPane {
|
|||
if (item != null) {
|
||||
itemTitle = item.getDisplayName();
|
||||
} else if (!category.ignoreParentIndexItem()
|
||||
&& category.getParentCategoryCount() > 0) {
|
||||
&& category.getParentCategoryCount() > 0) {
|
||||
Category ancestor = findParentCategoryWithNonInheritedIndexItem(category);
|
||||
if (ancestor != null) {
|
||||
if (ancestor.getIndexObject() != null) {
|
||||
itemTitle = ancestor.getIndexObject().getDisplayName();
|
||||
}
|
||||
itemTitle += " (Inherited from "
|
||||
+ ancestor.getDisplayName() + ")";
|
||||
+ ancestor.getDisplayName() + ")";
|
||||
} else {
|
||||
// The complete hierarchy is set to inherit.
|
||||
// Just leave the itemTitle as None.
|
||||
|
|
@ -289,24 +294,29 @@ class CategoryItemPane extends BaseItemPane {
|
|||
}
|
||||
|
||||
props.add(new Property(gz("cms.ui.name"),
|
||||
category.getName("")));
|
||||
category.getName("")));
|
||||
props.add(new Property(gz("cms.ui.description"),
|
||||
category.getDescription("")));
|
||||
category.getDescription("")));
|
||||
props.add(new Property(gz("cms.ui.category.url"),
|
||||
category.getURL("")));
|
||||
category.getURL("")));
|
||||
props.add(new Property(gz("cms.ui.category.is_not_abstract"),
|
||||
category.isAbstract()
|
||||
? gz("cms.ui.no")
|
||||
: gz("cms.ui.yes")));
|
||||
category.isAbstract()
|
||||
? gz("cms.ui.no")
|
||||
: gz("cms.ui.yes")));
|
||||
props.add(new Property(gz("cms.ui.cateogry.is_visible"),
|
||||
category.isVisible()
|
||||
? gz("cms.ui.yes")
|
||||
: gz("cms.ui.no")));
|
||||
props.add(new Property(gz("cms.ui.category.is_enabled"),
|
||||
category.isEnabled("")
|
||||
? gz("cms.ui.yes")
|
||||
: gz("cms.ui.no")));
|
||||
category.isEnabled("")
|
||||
? gz("cms.ui.yes")
|
||||
: gz("cms.ui.no")));
|
||||
props.add(new Property(gz("cms.ui.category.index_item"),
|
||||
itemTitle));
|
||||
itemTitle));
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,6 +372,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
super.register(page);
|
||||
page.addComponentStateParam(m_editCategoryLocalizationForm, m_catLocaleParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class SubcategorySection extends Section {
|
||||
|
|
@ -375,6 +386,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
group.setSubject(new SubcategoryList(m_category, m_model));
|
||||
group.addAction(new AdminVisible(addLink), ActionGroup.ADD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class LinkedCategorySection extends Section {
|
||||
|
|
@ -393,6 +405,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
public final boolean isVisible(final PageState state) {
|
||||
return !m_category.getCategory(state).isRoot();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CategoryTemplateSection extends Section {
|
||||
|
|
@ -407,6 +420,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
// XXX secvis
|
||||
//group.addAction(link);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PermissionsSection extends Section {
|
||||
|
|
@ -436,7 +450,8 @@ class CategoryItemPane extends BaseItemPane {
|
|||
privMap.put(Category.MAP_DESCRIPTOR.getName(), "Categorize Items");
|
||||
privMap.put("admin", "Admin");
|
||||
|
||||
final CMSPermissionsPane permPane = new CMSPermissionsPane(privs, privMap, new ACSObjectSelectionModel(m_model)) {
|
||||
final CMSPermissionsPane permPane = new CMSPermissionsPane(privs, privMap, new ACSObjectSelectionModel(
|
||||
m_model)) {
|
||||
@Override
|
||||
public void showAdmin(PageState ps) {
|
||||
Assert.exists(m_model.getSelectedKey(ps));
|
||||
|
|
@ -444,6 +459,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
super.showAdmin(ps);
|
||||
getAdminListingPanel().setVisible(ps, false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
final ActionLink restoreDefault = new ActionLink(new Label(gz(
|
||||
|
|
@ -453,6 +469,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
Category cat = m_category.getCategory(ps);
|
||||
return PermissionService.getContext(cat) == null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
final ActionLink useCustom = new ActionLink(new Label(gz(
|
||||
|
|
@ -462,6 +479,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
Category cat = m_category.getCategory(ps);
|
||||
return PermissionService.getContext(cat) != null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ActionListener al = new ActionListener() {
|
||||
|
|
@ -489,7 +507,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
// revoke all direct permissions so category will only
|
||||
// have inherited permissions
|
||||
ObjectPermissionCollection perms =
|
||||
PermissionService.getDirectGrantedPermissions(
|
||||
PermissionService.getDirectGrantedPermissions(
|
||||
cat.getOID());
|
||||
while (perms.next()) {
|
||||
PermissionService.revokePermission(
|
||||
|
|
@ -500,6 +518,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
}
|
||||
permPane.reset(state);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
restoreDefault.addActionListener(al);
|
||||
|
|
@ -516,8 +535,10 @@ class CategoryItemPane extends BaseItemPane {
|
|||
public void stateChanged(ChangeEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class OrderItemsForm extends CMSForm {
|
||||
|
|
@ -532,6 +553,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
add(new Submit("Done"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -549,7 +571,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
protected String prepareURL(final PageState state, String location) {
|
||||
|
||||
ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state)
|
||||
.getDirectIndexObject()))
|
||||
.getDirectIndexObject()))
|
||||
.getPrimaryInstance();
|
||||
if (indexItem == null) {
|
||||
return "";
|
||||
|
|
@ -571,6 +593,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private class EditItemLink extends Link {
|
||||
|
|
@ -588,7 +611,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
protected String prepareURL(final PageState state, String location) {
|
||||
boolean canEdit = false;
|
||||
ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state)
|
||||
.getDirectIndexObject()))
|
||||
.getDirectIndexObject()))
|
||||
.getPrimaryInstance();
|
||||
if (indexItem == null) {
|
||||
return "";
|
||||
|
|
@ -598,7 +621,7 @@ class CategoryItemPane extends BaseItemPane {
|
|||
} else {
|
||||
BigDecimal draftID = indexItem.getDraftVersion().getID();
|
||||
return "item.jsp?item_id=" + draftID + "&set_tab="
|
||||
+ ContentItemPage.AUTHORING_TAB;
|
||||
+ ContentItemPage.AUTHORING_TAB;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -636,17 +659,18 @@ class CategoryItemPane extends BaseItemPane {
|
|||
BigDecimal id = item.getID();
|
||||
User user = Web.getContext().getUser();
|
||||
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
|
||||
Integer.parseInt(id.toString())));
|
||||
Integer.parseInt(id.toString())));
|
||||
Iterator permissions = PermissionService.getImpliedPrivileges(
|
||||
ci.getOID(), user.getOID());
|
||||
while (permissions.hasNext()) {
|
||||
PrivilegeDescriptor permission = (PrivilegeDescriptor) permissions.next();
|
||||
if (permission.equals(PrivilegeDescriptor.ADMIN)
|
||||
|| permission.equals(PrivilegeDescriptor.EDIT)) {
|
||||
|| permission.equals(PrivilegeDescriptor.EDIT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ object type Category extends ACSObject {
|
|||
String[1..1] name = cat_categories.name VARCHAR(200);
|
||||
String[0..1] url = cat_categories.url VARCHAR(200);
|
||||
Boolean[1..1] isEnabled = cat_categories.enabled_p CHAR(1);
|
||||
|
||||
Boolean[1..1] isVisible = cat_categories.visible_p CHAR(1);
|
||||
Boolean[1..1] isAbstract = cat_categories.abstract_p CHAR(1);
|
||||
String[1..1] defaultAncestors = cat_categories.default_ancestors VARCHAR(3209);
|
||||
Boolean[1..1] ignoreParentIndexItem = cat_categories.ignore_parent_index_p CHAR(1);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
--
|
||||
-- Copyright (C) 2013 Jens Pelzetter. All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
-- as published by the Free Software Foundation; either version 2.1 of
|
||||
-- the License, or (at your option) any later version.
|
||||
--
|
||||
-- This library is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-- Lesser General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this library; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- $Id$
|
||||
|
||||
ALTER TABLE cat_categories ADD COLUMN visible_p CHAR(1);
|
||||
UPDATE cat_categories SET visible_p = 1;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
--
|
||||
-- Copyright (C) 2013 Peter Boy. All Rights Reserved.
|
||||
-- Copyright (C) 2013 Jens Pelzetter. All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@
|
|||
begin;
|
||||
|
||||
\i default/6.6.5-6.6.6/set_singleton.sql
|
||||
|
||||
\i default/6.6.5-6.6.6/add_cat_visible.sql
|
||||
|
||||
commit;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ public class Category extends ACSObject {
|
|||
* An attribute name for the underlying data object.
|
||||
*/
|
||||
public static final String IS_ENABLED = "isEnabled";
|
||||
public static final String IS_VISIBLE = "isVisible";
|
||||
/**
|
||||
* An attribute name for the underlying data object.
|
||||
*/
|
||||
|
|
@ -213,6 +214,7 @@ public class Category extends ACSObject {
|
|||
/**
|
||||
* Returns the model name of {@link #BASE_DATA_OBJECT_TYPE}.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getBaseDataObjectPackage() {
|
||||
return BASE_DATA_OBJECT_PACKAGE;
|
||||
|
|
@ -290,6 +292,8 @@ public class Category extends ACSObject {
|
|||
* storage mechanism. This method is just a wrapper for the {@link
|
||||
* #Category(OID)} constructor.
|
||||
*
|
||||
* @param id
|
||||
*
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Category(BigDecimal id) {
|
||||
|
|
@ -389,6 +393,7 @@ public class Category extends ACSObject {
|
|||
setName("name me");
|
||||
}
|
||||
setEnabled(true);
|
||||
setVisible(true);
|
||||
setAbstract(false);
|
||||
//by default do not ignore the parent index item
|
||||
setIgnoreParentIndexItem(false);
|
||||
|
|
@ -807,6 +812,14 @@ public class Category extends ACSObject {
|
|||
set(IS_ENABLED, isEnabled);
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return ((Boolean) get(IS_VISIBLE)).booleanValue();
|
||||
}
|
||||
|
||||
public void setVisible(final boolean visible) {
|
||||
set(IS_VISIBLE, visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* An abstract category cannot have any child objects, but it can have child
|
||||
* categories.
|
||||
|
|
|
|||
Loading…
Reference in New Issue