Skip to content

Commit

Permalink
More Spring XML cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Nov 22, 2013
1 parent a8f930f commit 23ec317
Show file tree
Hide file tree
Showing 30 changed files with 1,249 additions and 68 deletions.
19 changes: 19 additions & 0 deletions fcrepo-http-api/src/main/resources/META-INF/spring/rest.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<bean class="org.fcrepo.http.commons.session.SessionFactory" />

<!-- Mints PIDs-->
<bean class="org.fcrepo.kernel.identifiers.UUIDPidMinter"/>

<context:annotation-config />

<context:component-scan base-package="org.modeshape.web.jcr.rest, org.fcrepo.http"/>

</beans>

20 changes: 20 additions & 0 deletions fcrepo-http-api/src/main/resources/logback.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%p %d{HH:mm:ss.SSS} \(%c{0}\) %m%n</pattern>
</encoder>
</appender>


<logger name="org.fcrepo.http.api" additivity="false" level="DEBUG">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="org.fcrepo" additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</logger>
<root additivity="false" level="WARN">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
4 changes: 4 additions & 0 deletions fcrepo-http-api/src/main/resources/velocity.properties
@@ -0,0 +1,4 @@
resource.loader = class
class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
class.resource.loader.description = Load resources from the CLASSPATH
runtime.references.strict = true
13 changes: 13 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common-breadcrumb.vsl
@@ -0,0 +1,13 @@

#set( $breadcrumbs = $helpers.getNodeBreadcrumbs($uriInfo, $topic))

<ul class="breadcrumb">
<li><a href="$uriInfo.getBaseUri()">Home</a></li>
#foreach($entry in $breadcrumbs.entrySet())
#if ($entry.getKey() == $uriInfo.getAbsolutePath().toString())
<li class="active">$entry.getValue()</li>
#else
<li ><a href="$entry.getKey()">$entry.getValue()</a></li>
#end
#end
</ul>
10 changes: 10 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common-head.vsl
@@ -0,0 +1,10 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript">
#include("views/common.js")
</script>
<style type="text/css">
#include("views/common.css")
</style>
48 changes: 48 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common-header.vsl
@@ -0,0 +1,48 @@
#* @vtlvariable name="uriInfo" type="javax.ws.rs.core.UriInfo" *#

<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="$uriInfo.baseUriBuilder.build()">Fedora 4</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="$uriInfo.baseUriBuilder.build()">Home</a></li>
<li><a href="$uriInfo.baseUriBuilder.build()fcr:namespaces">Namespaces</a></li>
<li><a href="$uriInfo.baseUriBuilder.build()fcr:workspaces">Workspaces</a></li>
<li><a href="$uriInfo.baseUriBuilder.build()fcr:nodetypes">Types</a></li>
</ul>
<form class="navbar-form navbar-left" role="search" method="GET" action="$uriInfo.baseUriBuilder.build()fcr:search">
<div class="form-group">
<input class="form-control" type="text" name="q" placeholder="Search"/>
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
</div>
</nav>


<!-- Modal -->
<div class="modal fade" id="errorModal" tabindex="-1" role="dialog" aria-labelledby="errorLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="errorLabel"></h4>
</div>
<div class="modal-body">
<div id="errorText"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
19 changes: 19 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common-metadata.vsl
@@ -0,0 +1,19 @@
<dl>
<dt>UUID</dt> <dd>$esc.html($helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.HAS_PRIMARY_IDENTIFIER, true))</dd>

<dt>Created at</dt> <dd>$helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.CREATED_DATE, true)
by $esc.html($helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.CREATED_BY, true))</dd>

<dt>Last Modified at</dt> <dd>$helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.LAST_MODIFIED_DATE, true)
by $esc.html($helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.LAST_MODIFIED_BY, true))</dd>

<dt>Children <span class="badge">$helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.HAS_CHILD_COUNT, true)</span></dt>
<dd>
<ol>
#foreach($quad in $helpers.getObjects($rdf, $topic, $rdfLexicon.HAS_CHILD))
<li><a href="$quad.getObject().getURI()">$esc.html($helpers.getObjectTitle($rdf, $quad.getObject()))</a></li>
#end
</ol>
</dd>

</dl>
140 changes: 140 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common-node-actions.vsl
@@ -0,0 +1,140 @@
#set ($content = $helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.HAS_CONTENT, false))

#if ($content != "")
<a href="$content" class="btn btn-success btn-lg"><span class="glyphicon glyphicon-download"></span> Download Content</a>

<h3>Update Content</h3>
<form action="javascript:updateFile()">
<div class="form-group">
<label for="update_file" class="control-label">File</label>
<input type="file" id="update_file"/>
</div>
<input type="submit" class="btn btn-primary" value="Update">
</form>
<hr />
#end

<form id="action_create" name="action_create" method="POST" enctype="multipart/form-data">
<h3>Create New Node</h3>
<div class="form-group">
<label for="new_mixin" class="control-label">
Type
</label>
<select id="new_mixin" name="mixin" class="form-control">
<option value="fedora:object">object</option>
<option value="fedora:datastream">datastream</option>
</select>
</div>

<div class="form-group">
<label for="new_id" class="control-label">
Identifier
</label>
<input type="text" id="new_id" name="slug" placeholder="(auto-generated identifier)" class="form-control"/>
</div>


<div id="datastream_payload_container" class="form-group">
<label for="datastream_payload" class="control-label">
File
</label>
<input type="file" name="file" id="datastream_payload"/>
</div>
<button type="submit" class="btn btn-primary">Add</button>
<hr />
</form>


<form id="action_sparql_update" method="POST">
<input type="hidden" name="_method" value="PATCH" />
<h3>Update Properties</h3>
<div class="form-group">
<textarea rows="10" id="sparql_update_query" name="query" class="form-control">
$helpers.getPrefixPreamble($model)
DELETE { }
INSERT { }
WHERE { }
</textarea>
</div>
<button type="submit" class="btn btn-primary">Update</button>
<hr />
</form>


<form id="action_delete" name="action_delete" action="javascript:deleteItem()" method="POST">
<input type="hidden" name="_method" value="DELETE" />
<h3>Delete Object</h3>
<button name="delete-button" type="submit" class="btn btn-danger">Delete</button>
<hr />
</form>


#set ($serializations = $rdf.find($nodeany, $topic, $helpers.asNode($rdfLexicon.HAS_SERIALIZATION), $nodeany))

#if($serializations.hasNext())
<div class="btn-group">
<div class="dropdown">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">
Export as...
<span class="caret"></span>
</a>

<ul class="dropdown-menu">
#foreach($quad in $helpers.getSortedTriples($model, $serializations))
<li><a href="$quad.getObject().getURI()">$helpers.getObjectTitle($rdf, $quad.getObject())</a></li>
#end
</ul>
</div>
</div>
<hr />
#end


#set ($serializations = $rdf.find($nodeany, $topic, $helpers.asNode($rdfLexicon.HAS_SERIALIZATION), $nodeany))

#if($serializations.hasNext())
<form id="action_import" action="fcr:import" method="POST">
<h3>Import</h3>


<div class="form-group">
<input type="file" id="import_file"/>
</div>

<div class="form-group">
<label class="control-label">Format</label>
<select id="import_format" name="format" class="form-control">
#foreach($quad in $helpers.getSortedTriples($model, $serializations))
<option>$helpers.getObjectTitle($rdf, $quad.getObject())</option>
#end
</select>
</div>
<button type="submit" class="btn">Import</button>
<hr />
</form>

#end

<h3>Transactions</h3>
#if($uriInfo.getAbsolutePath().toString().contains("/tx:"))

#set ($absPath = $uriInfo.absolutePathBuilder.build().toString())

#set ($txNodePath = $absPath.indexOf("/", $helpers.addOne($absPath.indexOf("/tx:"))))
#if ($txNodePath != -1)
#set ($txPath = $absPath.substring(0, $txNodePath))
#else
#set ($txPath = $uriInfo.getAbsolutePath().toString())
#end
<form id="action_commit_transaction" data-redirect-after-submit="$uriInfo.baseUriBuilder.build()" action="$txPath/fcr:tx/fcr:commit" method="POST">
<button type="submit" class="btn btn-primary">Commit</button>
</form>

<form id="action_rollback_transaction" data-redirect-after-submit="$uriInfo.baseUriBuilder.build()" action="$txPath/fcr:tx/fcr:rollback" method="POST">
<button type="submit" class="btn btn-danger">Rollback</button>
</form>
#else
<form id="action_create_transaction" action="$uriInfo.baseUriBuilder.build()fcr:tx" method="POST">
<button type="submit" class="btn btn-primary">Start Transaction</button>
</form>
#end
@@ -0,0 +1,8 @@

#parse("views/common-header.vsl")

<div class="row">
<div class="col-md-9">
<h1>$esc.html($helpers.getObjectTitle($rdf, $topic))</h1>
</div>
</div>
59 changes: 59 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common.css
@@ -0,0 +1,59 @@
.mode_root #action_delete {
display: none;
}

body {
padding-bottom: 40px;
}

.nt_file #action_create, .nt_resource #action_create {
display: none;
}

.nt_file #action_import, .nt_resource #action_import {
display: none;
}

dl {
padding-left: 19px;
}

dd {
padding-left: 38px;
}

.well dl {
padding-left: 0;
}

.well {
text-indent: -35px;
padding-left: 54px;
}

#metadata .panel-body {
word-wrap: break-word;
text-indent: -35px;
padding-left: 35px;
}

#datastream_payload_container {
display: none;
}

#actions.visible-lg.in, #actions.visible-lg.collapsing, #actions.visible-md.in, #actions.visible-md.collapsing {
display: block !important;
}

#toggle-actions {
float:right;
margin-bottom: 1em;
}

#actions {
margin-bottom: 3em;
}

.namespace {
font-size: .8em;
}

0 comments on commit 23ec317

Please sign in to comment.