Changeset 704


Ignore:
Timestamp:
09/19/10 09:37:51 (14 years ago)
Author:
gaba
Message:
 
Location:
MDService2/trunk/MDService2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js

    r699 r704  
    508508        });
    509509       
     510        $('.cmd_resubmit').live('click',  function(event) {
     511                var qid = $(this).closest('.query_wrapper').attr("id");
     512
     513                queryset.resubmit(qid);
     514               
     515        });
     516       
    510517       
    511518        $('.cmd_down').live('click',  function(event) {
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js

    r692 r704  
    88        this.listid = "";
    99        this.container = {};
    10        
    11        
     10        // page
     11        this.startRecord = 1;
     12        this.maximumRecords = 50;
     13        //TODO load
     14       
     15        //
     16        this.is_resubmit = 0;
    1217};
    1318
     
    3944
    4045Query.prototype.query_uri = function () {
    41         return "?q=" + escape(this.query) + "&collection=" + this.collection + "&columns=" + this.columns;
     46        return "?q=" + escape(this.query) + "&collection=" + this.collection + "&columns=" + this.columns + "&startRecord=" + this.startRecord + "&iend=" + this.maximumRecords;
    4247        //return $.param(this.query);
    4348};
     
    100105        "<span class='cmd cmd_delete'> </span><span class='cmd cmd_get'></span><span class='query_id'>" +
    101106        this.listid + "</span> <span class='query'>" +
    102         this.collection + ": " + Query.simplequerystring(this.query) + "</span><span class='cmd cmd_save'></span><span class='cmd cmd_select'></span></div>" +         
     107        this.collection + ": " + Query.simplequerystring(this.query) + "</span><span class='cmd cmd_save'></span><span class='cmd cmd_resubmit'></span></div>" +               
    103108                        "<div class='result'></div></div>";
    104109        addToQuerylist(x);     
     
    109114       
    110115        var uri = link('recordset','htmltable', this.query_uri());
    111         notifyUser("submitting query:" +  uri);
    112        
     116        var re = "";
     117       
     118        var l_resubmit = this.is_resubmit;
     119        if (l_resubmit == 1) {
     120                this.is_resubmit = 0;
     121                re = "re"
     122        }
     123       
     124        notifyUser(re + "submitting query:" +  uri);
    113125        this.container.find('.result').load( uri, function() {
    114126                                notifyUser("result-loaded",'debug');
     127                               
    115128                                var get = $(this).parent().find('.cmd_get');                           
    116129
     
    120133                               
    121134                                var result_header = $(this).children('.result_header');
    122                                 var q_header = $(this).parent().find('.query_header');
    123                                 q_header.append(result_header);
    124                                
     135                               
     136                                var q_header;
     137                                q_header = $(this).parent().find('.query_header');
     138                                if (l_resubmit  == 1) {
     139                                        result_header.remove();
     140                                } else {
     141                                        q_header.append(result_header);
     142                                }
     143                               
     144                                q_header.find('.reload').click(function() {
     145                                       
     146                                        var qid = $(this).closest('.query_wrapper').attr("id");
     147                                        queryset.resubmit(qid);
     148/*
     149                                        var startRecord = $(this).parent().find('.start_record').val();
     150                                        var maximumRecords = $(this).parent().find('.maximum_records').val();
     151                                        var id = $(this).closest('.query_wrapper').attr("id");
     152                                       
     153                                        queryset_container.container = $('#' + id );
     154                                        var q = queryset.queries[id.substring(1)-1];
     155                                       
     156                                        q.startRecord = startRecord;
     157                                        q.maximumRecords = maximumRecords;
     158                                        q.is_resubmit = 1;
     159                                        q.submit();
     160                                        queryset_container.container = $('#q' + queryset.queries.length );
     161                                        //$('#' + id ).
     162                                        */
     163                                });
    125164                        });
    126165
    127166};
     167
    128168
    129169
     
    235275                }
    236276                return json_cols;
    237         }
    238        
    239        
    240 };
     277        },
     278       
     279        resubmit: function(qid){
     280                var query = queryset.queries[qid.substring(1)-1];
     281                queryset_container.container = $('#' + qid );
     282                query.is_resubmit = 1;
     283                query.startRecord = $('#' + qid ).find('.start_record').val();
     284                query.maximumRecords = $('#' + qid ).find('.maximum_records').val();
     285                query.submit();
     286                queryset_container.container = $('#q' + queryset.queries.length );
     287
     288        }
     289       
     290       
     291};
  • MDService2/trunk/MDService2/WebContent/style/cmdi.css

    r699 r704  
    8080        background-image: url("imgs/icon_filter_10.png");
    8181}
     82.cmd_resubmit {
     83        background-image: url("imgs/icon_filter_10.png");
     84}
    8285
    8386.cmd_up {
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java

    r689 r704  
    2929import org.xml.sax.SAXException;
    3030import org.xml.sax.InputSource;
     31import org.apache.commons.lang.StringEscapeUtils;
    3132
    3233
     
    108109                //e.setNamedItem(attr);
    109110                e.setAttribute("id", c.toString());
    110                 String[] key_array = key_info.split("-");
     111                String[] key_array = key_info.split("//-");
    111112               
    112113                e.setAttribute("type", key_array[0]);
     
    182183                        transformed = "";
    183184                } else {
    184                         try {
    185                                 transformed =  query.toURLParam();
    186                                 transformed = transformed.replace("'", "__qqqqq__");
    187                                 //Admin.notifyUser("CACHE.transformQuery:"+transformed);
    188                         } catch (MalformedURLException e) {
    189                                 // TODO Auto-generated catch block
    190                                 e.printStackTrace();
    191                                 transformed = "";
    192                         }
     185                        transformed =  query.getSimpleQueryString();
     186                        transformed = StringEscapeUtils.escapeXml(transformed);
     187                        //Admin.notifyUser("CACHE.transformQuery:"+transformed);
    193188                }
    194189                return transformed;
     
    201196                String xpath_expr="";
    202197               
    203                 String[] key_array = key_info.split("-");
     198                String[] key_array = key_info.split("//-");
    204199                String query_str;
    205200               
     201                Admin.notifyUser("formPATH:" + key_info);
     202               
     203               
    206204                if(key_array.length > 1){
     205                        //Admin.notifyUser("formPATH- querystring:" + key_array[1]);
    207206                        if (key_array[0].equals("recordset")){
    208207                                query_str = transformQuery(key_array[1]);       
     208                                Admin.notifyUser("formPATH- querystring-transformed:" + query_str);
    209209                        }
    210210                        else {
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CompRegistryProxyAction.java

    r690 r704  
    5151                String key="";
    5252                if (getActionkey()!=null) {
    53                         key += getActionkey() + "-" ;
     53                        key += getActionkey() + "//-" ;
    5454                }
    5555                if (getCompid()!=null) {
    56                         key += getCompid() + "-" ;
     56                        key += getCompid() + "//-" ;
    5757                }
    5858                 
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java

    r690 r704  
    176176                String key="";
    177177                if (getActionkey()!=null) {
    178                         key += getActionkey() + "-" ;
     178                        key += getActionkey() + "//-" ;
    179179                }
    180180                if (getQ()!=null) {
    181                         key += getQ() + "-" ;
     181                        key += getQ() + "//-" ;
    182182                }
    183183                if (getCollection()!=null) {
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/model/Query.java

    r690 r704  
    188188        }
    189189
     190        public String getSimpleQueryString() {
     191                String[] arr_and = query_string.split(" and ");
     192                String simple_form = "";
     193                String simple_form_all = "";
     194                String rel = "";
     195               
     196                for( int i=0;i<arr_and.length;i++){
     197                        arr_and[i] = arr_and[i].trim();
     198                        String[] arr_or = arr_and[i].split(" or ");
     199                        simple_form = "";
     200                        for( int j=0;j<arr_or.length;j++){
     201                                arr_or[j] = arr_or[j].trim();
     202                                while (arr_or[j].substring(0,1).equals("(") ) {
     203                                        arr_or[j] = arr_or[j].substring(1,arr_or[j].length());
     204                                        arr_or[j] = arr_or[j].trim();
     205                                }
     206                                while ( arr_or[j].substring(arr_or[j].length()-1,arr_or[j].length()).equals(")")){
     207                                        arr_or[j] = arr_or[j].substring(0,arr_or[j].length()-1);
     208                                        arr_or[j] = arr_or[j].trim();
     209                                }
     210                                if (j > 0) {
     211                                        rel = " or ";
     212                                } else {
     213                                        rel = "";
     214                                }
     215                                simple_form = simple_form + rel + arr_or[j];
     216                        }
     217                        Admin.notifyUser(simple_form);
     218                        if (arr_or.length > 1){
     219                                simple_form = "(" + simple_form + ") ";
     220                        }
     221                        if (i > 0) {
     222                                rel = " and  ";
     223                        } else {
     224                                rel = "";
     225                        }
     226                        simple_form_all = simple_form_all + rel + simple_form;
     227                       
     228                }
     229               
     230                return simple_form_all;
     231        }
    190232        /**
    191233         * construct the URL-Param
  • MDService2/trunk/MDService2/src/xsl/mdset2view.xsl

    r699 r704  
    2020
    2121<xsl:include href="cmd_commons.xsl"/>
     22
     23<xsl:param name="startRecord">1</xsl:param>
     24<xsl:param name="maximumRecords">50</xsl:param>
    2225
    2326<!-- <xsl:param name="format" select="'table'" /> table|list|detail -->
     
    100103        <span class="label" >query:</span><span class="value"><xsl:value-of select="echoedSearchRetrieveRequest" /></span>;
    101104        <span class="label" >hitcount:</span><span class="value hilight"><xsl:value-of select="numberOfRecords" /></span>;
    102         <span class="label" >showing:</span><span class="value"><xsl:value-of select="diagnostics" /></span>
     105        <span class="label" >showing:</span><span class="value"><xsl:value-of select="diagnostics" /></span>;
     106        <span class="label" >startRecord:</span><span><input type="text" size="5" class="value start_record"><xsl:attribute name="value">
     107    <xsl:value-of select="$startRecord"/>
     108  </xsl:attribute>
     109        </input></span>
     110        <span class="label" >maximumRecords:</span><span><input type="text" size="5" class="value maximum_records" ><xsl:attribute name="value">
     111    <xsl:value-of select="$maximumRecords"/>
     112  </xsl:attribute></input></span>
     113        <button class="reload">reload</button>
    103114    </div>
    104115</xsl:template>
Note: See TracChangeset for help on using the changeset viewer.