Author: tyrell Date: Fri Jul 11 10:20:22 2008 New Revision: 19152 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19152
Log: Fixing MASHUP-929 Modified: trunk/mashup/java/modules/dashboard/ajax_add_gadget.jsp trunk/mashup/java/modules/dashboard/index.jsp Modified: trunk/mashup/java/modules/dashboard/ajax_add_gadget.jsp URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/dashboard/ajax_add_gadget.jsp?rev=19152&r1=19151&r2=19152&view=diff ============================================================================== --- trunk/mashup/java/modules/dashboard/ajax_add_gadget.jsp (original) +++ trunk/mashup/java/modules/dashboard/ajax_add_gadget.jsp Fri Jul 11 10:20:22 2008 @@ -63,7 +63,7 @@ ArrayList gadgetUrls = (ArrayList) gadgetList.getPropertyValues("GADGET_LIST"); gadgetUrls.add(gadgetUrl); gadgetList.setProperty("GADGET_LIST", gadgetUrls); - } catch (RegistryException e) { + } catch (Exception e) { // Creating the resource gadgetList = new ResourceImpl(); gadgetList.setDescription( Modified: trunk/mashup/java/modules/dashboard/index.jsp URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/dashboard/index.jsp?rev=19152&r1=19151&r2=19152&view=diff ============================================================================== --- trunk/mashup/java/modules/dashboard/index.jsp (original) +++ trunk/mashup/java/modules/dashboard/index.jsp Fri Jul 11 10:20:22 2008 @@ -42,102 +42,105 @@ <!DOCTYPE html> <html> <head> -<title><%= bundle.getString("main.title")%> - Dashboard</title> + <title><%= bundle.getString("main.title")%> - Dashboard</title> -<!-- default container look and feel --> -<link rel="stylesheet" href="css/gadgets.css"> -<script type="text/javascript" src="js/rpc.js?c=1&debug=1"></script> -<script type="text/javascript" src="javascript/cookies.js"></script> -<script type="text/javascript" src="javascript/util.js"></script> -<script type="text/javascript" src="javascript/prototype.js"></script> -<script type="text/javascript" src="javascript/gadgets.js"></script> -<script type="text/javascript" src="javascript/cookiebaseduserprefstore.js"></script> -<script type="text/javascript"> - - if (typeof wso2 == "undefined") { - /** - * The WSO2 global namespace object. If WSO2 is already defined, the - * existing WSO2 object will not be overwritten so that defined - * namespaces are preserved. - * @class wso2 - * @static - */ - var wso2 = {}; - } + <!-- default container look and feel --> + <link rel="stylesheet" href="css/gadgets.css"> + <script type="text/javascript" src="js/rpc.js?c=1&debug=1"></script> + <script type="text/javascript" src="javascript/cookies.js"></script> + <script type="text/javascript" src="javascript/util.js"></script> + <script type="text/javascript" src="javascript/prototype.js"></script> + <script type="text/javascript" src="javascript/gadgets.js"></script> + <script type="text/javascript" src="javascript/cookiebaseduserprefstore.js"></script> + <script type="text/javascript"> + + if (typeof wso2 == "undefined") { + /** + * The WSO2 global namespace object. If WSO2 is already defined, the + * existing WSO2 object will not be overwritten so that defined + * namespaces are preserved. + * @class wso2 + * @static + */ + var wso2 = {}; + } - wso2.dashboard = function() { - }; + wso2.dashboard = function() { + }; - wso2.dashboard.gadgetSpecUrls = [ - <% - // Retrieving the users stored gadgets from the registry location - String gadgetPath = MashupConstants.USERS_PATH + "/" + currentUser + "/gadgets"; - Resource gadgetList; - ArrayList gadgetUrls = null; - try { - gadgetList = userRegistry.get(gadgetPath); - gadgetUrls = (ArrayList) gadgetList.getPropertyValues("GADGET_LIST"); - - Iterator urls = gadgetUrls.iterator(); - boolean firstUrl = true; - while(urls.hasNext()){ - if(firstUrl){ - %> - '<%=(String)urls.next()%>' - <% - firstUrl = false; - }else{ - %> - ,'<%=(String)urls.next()%>' - <% - } + wso2.dashboard.gadgetSpecUrls = [ + <% + // Retrieving the users stored gadgets from the registry location + String gadgetPath = MashupConstants.USERS_PATH + "/" + currentUser + "/gadgets"; + Resource gadgetList; + ArrayList gadgetUrls = null; + try { + gadgetList = userRegistry.get(gadgetPath); + + if(gadgetList.getPropertyValues("GADGET_LIST") != null){ + gadgetUrls = (ArrayList) gadgetList.getPropertyValues("GADGET_LIST"); + + Iterator urls = gadgetUrls.iterator(); + boolean firstUrl = true; + while(urls.hasNext()){ + if(firstUrl){ + %> + '<%=(String)urls.next()%>' + <% + firstUrl = false; + }else{ + %> + ,'<%=(String)urls.next()%>' + <% + } + } + } + } catch (RegistryException e) { + // If there aren't any, adding a default set of gadgets and refreshing + gadgetList = new ResourceImpl(); + gadgetList.setDescription( + "A list of Google Gadget URLs to be displayed in the Dashboard."); + gadgetUrls = new ArrayList(); + gadgetUrls.add("http://www.pramodfanda.info/gadget/top5movies.xml"); + gadgetUrls.add("http://cdn-widgets.demandmedia.com/assets/livestrong/igoogle/gadgets/fitnesstipoftheday/fitnesstipoftheday.xml"); + gadgetUrls.add("http://aruljohn.com/gadget/ip.xml"); + gadgetUrls.add("http://gadget-nasa-iod.googlecode.com/svn/trunk/gadget-nasa-iod.xml"); + gadgetUrls.add("http://www.calculatorcat.com/gmodules/current_moon.xml"); + gadgetUrls.add("http://www.google.com/ig/modules/horoscope.xml"); + gadgetList.setProperty("GADGET_LIST", gadgetUrls); + + try { + userRegistry.put(gadgetPath, gadgetList); + } catch (RegistryException ex) {} } - } catch (RegistryException e) { - // If there aren't any, adding a default set of gadgets and refreshing - gadgetList = new ResourceImpl(); - gadgetList.setDescription( - "A list of Google Gadget URLs to be displayed in the Dashboard."); - gadgetUrls = new ArrayList(); - gadgetUrls.add("http://www.pramodfanda.info/gadget/top5movies.xml"); - gadgetUrls.add("http://cdn-widgets.demandmedia.com/assets/livestrong/igoogle/gadgets/fitnesstipoftheday/fitnesstipoftheday.xml"); - gadgetUrls.add("http://aruljohn.com/gadget/ip.xml"); - gadgetUrls.add("http://gadget-nasa-iod.googlecode.com/svn/trunk/gadget-nasa-iod.xml"); - gadgetUrls.add("http://www.calculatorcat.com/gmodules/current_moon.xml"); - gadgetUrls.add("http://www.google.com/ig/modules/horoscope.xml"); - gadgetList.setProperty("GADGET_LIST", gadgetUrls); - - try { - userRegistry.put(gadgetPath, gadgetList); - } catch (RegistryException ex) {} - } - %> - ]; + %> + ]; - // This container lays out and renders gadgets itself. - wso2.dashboard.LayoutManager = function() { - gadgets.LayoutManager.call(this); - }; - - wso2.dashboard.LayoutManager.inherits(gadgets.LayoutManager); - - wso2.dashboard.LayoutManager.prototype.getGadgetChrome = function(gadget) { - var chromeId = 'gadget-chrome-' + gadget.id; - return chromeId ? document.getElementById(chromeId) : null; - }; - - wso2.dashboard.init = function() { - gadgets.container.layoutManager = new wso2.dashboard.LayoutManager(); - }; - - wso2.dashboard.renderGadgets = function() { - for (var i = 0; i < wso2.dashboard.gadgetSpecUrls.length; ++i) { - var gadget = gadgets.container.createGadget( - {specUrl: wso2.dashboard.gadgetSpecUrls[i], urlIndex: i}); - gadgets.container.addGadget(gadget); - gadgets.container.renderGadget(gadget); - } - }; -</script> + // This container lays out and renders gadgets itself. + wso2.dashboard.LayoutManager = function() { + gadgets.LayoutManager.call(this); + }; + + wso2.dashboard.LayoutManager.inherits(gadgets.LayoutManager); + + wso2.dashboard.LayoutManager.prototype.getGadgetChrome = function(gadget) { + var chromeId = 'gadget-chrome-' + gadget.id; + return chromeId ? document.getElementById(chromeId) : null; + }; + + wso2.dashboard.init = function() { + gadgets.container.layoutManager = new wso2.dashboard.LayoutManager(); + }; + + wso2.dashboard.renderGadgets = function() { + for (var i = 0; i < wso2.dashboard.gadgetSpecUrls.length; ++i) { + var gadget = gadgets.container.createGadget( + {specUrl: wso2.dashboard.gadgetSpecUrls[i], urlIndex: i}); + gadgets.container.addGadget(gadget); + gadgets.container.renderGadget(gadget); + } + }; + </script> </head> <body onLoad="wso2.dashboard.init();wso2.dashboard.renderGadgets()"> <%@ include file="header.jsp" %> @@ -146,47 +149,52 @@ <div id="pageTitle"><%= bundle.getString("main.title")%> - Dashboard</div> </div> <div id="pageBg"> -<div id="addGadgets" nowrap="nowrap"> - <% - if (RegistryUtils.isLoggedIn(userRegistry)) { - %> - [<a href="directory.jsp" class="signAddGadgets" title="Add Gadgets">Add Gadgets</a>] - <% - } else { - %> - [<a href="#" onclick="showSignIn();" class="signAddGadgets" title="Sign-in to Add Gadgets">Sign-in to Add Gadgets</a>] - <% - } - %> -</div> + <div id="addGadgets" nowrap="nowrap"> + <% + if (RegistryUtils.isLoggedIn(userRegistry)) { + %> + [<a href="directory.jsp" class="signAddGadgets" title="Add Gadgets">Add Gadgets</a>] + <% + } else { + %> + [<a href="#" onclick="showSignIn();" class="signAddGadgets" title="Sign-in to Add Gadgets">Sign-in + to Add Gadgets</a>] + <% + } + %> + </div> -<div id="widgets"> - <% - int widgetCount = 0; - if (gadgetUrls != null) { - widgetCount = gadgetUrls.size(); - } + <div id="widgets"> + <% + int widgetCount = 0; + if (gadgetUrls != null) { + widgetCount = gadgetUrls.size(); + } - int currentColumnId = 0; + int currentColumnId = 0; - for (int x = 0; x < widgetCount; x++) { - if (currentColumnId > 2) { - currentColumnId = 0; + for (int x = 0; x < widgetCount; x++) { + if (currentColumnId > 2) { + currentColumnId = 0; + } + %> + <div id="widget_col_<%=currentColumnId%>"> + <div id="gadget-chrome-<%=x%>" class="gadgets-gadget-chrome"></div> + </div> + <% + currentColumnId++; } - %> - <div id="widget_col_<%=currentColumnId%>"> - <div id="gadget-chrome-<%=x%>" class="gadgets-gadget-chrome"></div> - </div> - <% - currentColumnId++; - } - %> -</div> + %> + </div> </div> <br/> + <div id="pageBottomBg"> - <div class="footer"><a href="http://wso2.com/products/mashup/" class="mashupServer" target="_blank" title="WSO2 Mashup Server">WSO2 Mashup Server</a> � 2007-2008 WSO2 Inc.</div> + <div class="footer"><a href="http://wso2.com/products/mashup/" class="mashupServer" + target="_blank" title="WSO2 Mashup Server">WSO2 Mashup Server</a> � + 2007-2008 WSO2 Inc. + </div> </div> </body> </html> _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
