[freenet-cvs] r17890 - in trunk/apps/thingamablog/src/net/sf/thingamablog: . blog gui/app gui/properties xml

dieppe at freenetproject.org dieppe at freenetproject.org
Thu Feb 14 11:19:13 UTC 2008


Author: dieppe
Date: 2008-02-14 11:19:13 +0000 (Thu, 14 Feb 2008)
New Revision: 17890

Modified:
   trunk/apps/thingamablog/src/net/sf/thingamablog/TBGlobals.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/blog/Weblog.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TBOptionsDialog.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TemplateSelectionPanel.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/ThingamablogFrame.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/WeblogPreviewer.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java
   trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java
Log:
Some few changes to generate the key pair (not implemented yet, but very soon)
Some others to (may be) fix the issue of viewing a flog


Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/TBGlobals.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/TBGlobals.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/TBGlobals.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -112,6 +112,10 @@
 	private static String socksPort = "1080";
 	private static String socksUser = "";
 	private static String socksPass = "";
+        
+        //node properties
+        private static String nodePort = "9184";
+        private static String nodeHostname = "localhost";
 	
 	//auto feed updater stuff
 	private static int feedUpdateInterval = 1800000;//30 minutes
@@ -273,6 +277,10 @@
 			if(props.get("LAF") != null)
 				lafName = props.getProperty("LAF");
 						
+                        if(props.get("NODE_PORT") != null)
+                            nodePort = props.getProperty("NODE_PORT");
+                        if(props.get("NODE_HOSTNAME") != null)
+                            nodeHostname = props.getProperty("NODE_HOSTNAME");
 		}
 		catch(FileNotFoundException fnfe)
 		{
@@ -321,6 +329,8 @@
 			props.put("FEED_UPDATE_INTERVAL", feedUpdateInterval + "");
 			props.put("AUTO_UPDATE", isAutoFeedUpdate + "");
 			props.put("PING_AFTER_PUB", isPingAfterPub + "");
+                        props.put("NODE_PORT", nodePort);
+                        props.put("NODE_HOSTNAME", nodeHostname);
 			
 			//Browser.save(props);
 			props.store(fos, "Thingamablog Properties");			
@@ -515,6 +525,42 @@
 		return socksPass;
 	}
 				
+        /**
+         * Sets the port of the node
+         * @param port
+         */
+        public static void setNodePort(String port)
+        {
+            if(port == null || port.equals(""))
+			nodePort = "9184";
+		else
+			nodePort = port;
+        }
+        
+        /**
+         * Gets the port of the node
+         * @return
+         */
+        public static String getNodePort() {
+            return nodePort;
+        }
+        
+        /**
+         * Sets the hostname of the machine the node is running on
+         * @param hostname
+         */
+        public static void setNodeHostname(String hostname){
+            nodeHostname = hostname;
+        }
+        
+        /**
+         * Gets the hostname of the machine the node is running on
+         * @return
+         */
+        public static String getNodeHostname(){
+            return nodeHostname;
+        }
+        
     /**
      * Indicates whether a splash screen is displayed at startup
      * @return

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/blog/TBWeblog.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -91,6 +91,8 @@
 	
         // Should be internet or freenet
         private String type;
+        // If type == freenet, then insertURI is set to the insertURI of the flog, else, set to null
+        private String insertURI;
         
 	//private Vector outdatedTopLevelPages = new Vector();
 	private Vector outdatedCategoryPages = new Vector();
@@ -1404,4 +1406,12 @@
     public String getType() {
         return this.type;
     }
+
+    public void setInsertURI(String insertURI) {
+        this.insertURI = insertURI;
+    }
+    
+    public String getInsertUri() {
+        return this.insertURI;
+    }
 }

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/blog/Weblog.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/blog/Weblog.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/blog/Weblog.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -81,6 +81,9 @@
 	
 	/** The home directory of the web files */
 	protected  File webFilesDirectory = new File(System.getProperty("user.home"));
+        
+        /** The type of the weblog (f/blog) */
+        protected String type;
 		
 	private Date lastEmailCheck = new Date();
     private int outdatedAfterMinutes = 30;
@@ -1328,4 +1331,12 @@
     {
         lastEmailCheck = d;
     }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+    
+    public String getType() {
+        return this.type;
+    }
 }

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TBOptionsDialog.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TBOptionsDialog.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TBOptionsDialog.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -111,6 +111,9 @@
 	private JTextField socksPortField;
 	private JTextField socksUserField;
 	private JPasswordField socksPasswordField;
+        
+        private JTextField nodePortTf;
+        private JTextField hostNameTf;
 	
 	private JTextArea feedItemArea;
 	private JCheckBox updateNewsCb;
@@ -234,6 +237,9 @@
 		useSocksProxyCb.addActionListener(lst);		
 		socksProxyAuthCb.addActionListener(lst);		
 		
+                //node components
+                nodePortTf = new JTextField(10);
+                hostNameTf = new JTextField(20);
 			
     	
     	
@@ -330,11 +336,20 @@
 		lip.setBorder(new TitledBorder(i18n.str("proxy_details"))); //$NON-NLS-1$
 		proxyPanel.add(lip, BorderLayout.CENTER);		
 		
+                //node tab
+                JPanel nodePanel = new JPanel(new BorderLayout());
+                lip = new LabelledItemPanel();
+                lip.addItem(i18n.str("node_port"), nodePortTf);
+                lip.addItem(i18n.str("node_hostname"), hostNameTf);
+                lip.setBorder(new TitledBorder(i18n.str("node_details")));
+                nodePanel.add(lip, BorderLayout.NORTH);
+                
 		tabs.add(generalPanel, i18n.str("general")); //$NON-NLS-1$
 		tabs.add(newsPanel, i18n.str("feed_reader")); //$NON-NLS-1$
 		//tabs.add(browserPanel, i18n.str("browser")); //$NON-NLS-1$
 		tabs.add(proxyPanel, i18n.str("proxy")); //$NON-NLS-1$
-		
+		tabs.add(nodePanel, i18n.str("node"));
+                
 		setContentPane(tabs);
 		setComponentValues();
 		pack();
@@ -352,7 +367,9 @@
     		socksPortField.setText(TBGlobals.getSocksProxyPort());
     		socksProxyAuthCb.setSelected(TBGlobals.isSocksProxyRequiresLogin());
     		socksUserField.setText(TBGlobals.getSocksProxyUser());
-    		socksPasswordField.setText(TBGlobals.getSocksProxyPassword());		
+    		socksPasswordField.setText(TBGlobals.getSocksProxyPassword());
+                nodePortTf.setText(TBGlobals.getNodePort());
+                hostNameTf.setText(TBGlobals.getNodeHostname());
   		
 			updateProxyComponentsEnabledState();
     	}
@@ -411,6 +428,8 @@
     	TBGlobals.setSocksProxyRequiresLogin(socksProxyAuthCb.isSelected());
     	TBGlobals.setSocksProxyUser(socksUserField.getText());
     	TBGlobals.setSocksProxyPassword(new String(socksPasswordField.getPassword()));
+        TBGlobals.setNodePort(nodePortTf.getText());
+        TBGlobals.setNodeHostname(hostNameTf.getText());
     	
     	if(layout2ColRb.isSelected())
     		TBGlobals.setLayoutStyle(TBGlobals.TWO_COL);

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TemplateSelectionPanel.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TemplateSelectionPanel.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/TemplateSelectionPanel.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -73,7 +73,7 @@
         init(prevListener);
     }
     
-    public TemplateSelectionPanel(final WeblogBackend backend, final String title, final String descr, final String[] cats, final Author[] auths)
+    public TemplateSelectionPanel(final WeblogBackend backend, final String title, final String descr, final String[] cats, final Author[] auths, final String type)
     {
         ActionListener prevListener = new ActionListener()
         {               
@@ -86,7 +86,7 @@
                     return;
                 try
                 {
-                    pw.previewInBrowser(backend, pack, title, descr, cats, auths);
+                    pw.previewInBrowser(backend, pack, title, descr, cats, auths, type);
                 }
                 catch (Exception ex)
                 {                        

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/ThingamablogFrame.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/ThingamablogFrame.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/ThingamablogFrame.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -3491,6 +3491,7 @@
 		{
 			if(curSelWeblog != null)
 			{
+                            if(curSelWeblog.getType().equals("internet")){
 				try
 				{				
 					//Browser.displayURL(curSelWeblog.getFrontPageUrl());
@@ -3500,7 +3501,20 @@
 				{
 					ex.printStackTrace();
 					logger.log(Level.WARNING, ex.getMessage(), ex);
-				}			
+				}
+                            } else {
+                                try
+                                {   
+                                    String nodeHostname = TBGlobals.getProperty("NODE_HOSTNAME");
+                                    Desktop.browse(new URL("http://" + nodeHostname + ":8888" + curSelWeblog.getFrontPageUrl()));
+                                }
+                                catch(Exception ex)
+                                {
+                                    System.err.println("erreur freenet");
+                                    ex.printStackTrace();
+                                    logger.log(Level.WARNING, ex.getMessage(), ex);
+                                }
+                            }
 			}
 		}
 	}

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/WeblogPreviewer.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/WeblogPreviewer.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/app/WeblogPreviewer.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -91,7 +91,7 @@
         String mediaUrl = new File(outputDir, 
             bmUrl.substring(bUrl.length() - 1, bmUrl.length())).toURI().toURL().toExternalForm();
               
-        initPreviewBlog(blog.getBackend(), pack, blog.getTitle(), blog.getDescription(), cats, auths, ents);
+        initPreviewBlog(blog.getBackend(), pack, blog.getTitle(), blog.getDescription(), cats, auths, ents, blog.getType());
         previewBlog.setBlogUrls(outputDir.getAbsolutePath(), baseUrl, arcUrl, mediaUrl);
         
         //mimic the necessary attributes of the blog we're previewing
@@ -111,15 +111,15 @@
         doPreview();
     }
     
-    public void previewInBrowser(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths) throws Exception
+    public void previewInBrowser(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths, String type) throws Exception
     {
-        previewInBrowser(backend, pack, title, desc, cats, auths, null);
+        previewInBrowser(backend, pack, title, desc, cats, auths, null, type);
     }
     
-    public void previewInBrowser(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths, BlogEntry[] ents) 
+    public void previewInBrowser(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths, BlogEntry[] ents, String type) 
     throws Exception
     {       
-        initPreviewBlog(backend, pack, title, desc, cats, auths, ents);
+        initPreviewBlog(backend, pack, title, desc, cats, auths, ents, type);
         doPreview();        
     }
     
@@ -129,8 +129,13 @@
     	
     	try
         {            
-            previewBlog.publishAll(new NullPublishProgress());        
-            Desktop.browse(new URL(previewBlog.getFrontPageUrl()));            
+            previewBlog.publishAll(new NullPublishProgress());
+            if(previewBlog.getType().equals("internet")) {
+                Desktop.browse(new URL(previewBlog.getFrontPageUrl()));            
+            } else {
+                String nodeHostname = TBGlobals.getProperty("NODE_HOSTNAME");
+                Desktop.browse(new URL("http://" + nodeHostname + ":8888" + previewBlog.getFrontPageUrl()));
+            }
         }
         catch(Exception ex)
         {           
@@ -151,7 +156,7 @@
     
     
     
-    private synchronized void initPreviewBlog(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths, BlogEntry[] ents) 
+    private synchronized void initPreviewBlog(WeblogBackend backend, TemplatePack pack, String title, String desc, String[] cats, Author[] auths, BlogEntry[] ents, String type) 
     throws Exception
     {        
         clearPreviewData();
@@ -159,7 +164,8 @@
         previewBlog = new TBWeblog(TBGlobals.getPreviewDirectory());       
         previewBlog.setBackend(backend);     
         previewBlog.setTitle(title);
-        previewBlog.setDescription(desc); 
+        previewBlog.setDescription(desc);
+        previewBlog.setType(type);
         
         //set last publish date really old so that web files modified date is
         //certain to be newer 

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBPublishTransportPanel.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -68,7 +68,7 @@
     private final String FTP = "FTP"; //$NON-NLS-1$
 	private final String SFTP = "SFTP"; //$NON-NLS-1$
 	private final String LOCAL = "Local"; //$NON-NLS-1$
-//        private final String FCP = "FCP";
+        private final String FCP = "FCP";
 	
 	private TBWeblog weblog;
 	private JComboBox encodingsCombo;
@@ -76,7 +76,7 @@
 	private JPanel transportsPanel;
 	private RemoteTransportPanel ftpPanel;
 	private RemoteTransportPanel sftpPanel;
-//        private FcpTransportPanel fcpPanel;
+        private FcpTransportPanel fcpPanel;
 	private JPanel localPanel;
 	private CardLayout tLayout;
     private JTabbedPane ftpTabs = new JTabbedPane();
@@ -105,11 +105,11 @@
                  }
                 // Else, we are building a flog, and the transport process is LOCAL or FCP
                 else {
-                    types=new String[1];
+                    types=new String[2];
                     types[0]="LOCAL";
-                    //types[2]="FCP";                    
-                    //fcpPanel = new FcpTransportPanel();
-                    //fcpPanel.setBorder(new TitledBorder(i18n.str("fcp_transport")));
+                    types[1]="FCP";                    
+                    fcpPanel = new FcpTransportPanel();
+                    fcpPanel.setBorder(new TitledBorder(i18n.str("fcp_transport")));
                  }
                 localPanel = new JPanel();
                 		
@@ -121,7 +121,7 @@
                     transportsPanel.add(sftpPanel, SFTP);
                 } else {
                     transportsPanel.add(localPanel, LOCAL);
-                    //transportsPanel.add(fcpPanel, FCP);
+                    transportsPanel.add(fcpPanel, FCP);
                 }
 			
 		
@@ -163,15 +163,14 @@
 			transportTypeCombo.setSelectedItem(SFTP);
 			tLayout.show(transportsPanel, SFTP);
 		}
-		else
+		else if(wb.getPublishTransport() instanceof LocalTransport)
 		{		
 			transportTypeCombo.setSelectedItem(LOCAL);
 			tLayout.show(transportsPanel, LOCAL);
-		} 
-//                else {
-//                    transportTypeCombo.setSelectedItem(FCP);
-//                    tLayout.show(transportsPanel, FCP);
-//                }
+		} else {
+                        transportTypeCombo.setSelectedItem(FCP);
+                        tLayout.show(transportsPanel, FCP);
+                }
                 
 		transportTypeCombo.addActionListener(new ActionListener()
 		{
@@ -236,7 +235,9 @@
 		{
 			transport = new LocalTransport();
 		} else {
-//                    transport = new FCPTransport();
+//                        FCPTransport pt = new FCPTransport();
+//                        pt.setPort(fcpPanel.getPort());
+//                        pt.setMachineName(fcpPanel.getMachineName());
                 }
 		
 		weblog.setPublishTransport(transport);
@@ -416,9 +417,56 @@
         }
     }
         
-//        private class FCPTransportPanel extends JPanel {
-//            /**
-//             * Ask for some options like : is the node on the same computer, etc..
-//             */
-//        }
+        private class FcpTransportPanel extends JPanel {
+            /**
+             * Ask for some options like : is the node on the same computer, etc..
+             */
+            
+                private static final long serialVersionUID = 1L;		
+		private JTextField portField;
+		private JTextField machineNameField;
+		public FcpTransportPanel()
+		{
+                        portField = new JTextField();
+                        machineNameField = new JTextField();
+                    
+			TextEditPopupManager pm = TextEditPopupManager.getInstance();
+			pm.registerJTextComponent(machineNameField);
+                        
+                        // Default port
+                        portField.setText("9481");
+                        //Default machine name
+                        machineNameField.setText("localhost");
+			LabelledItemPanel lip = new LabelledItemPanel();
+			JPanel p = new JPanel(new BorderLayout());
+			p.add(portField, BorderLayout.WEST);
+			p.add(new JPanel(), BorderLayout.CENTER);
+			lip.addItem(i18n.str("port"), p);
+                        lip.addItem(i18n.str("machineName"),machineNameField);
+			setLayout(new BorderLayout());
+			add(lip, BorderLayout.CENTER);	
+		}
+
+        public int getPortField() {                        
+            try
+            {
+            	return Integer.parseInt(portField.getText());
+            }
+            catch (Exception ex){}
+            return 9481;
+        }
+
+        public void setPortField(int p) {
+            portField.setText(p+"");
+        }
+
+        public String getMachineNameField() {
+            return machineNameField.getText();
+        }
+
+        public void setMachineNameField(String machineNameField) {
+            this.machineNameField.setText(machineNameField);
+        }
+                
+    }
 }
\ No newline at end of file

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/gui/properties/TBWizardDialog.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -12,10 +12,12 @@
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 import java.util.Vector;
+import java.util.logging.Logger;
 
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
@@ -34,6 +36,7 @@
 import net.atlanticbb.tantlinger.i18n.I18n;
 import net.atlanticbb.tantlinger.ui.UIUtils;
 import net.atlanticbb.tantlinger.ui.text.TextEditPopupManager;
+import net.sf.thingamablog.TBGlobals;
 import net.sf.thingamablog.blog.Author;
 import net.sf.thingamablog.blog.BackendException;
 import net.sf.thingamablog.blog.TBWeblog;
@@ -268,12 +271,12 @@
 		public void actionPerformed(ActionEvent e)
 		{
 			if(e.getSource() == nextButton)
-			{                            
+			{                           
+                                 PropertyPanel p = getCurrentPanel();
                                 // We check if the current panel is the starterPanel (donePanel is not yet initialized) or if the current panel is not donePanel
 				if(starterPanel.isVisible() || !donePanel.isVisible())
 				{				
 					//if(isCurrentPanelValid())
-                    PropertyPanel p = getCurrentPanel();
                     if(p != null && p.isValidData())
                     {
 						p.saveProperties();
@@ -295,7 +298,8 @@
                     }
 				}                                
 
-				if(donePanel.isVisible())
+                                if(p == starterPanel){}
+                                else if( donePanel.isVisible())
 				{
 					doneButton.setText(FINISH);
 					nextButton.setEnabled(false);
@@ -342,6 +346,8 @@
 		private JTextField urlField = new JTextField(20);
                 private String TYPE[]={"internet","freenet"};
                 private JComboBox typeCombo = new JComboBox(TYPE);
+                private JButton generateKeyButton = new JButton(i18n.str("generate_key"));
+                private JTextField insertUriField = new JTextField();
 		
 		public StarterPanel()
 		{			
@@ -349,11 +355,17 @@
 			String text =
 			i18n.str("welcome_panel_text"); //$NON-NLS-1$
 			
-			
+                        ActionListener listener = new TypeListener();
+                        typeCombo.addActionListener(listener);
+                        generateKeyButton.addActionListener(listener);
+                        generateKeyButton.setEnabled(false);
+                        
 			LabelledItemPanel lip = new LabelledItemPanel();
 			lip.addItem(i18n.str("base_path"), pathField); //$NON-NLS-1$
 			lip.addItem(i18n.str("base_url"), urlField); //$NON-NLS-1$
+                        lip.addItem(i18n.str("insertUri"), insertUriField);
 			lip.addItem(i18n.str("type"), typeCombo);
+                        lip.addItem("", generateKeyButton);
                         
 			popupManager.registerJTextComponent(pathField);
 			popupManager.registerJTextComponent(urlField);
@@ -396,8 +408,14 @@
                                 return false;
 			}			
             }		
-            if (typeCombo.getSelectedItem().toString().equals("freenet"))
-                        return isValidSSK(urlField.getText());
+            if (typeCombo.getSelectedItem().toString().equals("freenet")) {
+                boolean valid = true;        
+                valid = valid && isValidSSK(urlField.getText());
+                valid = valid && isValidSSK(insertUriField.getText());
+                return valid;
+            } else {
+                insertUriField.setText("none");                
+            }
 			
             return true;		
             }
@@ -417,7 +435,31 @@
 			
 			weblog.setBlogUrls(path, url, arcUrl, mediaUrl);
                         weblog.setType(typeCombo.getSelectedItem().toString());
+                        weblog.setInsertURI(insertUriField.getText());
 		}
+                
+                private class TypeListener implements ActionListener {
+                public void actionPerformed(ActionEvent e) {
+                    if (e.getSource() instanceof JComboBox && ((JComboBox) e.getSource()).getSelectedItem().equals("internet")) {
+                        generateKeyButton.setEnabled(false);
+                        insertUriField.setEditable(false);
+                        urlField.setEditable(true);
+                    } else if (e.getSource() instanceof JComboBox && ((JComboBox) e.getSource()).getSelectedItem().equals("freenet")) {
+                        generateKeyButton.setEnabled(true);
+                        insertUriField.setEditable(true);
+                    } else if (e.getSource() instanceof JButton){
+                        if(generateKeyButton.getText().equals(i18n.str("generate_key"))){
+                            int port = Integer.parseInt(TBGlobals.getProperty("NODE_PORT"));
+                            String hostname = TBGlobals.getProperty("NODE_HOSTNAME");
+                            generateKeyButton.setText(i18n.str("cancel"));
+                        } else {
+                            urlField.setText("");
+                            insertUriField.setText("");
+                            generateKeyButton.setText(i18n.str("generate_key"));
+                        }
+                    }
+                }
+            }
 	}
 	
 	private class TitleDescrPanel extends PropertyPanel

Modified: trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java
===================================================================
--- trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java	2008-02-13 23:53:53 UTC (rev 17889)
+++ trunk/apps/thingamablog/src/net/sf/thingamablog/xml/TBPersistFactory.java	2008-02-14 11:19:13 UTC (rev 17890)
@@ -334,6 +334,7 @@
 		element.setAttribute("url", blog.getBaseUrl());
 		element.setAttribute("arc_url", blog.getArchiveUrl());
 		element.setAttribute("media_url", blog.getMediaUrl());
+                element.setAttribute("insertURI", blog.getInsertUri());
 		element.setAttribute("base_path", blog.getBasePath());		
 		element.setAttribute("base_date", blog.getArchiveBaseDate().getTime() + "");
 		element.setAttribute("arc_policy", blog.getArchivePolicy() + "");
@@ -540,6 +541,7 @@
 		loadPingServicesFromXML(blogEle, weblog);
         loadEmailSettingsFromXML(blogEle, weblog);
 		weblog.setTitle(blogEle.getAttributeValue("title", "Untitled"));
+                weblog.setType(blogEle.getAttributeValue("type","internet"));
 		String description = "";
 		Element desc = blogEle.getChild("Description");
 		if(desc != null)
@@ -589,6 +591,7 @@
 		tb.setLocale(createLocale(element.getAttributeValue("locale", Locale.getDefault().toString())));
 		tb.setPublishAll(element.getAttributeValue("publish_all", "true").equals("true"));
 		tb.setType(element.getAttributeValue("type").toString());
+                tb.setInsertURI(element.getAttributeValue("insertURI"));
                 
 		int arcPolicy = TBWeblog.ARCHIVE_MONTHLY;
 		int dayInterval = 5;




More information about the cvs mailing list