From: <wol...@us...> - 2011-07-31 09:48:12
|
Revision: 15013 http://exist.svn.sourceforge.net/exist/?rev=15013&view=rev Author: wolfgang_m Date: 2011-07-31 09:48:06 +0000 (Sun, 31 Jul 2011) Log Message: ----------- [website] Fixed url rewriting example. Modified Paths: -------------- stable/eXist-1.4.x/webapp/urlrewrite/controller.xql stable/eXist-1.4.x/webapp/urlrewrite/error-handler.xql stable/eXist-1.4.x/webapp/urlrewrite/index.xml stable/eXist-1.4.x/webapp/urlrewrite/login.xml Removed Paths: ------------- stable/eXist-1.4.x/webapp/urlrewrite/jquery.xml stable/eXist-1.4.x/webapp/urlrewrite/style-jquery.xql Modified: stable/eXist-1.4.x/webapp/urlrewrite/controller.xql =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/controller.xql 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/controller.xql 2011-07-31 09:48:06 UTC (rev 15013) @@ -16,8 +16,10 @@ declare function local:set-credentials($user as xs:string, $password as xs:string?) as element()+ { session:set-attribute("myapp.user", $user), session:set-attribute("myapp.password", $password), - <set-attribute name="xquery.user" value="{$user}"/>, - <set-attribute name="xquery.password" value="{$password}"/> + <set-attribute xmlns="http://exist.sourceforge.net/NS/exist" + name="xquery.user" value="{$user}"/>, + <set-attribute xmlns="http://exist.sourceforge.net/NS/exist" + name="xquery.password" value="{$password}"/> }; (:~ @@ -41,7 +43,10 @@ else if ($user) then let $loggedIn := xdb:login("/db", $user, $password) return - local:set-credentials($user, $password) + if ($loggedIn) then + local:set-credentials($user, $password) + else + util:log("DEBUG", ("Could not log in ", $user, $password)) else if ($sessionCredentials) then local:set-credentials($sessionCredentials[1], $sessionCredentials[2]) else @@ -61,19 +66,6 @@ </view> </dispatch> -(: - jQuery module demo: tags in the jquery namespace are expanded - by style-jquery.xql -:) -else if ($exist:resource eq 'jquery.xml') then - <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> - {local:set-user()} - <view> - <forward url="style.xql"/> - <forward url="style-jquery.xql"/> - </view> - </dispatch> - (: Error handling: faulty.xql will trigger an XQuery error which will be handled by error-handler.xql @@ -96,7 +88,7 @@ else if ($exist:resource eq 'protected.xml') then let $login := local:set-user() return - if ($login) then + if (exists($login)) then <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> {$login} <view> Modified: stable/eXist-1.4.x/webapp/urlrewrite/error-handler.xql =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/error-handler.xql 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/error-handler.xql 2011-07-31 09:48:06 UTC (rev 15013) @@ -16,9 +16,10 @@ </style:page-head> <div id="content2col"> <h2>An error has occurred</h2> - {$input//div[@class = 'description']} - + <div class="description"> + {$input//div[@id = 'container']/h2/text()} + </div> <p><a href="index.xml">Back</a> to the examples.</p> </div> </body> - </html> \ No newline at end of file + </html> Modified: stable/eXist-1.4.x/webapp/urlrewrite/index.xml =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/index.xml 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/index.xml 2011-07-31 09:48:06 UTC (rev 15013) @@ -16,9 +16,8 @@ <ul> <li><a href="protected.xml">Access control</a>: use URL rewriting to control access to a resource from the controller.xql.</li> - <li>Declarative jQuery: an XQuery module which parses an HTML template and generates jQuery/Javascript code. (trunk only)</li> <li><a href="faulty.xql">Error handling</a>: redirect the user to a landing page if an XQuery error occurs.</li> </ul> </div> </body> -</html> \ No newline at end of file +</html> Deleted: stable/eXist-1.4.x/webapp/urlrewrite/jquery.xml =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/jquery.xml 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/jquery.xml 2011-07-31 09:48:06 UTC (rev 15013) @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html xmlns:jquery="http://exist-db.org/xquery/jquery" xmlns:style="http://exist-db.org/xquery/style"> - <head> - <title>eXist - jQuery/URL rewriting demo</title> - <jquery:header base="../scripts/jquery" cssbase="../scripts/jquery/css"/> - <style:default-styles/> - <style type="text/css"> - label { width: 120px; float: left; } - .source { margin-top: 1.5em; padding-top: 1em; border-top: 1px solid #CCC; } - .programlisting { font-size: 13px; } - </style> - <script type="text/javascript"> - function dialogAction(node) { node.dialog("close"); alert("OK clicked!"); } - function accordionCallback(node) { alert("Opening panel..."); } - </script> - </head> - <body> - <style:page-head base=".."> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../sidebar.xml"/> - </style:page-head> - <div id="content2col"> - <p>This document is a complex demonstration of how to expand a set of known, namespaced tags in an HTML file - by passing the source through an <a href="https://secure.wikimedia.org/wikibooks/en/wiki/XQuery/Typeswitch_Transformations">XQuery - typeswitch transformation</a>.</p> - <p>The demo extends the HTML page with a set of jQuery widgets. Instead of directly creating the widgets in Javascript, we use an XQuery - module which expands a set of known tags in the jquery namespace and generates the required HTML and Javascript code for each widget.</p> - - <jquery:tabset id="tabs"> - <jquery:tab id="tab-info" label="Tabs"> - <p>Tabs can be created easily with a <jquery:tabset> element. The tabs are contained in its - <jquery:tab> children. Tab sets can be nested:</p> -<jquery:tabset id="nested-tabs"> - <jquery:tab id="nested-tab1" label="Nested Tab 1"> - <p>Nested tab 1.</p> - </jquery:tab> - <jquery:tab id="nested-tab2" label="Nested Tab 2"> - <p>Nested tab 2.</p> - </jquery:tab> - <jquery:tab href="ajax.html" label="AJAX"/> -</jquery:tabset> - - <jquery:ajax-accordion class="source"> - <jquery:panel title="View Source"><jquery:source ref="nested-tabs"/></jquery:panel> - </jquery:ajax-accordion> - </jquery:tab> - <jquery:tab id="tab-repeats" label="Repeating Fields"> -<div id="repeat-example"> - <p>Repeat a given part of a form. An index will be added to the name of each form element, - so "query" becomes "query1", "query2", ...</p> - <jquery:form-repeat trigger="#add-field" delete="#remove-field" form="#advanced-search"/> - <form id="advanced-search" method="GET"> - <table> - <tr class="repeat"> - <td> - <jquery:select name="field"> - <jquery:option value="Author"/> - <jquery:option value="Title"/> - </jquery:select> - </td> - <td><jquery:input name="term"/></td> - </tr> - <tr> - <td colspan="2"> - <button class="button" id="add-field"> - <span>+</span> Add search field</button> - <button class="button" id="remove-field"> - <span>-</span> Remove selected search field</button> - </td> - </tr> - <tr> - <td colspan="2"> - <button type="submit">Search</button> - </td> - </tr> - </table> - </form> -</div> - <jquery:ajax-accordion class="source"> - <jquery:panel title="View Source"><jquery:source ref="repeat-example"/></jquery:panel> - </jquery:ajax-accordion> - </jquery:tab> - <jquery:tab id="tab-accordion" label="Accordions"> -<jquery:ajax-accordion id="accordion-example"> - <jquery:panel title="Default"> - <p>An accordion consists of one or more panels, whose content can be either contained - within the <jquery:panel> element itself or loaded from an AJAX source specified - in the href attribute.</p> - </jquery:panel> - <jquery:panel title="Second panel"> - <p>Second panel.</p> - </jquery:panel> - <jquery:panel title="Callback function" on-select="accordionCallback"> - <p>Callback.</p> - </jquery:panel> - <jquery:panel title="AJAX panel" href="ajax.html"/> -</jquery:ajax-accordion> - - <jquery:ajax-accordion class="source"> - <jquery:panel title="View Source"><jquery:source ref="accordion-example"/></jquery:panel> - </jquery:ajax-accordion> - </jquery:tab> - <jquery:tab id="tab-dialogs" label="Dialogs"> -<div id="dialog-example"> - <ul> - <li><a href="#" id="create-new">Simple Dialog</a></li> - <li><a href="#" id="action">Dialog with action</a></li> - </ul> - <jquery:dialog id="new-dialog" modal="true" title="New" trigger="#create-new" width="550"> - <jquery:button id="cancel" label="Cancel"/> - <p>The dialog may contain one or more <jquery:button> elements. The button with id="cancel" will automatically - be set up to abort the action and close the dialog.</p> - </jquery:dialog> - <jquery:dialog id="action-dialog" modal="true" title="New" trigger="#action" width="550"> - <jquery:button id="cancel" label="Cancel"/> - <jquery:button label="OK" function="dialogAction"/> - <p>Clicking on the OK button calls the Javascript function "dialogAction".</p> - </jquery:dialog> -</div> - <jquery:ajax-accordion class="source"> - <jquery:panel title="Source"><jquery:source ref="dialog-example"/></jquery:panel> - </jquery:ajax-accordion> - </jquery:tab> - </jquery:tabset> - </div> - </body> -</html> \ No newline at end of file Modified: stable/eXist-1.4.x/webapp/urlrewrite/login.xml =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/login.xml 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/login.xml 2011-07-31 09:48:06 UTC (rev 15013) @@ -21,8 +21,8 @@ <input type="text" name="user"/> </div> <div> - <label for="passord">Password:</label> - <input type="password" name="passord"/> + <label for="password">Password:</label> + <input type="password" name="password"/> </div> <div> <input type="submit" value="Login"/> @@ -30,4 +30,4 @@ </form> </div> </body> -</html> \ No newline at end of file +</html> Deleted: stable/eXist-1.4.x/webapp/urlrewrite/style-jquery.xql =================================================================== --- stable/eXist-1.4.x/webapp/urlrewrite/style-jquery.xql 2011-07-31 09:47:04 UTC (rev 15012) +++ stable/eXist-1.4.x/webapp/urlrewrite/style-jquery.xql 2011-07-31 09:48:06 UTC (rev 15013) @@ -1,11 +0,0 @@ -xquery version "1.0"; - -import module namespace jquery="http://exist-db.org/xquery/jquery" at "resource:org/exist/xquery/lib/jquery.xql"; - -(: declare option exist:serialize "method=xhtml media-type=application/xhtml+xml omit-xml-declaration=no enforce-xhtml=yes"; :) -declare option exist:serialize "method=xhtml"; - -(: We receive an HTML template as input :) -let $input := request:get-data() -return - jquery:process($input) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |