- Timestamp:
- 10/21/11 10:29:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js
r1584 r1588 211 211 this.columns = columns; // string 212 212 this.query = query; //sctext 213 //this.squery = squery;214 213 this.listid = ""; 215 214 this.container = {}; … … 314 313 } 315 314 316 /*317 if (json["squerystring"] == "[NULL]"){318 this.squery = null;319 } else {320 this.squery = json["squerystring"];321 }322 */323 315 this.columns = columns_text; 324 316 … … 445 437 var params = "?"; 446 438 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 + "&"; 448 444 } 449 445 /* … … 490 486 var str = ""; 491 487 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(); 494 489 return str; 495 490 }; … … 559 554 var jsonq = {"id":this.id, 560 555 "name":"", 561 //"squerystring":this.squery, 562 "querystring":this.query, 556 "querystring":this.query, 563 557 "searchclauses":"null" , 564 558 "collections" : json_coll, … … 651 645 Query.fullformatstring = function (json) { 652 646 var qs = json.querystring; 653 //var sqs = json.squerystring;654 647 655 648 if (qs == "[NULL]") { … … 657 650 } 658 651 659 /*if (sqs == "[NULL]") { 660 sqs = null; 661 } 662 */ 652 663 653 var collection_text = Query.collectiontext(json); 664 654 665 655 var full_str = ""; 666 656 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 677 658 if (qs != null) { 678 659 qs = Query.simplequerystring(qs); … … 691 672 692 673 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;718 674 }; 719 675 … … 770 726 771 727 Query.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 788 729 // FIXME: this is not nice, there should be a function providing the formatted string of the query. 789 730 //var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : ""; … … 792 733 "<span class='query_id'>" + this.listid + "</span>: <span class='query'>" + 793 734 this.toString() + 794 //Query.queryliststring(this.squery, this.query) + coll + " @" + this.repository.toString() +795 735 "</span>" + 796 736 "</div>" + … … 834 774 835 775 // 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}; 850 777 851 778 var uri = "?query=" + JSON.stringify(jsonq) + "&startItem=" + this.startItem + "&maximumItems=" + this.maximumItems; … … 1079 1006 1080 1007 }, 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 */1096 1008 getquerystring: function(qid) { 1097 1009 var qstring = ""; … … 1194 1106 return query; 1195 1107 }, 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 */1224 1108 recorddetailselection: function(recordrow){ 1225 1109 if (this.recordrowselected != undefined){
Note: See TracChangeset
for help on using the changeset viewer.