Author: julien(a)jboss.com
Date: 2007-02-21 19:01:21 -0500 (Wed, 21 Feb 2007)
New Revision: 6371
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java
trunk/core-cms/src/resources/portal-cms-sar/content/
trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml
Modified:
trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml
trunk/core-cms/build.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/tools/etc/buildfragments/modules.ent
Log:
added plugin selection via content type and added embryon of cms plugin
Modified: trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-02-21 22:55:25
UTC (rev 6370)
+++ trunk/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-02-22 00:01:21
UTC (rev 6371)
@@ -90,6 +90,16 @@
</orderEntry>
<orderEntry type="module" module-name="format" />
<orderEntry type="module" module-name="portlet-federation"
/>
+ <orderEntry type="module" module-name="jems" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/el/lib/el-api.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-02-21 22:55:25 UTC
(rev 6370)
+++ trunk/build/ide/intellij/idea60/modules/core-cms/core-cms.iml 2007-02-22 00:01:21 UTC
(rev 6371)
@@ -53,6 +53,7 @@
<orderEntry type="module" module-name="identity" />
<orderEntry type="module" module-name="common" />
<orderEntry type="module" module-name="theme" />
+ <orderEntry type="module" module-name="core-admin" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java 2007-02-21
22:55:25 UTC (rev 6370)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java 2007-02-22
00:01:21 UTC (rev 6371)
@@ -25,9 +25,13 @@
import org.jboss.portal.faces.el.PropertyAccessor;
import org.jboss.portal.core.model.content.ContentType;
+import javax.faces.model.SelectItem;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -42,9 +46,12 @@
/** . */
private PropertyAccessor editors;
+ /** . */
+ private String selectedType;
public ContentEditorRegistryBean()
{
+ selectedType = "portlet";
editors = new PropertyAccessor()
{
public Class getType(Object propertyName)
@@ -73,7 +80,31 @@
return null;
}
+ public List getAvailableTypes()
+ {
+ Set types = registry.getContentTypes();
+ List items = new ArrayList(types.size());
+ for (Iterator i = types.iterator();i.hasNext();)
+ {
+ ContentType def = (ContentType)i.next();
+ SelectItem item = new SelectItem();
+ item.setValue(def.toString());
+ item.setLabel(def.toString());
+ items.add(item);
+ }
+ return items;
+ }
+ public String getSelectedType()
+ {
+ return selectedType;
+ }
+
+ public void setSelectedType(String selectedType)
+ {
+ this.selectedType = selectedType;
+ }
+
public ContentEditorRegistry getRegistry()
{
return registry;
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java 2007-02-21
22:55:25 UTC (rev 6370)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java 2007-02-22
00:01:21 UTC (rev 6371)
@@ -55,6 +55,9 @@
private final TagAttribute src;
/** . */
+ private final TagAttribute contentType;
+
+ /** . */
private final TagAttribute contentURI;
public ContentEditorTagHandler(TagConfig tagConfig)
@@ -64,6 +67,7 @@
//
this.src = this.getRequiredAttribute("src");
this.contentURI = this.getRequiredAttribute("contentURI");
+ this.contentType = this.getRequiredAttribute("contentType");
}
public ContentEditorRegistry getRegistry()
@@ -79,10 +83,22 @@
public void apply(FaceletContext ctx, UIComponent parent) throws IOException,
FacesException, FaceletException, ELException
{
ExpressionFactory f = ctx.getExpressionFactory();
+
ValueExpression ve = f.createValueExpression(ctx,
"#{applicationScope.ContentEditorRegistry}", ContentEditorRegistry.class);
ContentEditorRegistry registry = (ContentEditorRegistry)ve.getValue(ctx);
- FaceletContentEditor editor =
(FaceletContentEditor)registry.getEditor(ContentType.PORTLET);
+
+ // Get content type value
+ ValueExpression contentTypeValue = contentType.getValueExpression(ctx,
Object.class);
+ String contentTypeString = (String)contentTypeValue.getValue(ctx);
+ ContentType ct = ContentType.create(contentTypeString);
+
+ // Get editor
+ FaceletContentEditor editor = (FaceletContentEditor)registry.getEditor(ct);
+
+ // Get editor URL
URL url = editor.getFaceletURL();
+
+ // Do the include stuff
VariableMapper orig = ctx.getVariableMapper();
ctx.setVariableMapper(new VariableMapperWrapper(orig));
try
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml 2007-02-21
22:55:25 UTC (rev 6370)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml 2007-02-22
00:01:21 UTC (rev 6371)
@@ -148,13 +148,23 @@
<h:outputText style="font-weight:bold;" value="Type: "/>
<f:verbatim>Window<br/></f:verbatim>
+ <h:form id="content_type_form">
+ <h:selectOneMenu
+ value="#{registry.selectedType}">
+ <f:selectItems value="#{registry.availableTypes}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Change content type"/>
+ </h:form>
+
<h:form id="window_form">
<ct:content
src="bilto_src"
+ contentType="#{registry.selectedType}"
contentURI="#{portalobjectmgr.selectedObject.instanceRef}"/>
<br/>
<h:commandButton value="Change instance"/>
</h:form>
+
<h:outputLink value="#{portalobjectmgr.previewURL}" title="Preview
link" target="_blank">Preview link</h:outputLink>
</h:panelGroup>
Modified: trunk/core-cms/build.xml
===================================================================
--- trunk/core-cms/build.xml 2007-02-21 22:55:25 UTC (rev 6370)
+++ trunk/core-cms/build.xml 2007-02-22 00:01:21 UTC (rev 6371)
@@ -133,6 +133,7 @@
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-core.classpath"/>
<path refid="jboss.portal-workflow.classpath"/>
+ <path refid="jboss.portal-core-admin.classpath"/>
</path>
<!--+=======================================+-->
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java
(rev 0)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java 2007-02-22
00:01:21 UTC (rev 6371)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.cms.content;
+
+import org.jboss.portal.core.portlet.management.content.AbstractFaceletContentEditor;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSFaceletContentEditor extends AbstractFaceletContentEditor
+{
+}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-21
22:55:25 UTC (rev 6370)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-22
00:01:21 UTC (rev 6371)
@@ -686,6 +686,19 @@
<attribute name="ContentType">cms</attribute>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.cms.content.CMSFaceletContentEditor"
+ name="portal:service=ContentEditor,type=cms2"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="ContentType">cms</attribute>
+ <attribute
name="FaceletPath">content/editor.xhtml</attribute>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:service=ContentEditorRegistry2</depends>
+ </mbean>
+
<!-- Content renderer integration -->
<mbean
code="org.jboss.portal.core.cms.content.CMSContentRenderer"
Added: trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml
(rev 0)
+++ trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml 2007-02-22 00:01:21
UTC (rev 6371)
@@ -0,0 +1,9 @@
+<div
+
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+ <h:outputText value="TOTO"/>
+
+</div>
\ No newline at end of file
Modified: trunk/tools/etc/buildfragments/modules.ent
===================================================================
--- trunk/tools/etc/buildfragments/modules.ent 2007-02-21 22:55:25 UTC (rev 6370)
+++ trunk/tools/etc/buildfragments/modules.ent 2007-02-22 00:01:21 UTC (rev 6371)
@@ -99,6 +99,13 @@
<pathelement
path="${jboss.portal-core.lib}/jboss-portlet-api-lib.jar"/>
</path>
+ <!-- core-admin -->
+ <property name="jboss.portal-core-admin.root"
value="${project.root}/core-admin/output"/>
+ <property name="jboss.portal-core-admin.lib"
value="${jboss.portal-core-admin.root}/lib"/>
+ <path id="jboss.portal-core-admin.classpath">
+ <pathelement
path="${jboss.portal-core-admin.lib}/portal-core-admin-lib.jar"/>
+ </path>
+
<!-- core-cms -->
<property name="jboss.portal-core-cms.root"
value="${project.root}/core-cms/output"/>
<property name="jboss.portal-core-cms.lib"
value="${jboss.portal-core-cms.root}/lib"/>