Commits

J. Ryan Stinnett committed 3f76647

Rebased against upstream at bdb14468b554

Comments (0)

Files changed (7)

bazaarvoice-customizations

 # HG changeset patch
-# Parent 7b20bcd0a784d915c9d71502713bfeceb0fe08f7
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076996 21600
+# Node ID a0baf2a260b3a7d8c496cd32e7b323a571462f52
+# Parent  cb9e8afb804c53f32f271da04674c823adf31f0f
 Bazaarvoice-specific customizations
 
 diff --git a/src/org/opensolaris/opengrok/search/Results.java b/src/org/opensolaris/opengrok/search/Results.java
                  }
                  alt ^= true;
                  out.write(">");
--                out.write("<td class=\"q\"><a id=\"history\" href=\""+context+Constants.histL+rpath+"\" title=\"History\">H</a> <a href=\""+context+Constants.xrefP+rpath+"?a=true\" title=\"Annotate\">A</a> <a id=\"download\" href=\""+context+Constants.rawP+rpath+"\" title=\"Download\">D</a>");
+-                out.write("<td class=\"q\"><a href=\""+context+Constants.histL+rpath+"\" title=\"History\">H</a> <a href=\""+context+Constants.xrefP+rpath+"?a=true\" title=\"Annotate\">A</a> <a href=\""+context+Constants.rawP+rpath+"\" title=\"Download\">D</a>");
 -                out.write("</td>");
 -                out.write("<td class=\"f\"><a href=\"" +
 -                        selfUrl + "\">"+self+"</a>&nbsp;</td><td><tt class=\"con\">");
 diff --git a/src/org/opensolaris/opengrok/search/context/Context.java b/src/org/opensolaris/opengrok/search/context/Context.java
 --- a/src/org/opensolaris/opengrok/search/context/Context.java
 +++ b/src/org/opensolaris/opengrok/search/context/Context.java
-@@ -140,7 +140,7 @@
+@@ -145,7 +145,7 @@
                                  if (out == null) {
                                      Hit hit = new Hit(path,
                                              Util.htmlize(desc[3]).replaceAll(
                                              desc[1], false, alt);
                                      hits.add(hit);
                                      anything = true;
-@@ -154,10 +154,10 @@
+@@ -159,10 +159,10 @@
                                      out.write(desc[1]);
                                      out.write("</span> ");
                                      out.write(Util.htmlize(desc[3]).replaceAll(
                                      anything = true;
                                  }
                              } else {
-@@ -246,7 +246,7 @@
+@@ -251,7 +251,7 @@
              anything = matchedLines > 0;
              tokens.dumpRest();
              if (lim && (truncated || matchedLines == 10) && out != null) {
 diff --git a/src/org/opensolaris/opengrok/web/Util.java b/src/org/opensolaris/opengrok/web/Util.java
 --- a/src/org/opensolaris/opengrok/web/Util.java
 +++ b/src/org/opensolaris/opengrok/web/Util.java
-@@ -349,9 +349,7 @@
+@@ -351,9 +351,7 @@
          out.write("\" href=\"#");
          out.write(snum);
          out.write(closeQuotedTag);
 diff --git a/test/org/opensolaris/opengrok/web/UtilTest.java b/test/org/opensolaris/opengrok/web/UtilTest.java
 --- a/test/org/opensolaris/opengrok/web/UtilTest.java
 +++ b/test/org/opensolaris/opengrok/web/UtilTest.java
-@@ -125,12 +125,12 @@
+@@ -126,12 +126,12 @@
      public void readableLine() throws Exception {
          StringWriter out = new StringWriter();
          Util.readableLine(42, out, null);
  
  .sl {color:#999;text-decoration:underline;}
  td.a{color:#000}
-@@ -146,14 +197,11 @@
- .s  {color:green;} /* strings */
- .c  {color:#666;} /* comments */
- .b  {color:#000; font-weight:bold;} /* comments */
--.k  {color:#000; font-family:monospace;} /* comments */
- .i  {color:#00008b; font-weight:bold;} /* interpolations */
- .di {color:#00008b; font-weight:bold;} /* directives */
- .bi {color:#666;} /* built-in */
--a.s {color:#000;} /* matched lines */
- a.f {color:#909;} /* file locals */
- div.a {color:#000}
--a.h {font-size:small; margin-left:2em;}
- 
- a.d {color:#936; font-weight:bold; text-decoration:none;} /* definitions */
- 
-@@ -184,50 +232,14 @@
- 
- #results {margin-top:.5em;}
- #results .con{font-size:small;color:#000;}
--#more .l, #results .l { color:#666; }
- #results .m {background-color:#ffb;}
- #results i {color: green; font-weight:bold;}
- #results tr.dir{background-color:#C5D5A9;}
- #results td.q {white-space: nowrap;font-size: xx-small;}
+@@ -192,64 +243,8 @@
+ #results td.q {white-space: nowrap;font-size: xx-small;width:3em;}
  #results td.f{width:3em;padding-left:2em;padding-right:.5em;}
  
 -#more { line-height:1.25em;}
  
 -span.blame { }
 -span.blame-hidden { display: none }
+-
+-.sym_list_style {
+-    position:absolute;
+-    top:100px;
+-    left:100px;
+-    width:100px;
+-    height:100px;
+-    overflow:auto;
+-    z-index: 10;
+-    border:solid 1px #c0c0c0;
+-    background-color:#ffffcc;
+-    color:#000;
+-    font-size:12px;
+-    font-family:monospace;
+-    padding:5px;
+-    opacity:0.9;
+-    filter:alpha(opacity=90)
+-}
+-.sym_list_style_hide {
+-    display: none;
+-}
 +.hidden {display: none;}
 diff --git a/web/diff.jsp b/web/diff.jsp
 --- a/web/diff.jsp
                                          }
                                      }
                                  
-@@ -426,29 +478,29 @@
+@@ -426,13 +478,13 @@
  %></pre></div><%
                          }
                      } else {
              } catch (FileNotFoundException e) {
 -		 %><div class="src"><h3 class="error">Error Opening files! <%=Util.htmlize(e.getMessage())%></h3></div><%
 +         %><div class="src"><h3 class="error">Error Opening files! <%=Util.htmlize(e.getMessage())%></h3></div><%
+             } finally {
+                 if(in1 != null)
+                     try {
+@@ -446,16 +498,16 @@
+                 }
              }
-             if(in1 != null)
-                 in1.close();
-             if(in2 != null)
-                 in2.close();
          } else if (g == Genre.IMAGE) {
 -				%> <div class="src">
 -				<table rules="cols" cellpadding="5"><tr><th><%=basename%> (revision <%=r1%>)</th><th><%=basename%> (revision <%=r2%>)</th></tr>
 diff --git a/web/error.jsp b/web/error.jsp
 --- a/web/error.jsp
 +++ b/web/error.jsp
-@@ -30,33 +30,36 @@
+@@ -31,33 +31,36 @@
  String rawSource = environment.getSourceRootPath();
  String configError = "";
  if ("".equals(rawSource)) {
 -   PrintWriter prt = new PrintWriter(wrt);
 -   exception.printStackTrace(prt);
 -   prt.flush();
--   out.write(wrt.toString());
+-   Util.htmlize(wrt.toString(), out);
 -   prt.close();
 -%>
 -</pre>
 +                   PrintWriter prt = new PrintWriter(wrt);
 +                   exception.printStackTrace(prt);
 +                   prt.flush();
-+                   out.write(wrt.toString());
++                   Util.htmlize(wrt.toString(), out);
 +                   prt.close();
 +                %>
 +                </pre>
 diff --git a/web/help.jsp b/web/help.jsp
 --- a/web/help.jsp
 +++ b/web/help.jsp
-@@ -21,94 +21,122 @@
+@@ -21,100 +21,127 @@
  
  --%><%@ page import = "org.opensolaris.opengrok.configuration.RuntimeEnvironment"
               session="false" errorPage="error.jsp" %><%
 +                <p>Range searches allow one to match documents whose field(s) values are between the lower and upper bound specified by the range query. Range queries can be inclusive or exclusive of the upper and lower bounds. Sorting is done lexicographically. Inclusive queries are denoted by square brackets <span class="code code-search">[ ]</span>, exclusive by curly brackets <span class="code code-search">{ }</span>. For example, <span class="code code-search">title:{Aida TO Carmen}</span> will find all documents between Aida to Carmen, exclusive of Aida and Carmen.</p>
                      
 -                <a name="escaping"><u>Escaping special characters:</u></a>
--                <p>Opengrok supports escaping special characters that are part of the query syntax. The current list special characters are:<br/>
+-                <p>Opengrok supports escaping special characters that are part of the query syntax. Current special characters are:<br/>
 -                    <b>+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ </b><br/>
--                To escape these character use the \ before the character. For example to search for (1+1):2 use the query: \(1\+1\)\:2</p> 
+-                To escape these character use the \ before the character. For example to search for <b>(1+1):2</b> use the query: <b>\(1\+1\)\:2</b></p> 
+-                <p>NOTE on analyzers: Indexed words are made up of Alpha-Numeric and Underscore characters. One letter words are usually not indexed as symbols!<br>
+-Most other characters(including single and double quotes) are treated as "spaces/whitespace"(so even if you escape them, they will not be found, since most analyzers ignore them). <br>
+-The exceptions are: <b>@ $ % ^ &amp; = ? . :</b> which are mostly indexed as separate words.<br>
+-Because some of them are part of the query syntax, they must be escaped with a reverse slash as noted above.<br>
+-So searching for <b>\+1</b> or <b>\+ 1</b> will both find <b>+1</b> and <b>+ 1</b>.
++                <h3>Boosting terms</h3>
++                <p>Terms and phrases can be boosted (i.e., made more relevant) using a caret (<span class="code code-search">^</span>) and a positive decimal value to indicate desired boost level (e.g., <span class="code code-search">1.5</span> or <span class="code code-search">3</span>). For instance, <span class="code code-search">help^4 opengrok</span> will boost the term "help". (The default boost level if you don't specify it for a term is 1.)</p>
++                
++                <h2 id="escaping">Escaping special characters</h2>
++                <p>Opengrok supports escaping special characters that are part of the query syntax. The current list of special characters is below:<br/>
++                    <span class="code code-search">+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ </span>
++                <p>To escape these characters, use the backslash (<span class="code code-search">\</span>) symbol before each special character. For example, to search for (1+1):2, enter <span class="code code-search">\(1\+1\)\:2</span> in the General text field.</p>
++                <p>Indexed words are made up of alphanumeric and underscore characters. One letter words are usually not indexed as symbols.<br>
++                    Most other characters (including single and double quotes) are treated as "spaces/whitespace" (so even if you escape them, they will not be found, since most analyzers ignore them). <br>
++                    The exceptions are: <span class="code code-search">@ $ % ^ &amp; = ? . :</span> which are mostly indexed as separate words.<br>
++                    Because some of them are part of the query syntax, they must be escaped with a reverse slash as noted above.<br>
++                    So searching for <span class="code code-search">\+1</span> or <span class="code code-search">\+ 1</span> will both find <span class="code code-search">+1</span> and <span class="code code-search">+ 1</span>.
+                 </p>
 -                    
 -                valid <u>FIELDs</u> are
 -                <pre>
 -                    
 -                <p>Opengrok search is powered by <a href="http://lucene.apache.org/">lucene</a>, for more detail on query syntax refer to lucene docs.</p>
 -            </p>
-+                <h3>Boosting terms</h3>
-+                <p>Terms and phrases can be boosted (i.e., made more relevant) using a caret (<span class="code code-search">^</span>) and a positive decimal value to indicate desired boost level (e.g., <span class="code code-search">1.5</span> or <span class="code code-search">3</span>). For instance, <span class="code code-search">help^4 opengrok</span> will boost the term "help". (The default boost level if you don't specify it for a term is 1.)</p>
-+                
-+                <h2 id="escaping">Escaping special characters</h2>
-+                <p>Opengrok supports escaping special characters that are part of the query syntax. The current list of special characters is below:<br/>
-+                    <span class="code code-search">+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ </span>
-+                <p>To escape these characters, use the backslash (<span class="code code-search">\</span>) symbol before each special character. For example, to search for (1+1):2, enter <span class="code code-search">\(1\+1\)\:2</span> in the General text field.</p>
-+                
 +                <h2>Tips</h2>
 +                <ul>
 +                    <li>Client and file type restrictions can be added via the file path. For example, <span class="code code-search">olay xml</span> will only search *.xml files for the Olay client. (If you want to search across all Olay clients, use a multiple character wildcard: <span class="code code-search">olay* xml</span>.)</li>
          return;
      }
      
--%><form action="<%=context +Constants.diffP+ path%>">
+-%><form action="<%=context +Constants.diffP+ uriEncodedName%>">
 +%>
-+<h2>History log of <a class="code code-path" href="<%= context +Constants.xrefP+ path %>"><%=path%></a></h2>
-+<form action="<%=context +Constants.diffP+ path%>">
++<h2>History log of <a class="code code-path" href="<%= context +Constants.xrefP+ uriEncodedName %>"><%=path%></a></h2>
++<form action="<%=context +Constants.diffP+ uriEncodedName%>">
  <table cellspacing="0" cellpadding="2" border="0" width="100%" class="src" id="revisions">
  <tr>
--    <td colspan="5"><span class="pagetitle">History log of <a href="<%= context +Constants.xrefP+ path %>"><%=path%></a></span></td>
+-    <td colspan="5"><span class="pagetitle">History log of <a href="<%= context +Constants.xrefP+ uriEncodedName %>"><%=path%></a></span></td>
 -</tr>
 -<tr class="thead">
 -    <td>Revision</td><%
 +    %><td class="revision">&nbsp;<%=rev%>&nbsp;</td><%
      } else {
          if (entry.isActive()) {
-             String rp = Util.URIEncodePath(path);
+             String rp = uriEncodedName;
 -%><td>&nbsp;<a name="<%=rev%>" href="<%= context +Constants.xrefP + rp + "?r=" + Util.URIEncode(rev) %>"><%=rev%></a>&nbsp;</td><td align="center">
 +%><td class="revision">&nbsp;<a name="<%=rev%>" href="<%= context +Constants.xrefP + rp + "?r=" + Util.URIEncode(rev) %>"><%=rev%></a>&nbsp;</td><td align="center">
-     <input type="radio" <% if (count==0) {%>disabled<% } else if (count==1) {%>checked<%} %> name="r1" value="<%=rp%>@<%=rev%>"/>
-     <input type="radio" name="r2" <% if (count==0) {%>checked<% } %> value="<%=rp%>@<%=rev%>"/></td><%
+     <input type="radio" <% if (count==0) {%>disabled="disabled"<% } else if (count==1) {%>checked="checked"<%} %> name="r1" value="<%=rp%>@<%=rev%>"/>
+     <input type="radio" name="r2" <% if (count==0) {%>checked="checked"<% } %> value="<%=rp%>@<%=rev%>"/></td><%
          } else {
 @@ -149,7 +161,7 @@
    %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
  }
 @@ -202,4 +214,4 @@
          }
-         %><p class="rssbadge"><a href="<%=context+Constants.rssP+Util.URIEncodePath(path)%>"><img src="<%=context%>/<%=environment.getWebappLAF()%>/img/rss.png" width="80" height="15" alt="RSS XML Feed" title="RSS XML Feed of latest changes"/></a></p><%
+         %><p class="rssbadge"><a href="<%=context+Constants.rssP+uriEncodedName%>"><img src="<%=context%>/<%=environment.getWebappLAF()%>/img/rss.png" width="80" height="15" alt="RSS XML Feed" title="RSS XML Feed of latest changes"/></a></p><%
  }
 -%><%@include file="foot.jspf"%>
 +%></div><%@include file="foot.jspf"%>
 diff --git a/web/index.jsp b/web/index.jsp
 --- a/web/index.jsp
 +++ b/web/index.jsp
-@@ -35,16 +35,22 @@
+@@ -33,16 +33,22 @@
  String path = null;
  String sort = null;
  RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
 diff --git a/web/list.jsp b/web/list.jsp
 --- a/web/list.jsp
 +++ b/web/list.jsp
-@@ -33,32 +33,16 @@
+@@ -33,7 +33,15 @@
  org.opensolaris.opengrok.web.*,
  org.opensolaris.opengrok.history.*
  "
 +<body class="page page-list">
 +<%@include file="mast.jsp"%>
  <% if (!isDir) { %>
--<style type="text/css">
--    .sym_list_style {
--        position:absolute;
--        top:100px;
--        left:100px;
--        width:100px;
--        height:100px;
--        overflow:auto;
--        z-index: 10;
--        border:solid 1px #c0c0c0;
--        background-color:#ffffcc;
--        color:#000;
--        font-size:12px;
--        font-family:monospace;
--        padding:5px;
--        opacity:0.9;
--        filter:alpha(opacity=90)
--    }
--
--    .sym_list_style_hide {
--        display: none;
--    }
--}
--</style>
  <script type="text/javascript">/* <![CDATA[ */
  function lntoggle() {
-    $("a").each(function() {
-@@ -78,10 +62,10 @@
+@@ -54,19 +62,16 @@
  function get_sym_list_contents()
  {
      var contents = "";
 -
--    contents += "<input id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
--    contents += "&nbsp;&nbsp;";
--    contents += "<b><a href=\"#\" onclick=\"javascript:add_highlight();return false;\" title=\"Add highlight\">Highlight</a></b><br>";
-+    contents +="<label for=\"input_highlight\" title=\"Usages and definitions of macros/functions/classes; recommended for ftl, js, and java files\"><span class=\"fieldLabel\">Usages</span><span class=\"fieldHelper\"><span class=\"hint hint-case-sensitive\" title=\"case sensitive\">&nbsp;</span></span></label>";
-+    contents += "<input type=\"text\" id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
-+    contents += "<button class=\"primary\" onclick=\"javascript:add_highlight();return false;\" title=\"Highlight references (macro/function/class definitions)\">Highlight</button>";
+-    //contents += "<input id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
+-    //contents += "&nbsp;&nbsp;";
+-    //contents += "<b><a href=\"#\" onclick=\"javascript:add_highlight();return false;\" title=\"Add highlight\">Highlight</a></b><br>";
+-    contents += "<a href=\"#\" onclick=\"javascript:lsttoggle();\">[Close]</a><br>"
++    contents += "<label for=\"input_highlight\" title=\"Usages and definitions of macros/functions/classes; recommended for ftl and java files\"><span class=\"fieldLabel\">Usages</span><span class=\"fieldHelper\"><span class=\"hint hint-case-sensitive\" title=\"case sensitive\">&nbsp;</span></span></label>";
++    //contents += "<input type=\"text\" id=\"input_highlight\" name=\"input_highlight\" class=\"q\"/>";
++    //contents += "<button class=\"primary\" onclick=\"javascript:add_highlight();return false;\" title=\"Highlight references (macro/function/class definitions)\">Highlight</button>";
 +    contents += "<ul class=\"list-definitions list-definitions-master\" id=\"list-definitions-master-id\">"
++    contents += "<a href=\"#\" onclick=\"javascript:lsttoggle();\">[Close]</a><br>";
  
-     var class_names=[
-         "xm",
-@@ -127,9 +111,9 @@
-                         // Use line number as accurate anchor
-                         var line = this.getAttribute("ln");
+     var symbol_classes = get_sym_list();
+     for (var i = 0; i < symbol_classes.length; i++) {
+-        if (i > 0) {
+-            contents += "<br/>";
+-        }
+         var symbol_class = symbol_classes[i];
+-        contents += "<b>" + symbol_class[0] + "</b><br/>";
++        contents += "<li class=\"list-definitions-type\">" + symbol_class[0] + "<ul class=\"list-definitions\">";
  
--                        class_contents[i] += "<a href=\"#" +
-+                        class_contents[i] += "<li><a href=\"#" +
-                             line + "\" class=\"" + class_names[i] + "\">" +
--                            this.innerHTML + "</a><br>";
-+                            this.innerHTML + "</a></li>";
+         var class_name = symbol_class[1];
  
-                     }
- 
-@@ -144,22 +128,19 @@
-     {
-         if (class_contents[i] != "")
-         {
--            if (count > 0)
--            {
--                contents += "<br>"
--            }
--            contents += "<b>" + type_names[i] + "</b><br>"
-+            contents += "<li class=\"list-definitions-type\">" + type_names[i] + "<ul class=\"list-definitions\">"
-             contents += class_contents[i];
--
-+            contents += "</ul></li>"
-             count++;
+@@ -76,11 +81,14 @@
+             var symbol = symbols[j][0];
+             var line = symbols[j][1];
+             contents +=
+-                "<a href=\"#" + line + "\" class=\"" + class_name + "\">" +
+-                escape_html(symbol) + "</a><br/>";
++                "<li><a href=\"#" + line + "\" class=\"" + class_name + "\">" +
++                escape_html(symbol) + "</a></li>";
          }
++        
++        contents += "</ul></li>";
      }
  
-+    contents += "</ul>"
++    contents += "</ul>";
      return contents;
  }
  
+@@ -92,7 +100,7 @@
+ }
+ 
  // Initial value
 -document.sym_div_width = 240;
 +document.sym_div_width = 320;
  document.sym_div_height_max = 480;
  document.sym_div_top = 100;
  document.sym_div_left_margin = 40;
-@@ -167,7 +148,7 @@
+@@ -100,7 +108,7 @@
  
  function get_sym_div_left()
  {
      return document.sym_div_left;
  }
  
-@@ -196,10 +177,10 @@
+@@ -129,10 +137,10 @@
      if (document.sym_div == null)
      {
          document.sym_div = document.createElement("div");
          document.sym_div.style.width = get_sym_div_width() + "px";
          document.sym_div.style.height = get_sym_div_height() + "px";
          document.sym_div.style.top = get_sym_div_top() + "px";
-@@ -209,12 +190,16 @@
+@@ -142,12 +150,16 @@
  
          document.body.appendChild(document.sym_div);
          document.sym_div_shown = 1;
              document.sym_div_shown = 0;
          }
          else
-@@ -223,7 +208,7 @@
+@@ -156,7 +168,7 @@
              document.sym_div.style.width = get_sym_div_width() + "px";
              document.sym_div.style.top = get_sym_div_top() + "px";
              document.sym_div.style.left = get_sym_div_left() + "px";
              document.sym_div_shown = 1;
          }
      }
-@@ -264,11 +249,13 @@
+@@ -197,11 +209,13 @@
  function HighlightKeyword(keyword)
  {
      var high_colors=[
  
      var pattern = "a:contains('" + keyword + "')";
      $(pattern).css({
-@@ -415,7 +402,7 @@
+@@ -339,7 +353,7 @@
  
                          if (br != null) {
                            int len = 0;
                            while((len = br.read(buf)) > 0) {
                                out.write(buf, 0, len);
                            }
-@@ -460,7 +447,7 @@
+@@ -384,7 +398,7 @@
                          if (g == Genre.DATA || g == Genre.XREFABLE || g == null) {
  		            %><div id="src">Binary file [Click <a href="<%=context%>/raw<%=path%>?r=<%=rev%>">here</a> to download] </div><%
                          } else {
 -		            %><div id="src"><span class="pagetitle"><%=basename%> revision <%=rev%> </span><pre><%
 +		            %><div id="src"><h2><%=basename%> revision <%=rev%> </h2><pre><%
                              if (g == Genre.PLAIN) {
-                                 Annotation annotation = annotate ? HistoryGuru.getInstance().annotate(resourceFile, rev) : null;
-                                 //annotation.writeTooltipMap(out); //not needed yet
-@@ -548,7 +535,7 @@
+                                 // We don't have any way to get definitions
+                                 // for old revisions currently.
+@@ -484,7 +498,7 @@
              }
          }
      }
 diff --git a/web/mast.jsp b/web/mast.jsp
 --- a/web/mast.jsp
 +++ b/web/mast.jsp
-@@ -29,13 +29,11 @@
-              org.opensolaris.opengrok.web.EftarFileReader,
+@@ -29,7 +29,7 @@
               org.opensolaris.opengrok.web.Util,
+              org.opensolaris.opengrok.web.Constants,
               org.opensolaris.opengrok.history.HistoryGuru"
 -             %><%@ page session="false" %><%@ page errorPage="error.jsp"%><%
 +             %><%
- String context = request.getContextPath();
- String servlet = request.getServletPath();
- String reqURI = request.getRequestURI();
--String path = request.getPathInfo();
- if (path == null) path = "";
--RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
- environment.setUrlPrefix(context + Constants.searchR + "?");
- environment.register();
- String rawSource = environment.getSourceRootPath();
-@@ -129,10 +127,8 @@
+ 
+ // Use UTF-8 if no encoding is specified in the request
+ if (request.getCharacterEncoding() == null) {
+@@ -136,7 +136,6 @@
              } catch (Exception e) {
                  dtag = "";
              }
 -    String pageTitle="Cross Reference: " + path;
- 
--%><%@ include file="httpheader.jspf" %><%//below style is for the fancy always on top search bar%>
+     String rev = request.getParameter("r");
+             if (rev == null) {
+                 rev = "";
+@@ -145,7 +144,6 @@
+             }
+     String h = request.getParameter("h");
+ %><%@ include file="httpheader.jspf" %><%//below style is for the fancy always on top search bar%>
 -<body style="overflow:hidden;">
-+%><%//below style is for the fancy always on top search bar%>
- <script type="text/javascript" src="<%=context%>/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="<%=context%>/jquery-1.4.4.min.js"></script>
  <script type="text/javascript">/* <![CDATA[ */
-     $().ready(function() {
-@@ -145,8 +141,8 @@
+ function get_annotations() {
+@@ -167,8 +165,8 @@
  function toggle_annotations() {
    $("span").each(function() {      
        if (this.className == 'blame') {
           this.className = 'blame';
        }
       }
-@@ -155,90 +151,100 @@
+@@ -177,83 +175,85 @@
  $().ready(function() {
-     $('a[id=r]').tooltip({
+     $('a[name=r]').tooltip({
          left: 5,
 -	showURL: false
 -       });    
-+	    showURL: false
-+        });
-+    /* TODO: The following code to hide the highlight icon doesn't work because 
-+             we don't create div.sym_list until after the highlight icon is clicked, 
-+             which means the ul#list-definitions-master always has a length of 0 on page load.
-+             See list.jsp for lsttoggle() and get_sym_list_contents().
-+    */
-+    /*if ($('#list-definitions-master-id').has('li').length > 0) {
-+        $('#highlight-link').css('display', 'inline');
-+    }*/
- } );
+-} );
++        showURL: false
++    });    
++});
  /* ]]> */</script>
  <% } %>
 -<div id="page">
 -        if (noHistory || servlet.startsWith(Constants.histS)) {
 -        %> <span class="c" id="history">History</span><%
 -        } else {
--        %><a id="history" href="<%=context+Constants.histL+path%>">History</a><%
+-        %><a id="history" href="<%=context+Constants.histL+uriEncodedName%>">History</a><%
 -        }
 -        if (noAnnotation) {
 -        %> | <span class="c" id="annotate">Annotate</span><%
--        } else {
--           String rev = request.getParameter("r");
--            if (rev == null) {
--                rev = "";
--            } else if (rev.length() > 0) {
--                rev = "&r=" + rev;
--            }
--        
+-        } else {       
 -            if (Boolean.parseBoolean(request.getParameter("a"))) {
 -        %> | <span id="toggle-annotate-by-javascript" style="display: none">
 -            <a href="#" onclick="javascript:toggle_annotations(); return false;" title="Show or hide line annotation(commit revisions,authors)." >Annotate</a>
 -        </span>
 -        <span id="toggle-annotate">
--            <a href="<%=context+Constants.xrefP+path%><%
+-            <a href="<%=context+Constants.xrefP+uriEncodedName%><%
 -               if (rev.length() > 0) { 
 -               %>?<%=rev%><% 
 -           } %>">Annotate</a></span>
 -            // -->
 -        </script> <%
 -        } else {
--        %> | <a href="<%=context+Constants.xrefP+path%>?a=true<%=rev%>">Annotate</a><%
+-        %> | <a href="#" onclick="javascript:get_annotations(); return false;">Annotate</a><%
 -        }
 -    }    
 -            if (!isDir) {
 -                if ( servlet.startsWith(Constants.xrefS) ) {
--               %> | <a href="#" onclick="javascript:lntoggle();return false;" title="Show or hide line numbers (might be slower if file has more than 10 000 lines).">Line #</a> | <a href="#" onclick="javascript:lsttoggle();return false;" title="Show or hide symbol list.">List</a><%
+-               %> | <a href="#" onclick="javascript:lntoggle();return false;" title="Show or hide line numbers (might be slower if file has more than 10 000 lines).">Line #</a> | <a href="#" onclick="javascript:lsttoggle();return false;" title="Show or hide symbol list.">Navigate</a><%
 +                    if(isDir) {
 +                        if(path.length() > 0) {
 +                            %><input type="checkbox" id="path" name="path" value="<%=path%>"/><label for="path">only in <span class="code"><%=path%></span></label><%
 +                <% if (noHistory || servlet.startsWith(Constants.histS)) {
 +                    %><span class="c history" title="Open file history (currently not available)">&nbsp;</span>
 +                <% } else {
-+                %><a class="history" href="<%=context+Constants.histL+path%>" title="Open file history">&nbsp;</a><%
++                %><a class="history" href="<%=context+Constants.histL+uriEncodedName%>" title="Open file history">&nbsp;</a><%
                  }
--               String rev = request.getParameter("r");
--               if (rev == null || rev.equals("")) {
--        %> | <a id="download" href="<%=context+Constants.rawP+path%>">Download</a><%
+-               String lrev = request.getParameter("r");
+-               if (lrev == null || lrev.equals("")) {
+-        %> | <a id="download" href="<%=context+Constants.rawP+uriEncodedName%>">Download</a><%
 -        } else {
--        %> | <a id="download" href="<%=context+Constants.rawP+path%>?r=<%=rev%>">Download</a><%
+-        %> | <a id="download" href="<%=context+Constants.rawP+uriEncodedName%>?r=<%=lrev%>">Download</a><%
 -        }
 -     }
 +                if (noAnnotation) {
 +                %><span class="c annotate" title="Show/hide line annotation (currently not available)">&nbsp;</span><%
 +                } else {
-+                   String rev = request.getParameter("r");
-+                    if (rev == null) {
-+                        rev = "";
-+                    } else if (rev.length() > 0) {
-+                        rev = "&r=" + rev;
-+                    }
++                    if (Boolean.parseBoolean(request.getParameter("a"))) {
++                %><span id="toggle-annotate-by-javascript" style="display: none">
++                    <a class="annotate" href="#" onclick="javascript:toggle_annotations(); return false;" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a>
++                </span>
++                <span id="toggle-annotate">
++                    <a class="annotate" href="<%=context+Constants.xrefP+path%><%
++                       if (rev.length() > 0) { 
++                           %>?<%=rev%><% 
++                       } %>" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a></span>
++                <script type="text/javascript">
++                    <!--
++                    var toggle_js = document.getElementById('toggle-annotate-by-javascript'); 
++                    var toggle_ss = document.getElementById('toggle-annotate');
  
 -     Project proj = Project.getProject(resourceFile);
 -     //if (proj != null || !environment.hasProjects())
 -        %>
 -</div></form></div>
 -        <div id="content"><%
-+                    if (Boolean.parseBoolean(request.getParameter("a"))) {
-+                %><span id="toggle-annotate-by-javascript" style="display: none">
-+                    <a class="annotate" href="#" onclick="javascript:toggle_annotations(); return false;" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a>
-+                </span>
-+                <span id="toggle-annotate">
-+                    <a class="annotate" href="<%=context+Constants.xrefP+path%><%
-+                       if (rev.length() > 0) { 
-+                           %>?<%=rev%><% 
-+                       } %>" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a></span>
-+                <script type="text/javascript">
-+                    <!--
-+                    var toggle_js = document.getElementById('toggle-annotate-by-javascript'); 
-+                    var toggle_ss = document.getElementById('toggle-annotate');
-+
 +                    toggle_js.style.display = 'inline';
 +                    toggle_ss.style.display = 'none';
 +                    // -->
 +                </script> <%
 +                } else {
-+                %><a class="annotate" href="<%=context+Constants.xrefP+path%>?a=true<%=rev%>" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a><%
++                %><a class="annotate" href="#" onclick="javascript:get_annotations(); return false;" title="Show/hide line annotation (commit revisions, authors)">&nbsp;</a><%
 +                }
 +            }    
 +                    if (!isDir) {
 +                       %><a class="linenumbers" href="#" onclick="javascript:lntoggle();return false;" title="Show/hide line numbers (might be slower if file has more than 10,000 lines)">&nbsp;</a>
 +                       <a id="highlight-link" class="highlight" href="#" onclick="javascript:lsttoggle();return false;" title="Show/hide references highlighter pop-in">&nbsp;</a><%
 +                        }
-+                       String rev = request.getParameter("r");
-+                       if (rev == null || rev.equals("")) {
-+                %><a class="download" href="<%=context+Constants.rawP+path%>" title="Download this file">&nbsp;</a><%
++                       String lrev = request.getParameter("r");
++                       if (lrev == null || lrev.equals("")) {
++                %><a class="download" href="<%=context+Constants.rawP+uriEncodedName%>" title="Download this file">&nbsp;</a><%
 +                } else {
-+                %><a class="download" href="<%=context+Constants.rawP+path%>?r=<%=rev%>" title="Download this file">&nbsp;</a><%
++                %><a class="download" href="<%=context+Constants.rawP+uriEncodedName%>?r=<%=lrev%>" title="Download this file">&nbsp;</a><%
 +                }
 +             }
 +            %>
     });
  /* ]]> */
  </script>
-@@ -89,74 +88,62 @@
+@@ -89,76 +88,64 @@
  /* ]]> */
  </script>
  <%}%>
 -                                        <td>in project(s): <span style="padding-left:60px;font-size:small"><a tabindex="6" href="#" onclick="javascript:selectAllProjects();return false;">select all</a>&nbsp;|&nbsp;<a href="#" tabindex="7" onclick="javascript:invertAllProjects();return false;">invert selection</a></span></td>
 -                                    </tr>
 -                                    <tr><td>
--                                            <select tabindex="8" onkeyup="javascript:checkEnter(event);" class="q" style="width: 300px" id="project" name="project" multiple="multiple" size="<%=Math.min(6, env.getProjects().size())%>">
+-                                            <select tabindex="8" ondblclick="javascript:goFirstProject();" onkeyup="javascript:checkEnter(event);" class="q" style="width: 300px" id="project" name="project" multiple="multiple" size="<%=Math.min(6, env.getProjects().size())%>">
 -                                <%
 -                                for (Project p : env.getProjects()) {
 -                                    //TODO below "selected" has no effect if one refreshes the page with F5
--                                %><option ondblclick="javascript:goFirstProject();" value="<%=Util.formQuoteEscape(p.getDescription())%>"<%
+-                                    //also below ondblclick doesn't work in IE ...
+-                                    // ondblclick="javascript:goFirstProject();"
+-                                %><option value="<%=Util.formQuoteEscape(p.getDescription())%>"<%
 -                                          if (project != null) {
 -                                              String projectPath = p.getDescription();
 -                                              for (Iterator it = project.iterator(); it.hasNext();) {
 +                    <a tabindex="6" href="#" class="searchScopeOptionsAll" title="Select all" onclick="javascript:selectAllProjects();return false;">&nbsp;</a>
 +                    <a tabindex="7" href="#" class="searchScopeOptionsInverse" title="Select inverse" onclick="javascript:invertAllProjects();return false;">&nbsp;</a>
 +                </div>
-+                <select tabindex="8" onkeyup="javascript:checkEnter(event);" class="q" id="project" name="project" multiple="multiple" size="<%=Math.min(6, env.getProjects().size())%>">
++                <select tabindex="8" ondblclick="javascript:goFirstProject();" onkeyup="javascript:checkEnter(event);" class="q" id="project" name="project" multiple="multiple" size="<%=Math.min(6, env.getProjects().size())%>">
 +                    <%for (Project p : env.getProjects()) {
 +                        //TODO below "selected" has no effect if one refreshes the page with F5
-+                        %><option ondblclick="javascript:goFirstProject();" value="<%=Util.formQuoteEscape(p.getDescription())%>"<%
++                        //also below ondblclick doesn't work in IE ...
++                        // ondblclick="javascript:goFirstProject();"
++                        %><option value="<%=Util.formQuoteEscape(p.getDescription())%>"<%
 +                            if (project != null) {
 +                                String projectPath = p.getDescription();
 +                                for (Iterator it = project.iterator(); it.hasNext();) {
 diff --git a/web/status.jsp b/web/status.jsp
 --- a/web/status.jsp
 +++ b/web/status.jsp
-@@ -30,67 +30,71 @@
+@@ -27,26 +27,30 @@
+  session="false" errorPage="error.jsp" %><%@ include file="projects.jspf" %><%
  RuntimeEnvironment environment = RuntimeEnvironment.getInstance();
  environment.register();
- HistoryGuru historyGuru = HistoryGuru.getInstance();
 -String pageTitle = "Status";
 +String pageTitle = "Inspector Gadget status";
   %><%@ include file="httpheader.jspf" %>
 -        This page is only used for testing purposes to dump some of the
 -        internal settings on your OpenGrok server.
 -    </p>
--    <table border="1" width="100%">
--        <tr>
--            <th>Variable</th><th>Value</th>
--        </tr>
--        <tr>
--            <td>Source root</td><td><%=environment.getSourceRootPath()%></td>
--        </tr>
--        <tr>
--            <td>Data root</td><td><%=environment.getDataRootPath()%></td>
--        </tr>
--        <tr>
--            <td>CTags</td><td><%=environment.getCtags()%></td>
--        </tr>
--        <tr>
--            <td>Bug page</td><td><%=environment.getBugPage()%></td>
--        </tr>
--        <tr>
--            <td>Bug pattern</td><td><%=environment.getBugPattern()%></td>
--        </tr>
--        <tr>
--            <td>User page</td><td><%=environment.getUserPage()%></td>
--        </tr>
--        <tr>
--            <td>Review page</td><td><%=environment.getReviewPage()%></td>
--        </tr>
--        <tr>
--            <td>Review pattern</td><td><%=environment.getReviewPattern()%></td>
--        </tr>
--        <tr>
--            <td>Using projects</td><td><%=environment.hasProjects()%></td>
--        </tr>
--        <tr>
--            <td>Ignored files</td><td><ul><%
--            for (String s : environment.getIgnoredNames().getItems()) {
--              %><li><%=s%></li><%
--            }
--            %></ul></td>
--        </tr>
--        <tr>
--            <td>Index word limit</td><td><%=environment.getIndexWordLimit()%></td>
--        </tr>
--        <tr>
--            <td>Allow leading wildcard in search</td><td><%=environment.isAllowLeadingWildcard()%></td>
--        </tr>
--        <tr>
--            <td>History cache</td>
--            <td><%=Util.htmlize(historyGuru.getCacheInfo())%></td>
--        </tr>
+-    <%
+-    if (environment.isChattyStatusPage()) {
+-        Util.dumpConfiguration(out);
+-    } else {%>
+-    <p>
+-        For security reasons, printing of internal settings is not enabled by
+-        default. To enable, set the property <tt>chattyStatusPage</tt> to
+-        <tt>true</tt> in <tt>configuration.xml</tt>.
+-    </p><%}%>
+-</div>
+-<%@include file="foot.jspf"%>
 +<body class="page page-status">
 +    <div id="wrapper">
 +        <%@ include file="pageheader.jspf" %>
 +                    This page is only used for testing purposes to dump some of the
 +                    internal settings on Inspector Gadget's OpenGrok server.
 +                </p>
-+                <table border="1" width="100%">
-+                    <tr>
-+                        <th>Variable</th><th>Value</th>
-+                    </tr>
-+                    <tr>
-+                        <td>Source root</td><td><%=environment.getSourceRootPath()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Data root</td><td><%=environment.getDataRootPath()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>CTags</td><td><%=environment.getCtags()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Bug page</td><td><%=environment.getBugPage()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Bug pattern</td><td><%=environment.getBugPattern()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>User page</td><td><%=environment.getUserPage()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Review page</td><td><%=environment.getReviewPage()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Review pattern</td><td><%=environment.getReviewPattern()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Using projects</td><td><%=environment.hasProjects()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Ignored files</td><td><ul><%
-+                        for (String s : environment.getIgnoredNames().getItems()) {
-+                          %><li><%=s%></li><%
-+                        }
-+                        %></ul></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Index word limit</td><td><%=environment.getIndexWordLimit()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>Allow leading wildcard in search</td><td><%=environment.isAllowLeadingWildcard()%></td>
-+                    </tr>
-+                    <tr>
-+                        <td>History cache</td>
-+                        <td><%=Util.htmlize(historyGuru.getCacheInfo())%></td>
-+                    </tr>
- 
--    </table>
--</div>
--<%@include file="foot.jspf"%>
-+                </table>
++                <%
++                if (environment.isChattyStatusPage()) {
++                    Util.dumpConfiguration(out);
++                } else {%>
++                <p>
++                    For security reasons, printing of internal settings is not enabled by
++                    default. To enable, set the property <tt>chattyStatusPage</tt> to
++                    <tt>true</tt> in <tt>configuration.xml</tt>.
++                </p><%}%>
 +            </div>
 +        </div>
 +        <%@include file="foot.jspf"%>
 # HG changeset patch
-# Parent e6ef0f2df4c1a0d7bc6e8cc7a7d6d0428ba3c5f9
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID ac64ff6eac7de69b2a509f28e7207cfe0d9a57f6
+# Parent  af951aeaeba8e7971f4143c1958d37e2b7e493e2
 Add support for escaping markup
 
 diff --git a/src/org/opensolaris/opengrok/util/StringUtils.java b/src/org/opensolaris/opengrok/util/StringUtils.java

freemarker-support

 # HG changeset patch
-# Parent b9ca4c8026883a59948686ed299632a3a254407c
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID 3d24e2d206cf5d240bbe9f833d4f9ffea7cfec61
+# Parent  ac64ff6eac7de69b2a509f28e7207cfe0d9a57f6
 Adds support for FreeMarker files
 
 diff --git a/build.xml b/build.xml
 --- a/build.xml
 +++ b/build.xml
-@@ -142,15 +142,17 @@
+@@ -141,15 +141,17 @@
      <fail unless="JFlex.present" message="Please download JFlex (http://jflex.de/) and put JFlex.jar it into ./lib directory (or in ant classpath)."/>
  
      <taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpathref="lib.search.path"/>    
  import org.opensolaris.opengrok.analysis.java.JavaAnalyzerFactory;
  import org.opensolaris.opengrok.analysis.lisp.LispAnalyzerFactory;
  import org.opensolaris.opengrok.analysis.perl.PerlAnalyzerFactory;
-@@ -69,6 +57,20 @@
+@@ -70,6 +58,20 @@
  import org.opensolaris.opengrok.history.HistoryReader;
  import org.opensolaris.opengrok.web.Util;
  
  /**
   * Manages and porvides Analyzers as needed. Please see
   * <a href="http://www.opensolaris.org/os/project/opengrok/manual/internals/">
-@@ -134,7 +136,8 @@
+@@ -136,7 +138,8 @@
              new LispAnalyzerFactory(),
              new TclAnalyzerFactory(),
              new SQLAnalyzerFactory(),
 diff --git a/src/org/opensolaris/opengrok/analysis/Ctags.java b/src/org/opensolaris/opengrok/analysis/Ctags.java
 --- a/src/org/opensolaris/opengrok/analysis/Ctags.java
 +++ b/src/org/opensolaris/opengrok/analysis/Ctags.java
-@@ -77,6 +77,13 @@
+@@ -80,6 +80,13 @@
              command.add("--fields=-anf+iKnS");
              command.add("--excmd=pattern");
              command.add("--regex-Asm=/^[ \\t]*(ENTRY|ENTRY2|ALTENTRY)[ \\t]*\\(([a-zA-Z0-9_]+)/\\2/f,function/");  // for assmebly definitions
 # HG changeset patch
-# Parent f2944a37c7ef5373def854cd7b1642a1b5783525
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID 2c7b12cd8f5fd7a72b2543cf90020027366c3894
+# Parent  bdb14468b554a875d2200945f67d4614bbdb80f8
 Ignore IDEA project files
 
 diff --git a/.hgignore b/.hgignore
 # HG changeset patch
-# Parent 52250192857ebda1790aea629ffa865198edb671
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID af951aeaeba8e7971f4143c1958d37e2b7e493e2
+# Parent  2c7b12cd8f5fd7a72b2543cf90020027366c3894
 Fixed SVN issues with symlink handling
 
 diff --git a/src/org/opensolaris/opengrok/configuration/Project.java b/src/org/opensolaris/opengrok/configuration/Project.java
          }
  
          List<String> cmd = new ArrayList<String>();
-@@ -174,7 +180,12 @@
+@@ -176,7 +182,12 @@
  
          File directory = new File(directoryName);
  
 # HG changeset patch
-# Parent bdfa7e3f856b55d876b91cf97cd3e245346464df
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID e531bb8f756c408c77f86fd719de68ad2fe83aba
+# Parent  3d24e2d206cf5d240bbe9f833d4f9ffea7cfec61
 Change to a table for xrefs for easier copying
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 --- a/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 +++ b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
-@@ -23,240 +23,314 @@
+@@ -23,9 +23,16 @@
  
  package org.opensolaris.opengrok.analysis;
  
--import java.io.CharArrayReader;
--import java.io.IOException;
--import java.io.Reader;
--import java.io.Writer;
--import java.lang.reflect.Field;
--import java.util.Set;
- import org.opensolaris.opengrok.configuration.Project;
- import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
- import org.opensolaris.opengrok.history.Annotation;
- import org.opensolaris.opengrok.web.Util;
++import org.opensolaris.opengrok.analysis.Definitions.Tag;
++import org.opensolaris.opengrok.configuration.Project;
++import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
++import org.opensolaris.opengrok.history.Annotation;
++import org.opensolaris.opengrok.web.Util;
++
+ import java.io.CharArrayReader;
+ import java.io.IOException;
+ import java.io.Reader;
++import java.io.StringWriter;
+ import java.io.Writer;
+ import java.lang.reflect.Field;
+ import java.util.Comparator;
+@@ -33,12 +40,8 @@
+ import java.util.Map;
+ import java.util.Set;
+ import java.util.SortedSet;
++import java.util.Stack;
+ import java.util.TreeSet;
+-import org.opensolaris.opengrok.analysis.Definitions.Tag;
+-import org.opensolaris.opengrok.configuration.Project;
+-import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
+-import org.opensolaris.opengrok.history.Annotation;
+-import org.opensolaris.opengrok.web.Util;
  
-+import java.io.CharArrayReader;
-+import java.io.IOException;
-+import java.io.Reader;
-+import java.io.StringWriter;
-+import java.io.Writer;
-+import java.lang.reflect.Field;
-+import java.util.Set;
-+import java.util.Stack;
-+
  /**
   * Base class for Xref lexers.
-  *
+@@ -46,14 +49,20 @@
   * @author Lubos Kosco
   */
  public abstract class JFlexXref {
--  public Writer out;
--  public String urlPrefix = RuntimeEnvironment.getInstance().getUrlPrefix();
--  public Annotation annotation;
--  public Project project;
--  protected Definitions defs;
+-    public Writer out;
 +    public StringWriter out;
-+    public String urlPrefix = RuntimeEnvironment.getInstance().getUrlPrefix();
-+    public Annotation annotation;
-+    public Project project;
-+    protected Definitions defs;
+     public String urlPrefix = RuntimeEnvironment.getInstance().getUrlPrefix();
+     public Annotation annotation;
+     public Project project;
+     protected Definitions defs;
++
+     /** EOF value returned by yylex(). */
+     private final int yyeof;
  
--  /** EOF value returned by yylex(). */
--  private final int yyeof;
-+    /**
-+     * EOF value returned by yylex().
-+     */
-+    private final int yyeof;
- 
--  protected JFlexXref() {
--      try {
--        // TODO when bug #16053 is fixed, we should add a getter to a file
--        // that's included from all the Xref classes so that we avoid the
--        // reflection.
--        Field f = getClass().getField("YYEOF");
--        yyeof = f.getInt(null);
--      } catch (Exception e) {
--          // The auto-generated constructors for the Xref classes don't
--          // expect a checked exception, so wrap it in an AssertionError.
--          // This should never happen, since all the Xref classes will get
--          // a public static YYEOF field from JFlex.
--          AssertionError ae = new AssertionError("Couldn't initialize yyeof");
--          ae.initCause(e);
--          throw ae; // NOPMD (stack trace is preserved by initCause(), but PMD
--                    // thinks it's lost)
--      }
--  }
 +    private int lastOutSize;
 +    private Writer xrefOut;
++
++    private Stack<String> spanClasses = new Stack<String>();
++
+     /**
+      * Description of styles to use for different types of definitions. Each
+      * element in the array contains a three-element string array with the
+@@ -113,6 +122,7 @@
+     public void reInit(char[] contents, int length) {
+         yyreset(new CharArrayReader(contents, 0, length));
+         annotation = null;
++        spanClasses.clear();
+     }
  
--  /**
--   * Reinitialize the xref with new contents.
--   *
--   * @param contents a char buffer with text to analyze
--   * @param length the number of characters to use from the char buffer
--   */
--  public void reInit(char[] contents, int length) {
--      yyreset(new CharArrayReader(contents, 0, length));
--      annotation = null;
--  }
-+    private Stack<String> spanClasses = new Stack<String>();
- 
--  public void setDefs(Definitions defs) {
--      this.defs = defs;
--  }
--  
--  protected void appendProject() throws IOException {
--      if (project != null) {
--          out.write("&amp;project=");
--          out.write(project.getDescription());
--      }
--  }
--  
--  protected String getProjectPostfix() {
--      return project == null ? "" : ("&amp;project=" + project.getDescription());
--  }
-+    protected JFlexXref() {
-+        try {
-+            // TODO when bug #16053 is fixed, we should add a getter to a file
-+            // that's included from all the Xref classes so that we avoid the
-+            // reflection.
-+            Field f = getClass().getField("YYEOF");
-+            yyeof = f.getInt(null);
-+        } catch (Exception e) {
-+            // The auto-generated constructors for the Xref classes don't
-+            // expect a checked exception, so wrap it in an AssertionError.
-+            // This should never happen, since all the Xref classes will get
-+            // a public static YYEOF field from JFlex.
-+            AssertionError ae = new AssertionError("Couldn't initialize yyeof");
-+            ae.initCause(e);
-+            throw ae; // NOPMD (stack trace is preserved by initCause(), but PMD
-+            // thinks it's lost)
-+        }
-+    }
- 
--  /** Get the next token from the scanner. */
--  public abstract int yylex() throws IOException;
-+    /**
-+     * Reinitialize the xref with new contents.
-+     *
-+     * @param contents a char buffer with text to analyze
-+     * @param length   the number of characters to use from the char buffer
-+     */
-+    public void reInit(char[] contents, int length) {
-+        yyreset(new CharArrayReader(contents, 0, length));
-+        annotation = null;
-+        spanClasses.clear();
-+    }
- 
--  /** Reset the scanner. */
--  public abstract void yyreset(Reader reader);
-+    public void setDefs(Definitions defs) {
-+        this.defs = defs;
-+    }
- 
--  /** Get the value of {@code yyline}. */
--  protected abstract int getLineNumber();
-+    protected void appendProject()
-+            throws IOException {
-+        if (project != null) {
-+            out.write("&amp;project=");
-+            out.write(project.getDescription());
-+        }
-+    }
- 
--  /** Set the value of {@code yyline}. */
--  protected abstract void setLineNumber(int x);
-+    protected String getProjectPostfix() {
-+        return project == null ? "" : ("&amp;project=" + project.getDescription());
-+    }
- 
--  /**
--   * Write xref to the specified {@code Writer}.
--   *
--   * @param out xref destination
--   * @throws IOException on error when writing the xref
--   */
--  public void write(Writer out) throws IOException {
--      this.out = out;
--      setLineNumber(0);
--      startNewLine();
--      while (yylex() != yyeof) { // NOPMD while statement intentionally empty
--          // nothing to do here, yylex() will do the work
--      }
--  }
-+    /**
-+     * Get the next token from the scanner.
-+     */
-+    public abstract int yylex()
-+            throws IOException;
- 
--  /**
--   * Terminate the current line and insert preamble for the next line. The
--   * line count will be incremented.
--   *
--   * @throws IOException on error when writing the xref
--   */
--  protected void startNewLine() throws IOException {
--      int line = getLineNumber() + 1;
--      setLineNumber(line);
--      Util.readableLine(line, out, annotation);
--  }
-+    /**
-+     * Reset the scanner.
-+     */
-+    public abstract void yyreset(Reader reader);
- 
--  /**
--   * Write a symbol and generate links as appropriate.
--   *
--   * @param symbol the symbol to write
--   * @param keywords a set of keywords recognized by this analyzer (no links
--   * will be generated if the symbol is a keyword)
--   * @param line the line number on which the symbol appears
--   * @throws IOException if an error occurs while writing to the stream
--   */
--  protected void writeSymbol(String symbol, Set<String> keywords, int line)
--          throws IOException {
--      String[] strs = new String[1];
--      strs[0] = "";
-+    /**
-+     * Get the value of {@code yyline}.
-+     */
-+    protected abstract int getLineNumber();
- 
--      if (keywords!=null && keywords.contains(symbol)) {
--          // This is a keyword, so we don't create a link.
--          out.append("<b>").append(symbol).append("</b>");
-+    /**
-+     * Set the value of {@code yyline}.
-+     */
-+    protected abstract void setLineNumber(int x);
- 
--      } else if (defs != null && defs.hasDefinitionAt(symbol, line, strs)) {
--          // This is the definition of the symbol.
--          String type = strs[0];
--          String style_class = "d";
-+    /**
-+     * Write xref to the specified {@code Writer}.
-+     *
-+     * @param xrefOut xref destination
-+     * @throws IOException on error when writing the xref
-+     */
-+    public void write(Writer xrefOut)
-+            throws IOException {
+     public void setDefs(Definitions defs) {
+@@ -149,13 +159,24 @@
+      * @throws IOException on error when writing the xref
+      */
+     public void write(Writer out) throws IOException {
+-        this.out = out;
+-        writeSymbolTable();
 +        this.xrefOut = xrefOut; // line numbers are written directly
 +        out = new StringWriter(); // xref of actual file contents is buffered and then written after the line numbers
- 
--          if (type.startsWith("macro")) {
--              style_class = "xm";
--          }
--          else if (type.startsWith("argument")) {
--              style_class = "xa";
--          }
--          else if (type.startsWith("local")) {
--              style_class = "xl";
--          }
--          else if (type.startsWith("variable")) {
--              style_class = "xv";
--          }
--          else if (type.startsWith("class")) {
--              style_class = "xc";
--          }
--          else if (type.startsWith("interface")) {
--              style_class = "xi";
--          }
--          else if (type.startsWith("namespace")) {
--              style_class = "xn";
--          }
--          else if (type.startsWith("enum")) {
--              style_class = "xe";
--          }
--          else if (type.startsWith("enumerator")) {
--              style_class = "xer";
--          }
--          else if (type.startsWith("struct")) {
--              style_class = "xs";
--          }
--          else if (type.startsWith("typedef")) {
--              style_class = "xt";
--          }
--          else if (type.startsWith("typedefs")) {
--              style_class = "xts";
--          }
--          else if (type.startsWith("union")) {
--              style_class = "xu";
--          }
--          else if (type.startsWith("field")) {
--              style_class = "xfld";
--          }
--          else if (type.startsWith("member")) {
--              style_class = "xmb";
--          }
--          else if (type.startsWith("function")) {
--              style_class = "xf";
--          }
--          else if (type.startsWith("method")) {
--              style_class = "xmt";
--          }
--          else if (type.startsWith("subroutine")) {
--              style_class = "xsr";
--          }
++
 +        // Start table and line number column
 +        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>");
-+        setLineNumber(0);
-+        startNewLine();
-+        while (yylex() != yyeof) { // NOPMD while statement intentionally empty
-+            // nothing to do here, yylex() will do the work
-+        }
- 
--          // 1) Create an anchor for direct links. (Perhaps, we should only
--          //    do this when there's exactly one definition of the symbol in
--          //    this file? Otherwise, we may end up with multiple anchors with
--          //    the same name.)
--          out.append("<a class=\"").append(style_class).append("\" name=\"").append(symbol).append("\"/>");
+         setLineNumber(0);
+         startNewLine();
+         while (yylex() != yyeof) { // NOPMD while statement intentionally empty
+             // nothing to do here, yylex() will do the work
+         }
++
 +        // Terminate last line
 +        endCurrentLine();
- 
--          // 2) Create a link that searches for all references to this symbol.
--          out.append("<a href=\"").append(urlPrefix).append("refs=");
--          out.append(symbol);
--          appendProject();
--          out.append("\" class=\"").append(style_class).append("\" ")
--              // May have multiple anchors with the same function name,
--              // store line number for accurate location used in list.jsp.
--              .append("ln=\"").append(Integer.toString(line)).append("\">")
--              .append(symbol).append("</a>");
++
 +        // End line number column and write the file contents
 +        xrefOut.write("</td><td>");
 +        xrefOut.write(out.toString());
 +        xrefOut.write("</td></tr></table>");
-+    }
+     }
  
--      } else if (defs != null && defs.occurrences(symbol) == 1) {
--          // This is a reference to a symbol defined exactly once in this file.
--          String style_class = "d";
-+    /**
-+     * Terminate the current line and insert preamble for the next line. The
-+     * line count will be incremented.
-+     *
-+     * @throws IOException on error when writing the xref
-+     */
-+    protected void startNewLine()
-+            throws IOException {
+     /**
+@@ -262,9 +283,40 @@
+      * @throws IOException on error when writing the xref
+      */
+     protected void startNewLine() throws IOException {
 +        // Add line number info to the main stream
-+        int line = getLineNumber() + 1;
-+        setLineNumber(line);
+         int line = getLineNumber() + 1;
+         setLineNumber(line);
+-        Util.readableLine(line, out, annotation);
 +        Util.readableLine(line, xrefOut, annotation);
- 
--          // Generate a direct link to the symbol definition.
--          out.append("<a class=\"").append(style_class).append("\" href=\"#").append(symbol).append("\">")
--                  .append(symbol).append("</a>");
++
 +        // Terminate previous line and start a new one
 +        if (line > 1) {
 +            endCurrentLine();
 +        }
 +        out.write("<div>");
- 
--      } else {
--          // This is a symbol that is not defined in this file, or a symbol
--          // that is defined more than once in this file. In either case, we
--          // can't generate a direct link to the definition, so generate a
--          // link to search for all definitions of that symbol instead.
--          out.append("<a href=\"").append(urlPrefix).append("defs=");
--          out.append(symbol);
--          appendProject();
--          out.append("\">").append(symbol).append("</a>");
--      }
--  }
++
 +        // Reopen any existing spans
 +        for (String spanClass : spanClasses) {
 +            if (spanClass == null) {
 +        
 +        lastOutSize = out.getBuffer().length();
 +    }
- 
--  /**
--   * Write HTML escape sequence for the specified Unicode character, unless
--   * it's an ISO control character, in which case it is ignored.
--   *
--   * @param c the character to write
--   * @throws IOException if an error occurs while writing to the stream
--   */
--  protected void writeUnicodeChar(char c) throws IOException {
--      if (!Character.isISOControl(c)) {
--          out.append("&#").append(Integer.toString((int) c)).append(';');
--      }
--  }
++
 +    private void endCurrentLine() {
 +        if (out.getBuffer().length() == lastOutSize) {
 +            out.write("<br/>");
 +        }
 +
 +        out.write("</div>");
-+    }
-+
-+    /**
-+     * Write a symbol and generate links as appropriate.
-+     *
-+     * @param symbol   the symbol to write
-+     * @param keywords a set of keywords recognized by this analyzer (no links
-+     *                 will be generated if the symbol is a keyword)
-+     * @param line     the line number on which the symbol appears
-+     * @throws IOException if an error occurs while writing to the stream
-+     */
-+    protected void writeSymbol(String symbol, Set<String> keywords, int line)
-+            throws IOException {
-+        String[] strs = new String[1];
-+        strs[0] = "";
-+
-+        if (keywords != null && keywords.contains(symbol)) {
-+            // This is a keyword, so we don't create a link.
-+            out.append("<b>").append(symbol).append("</b>");
-+
-+        } else if (defs != null && defs.hasDefinitionAt(symbol, line, strs)) {
-+            // This is the definition of the symbol.
-+            String type = strs[0];
-+            String style_class = "d";
-+
-+            if (type.startsWith("macro")) {
-+                style_class = "xm";
-+            } else if (type.startsWith("argument")) {
-+                style_class = "xa";
-+            } else if (type.startsWith("local")) {
-+                style_class = "xl";
-+            } else if (type.startsWith("variable")) {
-+                style_class = "xv";
-+            } else if (type.startsWith("class")) {
-+                style_class = "xc";
-+            } else if (type.startsWith("interface")) {
-+                style_class = "xi";
-+            } else if (type.startsWith("namespace")) {
-+                style_class = "xn";
-+            } else if (type.startsWith("enum")) {
-+                style_class = "xe";
-+            } else if (type.startsWith("enumerator")) {
-+                style_class = "xer";
-+            } else if (type.startsWith("struct")) {
-+                style_class = "xs";
-+            } else if (type.startsWith("typedef")) {
-+                style_class = "xt";
-+            } else if (type.startsWith("typedefs")) {
-+                style_class = "xts";
-+            } else if (type.startsWith("union")) {
-+                style_class = "xu";
-+            } else if (type.startsWith("field")) {
-+                style_class = "xfld";
-+            } else if (type.startsWith("member")) {
-+                style_class = "xmb";
-+            } else if (type.startsWith("function")) {
-+                style_class = "xf";
-+            } else if (type.startsWith("method")) {
-+                style_class = "xmt";
-+            } else if (type.startsWith("subroutine")) {
-+                style_class = "xsr";
-+            }
-+
-+            // 1) Create an anchor for direct links. (Perhaps, we should only
-+            //    do this when there's exactly one definition of the symbol in
-+            //    this file? Otherwise, we may end up with multiple anchors with
-+            //    the same name.)
-+            out.append("<a class=\"").append(style_class).append("\" name=\"").append(symbol).append("\"/>");
-+
-+            // 2) Create a link that searches for all references to this symbol.
-+            out.append("<a href=\"").append(urlPrefix).append("refs=");
-+            out.append(symbol);
-+            appendProject();
-+            out.append("\" class=\"").append(style_class).append("\" ")
-+                    // May have multiple anchors with the same function name,
-+                    // store line number for accurate location used in list.jsp.
-+                    .append("ln=\"").append(Integer.toString(line)).append("\">")
-+                    .append(symbol).append("</a>");
-+
-+        } else if (defs != null && defs.occurrences(symbol) == 1) {
-+            // This is a reference to a symbol defined exactly once in this file.
-+            String style_class = "d";
-+
-+            // Generate a direct link to the symbol definition.
-+            out.append("<a class=\"").append(style_class).append("\" href=\"#").append(symbol).append("\">")
-+                    .append(symbol).append("</a>");
-+
-+        } else {
-+            // This is a symbol that is not defined in this file, or a symbol
-+            // that is defined more than once in this file. In either case, we
-+            // can't generate a direct link to the definition, so generate a
-+            // link to search for all definitions of that symbol instead.
-+            out.append("<a href=\"").append(urlPrefix).append("defs=");
-+            out.append(symbol);
-+            appendProject();
-+            out.append("\">").append(symbol).append("</a>");
-+        }
-+    }
-+
-+    /**
-+     * Write HTML escape sequence for the specified Unicode character, unless
-+     * it's an ISO control character, in which case it is ignored.
-+     *
-+     * @param c the character to write
-+     * @throws IOException if an error occurs while writing to the stream
-+     */
-+    protected void writeUnicodeChar(char c)
-+            throws IOException {
-+        if (!Character.isISOControl(c)) {
-+            out.append("&#").append(Integer.toString((int) c)).append(';');
-+        }
-+    }
+     }
+ 
+     /**
+@@ -374,4 +426,28 @@
+             out.write(address);
+         }
+     }
 +
 +    /**
 +     * Write a span start tag. The class is pushed onto a stack so that it can be

xref-line-highlight

 # HG changeset patch
-# Parent 659fdcb49e734fc6e4dc86e58b8b62847134c5d0
+# User J. Ryan Stinnett <jryans@gmail.com>
+# Date 1295076995 21600
+# Node ID cb9e8afb804c53f32f271da04674c823adf31f0f
+# Parent  e531bb8f756c408c77f86fd719de68ad2fe83aba
 Adding centering and highlighting when targeting specific lines
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 --- a/src/org/opensolaris/opengrok/analysis/JFlexXref.java
 +++ b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
-@@ -139,7 +139,7 @@
+@@ -163,7 +163,7 @@
          out = new StringWriter(); // xref of actual file contents is buffered and then written after the line numbers
  
          // Start table and line number column
          setLineNumber(0);
          startNewLine();
          while (yylex() != yyeof) { // NOPMD while statement intentionally empty
-@@ -150,7 +150,7 @@
+@@ -174,7 +174,7 @@
          endCurrentLine();
  
          // End line number column and write the file contents
          xrefOut.write(out.toString());
          xrefOut.write("</td></tr></table>");
      }
-@@ -172,7 +172,7 @@
+@@ -292,7 +292,7 @@
          if (line > 1) {
              endCurrentLine();
          }
  
          // Reopen any existing spans
          for (String spanClass : spanClasses) {
-@@ -260,17 +260,11 @@
-                 style_class = "xsr";
+@@ -347,17 +347,7 @@
+                 style_class = style[1];
              }
  
--            // 1) Create an anchor for direct links. (Perhaps, we should only
+-            // 1) Create an anchor for direct links. (Perhaps we should only
 -            //    do this when there's exactly one definition of the symbol in
 -            //    this file? Otherwise, we may end up with multiple anchors with
 -            //    the same name.)
--            out.append("<a class=\"").append(style_class).append("\" name=\"").append(symbol).append("\"/>");
+-            out.append("<a class=\"");
+-            out.append(style_class);
+-            out.append("\" name=\"");
+-            out.append(symbol);
+-            out.append("\"/>");
 -
 -            // 2) Create a link that searches for all references to this symbol.
 +            // Create a link that searches for all references to this symbol.
-             out.append("<a href=\"").append(urlPrefix).append("refs=");
+             out.append("<a href=\"");
+             out.append(urlPrefix);
+             out.append("refs=");
+@@ -365,6 +355,8 @@
+             appendProject();
+             out.append("\" class=\"");
+             out.append(style_class);
++            out.append("\" id=\"f:");
++            out.append(symbol);
+             out.append("\">");
              out.append(symbol);
-             appendProject();
--            out.append("\" class=\"").append(style_class).append("\" ")
-+            out.append("\" class=\"").append(style_class).append("\" id=\"f:").append(symbol).append("\" ")
-                     // May have multiple anchors with the same function name,
-                     // store line number for accurate location used in list.jsp.
-                     .append("ln=\"").append(Integer.toString(line)).append("\">")
+             out.append("</a>");
 diff --git a/src/org/opensolaris/opengrok/web/Util.java b/src/org/opensolaris/opengrok/web/Util.java
 --- a/src/org/opensolaris/opengrok/web/Util.java
 +++ b/src/org/opensolaris/opengrok/web/Util.java
-@@ -346,8 +346,6 @@
+@@ -348,8 +348,6 @@
          }
          out.write(anchorClassStart);
          out.write((num % 10 == 0 ? "hl" : "l"));
 diff --git a/web/list.jsp b/web/list.jsp
 --- a/web/list.jsp
 +++ b/web/list.jsp
-@@ -288,6 +288,39 @@
+@@ -221,6 +221,39 @@
      HighlightKeyword(tbox.value);
  }