dpillot     2005/10/11 17:15:56 CEST

  Modified files:
    core/src/webapp/jsp/jahia/engines/importexport contentpick.jsp 
  Log:
  added support for limited advanced queries
  
  Revision  Changes    Path
  1.26      +65 -32    
jahia/core/src/webapp/jsp/jahia/engines/importexport/contentpick.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/engines/importexport/contentpick.jsp.diff?r1=1.25&r2=1.26&f=h
  
  
  
  Index: contentpick.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/engines/importexport/contentpick.jsp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- contentpick.jsp   11 Oct 2005 09:51:38 -0000      1.25
  +++ contentpick.jsp   11 Oct 2005 15:15:55 -0000      1.26
  @@ -29,6 +29,7 @@
       public String printFriendlyDate(JahiaSearchHit hit, String datekey, 
Locale l) {
           String s = "NA";
           long d = 0;
  +
           //formatters
           SimpleDateFormat df = new SimpleDateFormat("EEEE dd MMM yyyy - 
HH:mm:ss", l);
           SimpleDateFormat sd = new SimpleDateFormat("HH:mm", l);
  @@ -38,6 +39,7 @@
           now.set(Calendar.HOUR_OF_DAY, 
now.getActualMinimum(Calendar.HOUR_OF_DAY));
           now.set(Calendar.MINUTE, now.getActualMinimum(Calendar.MINUTE));
           now.set(Calendar.SECOND, now.getActualMinimum(Calendar.SECOND));
  +
           GregorianCalendar hier = new GregorianCalendar(l);
           hier.roll(Calendar.DATE, false);
           hier.set(Calendar.HOUR_OF_DAY, 
hier.getActualMinimum(Calendar.HOUR_OF_DAY));
  @@ -55,11 +57,11 @@
                   Calendar c = Calendar.getInstance(l);
                   c.setTime(new Date(d));
                   if (c.after(now)) {
  -                    return "today a " + sd.format(new Date(d));
  +                    return "aujourd'hui a " + sd.format(new 
Date(d));
                   } else if (c.after(hier) && c.before(now)) {
                       return "hier a " + sd.format(new Date(d));
                   }
  -                logger.debug(c.getTime());
  +                //logger.debug(c.getTime());
                   s = df.format(new Date(d));
               } catch (NumberFormatException e) {
                   //defensive code!
  @@ -74,7 +76,7 @@
   %>
   <%
       /**
  -     * @version $Id: contentpick.jsp,v 1.25 2005/10/11 09:51:38 dpillot Exp $
  +     * @version $Id: contentpick.jsp,v 1.26 2005/10/11 15:15:55 dpillot Exp $
        */
   
       HashMap engineMap = (HashMap) 
request.getAttribute("org.jahia.engines.EngineHashMap");
  @@ -82,6 +84,7 @@
       String theScreen = (String) engineMap.get("screen");
       //parameter to order the results (def:score)
       String orderBy = (String) engineMap.get("orderby");
  +    if(orderBy==null || orderBy.equalsIgnoreCase("")) orderBy="score";
       // # of sites
       int sitecount = Integer.parseInt((String) engineMap.get("sitecount"));
       // server path
  @@ -132,7 +135,7 @@
   <%=sitecount%>
   -->
   <script type="text/javascript">
  -
  +    var expand=1;
       function orderby(param) {
           document.mainForm.orderby.value = param;
           handleActionChange("contentPick");
  @@ -164,32 +167,29 @@
       // cosmetic search query functions
       function expandcontent(cid) {
           //alert(document.getElementById(cid).style.display);
  -        document.getElementById(cid).style.display = 
(document.getElementById(cid).style.display != "block")? "block" : "none"
  +        if(document.getElementById(cid).style.display != "block"){
  +         document.getElementById(cid).style.display="block";
  +            expand++;
  +        } else {
  +          document.getElementById(cid).style.display="none";
  +            expand--;
  +            if(expand==1) 
document.getElementById("sc0").style.display="none";
  +        }
  +
  +        if(expand>1) document.getElementById("sc0").style.display="block";
       }
   
   
       function contractcontent(cid) {
  -        document.getElementById(cid).style.display = "none"
  +        document.getElementById(cid).style.display = "none";
  +        expand--;
  +        if(expand==1) document.getElementById("sc0").style.display="none";
       }
   
  -    // search function to preprocess queries 
  +    // search function to preprocess queries
       function goSearch() {
           //alert("searching....");
  -        //condition1
  -        /*
  -        var valquery=document.getElementById("mainForm").query.value;
  -        var idx=document.getElementById("mainForm").cond1.selectedIndex;
  -        var cond=document.mainForm.condition1.options[idx].value;
  -        if(cond=="and"){
  -
  -            val valquery_array=valquery.split(" ");
  -            valquery="";
  -            for(n=0;n<valquery_array.length;n++) {
  -            valquery=valquery+" AND "+valquery_array[n];
  -            }
  -            document.getElementById("mainForm").query.value=valquery
  -            }
  -            */
  +        
document.getElementById("waiting").src="/jahia/jsp/jahia/engines/images/waiting.gif";
           handleActionChange("contentPick");
       }
       //
  @@ -198,23 +198,52 @@
           opener.location = path;
       }
   
  +    //preloading
  +    waitingimage=new Image();
  +    waitingimage.src="/jahia/jsp/jahia/engines/images/waiting.gif";
  +
   </script>
   
   
  -<input type="hidden" name="orderby" value="score"/>
  +<input type="hidden" name="orderby" value="<%=orderBy%>"/>
   <input type="hidden" name="bigquery" value=""/>
  -<table border=0><tr><td>
  +<table border=0><tr><td colspan="2">
  +    <div id="sc0" class="switchcontent">
  +     <select name="concat" id="cond0" onchange="goSearch()">
  +         <% if(((String)engineMap.get("concat")).equalsIgnoreCase("or")) {%>
  +         <option value="or" selected="selected">au moins une de ces 
conditions</option>
  +         <% } else { %>
  +            <option value="or">au moins une de ces conditions</option>
  +            <% } %>
  +         <% if(((String)engineMap.get("concat")).equalsIgnoreCase("and")) {%>
  +         <option value="and" selected="selected">toutes ces 
conditions</option>
  +         <% } else { %>
  +            <option value="or">toutes ces conditions</option>
  +            <% } %>
  +         </select>
  +    </div>
       <div id="sc1" class="switchcontent1">
   
           <select name="condition1" id="cond1" onchange="goSearch()">
  +            <% if(((String)engineMap.get("smode")).equalsIgnoreCase("or")) 
{%>
               <option value="or" selected="selected">au moins un des 
mots</option>
  +            <% } else { %>
  +            <option value="or">au moins un des mots</option>
  +            <% } %>
  +            <% if(((String)engineMap.get("smode")).equalsIgnoreCase("and")) 
{%>
  +            <option value="and" selected="selected">tous les mots</option>
  +            <% } else { %>
               <option value="and">tous les mots</option>
  +            <% } %>
  +            <% 
if(((String)engineMap.get("smode")).equalsIgnoreCase("exact")) {%>
  +            <option value="exact" selected="selected">la phrase 
exacte</option>
  +            <% } else { %>
               <option value="exact">la phrase exacte</option>
  -
  +            <% } %>
           </select>
           <!-- query -->
  -        <INPUT name="query" size=50 
value="<%=engineMap.get("searchString")%>"
  -               onkeypress="submitenter(this,window.event)"/>
  +        <INPUT name="query" size=40 
value="<%=engineMap.get("searchString")%>"
  +               onkeypress="submitenter(this,window.event)" 
onfocus="this.value=''"/>
   
           <%
               int count = 0;
  @@ -262,7 +291,7 @@
               <option label="keywords" value="keywords"></option>
   
           </select>
  -        <INPUT size=50 value="" name="query2"/>
  +        <INPUT size=50 value="" name="query2" 
onkeypress="submitenter(this,window.event)" onfocus="this.value=''"/>
           <a href="javascript:expandcontent('sc3')"><img 
src="/jahia/jsp/jahia/engines/images/adding.png" width="16"
                                                          height="16" 
border="0"></a><a
               href="javascript:contractcontent('sc2')"><img 
src="/jahia/jsp/jahia/engines/images/deleting.png" width="16"
  @@ -276,7 +305,7 @@
               <option label="keywords" value="keywords"></option>
   
           </select>
  -        <INPUT size=50 value="" name="query3"/>
  +        <INPUT size=50 value="" name="query3" 
onkeypress="submitenter(this,window.event)" onfocus="this.value=''"/>
           <a href="javascript:expandcontent('sc4')"><img 
src="/jahia/jsp/jahia/engines/images/adding.png" width="16"
                                                          height="16" 
border="0"></a><a
               href="javascript:contractcontent('sc3')"><img 
src="/jahia/jsp/jahia/engines/images/deleting.png" width="16"
  @@ -290,16 +319,17 @@
               <option label="keywords" value="keywords"></option>
   
           </select>
  -        <INPUT size=50 value="" name="query4"/>
  +        <INPUT size=50 value="" name="query4" 
onkeypress="submitenter(this,window.event)" onfocus="this.value=''" />
           <a href="javascript:expandcontent('sc5')"><img 
src="/jahia/jsp/jahia/engines/images/adding.png" width="16"
                                                          height="16" 
border="0"></a><a
               href="javascript:contractcontent('sc4')"><img 
src="/jahia/jsp/jahia/engines/images/deleting.png" width="16"
                                                             height="16" 
border="0"></a>
  -        <INPUT size=50 value="" name="query4"/>
  +
       </div>
   
   </td></tr>
  -    <tr><td><a href="javascript:goSearch()">search</a></td></tr>
  +    <tr><td><a href="javascript:goSearch()">search</a></td><td 
align="right"><img id="waiting" src="/jahia/jsp/jahia/engines/images/pix.gif" 
width="16"
  +                                                          height="16" 
border="0"></td></tr>
   </table>
   
   
  @@ -441,6 +471,9 @@
   </div><!-- end menu wrapper part -->
   <%  /**
    * $Log: contentpick.jsp,v $
  + * Revision 1.26  2005/10/11 15:15:55  dpillot
  + * added support for limited advanced queries
  + *
    * Revision 1.25  2005/10/11 09:51:38  dpillot
    * date display & selection enhancements
    *
  

Reply via email to