Changeset 09cb5fa


Ignore:
Timestamp:
Sep 4, 2005 10:43:22 PM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
59a80375
Parents:
ee8e45e
git-author:
jrandom <jrandom> (09/04/05 22:43:22)
git-committer:
zzz <zzz@…> (09/04/05 22:43:22)
Message:

allow you to bookmark syndie archives and later recall those bookmarks on the remote page

Location:
apps/syndie
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java

    ree8e45e r09cb5fa  
    579579                    if (a.description != null)
    580580                        _postBodyBuffer.append(": ").append(sanitizeString(a.description));
     581                    _postBodyBuffer.append(" <a href=\"");
     582                    _postBodyBuffer.append(getBookmarkURL(a.name, a.location, a.locationSchema, "syndiearchive"));
     583                    _postBodyBuffer.append("\">bookmark</a>");
    581584                }
    582585                _postBodyBuffer.append("<br />\n");
     
    870873               + "&location=" + sanitizeTagParam(archiveLocation.getLocation());
    871874    }
     875    public static String getBookmarkURL(String name, String location, String schema, String protocol) {
     876        return "addresses.jsp?name=" + sanitizeTagParam(name)
     877               + "&network=" + sanitizeTagParam(schema)
     878               + "&protocol=" + sanitizeTagParam(protocol)
     879               + "&location=" + sanitizeTagParam(location);
     880               
     881    }
    872882}
  • apps/syndie/jsp/addresses.jsp

    ree8e45e r09cb5fa  
    142142        buf.setLength(0);
    143143    }
     144
     145    String net = request.getParameter("network");
     146    String proto = request.getParameter("protocol");
     147    String name = request.getParameter("name");
     148    String loc = request.getParameter("location");
     149    boolean active = (request.getParameter("action") != null);
     150    if (net == null || active) net = "";
     151    if (proto == null || active) proto = "";
     152    if (name == null || active) name = "";
     153    if (loc == null || active) loc= "";
    144154    %>
    145     <tr><form action="addresses.jsp" method="POST"><td><input type="text" name="name" size="20" /></td>
    146         <td><select name="network"><option value="i2p">I2P</option><option value="syndie">Syndie</option><option value="tor">Tor</option><option value="freenet">Freenet</option><option value="internet">Internet</option></select></td>
    147         <td><select name="protocol"><option value="http">HTTP</option><option value="irc">IRC</option><option value="i2phex">I2Phex</option><option value="syndiearchive">Syndie archive</option><option value="syndieblog">Syndie blog</option></select></td>
    148         <td><input type="text" size="50" name="location" /></td>
     155    <tr><form action="addresses.jsp" method="POST"><td><input type="text" name="name" size="20" value="<%=name%>" /></td>
     156        <td><select name="network">
     157            <option value="i2p" <%="i2p".equals(net) ? " selected=\"true\" " : ""%>>I2P</option>
     158            <option value="syndie" <%="syndie".equals(net) ? " selected=\"true\" " : ""%>>Syndie</option>
     159            <option value="tor" <%="tor".equals(net) ? " selected=\"true\" " : ""%>>Tor</option>
     160            <option value="freenet" <%="freenet".equals(net) ? " selected=\"true\" " : ""%>>Freenet</option>
     161            <option value="internet" <%="internet".equals(net) ? " selected=\"true\" " : ""%>>Internet</option></select></td>
     162        <td><select name="protocol">
     163            <option value="http" <%="http".equals(proto) ? " selected=\"true\" " : ""%>>HTTP</option>
     164            <option value="irc" <%="irc".equals(proto) ? " selected=\"true\" " : ""%>>IRC</option>
     165            <option value="i2phex" <%="i2phex".equals(proto) ? " selected=\"true\" " : ""%>>I2Phex</option>
     166            <option value="syndiearchive" <%="syndiearchive".equals(proto) ? " selected=\"true\" " : ""%>>Syndie archive</option>
     167            <option value="syndieblog" <%="syndieblog".equals(proto) ? " selected=\"true\" " : ""%>>Syndie blog</option></select></td>
     168        <td><input type="text" size="50" name="location" value="<%=loc%>" /></td>
    149169        <td><input type="checkbox" name="isPublic" /></td>
    150170        <td><input type="text" name="groups" size="10" /></td>
  • apps/syndie/jsp/remote.jsp

    ree8e45e r09cb5fa  
    1 <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*" %>
     1<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*, net.i2p.syndie.*, net.i2p.syndie.sml.*, java.util.*" %>
    22<% request.setCharacterEncoding("UTF-8"); %>
    33<jsp:useBean scope="session" class="net.i2p.syndie.web.RemoteArchiveBean" id="remote" />
     
    2626 <option value="usenet" <%=("usenet".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>Usenet</option>
    2727</select>
    28 Proxy <input type="text" size="10" name="proxyhost" value="localhost" />:<input type="text" size="4" name="proxyport" value="4444" />
    29 <input name="location" size="40" value="<%=(request.getParameter("location") != null ? request.getParameter("location") : "")%>" />
     28Proxy <input type="text" size="10" name="proxyhost" value="localhost" />:<input type="text" size="4" name="proxyport" value="4444" /><br />
     29Bookmarked archives: <select name="archivepetname"><option value="">Custom location</option><%
     30for (Iterator iter = user.getPetNameDB().getNames().iterator(); iter.hasNext(); ) {
     31  PetName pn = user.getPetNameDB().get((String)iter.next());
     32  if ("syndiearchive".equals(pn.getProtocol())) {
     33    %><option value="<%=HTMLRenderer.sanitizeTagParam(pn.getName())%>"><%=HTMLRenderer.sanitizeString(pn.getName())%></option><%
     34  }
     35}
     36%></select> or
     37<input name="location" size="30" value="<%=(request.getParameter("location") != null ? request.getParameter("location") : "")%>" />
    3038<input type="submit" name="action" value="Continue..." /><br />
    3139<%
    3240  String action = request.getParameter("action");
    3341  if ("Continue...".equals(action)) {
    34     remote.fetchIndex(user, request.getParameter("schema"), request.getParameter("location"), request.getParameter("proxyhost"), request.getParameter("proxyport"));
     42    String location = request.getParameter("location");
     43    String pn = request.getParameter("archivepetname");
     44    if ( (pn != null) && (pn.trim().length() > 0) ) {
     45      PetName pnval = user.getPetNameDB().get(pn);
     46      if (pnval != null) location = pnval.getLocation();
     47    }
     48    remote.fetchIndex(user, request.getParameter("schema"), location, request.getParameter("proxyhost"), request.getParameter("proxyport"));
    3549  } else if ("Fetch metadata".equals(action)) {
    3650    remote.fetchMetadata(user, request.getParameterMap());
Note: See TracChangeset for help on using the changeset viewer.