Update of 
/var/cvs/contributions/CMSContainer_Modules/subsite/src/java/com/finalist/cmsc/subsite/forms
In directory 
james.mmbase.org:/tmp/cvs-serv10025/subsite/src/java/com/finalist/cmsc/subsite/forms

Modified Files:
        SubSiteAction.java 
Log Message:
CMSC-617 Personal Pages module
Synced branch 1.4 fixes to head


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/subsite/src/java/com/finalist/cmsc/subsite/forms
See also: http://www.mmbase.org/jira/browse/CMSC-617


Index: SubSiteAction.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/subsite/src/java/com/finalist/cmsc/subsite/forms/SubSiteAction.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- SubSiteAction.java  17 Mar 2008 11:39:14 -0000      1.7
+++ SubSiteAction.java  31 Mar 2008 19:49:02 -0000      1.8
@@ -51,24 +51,26 @@
    private static Logger log = 
Logging.getLoggerInstance(SearchAction.class.getName());
 
    @Override
-   public ActionForward execute(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response, Cloud cloud) throws 
Exception {
+   public ActionForward execute(ActionMapping mapping, ActionForm form,
+         HttpServletRequest request, HttpServletResponse response, Cloud cloud)
+         throws Exception {
 
       // Initialize
       SearchForm searchForm = (SearchForm) form;
 
       String subsite = request.getParameter("subsite");
 
-      /*
-       * Purpose of this file - retrieve list of subsites - retrieve list of
-       * pages if channel parameter (subsite) is given (or only 1 subsite
-       * exists) -> and put it in a List
+      /* Purpose of this file
+       * - retrieve list of subsites
+       * - retrieve list of pages if 
+       *      channel parameter (subsite) is given (or only 1 subsite exists) 
+       *      -> and put it in a List 
        */
 
-      // Retrieve list of pages of subsite
+      //Retrieve list of pages of subsite
       Node subsiteNode = null;
       if (StringUtils.isBlank(subsite) || !cloud.hasNode(subsite)) {
-         // If the subsiteNode does not exist or is not valid, get the first
-         // found subsite
+          //If the subsiteNode does not exist or is not valid, get the first 
found subsite
          NodeManager nm = cloud.getNodeManager(SubSiteUtil.SUBSITE);
          NodeQuery subsitesQuery = nm.createQuery();
          SearchUtil.addLimitConstraint(subsitesQuery, 0, 1);
@@ -77,20 +79,22 @@
          if (results.size() > 0) {
             subsiteNode = (Node) results.get(0);
          }
-      } else {
+      }
+      else {
          subsiteNode = cloud.getNode(subsite);
       }
 
-      if (subsiteNode == null) {
-         // If there are no subsites at all, return an empty list
+      if (subsiteNode != null){
+         request.setAttribute("subsite", 
String.valueOf(subsiteNode.getNumber()));
+      }
+         
+         if (subsiteNode == null){ //If there are no subsites at all, return 
empty list
          searchForm.setResultCount(0);
          NodeList results = cloud.createNodeList();
          searchForm.setResults(results);
          return mapping.findForward(SUCCESS);
       }
 
-      request.setAttribute("subsite", String.valueOf(subsiteNode.getNumber()));
-
       NodeManager nodeManager = subsiteNode.getNodeManager();
       // Order the result by:
       String order = searchForm.getOrder();
@@ -122,7 +126,7 @@
       searchForm.setKeywords(resultsPerPage);
 
       String direction = null;
-      NodeQuery query = createLinkedElementsQuery(subsiteNode, order, 
direction, offset * maxNumber, maxNumber, -1, -1, -1);
+      NodeQuery query = createLinkedElementsQuery(subsiteNode, order, 
direction, offset*maxNumber, maxNumber, -1, -1, -1);
 
       // Add the title constraint:
       if (!StringUtil.isEmpty(searchForm.getTitle())) {
@@ -158,16 +162,16 @@
       cal.set(Calendar.SECOND, 0);
       cal.set(Calendar.MILLISECOND, 0);
 
-      if (year != -1 || month != -1 || day != -1) {
-         Field field = 
query.getCloud().getNodeManager(destinationManager).getField("publishdate"); // 
Does this work?
+       if(year != -1 || month != -1 || day != -1) {
+         Field field = 
query.getCloud().getNodeManager(destinationManager).getField("publishdate"); 
//Does this work?
          StepField basicStepField = query.getStepField(field);
-         if (year != -1) {
+          if(year != -1) {
             SearchUtil.addConstraint(query, new 
BasicFieldValueDateConstraint(basicStepField, new Integer(year), 
FieldValueDateConstraint.YEAR));
          }
-         if (month != -1) {
+          if(month != -1) {
             SearchUtil.addConstraint(query, new 
BasicFieldValueDateConstraint(basicStepField, new Integer(month), 
FieldValueDateConstraint.MONTH));
          }
-         if (day != -1) {
+          if(day != -1) {
             SearchUtil.addConstraint(query, new 
BasicFieldValueDateConstraint(basicStepField, new Integer(day), 
FieldValueDateConstraint.DAY_OF_MONTH));
          }
       }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to