Author: solomax
Date: Wed May  8 14:49:18 2013
New Revision: 1480309

URL: http://svn.apache.org/r1480309
Log:
[OPENMEETINGS-612] RSS widget is implemented

Added:
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/UserHelper.java
Modified:
    openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cli/Admin.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/installation/ImportInitvalues.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/Configuration.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/user/User.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/rss/LoadAtomRssFeed.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.html
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.java
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.html
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.java

Modified: openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css 
(original)
+++ openmeetings/trunk/singlewebapp/WebContent/openmeetings/css/theme.css Wed 
May  8 14:49:18 2013
@@ -596,3 +596,7 @@ div.tableWrapper {
 .widget td {
        min-width: 150px;
 }
+#feedcontainer {
+       height: 300px;
+       overflow: auto;
+}
\ No newline at end of file

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cli/Admin.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cli/Admin.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cli/Admin.java 
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/cli/Admin.java 
Wed May  8 14:49:18 2013
@@ -18,6 +18,9 @@
  */
 package org.apache.openmeetings.cli;
 
+import static org.apache.openmeetings.utils.UserHelper.getMinPasswdLength;
+import static org.apache.openmeetings.utils.UserHelper.invalidPassword;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
@@ -37,6 +40,7 @@ import org.apache.commons.cli.Parser;
 import org.apache.commons.cli.PosixParser;
 import org.apache.commons.transaction.util.FileHelper;
 import org.apache.openjpa.jdbc.meta.MappingTool;
+import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
 import org.apache.openmeetings.data.file.dao.FileExplorerItemDao;
 import org.apache.openmeetings.data.flvrecord.FlvRecordingDao;
 import org.apache.openmeetings.data.user.dao.UsersDao;
@@ -94,7 +98,7 @@ public class Admin {
                options.addOption(new OmOption("i", "email", null, true, "Email 
of the default user (mutually exclusive with 'file')"));
                options.addOption(new OmOption("i", "group", null, true, "The 
name of the default user group (mutually exclusive with 'file')"));
                options.addOption(new OmOption("i", "tz", null, true, "Default 
server time zone, and time zone for the selected user (mutually exclusive with 
'file')"));
-               options.addOption(new OmOption("i", null, "password", true, 
"Password of the default user, minimum " + 
InstallationConfig.USER_LOGIN_MINIMUM_LENGTH + " characters (will be prompted 
if not set)", true));
+               options.addOption(new OmOption("i", null, "password", true, 
"Password of the default user, minimum " + 
InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH + " characters (will be 
prompted if not set)", true));
                options.addOption(new OmOption("i", null, 
"system-email-address", true, "System e-mail address [default: " + 
cfg.mailReferer + "]", true));
                options.addOption(new OmOption("i", null, "smtp-server", true, 
"SMTP server for outgoing e-mails [default: " + cfg.smtpServer + "]", true));
                options.addOption(new OmOption("i", null, "smtp-port", true, 
"SMTP server for outgoing e-mails [default: " + cfg.smtpPort + "]", true));
@@ -545,11 +549,12 @@ public class Admin {
                        System.exit(1);
                }
                admin.pass = cmdl.getOptionValue("password");
-               if (checkPassword(admin.pass)) {
+               ConfigurationDao cfgDao = 
getApplicationContext(ctxName).getBean(ConfigurationDao.class);
+               if (invalidPassword(admin.pass, cfgDao)) {
                        System.out.print("Please enter password for the user '" 
+ admin.login + "':");
                        admin.pass = new BufferedReader(new 
InputStreamReader(System.in)).readLine();
-                       if (checkPassword(admin.pass)) {
-                               System.out.println("Password was not provided, 
or too short, should be at least " + 
InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH + " character long.");
+                       if (invalidPassword(admin.pass, cfgDao)) {
+                               System.out.println("Password was not provided, 
or too short, should be at least " + getMinPasswdLength(cfgDao) + " character 
long.");
                                System.exit(1);
                        }
                }
@@ -571,10 +576,6 @@ public class Admin {
                return admin;
        }
        
-       private boolean checkPassword(String pass) {
-               return (pass == null || pass.length() < 
InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH);
-       }
-       
        public static void dropDB() throws Exception {
                File conf = new File(OmFileHelper.getWebinfDir(), 
PERSISTENCE_NAME);
                ConnectionProperties connectionProperties = 
ConnectionPropertiesPatcher.getConnectionProperties(conf);

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/installation/ImportInitvalues.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/installation/ImportInitvalues.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/installation/ImportInitvalues.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/installation/ImportInitvalues.java
 Wed May  8 14:49:18 2013
@@ -18,12 +18,16 @@
  */
 package org.apache.openmeetings.installation;
 
+import static 
org.apache.openmeetings.installation.InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.CRYPT_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.DASHBOARD_SHOW_MYROOMS_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.DASHBOARD_SHOW_RSS_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.DEFAUT_LANG_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.FRONTEND_REGISTER_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.MAX_UPLOAD_SIZE_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.PASS_MIN_LENGTH_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED1_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED2_KEY;
 
 import java.io.File;
 import java.util.Arrays;
@@ -343,10 +347,10 @@ public class ImportInitvalues {
                                                null,
                                                "The path to JOD library 
(http://code.google.com/p/jodconverter), configure the path to point to the lib 
directory of JOD that contains also the jodconverter-core-version.jar");
 
-               configurationDao.add("rss_feed1", cfg.urlFeed, null,
+               configurationDao.add(RSS_FEED1_KEY, cfg.urlFeed, null,
                                "Feed URL");
 
-               configurationDao.add("rss_feed2", cfg.urlFeed2, null,
+               configurationDao.add(RSS_FEED2_KEY, cfg.urlFeed2, null,
                                "Feed URL 2");
 
                configurationDao
@@ -444,8 +448,8 @@ public class ImportInitvalues {
                                + InstallationConfig.USER_LOGIN_MINIMUM_LENGTH, 
null,
                                "Number of chars needed in a user login");
 
-               configurationDao.add("user.pass.minimum.length", ""
-                               + 
InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH, null,
+               configurationDao.add(PASS_MIN_LENGTH_KEY, ""
+                               + USER_PASSWORD_MINIMUM_LENGTH, null,
                                "Number of chars needed in a user login");
 
                configurationDao

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/Configuration.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/Configuration.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/Configuration.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/Configuration.java
 Wed May  8 14:49:18 2013
@@ -65,6 +65,7 @@ public class Configuration implements Se
        public static final String RSS_FEED1_KEY = "rss_feed1";
        public static final String RSS_FEED2_KEY = "rss_feed2";
        public static final String FRONTEND_REGISTER_KEY = 
"allow_frontend_register";
+       public static final String PASS_MIN_LENGTH_KEY = 
"user.pass.minimum.length";
 
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/user/User.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/user/User.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/user/User.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/user/User.java
 Wed May  8 14:49:18 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.openmeetings.persistence.beans.user;
 
+import static org.apache.openmeetings.utils.UserHelper.invalidPassword;
+
 import java.io.Serializable;
 import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
@@ -369,12 +371,7 @@ public class User implements Serializabl
        
        public void updatePassword(ManageCryptStyle crypt, ConfigurationDao 
configDao, String pass, boolean empty) throws NoSuchAlgorithmException {
                if (!empty) {
-                       Integer userPassMinimumLength = 
configDao.getConfValue("user.pass.minimum.length", Integer.class, "4");
-       
-                       if (userPassMinimumLength == null) {
-                               throw new 
RuntimeException("user.pass.minimum.length problem");
-                       }
-                       if (pass == null || pass.length() < 
userPassMinimumLength) {
+                       if (invalidPassword(pass, configDao)) {
                                throw new RuntimeException("Password of invalid 
length is provided");
                        }
                }

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
 Wed May  8 14:49:18 2013
@@ -22,6 +22,7 @@ import static org.apache.openmeetings.pe
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.DASHBOARD_SHOW_RSS_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.FRONTEND_REGISTER_KEY;
 import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.MAX_UPLOAD_SIZE_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.PASS_MIN_LENGTH_KEY;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -730,7 +731,7 @@ public class MainService implements IPen
        public List<Configuration> getLoginOptions(String SID) {
                try {
                        return configurationDao.get(FRONTEND_REGISTER_KEY, 
"show.facebook.login",
-                                       "user.login.minimum.length", 
"user.pass.minimum.length", "user.pass.minimum.length",
+                                       "user.login.minimum.length", 
PASS_MIN_LENGTH_KEY, PASS_MIN_LENGTH_KEY,
                                        "ldap_default_id");
                } catch (Exception err) {
                        log.error("[getLoginOptions]", err);

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/rss/LoadAtomRssFeed.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/rss/LoadAtomRssFeed.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/rss/LoadAtomRssFeed.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/rss/LoadAtomRssFeed.java
 Wed May  8 14:49:18 2013
@@ -18,6 +18,10 @@
  */
 package org.apache.openmeetings.rss;
 
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED1_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED2_KEY;
+
+import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Iterator;
@@ -49,10 +53,10 @@ public class LoadAtomRssFeed {
                        if (authLevelmanagement.checkUserLevel(user_level)) {
                                LinkedHashMap<String, LinkedHashMap<String, 
LinkedHashMap<String, LinkedHashMap<String, Object>>>> returnMap = new 
LinkedHashMap<String, LinkedHashMap<String, LinkedHashMap<String, 
LinkedHashMap<String, Object>>>>();
 
-                               String url1 = 
configurationDao.getConfValue("rss_feed1", String.class, "");
+                               String url1 = 
configurationDao.getConfValue(RSS_FEED1_KEY, String.class, "");
                                returnMap.put("feed1", this.parseRssFeed(url1));
 
-                               String url2 = 
configurationDao.getConfValue("rss_feed2", String.class, "");
+                               String url2 = 
configurationDao.getConfValue(RSS_FEED2_KEY, String.class, "");
                                returnMap.put("feed2", this.parseRssFeed(url2));
 
                                return returnMap;
@@ -66,6 +70,18 @@ public class LoadAtomRssFeed {
                return null;
        }
 
+       public static HttpURLConnection getFeedConnection(String _url) throws 
IOException {
+               URL url = new URL(_url);
+
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+
+               conn.setDoOutput(true);
+               conn.setDoInput(true);
+               conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; 
MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)");
+               conn.setRequestProperty("Referer", 
"http://openmeetings.apache.org/";);
+               return conn;
+       }
+       
        public LinkedHashMap<String, LinkedHashMap<String, 
LinkedHashMap<String, Object>>> parseRssFeed(
                        String urlEndPoint) {
                try {

Added: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/UserHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/UserHelper.java?rev=1480309&view=auto
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/UserHelper.java
 (added)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/UserHelper.java
 Wed May  8 14:49:18 2013
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+package org.apache.openmeetings.utils;
+
+import static 
org.apache.openmeetings.installation.InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.PASS_MIN_LENGTH_KEY;
+
+import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
+
+public class UserHelper {
+       public static int getMinPasswdLength(ConfigurationDao cfgDao) {
+               return cfgDao.getConfValue(PASS_MIN_LENGTH_KEY, Integer.class, 
"" + USER_PASSWORD_MINIMUM_LENGTH);
+       }
+       
+       public static boolean invalidPassword(String pass, ConfigurationDao 
cfgDao) {
+               return (pass == null || pass.length() < 
getMinPasswdLength(cfgDao));
+       }
+}

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.html
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.html?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.html
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.html
 Wed May  8 14:49:18 2013
@@ -21,7 +21,9 @@
 <html xmlns:wicket="http://wicket.apache.org";>
 <wicket:head>
        <script type="text/javascript">
-               function getItems(url) {
+               var MAX_ITEM_COUNT = 5;
+               function getRssItems(url, next) {
+                       //TODO items need to be merged and sorted by date
                        $.ajax({
                                url: url
                                , type: 'GET'
@@ -29,6 +31,7 @@
                                , dataType: 'xml'
                                , success: function(data, status, xhr) {
                                        var $xml = $(data);
+                                       var counter = MAX_ITEM_COUNT;
                                        $xml.find("item").each(function() {
                                                var $this = $(this), item = {
                                                        title : 
$this.find("title").text(),
@@ -38,28 +41,45 @@
                                                        author : 
$this.find("author").text()
                                                }
                                                addItem(item);
+                                               if (--counter < 0) {
+                                                       return false;
+                                               }
                                        });
+                                       counter = MAX_ITEM_COUNT;
                                        $xml.find("entry").each(function() {
                                                var $this = $(this), item = {
                                                        title : 
$this.find("title").text(),
                                                        link : 
$this.find("link").text(),
-                                                       description : 
$this.find("summary").text(),
+                                                       description : 
$this.find("content"),
                                                        pubDate : 
$this.find("published").text(),
                                                        author : 
$this.find("author").text()
                                                }
                                                addItem(item);
+                                               if (--counter < 0) {
+                                                       return false;
+                                               }
                                        });
+                                       if (next) {
+                                               getRssItems(next, null)
+                                       } else {
+                                               
$('#feeds').accordion({collapsible: true, active: false, header: 'h3'});
+                                       }
                                }
                        });
                }
-               
                function addItem(item) {
-                       $('#feeds').append('<div class="item"><div 
class="title">' + item.title + '</div><div class="desc">' + item.description
-                                       + '</div></div>');
+                       //TODO need to be checked
+                       $('#feeds').append('<h3>' + item.title + '</h3>')
+                               
.append($('<div></div>').append(item.description));
+               }
+               function loadRssTab(url1, url2) {
+                       $('#feedcontainer').html('');
+                       $('#feedcontainer').append('<div id="feeds"></div>');
+                       getRssItems(url1, url2);
                }
        </script>
 </wicket:head>
 <wicket:panel>
-       <div id="feeds"></div>
+       <div id="feedcontainer"></div>
 </wicket:panel>
 </html>

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/dashboard/RssWidgetView.java
 Wed May  8 14:49:18 2013
@@ -18,32 +18,78 @@
  */
 package org.apache.openmeetings.web.components.user.dashboard;
 
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED1_KEY;
+import static 
org.apache.openmeetings.persistence.beans.basic.Configuration.RSS_FEED2_KEY;
+import static org.apache.openmeetings.rss.LoadAtomRssFeed.getFeedConnection;
 import static org.apache.openmeetings.web.app.Application.getBean;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+
 import org.apache.openmeetings.data.basic.dao.ConfigurationDao;
+import org.apache.wicket.behavior.AbstractAjaxBehavior;
 import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 import org.apache.wicket.model.Model;
+import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
+import org.apache.wicket.request.resource.ContentDisposition;
+import org.apache.wicket.util.resource.AbstractResourceStream;
+import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
 
 import ro.fortsoft.wicket.dashboard.Widget;
 import ro.fortsoft.wicket.dashboard.web.WidgetView;
 
 public class RssWidgetView extends WidgetView {
        private static final long serialVersionUID = -6257866996099503210L;
+       private RSSFeedBehavior feed1; 
+       private RSSFeedBehavior feed2; 
 
        public RssWidgetView(String id, Model<Widget> model) {
                super(id, model);
+               ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
+               add(feed1 = new 
RSSFeedBehavior(cfgDao.getConfValue(RSS_FEED1_KEY, String.class, "")));
+               add(feed2 = new 
RSSFeedBehavior(cfgDao.getConfValue(RSS_FEED2_KEY, String.class, "")));
        }
        
        @Override
        public void renderHead(IHeaderResponse response) {
                super.renderHead(response);
-               ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
-               //FIXME refactor this link to XML resoursce should be generated 
here
-               /*
-               response.render(OnDomReadyHeaderItem.forScript("getNews('"
-                               + cfgDao.getConfValue(RSS_FEED1_KEY, 
String.class, "") + ","
-                               + cfgDao.getConfValue(RSS_FEED2_KEY, 
String.class, "") + "');"
-                               )) ;
-                               */
+               response.render(OnDomReadyHeaderItem.forScript("loadRssTab('" + 
feed1.getCallbackUrl() + "',"
+                               + "'" + feed2.getCallbackUrl() + "');")) ;
+       }
+       
+       class RSSFeedBehavior extends AbstractAjaxBehavior {
+               private static final long serialVersionUID = 
721009368063152450L;
+               private String url;
+
+               RSSFeedBehavior(String url) {
+                       this.url = url;
+               }
+               
+               public void onRequest() {
+                       ResourceStreamRequestHandler handler = new 
ResourceStreamRequestHandler(new AbstractResourceStream() {
+                               private static final long serialVersionUID = 
-322593118428697261L;
+                               HttpURLConnection con;
+                               
+                               public InputStream getInputStream() throws 
ResourceStreamNotFoundException {
+                                       try {
+                                               con = getFeedConnection(url);
+                                               con.connect();
+                                               return con.getInputStream();
+                                       } catch (IOException e) {
+                                               throw new 
ResourceStreamNotFoundException();
+                                       }
+                               }
+
+                               public void close() throws IOException {
+                                       if (con != null) {
+                                               con.disconnect();
+                                       }
+                               }
+                       }, "feed");
+                       
handler.setContentDisposition(ContentDisposition.ATTACHMENT);
+                       
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
+               }
        }
 }

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.html
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.html?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.html
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.html
 Wed May  8 14:49:18 2013
@@ -40,7 +40,7 @@
                        </tr>
                        <tr>
                                <td><wicket:ommessage key="116" /></td>
-                               <td><input wicket:id="repassword" 
type="password" value="" /></td>
+                               <td><input wicket:id="confirmPassword" 
type="password" value="" /></td>
                        </tr>
                        <tr>
                                <td><wicket:ommessage key="119" /></td>

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.java?rev=1480309&r1=1480308&r2=1480309&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/RegisterDialog.java
 Wed May  8 14:49:18 2013
@@ -108,6 +108,7 @@ public class RegisterDialog extends Abst
        
        class RegisterForm extends StatelessForm<String> {
                private static final long serialVersionUID = 
1701373326213602431L;
+           private PasswordTextField confirmPassword;
 
                public RegisterForm(String id) {
                        super(id);
@@ -116,7 +117,7 @@ public class RegisterDialog extends Abst
                        add(new RequiredTextField<String>("lastName", new 
PropertyModel<String>(RegisterDialog.this, "lastName")));
                        add(new RequiredTextField<String>("login", new 
PropertyModel<String>(RegisterDialog.this, "login")));
                        add(new PasswordTextField("password", new 
PropertyModel<String>(RegisterDialog.this, "password")).setResetPassword(true));
-                       add(new PasswordTextField("repassword", new 
Model<String>()).setResetPassword(true));
+                       add(confirmPassword = new 
PasswordTextField("confirmPassword", new 
Model<String>()).setResetPassword(true));
                        add(new RequiredTextField<String>("email", new 
PropertyModel<String>(RegisterDialog.this, "email")));
                        add(new DropDownChoice<FieldLanguage>("lang"
                                        , new 
PropertyModel<FieldLanguage>(RegisterDialog.this, "lang")
@@ -146,5 +147,11 @@ public class RegisterDialog extends Abst
                                }
                        });
                }
+               
+               @Override
+               protected void onValidate() {
+                       // TODO Auto-generated method stub
+                       super.onValidate();
+               }
        }
 }


Reply via email to