Übernahme von categorised forum von Chris Gilbert aus dem contributed Zweig
(wsx - West Sussex) Damit wird es möglich, ein Forum auch in den Navigationsbaum einzuhängen, nicht nur als Adresse unterhalb von /portal/. Compiliert im Moment noch nicht, da noch Abhängigkeiten zu ccm-ldn-aplaws aufgelöst werden müssen. git-svn-id: https://svn.libreccm.org/ccm/trunk@450 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0cc588cb7f
commit
60bd82ae63
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-forum-categorised"
|
||||||
|
prettyName="Forum Categorised Extension"
|
||||||
|
version="6.5.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-forum" version="6.4.0" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-ldn-navigation" version="6.4.0" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-ldn-terms" version="6.4.0" relation="ge"/>
|
||||||
|
<!-- <ccm:requires name="ccm-ldn-aplaws" version="6.4.0" relation="ge"/> -->
|
||||||
|
</ccm:dependencies>
|
||||||
|
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
|
||||||
|
<ccm:description>
|
||||||
|
The Red Hat Web Application Framework is a platform for writing
|
||||||
|
database-backed web applications in Java.
|
||||||
|
</ccm:description>
|
||||||
|
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
</requires>
|
||||||
|
<provides>
|
||||||
|
<initializer class="com.arsdigita.categorisedforum.Initializer"/>
|
||||||
|
</provides>
|
||||||
|
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<upgrade>
|
||||||
|
<version from="1.4.2" to="1.4.3">
|
||||||
|
<script sql="ccm-forum/upgrade/::database::-1.4.2-1.4.3.sql"/>
|
||||||
|
</version>
|
||||||
|
<version from="1.4.3" to="1.4.4">
|
||||||
|
<script sql="ccm-forum/upgrade/::database::-1.4.3-1.4.4.sql"/>
|
||||||
|
</version>
|
||||||
|
<version from="1.4.4" to="1.4.5">
|
||||||
|
<script sql="ccm-forum/upgrade/::database::-1.4.4-1.4.5.sql"/>
|
||||||
|
</version>
|
||||||
|
|
||||||
|
</upgrade>
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* Created on 09-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.SimpleComponent;
|
||||||
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.categorization.ui.ACSObjectCategoryForm;
|
||||||
|
import com.arsdigita.categorization.ui.ACSObjectCategorySummary;
|
||||||
|
import com.arsdigita.forum.ui.Constants;
|
||||||
|
import com.arsdigita.web.RedirectSignal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class AssignCategoryView extends SimpleContainer implements Constants {
|
||||||
|
|
||||||
|
private ACSObjectCategorySummary m_summary;
|
||||||
|
private SimpleComponent m_add;
|
||||||
|
private BigDecimalParameter m_root;
|
||||||
|
private StringParameter m_mode;
|
||||||
|
Logger s_log = Logger.getLogger(AssignCategoryView.class);
|
||||||
|
|
||||||
|
public AssignCategoryView() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
m_root = new BigDecimalParameter("root");
|
||||||
|
m_mode = new StringParameter("mode");
|
||||||
|
|
||||||
|
m_summary = new ForumCategorySummary();
|
||||||
|
s_log.debug("m_summary in the constructor is : " + m_summary.toString());
|
||||||
|
|
||||||
|
m_summary.registerAction(ACSObjectCategorySummary.ACTION_ADD,
|
||||||
|
new AddActionListener("plain"));
|
||||||
|
m_summary.registerAction(ACSObjectCategorySummary.ACTION_ADD_JS,
|
||||||
|
new AddActionListener("javascript"));
|
||||||
|
m_add = new ForumTermPicker(m_root, m_mode);
|
||||||
|
|
||||||
|
m_add.addCompletionListener(new ResetListener());
|
||||||
|
|
||||||
|
add(m_summary);
|
||||||
|
add(m_add);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register(Page p) {
|
||||||
|
super.register(p);
|
||||||
|
|
||||||
|
p.setVisibleDefault(m_add, false);
|
||||||
|
|
||||||
|
p.addGlobalStateParam(m_root);
|
||||||
|
p.addGlobalStateParam(m_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(PageState state) {
|
||||||
|
state.setValue(m_root, null);
|
||||||
|
state.setValue(m_mode, null);
|
||||||
|
|
||||||
|
m_summary.setVisible(state, true);
|
||||||
|
m_add.setVisible(state, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AddActionListener implements ActionListener {
|
||||||
|
private String m_mode;
|
||||||
|
|
||||||
|
public AddActionListener(String mode) {
|
||||||
|
m_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
state.setValue(m_root,
|
||||||
|
new BigDecimal(state.getControlEventValue()));
|
||||||
|
|
||||||
|
state.setValue(AssignCategoryView.this.m_mode,
|
||||||
|
m_mode);
|
||||||
|
s_log.debug("m_summary in the action perform is : " + m_summary.toString());
|
||||||
|
m_summary.setVisible(state, false);
|
||||||
|
m_add.setVisible(state, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ResetListener implements ActionListener {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
reset(state);
|
||||||
|
throw new RedirectSignal(state.toURL(), true);
|
||||||
|
}
|
||||||
|
}/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* Created on 09-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.forum.Forum;
|
||||||
|
import com.arsdigita.forum.ForumContext;
|
||||||
|
import com.arsdigita.forum.ui.ForumComponent;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.Party;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
|
import com.arsdigita.kernel.security.UserContext;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class CategorisedForumComponent extends ForumComponent {
|
||||||
|
|
||||||
|
public static final String MODE_CATEGORIES = "categories";
|
||||||
|
|
||||||
|
private AssignCategoryView m_categoryView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public CategorisedForumComponent() {
|
||||||
|
super();
|
||||||
|
m_categoryView = new AssignCategoryView();
|
||||||
|
add(m_categoryView);
|
||||||
|
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setVisible(
|
||||||
|
PageState state,
|
||||||
|
Party party,
|
||||||
|
Forum forum,
|
||||||
|
String mode) {
|
||||||
|
|
||||||
|
PermissionDescriptor forumAdmin =
|
||||||
|
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party);
|
||||||
|
|
||||||
|
if (MODE_CATEGORIES.equals(mode)) {
|
||||||
|
if (party == null) {
|
||||||
|
UserContext.redirectToLoginPage(state.getRequest());
|
||||||
|
}
|
||||||
|
PermissionService.assertPermission(forumAdmin);
|
||||||
|
setVisibleComponent(state, m_categoryView);
|
||||||
|
} else {
|
||||||
|
super.setVisible(state, party, forum, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateModes(
|
||||||
|
PageState state,
|
||||||
|
Element content,
|
||||||
|
Party party,
|
||||||
|
Forum forum) {
|
||||||
|
super.generateModes(state, content, party, forum);
|
||||||
|
PermissionDescriptor permission =
|
||||||
|
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party);
|
||||||
|
|
||||||
|
if (PermissionService.checkPermission(permission)) {
|
||||||
|
generateModeXML(state, content, MODE_CATEGORIES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Created on 09-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.forum.Forum;
|
||||||
|
import com.arsdigita.forum.ForumContext;
|
||||||
|
import com.arsdigita.forum.ForumPageBuilder;
|
||||||
|
import com.arsdigita.forum.ui.ForumComponent;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Menu;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class CategorisedForumPageBuilder extends ForumPageBuilder {
|
||||||
|
|
||||||
|
public Page buildPage() {
|
||||||
|
|
||||||
|
Page page = super.buildPage();
|
||||||
|
Path path = new Path();
|
||||||
|
path.setModel(new ForumNavigationModel());
|
||||||
|
|
||||||
|
page.add(path);
|
||||||
|
page.add(new Menu());
|
||||||
|
return page;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ForumComponent getForumComponent() {
|
||||||
|
return new CategorisedForumComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Created on 09-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.forum.ForumPageBuilder;
|
||||||
|
import com.arsdigita.forum.ThreadPageBuilder;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Menu;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class CategorisedThreadPageBuilder extends ThreadPageBuilder {
|
||||||
|
|
||||||
|
public Page buildPage() {
|
||||||
|
|
||||||
|
Page page = super.buildPage();
|
||||||
|
Path path = new Path();
|
||||||
|
path.setModel(new ForumNavigationModel());
|
||||||
|
page.add(path);
|
||||||
|
page.add(new Menu());
|
||||||
|
return page;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Created on 09-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import com.arsdigita.aplaws.ui.CategorySubtree;
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.EmptyPage;
|
||||||
|
import com.arsdigita.forum.ForumPageBuilder;
|
||||||
|
import com.arsdigita.forum.PageBuilder;
|
||||||
|
import com.arsdigita.forum.ThreadPageBuilder;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Menu;
|
||||||
|
import com.arsdigita.london.navigation.ui.category.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* Used by Ajax to generate branch of tree
|
||||||
|
*/
|
||||||
|
public class CategorySubtreePageBuilder implements PageBuilder {
|
||||||
|
|
||||||
|
public Page buildPage() {
|
||||||
|
|
||||||
|
//
|
||||||
|
// the title of the page is important because we use the xsl in ccm-ldn-aplaws
|
||||||
|
// web/__ccm__/themes/aplaws/category-step.xsl that refers to it. This
|
||||||
|
// matches the page defined in ccm-ldn-aplaws/web/packages/content-section/www/admin/load-cat.jsp
|
||||||
|
|
||||||
|
Page page = new EmptyPage();
|
||||||
|
page.setTitle("childCategories");
|
||||||
|
page.add(new CategorySubtree());
|
||||||
|
|
||||||
|
return page;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Created on 22-Feb-06
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
|
import com.arsdigita.categorization.RootCategoryCollection;
|
||||||
|
import com.arsdigita.categorization.ui.ACSObjectCategorySummary;
|
||||||
|
import com.arsdigita.forum.Forum;
|
||||||
|
import com.arsdigita.forum.ForumContext;
|
||||||
|
import com.arsdigita.forum.ui.Constants;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class ForumCategorySummary extends ACSObjectCategorySummary implements Constants {
|
||||||
|
|
||||||
|
|
||||||
|
protected ACSObject getObject(PageState state) {
|
||||||
|
return ForumContext.getContext(state).getForum();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getXMLPrefix()
|
||||||
|
*/
|
||||||
|
protected String getXMLPrefix() {
|
||||||
|
return "forum";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getXMLNameSpace()
|
||||||
|
*/
|
||||||
|
protected String getXMLNameSpace() {
|
||||||
|
return FORUM_XML_NS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retrieve any domains that are mapped to this forum. If there are none,
|
||||||
|
* retrieve domains mapped to the parent application (eg ccm/portal)
|
||||||
|
* @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getRootCategories()
|
||||||
|
*/
|
||||||
|
protected RootCategoryCollection getRootCategories(PageState state) {
|
||||||
|
Forum forum = ForumContext.getContext(state).getForum();
|
||||||
|
RootCategoryCollection roots = Category.getRootCategories(forum);
|
||||||
|
if (roots.size() == 0) {
|
||||||
|
// forum has no domains - check if parent application has, and use those
|
||||||
|
roots = Category.getRootCategories(forum.getParentApplication());
|
||||||
|
}
|
||||||
|
return roots;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Created on 04-Aug-05
|
||||||
|
*
|
||||||
|
* To change the template for this generated file go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
import com.arsdigita.categorization.CategorizedObject;
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
|
import com.arsdigita.categorization.CategoryCollection;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.london.navigation.CookieNavigationModel;
|
||||||
|
import com.arsdigita.london.navigation.GenericNavigationModel;
|
||||||
|
import com.arsdigita.london.terms.Domain;
|
||||||
|
import com.arsdigita.london.terms.Term;
|
||||||
|
import com.arsdigita.london.terms.Util;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cgyg9330
|
||||||
|
*
|
||||||
|
* Navigation model that retrieves the path to one navigation category that the forum is allocated to
|
||||||
|
* if there is no cookie available
|
||||||
|
*/
|
||||||
|
public class ForumNavigationModel extends CookieNavigationModel {
|
||||||
|
|
||||||
|
protected ACSObject getCategorisedObject() {
|
||||||
|
return Kernel.getContext().getResource();
|
||||||
|
|
||||||
|
}
|
||||||
|
protected Category[] getAlternativePath(boolean cookieExists) {
|
||||||
|
Application forum = (Application)Kernel.getContext().getResource();
|
||||||
|
//Category defaultCat = new CategorizedObject(forum).getDefaultParentCategory();
|
||||||
|
Domain navigation = Util.getApplicationDomain(Application.retrieveApplicationForPath("/navigation/"));
|
||||||
|
DomainCollection forumNavigationTerms = navigation.getDirectTerms(forum);
|
||||||
|
Category cat = null;
|
||||||
|
if (forumNavigationTerms.next()) {
|
||||||
|
cat = ((Term) forumNavigationTerms.getDomainObject()).getModel();
|
||||||
|
forumNavigationTerms.close();
|
||||||
|
}
|
||||||
|
if (cat == null) {
|
||||||
|
return new Category[]{ getRootCategory() };
|
||||||
|
}
|
||||||
|
List path = new ArrayList();
|
||||||
|
CategoryCollection cats = cat.getDefaultAscendants();
|
||||||
|
cats.addOrder("defaultAncestors");
|
||||||
|
while (cats.next()) {
|
||||||
|
path.add(cats.getDomainObject());
|
||||||
|
}
|
||||||
|
return (Category[]) path.toArray(new Category[(int) path.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.categorisedforum;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.form.Widget;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.categorization.ui.ACSObjectCategoryForm;
|
||||||
|
import com.arsdigita.forum.ForumContext;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
|
||||||
|
public class ForumTermForm extends ACSObjectCategoryForm {
|
||||||
|
|
||||||
|
private static Logger s_log = Logger.getLogger(ForumTermForm.class);
|
||||||
|
|
||||||
|
|
||||||
|
public ForumTermForm(BigDecimalParameter root, StringParameter mode, Widget widget) {
|
||||||
|
super(root, mode, widget);
|
||||||
|
s_log.debug("creating new ForumTerm Form with widget " + widget);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.categorization.ui.ACSObjectCategoryForm#getObject()
|
||||||
|
*/
|
||||||
|
protected ACSObject getObject(PageState state) {
|
||||||
|
|
||||||
|
return ForumContext.getContext(state).getForum();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.aplaws.ui.ACSObjectCategoryPicker;
|
||||||
|
import com.arsdigita.aplaws.ui.TermWidget;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.categorization.ui.ACSObjectCategoryForm;
|
||||||
|
import com.arsdigita.forum.ForumContext;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
|
||||||
|
public class ForumTermPicker extends ACSObjectCategoryPicker {
|
||||||
|
private static final Logger s_log = Logger.getLogger(ForumTermPicker.class);
|
||||||
|
|
||||||
|
|
||||||
|
public ForumTermPicker(BigDecimalParameter root,
|
||||||
|
StringParameter mode) {
|
||||||
|
super(root, mode);
|
||||||
|
s_log.debug("instantiating ForumCategoryPicker");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.aplaws.ui.ACSObjectCategoryPicker#getForm(com.arsdigita.bebop.parameters.BigDecimalParameter, com.arsdigita.bebop.parameters.StringParameter)
|
||||||
|
*/
|
||||||
|
protected ACSObjectCategoryForm getForm(BigDecimalParameter root, StringParameter mode) {
|
||||||
|
s_log.debug("getForm");
|
||||||
|
return new ForumTermForm(root, mode, new TermWidget(mode, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.aplaws.ui.ACSObjectCategoryPicker#getObject()
|
||||||
|
*/
|
||||||
|
protected ACSObject getObject(PageState state) {
|
||||||
|
return ForumContext.getContext(state).getForum();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the CCM Public
|
||||||
|
* License (the "License"); you may not use this file except in
|
||||||
|
* compliance with the License. You may obtain a copy of the
|
||||||
|
* License at http://www.redhat.com/licenses/ccmpl.html.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an
|
||||||
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language
|
||||||
|
* governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.forum.Forum;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.NoValidURLException;
|
||||||
|
import com.arsdigita.kernel.URLFinder;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.URL;
|
||||||
|
|
||||||
|
public class ForumURLFinder implements URLFinder {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(ForumURLFinder.class);
|
||||||
|
|
||||||
|
public String find(OID oid,String context) throws NoValidURLException {
|
||||||
|
|
||||||
|
|
||||||
|
return find(oid);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.arsdigita.kernel.URLFinder#find(com.arsdigita.persistence.OID)
|
||||||
|
*/
|
||||||
|
public String find(OID oid) throws NoValidURLException {
|
||||||
|
Application forum;
|
||||||
|
|
||||||
|
try {
|
||||||
|
forum = (Forum)DomainObjectFactory.newInstance(oid);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
throw new NoValidURLException(
|
||||||
|
"cannot instantiate application " + oid +
|
||||||
|
" message: " + ex.getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return URL.getDispatcherPath() + forum.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.categorisedforum;
|
||||||
|
import com.arsdigita.db.DbHelper;
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.xml.TraversalHandler;
|
||||||
|
|
||||||
|
import com.arsdigita.persistence.pdl.ManifestSource;
|
||||||
|
import com.arsdigita.persistence.pdl.NameFilter;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.CompoundInitializer;
|
||||||
|
import com.arsdigita.runtime.LegacyInitEvent;
|
||||||
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
|
import com.arsdigita.runtime.PDLInitializer;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.Group;
|
||||||
|
import com.arsdigita.kernel.URLFinder;
|
||||||
|
import com.arsdigita.kernel.URLService;
|
||||||
|
import com.arsdigita.kernel.NoValidURLException;
|
||||||
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
|
import com.arsdigita.kernel.ResourceTypeConfig;
|
||||||
|
import com.arsdigita.kernel.ResourceType;
|
||||||
|
import com.arsdigita.kernel.ui.ResourceConfigFormSection;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.messaging.ThreadedMessage;
|
||||||
|
|
||||||
|
import com.arsdigita.forum.Forum;
|
||||||
|
import com.arsdigita.forum.ForumPageFactory;
|
||||||
|
import com.arsdigita.forum.portlet.RecentPostingsPortlet;
|
||||||
|
import com.arsdigita.forum.ui.portlet.RecentPostingsPortletEditor;
|
||||||
|
import com.arsdigita.web.ui.ApplicationConfigFormSection;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The forum initializer.
|
||||||
|
*
|
||||||
|
* @author Justin Ross <jross@redhat.com>
|
||||||
|
* @version $Id: Initializer.java,v 1.1 2006/03/03 10:54:45 cgyg9330 Exp $
|
||||||
|
*/
|
||||||
|
public class Initializer extends CompoundInitializer {
|
||||||
|
public final static String versionId =
|
||||||
|
"$Id: Initializer.java,v 1.1 2006/03/03 10:54:45 cgyg9330 Exp $" +
|
||||||
|
"$Author: cgyg9330 $" +
|
||||||
|
"$DateTime: 2004/08/17 23:26:27 $";
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
|
|
||||||
|
|
||||||
|
public void init(LegacyInitEvent e) {
|
||||||
|
super.init(e);
|
||||||
|
ForumPageFactory.registerPageBuilder(ForumPageFactory.FORUM_PAGE, new CategorisedForumPageBuilder());
|
||||||
|
ForumPageFactory.registerPageBuilder(ForumPageFactory.THREAD_PAGE, new CategorisedThreadPageBuilder());
|
||||||
|
ForumPageFactory.registerPageBuilder("load-cat.jsp", new CategorySubtreePageBuilder());
|
||||||
|
URLService.registerFinder(Forum.BASE_DATA_OBJECT_TYPE, new ForumURLFinder());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,298 @@
|
||||||
|
ll<xsl:stylesheet xmlns:forum="http://www.arsdigita.com/forum/1.0"
|
||||||
|
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:nav="http://ccm.redhat.com/london/navigation"
|
||||||
|
xmlns:search="http://rhea.redhat.com/search/1.0"
|
||||||
|
xmlns:portal="http://www.uk.arsdigita.com/portal/1.0"
|
||||||
|
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||||
|
exclude-result-prefixes="xsl bebop nav search portal forum cms"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:output method="html" indent="yes"/>
|
||||||
|
<xsl:import href="../../../../../ROOT/__ccm__/themes/aplaws/category-step.xsl"/>
|
||||||
|
<xsl:import href="../../../../../ROOT/__ccm__/static/cms/admin/category-step/category-step.xsl"/>
|
||||||
|
|
||||||
|
<xsl:template match="forum:categoryStepSummary">
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<h3>Assign Categories</h3>
|
||||||
|
<br/>
|
||||||
|
<xsl:for-each select="forum:categoryRoots/forum:categoryRoot">
|
||||||
|
<xsl:sort select="@name"/>
|
||||||
|
<xsl:variable name="name">
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<h5><xsl:value-of select="$name"/></h5>
|
||||||
|
<br/>
|
||||||
|
<xsl:if test="@addAction">
|
||||||
|
<script LANGUAGE="JavaScript">
|
||||||
|
<![CDATA[ <!-- begin script ]]>
|
||||||
|
<![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA["><img src="/assets/action-add.png" border="0"/></a>')]]>
|
||||||
|
<![CDATA[ document.write("\<!--") ]]>
|
||||||
|
<![CDATA[ // end script --> ]]>
|
||||||
|
</script>
|
||||||
|
<a href="{@addAction}">
|
||||||
|
<img src="/assets/action-add.png" border="0"/>
|
||||||
|
</a>
|
||||||
|
<script LANGUAGE="JavaScript">
|
||||||
|
<![CDATA[ <!-- begin script ]]>
|
||||||
|
<![CDATA[ document.write("--\>") ]]>
|
||||||
|
<![CDATA[ // end script --> ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script LANGUAGE="JavaScript">
|
||||||
|
<![CDATA[ <!-- begin script ]]>
|
||||||
|
<![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA[">Add Categories</a>')]]>
|
||||||
|
<![CDATA[ document.write("\<!--") ]]>
|
||||||
|
<![CDATA[ // end script --> ]]>
|
||||||
|
</script>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<a href="{@addAction}">
|
||||||
|
<xsl:text>Add categories</xsl:text>
|
||||||
|
</a>
|
||||||
|
<script LANGUAGE="JavaScript">
|
||||||
|
<![CDATA[ <!-- begin script ]]>
|
||||||
|
<![CDATA[ document.write("--\>") ]]>
|
||||||
|
<![CDATA[ // end script --> ]]>
|
||||||
|
</script>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="count(../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]) = 0">
|
||||||
|
<div>
|
||||||
|
There are no categories assigned in this context
|
||||||
|
</div>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<ul>
|
||||||
|
<xsl:for-each select="../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]">
|
||||||
|
<xsl:sort select="@path"/>
|
||||||
|
<li>
|
||||||
|
<xsl:value-of select="substring(@path, string-length($name) + 5)"/> 
|
||||||
|
<xsl:if test="@deleteAction">
|
||||||
|
<a href="{@deleteAction}"><img src="/assets/action-delete.png" border="0"/></a>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<a href="{@deleteAction}">Remove</a>
|
||||||
|
</xsl:if>
|
||||||
|
</li>
|
||||||
|
</xsl:for-each>
|
||||||
|
</ul>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:for-each>
|
||||||
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="forum:categoryWidget">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@mode = 'javascript'">
|
||||||
|
<xsl:apply-templates select="." mode="forum:javascript"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates select="." mode="forum:plain"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="forum:categoryWidget" mode="forum:javascript">
|
||||||
|
<script language="JavaScript">
|
||||||
|
<![CDATA[
|
||||||
|
<!-- Begin hiding
|
||||||
|
function catToggle(id) {
|
||||||
|
var elImg = document.getElementById("catTog"+id);
|
||||||
|
var elChildren = document.getElementById("catCh"+id);
|
||||||
|
|
||||||
|
if (elChildren.style.display != "block") {
|
||||||
|
elChildren.style.display = "block";
|
||||||
|
elImg.src = "/assets/action-delete.png";
|
||||||
|
} else {
|
||||||
|
elChildren.style.display = "none";
|
||||||
|
elImg.src = "/assets/action-add.png";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function catSelect(id, name, node) {
|
||||||
|
var elWidget = document.getElementById("catWd");
|
||||||
|
var elWidgetHidden = document.getElementById("catWdHd");
|
||||||
|
var found = 0;
|
||||||
|
for (var i = 0 ; i < elWidget.options.length ; i++) {
|
||||||
|
if (elWidget.options[i].value == id) {
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
var opt = new Option(name, id);
|
||||||
|
elWidget.options[elWidget.options.length] = opt;
|
||||||
|
|
||||||
|
var optHidden = new Option(node, id, false, true);
|
||||||
|
elWidgetHidden.options[elWidgetHidden.options.length] = optHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elLink = document.getElementById("catLn"+node);
|
||||||
|
var elName = document.getElementById("catNm"+node);
|
||||||
|
elLink.style.display="none";
|
||||||
|
elName.style.display="inline";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function catDeselect() {
|
||||||
|
var elWidget = document.getElementById("catWd");
|
||||||
|
var elWidgetHidden = document.getElementById("catWdHd");
|
||||||
|
var idx = elWidget.selectedIndex;
|
||||||
|
if (idx != -1) {
|
||||||
|
//var id = elWidget.options[idx].value;
|
||||||
|
var node = elWidgetHidden.options[idx].text;
|
||||||
|
var elLink = document.getElementById("catLn"+node);
|
||||||
|
var elName = document.getElementById("catNm"+node);
|
||||||
|
elLink.style.display="inline";
|
||||||
|
elName.style.display="none";
|
||||||
|
|
||||||
|
elWidget.options[idx] = null;
|
||||||
|
elWidgetHidden.options[idx] = null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// End hiding -->
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
<div>
|
||||||
|
<xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat">
|
||||||
|
<xsl:with-param name="expand" select="'block'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div class="content">
|
||||||
|
<h4>Selected Categories</h4>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="forum:category" mode="forum:javascriptCat">
|
||||||
|
<xsl:param name="expand" select="'none'"/>
|
||||||
|
<xsl:variable name="linkStyle">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@isAbstract != '1' and @isSelected != '1'">
|
||||||
|
<xsl:value-of select="'inline'"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="'none'"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="nameStyle">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@isAbstract != '1' and @isSelected != '1'">
|
||||||
|
<xsl:value-of select="'none'"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="'inline'"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<div id="catSelf{@pid}">
|
||||||
|
<div class="content">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand='none'">
|
||||||
|
<a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-add.png" width="14" height="14" border="0"/></a>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand!='none'">
|
||||||
|
<a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-delete.png" width="14" height="14" border="0"/></a>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<img src="/assets/action-generic.png" width="14" height="14" border="0"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<a id="catLn{@nodeID}" href="#" style="padding-left: 6px; display: {$linkStyle}">
|
||||||
|
<xsl:attribute name="onclick">catSelect('<xsl:value-of select="@id"/>', '<xsl:call-template name="escape-apostrophes">
|
||||||
|
<xsl:with-param name="text" select="@fullname"/>
|
||||||
|
</xsl:call-template>', '<xsl:value-of select="@nodeID"/>')</xsl:attribute>
|
||||||
|
|
||||||
|
<xsl:if test="@description">
|
||||||
|
<xsl:attribute name="title">
|
||||||
|
<xsl:value-of select="@description"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</a>
|
||||||
|
<span id="catNm{@nodeID}" style="padding-left: 6px; display: {$nameStyle}">
|
||||||
|
<xsl:if test="@description">
|
||||||
|
<xsl:attribute name="title">
|
||||||
|
<xsl:value-of select="@description"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="@name"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="catCh{@nodeID}" style="margin-left: 20px; display: {$expand}">
|
||||||
|
<xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat">
|
||||||
|
<xsl:sort data-type="number" select="@sortKey"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="forum:categoryWidget" mode="forum:plain">
|
||||||
|
<select name="{@name}" size="30" multiple="multiple">
|
||||||
|
<xsl:apply-templates select="forum:category[position() = 1]/forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat"/>
|
||||||
|
</select>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="forum:category" mode="forum:plainCat">
|
||||||
|
<xsl:if test="@isSelected != '1' and @isAbstract != '1'">
|
||||||
|
<option value="{@sortKey}"><xsl:value-of select="@fullname"/></option>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat">
|
||||||
|
<xsl:sort data-type="number" select="@sortKey"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="escape-apostrophes">
|
||||||
|
<xsl:param name="text"/>
|
||||||
|
<xsl:variable name="apostrophe">'</xsl:variable>
|
||||||
|
<xsl:variable name="escaped-apostrophe">\'</xsl:variable>
|
||||||
|
<xsl:call-template name="do-replace">
|
||||||
|
<xsl:with-param name="text" select="$text"/>
|
||||||
|
<xsl:with-param name="replace" select="$apostrophe"/>
|
||||||
|
<xsl:with-param name="by" select="$escaped-apostrophe"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="do-replace">
|
||||||
|
<xsl:param name="text"/>
|
||||||
|
<xsl:param name="replace"/>
|
||||||
|
<xsl:param name="by"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($text, $replace)">
|
||||||
|
<xsl:value-of select="substring-before($text, $replace)"/>
|
||||||
|
<xsl:value-of select="$by"/>
|
||||||
|
<xsl:call-template name="do-replace">
|
||||||
|
<xsl:with-param name="text" select="substring-after($text, $replace)"/>
|
||||||
|
<xsl:with-param name="replace" select="$replace"/>
|
||||||
|
<xsl:with-param name="by" select="$by"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$text"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--<xsl:template match="bebop:formAction[@name='category'] ">
|
||||||
|
<div class="content">
|
||||||
|
<form action="{@action}" name="{@name}" method="get">
|
||||||
|
<xsl:apply-templates select="bebop:gridPanel/bebop:formWidget[@type='hidden']" />
|
||||||
|
<xsl:apply-templates select="bebop:pageState" />
|
||||||
|
<xsl:apply-templates />
|
||||||
|
<div class="forumButton">
|
||||||
|
<xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget" />
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</xsl:template>-->
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
Loading…
Reference in New Issue