Examples of HtmlGenerator


Examples of org.w3c.jigsaw.html.HtmlGenerator

  }
  return super.perform(req);
    }

    protected HtmlGenerator getHtmlGenerator(String title) {
  HtmlGenerator g = new HtmlGenerator(title);
  addStyleSheet(g);
  return g;
    }
View Full Code Here

Examples of org.w3c.jigsaw.html.HtmlGenerator

     */

    public Reply get(Request request)
  throws ProtocolException, ResourceException
    {
  HtmlGenerator g = getHtmlGenerator("Modified files");
  g.append("<h1>List of recently published files</h1>\n");
  Enumeration penum = putlist.getPublishedEntries();
  if (! penum.hasMoreElements())
      g.append("<center><b>No recently published file</b></center>\n");
  g.append("<ul>\n");
 
  Vector sorted =
      org.w3c.tools.sorter.Sorter.sortComparableEnumeration(penum);

  for (int i=0; i < sorted.size(); i++) {
      PutedEntry e      = (PutedEntry) sorted.elementAt(i);
      String     url    = e.getURL();
      g.append("<li><a href=\"",
         url,
         "\">"+url+"</a>");
      g.append("<br>Published by <em>"+e.getAuthor()+"</em> on <strong>",
         new Date(e.getTime()).toString(),
         "</strong>.</li>\n");
  }

  g.append("</ul>\n");

  penum = putlist.getEntries();
  if (penum.hasMoreElements()) {
      g.append("<h1>List of modified files</h1>\n");
      g.append("<form action=\""+request.getURL()+
         "\" method=\"POST\">\n");
      g.append("<dl>\n");
      // Dump all entries:
      sorted =
    org.w3c.tools.sorter.Sorter.sortComparableEnumeration(penum);

      for (int i=0; i < sorted.size(); i++) {
    PutedEntry e      = (PutedEntry) sorted.elementAt(i);
    String     fname  = e.getFilename();
    String     author = e.getAuthor();
    long       time   = e.getTime();
    String     url    = e.getURL();

    g.append("<dt><input type=\"checkbox\" name=\""+
       e.getKey() + "\" value =\"mark\">",
       (fname != null) ? fname : url,
       "</dt><dd>");
    if ( fname != null ) {
        File         file    = new File(fname);
        File         dir     = new File(file.getParent());
        // Compute the CVS directory URL for the file:
        URL          cvsurl  = null;
        try {
      cvsurl  = new URL(new URL(url), "CVS");
        } catch (Exception ex) {
      cvsurl = null;
        }
        // Display status:
        int st = -1;
        try {
      // Local status first:
      CvsDirectory cvs =
          CvsDirectory.getManager(dir,
                putlist.props);
      st  = cvs.status(file.getName());
      if ( cvsurl != null )
          g.append("Status: <a href=\""+cvsurl+ "\">"
             , cvs.statusToString(st)
             , "</a><br>");
      else
          g.append("Status: "
             , cvs.statusToString(st)
             , "<br>");

      if (url != null)
          g.append("URL: <a href=\"",
             url,
             "\">"+url+"</a><br>");
   
        } catch (CvsException ex) {
      g.append("Status: <strong>CVS ERROR</strong>: "
         , ex.getMessage()
         , "<br>");
        }
        // Publish status next (when possible)
        if ( st != CVS.FILE_Q ) {
      try {
          File         sf  = putlist.getServerFile(file);
          File         sd  = new File(sf.getParent());
          CvsDirectory sc  =
        CvsDirectory.getManager(sd, putlist.props);
          int          sst = sc.status(file.getName());
          if (sst == CVS.FILE_C) {
        g.append("Publish: (needed) <B><U>",
           sc.statusToString(sst),
           "</U></B><br>");
          } else if ((st == CVS.FILE_M) ||
               (sst != CVS.FILE_OK))
        {
            g.append("Publish: (needed) <em>"
               , sc.statusToString(sst)
               , "</em><br>");
        } else {
            g.append("Publish: <em>"
               , sc.statusToString(sst)
               , "</em><br>");
        }
      } catch (CvsException ex) {
          g.append("Publish: <strong>CVS ERROR</strong>: "
             , ex.getMessage()
             , "<br>");
      }
        }
    }
    // Display author:
    if ( author != null )
        g.append("Modified by <em>"+author+"</em> on <strong>"+
           new Date(time).toString() + "</strong>.<br>\n");
    else
        g.append("Modified on <strong>"+
           new Date(time).toString()+
           "</strong>.<br>\n");
      }
      g.append("</dl>\n");
      // The command button:
      g.append ("<hr noshade width=\"40%\">\n<center>\n",
          "<table border=\"0\">",
          "<tr align=\"left\"><td>\n");
      g.append ("<b>Perform action on marked entries:</b><p>\n") ;
      g.append ("<input type=\"radio\" name=\"action\" ",
          "value=\"publish\">Publish<br>\n");
      g.append ("<input type=\"radio\" name=\"action\" value=\"remove\">"
          + "Remove \n");
      g.append ("</p><center>\n") ;
      g.append ("<input type=\"submit\" name=\"submit\" "+
          "value=\"Perform Action\">\n") ;
      g.append ("</center>");
      g.append ("</form>\n") ;
      g.append ("</td></tr></table></center>\n");
  }

  penum = putlist.getDelEntries();
  if (penum.hasMoreElements()) {
      g.append("<h1>List of deleted files</h1>\n");
      g.append("<form action=\""+request.getURL()+
         "\" method=\"POST\">\n");
      g.append("<dl>\n");
      //Dump only confirmed entries
      sorted =
    org.w3c.tools.sorter.Sorter.sortComparableEnumeration(penum);
      for (int i=0; i < sorted.size(); i++) {
    DeletedEntry e = (DeletedEntry) sorted.elementAt(i);
    if (e.isConfirmed()) {
        String     fname  = e.getFilename();
        String     author = e.getAuthor();
        long       time   = e.getTime();
        String     url    = e.getURL();
        g.append("<dt><input type=\"checkbox\" name=\""+
           e.getKey() + "\" value =\"mark\">",
           (fname != null) ? fname : url,
           "</dt><dd>");
        if (url != null)
      g.append("URL: <b>"+url+"</b><br>");
        // Display author:
        if ( author != null )
      g.append("Deleted by <em>"+
         author+"</em> on <strong>"+
         new Date(time).toString() +
         "</strong>.<br>\n");
        else
      g.append("Deleted on <strong>"+
         new Date(time).toString()+
         "</strong>.<br>\n");
    }
      }
      g.append("</dl>\n");
      // The command button:
      g.append ("<hr noshade width=\"40%\">\n<center>\n",
          "<table border=\"0\">",
          "<tr align=\"left\"><td>\n");
      g.append ("<b>Perform action on marked entries:</b><p>\n") ;
      g.append ("<input type=\"radio\" name=\"action\" ",
          "value=\"delete\">Delete<br>\n");
      g.append ("<input type=\"radio\" name=\"action\" "+
          "value=\"removedel\">Remove \n");
      g.append ("</p><center>\n") ;
      g.append ("<input type=\"submit\" name=\"submit\" "+
          "value=\"Perform Action\">\n") ;
      g.append ("</center>");
      g.append ("</form>\n") ;
      g.append ("</td></tr></table></center>\n");
  }

  g.append ("<h1>Putlist Configuration</h1>");
  g.append ("<center>");
  g.append ("<table border=\"0\"><tr align=\"left\"><td>");
  g.append ("<form action=\""+request.getURL()+"\" method=\"POST\">\n");
  g.append ("<input type=\"hidden\" name=\"action\" value=\"config\">");
  g.append ("<input type=\"checkbox\"",
      (putlist.getAutoPublishFlag() ? " CHECKED " : " "),
      "name=\"autopublish\" value=\"mark\"> Auto Publish<br>");
  g.append ("<input type=\"checkbox\"",
      (putlist.getAutoDeleteFlag() ? " CHECKED " : " "),
      "name=\"autodelete\" value=\"mark\"> Auto Delete<br>");
  g.append ("Max published entries <input type=\"text\" "+
      "size=\"3\" maxlength=\"2\" name=\"mpe\" value=\""+
      putlist.getMaxPublishedEntryStored()+
      "\">");
  g.append ("</p><center>");
  g.append ("<input type=\"submit\" name=\"submit\" "+
      "value=\"Save Configuration\">") ;
  g.append ("</center></form>\n");
  g.append ("</td></tr></table>\n");
  g.append ("</center>");
  g.append ("<hr noshade width=\"80%\">");
  g.close();
  Reply reply = createDefaultReply(request, HTTP.OK);
  reply.addPragma("no-cache");
  reply.setNoCache();
  reply.setStream(g);
  return reply;
View Full Code Here

Examples of org.w3c.jigsaw.html.HtmlGenerator

         Request request,
         String msg,
         String details)
    {
  Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR);
  HtmlGenerator g = getHtmlGenerator(cvsframe, msg);
  g.append ("<center>");
  g.append ("[ <A HREF=\"./CVS\">Back</A> ]<hr noshade width=\"80%\">");
  g.append ("</center>");
  g.append ("<div class=\"error\"> <center><p class=\"error\">", msg,
      "</center><p>\n");
  g.append ("Details : <p><em>",details,"</em><p></div>\n");
  g.append ("<hr noshade width=\"80%\">");
  error.setStream(g);
  return error;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.