roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r375297 - /incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java
Date Mon, 06 Feb 2006 15:21:32 GMT
Author: snoopdave
Date: Mon Feb  6 07:21:30 2006
New Revision: 375297

URL: http://svn.apache.org/viewcvs?rev=375297&view=rev
Log:
ROL-736: made it possible to add one feed to multiple groups

Modified:
    incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java

Modified: incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java?rev=375297&r1=375296&r2=375297&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java
(original)
+++ incubator/roller/trunk/src/org/roller/presentation/planet/PlanetSubscriptionsAction.java
Mon Feb  6 07:21:30 2006
@@ -182,7 +182,7 @@
         return forward;
     }
     
-    /** Save subscription, add to "external" group */
+    /** Save subscription, add to current group */
     public ActionForward saveSubscription(ActionMapping mapping,
             ActionForm actionForm, HttpServletRequest request,
             HttpServletResponse response) throws IOException, ServletException {
@@ -203,13 +203,24 @@
                 PlanetSubscriptionData sub = null;
                 ActionErrors errors = validate(planet, form);
                 if (errors.isEmpty()) {
-                    if (form.getId() == null || form.getId().trim().length() == 0) {
-                        sub = new PlanetSubscriptionData();
+                    if (form.getId() == null || form.getId().trim().length() == 0) {    
                   
+                        // User adding new subscription to group.                       

+                        // Does form specify a subscription that already exists?
+                        if (form.getFeedUrl() != null) {
+                            sub = planet.getSubscription(form.getFeedUrl());            
              
+                        }
+                        // If not, then create a new one
+                        if (sub == null) {
+                            sub = new PlanetSubscriptionData();   
+                        }
+                        // And add it to the group
                         targetGroup.addSubscription(sub);
+                        
                     } else {
+                        // User editing an existing subscription within a group
                         sub = planet.getSubscriptionById(form.getId());
-                    }
-                    form.copyTo(sub, request.getLocale());
+                        form.copyTo(sub, request.getLocale());                        
+                    }                    
                     form.setGroupHandle(groupHandle);
                     planet.saveSubscription(sub);
                     planet.saveGroup(targetGroup);



Mime
View raw message