Ignore:
Timestamp:
10/21/11 10:29:20 (13 years ago)
Author:
gaba
Message:

squery removing changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js

    r1584 r1588  
    211211        this.columns = columns;         // string
    212212        this.query = query;              //sctext
    213         //this.squery = squery;
    214213        this.listid = "";
    215214        this.container = {};
     
    314313        }
    315314
    316         /*
    317         if (json["squerystring"] == "[NULL]"){
    318                 this.squery = null;
    319         } else {
    320                 this.squery = json["squerystring"];     
    321         }
    322 */
    323315        this.columns = columns_text;
    324316       
     
    445437        var params = "?";
    446438        if (this.query != null) {
    447                 params = params + "query=" + escape(this.query) + "&";
     439                escaped_sq = escape(this.query);
     440                //escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;
     441                //escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B");
     442                //params = params + "query=" + escape(this.query) + "&";
     443                params = params + "query=" + escaped_sq + "&";
    448444        }
    449445        /*
     
    490486        var str = "";
    491487        var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : "";
    492         //str = Query.queryliststring(this.squery,this.query) + coll + " @" + this.repository.toString();
    493         str = Query.queryliststring(this.query) + coll + " @" + this.repository.toString();
     488        str = Query.simplequerystring(this.query) + coll + " @" + this.repository.toString();
    494489        return str;
    495490};
     
    559554        var jsonq = {"id":this.id,
    560555                                 "name":"",
    561                              //"squerystring":this.squery,
    562                                  "querystring":this.query,     
     556                             "querystring":this.query, 
    563557                                 "searchclauses":"null" ,
    564558                                 "collections" : json_coll,
     
    651645Query.fullformatstring = function (json) {
    652646        var qs = json.querystring;
    653         //var sqs = json.squerystring;
    654647       
    655648        if (qs == "[NULL]") {
     
    657650        }
    658651       
    659         /*if (sqs == "[NULL]") {
    660                 sqs = null;
    661         }
    662         */
     652       
    663653        var collection_text = Query.collectiontext(json);
    664654       
    665655        var full_str = "";
    666656        var len = formatquerystring_len;
    667         /*
    668         if (sqs != null) {
    669                 if (sqs.length > len){
    670                         full_str = sqs.substring(0,len) + "..| ";
    671                 } else {
    672                         sqs = sqs + "                                     ";
    673                         full_str = sqs.substring(0,len) + "  | ";
    674                 }
    675         }
    676         */
     657       
    677658        if (qs != null) {
    678659                qs = Query.simplequerystring(qs);
     
    691672       
    692673        return full_str;
    693 };
    694 
    695 Query.queryliststring = function(query) {
    696         var s_squery = "";
    697         var s_query = "";
    698         var str = "";
    699        
    700         /*if (squery != null){
    701                 s_squery = squery;
    702         }
    703        
    704         if (query != null){
    705                 s_query = query;
    706         }
    707         if (s_squery.length != 0 && s_query.length != 0){
    708                 str = squery + " & (" + Query.simplequerystring(query) +  ")";
    709         } else if (s_squery.length != 0) {
    710                 str = squery;
    711         } else {
    712                 str =  Query.simplequerystring(query);
    713         }
    714         */
    715        
    716         str =  Query.simplequerystring(query);
    717         return str;
    718674};
    719675
     
    770726
    771727Query.prototype.render = function () {
    772 /*
    773         var x = "<div id='" + this.listid + "' class='query_wrapper ui-widget' ><div class='query_header ui-widget-header ui-state-default ui-corner-top'>" +
    774         "<span class='cmd cmd_get'></span><span class='cmd cmd_save'></span><span class='cmd cmd_del'> </span>" +
    775         "<span class='query_id'>" +     this.listid + "</span>: <span class='query'>" +
    776         this.getcollectiontext("name") + ":" + Query.queryliststring(this.squery, this.query) + ", repository:" + this.repository.toString() + "</span>" +
    777                         "<a class='cmd cmd_xml' target='_blank' href='" + this.link("xml") + "'>xml</a> <a class='cmd cmd_link' target='_blank' href='" + this.link("fullpage") + "' >link</a></div>" +
    778                 //      <span class='cmd cmd-xml'></span><span class='cmd cmd-page'></span><span class='cmd cmd-link'></span></div>" +         
    779                         //"<div class='ui-context-dialog columns-wrapper'><div class='query-columns'></div><span class='cmd cmd_del'></span></div><div class='result ui-widget-content ui-corner-bottom'></div>";
    780                         "<div class='result ui-widget-content ui-corner-bottom'></div>";
    781                         */
    782         /*
    783         var x = $('#querylistelement').html().toString();
    784         x.replace('querylistelement', this.listid);
    785         $(x).find(".query-id").text(this.listid);
    786         $(x).children().children(".query").text(this.getcollectiontext("name") + ":" + Query.queryliststring(this.squery, this.query) + ", repository:" + this.repository.toString());
    787         */
     728
    788729        // FIXME: this is not nice, there should be a function providing the formatted string of the query.
    789730        //var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : ""; 
     
    792733        "<span class='query_id'>" + this.listid + "</span>: <span class='query'>" +
    793734        this.toString() +
    794         //Query.queryliststring(this.squery, this.query) + coll + " @" + this.repository.toString() +
    795735        "</span>" +
    796736                        "</div>" +
     
    834774         
    835775                // JSON conversion
    836          /*
    837                 if (this.query.length == 0){
    838                         xqstring = "[NULL]";
    839                 } else {
    840                         xqstring = this.query;
    841                 }
    842                 if (this.squery.length == 0){
    843                         xsquery = "[NULL]";
    844                 } else {
    845                         xsquery = this.squery;
    846                 }
    847          */
    848                 //var jsonq = {"squerystring":this.squery, "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
    849          var jsonq = { "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
     776         var jsonq = { "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
    850777
    851778                var uri = "?query=" + JSON.stringify(jsonq) + "&startItem=" + this.startItem + "&maximumItems=" + this.maximumItems;
     
    10791006               
    10801007        },
    1081 /*
    1082         getsquery: function(qid) {
    1083                 var qstring = "";
    1084                
    1085                 for (var i = 0; i < this.queries.length; i++) {
    1086                         if (this.queries[i].listid == qid) {
    1087                                 qstring = this.queries[i].squery;
    1088                         }
    1089                 }
    1090                 if (qstring == null){
    1091                         qstring = "";
    1092                 }
    1093                 return qstring;
    1094         },
    1095         */
    10961008        getquerystring: function(qid) {
    10971009                var qstring = "";
     
    11941106                return query;
    11951107        },
    1196         /*
    1197         next: function(qid,pages){
    1198                 var query = queryset.queries[qid.substring(1)-1];
    1199                 var start = 0;
    1200                 var num = 0;
    1201                 var max_value = $('#' + qid ).find('.result-header').attr("max_value");
    1202                
    1203                 if (parseInt(query.startItem) + pages * page_record_count >= 1){
    1204                         start = parseInt(query.startItem) + pages * page_record_count ;
    1205                 } else if (parseInt(query.startItem) + pages * page_record_count + page_record_count - 1 >= 1){
    1206                         start = 1 ;
    1207                 }
    1208                 if (start > 0){
    1209                         if (start + page_record_count - 1 <= max_value) {
    1210                                 num = page_record_count;
    1211                         } else if (start <= max_value){
    1212                                 num = max_value - start;
    1213                         }
    1214                
    1215                         if (num > 0){
    1216                                 query.startItem =       start;
    1217                                 query.maximumItems = num;
    1218                                 query.resubmit();
    1219                         }
    1220                 }
    1221                
    1222         },
    1223         */
    12241108        recorddetailselection: function(recordrow){
    12251109                if (this.recordrowselected != undefined){
Note: See TracChangeset for help on using the changeset viewer.