Author: jolantern
Date: 2007-12-27 12:36:22 +0000 (Thu, 27 Dec 2007)
New Revision: 16819

Modified:
   branches/legacy/stable/src/freenet/node/http/BookmarkManagerServlet.java
Log:
Updating the BookmarkManagerServlet to display 'active link missing' message 
when active link is null. Still need to update the NodeInfoServlet

Modified: 
branches/legacy/stable/src/freenet/node/http/BookmarkManagerServlet.java
===================================================================
--- branches/legacy/stable/src/freenet/node/http/BookmarkManagerServlet.java    
2007-12-26 22:56:01 UTC (rev 16818)
+++ branches/legacy/stable/src/freenet/node/http/BookmarkManagerServlet.java    
2007-12-27 12:36:22 UTC (rev 16819)
@@ -832,6 +832,8 @@
                                .append("\" alt=\"")
                                .append(title)
                                .append("\" width=\"95\" height=\"32\" /> ");
+               else
+                       buf.append("(active link missing)");
                buf
                        .append(title)
                        .append("</a>");
@@ -959,8 +961,7 @@
                                                bmk.setKey(k);
                                        if (t != null)
                                                bmk.setTitle(t);
-                                       if (al != null)
-                                               bmk.setActivelinkFile(al);
+                                       bmk.setActivelinkFile(al);
                                        if (desc != null)
                                                bmk.setDescription(desc);
                                }
@@ -1000,7 +1001,7 @@
        }

        protected boolean safeLink(String s) {
-               return (s.indexOf('\n') < 0) && (s.indexOf('\r') < 0) && 
(s.indexOf(':') < 0) && (s.indexOf('<') < 0);
+               return (s == null) || ((s.indexOf('\n') < 0) && 
(s.indexOf('\r') < 0) && (s.indexOf(':') < 0) && (s.indexOf('<') < 0));
        }

        /**
@@ -1043,6 +1044,11 @@
                                this.title = "no title";
                }

+               /**
+                * Obtain path to active link picture relative to site.
+                * When this method returns null, no link should be displayed.
+                */
+
                public String getActivelinkFile() {
                        return activelink;
                }
@@ -1050,7 +1056,7 @@
                public void setActivelinkFile(String file) {
                        activelink = clean(file);
                        if (activelink.equals(""))
-                               activelink = "noactivelink" + 
randSource.nextInt() + ".png"; // should create broken link
+                               activelink = null;
                }

                public String getDescription() {


Reply via email to