Changeset 1388
- Timestamp:
- 06/01/11 21:59:12 (13 years ago)
- Location:
- MDService2/trunk/MDService2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js
r1384 r1388 37 37 }; 38 38 39 Workspace. setTypedElement = function(type, id,data){39 Workspace.prototype.setTypedElement = function(type, id,data){ 40 40 switch(type){ 41 41 case 'queryset': 42 this.user_json["WorkspaceProfile"].Querysets = data; 42 if (data == "[{}]"){ 43 this.user_json["WorkspaceProfile"].Querysets = [{}]; 44 } else { 45 this.user_json["WorkspaceProfile"].Querysets = data; 46 } 43 47 break; 44 48 case 'bookmarkset': 45 this.user_json["WorkspaceProfile"].Bookmarksets = data; 49 if (data == "[{}]"){ 50 this.user_json["WorkspaceProfile"].Bookmarksets = [{}]; 51 } else { 52 this.user_json["WorkspaceProfile"].Bookmarksets = data; 53 } 46 54 break; 47 55 case 'query': 48 workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"] = data; 56 if (data == "[{}]"){ 57 workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"] = [{}]; 58 } else { 59 workspace.user_json["WorkspaceProfile"]["Querysets"][id]["Queries"] = data; 60 } 49 61 break; 50 62 case 'bookmark': 51 workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id]["Bookmarks"] = data; 63 if (data == "[{}]"){ 64 workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id]["Bookmarks"] = [{}]; 65 } else { 66 workspace.user_json["WorkspaceProfile"]["Bookmarksets"][id]["Bookmarks"] = data; 67 } 52 68 break; 53 69 } … … 60 76 61 77 if (elems == "null"){ 62 Workspace.setTypedElement(type,id, "[{}]"); 78 this.setTypedElement(type,id, "[{}]"); 79 elems = this.getTypedElement('user', type, id); 63 80 } else { 64 81 iq = elems.length; … … 147 164 // set null string , if 0 querysets 148 165 if (size == 1) { 149 Workspace.setTypedElement(type,id2,"null");166 this.setTypedElement(type,id2,"null"); 150 167 } 151 168 }; … … 193 210 194 211 }; 195 Workspace.prototype.savequery = function(json, qsid, bookmark){212 Workspace.prototype.savequery = function(json, qsid, query){ 196 213 var JSONText; 197 214 var type = "user"; 198 215 var qdata = "/";// + querysetid; 199 216 JSONText = JSON.stringify(json); 200 if ( bookmark == 0){217 if (query.bookmark == 0){ 201 218 qdata = qdata + this.getTypedElement(type, 'queryset')[qsid]["id"]; 202 219 } else { … … 207 224 if (json.id == 0){ 208 225 json.id = $(data).text(); 209 if (bookmark == 0){ 226 query.id = $(data).text(); 227 if (query.bookmark == 0){ 210 228 appendQueryUI(json,qsid, $('#userqueries')); 211 229 } else { … … 355 373 if (this.id == 0){ 356 374 workspace.addelement("query",jsonq, qsid);//qsjson); 357 workspace.savequery(jsonq, qsid, this.bookmark);358 } else { 359 workspace.savequery(jsonq, this.bookmark);375 workspace.savequery(jsonq, qsid, this); 376 } else { 377 workspace.savequery(jsonq, qsid, this); 360 378 } 361 379 } else { … … 364 382 if (this.id == 0){ 365 383 workspace.addelement("bookmark", jsonq, qsid);//qsjson); 366 workspace.savequery(jsonq, qsid,this .bookmark);367 } else { 368 workspace.savequery(jsonq, this.bookmark);384 workspace.savequery(jsonq, qsid,this); 385 } else { 386 workspace.savequery(jsonq, qsid, this); 369 387 } 370 388 } … … 481 499 //$.data("query",this); 482 500 var q = this; 483 if (q.vcrid == 0){501 //if (q.vcrid == 0){ 484 502 $.get("/MDService2/virtualcollection/USER/" + this.id,"", function(data){ 485 var id = parseInt($(data).children().children('virtualcollectionid').text()); 486 q.vcrid = id; 487 q.save(); 503 if (q.vcrid == 0){ 504 var id = parseInt($(data).children().children('virtualcollectionid').text()); 505 q.vcrid = id; 506 q.save(); 507 } 488 508 }); 489 }509 //} 490 510 }; 491 511 … … 1136 1156 $(q_header).data('query',query); 1137 1157 q_header.find('.cmd_reload').data('query',query); 1138 q_header.find('.cmds .cmd_save').data('query',query); 1158 q_header.find('.cmds .cmd_save').data('qid',query.listid); 1159 q_header.find('.cmds .cmd_savenew').data('qid',query.listid); 1139 1160 q_header.find('.cmd_reload').click(function() { 1140 1161 /* -
MDService2/trunk/MDService2/WebContent/scripts/mdservice_ui.js
r1384 r1388 354 354 355 355 $('#detail_query .cmds .cmd_save').live('click', function(event) { 356 qid = $(this).data('query').listid; 356 //qid = $(this).data('query').listid; 357 qid = $(this).data('qid'); 357 358 notifyUser("here I would save query: " + qid, "debug"); 358 $(this).data('query').save(); 359 var q = queryset.getQuery(qid); 360 q.save(); 361 //Workspace.saveQuery($(this).data('query')); 362 }); 363 $('#detail_query .cmds .cmd_savenew').live('click', function(event) { 364 //qid = $(this).data('query').listid; 365 qid = $(this).data('qid'); 366 notifyUser("here I would savenew query: " + qid, "debug"); 367 var q = queryset.getQuery(qid); 368 q.id = 0; 369 q.save(); 359 370 //Workspace.saveQuery($(this).data('query')); 360 371 }); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/VirtualCollectionProxyAction.java
r1310 r1388 36 36 //private String proxy_key = "virtual_collection"; 37 37 38 private String qid;38 //private String qid; 39 39 //private String date; 40 40 //private String datefrom; 41 41 //private String dateto; 42 42 /* 43 43 public String getQid(){ 44 44 return qid; … … 47 47 this.qid = qid; 48 48 } 49 49 */ 50 50 @Override 51 51 protected void initialize(){ … … 105 105 106 106 //create connection and post request data 107 108 URL url = new URL("http://clarin.ids-mannheim.de/vcr/service/virtualcollection"); 107 // find out 108 String urlstring = "http://clarin.ids-mannheim.de/vcr/service/virtualcollection"; 109 String vcrstr = (String)getQueryVcrid(); 110 if (!vcrstr.equals("0")){ 111 urlstring = urlstring + "/" + vcrstr; 112 } 113 //qlist.item(0).get 114 URL url = new URL(urlstring); 109 115 String charset = "UTF-8"; 110 116 URLConnection urlconn = url.openConnection(); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/WorkspaceAction.java
r1384 r1388 552 552 // apend to specific queryset 553 553 NodeList wsnodelist = (NodeList) getQueryParent(); 554 wsnodelist.item(0).appendChild(node2); 554 Node anode = wsnodelist.item(0); 555 if (anode.getTextContent().trim().toLowerCase().equals("null")){ 556 anode.setTextContent(""); 557 } 558 anode.appendChild(node2); 555 559 } 556 560 … … 585 589 // apend to specific bookmarkset 586 590 NodeList wsnodelist = (NodeList) getBookmarkParent(); 587 wsnodelist.item(0).appendChild(node2); 591 Node anode = wsnodelist.item(0); 592 if (anode.getTextContent().trim().toLowerCase().equals("null")){ 593 anode.setTextContent(""); 594 } 595 anode.appendChild(node2); 588 596 } 589 597 … … 620 628 NodeList wsnodelist = (NodeList) this.getWorkspace(); 621 629 Element welem = (Element)wsnodelist.item(0); 622 welem.getElementsByTagName("Querysets").item(0).appendChild(node2); 630 Node anode = welem.getElementsByTagName("Querysets").item(0); 631 if (anode.getTextContent().trim().toLowerCase().equals("null")){ 632 anode.setTextContent(""); 633 } 634 anode.appendChild(node2); 623 635 } 624 636 … … 655 667 NodeList wsnodelist = (NodeList) this.getWorkspace(); 656 668 Element welem = (Element)wsnodelist.item(0); 657 welem.getElementsByTagName("Bookmarksets").item(0).appendChild(node2); 669 Node anode = welem.getElementsByTagName("Bookmarksets").item(0); 670 if (anode.getTextContent().trim().toLowerCase().equals("null")){ 671 anode.setTextContent(""); 672 } 673 anode.appendChild(node2); 658 674 } 659 675 … … 873 889 XPathExpression expr; 874 890 expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" + this.qid + "']"); 891 //expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" +this.qid.toString()+"']"); 875 892 //expr = xpath.compile("//item[@id='" + this.qid + "']"); 876 893 //expression is evaluated with respect to a certain context node which is doc. … … 901 918 return result; 902 919 } 920 921 public Object getQueryVcrid() throws XPathExpressionException{ 922 923 XPathFactory factory = XPathFactory.newInstance(); 924 XPath xpath = factory.newXPath(); 925 XPathExpression expr; 926 // expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item[id='" + this.qsid + "']/vcrid"); 927 expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" + this.qid + "']/vcrid"); 928 929 //expression is evaluated with respect to a certain context node which is doc. 930 Object result = null; 931 try{ 932 result = expr.evaluate(workspace_doc, XPathConstants.STRING); 933 } catch(Exception e){ 934 935 } 936 937 return result; 938 } 903 939 public Object getQueryset() throws XPathExpressionException{ 904 940 -
MDService2/trunk/MDService2/src/xsl/mdset2view.xsl
r1252 r1388 159 159 <!-- <div class='ui-context-dialog ui-widget-content columns-wrapper'> --> 160 160 <div class='ui-widget-content columns-wrapper'> 161 <div class='cmds'><span class="cmd cmd_reload" /><span class="cmd cmd_save" />< /div>161 <div class='cmds'><span class="cmd cmd_reload" /><span class="cmd cmd_save" /><span class="cmd cmd_savenew" /></div> 162 162 <div class='query-columns'> 163 163 <label>Columns</label>
Note: See TracChangeset
for help on using the changeset viewer.