geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r956450 - in /geronimo/server/trunk/plugins/console/console-portal-driver/src: main/java/org/apache/geronimo/console/navigation/ main/webapp/WEB-INF/themes/ test/java/org/apache/geronimo/console/navigation/
Date Mon, 21 Jun 2010 06:47:17 GMT
Author: rwonly
Date: Mon Jun 21 03:17:36 2010
New Revision: 956450

URL: http://svn.apache.org/viewvc?rev=956450&view=rev
Log:
GERONIMO-5325 iframe causes some portlets display incorrectly - fix huge blank (Original patch
from Ben, Thanks!)

Modified:
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
    geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
    geronimo/server/trunk/plugins/console/console-portal-driver/src/test/java/org/apache/geronimo/console/navigation/NavigationJsonGeneratorTest.java

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java?rev=956450&r1=956449&r2=956450&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/java/org/apache/geronimo/console/navigation/NavigationJsonGenerator.java
Mon Jun 21 03:17:36 2010
@@ -164,8 +164,11 @@ public class NavigationJsonGenerator {
             sb.append("\n{");
             sb.append("label: \'<img src=\"").append(contextPath).append(node.getIcon()).append("\">&nbsp;");
             sb.append("<span>").append(getLocalizedString(node.getLabel())).append("</span>\'");
-            sb.append(",");
+            sb.append(",");            
             sb.append("name: \'").append(getLocalizedString(node.getLabel())).append("\'");
+            sb.append(",");
+            sb.append("href:\'").append(contextPath + "/portal/" + node.getId() + "/" + node.getPath()
+ "\'");
+
             sb.append("},");
         }
         
@@ -183,54 +186,6 @@ public class NavigationJsonGenerator {
 
     }
     
- public String generateLinks(List<PageConfig> pageConfigList, String contextPath, String
DefaultIcon) {
-        
-        Map<String, TreeNode> navigationTree = new TreeMap<String, TreeNode>();
-        
-        for (PageConfig pc : pageConfigList) {
-            try {
-                new TreeNode(pc).populateTree(navigationTree);
-            } catch (Exception e) {
-                log.error(e.getMessage(),e);
-                continue;
-            }
-        }
-
-        StringBuffer sb = new StringBuffer(10);
-        sb.append("<ul>\n");
-        
-        for (TreeNode node : navigationTree.values()) {
-
-            if (node.isTopNode()) {
-                appendNodeToLinks(sb, node, contextPath, DefaultIcon);
-            }
-
-        }
-
-        sb.append("</ul>");
-        return sb.toString();
-    }
-
-    private void appendNodeToLinks(StringBuffer sb, TreeNode node, String contextPath, String
DefaultIcon) {
-
-        if (node.isLeafNode()) {
-            sb.append("<li>");
-            sb.append("<a href=\"" + contextPath + "/portal/" + node.getId() + "/" + node.getPath()
+ "\">"
-                    + getLocalizedString(node.getLabel()) + "</a>");
-            sb.append("</li>\n");
-        }
-        
-        if (node.getChildren() != null) {
-
-            for (TreeNode child : node.getChildren().values()) {
-                appendNodeToLinks(sb, child, contextPath, DefaultIcon);
-            }
-        
-        }
-
-
-
-    }
     
     private String getLocalizedString(String key) {
 

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp?rev=956450&r1=956449&r2=956450&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/main/webapp/WEB-INF/themes/navigation.jsp
Mon Jun 21 03:17:36 2010
@@ -59,12 +59,6 @@ limitations under the License.
     </tr>
 </table>
 
-<div id="links" style="visibility: hidden; width: 0px; height: 0px;">
-<%=generator.generateLinks(pageConfigList, request.getContextPath(), "/images/ico_doc_16x16.gif")%>
-</div>
-
-
-
 <script type="text/javascript">
 
 <%-- scripts to create the navigation tree--%>
@@ -75,21 +69,7 @@ limitations under the License.
 
    var treeData = <%=treeJson%>;
    var listData = <%=listJson%>;
-   var treeStore;
-
-function load() {
-
-   var listStore= new dojo.data.ItemFileReadStore
-       ({
-       data: {
-           identifier: 'name',
-           label: 'label',
-           items: listData
-           }
-    });
-
-             
-  treeStore = new dojo.data.ItemFileReadStore
+   var treeStore = new dojo.data.ItemFileReadStore
     ({
          data: {
              identifier: 'id',
@@ -97,8 +77,15 @@ function load() {
              items: treeData
              }
      });
-
-       
+    var listStore = new dojo.data.ItemFileReadStore({
+       data: {
+           identifier: 'name',
+           label: 'label',
+           items: listData
+           }
+    });
+function load() {
+      
    var treeModel = new dijit.tree.ForestStoreModel({
        store: treeStore
    });
@@ -114,7 +101,7 @@ function load() {
 
              if(anchorNode)
                 {
-                 displayPortlets(anchorNode);
+                 displayPortlets(anchorNode.href);
                 }                     
             },
             _createTreeNode: function(args) {
@@ -149,26 +136,21 @@ function load() {
          );
   }
 
-   function quickLaunchPortlets(portalPageName){
-
-       var anchors = dojo.byId("links").getElementsByTagName("a"); 
-       
-       for (var i = 0; i < anchors.length; i++) { 
-           anchorName = anchors[i].innerHTML; 
-           if ( anchorName == portalPageName) { 
-               displayPortlets(anchors[i]);
-               if(dijit.byId("navigationTree")){
-                   findAndSelect(portalPageName,dijit.byId("navigationTree").rootNode);
-               }
-               return;
-           }
-       }
-
-   }
+    function quickLaunchPortlets(portalPageName){
+        listStore.fetchItemByIdentity({identity:portalPageName,
+            onItem:function(item){
+                var iframeHref = listStore.getValue(item,"href");
+                displayPortlets(iframeHref);
+            }
+        });
+        if(dijit.byId("navigationTree")){
+            findAndSelect(portalPageName,dijit.byId("navigationTree").rootNode);
+        }
+    }
 
-    function displayPortlets(anchor){
+    function displayPortlets(iframeHref){
     
-        var iframeHref = anchor.href;
+        //var iframeHref = anchor.href;
 
         if(document.location.href.indexOf(iframeHref)==0){      
             iframeHref=document.location.href.substring(0,document.location.href.indexOf("?"));

Modified: geronimo/server/trunk/plugins/console/console-portal-driver/src/test/java/org/apache/geronimo/console/navigation/NavigationJsonGeneratorTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-portal-driver/src/test/java/org/apache/geronimo/console/navigation/NavigationJsonGeneratorTest.java?rev=956450&r1=956449&r2=956450&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-portal-driver/src/test/java/org/apache/geronimo/console/navigation/NavigationJsonGeneratorTest.java
(original)
+++ geronimo/server/trunk/plugins/console/console-portal-driver/src/test/java/org/apache/geronimo/console/navigation/NavigationJsonGeneratorTest.java
Mon Jun 21 03:17:36 2010
@@ -83,20 +83,10 @@ public class NavigationJsonGeneratorTest
     public void testGenerateQuickLauncherJSON() {
         System.out.println("testGenerateQuickLauncherJSON() ------ ");
         String json=navigationJsonGenerator.generateQuickLauncherJSON(pageList, "console",
"/images/ico_deploy_16x16.gif");
-        String expected="[\n\n{label: \'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item1-1-1-1</span>\',name:
\'item1-1-1-1\'},\n{label: \'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item1-2</span>\',name:
\'item1-2\'},\n{label: \'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item2-2</span>\',name:
\'item2-2\'}\n]";
+        String expected="[\n\n{label: \'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item1-1-1-1</span>\',name:
\'item1-1-1-1\',href:\'console/portal/1-1-1-1/cat1/cat1-1/cat1-1-1/item1-1-1-1'},\n{label:
\'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item1-2</span>\',name:
\'item1-2\',href:\'console/portal/1-2/cat1/item1-2\'},\n{label: \'<img src=\"console/images/ico_deploy_16x16.gif\">&nbsp;<span>item2-2</span>\',name:
\'item2-2\',href:\'console/portal/2-2/cat2/item2-2\'}\n]";
        
         System.out.println(json);
         Assert.assertEquals(expected,json);
 
     }
-    
-    public void testGenerateLinks() {
-        System.out.println("testGenerateLinks()------ ");
-        String json=navigationJsonGenerator.generateLinks(pageList, "console", "/images/ico_deploy_16x16.gif");
-        String expected="<ul>\n<li><a href=\"console/portal/1-1-1-1/cat1/cat1-1/cat1-1-1/item1-1-1-1\">item1-1-1-1</a></li>\n<li><a
href=\"console/portal/1-2/cat1/item1-2\">item1-2</a></li>\n<li><a
href=\"console/portal/2-2/cat2/item2-2\">item2-2</a></li>\n</ul>";
-
-        System.out.println(json);
-        Assert.assertEquals(expected,json);
-    }
-
 }



Mime
View raw message