Author: julien(a)jboss.com
Date: 2007-01-20 09:59:28 -0500 (Sat, 20 Jan 2007)
New Revision: 6057
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
Modified:
trunk/core-cms/build.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/impl/model/content/cms/CMSContent.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
now content editor can list any content type.
started to do the cms content editor
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/cms/CMSContent.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/cms/CMSContent.java 2007-01-20
12:29:35 UTC (rev 6056)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/cms/CMSContent.java 2007-01-20
14:59:28 UTC (rev 6057)
@@ -24,7 +24,10 @@
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.spi.ContentState;
+import org.jboss.portal.common.util.LocalizedString;
+import java.util.Locale;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -40,6 +43,11 @@
this.state = state;
}
+ public LocalizedString getDisplayName()
+ {
+ return new LocalizedString(state.getURI() + " cms", Locale.ENGLISH);
+ }
+
/**
*
* @return
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-01-20
12:29:35 UTC (rev 6056)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-01-20
14:59:28 UTC (rev 6057)
@@ -24,7 +24,10 @@
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.spi.ContentState;
+import org.jboss.portal.common.util.LocalizedString;
+import java.util.Locale;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -48,6 +51,11 @@
this.state = state;
}
+ public LocalizedString getDisplayName()
+ {
+ return new LocalizedString(state.getURI() + " portlet", Locale.ENGLISH);
+ }
+
/**
*
* @return
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-01-20
12:29:35 UTC (rev 6056)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-01-20
14:59:28 UTC (rev 6057)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.model.content;
+import org.jboss.portal.common.util.LocalizedString;
+
/**
* The content.
*
@@ -30,4 +32,5 @@
*/
public interface Content
{
+ LocalizedString getDisplayName();
}
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-20
12:29:35 UTC (rev 6056)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-01-20
14:59:28 UTC (rev 6057)
@@ -12,6 +12,7 @@
<%@ page import="java.io.PrintWriter" %>
<%@ page
import="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistry" %>
<%@ page import="org.jboss.portal.core.portlet.dashboard.ContentEditor"
%>
+<%@ page import="org.jboss.portal.core.model.content.Content" %>
<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -252,14 +253,11 @@
{
Window window = (Window)j.next();
ContentType contentType = window.getContentType();
- if (ContentType.PORTLET.equals(contentType))
- {
- PortletContent portletContent =
(PortletContent)window.getContent();
+ Content portletContent = window.getContent();
%>
- <option value="<%= window.getName() %>"><%=
portletContent.getInstanceRef() %>
+ <option value="<%= window.getName() %>"><%=
portletContent.getDisplayName().getDefaultString() %>
</option>
<%
- }
}
%>
</select>
Modified: trunk/core-cms/build.xml
===================================================================
--- trunk/core-cms/build.xml 2007-01-20 12:29:35 UTC (rev 6056)
+++ trunk/core-cms/build.xml 2007-01-20 14:59:28 UTC (rev 6057)
@@ -344,14 +344,14 @@
description="Deploy."
depends="output">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <!--<copy file="${build.lib}/jboss-portal.sar"
todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>-->
+ <copy file="${build.lib}/portal-cms.sar"
todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
</target>
<target name="deploy-ha"
description="Deploy high availability."
depends="output-ha">
<require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
- <!--<copy file="${build.lib}/jboss-portal-ha.sar"
todir="${jboss.home}/server/${portal-ha.deploy.dir}"/>-->
+ <copy file="${build.lib}/portal-cms-ha.sar"
todir="${jboss.home}/server/${portal-ha.deploy.dir}"/>
</target>
<!--
@@ -361,14 +361,14 @@
description="Undeploy."
depends="init">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <!--<delete
file="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar"/>-->
+ <delete
file="${jboss.home}/server/${portal.deploy.dir}/portam-cms.sar"/>
</target>
<target name="undeploy-ha"
description="Undeploy."
depends="init">
<require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
- <!--<delete
file="${jboss.home}/server/${portal-ha.deploy.dir}/jboss-portal-ha.sar"/>-->
+ <delete
file="${jboss.home}/server/${portal-ha.deploy.dir}/portal-cms-ha.sar"/>
</target>
<target name="tests" depends="init,
_buildmagic:configure:deployment">
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java
(rev 0)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/editor/CMSContentEditor.java 2007-01-20
14:59:28 UTC (rev 6057)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * 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.editor;
+
+import org.jboss.portal.core.portlet.dashboard.AddWindowContext;
+import org.jboss.portal.core.portlet.dashboard.AbstractContentEditor;
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.ActionRequest;
+import java.io.PrintWriter;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSContentEditor extends AbstractContentEditor
+{
+
+ /** . */
+ private CMS cms;
+
+ public CMS getCMS()
+ {
+ return cms;
+ }
+
+ public void setCMS(CMS cms)
+ {
+ this.cms = cms;
+ }
+
+ public void show(RenderRequest req, PrintWriter writer)
+ {
+ Command cmd = cms.getCommandFactory().createFileGetListCommand("/");
+ List list = (List)cms.execute(cmd);
+ writer.println("<select name=\"available_instances\"
multiple=\"true\" size=\"20\">\n");
+ for (int i = 0; i < list.size(); i++)
+ {
+ File instance = (File)list.get(i);
+ writer.print("<option value=\"");
+ writer.print(instance.getBaseUUID());
+ writer.print("\">");
+ writer.print(instance.getName());
+ writer.println("</option>\n");
+ }
+ writer.println("</select>");
+ }
+
+ public void add(ActionRequest req, AddWindowContext ctx)
+ {
+ // todo
+ }
+}
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-01-20
12:29:35 UTC (rev 6056)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-01-20
14:59:28 UTC (rev 6057)
@@ -626,4 +626,18 @@
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Server</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.cms.editor.CMSContentEditor"
+ name="portal:service=ContentEditor,type=cms"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:registry=ContentEditor</depends>
+ <depends
+ optional-attribute-name="CMS"
+ proxy-type="attribute">portal:service=CMS</depends>
+ <attribute name="ContentType">cms</attribute>
+ </mbean>
</server>