Return-Path: Delivered-To: apmail-incubator-roller-commits-archive@www.apache.org Received: (qmail 70080 invoked from network); 27 Oct 2006 14:51:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Oct 2006 14:51:30 -0000 Received: (qmail 54993 invoked by uid 500); 27 Oct 2006 14:51:41 -0000 Delivered-To: apmail-incubator-roller-commits-archive@incubator.apache.org Received: (qmail 54941 invoked by uid 500); 27 Oct 2006 14:51:41 -0000 Mailing-List: contact roller-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: roller-dev@incubator.apache.org Delivered-To: mailing list roller-commits@incubator.apache.org Received: (qmail 54929 invoked by uid 99); 27 Oct 2006 14:51:41 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Oct 2006 07:51:41 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Oct 2006 07:51:27 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 18F521A984D; Fri, 27 Oct 2006 07:51:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r468397 - in /incubator/roller/trunk/sandbox/planetroller: ./ src/org/apache/roller/planet/ui/forms/ web/WEB-INF/ web/WEB-INF/classes/ web/planet-ui/ web/planet-ui/admin/ Date: Fri, 27 Oct 2006 14:51:05 -0000 To: roller-commits@incubator.apache.org From: snoopdave@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061027145106.18F521A984D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: snoopdave Date: Fri Oct 27 07:51:03 2006 New Revision: 468397 URL: http://svn.apache.org/viewvc?view=rev&rev=468397 Log: OPML import Added: incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/UploadOpmlForm.java incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/uploadOpmlForm.jsp Modified: incubator/roller/trunk/sandbox/planetroller/build.xml incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/SubscriptionForm.java incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/classes/ApplicationResources.properties incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/faces-config.xml incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/web.xml incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/configForm.jsp incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/groupForm.jsp incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/subscriptionForm.jsp incubator/roller/trunk/sandbox/planetroller/web/planet-ui/planet.css Modified: incubator/roller/trunk/sandbox/planetroller/build.xml URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/build.xml?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/build.xml (original) +++ incubator/roller/trunk/sandbox/planetroller/build.xml Fri Oct 27 07:51:03 2006 @@ -74,6 +74,7 @@ + Modified: incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/SubscriptionForm.java URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/SubscriptionForm.java?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/SubscriptionForm.java (original) +++ incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/SubscriptionForm.java Fri Oct 27 07:51:03 2006 @@ -40,7 +40,7 @@ public class SubscriptionForm implements LoadableForm { private ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources"); - private static Log log = LogFactory.getLog(GroupsListForm.class); + private static Log log = LogFactory.getLog(SubscriptionForm.class); private PlanetSubscriptionData subscription = new PlanetSubscriptionData(); private String groupid = null; private String subid = null; @@ -56,8 +56,7 @@ subscription = pmgr.getSubscriptionById(subid); } else { subscription = new PlanetSubscriptionData(); - } - groupid = request.getParameter("groupid"); + } return "editSubscription"; } Added: incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/UploadOpmlForm.java URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/UploadOpmlForm.java?view=auto&rev=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/UploadOpmlForm.java (added) +++ incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/ui/forms/UploadOpmlForm.java Fri Oct 27 07:51:03 2006 @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. The ASF licenses this file to You + * under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. For additional information regarding + * copyright in this work, please see the NOTICE file in the top level + * directory of this distribution. + */ +package org.apache.roller.planet.ui.forms; + +import java.io.InputStreamReader; +import java.util.Iterator; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.myfaces.custom.fileupload.UploadedFile; +import org.apache.roller.RollerException; +import org.apache.roller.planet.business.PlanetFactory; +import org.apache.roller.planet.business.PlanetManager; +import org.apache.roller.planet.pojos.PlanetGroupData; +import org.apache.roller.planet.pojos.PlanetSubscriptionData; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.input.SAXBuilder; + +public class UploadOpmlForm { + private static Log log = LogFactory.getLog(UploadOpmlForm.class); + private String groupid; + private UploadedFile uploadedFile; + + public String load(HttpServletRequest request) throws Exception { + setGroupid(request.getParameter("groupid")); + return "uploadOpml"; + } + + public String presentUploadForm() throws Exception { + FacesContext fctx = FacesContext.getCurrentInstance(); + return load((HttpServletRequest)fctx.getExternalContext().getRequest()); + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public String processUpload() throws Exception { + PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager(); + PlanetGroupData group = pmgr.getGroupById(getGroupid()); + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(new InputStreamReader(uploadedFile.getInputStream())); + Element body = doc.getRootElement().getChild("body"); + Iterator iter = body.getChildren().iterator(); + while (iter.hasNext()) { + Element elem = (Element)iter.next(); + importOpmlElement(group, elem); + } + PlanetFactory.getPlanet().flush(); + return "uploadOpml"; + } + + private void importOpmlElement(PlanetGroupData group, Element elem) throws Exception { + + String text = elem.getAttributeValue("text"); + String title = elem.getAttributeValue("title"); + title = null!=title ? title : text; + + String url = elem.getAttributeValue("url"); + String xmlUrl = elem.getAttributeValue("xmlUrl"); + xmlUrl = null!=xmlUrl ? xmlUrl : url; + + String htmlUrl = elem.getAttributeValue("htmlUrl"); + url = null!=htmlUrl ? htmlUrl : url; + + if (elem.getChildren().size()==0) { + // Leaf element, store a subscription + if (null != title && null != xmlUrl) { + PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager(); + + // If subscription already exists in Planet, just use it + PlanetSubscriptionData sub = pmgr.getSubscription(xmlUrl); + + // Otherwise create a new one + if (sub == null) { + sub = new PlanetSubscriptionData(); + sub.setTitle(title); + sub.setFeedURL(xmlUrl); + sub.setSiteURL(url); + pmgr.saveSubscription(sub); + } + try { + // Save sub and add it to group + sub.getGroups().add(group); + group.getSubscriptions().add(sub); + pmgr.saveSubscription(sub); + pmgr.saveGroup(group); + + } catch (RollerException e) { + log.debug("ERROR: importing subscription with feedURL: " + xmlUrl); + } + } + } else { + // Import folder's children + Iterator iter = elem.getChildren("outline").iterator(); + while ( iter.hasNext() ) { + Element subelem = (Element)iter.next(); + importOpmlElement(group, subelem); + } + } + } + + public String getGroupid() { + return groupid; + } + + public void setGroupid(String groupid) { + this.groupid = groupid; + } +} Modified: incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/classes/ApplicationResources.properties URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/classes/ApplicationResources.properties (original) +++ incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/classes/ApplicationResources.properties Fri Oct 27 07:51:03 2006 @@ -1,7 +1,7 @@ # application wide -appTitle=Planet Roller admin console +appTitle=Roller-Planet admin console appHome=Home appConfig=Config appGroups=Groups @@ -18,10 +18,10 @@ # configForm.jsp -configPageTitle=Planet Roller admin console +configPageTitle=Roller-Planet admin console configFormTitle=Configuration configHelp=You can set the title, description and administrator \ -information to be used in all pages and feeds generated by Planet Roller. \ +information to be used in all pages and feeds generated by Roller-Planet. \ You can also set the default group, the aggregation group that will \ be featured on the front page of the site. configTitle=Planet title @@ -45,7 +45,7 @@ groupReturnToList=Return to groups list groupHelp=You can set the title, handle, descrption and list of feeds for \ each group. What's a group? A group is a collection of RSS or Atom feed \ -subscriptions that will be aggregated together to form a Planet. Planet Roller \ +subscriptions that will be aggregated together to form a Planet. Roller-Planet \ will generate a set of HTML, OPML and RSS files for each group you define. groupHandle=Handle groupTitle=Title @@ -59,13 +59,14 @@ groupSubscriptionName=Handle groupSubscriptionFeedURL=Feed URL groupSubscriptionSiteURL=Site URL +groupUploadOpml=Import OPML subscriptions # groupsList.jsp -groupsPageTitle=Planet Roller groups +groupsPageTitle=Roller-Planet groups groupsListTitle=Groups -groupsHelp=You can define multiple groups within your Planet Roller server, \ -each made up of one or more RSS or Atom feed subscriptions. Planet Roller will \ +groupsHelp=You can define multiple groups within your Roller-Planet server, \ +each made up of one or more RSS or Atom feed subscriptions. Roller-Planet will \ generate a set of HTML, OPML and RSS files for each group you define. Below \ are the groups you've currently got defined. groupsNewGroupName=Group name @@ -80,7 +81,7 @@ # login.jsp -loginPageTitle=Login to Planet Roller admin console +loginPageTitle=Login to Roller-Planet admin console loginUsername=Username loginPassword=Password loginButton=Login @@ -88,10 +89,10 @@ # main.jsp -mainTitle=Welcome to Planet Roller -mainPlanetLink=Main page of Planet Roller site +mainTitle=Welcome to Roller-Planet +mainPlanetLink=Main page of Roller-Planet site mainRegistrationLink=Blog registration page -mainConsoleLink=Planet Roller Admin Console +mainConsoleLink=Roller-Planet Admin Console # registrationForm.jsp @@ -121,10 +122,17 @@ subscriptionPageTitle=Edit subscription subscriptionHelp=A subscription is an RSS or Atom feed that can be included \ -in one or more Planet Roller groups. +in one or more Roller-Planet groups. subscriptionTitle=Title subscriptionName=Handle subscriptionFeedURL=Feed URL subscriptionSiteURL=Site URL subscriptionReturnToGroup=Return to group + +# uploadOpmlForm.jsp + +uploadOpmlPageTitle=Import OPML +uploadOpmlHelp=Import OPML subscriptions to group +uploadOpmlReturnToGroup=Return to group +uploadOpmlButton=Upload Modified: incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/faces-config.xml URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/faces-config.xml?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/faces-config.xml (original) +++ incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/faces-config.xml Fri Oct 27 07:51:03 2006 @@ -7,6 +7,11 @@ session + error + org.apache.roller.planet.ui.utils.ErrorBean + session + + groupsList org.apache.roller.planet.ui.forms.GroupsListForm session @@ -27,9 +32,9 @@ request - error - org.apache.roller.planet.ui.utils.ErrorBean - session + uploadOpmlForm + org.apache.roller.planet.ui.forms.UploadOpmlForm + request /* @@ -57,6 +62,13 @@ editSubscription /planet-ui/admin/subscriptionForm.faces + + + + /* + + uploadOpml + /planet-ui/admin/uploadOpmlForm.faces Modified: incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/web.xml?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/web.xml (original) +++ incubator/roller/trunk/sandbox/planetroller/web/WEB-INF/web.xml Fri Oct 27 07:51:03 2006 @@ -21,6 +21,15 @@ MyFacesExtensionsFilter *.faces + + + uploadMaxFileSize + 500k + + + uploadThresholdSize + 100k + Modified: incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/configForm.jsp URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/configForm.jsp?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/configForm.jsp (original) +++ incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/configForm.jsp Fri Oct 27 07:51:03 2006 @@ -41,7 +41,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -73,7 +73,7 @@ - + Modified: incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/groupForm.jsp URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/groupForm.jsp?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/groupForm.jsp (original) +++ incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/groupForm.jsp Fri Oct 27 07:51:03 2006 @@ -46,7 +46,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -126,6 +126,13 @@ + + + +

+ + + Modified: incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/subscriptionForm.jsp URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/subscriptionForm.jsp?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/subscriptionForm.jsp (original) +++ incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/subscriptionForm.jsp Fri Oct 27 07:51:03 2006 @@ -51,7 +51,7 @@ - + @@ -59,7 +59,7 @@ - @@ -67,7 +67,7 @@ - Added: incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/uploadOpmlForm.jsp URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/uploadOpmlForm.jsp?view=auto&rev=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/uploadOpmlForm.jsp (added) +++ incubator/roller/trunk/sandbox/planetroller/web/planet-ui/admin/uploadOpmlForm.jsp Fri Oct 27 07:51:03 2006 @@ -0,0 +1,65 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. The ASF licenses this file to You + under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. For additional information regarding + copyright in this work, please see the NOTICE file in the top level + directory of this distribution. +--%> +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> +<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %> + + + + + + <h:outputText value="#{msgs.uploadOpmlPageTitle}" /> + + + +

+<%@include file="/planet-ui/admin/menu.jsp" %> + + + +

+

+ + +

+ +

+
+ + + + + +

+ + + +

+ + + + + + + + + Modified: incubator/roller/trunk/sandbox/planetroller/web/planet-ui/planet.css URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/web/planet-ui/planet.css?view=diff&rev=468397&r1=468396&r2=468397 ============================================================================== --- incubator/roller/trunk/sandbox/planetroller/web/planet-ui/planet.css (original) +++ incubator/roller/trunk/sandbox/planetroller/web/planet-ui/planet.css Fri Oct 27 07:51:03 2006 @@ -6,12 +6,11 @@ padding: 15px 20px 15px 20px; } -/* TODO: fix hardcoded context reference */ body { color: #666; - background-image: url(/planet/planet-ui/images/body-bg-grey.png); + background-image: url(images/body-bg-grey.png); background-repeat: no-repeat; - background-position: center; + background-position: top; text-align: center; margin: 0px; padding: 0px; @@ -66,8 +65,7 @@ tr.evenRow { background: #f5f5f5; } -/* TODO: fix hardcoded context reference */ table.data th { - background-image: url(/planet/planet-ui/images/th-bg-grey.png); + background-image: url(images/th-bg-grey.png); }