Package org.w3c.jigsaw.html

Examples of org.w3c.jigsaw.html.HtmlGenerator


    || (dirResource.getLastModified() > listing_stamp)
    || (getLastModified() > listing_stamp)) {
   
    Enumeration e = dirResource.enumerateResourceIdentifiers() ;
    Vector        resources = Sorter.sortStringEnumeration(e) ;
    HtmlGenerator g = new HtmlGenerator("Directory listing of "+
              dirResource.getIdentifier());
    // Add style link
    addStyleSheet(g);
    g.append("<h1>Directory listing of ",
       dirResource.getIdentifier(),
       "</h1>");
    // Link to the parent, when possible:
    if ( dirResource.getParent() != null )
        g.append("<p><a href=\"..\">Parent</a><br>");
    g.append("\n<form method=\"POST\" action=\""+request.getURL()
       +"\">\n");
    String listername = getResource().getIdentifier();
    // List the children:
    g.append("<table border=\"0\">\n");

    ResourceReference rr       = null;
    FramedResource    resource = null;
    String            name     = null;
    //ugly hack to put CVS link first
    rr = dirResource.lookup("CVS");
    if (rr != null) {
        g.append(getResourceLine(rr, "CVS", false));
    }
    boolean even = true;
    for (int i = 0 ; i < resources.size() ; i++) {
        name = (String) resources.elementAt(i);
        if ( name.equals(listername) || name.equals("CVS"))
      continue;
        rr = dirResource.lookup(name);
        g.append(getResourceLine(rr, name, even));
        even = !even;
    }
    g.append("</table>\n");
    g.append("<P><INPUT TYPE=\"SUBMIT\" NAME=\"SUBMIT\" VALUE=\""+
       "Delete file from  publishing space\"></FORM>\n");
    g.close() ;
    listing_stamp = getLastModified() ;
    listing       = g ;
      } else if ( checkIfModifiedSince(request) == COND_FAILED ) {
    // Is it an IMS request ?
    return createDefaultReply(request, HTTP.NOT_MODIFIED) ;
View Full Code Here


      http_class = null;
    }

    Enumeration   e     = cresource.enumerateResourceIdentifiers();
    Vector    resources = Sorter.sortStringEnumeration(e) ;
    HtmlGenerator g     =
          new HtmlGenerator("Index of "+cresource.getIdentifier());
    // Add style link
    addStyleSheet(g);
    g.append("<h1>"+cresource.getIdentifier()+"</h1>");
    // Link to the parent, when possible:
    if ( cresource.getParent() != null ) {
        g.append("<p><a href=\"..\">Parent</a><br>");
    }
      // List the children:
    for (int i = 0 ; i < resources.size() ; i++) {
        String            name = (String) resources.elementAt(i);
        ResourceReference rr   = null;
        long              size = -1;
        rr = cresource.lookup(name);
        FramedResource resource = null;
        if (rr != null) {
      try {
          resource = (FramedResource) rr.unsafeLock();
          // remove manually deleted FileResources
          if( resource instanceof FileResource ) {
              FileResource fr = (FileResource)resource;
        if( !fr.getFile().exists() ) {
            try {
          fr.delete();
            } catch (MultipleLockException ex) {};
            continue;
        } else {
          size = fr.getFile().length();
        }
          }
          HTTPFrame itsframe = null;
          if (http_class != null)
        itsframe =
            (HTTPFrame) resource.getFrame(http_class);
          if (itsframe != null) {
        // Icon first, if available
        String icon = itsframe.getIcon() ;
        if ( icon != null ) {
            g.append("<img src=\""+
               getIconDirectory() +"/"+ icon+
               "\" alt=\"" + icon + "\">");
        }
        // Resource's name with link:
        if (resource instanceof ContainerInterface) {
            g.append("<a href=\""
               , URLEncoder.encode(name)
               , "/\">"+name+"</a>");
        } else {
            g.append("<a href=\""
               , URLEncoder.encode(name)
               , "\">"+name+"</a>");
        }
        // resource's title, if any:
        String title = itsframe.getTitle();
        if ( title != null ) {
            g.append(" "+title);
        }
        //size (if any)
        if (size != -1) {
            String s = null;
            if (size > 1023) {
          s = " ["+(size/1024)+" KB]";
            } else {
          s = " ["+size+" bytes]";
            }
            g.append(s);
        }
        g.append("<br>\n");
          } else {
        // Resource's name with link:
        g.append(name+
           " (<i>Not available via HTTP.</i>)");
        g.append("<br>\n");
          }
      } catch (InvalidResourceException ex) {
          g.append(name+
          " cannot be loaded (server misconfigured)");
          g.append("<br>\n");
          continue;
      } finally {
          rr.unlock();
      }
        }
    }
    g.close() ;
    listing_stamp = getLastModified() ;
    listing       = g ;
    return true;
      }
  }
View Full Code Here

         int status,
         String title,
         String msg)
    {
  Reply error = request.makeReply(status);
  HtmlGenerator g = CvsFrame.getHtmlGenerator(title);
  g.append("<span class=\"title\">",title,"</span>\n");
  g.append("<p>",msg);
  error.setStream(g);
  return error;
    }
View Full Code Here

  }
  return null;
    }

    protected HtmlGenerator getHtmlGenerator(String title) {
  HtmlGenerator g = new HtmlGenerator(title);
  g.addStyle("BODY {color: black; background: white; "+
       "font-family: serif; margin-top: 35px }\n");
  return g;
    }
View Full Code Here

      case PutListResource.FILE_PB:
      case PutListResource.FILE_DEL:
    return null;
      case PutListResource.FILE_MG:
    Reply   msg = request.makeReply(HTTP.CONFLICT);
    HtmlGenerator g = getHtmlGenerator("Warning");
    g.append ("<H1>Warning</H1> The file on publish space has "+
        "been modified directly but attempting to merge "+
        "has succeed.<p>"+
        "You should update the file before editing "+
        "it again.");
    msg.setStream(g);
    return msg;
      case PutListResource.FILE_CF:
    Reply error = request.makeReply(HTTP.CONFLICT);
    HtmlGenerator gerr = getHtmlGenerator("Warning");
    gerr.append ("<H1>Warning</H1> The file on publish space has "+
           "been modified directly and attempting to merge"+
           " has failed.<p>"+
           "Ask your system administrator.");
    error.setStream(gerr);
    return error;
View Full Code Here

  }
  return super.perform(req);
    }

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

     */

    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

         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

  } else if (action.equals("showdirs")) {
      showdirs = true;
  }

  boolean no_entries = true;
  HtmlGenerator g = getHtmlGenerator(this, "CVS for "+
             getCvsManager().getDirectory());
  addStyleSheet(g);
  g.addLink(new HtmlLink(null, "made", "jigsaw@w3.org"));

  String tablecolor = "white";
  String parentpath = null;
  ResourceReference rr_parent = resource.getParent();
  try {
      Resource parent = rr_parent.lock();
      parentpath = parent.getURLPath();
  } catch (InvalidResourceException ex) {
      getServer().errlog(resource, "Invalid parent");
      throw new RuntimeException("The server is misconfigured.");
  } finally {
      rr_parent.unlock();
  }

  //entries
  boolean nofile   = true;
  boolean nodir    = true;
  Vector  names    = null;
  Vector  dirnames = null;

  //javascript
  g.addScript("JavaScript", "var submitOK = true;\n\n");

  g.addScript("function SelectAll() {\n");
        g.addScript("    len = document.liste.elements.length;\n");
        g.addScript("    var i=0; var checked; var item;\n");
        g.addScript("    if (document.liste.elements[i].checked == true)\n");
        g.addScript("        checked = false;\n");
        g.addScript("    else\n");
        g.addScript("        checked = true;\n");
        g.addScript("    for( i=0; i<len; i++) {\n");
  g.addScript("        item = document.liste.elements[i].name;\n");
  g.addScript("        if (item !='action' && item != 'scope')\n");
        g.addScript("            document.liste.elements[i].checked=checked;");
  g.addScript("\n    }\n");
  g.addScript("}\n\n");

  g.addScript("function confirmDirAction() {\n");
  g.addScript("    len = document.liste.elements.length;\n");
  g.addScript("    var i=0; var item; var oneselected=false;\n");
  g.addScript("    for( i=0; i<len; i++) {\n");
  g.addScript("         item = document.liste.elements[i].name;\n");
  g.addScript("         if (item !='action' && item != 'scope'){\n");
  g.addScript("             if (document.liste.elements[i].checked\n");
  g.addScript("                 == true){\n");
  g.addScript("                 oneselected = true;\n");
  g.addScript("             }\n");
  g.addScript("         }\n");
  g.addScript("    }\n");
  g.addScript("    if (oneselected == false){\n");
  g.addScript("        submitOK = false;\n");
  g.addScript("        alert('No directory selected.');\n");
  g.addScript("    } else {\n");
  g.addScript("        submitOK = true;\n");
  g.addScript("    }\n");
  g.addScript("}\n\n");

  g.addScript("function confirmFileAction() {\n");
  g.addScript("    len = document.liste.elements.length;\n");
  g.addScript("    var i=0; var item; var oneselected=false;\n");
  g.addScript("    if (document.liste.scope[0].checked == true){\n");
  g.addScript("        //Marked files\n");
        g.addScript("        for( i=0; i<len; i++) {\n");
  g.addScript("             item = document.liste.elements[i].name;\n");
  g.addScript("             if (item !='action' && item != 'scope'){\n");
  g.addScript("               if (document.liste.elements[i].checked\n");
  g.addScript("                   == true){\n");
  g.addScript("                   oneselected = true;\n");
  g.addScript("               }\n");
  g.addScript("             }\n");
  g.addScript("        }\n");
  g.addScript("        if (oneselected == false){\n");
  g.addScript("            submitOK = false;\n");
  g.addScript("            alert('No file selected.');\n");
  g.addScript("        }\n");
  g.addScript("    } else if (document.liste.scope[1].checked\n");
  g.addScript("               == true){\n");
  g.addScript("        //Directory\n");
  g.addScript("        if (document.liste.action[1].checked == true\n");
  g.addScript("            ||\n");
  g.addScript("           document.liste.action[2].checked == true){\n");
  g.addScript("           oneselected = true;\n");
  g.addScript("        } else {\n");
  g.addScript("           alert('Command not allowed on directory');\n");
  g.addScript("           oneselected = false;\n");
  g.addScript("        }\n");
  g.addScript("    } else if (document.liste.scope[2].checked\n");
  g.addScript("               == true){\n");
  g.addScript("        //Matching files\n");
  g.addScript("        if (document.liste.regval.value == ''){\n");
  g.addScript("           alert('No regular expression specified.');\n");
  g.addScript("           oneselected = false;\n");
  g.addScript("        } else if (document.liste.action[3].checked "+
        "== true || document.liste.action[4].checked == true){\n");
  g.addScript("            alert('Command not allowed with regular "+
        "expressions');\n");
  g.addScript("            oneselected = false;\n");
  g.addScript("        } else {\n");
  g.addScript("            oneselected = true;\n");
  g.addScript("        }\n");
  g.addScript("    } else {\n");
  g.addScript("        oneselected = true;\n");
  g.addScript("    }\n");
  g.addScript("    if (oneselected == false) {\n");
  g.addScript("        submitOK = false;\n");
  g.addScript("    } else if (document.liste.action[4].checked != \n");
  g.addScript("               true){\n");
  g.addScript("        submitOK = true;\n");
        g.addScript("    } else if (confirm('Do you really want to remove "+
        "these files ?')) {\n");
  g.addScript("        submitOK = true;\n");
        g.addScript("    } else {\n");
  g.addScript("        submitOK = false;\n");
  g.addScript("    }\n");
  g.addScript("}\n\n");

  g.addScript("function accFileSub() {\n");
        g.addScript("    if (submitOK == false) {\n");
        g.addScript("        submitOK = true;\n");
        g.addScript("        return(false);\n");
        g.addScript("    } else {\n");
        g.addScript("        return(true);\n");
  g.addScript("    }\n");
  g.addScript("}\n");

  g.addScript("function accDirSub() {\n");
        g.addScript("    if (submitOK == false) {\n");
        g.addScript("        submitOK = true;\n");
        g.addScript("        return(false);\n");
        g.addScript("    } else {\n");
        g.addScript("        return(true);\n");
  g.addScript("    }\n");
  g.addScript("}\n");

  // Dump all file entries:
  Enumeration gen_enum  = null;
  try {
      gen_enum = getCvsManager().listFiles() ;
      names = Sorter.sortStringEnumeration(gen_enum);
      nofile = (names.size() == 0);
  } catch (CvsException ex) {
      throw new HTTPException(error(this, request,
            "unable to list files",ex));
  }

  // get a vector of directory entries
  try {
      gen_enum = getCvsManager().listDirectories();
      dirnames = Sorter.sortStringEnumeration(gen_enum);
      nodir  = (dirnames.size() == 0);
  } catch (CvsException ex) {
      throw new HTTPException(error(this, request
            , "unable to list directories"
            , ex));
  }

  String head = " [ <a href=\"./\">Up to directory</A> ]";
  if ( ! nofile ) {
      head += " &middot; [ <A HREF=\""+
    resource.getURLPath()+"\">Files</A> ]";
      if ( ! nodir )
    head += " &middot; [ <A HREF=\""+
        resource.getURLPath()+
        "?action=showdirs\">Directories</A> ]";
      else
    head += " &middot; [ Directories ]";
  } else if ( ! nodir ) {
      head += " &middot; [ Files ]";
      head += " &middot; [ <A HREF=\""+
    resource.getURLPath()+
    "?action=showdirs\">Directories</A> ]";
  } else {
      head += " &middot; [ Files ]";
      head += " &middot; [ Directories ]";
  }
  head +=
      " &middot; [ <A HREF=\""+resource.getURLPath()+
      "?action="+(showdirs? "refreshdirs" : "refreshfiles")+
      "\">Refresh</A> ]";

  g.append ("<A NAME=\"top\"></A>");
  g.append("<center>",head,"<hr noshade width=\"80%\"></center>");
  g.append("<center><div class=\"boxcenter\">");
  g.append(" <a class=\"alphalink\" href=\"#"+
     alphabet[0]+"\">"+alphabet[0]+"</a>");
  for (int i = 1; i < alphabet.length; i++)
      g.append(" &middot; <a class=\"alphalink\" href=\"#"+alphabet[i]+
         "\">"+alphabet[i]+"</a>");
  g.append("</div></center>");

  if (!nofile && !showdirs ) {
      no_entries = false;
      // now generate the form
      g.append ("<center>");
      g.append ("<form OnSubmit=\"return(accFileSub());\" "+
          "name=\"liste\" action=\"", resource.getURLPath(),
          "\" method=\"post\">\n");
      g.append ("<table width=\"90%\" border=\"0\" cellspacing=\"0\"",
          "cellpadding=\"0\" nosave>\n") ;
      g.append ("<caption>FILES in ", parentpath, "</caption>\n");
      // Dump entries, sorted:
      int alphaidx = 0;
      for (int i = 0 ; i < names.size() ; i++) {
    String name  = (String)   names.elementAt(i);
    char   ch    = name.charAt(0);
    if (Character.isLetterOrDigit(ch)) {
        if ((alphaidx == 0) || (ch != alphabet[alphaidx-1])) {
      char alpha = alphabet[alphaidx];
      while (ch != alpha) {
          g.append("<a name=\""+alpha+"\"></a>\n");
          alpha = alphabet[++alphaidx];
      }
      if (ch == alpha) {
          g.append("<a name=\""+alpha+"\"></a>\n");
          alphaidx++;
      }
        }
    }
    try {
        dumpFileEntry (g, name) ;
    } catch (CvsException ex) {
        g.append ("<td>" + name +
            "<strong>CVS Failed</strong>\n") ;
    }
      }
      g.append ("<tr><td colspan=\"2\">");
      g.append ("</center><a class=\"script\" "+
          "href=\"javascript:SelectAll()\" "+
          "onMouseOver=\"window.status="+
          "'Select / Unselect all files';"+
          "return true\">All/None</a><center>");
      g.append ("</td></tr>");
      g.append ("</table><p>\n") ;

      // Dump the files command area:
      g.append ("<hr noshade width=\"40%\">");
      g.append ("<table cellpadding=\"10\" align=\"center\" "+
          "width=\"90%\" border=\"0\" cellspacing=\"0\" "+
          "cellpadding=\"0\">");
      // add proposed actions
      g.append ("<tr valign=\"top\"><td>");
      g.append("<strong>Action:</strong><br>\n");
      g.append("<input type=\"radio\" name=\"action\" value=\"addcom\">"
         + " Add into the repository <br>\n");
      g.append("<input type=\"radio\" name=\"action\" value=\"commit\">"
         + " Incorporate changes into the repository <br>\n");
      g.append("<input type=\"radio\" name=\"action\" value=\"update\" "
         + "checked = \"yes\"> Update <br>\n");
      g.append("<input type=\"radio\" name=\"action\" value=\"revert\">"
         + " Revert to selected revision <br>\n");
      g.append("<input type=\"radio\" name=\"action\" value=\"remove\">"+
         " Remove from repository <br>\n");
      g.append("</td>\n<td>\n");
      // add proposed scopes:
      g.append("<strong>Perform action on:</strong><br>\n\n");
      g.append("<input type=\"radio\" name=\"scope\" value=\"mark\""
         + "checked=\"yes\"> Marked files<br>\n");
      g.append("<input type=\"radio\" name=\"scope\" "
         + "value=\"directory\"> Directory<br>\n");
      g.append("<input type=\"radio\" name=\"scope\" value=\"regexp\">"+
         " Matching files <input type=\"text\" name=\"regval\">"+
         "<br>\n");
      g.append("</td></tr>");
      // comments
      g.append("<tr><td colspan=2 align=\"center\">\n");
      g.append ("<p align=\"center\"><strong>Comments for " +
          "add/remove/commit files<br>\n");
      g.append ("<textarea wrap=\"soft\" name=\"comment\" rows=\"3\" "+
          "cols=\"50\">\n") ;
      g.append ("</textarea></td></tr>\n") ;
      // and close the table and the first form
      g.append ("<tr valign=\"top\"><td align=\"center\" " +
          "colspan=\"2\">\n");
      g.append ("<input type=\"submit\" name=\"submit\" " +
          "value=\" Perform Action \" "+
          "onClick=\"confirmFileAction();\">" );
      g.append ("</table>");
      g.append ("</form>\n\n");
      g.append("</table>");
      g.append("</center>\n");
  }

  if (!nodir && showdirs) {
      no_entries = false;
      // the next one is for stephan
      g.append("<A NAME=\"dirs\"></A>");
      // now generate the form
      g.append ("<center>\n");
      g.append("<form OnSubmit=\"return(accDirSub());\" name=\"liste\"",
         " method=\"post\">\n");
      //g.append("<table width=\"80%\">\n") ;
      g.append ("<table width=\"90%\" border=\"0\" cellspacing=\"0\"",
          "cellpadding=\"0\">\n") ;
      g.append("<caption>SUBDIRECTORIES in ", parentpath,
         "</caption>\n");
      // Dump entries, sorted:
      int alphaidx = 0;
      for (int i = 0 ; i < dirnames.size() ; i++) {
    String name = (String) dirnames.elementAt(i);
    char   ch   = name.charAt(0);
    if (Character.isLetterOrDigit(ch)) {
        if ((alphaidx == 0) || (ch != alphabet[alphaidx-1])) {
      char alpha = alphabet[alphaidx];
      while (ch != alpha) {
          g.append("<a name=\""+alpha+"\"></a>\n");
          alpha = alphabet[++alphaidx];
      }
      if (ch == alpha) {
          g.append("<a name=\""+alpha+"\"></a>\n");
          alphaidx++;
      }
        }
    }
    try {
        dumpDirectoryEntry (g, name) ;
    } catch (CvsException e) {
        g.append ("<td>" + name +
            "<strong>CVS Failed</strong>\n") ;
    }
      }
      g.append ("<tr><td colspan=\"2\">");
      g.append ("</center><a class=\"script\" "+
          "href=\"javascript:SelectAll()\" "+
          "onMouseOver=\"window.status="+
          "'Select / Unselect all files';"+
          "return true\">All/None</a><center>");
      g.append ("</td></tr>");
      g.append ("</table><p>\n") ;
      // Dump the dirs command area:
      g.append ("<table align=\"center\" width=\"90%\" width=\"90%\" "+
          "border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
      g.append ("<input type=\"hidden\" name=\"action\" value=\"add\">");
      //hidden scope
      g.append ("<input type=\"hidden\" name=\"scope\""+
          " value=\"subdir\">\n");
      g.append ("<tr><td align=\"center\">",
          "<input type=\"submit\" name=\"submit\" ",
          "value=\"Add marked directories\" "+
          "onClick=\"confirmDirAction();\">\n"+
          "</td></tr>");
      // and close the table and the first form
      g.append ("</table></form>\n\n");
      g.append("</center>\n");
  }
  if (no_entries) {
      g.append("<center>No entries.</center><p>\n");
      //new
      g.append ("<form name=\"liste\""+
          "action=\"", resource.getURLPath(),
          "\" method=\"post\">\n");
      g.append ("<table cellpadding=\"10\" align=\"center\" "+
          "width=\"90%\" border=\"0\" cellspacing=\"0\" "+
          "cellpadding=\"0\">");
      // add proposed actions
      g.append ("<tr valign=\"top\"><td>");
      g.append("<input type=\"hidden\" name=\"action\" ",
         "value=\"update\">");
      // add proposed scopes:
      g.append("<strong>Perform update on:</strong><br>\n\n");
      g.append("<input type=\"radio\" name=\"scope\" "
         + "value=\"directory\"> Directory<br>\n");
      g.append("<input type=\"radio\" name=\"scope\" value=\"regexp\">"+
         " File <input type=\"text\" name=\"regval\">"+
         "<br>\n");
      g.append("</td></tr>");
      // and close the table and the first form
      g.append ("<tr valign=\"top\"><td align=\"center\" " +
          "colspan=\"2\">\n");
      g.append ("<input type=\"submit\" name=\"submit\" " +
          "value=\" Update \">");
      g.append ("</td></tr></table>");
      g.append ("</form>\n\n");
      //end new
  } else {
      g.append("<a name=\"bottom\"></a>");
      g.append("<center><hr noshade width=\"80%\">",head,"</center>");
  }

  g.close() ;
  // Send back the reply:
  Reply reply = request.makeReply(HTTP.OK) ;
  reply.setHeaderValue(reply.H_CACHE_CONTROL, CACHE_CONTROL_NOCACHE);
  reply.setHeaderValue(reply.H_PRAGMA, PRAGMA_NOCACHE);
  reply.setStream(g);
View Full Code Here

    return ;
      }
      if (putlist.publish(pe) == PutListResource.FILE_CF) {
    //send error.
    Reply error = request.makeReply(HTTP.CONFLICT);
    HtmlGenerator gerr = getHtmlGenerator("Warning");
    gerr.append ("<H1>Warning</H1> The file on publish space has "+
           "been modified directly and attempting to merge"+
           " has failed.<p>"+
           "Ask your system administrator.");
    error.setStream(gerr);
    throw new HTTPException(error);
View Full Code Here

TOP

Related Classes of org.w3c.jigsaw.html.HtmlGenerator

Copyright © 2018 www.massapicom. 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.