2. Teil Synchronisieren von ccm-ldn-atoz (patches 1742,1743,1744,1759,1751 von clasohm), neue Datein des patches, ein Hoch auf svn add
git-svn-id: https://svn.libreccm.org/ccm/trunk@76 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
52afa2443e
commit
a94eed0de3
|
|
@ -0,0 +1,31 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2004 Red Hat Inc. 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
|
||||||
|
|
||||||
|
model com.arsdigita.london.atoz;
|
||||||
|
|
||||||
|
query getAllBlackListTypes {
|
||||||
|
String objectType;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct.classname
|
||||||
|
from atoz_cat_ct_blacklist_map bm,
|
||||||
|
content_types ct
|
||||||
|
where ct.type_id = bm.type_id
|
||||||
|
} map {
|
||||||
|
objectType = classname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
create table atoz_cat_aliases (
|
||||||
|
object_id NUMERIC not null
|
||||||
|
constraint atoz_cat_alias_obje_id_p_5h3fv
|
||||||
|
primary key,
|
||||||
|
provider_id INTEGER not null,
|
||||||
|
-- referential constraint for provider_id deferred due to circular dependencies
|
||||||
|
category_id INTEGER not null,
|
||||||
|
-- referential constraint for category_id deferred due to circular dependencies
|
||||||
|
letter CHAR(1) not null,
|
||||||
|
title VARCHAR(200) not null
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table atoz_cat_aliases add
|
||||||
|
constraint atoz_cat_alia_categ_id_f_smlu2 foreign key (category_id)
|
||||||
|
references cat_categories(category_id);
|
||||||
|
alter table atoz_cat_aliases add
|
||||||
|
constraint atoz_cat_alia_provi_id_f_c9mnf foreign key (provider_id)
|
||||||
|
references atoz_cat_provider(provider_id);
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
@@ ../default/upgrade/add-cat_aliases.sql
|
||||||
|
|
||||||
|
insert into atoz_cat_aliases (object_id, provider_id, category_id, letter, title)
|
||||||
|
select acs_object_id_seq.nextval, m.provider_id, m.category_id, m.letter, m.title
|
||||||
|
from atoz_cat_alias_map m;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
begin;
|
||||||
|
|
||||||
|
\i ../default/upgrade/add-cat_aliases.sql
|
||||||
|
|
||||||
|
insert into atoz_cat_aliases (object_id, provider_id, category_id, letter, title)
|
||||||
|
select nextval('acs_object_id_seq'), m.provider_id, m.category_id, m.letter, m.title
|
||||||
|
from atoz_cat_alias_map m;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Red Hat Inc. 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.london.atoz;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
|
import com.arsdigita.db.Sequences;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.Party;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.PersistenceException;
|
||||||
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
|
|
||||||
|
public class AtoZCategoryAlias extends DomainObject {
|
||||||
|
private static final Logger s_log = Logger.getLogger(AtoZCategoryAlias.class);
|
||||||
|
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.atoz.AtoZCategoryAlias";
|
||||||
|
|
||||||
|
public static final String ID = "id";
|
||||||
|
public static final String PROVIDER = "provider";
|
||||||
|
public static final String CATEGORY = "category";
|
||||||
|
public static final String LETTER = "letter";
|
||||||
|
public static final String TITLE = "title";
|
||||||
|
|
||||||
|
public AtoZCategoryAlias() {
|
||||||
|
this(BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AtoZCategoryAlias(String type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AtoZCategoryAlias(DataObject obj) {
|
||||||
|
super(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AtoZCategoryAlias(OID oid) {
|
||||||
|
super(oid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup(Category category, String letter, String title) {
|
||||||
|
setCategory(category);
|
||||||
|
setLetter(letter);
|
||||||
|
setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called from base class (DomainObject) constructors.
|
||||||
|
*/
|
||||||
|
protected void initialize() {
|
||||||
|
super.initialize();
|
||||||
|
|
||||||
|
if (isNew() && get(ID) == null)
|
||||||
|
set(ID, generateID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AtoZCategoryProvider getProvider() {
|
||||||
|
return (AtoZCategoryProvider)get(PROVIDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Category getCategory() {
|
||||||
|
return new Category((DataObject)get(CATEGORY));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(Category category) {
|
||||||
|
set(CATEGORY, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLetter() {
|
||||||
|
return (String)get(LETTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLetter(String letter) {
|
||||||
|
set(LETTER, letter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return (String)get(TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
set(TITLE, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
static BigDecimal generateID() throws PersistenceException {
|
||||||
|
try {
|
||||||
|
return Sequences.getNextValue();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
final String errorMsg = "Unable to generate a unique " +
|
||||||
|
"ACSObject id.";
|
||||||
|
s_log.error(errorMsg);
|
||||||
|
throw PersistenceException.newInstance(errorMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -47,10 +47,10 @@ import com.arsdigita.xml.XML;
|
||||||
/**
|
/**
|
||||||
* Initializes the A-Z system
|
* Initializes the A-Z system
|
||||||
*
|
*
|
||||||
* @version $Id: Initializer.java 1052 2005-12-13 22:52:55Z apevec $
|
* @version $Id: Initializer.java 1741 2008-09-01 15:38:21Z clasohm $
|
||||||
*/
|
*/
|
||||||
public class Initializer extends CompoundInitializer {
|
public class Initializer extends CompoundInitializer {
|
||||||
public final static String versionId = "$Id: Initializer.java 1052 2005-12-13 22:52:55Z apevec $";
|
public final static String versionId = "$Id: Initializer.java 1741 2008-09-01 15:38:21Z clasohm $";
|
||||||
|
|
||||||
public Initializer() {
|
public Initializer() {
|
||||||
final String url = RuntimeConfig.getConfig().getJDBCURL();
|
final String url = RuntimeConfig.getConfig().getJDBCURL();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2004 Red Hat Inc. 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.london.atoz.ui.admin;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
import com.arsdigita.london.atoz.AtoZCategoryProvider;
|
||||||
|
import com.arsdigita.london.terms.Domain;
|
||||||
|
import com.arsdigita.london.terms.Term;
|
||||||
|
|
||||||
|
import com.arsdigita.aplaws.Aplaws;
|
||||||
|
import com.arsdigita.bebop.form.Widget;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.parameters.ArrayParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copied from com.arsdigita.aplaws.ui.TermWidget.
|
||||||
|
*
|
||||||
|
* @author clasohm@redhat.com
|
||||||
|
*/
|
||||||
|
public class TermWidget extends com.arsdigita.aplaws.ui.TermWidget {
|
||||||
|
private static final Logger s_log = Logger.getLogger(TermWidget.class);
|
||||||
|
|
||||||
|
private ACSObjectSelectionModel m_provider;
|
||||||
|
|
||||||
|
public TermWidget(ACSObjectSelectionModel provider) {
|
||||||
|
super(null, null);
|
||||||
|
|
||||||
|
m_provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateWidget(PageState state,
|
||||||
|
Element parent) {
|
||||||
|
Domain domain = getDomain(state);
|
||||||
|
|
||||||
|
Element widget = parent.newChildElement("cms:categoryWidget",
|
||||||
|
CMS.CMS_XML_NS);
|
||||||
|
exportAttributes(widget);
|
||||||
|
|
||||||
|
widget.addAttribute("mode", "javascript");
|
||||||
|
widget.addAttribute("name", getName());
|
||||||
|
|
||||||
|
Set ids = new HashSet();
|
||||||
|
|
||||||
|
BigDecimal[] values = (BigDecimal[])getValue(state);
|
||||||
|
if (values != null) {
|
||||||
|
for (int i = 0 ; i < values.length ; i++) {
|
||||||
|
ids.add(values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// only root terms at first, the rest is loaded on-demand via AJAX
|
||||||
|
DomainCollection terms = domain.getRootTerms();
|
||||||
|
terms.addPath("model.parents.link.sortKey");
|
||||||
|
terms.addPath("model.parents.id");
|
||||||
|
terms.addPath("domain.key");
|
||||||
|
|
||||||
|
// Pull out everything related to the category, otherwise
|
||||||
|
// another query per row is executed when doing term.getModel();
|
||||||
|
terms.addPath("model.objectType");
|
||||||
|
terms.addPath("model.displayName");
|
||||||
|
terms.addPath("model.defaultDomainClass");
|
||||||
|
terms.addPath("model.name");
|
||||||
|
terms.addPath("model.description");
|
||||||
|
terms.addPath("model.url");
|
||||||
|
terms.addPath("model.isEnabled");
|
||||||
|
terms.addPath("model.isAbstract");
|
||||||
|
terms.addPath("model.defaultAncestors");
|
||||||
|
|
||||||
|
List roots = new LinkedList();
|
||||||
|
while (terms.next()) {
|
||||||
|
Term term = (Term) terms.getDomainObject();
|
||||||
|
roots.add(new TermSortKeyPair
|
||||||
|
(term,(BigDecimal)terms.get("model.parents.link.sortKey")));
|
||||||
|
}
|
||||||
|
|
||||||
|
Element el = generateCategory(widget, domain.getModel(), ids, null);
|
||||||
|
|
||||||
|
if (Aplaws.getAplawsConfig().ajaxExpandAllBranches()) {
|
||||||
|
// add attribute to the parent node, so that in stylesheet
|
||||||
|
// we can look for any ancestor with this attribute (can't
|
||||||
|
// add attribute to categoryWidget element as that is not
|
||||||
|
// visible when subbranches are transformed)
|
||||||
|
el.addAttribute("expand", "all" );
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Iterator i=roots.iterator(); i.hasNext(); ) {
|
||||||
|
TermSortKeyPair pair = (TermSortKeyPair) i.next();
|
||||||
|
Term term = pair.getTerm();
|
||||||
|
BigDecimal sortKey = pair.getSortKey();
|
||||||
|
|
||||||
|
generateRootTerm(el, term, ids, sortKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void generateRootTerm(Element parent,
|
||||||
|
Term term,
|
||||||
|
Set selected,
|
||||||
|
BigDecimal sortKey) {
|
||||||
|
Element el = generateTerm(parent, term, selected, sortKey);
|
||||||
|
el.addAttribute("root","1");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class TermSortKeyPair {
|
||||||
|
private Term m_term;
|
||||||
|
private BigDecimal m_sortKey;
|
||||||
|
|
||||||
|
public TermSortKeyPair(Term term, BigDecimal sortKey) {
|
||||||
|
m_term = term;
|
||||||
|
m_sortKey = sortKey;
|
||||||
|
}
|
||||||
|
public Term getTerm() {
|
||||||
|
return m_term;
|
||||||
|
}
|
||||||
|
public BigDecimal getSortKey() {
|
||||||
|
return m_sortKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* copied from com.arsdigita.aplaws.ui.ACSObjectCategoryPicker
|
||||||
|
*/
|
||||||
|
protected Domain getDomain(PageState state) {
|
||||||
|
AtoZCategoryProvider provider = (AtoZCategoryProvider)m_provider.getSelectedObject(state);
|
||||||
|
Category root = Category.getRootForObject(provider);
|
||||||
|
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Getting domain for " + root.getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
DataCollection domains = SessionManager.getSession()
|
||||||
|
.retrieve(Domain.BASE_DATA_OBJECT_TYPE);
|
||||||
|
domains.addEqualsFilter("model.id", root.getID());
|
||||||
|
|
||||||
|
if (domains.next()) {
|
||||||
|
Domain domain = (Domain)DomainObjectFactory
|
||||||
|
.newInstance(domains.getDataObject());
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Got domain " + domain);
|
||||||
|
}
|
||||||
|
domains.close();
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("No domain found");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Overrides the version from ccm-cms. This behaves as a single-selection
|
||||||
|
// widget. It always stores the selection in slot 0, and makes sure the
|
||||||
|
// previous selection is made clickable again.
|
||||||
|
function catSelect(id, name) {
|
||||||
|
var elWidget = $("catWd");
|
||||||
|
var elWidgetHidden = $("catWdHd");
|
||||||
|
var found = 0;
|
||||||
|
for (var i = 0 ; i < elWidget.options.length ; i++) {
|
||||||
|
if (elWidget.options[i].value == id) {
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
if (elWidget.options[0] != null) {
|
||||||
|
var prevId = elWidget.options[0].value;
|
||||||
|
var elLink = $("catLn"+prevId);
|
||||||
|
var elName = $("catNm"+prevId);
|
||||||
|
elLink.style.display="inline";
|
||||||
|
elName.style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
var opt = new Option(name, id);
|
||||||
|
opt.onclick = "function() { catDeselect('" + id + "'); }";
|
||||||
|
elWidget.options[0] = opt;
|
||||||
|
var optHidden = new Option(name, id, false, true);
|
||||||
|
elWidgetHidden.options[0] = optHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elLink = $("catLn"+id);
|
||||||
|
var elName = $("catNm"+id);
|
||||||
|
|
||||||
|
elLink.style.display="none";
|
||||||
|
elName.style.display="inline";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||||
|
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||||
|
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||||
|
version="1.2">
|
||||||
|
|
||||||
|
<define:page name="childCategories" pageClass="com.arsdigita.cms.ui.authoring.EmptyPage" title="childCategories" cache="true">
|
||||||
|
|
||||||
|
<define:component name="catSubtree"
|
||||||
|
classname="com.arsdigita.aplaws.ui.CategorySubtree"/>
|
||||||
|
</define:page>
|
||||||
|
|
||||||
|
<show:all/>
|
||||||
|
</jsp:root>
|
||||||
Loading…
Reference in New Issue