Permalink
Browse files

Some small changes to improve class

  • Loading branch information...
Nuno Job
Nuno Job committed Apr 14, 2010
1 parent 748c381 commit 3021cb15066d4bf56753aad3fc3be87a62348efe
Showing with 24 additions and 11 deletions.
  1. BIN img/.DS_Store
  2. BIN img/marklogic.png
  3. +4 −4 index.xqy
  4. +9 −0 lib/helpers.xqy
  5. +4 −3 new.xqy
  6. +7 −4 show.xqy
View
Binary file not shown.
View
Binary file not shown.
View
@@ -1,5 +1,7 @@
xquery version "1.0-ml" ;
import module namespace h = "helpers" at "/lib/helpers.xqy" ;
xdmp:set-response-content-type( "application/xhtml+xml" ),
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
@@ -12,7 +14,7 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<body id="home">
<div id="wrapper">
<div id="header">
<h1> MarkLogic Blog </h1>
<h1> <img border="0" alt="MarkLogic" src="img/marklogic.png"/> Blog </h1>
</div>
<div id="nav">
<ul>
@@ -22,7 +24,6 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<div id="content">
<div id="subcol">
<h2>Facets</h2>
Not yet
</div>
<div id="maincol">
@@ -34,15 +35,14 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
</div><br/>
<h2>Listing Posts</h2>
<dl> { for $a in fn:doc() [1 to 10]
let $_ := xdmp:log ( xdmp:quote($a) )
let $permalink := fn:concat('show.xqy?uri=', fn:document-uri($a))
let $snippet := fn:string-join(
fn:tokenize(fn:string($a//*:body), " ")[1 to 20], " ")
return
(<dt><a href="{$permalink}">{fn:string($a//*:title)}</a></dt>,
<dd>{$snippet}</dd>) }
</dl>
<p>[ <a href="new.xqy">Add new</a> ]</p>
<p>[ {h:link_to_new()} ]</p>
</div>
</div>
</div>
View
@@ -0,0 +1,9 @@
xquery version "1.0-ml";
module namespace h = "helpers";
declare function h:link_to_index() {
<a href="index.xqy" xmlns="http://www.w3.org/1999/xhtml">Back to main</a> } ;
declare function h:link_to_new() {
<a href="new.xqy" xmlns="http://www.w3.org/1999/xhtml">Add new</a> } ;
View
@@ -1,4 +1,6 @@
xquery version "1.0-ml" ;
import module namespace h = "helpers" at "/lib/helpers.xqy" ;
import module namespace gen = "http://ns.dscape.org/2010/generate-tree"
at "/lib/generate-tree.xqy" ;
@@ -14,7 +16,7 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<body id="home">
<div id="wrapper">
<div id="header">
<h1> MarkLogic Blog </h1>
<h1> <img border="0" alt="MarkLogic" src="img/marklogic.png"/> Blog </h1>
</div>
<div id="nav">
<ul>
@@ -24,7 +26,6 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<div id="content">
<div id="subcol">
<h2>Facets</h2>
Not yet
</div>
<div id="maincol">
@@ -48,7 +49,7 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
return xdmp:document-insert( $path,
gen:process-fields( $xpaths, $values ) ) }
</div>
<p>[ <a href="index.xqy">Back to main</a> ]</p>
<p>[ { h:link_to_index() } ]</p>
</div>
</div>
</div>
View
@@ -1,5 +1,7 @@
xquery version "1.0-ml" ;
import module namespace h = "helpers" at "/lib/helpers.xqy" ;
xdmp:set-response-content-type( "application/xhtml+xml" ),
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
@@ -12,7 +14,7 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<body id="home">
<div id="wrapper">
<div id="header">
<h1> MarkLogic Blog </h1>
<h1> <img border="0" alt="MarkLogic" src="img/marklogic.png"/> Blog </h1>
</div>
<div id="nav">
<ul>
@@ -22,7 +24,6 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
<div id="content">
<div id="subcol">
<h2>Facets</h2>
Not yet
</div>
<div id="maincol">
@@ -33,11 +34,13 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
</form>
</div><br/> {
let $uri := xdmp:get-request-field("uri")
let $a := doc($uri)
let $a := doc(xdmp:url-encode($uri))
let $_ := xdmp:log(xdmp:quote($a))
let $_ := xdmp:log($uri)
return
(<h2>{fn:string($a//*:title)}</h2>,
<p>{fn:string($a//*:body)}</p>) }
<p>[ <a href="new.xqy">Add new</a> ]</p>
<p>[ { h:link_to_index() } ]</p>
</div>
</div>
</div>

0 comments on commit 3021cb1

Please sign in to comment.