Update of /cvsroot/monetdb/pathfinder/runtime/xrpc/demo
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17684

Modified Files:
      Tag: xrpcdemo
        demo-mod.xq index.html style.css 
Log Message:
Demo GUI (work in progress...)



U index.html
Index: index.html
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/index.html,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- index.html  5 Jun 2008 12:54:36 -0000       1.1.2.3
+++ index.html  7 Jun 2008 22:13:21 -0000       1.1.2.4
@@ -67,10 +67,12 @@
   
   var funcdefs = new Array();
   funcdefs[funcdefs.length]=new funcdef("add", false, new Array("integer", 
"integer"), new Array("", ""), "declare function f:add($v1 as xs:integer, $v2 
as xs:integer) as xs:integer\n{ $v1 + $v2 };");
+  funcdefs[funcdefs.length]=new funcdef("addSeq", false, new Array("integer", 
"integer"), new Array("+", "+"), "declare function f:addSeq($v1 as xs:integer+, 
$v2 as xs:integer+) as xs:integer\n{ for $vi in $v1, $vj in $v2 return $vi + 
$vj };");
   funcdefs[funcdefs.length]=new funcdef("firstPerson", false, new 
Array("string"), new Array(""), "declare function f:firstPerson($doc as 
xs:string) as node()\n{ exactly-one(doc($doc)//person[1]) };");
   funcdefs[funcdefs.length]=new funcdef("firstPerson", false, new 
Array("string", "string"), new Array("+", "+"), "declare function 
f:firstPerson($docs as xs:string+, $dsts as xs:string+) as node()+\n{ for $d at 
$pos in $dsts\n  return execute at {$d} 
{f:firstPerson(exactly-one($docs[$pos]))}\n};");
   funcdefs[funcdefs.length]=new funcdef("boughtItems", false, new 
Array("string", "string"), new Array("", ""), "declare function 
f:boughtItems($pid as xs:string, $doc as xs:string) as node()*\n{ 
doc($doc)//closed_auction[./buyer/@person=$pid] };");
-  funcdefs[funcdefs.length]=new funcdef("boughtItemsAllPersons", false, new 
Array("string", "string", "string"), new Array("", "", ""), "declare function 
f:boughtItemsAllPersons($docL as xs:string, $docR as xs:string, $dst as 
xs:string) as node()*\n{ for $pid in doc($docL)//person/@pid\n  return execute 
at {$dst} {f:boughtItems($pid, $docR)}\n};");
+  funcdefs[funcdefs.length]=new funcdef("boughtItemsSeq", false, new 
Array("string", "string"), new Array("+", ""), "declare function 
f:boughtItemsSeq($pid as xs:string+, $doc as xs:string) as node()*\n{ for $p in 
$pid\n  return\n    doc($doc)//closed_auction[./buyer/@person=$p]\n};");
+  funcdefs[funcdefs.length]=new funcdef("boughtItemsAllPersons", false, new 
Array("string", "string", "string"), new Array("", "", ""), "declare function 
f:boughtItemsAllPersons($docL as xs:string, $docR as xs:string, $dst as 
xs:string) as node()*\n{ for $p in $pid\n  return\n          for $ca in 
doc($doc)//closed_auction[./buyer/@person=$p]\n      return\nelement 
closed_auction {attribute buyer {$ca/buyer/@person}, $ca/price, $ca/date}\n};");
   funcdefs[funcdefs.length]=new funcdef("insertPerson", true, new 
Array("node()", "string"), new Array("", ""), "declare updating function 
f:insertPerson($p as node(), $doc as xs:string)\n{ do insert $p into 
doc($doc)//persons };");
   funcdefs[funcdefs.length]=new funcdef("deletePerson", true, new 
Array("string", "string"), new Array("", ""), "declare updating function 
f:deletePerson($pid as xs:string, $doc as xs:string)\n{ do delete 
doc($doc)//person[./@pid=$pid] };");
   funcdefs[funcdefs.length]=new funcdef("custom...", false, new 
Array("integer", "integer", "integer", "integer"), new Array("", "", "", ""), 
"");
@@ -299,6 +301,10 @@
   function updatingChanged(object) { 
   }
   
+  function escapeForHTML(s) {
+       return 
s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;")
+  }
+  
   function messreqChanged(xmldoc) {
        document.getElementById("messreq").value = serializeXML(xmldoc);
   
@@ -325,9 +331,13 @@
                var sval = '';
                for (var k = 0; k < seqnodes.length; k++) {
                        var atvals = seqnodes[k].childNodes;
+                       if (k > 0) sval += ', ';
                        sval += '( ';
                        for (var j = 0; j < atvals.length; j++) {
-                               sval += atvals[j].firstChild.nodeValue + ' '; 
+                               if (j > 0) sval += ', ';
+                               var tval = atvals[j].firstChild.nodeValue;
+                               if (tval == null) tval = 
escapeForHTML(serializeXML(atvals[j].firstChild));
+                               sval += tval + ' ';
                        }
                        sval += ') ';
                }
@@ -354,14 +364,17 @@
                '<tr><td>Function<\/td><td>' + funcn + '<\/td><\/tr>' +
                '<tr><td>NS<\/td><td>' + ns + '<\/td><\/tr>' +
                '<tr><td>&nbsp;<\/td><td><\/td><\/tr>' +
-               '</table><table><tr><td>iter<\/td><td>param<\/td><\/tr>';
+               '</table><table><tr><td>iter<\/td><td>result<\/td><\/tr>';
                var seqnodes = 
xmldoc.getElementsByTagName("response")[0].childNodes;
                
                for (var k = 0; k < seqnodes.length; k++) {
                        var atvals = seqnodes[k].childNodes;
                        var sval = '( ';
                        for (var j = 0; j < atvals.length; j++) {
-                               sval += atvals[j].firstChild.nodeValue + ' '; 
+                               if (j > 0) sval += ', ';
+                               var tval = atvals[j].firstChild.nodeValue;
+                               if (tval == null) tval = 
escapeForHTML(serializeXML(atvals[j].firstChild));
+                               sval += tval + ' ';
                        }
                        sval += ') ';
                        htm += '<tr><td>' + (k+1) + '<\/td><td>' + sval + 
'<\/td><\/tr>';
@@ -434,7 +447,7 @@
        </tr>
        <tr>
                <td></td>
-               <td><textarea cols="40" rows="4" name="def" id="def" 
readonly="readonly"></textarea></td>
+               <td><textarea cols="40" rows="14" name="def" id="def" 
readonly="readonly"></textarea></td>
        </tr>
        <tr>
                <td><label for="loop">Loop counter</label></td>

U style.css
Index: style.css
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/style.css,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- style.css   5 Jun 2008 12:54:43 -0000       1.1.2.3
+++ style.css   7 Jun 2008 22:13:22 -0000       1.1.2.4
@@ -34,6 +34,7 @@
        border: 1px solid black;
        border-bottom: 4px solid black;
        border-right: 4px solid black;
+       height: 646px;
 }
 
 #answers {
@@ -58,9 +59,10 @@
 
 #graph {
        width: 400px;
-       height: 620px;
+       height: 640px;
        margin-right: 5px;
        overflow:auto;
+       padding: 0px;
 }
 
 #request tr.myheader, #response tr.myheader, #answers tr.myheader, #graph 
tr.myheader {

U demo-mod.xq
Index: demo-mod.xq
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/demo-mod.xq,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- demo-mod.xq 4 Jun 2008 13:30:12 -0000       1.1.2.2
+++ demo-mod.xq 7 Jun 2008 22:13:21 -0000       1.1.2.3
@@ -3,6 +3,9 @@
 declare function f:add($v1 as xs:integer, $v2 as xs:integer) as xs:integer
 { $v1 + $v2 };
 
+declare function f:addSeq($v1 as xs:integer+, $v2 as xs:integer+) as 
xs:integer+
+{ for $vi in $v1, $vj in $v2 return $vi + $vj };
+
 declare function f:firstPerson($doc as xs:string) as node()
 { exactly-one(doc($doc)//person[1]) };
 
@@ -14,6 +17,15 @@
 declare function f:boughtItems($pid as xs:string, $doc as xs:string) as node()*
 { doc($doc)//closed_auction[./buyer/@person=$pid] };
 
+declare function f:boughtItemsSeq($pid as xs:string+, $doc as xs:string) as 
node()*
+{ for $p in $pid
+  return
+       for $ca in doc($doc)//closed_auction[./buyer/@person=$p]
+       return
+       element closed_auction {attribute buyer {$ca/buyer/@person}, $ca/price, 
$ca/date}
+       
+};
+
 declare function f:boughtItemsAllPersons($docL as xs:string, $docR as 
xs:string, $dst as xs:string) as node()*
 { for $pid in doc($docL)//person/@pid
   return execute at {$dst} {f:boughtItems($pid, $docR)}


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to