Commits

Tiff Ting  committed 7f575ad

added back sort links to search view, changed default diff view to inline

  • Participants
  • Parent commits c2a8873

Comments (0)

Files changed (1)

File bazaarvoice-customizations

 # HG changeset patch
-# Parent 85fcd01ae544dd5431706f78e7114b22c63046b6
+# Parent 20719e620fcc2bdcd1656a148e7f9492da76dfbc
 Bazaarvoice-specific customizations
 
 diff --git a/src/org/opensolaris/opengrok/search/Results.java b/src/org/opensolaris/opengrok/search/Results.java
 diff --git a/web/default/style.css b/web/default/style.css
 --- a/web/default/style.css
 +++ b/web/default/style.css
-@@ -1,144 +1,186 @@
+@@ -1,144 +1,194 @@
 -body {
 -background-color: #ffffff;
 -/*font-size: 100.01%; /* 12px [1] */
 +            #headerMenu p {display: inline; font-size: 1em; margin-left: 1em; white-space: nowrap;}
 +                #headerMenu p .code {color: #666666;}
 +            #headerMenu div.q {background-color: rgba(76,119,187,0.15); border: 1px solid rgba(76,119,187,0.15); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; clear: both; float: right; margin-top: 4em; margin-right: 2em; padding: 1em;}
++            #headerMenu .sortMenu {font-size: 1.2em;}
++                #headerMenu .sortMenu .menuHeader {color: #666666; margin-right: 0.25em;}
++                .sortOption {border-right: 1px solid #666666; margin-right: 0.25em; padding-right: 0.5em;}
++                .sortOptionPath {border-right-width: 0; margin-right: 0; padding-right: 0;}
++                #headerMenu .sortMenu .selected {color: #ffffff; font-weight: bold;}
++                #headerMenu .sortMenu a {font-size: 1em;}
++                    #headerMenu .sortMenu a:link, #headerMenu .sortMenu a:visited {color: #999999;}
++                    #headerMenu .sortMenu a:hover, #headerMenu .sortMenu a:active {color: #eeeeee;}
 +    #content {background-color: #ffffff; margin: 0 30px; padding: 11em 20px 15px;}
 +        #contentMenu {padding-top: 1em;}
 +            #sbox {}
 +                    .foldername {/*font-weight: bold;*/}
 +                    .date {color: #999999;}
 +                    .alt {background-color: #eef8fe;} /* odd rows */
-+                    td#line_numbers {}
-+                    td#line_content {}
 +            ul.filelist {font-family: Consolas, 'Lucida Console', Monaco, monospace; font-size: 0.8em; margin-top: 0;}
 +            p.action {margin-top: 3em;}
 +    #footer {background: #101010 url(./img/backgroundFooter.jpg) no-repeat left bottom; clear: both; color: #cccccc; line-height: 1.5em; padding: 2em 50px 1.5em;}
 +                #difftable table {table-layout: fixed; width: 100%;}
 +                    #difftable th {background-color: #eeeeee;}
 +                    tr.k {border-bottom: 1px dashed #ccc;}
-+                    .indicator-break {font-family: Helvetica, Helvetica Neue, Arial, sans-serif; margin: 2em 0;}
++                    .indicator-break {font-family: Helvetica, Helvetica Neue, Arial, sans-serif; margin: 1.25em 0;}
 +                        .indicator-break .prefix {background-image: none; padding-left: 0;}
 +                        #difftable span.d {background-color: #ffffcc;} /* deleted */
 +                    #difftable span.a {background-color: #ccffcc;} /* added */
-+        
  
 -#MastheadLogo {
 -	background-color: white;
 -	border: none;
 -	text-decoration: none;
 -}
-+.l, .hl {background-color: #dddddd; display: inline-block; margin-right: 0.5em; padding-right: 1em; text-align: right; width: 4em;}
++        /* list page */
++        #line_numbers {padding-right: 0.5em;}
+ 
+-#pagetitle {
+-	float: right;
+-	font-size: large;
+-	color:#5382a1;
+-	text-align:right;
+-}
++.l, .hl {background-color: #dddddd; display: inline-block; padding-right: 1em; text-align: right; width: 4em;}
 +.blame .l {padding-right: 0; width: auto;}
 +.l, .l:link, .l:visited, .l:hover, .l:active  {color: #999999; text-decoration: none;}
 +.hl, .hl:link, .hl:visited, .hl:hover, .hl:active {color: #000000; text-decoration: none;}
 +.hl-hide {display: none}
 +.l.d {background-color: #ffffcc; text-decoration: line-through;}
  
--#pagetitle {
--	float: right;
--	font-size: large;
--	color:#5382a1;
+-#filename {
+-	font-size: x-large;
+-	color:#000;
 -	text-align:right;
 -}
 +a.p, a.r {background-image: url(./img/icons.gif); background-repeat: no-repeat; padding-left: 20px;}
 +a.p {background-position: 0 -920px;}
 +    a.p:hover {background-position: 0 -960px;}
  
--#filename {
--	font-size: x-large;
--	color:#000;
--	text-align:right;
--}
--
 -#bar {
 -	padding-left: 0.5em;
 -	margin-bottom:0.2em;
  
  .sl {color:#999;text-decoration:underline;}
  td.a{color:#000}
-@@ -146,14 +188,11 @@
+@@ -146,14 +196,11 @@
  .s  {color:green;} /* strings */
  .c  {color:#666;} /* comments */
  .b  {color:#000; font-weight:bold;} /* comments */
  
  a.d {color:#936; font-weight:bold; text-decoration:none;} /* definitions */
  
-@@ -184,50 +223,14 @@
+@@ -184,50 +231,14 @@
  
  #results {margin-top:.5em;}
  #results .con{font-size:small;color:#000;}
 +%>
 +<%!
 +public String getFormatType(String format) {
-+    String formatType = "diff-side";
-+    if (format.equals("s")) {
++    String formatType = "diff-inline";
++    if (format.equals("u")) {
++        formatType = "diff-inline";
++    } else if (format.equals("s")) {
 +        formatType = "diff-side";
-+    } else if (format.equals("u")) {
-+        formatType = "diff-inline";
 +    } else if (format.equals("t")) {
 +        formatType = "diff-text";
 +    }
                      } else if (g == Genre.PLAIN || g == Genre.HTML) {
  //--------Do THE DIFFS------------
                          ArrayList<String> l1 = new ArrayList<String>();
-@@ -122,9 +158,8 @@
+@@ -122,207 +158,222 @@
                          Revision rev = Diff.diff(file1, file2);
                          
                          if(rev.size() == 0) {
                              int ln1 = 0;
                              int ln2 = 0;
                              
-@@ -136,193 +171,209 @@
+                             String format = request.getParameter("format");
+-                            if(format == null || (!format.equals("o") && !format.equals("n") && !format.equals("u") && !format.equals("t")))
+-                                format = "s";
++                            if(format == null || (!format.equals("o") && !format.equals("n") && !format.equals("s") && !format.equals("t")))
++                                format = "u";
+                             String pfull = request.getParameter("full");
+                             boolean full = pfull != null && pfull.equals("1");
                              pfull = full ? "1" : "0";
                              
  
 +                        <dd class="added">Added</dd>
 +                    </dl>
 +                    <div id="diffbar">
-+                        <% if(format.equals("s")) { %>
-+                        <span class="tab tabsel">side-by-side</span> <%
++                        <% if(format.equals("u")) { %>
++                        <span class="tab tabsel">inline</span> <%
  } else {
 -	%><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=s&full=<%=pfull%>">sdiff</a></span> <%
-+    %><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=s&full=<%=pfull%>">side-by-side</a></span> <%
++    %><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=u&full=<%=pfull%>">inline</a></span> <%
  }
                              
-                             if(format.equals("u")) {
+-                            if(format.equals("u")) {
 -	%><span class="tabsel"><b>udiff</b></span> <%
-+    %><span class="tab tabsel">inline</span> <%
++                            if(format.equals("s")) {
++    %><span class="tab tabsel">side-by-side</span> <%
                                  } else {
 -	%><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=u&full=<%=pfull%>">udiff</a></span> <%
-+    %><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=u&full=<%=pfull%>">inline</a></span> <%
++    %><span class="tab"><a href="<%=reqURI%>?r1=<%=rp1%>&r2=<%=rp2%>&format=s&full=<%=pfull%>">side-by-side</a></span> <%
                                  }
                              
                              if(format.equals("t")) {
 diff --git a/web/search.jsp b/web/search.jsp
 --- a/web/search.jsp
 +++ b/web/search.jsp
-@@ -99,23 +99,23 @@
+@@ -88,6 +88,15 @@
+     }
+ } else { sort = RELEVANCY; }
+ 
++String sortName = "relevance";
++if (sort.equals("relevance")) {
++    sortName = "relevance";
++} else if (sort.equals("lastmodtime")) {
++    sortName = "last modified time";
++} else if (sort.equals("fullpath")) {
++    sortName = "path";
++}
++
+ //List<org.apache.lucene.document.Document> docs=new ArrayList<org.apache.lucene.document.Document>();
+ String errorMsg = null;
+ 
+@@ -99,23 +108,23 @@
  if (project != null && project.size()<1) project = null;
  
  if (q != null || defs != null || refs != null || hist != null || path != null) {
  
      QueryBuilder queryBuilder =
              new QueryBuilder()
-@@ -125,16 +125,16 @@
+@@ -125,16 +134,16 @@
      try {
          String DATA_ROOT = env.getDataRootPath();
          if(DATA_ROOT.equals("")) {
              max = Integer.parseInt(request.getParameter("n"));      //then the start index
              if(max < 0 || (max % 10 != 0) || max > 50) max = 25;
              if(start < 0 ) start = 0;
-@@ -147,7 +147,7 @@
+@@ -147,7 +156,7 @@
  
          if (RuntimeEnvironment.getInstance().hasProjects()) {
              if (project == null) {
              } else {
                  if (project.size() > 1) { //more projects
                      IndexSearcher[] searchables = new IndexSearcher[project.size()];
-@@ -216,18 +216,18 @@
+@@ -216,18 +225,18 @@
          }
          thispage = max;
      } catch (BooleanQuery.TooManyClauses e) {
      }
  
      // Bug #3900: Check if this is a search for a single term, and that term
-@@ -264,69 +264,39 @@
+@@ -264,69 +273,65 @@
  
          response.sendRedirect(url.toString());
      } else {
 +<div id="wrapper">
 +    <%@ include file="pageheader.jspf" %>
 +            </form>
++            <%
++            String url = "search?";
++            url = url + (q == null ? "" : "&amp;q=" + Util.URIEncode(q)) +
++                (defs == null ? "" : "&amp;defs=" + Util.URIEncode(defs)) +
++                (refs == null ? "" : "&amp;refs=" + Util.URIEncode(refs)) +
++                (path == null ? "" : "&amp;path=" + Util.URIEncode(path)) +
++                (hist == null ? "" : "&amp;hist=" + Util.URIEncode(hist));
++            if (hasProjects) {
++                if (project!=null) {
++                    url = url + "&amp;project=";
++                    for (Iterator it = project.iterator(); it.hasNext();) {
++                        url = url + (project == null ? "" : Util.URIEncode((String) it.next()) + ",");
++                    }
++                }
++            }
++            %><div class="sortMenu"><span class="menuHeader">Sort by:</span><%
++            url=url+("&amp;sort=");
++            if (sort == null || RELEVANCY.equals(sort)) {
++                %><span class="sortOption sortOptionRelevance selected">relevance</span> <a href="<%=url+LASTMODTIME%>" class="sortOption sortOptionTime">last modified time</a> <a href="<%=url+BY_PATH%>" class="sortOption sortOptionPath">path</a><%
++            } else if (LASTMODTIME.equals(sort)) {
++                %><a href="<%=url+RELEVANCY%>" class="sortOption sortOptionRelevance">relevance</a> <span class="sortOption sortOptionTime selected">last modified time</span> <a href="<%=url+BY_PATH%>" class="sortOption sortOptionPath">path</a><%
++            } else if (BY_PATH.equals(sort)) {
++                %><a href="<%=url+RELEVANCY%>" class="sortOption sortOptionRelevance">relevance</a> <a href="<%=url+LASTMODTIME%>" class="sortOption sortOptionTime">last modified time</a> <span class="sortOption sortOptionPath selected">path</span><%
++            } else {
++                %><a href="<%=url+RELEVANCY%>" class="sortOption sortOptionRelevance">relevance</a> <a href="<%=url+LASTMODTIME%>" class="sortOption sortOptionTime">last modified time</a> <a href="<%=url+BY_PATH%>" class="sortOption sortOptionPath">path</a><%
++            }%></div>
 +        </div>
 +    </div>
 +    
                  }
  
                  int count=1;
-@@ -334,14 +304,14 @@
+@@ -334,14 +339,14 @@
  
                  for (int idx = 0; idx < count; idx++) {
     
                          String[] toks;
                          if(q != null) {
                              toks = q.split("[\t ]+");
-@@ -351,10 +321,10 @@
+@@ -351,10 +356,10 @@
                                          String[] ret = checker.suggestSimilar(toks[j].toLowerCase(), 5);
                                          for(int i = 0;i < ret.length; i++) {
                                              if (printHeader) {
                                          }
                                      }
                                  }
-@@ -368,14 +338,14 @@
+@@ -368,14 +373,14 @@
                                          String[] ret = checker.suggestSimilar(toks[j].toLowerCase(), 5);
                                          for(int i = 0;i < ret.length; i++) {
                                              if (printHeader) {
                          }
                          //TODO it seems the only true spellchecker is for below field, see IndexDatabase createspellingsuggestions ...
                          if(defs != null) {
-@@ -386,10 +356,10 @@
+@@ -386,10 +391,10 @@
                                          String[] ret = checker.suggestSimilar(toks[j].toLowerCase(), 5);
                                          for(int i = 0;i < ret.length; i++) {
                                              if (printHeader) {
                                          }
                                      }
                                  }
-@@ -400,123 +370,129 @@
+@@ -400,123 +405,129 @@
                          }
                          spellDirectory.close();
                          checker.close();
 +                            thispage = totalHits - start;      // set the max index to max or last
 +                        }
 +                %><p>Searched <span class="code code-search"><%=query.toString()%></span><br/>
-+                    Results <strong><%=start+1%> - <%=thispage+start%></strong> of <strong><%=totalHits%></strong>, sorted by <%=sort%></p>
++                    Results <strong><%=start+1%> - <%=thispage+start%></strong> of <strong><%=totalHits%></strong>, sorted by <%=sortName%></p>
 +                    <p>Completed in <%=(new Date()).getTime() - starttime.getTime()%> milliseconds.</p>
 +                    <%=slider != null ? slider.toString() : "" %>
 +