Changeset 1561 for MDService2
- Timestamp:
- 09/28/11 11:49:16 (13 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js
r1558 r1561 206 206 @class Represents a Query. 207 207 */ 208 function Query(collection, columns, query , squery) {208 function Query(collection, columns, query) { 209 209 this.id = 0; 210 210 this.collection = collection; // [] 211 211 this.columns = columns; // string 212 212 this.query = query; //sctext 213 this.squery = squery;213 //this.squery = squery; 214 214 this.listid = ""; 215 215 this.container = {}; … … 313 313 this.query = json["querystring"]; 314 314 } 315 /* 315 316 if (json["squerystring"] == "[NULL]"){ 316 317 this.squery = null; … … 318 319 this.squery = json["squerystring"]; 319 320 } 321 */ 320 322 this.columns = columns_text; 321 323 … … 444 446 // params = params + "q=" + escape(this.query) + "&"; 445 447 //} 446 if (this. squery != null) {447 escaped_sq =escape(this. squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;448 if (this.query != null) { 449 escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; 448 450 escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B"); 449 451 //params = params + "squery=" + escaped_sq + "&"; … … 463 465 var params = "?operation=searchRetrieve&version=1.2&"; 464 466 var q = ""; 467 /* 465 468 if (this.query != null) { 466 469 q = "( " + escape(this.query) + " )"; 467 470 } 468 if (this.squery != null) { 469 escaped_sq =escape(this.squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; 471 */ 472 if (this.query != null) { 473 escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; 470 474 escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B"); 471 if (q.length > 0){475 /*if (q.length > 0){ 472 476 q = q + " and "; 473 } 474 q = q +escaped_sq;477 }*/ 478 q = escaped_sq; 475 479 } 476 480 params = params + "query=" + q + "&x-cmd-collections=" + this.getcollectiontext("index") + … … 483 487 var str = ""; 484 488 var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : ""; 485 str = Query. queryliststring(this.squery,this.query) + coll + " @" + this.repository.toString();489 str = Query.simplequerystring(this.query) + coll + " @" + this.repository.toString(); 486 490 return str; 487 491 }; … … 551 555 var jsonq = {"id":this.id, 552 556 "name":"", 553 "squerystring":this.squery,557 //"squerystring":this.squery, 554 558 "querystring":this.query, 555 559 "searchclauses":"null" , … … 643 647 Query.fullformatstring = function (json) { 644 648 var qs = json.querystring; 645 var sqs = json.squerystring;649 //var sqs = json.squerystring; 646 650 647 651 if (qs == "[NULL]") { 648 652 qs = null; 649 653 } 654 /* 650 655 if (sqs == "[NULL]") { 651 656 sqs = null; 652 657 } 658 */ 653 659 var collection_text = Query.collectiontext(json); 654 660 655 661 var full_str = ""; 656 662 var len = formatquerystring_len; 657 663 /* 658 664 if (sqs != null) { 659 665 if (sqs.length > len){ … … 664 670 } 665 671 } 672 */ 666 673 if (qs != null) { 667 674 qs = Query.simplequerystring(qs); … … 681 688 return full_str; 682 689 }; 683 690 /* 684 691 Query.queryliststring = function(squery, query) { 685 692 var s_squery = ""; … … 702 709 return str; 703 710 }; 704 711 */ 705 712 Query.simplequerystring = function (querystring) { 706 713 … … 831 838 } 832 839 */ 833 var jsonq = {"squerystring":this.squery, "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols}; 840 //var jsonq = {"squerystring":this.squery, "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols}; 841 var jsonq = { "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols}; 834 842 835 843 var uri = "?query=" + JSON.stringify(jsonq) + "&startItem=" + this.startItem + "&maximumItems=" + this.maximumItems; … … 1062 1070 1063 1071 }, 1064 1072 /* 1065 1073 getsquery: function(qid) { 1066 1074 var qstring = ""; … … 1076 1084 return qstring; 1077 1085 }, 1086 */ 1078 1087 getquerystring: function(qid) { 1079 1088 var qstring = ""; -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
r1267 r1561 522 522 var n; 523 523 var scarr; 524 var rel ;524 var rel = ""; 525 525 n = scstr.indexOf("="); 526 526 if (n > 0){ … … 556 556 if (j > 0) {screl = "or";} 557 557 //notifyUser("scarr:" + scarr[0] + scarr[1],'debug'); 558 558 559 if (scarr == undefined) { 559 sc = new SearchClause(' ','','');560 sc = new SearchClause('*','any',scstr);//sc = new SearchClause('','',''); 560 561 } else { 561 562 sc = new SearchClause(scarr[0],rel,scarr[1]); … … 569 570 570 571 // from searchclauses to querystring 572 simplequerytext: function(){ 573 this.buildsctext(); 574 return sctext.replace('* any ',''); 575 }, 571 576 buildsctext: function(){ 572 577 var uncompletequery = false; … … 580 585 for (var i = 0; i < this.searchclauses.length; i++) { 581 586 if ( i>0) this.sctext = this.sctext + " and "; 582 this.sctext = this.sctext + " ( ";587 if (this.searchclauses.length> 1) this.sctext = this.sctext + " ( "; 583 588 for (var j = 0; j < this.searchclauses[i].length; j++) { 584 589 if ( j>0) this.sctext = this.sctext + " or "; 585 this.sctext = this.sctext + " ( ";590 if (this.searchclauses[i].length > 1) this.sctext = this.sctext + " ( "; 586 591 ptext = this.searchclauses[i][j].PlainText(); 587 592 if (ptext.length == 0){ … … 589 594 } 590 595 this.sctext = this.sctext + ptext; 591 this.sctext = this.sctext + " ) ";592 } 593 this.sctext = this.sctext + " ) ";596 if (this.searchclauses[i].length > 1) this.sctext = this.sctext + " ) "; 597 } 598 if (this.searchclauses.length> 1) this.sctext = this.sctext + " ) "; 594 599 } 595 600 -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js
r1558 r1561 65 65 // autocomplete correction 66 66 searchclauseset.addsearchclause(new SearchClause("","",""),"",0,0); 67 createInfos();67 //createInfos(); 68 68 69 69 detailcaller.calldetail(undefined, "info"); … … 91 91 92 92 } 93 93 function getInputMode(){ 94 if ($('#searchclauselist').is(":visible")){ 95 return 'complex'; 96 } 97 return 'simple'; 98 } 94 99 /** 95 100 * This function is called during the initialization sequence and binds event-handlers to events of ui-elements. … … 97 102 */ 98 103 function addFunctionality(){ 104 //TODO query-input action not valid (solve in html_snippets.xsl ?) 105 //$('#query-input').children("form").attr("id","searchretrieve"); 106 107 //switch the input simple query vs complex query 108 //$('#searchclauselist').hide(); 109 $('#switch-input').live('click',function(){ 110 $('#searchclauselist').toggle(); 111 $('#input-simplequery').toggle(); 112 if (getInputMode() == 'complex'){ 113 searchclauseset.sctext = $('#input-simplequery').attr("value"); 114 searchclauseset.buildfromquerystring(); 115 } else { 116 $('#input-simplequery').attr("value",searchclauseset.simplequerytext()); 117 } 118 }); 119 99 120 // DEL COMMAND 100 121 /* … … 253 274 event.preventDefault(); 254 275 //hideWelcomeMessage(); 255 searchclauseset.buildsctext(); 256 notifyUser(searchclauseset.sctext,'debug'); 257 258 //submit_query (columns_widget.getColumnsListText(),searchclauseset.sctext, $('#input-simplequery').attr("value"), $('#input-withsummary').attr("checked")); 259 260 var query = searchclauseset.sctext; 261 var squery = $('#input-simplequery').attr("value"); 276 var query; 277 if (getInputMode() == 'complex'){ 278 searchclauseset.buildsctext(); 279 query = searchclauseset.sctext; 280 } else { 281 query = $('#input-simplequery').attr("value"); 282 } 283 //searchclauseset.buildsctext(); 284 //notifyUser(searchclauseset.sctext,'debug'); 285 //submit_query (columns_widget.getColumnsListText(),searchclauseset.sctext, $('#input-simplequery').attr("value"), $('#input-withsummary').attr("checked")); 286 //var query = searchclauseset.sctext; 287 //var squery = $('#input-simplequery').attr("value"); 262 288 // TODO we dont use columns-widget 263 289 var columns = "";//columns_widget.getColumnsListText(); … … 270 296 query = null; 271 297 } 272 if (jQuery.trim(squery).length == 0){ 273 squery = null; 274 } 275 276 var q = new Query(collections, columns, query, squery); //actions.collections.current, query ); 298 var q = new Query(collections, columns, query); //actions.collections.current, query ); 277 299 q.repository = getSelectedRepository(); 278 300 //if (ws) { … … 1045 1067 //TODO new params 1046 1068 var q = url["q"]; 1047 var squery = url["query"];//url["squery"]; 1069 if (url["query"] == undefined){ 1070 q = url["q"]; 1071 } 1072 else { 1073 q = url["query"]; 1074 } 1075 1076 //var squery = url["query"];//url["squery"]; 1048 1077 var collection = url["collection"]; 1049 var startItem = url["start Item"];1050 var maximumItems = url["maximum Items"];1078 var startItem = url["startRecord"]; 1079 var maximumItems = url["maximumRecords"]; 1051 1080 var repository = url["repository"]; 1052 1081 var columns = url["columns"]; 1053 if ((q != undefined) || ( squery != undefined) || (collection != undefined)) {1082 if ((q != undefined) || (collection != undefined)) { 1054 1083 if (q == undefined) { 1055 1084 q = ""; 1056 1085 } else { 1057 1086 q = Url.decode(q); 1058 } 1087 }/* 1059 1088 if (squery == undefined) { 1060 1089 squery = ""; 1061 } 1090 } */ 1062 1091 if (columns == undefined) { 1063 1092 columns = ""; … … 1086 1115 } 1087 1116 1088 var query = new Query(collections, columns, q , squery);1117 var query = new Query(collections, columns, q); 1089 1118 query.startItem = startItem; 1090 1119 query.maximumItems = maximumItems; -
MDService2/branches/MDService_simple3/WebContent/style/cmds-ui.css
r1503 r1561 112 112 #input-simplequery { width: 85%; margin: 12px 0px 6px 0px; font-size: 1.2em;} 113 113 #submit-query { font-size: 1.2em; font-weight: bold;} 114 #searchclauselist {margin: 0px; }114 #searchclauselist {margin: 0px; display:none;} 115 115 .searchclause { } 116 116 .and_level {border-top: 1px solid #9999cc; margin: 2px 0px;} … … 153 153 154 154 .info div.example {border: 1px dashed #014172; background-color: #fafaff; font-family: "Courier New", monospaced; margin: 0.8em 0; padding: 4px; line-height: 1.2em} 155 156 155 157 156 158 /* ************* */ -
MDService2/branches/MDService_simple3/src/xsl/html_snippets.xsl
r1559 r1561 20 20 <link href="{$base_dir}/style/cmds-ui.css" type="text/css" rel="stylesheet"></link> 21 21 22 <xsl:if test="contains($format,' jspage')">22 <xsl:if test="contains($format,'htmljspage')"> 23 23 <link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" /> 24 24 <link href="{$base_dir}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link> … … 62 62 <div id="top-menu"> 63 63 <div id="user"> 64 <a href="{my:formURLparams($base_js_url, $q, $repository_name, $startRecord, $maximumRecords)}" > js </a> 64 <xsl:choose> 65 <xsl:when test="contains($format,'htmljspage')"> 66 <a href="{my:formURLparams($base_url, $q, $repository_name, $startRecord, $maximumRecords)}" > none js </a> 67 </xsl:when> 68 <xsl:otherwise> 69 <a href="{my:formURLparams($base_js_url, $q, $repository_name, $startRecord, $maximumRecords)}" > js </a> 70 </xsl:otherwise> 71 </xsl:choose> 72 65 73 <xsl:choose> 66 74 <xsl:when test="$user = ''" > … … 88 96 <div class="header ui-widget-header ui-state-default ui-corner-top" ><span>Search</span></div> 89 97 <div class="content" id="query-input" > 90 <form action="{my:formURL('search', 'htmlpage','')}" method="get"> 91 <input type="text" id="input-simplequery" name="query" value="{$q}" /> 92 <input type="submit" value="submit" id="submit-query"/> 98 <form id="searchretrieve" action="{my:formURL('search', 'htmlpage','')}" method="get"> 99 <table class="cmds-ui-elem-stretch"> 100 <tr> 101 <td><input type="text" id="input-simplequery" name="query" value="{$q}" class="queryinput active"/> 102 <div id="searchclauselist" class="queryinput inactive"/></td> 103 <td><input type="submit" value="submit" id="submit-query"/></td> 104 </tr> 105 </table> 93 106 94 107 <div> … … 110 123 </td> 111 124 <td valign="top"> 112 <label>Complex query</label><span name='detail_index' class='cmd cmd_detail'></span><br/>113 < div id="searchclauselist"></div>125 <label>Complex query</label><span id="switch-input" name='detail_index' class='cmd'></span><br/> 126 <!-- <div id="searchclauselist"></div>--> 114 127 <!--<input type="checkbox" checked="false" id="input-withsummary" name="WS"/><label>with Summary</label> 115 128 --> -
MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl
r1559 r1561 86 86 <xsl:call-template name="header" /> 87 87 </xsl:if> 88 <xsl:call-template name="query-input" /> 88 <xsl:if test="contains($format, 'page')"> 89 <xsl:call-template name="query-input" /> 90 </xsl:if> 91 89 92 90 93 <xsl:choose>
Note: See TracChangeset
for help on using the changeset viewer.