Changeset 683
- Timestamp:
- 09/09/10 20:44:35 (14 years ago)
- Location:
- MDService2/trunk/MDService2/WebContent/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js
r676 r683 87 87 this.Queries[0] = jj; 88 88 } 89 }); 90 91 $.each(jsonw["WorkspaceProfile"]["Querysets"], function(i,item){ 92 if (String(this.Queries) != "null") { 93 $.each(this.Queries, function(i,item){ 94 if (this.collections != "null") { 95 if (this.collections[0] == undefined){ 96 var jj = this["collections"]["item"]; 97 delete this["collections"]["item"]; 98 this.collections = [{}]; 99 this.collections[0] = jj; 100 } 101 } 102 }); 103 } 89 104 }); 90 105 } … … 503 518 var qid = $(this).closest('.query_wrapper').attr("id"); 504 519 var qstring = queryset.getquerystring(qid); 505 var coll = queryset.getcollections(qid); 506 if (coll == "") { 507 coll = "null"; 508 } 509 510 var id = $("#qts_select option:selected").val(); 520 var json_coll = queryset.getcollections(qid); 521 522 var id = parseInt($("#qts_select option:selected").val()); 511 523 var iq = $("#qs_select option").size(); 512 524 513 //var query = new Query("","");514 525 if (iq == 0){ 515 526 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"] = [{}]; 516 527 } 517 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq] = {"querystring":qstring,"searchclauses":"null" , "collections" : {"item":coll}}; 518 528 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq] = {"querystring":qstring,"searchclauses":"null" , "collections" : json_coll}; 519 529 saveWorkspace(); 520 530 … … 620 630 var iq = parseInt($("#qs_select option:selected").val()); 621 631 632 var collection_text = ""; 633 if (jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq].collections != "null"){ 634 $.each(jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq].collections,function(i,item){ 635 collection_text = collection_text + "," + item; 636 }); 637 if (collection_text.length > 1) { 638 collection_text = collection_text.substring(1); 639 } 640 } 641 622 642 var query = new Query("",""); 623 643 query.load(jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq]); 644 query.collection = collection_text; 624 645 queryset.addquery(query); 625 646 626 647 searchclauseset.sctext = query.query; 627 648 searchclauseset.buildfromquerystring(); 628 }); 629 $('#qs_delete').click(function(){ 649 650 $('#collection_list').attr("value",collection_text); 651 }); 652 $('#qs_remove').click(function(){ 630 653 var count = $("#qs_select option").size(); 631 654 var id = parseInt($("#qts_select option:selected").val()); … … 634 657 635 658 for (var i=iq;i<size-1;i++){ 636 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i] = j jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i+1];659 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i] = jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][i+1]; 637 660 } 638 661 … … 640 663 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"].length = size-1; 641 664 665 if (size == 1){ 666 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"] = "null"; 667 } 642 668 643 669 saveWorkspace(); … … 816 842 if (String(jsonq.Queries) != "null") { 817 843 $.each(jsonw["WorkspaceProfile"].Querysets[id].Queries, function(i,item) { 818 notifyUser(i + ',' + this.querystring + ',' + this.c reated,'debug');844 notifyUser(i + ',' + this.querystring + ',' + this.collections[0],'debug'); 819 845 $('#qs_select').append(new Option(this.querystring, i)); 820 846 }); … … 833 859 if (String(jsonw["WorkspaceProfile"].Querysets[id].Queries) != "null") { 834 860 $.each(jsonw["WorkspaceProfile"].Querysets[id].Queries, function(i,item) { 835 notifyUser(i + ',' + this.querystring + ',' + this.created,'debug'); 836 $('#qs_select').append(new Option(this.querystring, i)); 861 862 notifyUser(i + ',' + this.querystring + ',' + this.collections[0],'debug'); 863 $('#qs_select').append(new Option(this.querystring , i)); 837 864 }); 838 865 } … … 857 884 this.Queries = {}; 858 885 this.Queries["Query"] = jj; 859 860 886 } 887 /* 888 $.each(this.Queries,function(i,item){ 889 if (this.collections != "null"){ 890 if (this.collections[1] == undefined){ 891 var jj = this["collections"][0]; 892 delete this["collections"][0]; 893 this.collections = {}; 894 this.collections["item"] = jj; 895 } 896 } 897 }); 898 */ 861 899 } 862 900 }); -
MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js
r676 r683 101 101 getcollections: function(qid) { 102 102 var coll = ""; 103 var json_coll, json_temp; 103 104 104 105 for (var i = 0; i < this.queries.length; i++) { … … 107 108 } 108 109 } 109 return coll; 110 111 if (coll == "") { 112 json_coll = {}; 113 json_coll = "null"; 114 } else { 115 var pos = coll.indexOf(",", 0); 116 var i = 0; 117 118 json_coll = [{}]; 119 while (pos > -1){ 120 if (pos > -1){ 121 json_coll[i] = coll.substring(0,pos); 122 } else { 123 json_coll[i] = coll; 124 } 125 coll = coll.substring(pos+1); 126 pos = coll.indexOf(",", 0); 127 i = i+1; 128 } 129 130 json_coll[i] = coll; 131 132 133 } 134 return json_coll; 110 135 } 111 136 };
Note: See TracChangeset
for help on using the changeset viewer.