-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1afe89b
commit 66a5071
Showing
97 changed files
with
16,886 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project basedir="." default="compress" name="sandbox"> | ||
|
||
<property name="src" value="./src"/> | ||
<property name="tools" value="./tools"/> | ||
<property name="build" value="./build"/> | ||
<property name="scripts" value="./resources/scripts"/> | ||
<property name="top.dir" value="../.."/> | ||
<property name="templates.dir" value="./templates"/> | ||
<property name="templates.default.dir" value="${templates.dir}/default"/> | ||
|
||
<property name="closure.compiler.url" | ||
value="http://closure-compiler.googlecode.com/files/compiler-latest.zip"/> | ||
|
||
<path id="classpath.core"> | ||
<fileset dir="${top.dir}/tools/ant/lib"> | ||
<include name="*.jar"/> | ||
</fileset> | ||
<pathelement path="${tools}/compiler.jar"/> | ||
<pathelement path="${java.class.path}"/> | ||
</path> | ||
|
||
<!-- | ||
existdb-contrib fetch task import used for downloading and extracting jar/class from zip | ||
--> | ||
<taskdef name="fetch" classname="nl.ow.dilemma.ant.fetch.FetchTask" | ||
classpathref="classpath.core"/> | ||
|
||
<target name="prepare"> | ||
<mkdir dir="${tools}"/> | ||
|
||
<fetch classpathref="classpath.core" dest="${tools}" url="${closure.compiler.url}" | ||
classname="com.google.javascript.jscomp.CommandLineRunner"/> | ||
<unzip dest="${tools}"> | ||
<fileset dir="${tools}"> | ||
<include name="*.zip"/> | ||
</fileset> | ||
</unzip> | ||
<delete file="${tools}/compiler-latest.zip"/> | ||
|
||
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" | ||
classpath="${tools}/compiler.jar"/> | ||
</target> | ||
|
||
<target name="compress" depends="prepare"> | ||
<jscomp compilationLevel="simple" debug="false" output="${scripts}/eXide-1.0.min.js"> | ||
<sources dir="${basedir}/src"> | ||
<file name="ace-modes.js"/> | ||
<file name="util.js"/> | ||
<file name="commands.js"/> | ||
<file name="mode-helper.js"/> | ||
<file name="xquery-helper.js"/> | ||
<file name="xml-helper.js"/> | ||
<file name="outline.js"/> | ||
<file name="editor.js"/> | ||
<file name="eXide.js"/> | ||
<file name="deployment.js"/> | ||
<file name="templates.js"/> | ||
<file name="resources.js"/> | ||
</sources> | ||
</jscomp> | ||
<jscomp compilationLevel="simple" debug="false" output="${scripts}/jquery/jquery.plugins.min.js"> | ||
<sources dir="${scripts}/jquery"> | ||
<file name="jquery.event.drag-2.0.js"/> | ||
<file name="jquery.layout-1.3.0.rc29.15.js"/> | ||
<file name="jquery.fileupload.js"/> | ||
<file name="jquery.fileupload-ui.js"/> | ||
<file name="slick.core.js"/> | ||
<file name="slick.rowselectionmodel.js"/> | ||
<file name="slick.grid.js"/> | ||
</sources> | ||
</jscomp> | ||
</target> | ||
|
||
<target name="templates"> | ||
<zip basedir="${templates.default.dir}" destfile="${templates.dir}/default-0.1.xar"/> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<collection xmlns="http://exist-db.org/collection-config/1.0"> | ||
<index xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mods="http://www.loc.gov/mods/v3"> | ||
<fulltext default="none" attributes="no"/> | ||
<lucene> | ||
</lucene> | ||
</index> | ||
</collection> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
xquery version "1.0"; | ||
|
||
(:~ | ||
Retrieve current user credentials from HTTP session | ||
:) | ||
declare function local:credentials-from-session() as xs:string* { | ||
(session:get-attribute("myapp.user"), session:get-attribute("myapp.password")) | ||
}; | ||
|
||
(:~ | ||
Store user credentials to session for future use. Return an XML | ||
fragment to pass user and password to the query. | ||
:) | ||
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}"/> | ||
}; | ||
|
||
(:~ | ||
Check if login parameters were passed in the request. If yes, try to authenticate | ||
the user and store credentials into the session. Clear the session if parameter | ||
"logout" is set. | ||
The function returns an XML fragment to be included into the dispatch XML or | ||
the empty set if the user could not be authenticated or the | ||
session is empty. | ||
:) | ||
declare function local:set-user() as element()* { | ||
session:create(), | ||
let $user := request:get-parameter("user", ()) | ||
let $password := request:get-parameter("password", ()) | ||
let $sessionCredentials := local:credentials-from-session() | ||
return | ||
if ($user) then | ||
let $loggedIn := xmldb:login("/db", $user, $password) | ||
return | ||
if ($loggedIn) then | ||
local:set-credentials($user, $password) | ||
else | ||
() | ||
else if (exists($sessionCredentials)) then | ||
local:set-credentials($sessionCredentials[1], $sessionCredentials[2]) | ||
else | ||
() | ||
}; | ||
|
||
declare function local:logout() as element() { | ||
session:invalidate(), | ||
<ok/> | ||
}; | ||
|
||
if ($exist:path eq '/') then | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<redirect url="index.html"/> | ||
</dispatch> | ||
|
||
(: | ||
: Login a user via AJAX. Just returns a 401 if login fails. | ||
:) | ||
else if ($exist:resource eq 'login') then | ||
let $loggedIn := local:set-user() | ||
return | ||
if ($loggedIn) then | ||
<ok/> | ||
else ( | ||
response:set-status-code(401), | ||
<fail/> | ||
) | ||
|
||
else if ($exist:resource eq "logout") then | ||
local:logout() | ||
|
||
else if ($exist:resource eq "index.html") then | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<view> | ||
<forward url="modules/view.xql"/> | ||
</view> | ||
</dispatch> | ||
|
||
else if ($exist:resource eq 'execute') then | ||
let $query := request:get-parameter("qu", ()) | ||
let $base := request:get-parameter("base", ()) | ||
let $startTime := util:system-time() | ||
return | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<!-- Query is executed by XQueryServlet --> | ||
<forward servlet="XQueryServlet"> | ||
{local:set-user()} | ||
<!-- Query is passed via the attribute 'xquery.source' --> | ||
<set-attribute name="xquery.source" value="{$query}"/> | ||
<!-- Results should be written into attribute 'results' --> | ||
<set-attribute name="xquery.attribute" value="results"/> | ||
<set-attribute name="xquery.module-load-path" value="{$base}"/> | ||
<clear-attribute name="results"/> | ||
<!-- Errors should be passed through instead of terminating the request --> | ||
<set-attribute name="xquery.report-errors" value="yes"/> | ||
</forward> | ||
<view> | ||
<!-- Post process the result: store it into the HTTP session | ||
and return the number of hits only. --> | ||
<forward url="session.xql"> | ||
<clear-attribute name="xquery.source"/> | ||
<clear-attribute name="xquery.attribute"/> | ||
<set-attribute name="elapsed" | ||
value="{string(seconds-from-duration(util:system-time() - $startTime))}"/> | ||
</forward> | ||
</view> | ||
</dispatch> | ||
|
||
(: Retrieve an item from the query results stored in the HTTP session. The | ||
: format of the URL will be /sandbox/results/X, where X is the number of the | ||
: item in the result set :) | ||
else if (starts-with($exist:path, '/results/')) then | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<forward url="../session.xql"> | ||
{local:set-user()} | ||
<add-parameter name="num" value="{$exist:resource}"/> | ||
</forward> | ||
</dispatch> | ||
|
||
else if ($exist:resource eq "outline") then | ||
let $query := request:get-parameter("qu", ()) | ||
let $base := request:get-parameter("base", ()) | ||
return | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<!-- Query is executed by XQueryServlet --> | ||
<forward url="modules/outline.xql"> | ||
{local:set-user()} | ||
<set-attribute name="xquery.module-load-path" value="{$base}"/> | ||
</forward> | ||
</dispatch> | ||
|
||
else if (ends-with($exist:path, ".xql")) then | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
{ local:set-user() } | ||
<set-attribute name="app-root" value="{$exist:prefix}{$exist:controller}"/> | ||
</dispatch> | ||
|
||
else if (starts-with($exist:path, "/libs/")) then | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<forward url="/{substring-after($exist:path, '/libs/')}" absolute="yes"/> | ||
</dispatch> | ||
else | ||
(: everything else is passed through :) | ||
<dispatch xmlns="http://exist.sourceforge.net/NS/exist"> | ||
<cache-control cache="yes"/> | ||
</dispatch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://expath.org/ns/pkg" name="http://exist-db.org/apps/eXide" abbrev="eXide" version="1.0" spec="1.0"> | ||
<title>eXide - XQuery IDE</title> | ||
</package> |
Oops, something went wrong.