You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/06/01 01:56:17 UTC
svn commit: r543322 - in /roller/trunk/apps/weblogger:
src/java/org/apache/roller/weblogger/planet/ui/ web/WEB-INF/
web/WEB-INF/classes/ web/WEB-INF/jsps/admin/
Author: agilliland
Date: Thu May 31 16:56:16 2007
New Revision: 543322
URL: http://svn.apache.org/viewvc?view=rev&rev=543322
Log:
adding struts2 versions of weblogger planet actions.
Added:
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetConfig.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroupsBean.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptions.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptionsBean.java
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetUIAction.java
roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetConfig.jsp
roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetGroups.jsp
roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetSubscriptions.jsp
Modified:
roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/CreateUser.jsp
roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetConfig.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetConfig.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetConfig.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetConfig.java Thu May 31 16:56:16 2007
@@ -0,0 +1,157 @@
+/*
+ * 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.weblogger.planet.ui;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.planet.business.PlanetFactory;
+import org.apache.roller.planet.business.PropertiesManager;
+import org.apache.roller.planet.pojos.PropertyData;
+import org.apache.struts2.interceptor.ParameterAware;
+
+
+/**
+ * Planet Config Action.
+ *
+ * Handles editing of planet global runtime properties.
+ */
+public class PlanetConfig extends PlanetUIAction implements ParameterAware {
+
+ private static Log log = LogFactory.getLog(PlanetConfig.class);
+
+ // original request parameters
+ private Map parameters = Collections.EMPTY_MAP;
+
+ // runtime properties data
+ private Map properties = Collections.EMPTY_MAP;
+
+
+ public PlanetConfig() {
+ this.actionName = "planetConfig";
+ this.desiredMenu = "admin";
+ this.pageTitle = "";
+ }
+
+
+ @Override
+ public String requiredUserRole() {
+ return "admin";
+ }
+
+ @Override
+ public boolean isWeblogRequired() {
+ return false;
+ }
+
+
+ @Override
+ public void myPrepare() {
+ try {
+ // just grab our properties map and put it in the request
+ PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();
+ setProperties(pMgr.getProperties());
+ } catch (RollerException ex) {
+ log.error("Error loading planet properties");
+ }
+ }
+
+
+ public String execute() {
+ return INPUT;
+ }
+
+
+ public String save() {
+
+ try {
+ // only set values for properties that are already defined
+ String propName = null;
+ PropertyData updProp = null;
+ String incomingProp = null;
+ Iterator propsIT = getProperties().keySet().iterator();
+ while(propsIT.hasNext()) {
+ propName = (String) propsIT.next();
+
+ log.debug("Checking property ["+propName+"]");
+
+ updProp = (PropertyData) getProperties().get(propName);
+ String[] propValues = (String[]) getParameters().get(updProp.getName());
+ if(propValues != null && propValues.length > 0) {
+ // we don't deal with multi-valued props
+ incomingProp = propValues[0];
+ }
+
+ // some special treatment for booleans
+ // this is a bit hacky since we are assuming that any prop
+ // with a value of "true" or "false" is meant to be a boolean
+ // it may not always be the case, but we should be okay for now
+ if( updProp.getValue() != null // null check needed w/Oracle
+ && (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
+
+ if(incomingProp == null || !incomingProp.equals("on"))
+ incomingProp = "false";
+ else
+ incomingProp = "true";
+ }
+
+ // only work on props that were submitted with the request
+ if(incomingProp != null) {
+ log.debug("Setting new value for ["+propName+"]");
+
+ updProp.setValue(incomingProp.trim());
+ }
+ }
+
+ // save it
+ PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();
+ pMgr.saveProperties(this.properties);
+ PlanetFactory.getPlanet().flush();
+
+ addMessage("ConfigForm.message.saveSucceeded");
+
+ } catch (RollerException e) {
+ log.error(e);
+ addError("ConfigForm.error.saveFailed");
+ }
+
+ return INPUT;
+ }
+
+
+ public Map getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map parameters) {
+ this.parameters = parameters;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map properties) {
+ this.properties = properties;
+ }
+
+}
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroups.java Thu May 31 16:56:16 2007
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.roller.weblogger.planet.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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;
+
+
+/**
+ * Manage planet groups.
+ */
+public class PlanetGroups extends PlanetUIAction {
+
+ private static Log log = LogFactory.getLog(PlanetGroups.class);
+
+ // a bean to manage submitted data
+ private PlanetGroupsBean bean = new PlanetGroupsBean();
+
+ // the planet group we are working on
+ private PlanetGroupData group = null;
+
+
+ public PlanetGroups() {
+ this.actionName = "planetGroups";
+ this.desiredMenu = "admin";
+ this.pageTitle = "planetGroups.pagetitle";
+ }
+
+
+ @Override
+ public String requiredUserRole() {
+ return "admin";
+ }
+
+ @Override
+ public boolean isWeblogRequired() {
+ return false;
+ }
+
+
+ @Override
+ public void myPrepare() {
+
+ if(getPlanet() != null && getBean().getId() != null) try {
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ setGroup(pmgr.getGroupById(getBean().getId()));
+ } catch(Exception ex) {
+ log.error("Error looking up planet group - "+getBean().getId(), ex);
+ }
+ }
+
+
+ /**
+ * Show planet groups page.
+ */
+ public String execute() {
+
+ // if we are loading an existing group then populate the bean
+ if(getGroup() != null) {
+ getBean().copyFrom(getGroup());
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Save group.
+ */
+ public String save() {
+
+ myValidate();
+
+ if (!hasActionErrors()) try {
+
+ PlanetGroupData group = getGroup();
+ if(group == null) {
+ log.debug("Adding New Group");
+ group = new PlanetGroupData();
+ group.setPlanet(getPlanet());
+ } else {
+ log.debug("Updating Existing Group");
+ }
+
+ // copy in submitted data
+ getBean().copyTo(group);
+
+ // save and flush
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ pmgr.saveGroup(group);
+ PlanetFactory.getPlanet().flush();
+
+ addMessage("planetGroups.success.saved");
+
+ } catch(Exception ex) {
+ log.error("Error saving planet group - "+getBean().getId(), ex);
+ // TODO: i18n
+ addError("Error saving planet group");
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Delete group, reset form
+ */
+ public String delete() {
+
+ if(getGroup() != null) {
+ try {
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ pmgr.deleteGroup(getGroup());
+ PlanetFactory.getPlanet().flush();
+
+ addMessage("planetSubscription.success.deleted");
+ } catch(Exception ex) {
+ log.error("Error deleting planet group - "+getBean().getId());
+ // TODO: i18n
+ addError("Error deleting planet group");
+ }
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Validate posted group
+ */
+ private void myValidate() {
+
+ if(StringUtils.isEmpty(getBean().getTitle())) {
+ addError("planetGroups.error.title");
+ }
+
+ if(StringUtils.isEmpty(getBean().getHandle())) {
+ addError("planetGroups.error.handle");
+ }
+
+ if(getBean().getHandle() != null && "all".equals(getBean().getHandle())) {
+ addError("planetGroups.error.nameReserved");
+ }
+ }
+
+
+ public List<PlanetGroupData> getGroups() {
+
+ List<PlanetGroupData> displayGroups = new ArrayList();
+
+ Iterator allgroups = getPlanet().getGroups().iterator();
+ while (allgroups.hasNext()) {
+ PlanetGroupData agroup = (PlanetGroupData) allgroups.next();
+
+ // The "all" group is considered a special group and cannot be
+ // managed independently
+ if (!agroup.getHandle().equals("all")) {
+ displayGroups.add(agroup);
+ }
+ }
+
+ return displayGroups;
+ }
+
+
+ public PlanetGroupsBean getBean() {
+ return bean;
+ }
+
+ public void setBean(PlanetGroupsBean bean) {
+ this.bean = bean;
+ }
+
+ public PlanetGroupData getGroup() {
+ return group;
+ }
+
+ public void setGroup(PlanetGroupData group) {
+ this.group = group;
+ }
+
+}
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroupsBean.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroupsBean.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroupsBean.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetGroupsBean.java Thu May 31 16:56:16 2007
@@ -0,0 +1,73 @@
+/*
+ * 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.weblogger.planet.ui;
+
+import org.apache.roller.planet.pojos.PlanetGroupData;
+
+
+/**
+ * A simple bean for managing the form data used by the PlanetGroups.
+ */
+public class PlanetGroupsBean {
+
+ private String id = null;
+ private String title = null;
+ private String handle = null;
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getHandle() {
+ return handle;
+ }
+
+ public void setHandle(String handle) {
+ this.handle = handle;
+ }
+
+
+ public void copyTo(PlanetGroupData dataHolder) {
+
+ dataHolder.setTitle(getTitle());
+ dataHolder.setHandle(getHandle());
+ }
+
+
+ public void copyFrom(PlanetGroupData dataHolder) {
+
+ setId(dataHolder.getId());
+ setTitle(dataHolder.getTitle());
+ setHandle(dataHolder.getHandle());
+ }
+
+}
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptions.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptions.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptions.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptions.java Thu May 31 16:56:16 2007
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.roller.weblogger.planet.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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;
+
+
+/**
+ * Manage planet group subscriptions, default group is "all".
+ */
+public class PlanetSubscriptions extends PlanetUIAction {
+
+ private static final Log log = LogFactory.getLog(PlanetSubscriptions.class);
+
+ // id of the group we are working in
+ private String groupHandle = null;
+
+ // the planet group we are working in
+ private PlanetGroupData group = null;
+
+ // a bean for managing submitted data
+ private PlanetSubscriptionsBean bean = new PlanetSubscriptionsBean();
+
+ // the subscription we are working on
+ private PlanetSubscriptionData subscription = null;
+
+
+ public PlanetSubscriptions() {
+ this.actionName = "planetSubscriptions";
+ this.desiredMenu = "admin";
+ this.pageTitle = "planetSubscriptions.title";
+ }
+
+
+ @Override
+ public String requiredUserRole() {
+ return "admin";
+ }
+
+ @Override
+ public boolean isWeblogRequired() {
+ return false;
+ }
+
+
+ @Override
+ public void myPrepare() {
+
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+
+ // lookup group we are operating on, if none specified then use default
+ if (getGroupHandle() == null) {
+ setGroupHandle("all");
+ }
+
+ try {
+ setGroup(pmgr.getGroup(getPlanet(), getGroupHandle()));
+ } catch (RollerException ex) {
+ log.error("Error looking up planet group - "+getGroupHandle(), ex);
+ }
+
+ // lookup subscription we are working with
+ if(getBean().getId() != null) try {
+ setSubscription(pmgr.getSubscriptionById(getBean().getId()));
+ } catch(Exception ex) {
+ log.error("Error looking up planet subscription - "+getBean().getId(), ex);
+ }
+ }
+
+
+ /**
+ * Populate page model and forward to subscription page
+ */
+ public String execute() {
+
+ if(getSubscription() != null) {
+ getBean().copyFrom(getSubscription());
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Save subscription, add to current group
+ */
+ public String save() {
+
+ myValidate();
+
+ if(!hasActionErrors()) try {
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ PlanetSubscriptionData sub = getSubscription();
+ if(sub == null) {
+ // Adding new subscription to group
+ // Does subscription to that feed already exist?
+ sub = pmgr.getSubscription(getBean().getNewsfeedURL());
+ if (sub != null) {
+ log.debug("Adding Existing Subscription");
+
+ // Subscription already exists
+ addMessage("planetSubscription.foundExisting", sub.getTitle());
+ } else {
+ log.debug("Adding New Subscription");
+
+ // Add new subscription
+ sub = new PlanetSubscriptionData();
+ getBean().copyTo(sub);
+ pmgr.saveSubscription(sub);
+
+ // now that we know our new subs id, keep track of that
+ getBean().setId(sub.getId());
+ }
+
+ // add the subscription to our group
+ getGroup().getSubscriptions().add(sub);
+ sub.getGroups().add(getGroup());
+ pmgr.saveGroup(getGroup());
+ } else {
+ log.debug("Updating Subscription");
+
+ // User editing an existing subscription within a group
+ getBean().copyTo(sub);
+ pmgr.saveSubscription(sub);
+ }
+
+ // flush changes
+ PlanetFactory.getPlanet().flush();
+
+ addMessage("planetSubscription.success.saved");
+
+ } catch (RollerException ex) {
+ log.error("Unexpected error saving subscription", ex);
+ addError("planetSubscriptions.error.duringSave", ex.getRootCauseMessage());
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Delete subscription, reset form
+ */
+ public String delete() {
+
+ if(getSubscription() != null) try {
+
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ getGroup().getSubscriptions().remove(getSubscription());
+ pmgr.deleteSubscription(getSubscription());
+ PlanetFactory.getPlanet().flush();
+
+ addMessage("planetSubscription.success.deleted");
+
+ } catch (RollerException ex) {
+ log.error("Error removing planet subscription", ex);
+ addError("planetSubscription.error.deleting");
+ }
+
+ return LIST;
+ }
+
+
+ /**
+ * Validate posted subscription, fill in blanks via Technorati
+ */
+ private void myValidate() {
+
+ if(StringUtils.isEmpty(getBean().getTitle())) {
+ addError("planetSubscription.error.title");
+ }
+
+ if(StringUtils.isEmpty(getBean().getNewsfeedURL())) {
+ addError("planetSubscription.error.feedUrl");
+ }
+
+ if(StringUtils.isEmpty(getBean().getWebsiteURL())) {
+ addError("planetSubscription.error.siteUrl");
+ }
+ }
+
+
+ public List<PlanetSubscriptionData> getSubscriptions() {
+
+ List<PlanetSubscriptionData> subs = Collections.EMPTY_LIST;
+ if(getGroup() != null) {
+ Set subsSet = getGroup().getSubscriptions();
+ subs = new ArrayList(subsSet);
+ }
+ return subs;
+ }
+
+
+ public String getGroupHandle() {
+ return groupHandle;
+ }
+
+ public void setGroupHandle(String groupHandle) {
+ this.groupHandle = groupHandle;
+ }
+
+ public PlanetGroupData getGroup() {
+ return group;
+ }
+
+ public void setGroup(PlanetGroupData group) {
+ this.group = group;
+ }
+
+ public PlanetSubscriptionsBean getBean() {
+ return bean;
+ }
+
+ public void setBean(PlanetSubscriptionsBean bean) {
+ this.bean = bean;
+ }
+
+ public PlanetSubscriptionData getSubscription() {
+ return subscription;
+ }
+
+ public void setSubscription(PlanetSubscriptionData subscription) {
+ this.subscription = subscription;
+ }
+
+}
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptionsBean.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptionsBean.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptionsBean.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetSubscriptionsBean.java Thu May 31 16:56:16 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.weblogger.planet.ui;
+
+import org.apache.roller.planet.pojos.PlanetSubscriptionData;
+
+
+/**
+ * A simple bean for managing the form data used by the PlanetSubscriptions.
+ */
+public class PlanetSubscriptionsBean {
+
+ private String id = null;
+ private String title = null;
+ private String newsfeedURL = null;
+ private String websiteURL = null;
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getNewsfeedURL() {
+ return newsfeedURL;
+ }
+
+ public void setNewsfeedURL(String newsfeedURL) {
+ this.newsfeedURL = newsfeedURL;
+ }
+
+ public String getWebsiteURL() {
+ return websiteURL;
+ }
+
+ public void setWebsiteURL(String websiteURL) {
+ this.websiteURL = websiteURL;
+ }
+
+
+ public void copyTo(PlanetSubscriptionData dataHolder) {
+
+ dataHolder.setTitle(getTitle());
+ dataHolder.setFeedURL(getNewsfeedURL());
+ dataHolder.setSiteURL(getWebsiteURL());
+ }
+
+
+ public void copyFrom(PlanetSubscriptionData dataHolder) {
+
+ setId(dataHolder.getId());
+ setTitle(dataHolder.getTitle());
+ setNewsfeedURL(dataHolder.getFeedURL());
+ setWebsiteURL(dataHolder.getSiteURL());
+ }
+
+}
Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetUIAction.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetUIAction.java?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetUIAction.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/planet/ui/PlanetUIAction.java Thu May 31 16:56:16 2007
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.roller.weblogger.planet.ui;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.planet.business.PlanetFactory;
+import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.pojos.PlanetData;
+import org.apache.roller.weblogger.ui.struts2.util.UIAction;
+
+
+/**
+ * An extension of the UIAction class specific to the Planet actions.
+ */
+public abstract class PlanetUIAction extends UIAction {
+
+ private static Log log = LogFactory.getLog(PlanetUIAction.class);
+
+ public static final String PLANET_HANDLE = "zzz_default_planet_zzz";
+
+ // the planet used by all Planet actions
+ private PlanetData planet = null;
+
+
+ public PlanetData getPlanet() {
+ if(planet == null) {
+ try {
+ PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
+ planet = pmgr.getPlanetById(PLANET_HANDLE);
+ } catch(Exception ex) {
+ log.error("Error loading weblogger planet - "+PLANET_HANDLE, ex);
+ }
+ }
+ return planet;
+ }
+
+}
Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml?view=diff&rev=543322&r1=543321&r2=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml Thu May 31 16:56:16 2007
@@ -110,7 +110,6 @@
<action name="register!*" method="{1}"
class="org.apache.roller.weblogger.ui.struts2.core.Register">
<result name="input" type="tiles">.Register</result>
- <result name="cancel" type="redirect">/</result>
<result name="success" type="tiles">.Welcome</result>
</action>
@@ -124,7 +123,6 @@
<action name="createWeblog!*" method="{1}"
class="org.apache.roller.weblogger.ui.struts2.core.CreateWeblog">
<result name="input" type="tiles">.CreateWeblog</result>
- <result name="cancel" type="redirect-action">menu</result>
<result name="success" type="chain">menu</result>
</action>
@@ -152,13 +150,11 @@
<action name="createUser!*" method="{1}"
class="org.apache.roller.weblogger.ui.struts2.admin.CreateUser">
<result name="input" type="tiles">.CreateUser</result>
- <result name="cancel" type="redirect-action">userAdmin</result>
</action>
<action name="modifyUser!*" method="{1}"
class="org.apache.roller.weblogger.ui.struts2.admin.ModifyUser">
<result name="input" type="tiles">.ModifyUser</result>
- <result name="cancel" type="redirect-action">userAdmin</result>
</action>
<action name="globalCommentManagement!*" method="{1}"
@@ -190,22 +186,20 @@
</action>
- <!--
<action name="planetConfig!*" method="{1}"
- class="org.apache.roller.weblogger.planet.ui.struts2.admin.PlanetConfigAction">
- <result name="planetConfig.page">.PlanetConfig</result>
+ class="org.apache.roller.weblogger.planet.ui.PlanetConfig">
+ <result name="input" type="tiles">.PlanetConfig</result>
</action>
<action name="planetSubscriptions!*" method="{1}"
- class="org.apache.roller.weblogger.planet.ui.struts2.admin.PlanetSubscriptionsAction">
- <result name="planetSubscriptions.page">.PlanetSubscriptions</result>
+ class="org.apache.roller.weblogger.planet.ui.PlanetSubscriptions">
+ <result name="list" type="tiles">.PlanetSubscriptions</result>
</action>
<action name="planetGroups!*" method="{1}"
- class="org.apache.roller.weblogger.planet.ui.struts2.admin.PlanetGroupsAction">
- <result name="planetGroups.page">.PlanetGroups</result>
+ class="org.apache.roller.weblogger.planet.ui.PlanetGroups">
+ <result name="list" type="tiles">.PlanetGroups</result>
</action>
- -->
</package>
@@ -349,7 +343,6 @@
class="org.apache.roller.weblogger.ui.struts2.editor.TemplateEdit">
<result name="list" type="chain">templates</result>
<result name="input" type="tiles">.TemplateEdit</result>
- <result name="cancel" type="redirect-action">templates</result>
</action>
<action name="templateRemove!*" method="{1}"
Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/CreateUser.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/CreateUser.jsp?view=diff&rev=543322&r1=543321&r2=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/CreateUser.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/CreateUser.jsp Thu May 31 16:56:16 2007
@@ -85,7 +85,7 @@
<div class="control">
<s:submit key="userAdmin.save" />
- <s:submit key="application.cancel" action="createUser!cancel" />
+ <input type="button" value="<s:text name="application.cancel"/>" onclick="window.location='<s:url action="userAdmin"/>'" />
</div>
</s:form>
Added: roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetConfig.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetConfig.jsp?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetConfig.jsp (added)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetConfig.jsp Thu May 31 16:56:16 2007
@@ -0,0 +1,99 @@
+<%--
+ 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.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<%-- Start by parsing our config defs using the jstl xml toolkit --%>
+<%-- Then we'll progress through the config defs and print out the form --%>
+<x:parse var="configDefs">
+ <%= org.apache.roller.planet.config.PlanetRuntimeConfig.getRuntimeConfigDefsAsString() %>
+</x:parse>
+
+
+<p class="subtitle"><s:text name="planetConfig.subtitle" /></a>
+<p><s:text name="planetConfig.prompt" /></a>
+
+<s:form action="planetConfig">
+
+<input type="hidden" name="method" value="update">
+
+ <table class="formtableNoDesc">
+
+ <x:forEach select="$configDefs//config-def[@name='global-properties']/display-group">
+ <c:set var="displayGroupKey"><x:out select="@key"/></c:set>
+
+ <tr>
+ <td colspan="3"><h2><s:text name="${displayGroupKey}" /></h2></td>
+ </tr>
+
+ <x:forEach select="property-def">
+ <c:set var="propLabelKey"><x:out select="@key"/></c:set>
+ <c:set var="name"><x:out select="@name"/></c:set>
+
+ <tr>
+ <td class="label"><s:text name="${propLabelKey}" /></td>
+
+ <%-- choose the right html input element for the display --%>
+ <x:choose>
+
+ <%-- "string" type means use a simple textbox --%>
+ <x:when select="type='string'">
+ <td class="field"><input type="text" name='<c:out value="${name}"/>' value='<c:out value="${PlanetProps[name].value}"/>' size="35" /></td>
+ </x:when>
+
+ <%-- "text" type means use a full textarea --%>
+ <x:when select="type='text'">
+ <td class="field">
+ <textarea name='<c:out value="${name}"/>' rows="<x:out select="rows"/>" cols="<x:out select="cols"/>"><c:out value="${PlanetProps[name].value}"/></textarea>
+ </td>
+ </x:when>
+
+ <%-- "boolean" type means use a checkbox --%>
+ <x:when select="type='boolean'">
+ <c:choose>
+ <c:when test="${PlanetProps[name].value eq 'true'}">
+ <td class="field"><input type="checkbox" name='<c:out value="${name}"/>' CHECKED></td>
+ </c:when>
+ <c:otherwise>
+ <td class="field"><input type="checkbox" name='<c:out value="${name}"/>'></td>
+ </c:otherwise>
+ </c:choose>
+ </x:when>
+
+ <%-- if it's something we don't understand then use textbox --%>
+ <x:otherwise>
+ <td class="field"><input type="text" name='<c:out value="${name}"/>' size="50" /></td>
+ </x:otherwise>
+ </x:choose>
+
+ <td class="description"><%-- <s:text name="" /> --%></td>
+ </tr>
+
+ </x:forEach>
+
+ <tr>
+ <td colspan="2"> </td>
+ </tr>
+
+ </x:forEach>
+
+ </table>
+
+ <s:submit cssClass="buttonBox" key="configForm.save" />
+
+</s:form>
Added: roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetGroups.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetGroups.jsp?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetGroups.jsp (added)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetGroups.jsp Thu May 31 16:56:16 2007
@@ -0,0 +1,121 @@
+<%--
+ 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.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<p class="subtitle"><s:text name="planetGroups.subtitle" /></p>
+
+<p>
+ <s:if test="group == null" >
+ <s:text name="planetGroups.prompt.add" />
+ </s:if>
+ <s:else>
+ <s:text name="planetGroups.prompt.edit" />
+ </s:else>
+</p>
+
+<s:form action="planetGroups!save">
+ <s:hidden name="bean.id" />
+
+ <div class="formrow">
+ <label for="title" class="formrow" /><s:text name="planetGroups.title" /></label>
+ <s:textfield name="bean.title" size="40" maxlength="255" />
+ <img src="<s:url value="/images/help.png"/>" alt="help" title='<s:text name="planetGroups.tip.title" />' />
+ </div>
+
+ <div class="formrow">
+ <label for="handle" class="formrow" /><s:text name="planetGroups.handle" /></label>
+ <s:textfield name="bean.handle" size="40" maxlength="255" />
+ <img src="<s:url value="/images/help.png"/>" alt="help" title='<s:text name="planetGroups.tip.handle" />' />
+ </div>
+
+ <p />
+
+ <div class="formrow">
+ <label class="formrow" /> </label>
+ <s:submit key="planetGroups.button.save" />
+
+ <input type="button"
+ value='<s:text name="planetGroups.button.cancel" />'
+ onclick="window.location='<s:url action="planetGroups"/>'"/>
+
+ <s:if test="group != null" >
+
+ <input type="button"
+ value='<s:text name="planetGroups.button.delete" />'
+ onclick="window.location('')" />
+ </s:if>
+ </div>
+
+</s:form>
+
+<br style="clear:left" />
+
+<h2><s:text name="planetGroups.existingTitle" /></h2>
+<p><i><s:text name="planetGroups.existingPrompt" /></i></p>
+
+<table class="rollertable">
+<tr class="rHeaderTr">
+ <th class="rollertable" width="30%">
+ <s:text name="planetGroups.column.title" />
+ </th>
+ <th class="rollertable" width="50%">
+ <s:text name="planetGroups.column.handle" />
+ </th>
+ <th class="rollertable" width="10%">
+ <s:text name="planetGroups.column.edit" />
+ </th>
+ <th class="rollertable" width="10%">
+ <s:text name="planetGroups.column.subscriptions" />
+ </th>
+</tr>
+
+<s:iterator id="group" value="groups" status="rowstatus">
+ <s:if test="#rowstatus.odd == true">
+ <tr class="rollertable_odd">
+ </s:if>
+ <s:else>
+ <tr class="rollertable_even">
+ </s:else>
+
+ <td class="rollertable">
+ <s:property value="group.title" />
+ </td>
+
+ <td class="rollertable">
+ <s:property value="group.handle" />
+ </td>
+
+ <td class="rollertable">
+ <s:url id="groupUrl" action="planetGroups">
+ <s:param name="bean.id" value="#group.id" />
+ </s:url>
+ <s:a href="%{groupUrl}"><img src='<s:url value="/images/page_white_edit.png"/>' border="0" alt="icon"
+ title="<s:text name='planetGroups.edit.tip' />" /></s:a>
+ </td>
+
+ <td class="rollertable">
+ <s:url id="subUrl" action="planetSubscriptions">
+ <s:param name="groupHandle" value="#group.handle" />
+ </s:url>
+ <s:a href="%{subUrl}"><img src='<s:url value="/images/page_white_edit.png"/>' border="0" alt="icon"
+ title="<s:text name='planetGroups.subscriptions.tip' />" /></s:a>
+ </td>
+
+ </tr>
+</s:iterator>
+</table>
Added: roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetSubscriptions.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetSubscriptions.jsp?view=auto&rev=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetSubscriptions.jsp (added)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/admin/PlanetSubscriptions.jsp Thu May 31 16:56:16 2007
@@ -0,0 +1,138 @@
+<%--
+ 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.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<h1>
+ <s:text name="planetSubscriptions.title" />
+ <s:if test='groupHandle != "all"' >
+ [group: <s:property value="groupHandle" />]
+ </s:if>
+</h1>
+
+
+<s:if test="subscription == null && groupHandle == 'all'" >
+ <p class="subtitle"><s:text name="planetSubscriptions.subtitle.addMain" /></p>
+ <p><s:text name="planetSubscriptions.prompt.addMain" /></p>
+</s:if>
+<s:elseif test="subscription == null">
+ <p class="subtitle">
+ <s:text name="planetSubscriptions.subtitle.add" >
+ <s:param value="groupHandle" />
+ </s:text>
+ </p>
+ <p><s:text name="planetSubscriptions.prompt.add" /></p>
+</s:elseif>
+<s:else>
+ <p class="subtitle"><s:text name="planetSubscriptions.subtitle.edit" /></p>
+ <p><s:text name="planetSubscriptions.prompt.edit" /></p>
+</s:else>
+
+
+<s:form action="planetSubscriptions!save">
+ <s:hidden name="bean.id" />
+ <s:hidden name="groupHandle" />
+
+ <div class="formrow">
+ <label for="title" class="formrow" /><s:text name="planetSubscription.title" /></label>
+ <s:textfield name="bean.title" size="40" maxlength="255" />
+ <img src="<s:url value="/images/help.png"/>" alt="help" title='<s:text name="planetSubscription.tip.title" />' />
+ </div>
+
+ <div class="formrow">
+ <label for="feedURL" class="formrow" /><s:text name="planetSubscription.feedUrl" /></label>
+ <s:textfield name="bean.newsfeedURL" size="40" maxlength="255" />
+ <img src="<s:url value="/images/help.png"/>" alt="help" title='<s:text name="planetSubscription.tip.feedUrl" />' />
+ </div>
+
+ <div class="formrow">
+ <label for="siteURL" class="formrow" /><s:text name="planetSubscription.siteUrl" /></label>
+ <s:textfield name="bean.websiteURL" size="40" maxlength="255" />
+ <img src="<s:url value="/images/help.png"/>" alt="help" title='<s:text name="planetSubscription.tip.siteUrl" />' />
+ </div>
+
+ <p />
+ <div class="formrow">
+ <label class="formrow" /> </label>
+ <s:submit key="planetSubscriptions.button.save" />
+
+ <input type="button"
+ value='<s:text name="planetSubscriptions.button.cancel" />'
+ onclick="window.location('')"/>
+
+ <s:if test="subscription != null" >
+
+ <input type="button"
+ value='<s:text name="planetSubscriptions.button.delete" />'
+ onclick="window.location('')" />
+ </s:if>
+ </div>
+
+</s:form>
+
+<br style="clear:left" />
+
+<h2>
+ <s:text name="planetSubscriptions.existingTitle" />
+ <s:if test="groupHandle != 'all'" >
+ [group: <s:property value="groupHandle" />]
+ </s:if>
+</h2>
+<p><i><s:text name="planetSubscriptions.existingPrompt" /></i></p>
+
+<table class="rollertable">
+ <tr class="rHeaderTr">
+ <th class="rollertable" width="30%">
+ <s:text name="planetSubscriptions.column.title" />
+ </th>
+ <th class="rollertable" width="60%">
+ <s:text name="planetSubscriptions.column.feedUrl" />
+ </th>
+ <th class="rollertable" width="10%">
+ <s:text name="planetSubscriptions.column.edit" />
+ </th>
+ </tr>
+ <s:iterator id="sub" value="subscriptions" status="rowstatus">
+ <s:if test="#rowstatus.odd == true">
+ <tr class="rollertable_odd">
+ </s:if>
+ <s:else>
+ <tr class="rollertable_even">
+ </s:else>
+
+ <td class="rollertable">
+ <s:property value="#sub.title" />
+ </td>
+
+ <td class="rollertable">
+ <str:left count="100" >
+ <s:property value="#sub.feedURL" />
+ </str:left>
+ </td>
+
+ <td class="rollertable">
+ <s:url id="subUrl" action="planetSubscritions">
+ <s:param name="bean.id" value="#sub.id" />
+ <s:param name="groupHandle" value="%{groupHandle}" />
+ </s:url>
+ <s:a href="%{subUrl}"><img src='<c:url value="/images/page_white_edit.png"/>' border="0" alt="icon"
+ title="<s:text name='planetSubscription.edit.tip' />" /></s:a>
+ </td>
+
+ </tr>
+ </s:iterator>
+</table>
Modified: roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml?view=diff&rev=543322&r1=543321&r2=543322
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml Thu May 31 16:56:16 2007
@@ -151,12 +151,12 @@
<put name="content" value="/WEB-INF/jsps/admin/CacheInfo.jsp" />
</definition>
- <definition name=".PlanetSubscriptions" extends=".tiles-tabbedpage" >
- <put name="content" value="/WEB-INF/jsps/admin/PlanetSubscriptions.jsp" />
- </definition>
-
<definition name=".PlanetConfig" extends=".tiles-tabbedpage" >
<put name="content" value="/WEB-INF/jsps/admin/PlanetConfig.jsp" />
+ </definition>
+
+ <definition name=".PlanetSubscriptions" extends=".tiles-tabbedpage" >
+ <put name="content" value="/WEB-INF/jsps/admin/PlanetSubscriptions.jsp" />
</definition>
<definition name=".PlanetGroups" extends=".tiles-tabbedpage" >