incorporate several APLAWS patches for ccm-ldn-atoz:

r1741:	Changed AtoZ to not hide a category when an alias has been defined for it; 
	changed AtoZ to allow more than one alias to be defined for a category
r1742:	Added Category name in CategoryProviderAliasList.generateXML() 
r1743:	Fixed AtoZCategoryAlias.getCategory()
r1744:	Changed CategoryProviderAliasForm to use the Ajax category tree
r1747:	Relaxed version requirements for ccm-ldn-aplaws
r1750:	Added AtoZCategoryProvider.excludeBlackListTypes() 
1751:	Bumped version (release) number


git-svn-id: https://svn.libreccm.org/ccm/trunk@65 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2008-12-21 11:49:37 +00:00
parent 08ebde26fe
commit 712e43d266
10 changed files with 163 additions and 107 deletions

View File

@ -9,5 +9,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-terms"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-terms"/>
<classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-util"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-util"/>
<classpathentry combineaccessrules="false" kind="src" path="/ccm-cms-types-siteproxy"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-cms-types-siteproxy"/>
<classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-aplaws"/>
<classpathentry kind="output" path="build/Eclipse"/> <classpathentry kind="output" path="build/Eclipse"/>
</classpath> </classpath>

View File

@ -2,11 +2,12 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-ldn-atoz" name="ccm-ldn-atoz"
prettyName="A-Z" prettyName="A-Z"
version="6.5.0" version="6.6.0"
release="2"> release="4">
<ccm:dependencies> <ccm:dependencies>
<ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/>
<ccm:requires name="ccm-ldn-aplaws" version="6.4.0" relation="ge"/>
<ccm:requires name="ccm-ldn-util" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-util" version="6.2.0" relation="ge"/>
<ccm:requires name="ccm-ldn-terms" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-terms" version="6.2.0" relation="ge"/>
<ccm:requires name="ccm-ldn-navigation" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-navigation" version="6.2.0" relation="ge"/>

View File

@ -26,6 +26,18 @@ object type AtoZCategoryProvider extends AtoZProvider {
reference key (atoz_cat_provider.provider_id); reference key (atoz_cat_provider.provider_id);
} }
object type AtoZCategoryAlias {
BigDecimal[1..1] id = atoz_cat_aliases.object_id;
Category[1..1] category =
join atoz_cat_aliases.category_id to cat_categories.category_id;
String[1..1] letter = atoz_cat_aliases.letter CHAR(1);
String[1..1] title = atoz_cat_aliases.title VARCHAR(200);
object key (id);
}
association { association {
AtoZCategoryProvider[0..n] atozProvider1 = join cat_categories.category_id AtoZCategoryProvider[0..n] atozProvider1 = join cat_categories.category_id
to atoz_cat_blacklist_map.category_id, to atoz_cat_blacklist_map.category_id,
@ -38,16 +50,12 @@ association {
} }
association { association {
AtoZCategoryProvider[0..n] atozProvider2 = join cat_categories.category_id AtoZCategoryProvider[1..1] provider =
to atoz_cat_alias_map.category_id, join atoz_cat_aliases.provider_id
join atoz_cat_alias_map.provider_id
to atoz_cat_provider.provider_id; to atoz_cat_provider.provider_id;
Category[0..n] atozAliases = join atoz_cat_provider.provider_id component AtoZCategoryAlias[0..n] aliases =
to atoz_cat_alias_map.provider_id, join atoz_cat_provider.provider_id
join atoz_cat_alias_map.category_id to atoz_cat_aliases.provider_id;
to cat_categories.category_id;
String[1..1] letter = atoz_cat_alias_map.letter CHAR(1);
String[1..1] title = atoz_cat_alias_map.title VARCHAR(200);
} }
association { association {
@ -100,12 +108,6 @@ query getAtomicCategoryEntries {
where b.category_id = c.category_id where b.category_id = c.category_id
and b.provider_id = :providerID and b.provider_id = :providerID
) )
and not exists (
select 1
from atoz_cat_alias_map b
where b.category_id = c.category_id
and b.provider_id = :providerID
)
and not exists ( and not exists (
select 1 select 1
from atoz_cat_ct_blacklist_map b, cat_object_category_map m, from atoz_cat_ct_blacklist_map b, cat_object_category_map m,
@ -121,16 +123,16 @@ query getAtomicCategoryEntries {
union union
select c.category_id as id, select c.category_id as id,
a.object_type as object_type, a.object_type as object_type,
m.title as title, ca.title as title,
c.description as description, c.description as description,
lower(m.letter) as sort_key lower(ca.letter) as sort_key
from cat_categories c, from cat_categories c,
acs_objects a, acs_objects a,
atoz_cat_alias_map m atoz_cat_aliases ca
where c.category_id = m.category_id where c.category_id = ca.category_id
and c.category_id = a.object_id and c.category_id = a.object_id
and c.enabled_p = '1' and c.enabled_p = '1'
and m.provider_id = :providerID and ca.provider_id = :providerID
} map { } map {
id = id; id = id;
objectType = object_type; objectType = object_type;
@ -178,12 +180,6 @@ query getAtomicCategoryEntriesForRootCategory {
) )
and i2.subcategory_id = c.category_id and i2.subcategory_id = c.category_id
) )
and not exists (
select 1
from atoz_cat_alias_map b
where b.category_id = c.category_id
and b.provider_id = :providerID
)
and not exists ( and not exists (
select 1 select 1
from atoz_cat_ct_blacklist_map b, cat_object_category_map m, from atoz_cat_ct_blacklist_map b, cat_object_category_map m,
@ -199,16 +195,16 @@ query getAtomicCategoryEntriesForRootCategory {
union union
select c.category_id as id, select c.category_id as id,
a.object_type as object_type, a.object_type as object_type,
m.title as title, ca.title as title,
c.description as description, c.description as description,
lower(m.letter) as sort_key lower(ca.letter) as sort_key
from cat_categories c, from cat_categories c,
acs_objects a, acs_objects a,
atoz_cat_alias_map m atoz_cat_aliases ca
where c.category_id = m.category_id where c.category_id = ca.category_id
and c.category_id = a.object_id and c.category_id = a.object_id
and c.enabled_p = '1' and c.enabled_p = '1'
and m.provider_id = :providerID and ca.provider_id = :providerID
} map { } map {
id = id; id = id;
objectType = object_type; objectType = object_type;
@ -257,12 +253,6 @@ query getAtomicFilteredCategoryEntries {
where b.category_id = c.category_id where b.category_id = c.category_id
and b.provider_id = :providerID and b.provider_id = :providerID
) )
and not exists (
select 1
from atoz_cat_alias_map b
where b.category_id = c.category_id
and b.provider_id = :providerID
)
and not exists ( and not exists (
select 1 select 1
from atoz_cat_ct_blacklist_map b, cat_object_category_map m, from atoz_cat_ct_blacklist_map b, cat_object_category_map m,
@ -283,16 +273,16 @@ query getAtomicFilteredCategoryEntries {
union union
select c.category_id as id, select c.category_id as id,
a.object_type as object_type, a.object_type as object_type,
m.title as title, ca.title as title,
c.description as description, c.description as description,
lower(m.letter) as sort_key lower(ca.letter) as sort_key
from cat_categories c, from cat_categories c,
acs_objects a, acs_objects a,
atoz_cat_alias_map m atoz_cat_aliases ca
where c.category_id = m.category_id where c.category_id = ca.category_id
and c.category_id = a.object_id and c.category_id = a.object_id
and c.enabled_p = '1' and c.enabled_p = '1'
and m.provider_id = :providerID and ca.provider_id = :providerID
} map { } map {
id = id; id = id;
objectType = object_type; objectType = object_type;
@ -338,12 +328,6 @@ query getAtomicFilteredCategoryEntriesForRootCategory {
) )
and i2.subcategory_id = c.category_id and i2.subcategory_id = c.category_id
) )
and not exists (
select 1
from atoz_cat_alias_map b
where b.category_id = c.category_id
and b.provider_id = :providerID
)
and not exists ( and not exists (
select 1 select 1
from atoz_cat_ct_blacklist_map b, cat_object_category_map m, from atoz_cat_ct_blacklist_map b, cat_object_category_map m,
@ -364,16 +348,16 @@ query getAtomicFilteredCategoryEntriesForRootCategory {
union union
select c.category_id as id, select c.category_id as id,
a.object_type as object_type, a.object_type as object_type,
m.title as title, ca.title as title,
c.description as description, c.description as description,
lower(m.letter) as sort_key lower(ca.letter) as sort_key
from cat_categories c, from cat_categories c,
acs_objects a, acs_objects a,
atoz_cat_alias_map m atoz_cat_aliases ca
where c.category_id = m.category_id where c.category_id = ca.category_id
and c.category_id = a.object_id and c.category_id = a.object_id
and c.enabled_p = '1' and c.enabled_p = '1'
and m.provider_id = :providerID and ca.provider_id = :providerID
} map { } map {
id = id; id = id;
objectType = object_type; objectType = object_type;

View File

@ -105,6 +105,15 @@
<xrd:property name="/object/displayName"/> <xrd:property name="/object/displayName"/>
</xrd:attributes> </xrd:attributes>
</xrd:adapter> </xrd:adapter>
<xrd:adapter objectType="com.arsdigita.london.atoz.AtoZCategoryAlias">
<xrd:attributes rule="exclude">
<xrd:property name="/object/id"/>
<xrd:property name="/object/objectType"/>
<xrd:property name="/object/defaultDomainClass"/>
<xrd:property name="/object/displayName"/>
</xrd:attributes>
</xrd:adapter>
</xrd:context> </xrd:context>
<xrd:context name="com.arsdigita.london.atoz.ui.admin.ItemProviderAliasList"> <xrd:context name="com.arsdigita.london.atoz.ui.admin.ItemProviderAliasList">
@ -118,6 +127,7 @@
--> -->
</xrd:attributes> </xrd:attributes>
</xrd:adapter> </xrd:adapter>
<xrd:adapter objectType="com.arsdigita.london.atoz.AtoZItemAlias"> <xrd:adapter objectType="com.arsdigita.london.atoz.AtoZItemAlias">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<!-- <!--

View File

@ -8,4 +8,7 @@
<version from="6.3.0" to="6.3.1"> <version from="6.3.0" to="6.3.1">
<script sql="ccm-ldn-atoz/upgrade/::database::-6.3.0-6.3.1.sql"/> <script sql="ccm-ldn-atoz/upgrade/::database::-6.3.0-6.3.1.sql"/>
</version> </version>
<version from="6.5.0" to="6.6.0">
<script sql="ccm-ldn-atoz/upgrade/::database::-6.5.0-6.6.0.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -18,9 +18,12 @@
package com.arsdigita.london.atoz; package com.arsdigita.london.atoz;
import org.apache.log4j.Logger;
import com.arsdigita.categorization.Category; import com.arsdigita.categorization.Category;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainCollection;
import com.arsdigita.london.navigation.DataCollectionDefinition;
import com.arsdigita.london.subsite.Site; import com.arsdigita.london.subsite.Site;
import com.arsdigita.london.subsite.Subsite; import com.arsdigita.london.subsite.Subsite;
import com.arsdigita.london.subsite.SubsiteContext; import com.arsdigita.london.subsite.SubsiteContext;
@ -30,7 +33,6 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import org.apache.log4j.Logger;
public class AtoZCategoryProvider extends AtoZProvider { public class AtoZCategoryProvider extends AtoZProvider {
@ -46,7 +48,7 @@ public class AtoZCategoryProvider extends AtoZProvider {
public static final String CT_BLACK_LIST = "atozContentTypeBlackList"; public static final String CT_BLACK_LIST = "atozContentTypeBlackList";
public static final String ALIASES = "atozAliases"; public static final String ALIASES = "aliases";
public static final String CT_TYPE_ID = "type_id"; public static final String CT_TYPE_ID = "type_id";
@ -54,12 +56,12 @@ public class AtoZCategoryProvider extends AtoZProvider {
public static final String ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = "com.arsdigita.london.atoz.getAtomicCategoryEntriesForRootCategory"; public static final String ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = "com.arsdigita.london.atoz.getAtomicCategoryEntriesForRootCategory";
public static final String COMPOUND_ENTRIES = "com.arsdigita.london.atoz.getCompoundCategoryEntries";
public static final String FILTERED_ATOMIC_ENTRIES = "com.arsdigita.london.atoz.getAtomicFilteredCategoryEntries"; public static final String FILTERED_ATOMIC_ENTRIES = "com.arsdigita.london.atoz.getAtomicFilteredCategoryEntries";
public static final String FILTERED_ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = "com.arsdigita.london.atoz.getAtomicFilteredCategoryEntriesForRootCategory"; public static final String FILTERED_ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = "com.arsdigita.london.atoz.getAtomicFilteredCategoryEntriesForRootCategory";
public static final String ALL_BLACK_LIST_TYPES = "com.arsdigita.london.atoz.getAllBlackListTypes";
public AtoZCategoryProvider() { public AtoZCategoryProvider() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
} }
@ -103,13 +105,13 @@ public class AtoZCategoryProvider extends AtoZProvider {
} }
public void addAlias(Category cat, String letter, String title) { public void addAlias(Category cat, String letter, String title) {
DataObject link = add(ALIASES, cat); AtoZCategoryAlias alias = new AtoZCategoryAlias();
link.set("letter", letter); alias.setup(cat, letter, title);
link.set("title", title); add(ALIASES, alias);
} }
public void removeAlias(Category cat) { public void removeAlias(AtoZCategoryAlias alias) {
remove(ALIASES, cat); remove(ALIASES, alias);
} }
public void addBlock(Category cat) { public void addBlock(Category cat) {
@ -135,6 +137,18 @@ public class AtoZCategoryProvider extends AtoZProvider {
return new DomainCollection(entries); return new DomainCollection(entries);
} }
public static void excludeBlackListTypes(DataCollectionDefinition definition) {
DataQuery types =
SessionManager.getSession().retrieveQuery(ALL_BLACK_LIST_TYPES);
while (types.next()) {
String objectType = (String)types.get("objectType");
s_log.debug("Excluding object type from DataCollection: " + objectType);
definition.excludeSpecificObjectType(objectType);
}
types.close();
}
public DataQuery getAtomicEntries() { public DataQuery getAtomicEntries() {
DataQuery cats = null; DataQuery cats = null;
SubsiteContext subsiteContext = Subsite.getContext(); SubsiteContext subsiteContext = Subsite.getContext();

View File

@ -18,29 +18,30 @@
package com.arsdigita.london.atoz; package com.arsdigita.london.atoz;
import com.arsdigita.db.DbHelper;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.domain.xml.TraversalHandler;
import com.arsdigita.london.atoz.terms.DomainProvider; import com.arsdigita.london.atoz.terms.DomainProvider;
import com.arsdigita.london.atoz.ui.admin.CategoryProviderForm;
import com.arsdigita.london.atoz.ui.admin.CategoryProviderAdmin; import com.arsdigita.london.atoz.ui.admin.CategoryProviderAdmin;
import com.arsdigita.london.atoz.ui.admin.ItemProviderForm; import com.arsdigita.london.atoz.ui.admin.CategoryProviderForm;
import com.arsdigita.london.atoz.ui.admin.ItemProviderAdmin; import com.arsdigita.london.atoz.ui.admin.ItemProviderAdmin;
import com.arsdigita.london.atoz.ui.admin.ItemProviderForm;
import com.arsdigita.london.atoz.ui.admin.SiteProxyProviderAdmin; import com.arsdigita.london.atoz.ui.admin.SiteProxyProviderAdmin;
import com.arsdigita.london.atoz.ui.admin.SiteProxyProviderForm; import com.arsdigita.london.atoz.ui.admin.SiteProxyProviderForm;
import com.arsdigita.london.atoz.ui.terms.DomainProviderAdmin; import com.arsdigita.london.atoz.ui.terms.DomainProviderAdmin;
import com.arsdigita.london.atoz.ui.terms.DomainProviderForm; import com.arsdigita.london.atoz.ui.terms.DomainProviderForm;
import com.arsdigita.db.DbHelper;
import com.arsdigita.domain.xml.TraversalHandler;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.london.navigation.ApplicationNavigationModel; import com.arsdigita.london.navigation.ApplicationNavigationModel;
import com.arsdigita.london.navigation.DefaultNavigationModel; import com.arsdigita.london.navigation.DefaultNavigationModel;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.runtime.PDLInitializer; import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer; import com.arsdigita.runtime.CompoundInitializer;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.runtime.LegacyInitEvent;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.xml.XML; import com.arsdigita.xml.XML;
/** /**
@ -94,5 +95,17 @@ public class Initializer extends CompoundInitializer {
new AtoZProviderType("ESD Toolkit Domain Provider", new AtoZProviderType("ESD Toolkit Domain Provider",
"Provides a ESD Toolkit A-Z", DomainProvider.class, "Provides a ESD Toolkit A-Z", DomainProvider.class,
DomainProviderForm.class, DomainProviderAdmin.class)); DomainProviderForm.class, DomainProviderAdmin.class));
}
public void init(DomainInitEvent evt) {
super.init(evt);
DomainObjectFactory f = evt.getFactory();
f.registerInstantiator(AtoZCategoryAlias.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() {
protected DomainObject doNewInstance(DataObject dataObject) {
return new AtoZCategoryAlias(dataObject);
}
});
} }
} }

View File

@ -18,37 +18,33 @@
package com.arsdigita.london.atoz.ui.admin; package com.arsdigita.london.atoz.ui.admin;
import com.arsdigita.london.atoz.AtoZCategoryProvider; import java.math.BigDecimal;
import com.arsdigita.london.util.ui.ObjectCategoryPicker;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.StringInRangeValidationListener; import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.categorization.Category; import com.arsdigita.categorization.Category;
import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
import com.arsdigita.london.atoz.AtoZCategoryProvider;
public class CategoryProviderAliasForm extends Form { public class CategoryProviderAliasForm extends Form {
private ACSObjectSelectionModel m_provider; private ACSObjectSelectionModel m_provider;
private TermWidget m_termWidget;
private TextField m_title; private TextField m_title;
private SingleSelect m_letter; private SingleSelect m_letter;
private ObjectCategoryPicker m_category;
private SaveCancelSection m_buttons; private SaveCancelSection m_buttons;
public CategoryProviderAliasForm(ACSObjectSelectionModel provider) { public CategoryProviderAliasForm(ACSObjectSelectionModel provider) {
@ -70,18 +66,12 @@ public class CategoryProviderAliasForm extends Form {
m_letter.addOption(new Option(letter, letter.toUpperCase())); m_letter.addOption(new Option(letter, letter.toUpperCase()));
} }
m_category = new ObjectCategoryPicker("category") {
public String getContext(PageState state) {
return null;
}
public ACSObject getObject(PageState state) {
return (ACSObject)m_provider.getSelectedObject(state);
}
};
add(m_title); add(m_title);
add(m_letter); add(m_letter);
add(m_category);
m_termWidget = new TermWidget(provider);
m_termWidget.addValidationListener(new NotNullValidationListener());
add(m_termWidget);
m_buttons = new SaveCancelSection(new SimpleContainer()); m_buttons = new SaveCancelSection(new SimpleContainer());
add(m_buttons); add(m_buttons);
@ -110,7 +100,7 @@ public class CategoryProviderAliasForm extends Form {
AtoZCategoryProvider provider = (AtoZCategoryProvider)m_provider AtoZCategoryProvider provider = (AtoZCategoryProvider)m_provider
.getSelectedObject(state); .getSelectedObject(state);
Category cat = m_category.getCategory(state); Category cat = new Category(((BigDecimal[])m_termWidget.getValue(state))[0]);
String letter = (String)m_letter.getValue(state); String letter = (String)m_letter.getValue(state);
String title = (String)m_title.getValue(state); String title = (String)m_title.getValue(state);

View File

@ -24,6 +24,7 @@ import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.london.atoz.AtoZ; import com.arsdigita.london.atoz.AtoZ;
import com.arsdigita.london.atoz.AtoZCategoryAlias;
import com.arsdigita.london.atoz.AtoZCategoryProvider; import com.arsdigita.london.atoz.AtoZCategoryProvider;
import com.arsdigita.domain.DomainObjectXMLRenderer; import com.arsdigita.domain.DomainObjectXMLRenderer;
@ -53,16 +54,15 @@ public class CategoryProviderAliasList extends SimpleContainer {
String value = state.getControlEventValue(); String value = state.getControlEventValue();
if (DELETE.equals(key)) { if (DELETE.equals(key)) {
Category cat = (Category)DomainObjectFactory AtoZCategoryAlias alias = (AtoZCategoryAlias)DomainObjectFactory
.newInstance(OID.valueOf(value)); .newInstance(OID.valueOf(value));
AtoZCategoryProvider provider = (AtoZCategoryProvider) AtoZCategoryProvider provider = (AtoZCategoryProvider)
m_provider.getSelectedObject(state); m_provider.getSelectedObject(state);
provider.removeAlias(cat); provider.removeAlias(alias);
} }
} }
public void generateXML(PageState state, public void generateXML(PageState state,
Element parent) { Element parent) {
Element content = AtoZ.newElement("categoryProviderAliasList"); Element content = AtoZ.newElement("categoryProviderAliasList");
@ -73,9 +73,14 @@ public class CategoryProviderAliasList extends SimpleContainer {
DomainCollection entries = provider.getAliases(); DomainCollection entries = provider.getAliases();
while (entries.next()) { while (entries.next()) {
AtoZCategoryAlias alias = (AtoZCategoryAlias)entries.getDomainObject();
Element el = AtoZ.newElement("categoryProviderAlias"); Element el = AtoZ.newElement("categoryProviderAlias");
el.addAttribute("letter", XML.format(entries.get("link.letter"))); el.addAttribute("letter", XML.format(alias.getLetter()));
el.addAttribute("title", XML.format(entries.get("link.title"))); el.addAttribute("title", XML.format(alias.getTitle()));
Element elName = new Element("name");
elName.setText(alias.getCategory().getName());
el.addContent(elName);
try { try {
state.setControlEvent(this, DELETE, entries.getDomainObject() state.setControlEvent(this, DELETE, entries.getDomainObject()

View File

@ -2,11 +2,13 @@
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0" xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:atoz="http://xmlns.redhat.com/atoz/1.0" xmlns:atoz="http://xmlns.redhat.com/atoz/1.0"
version="1.0"> version="1.0">
<xsl:import href="../../../../../ROOT/packages/bebop/xsl/bebop.xsl"/> <xsl:import href="../../../../../ROOT/packages/bebop/xsl/bebop.xsl"/>
<xsl:import href="../../../../../ROOT/packages/ui/xsl/ui.xsl"/> <xsl:import href="../../../../../ROOT/packages/ui/xsl/ui.xsl"/>
<xsl:import href="../../../../../ROOT/__ccm__/static/cms/admin/category-step/category-step.xsl"/>
<xsl:output method="html"/> <xsl:output method="html"/>
@ -208,6 +210,39 @@
</form> </form>
</xsl:template> </xsl:template>
<xsl:template match="cms:emptyPage[@title='childCategories']">
<xsl:choose>
<xsl:when test="cms:category/@order='sortKey'">
<xsl:apply-templates select="cms:category/cms:category" mode="cms:javascriptCat">
<xsl:with-param name="expand" select="'none'"/>
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="cms:category/cms:category" mode="cms:javascriptCat">
<xsl:sort data-type="text" select="@name"/>
<xsl:with-param name="expand" select="'none'"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="cms:categoryWidget" mode="cms:javascript">
<script type="text/javascript" src="/assets/prototype.js"/>
<script type="text/javascript" src="/assets/category-step.js"/>
<script type="text/javascript" src="/resource/ccm-ldn-atoz/__ccm__/static/atoz/category-widget.js"/>
<div>
<xsl:apply-templates select="cms:category" mode="cms:javascriptCat">
<xsl:with-param name="expand" select="'block'"/>
</xsl:apply-templates>
</div>
<h3>Selected categories</h3>
<select id="catWd" size="5" onClick="catDeselect()" style="width: 400px; height=200px">
</select>
<select id="catWdHd" name="{@name}" size="5" multiple="multiple" style="display: none">
</select>
</xsl:template>
<xsl:template match="bebop:form" mode="atoz:categoryAliasForm"> <xsl:template match="bebop:form" mode="atoz:categoryAliasForm">
<form action="{@action}" name="{@name}"> <form action="{@action}" name="{@name}">
<xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/>
@ -236,7 +271,7 @@
<tr class="odd"> <tr class="odd">
<th>Category:</th> <th>Category:</th>
<td> <td>
<xsl:apply-templates select="bebop:select[@name='category']"/> <xsl:apply-templates select="cms:categoryWidget[@name='category']"/>
<xsl:apply-templates select="bebop:formErrors[@id='category']"/> <xsl:apply-templates select="bebop:formErrors[@id='category']"/>
</td> </td>
</tr> </tr>