Navigation Menu

Skip to content

Commit

Permalink
wire in explicit namespace registration form:
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Jun 20, 2013
1 parent d10e99f commit 42edddb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
4 changes: 1 addition & 3 deletions fcrepo-http-api/src/main/resources/views/common-header.vsl
@@ -1,6 +1,5 @@
#* @vtlvariable name="uriInfo" type="javax.ws.rs.core.UriInfo" *#

<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
Expand All @@ -17,5 +16,4 @@
</form>
</div>
</div>
</div>
</div>
</div>
16 changes: 16 additions & 0 deletions fcrepo-http-api/src/main/resources/views/common.js
Expand Up @@ -72,10 +72,26 @@ $(function() {

$('#action_create').submit(addChild);
$('#action_sparql_update').submit(sendSparqlUpdate);
$('#action_register_namespace').submit(registerNamespace);
$('#action_delete').submit(deleteItem);

});


function registerNamespace() {
var postURI = $('#main').attr('resource');


var query = "INSERT { <" + $('#namespace_uri').val() + "> <info:fedora/fedora-system:def/internal#hasNamespace> \"" + $('#namespace_prefix').val() + "\"} WHERE {}";


$.ajax({url: postURI, type: "POST", contentType: "application/sparql-update", data: query, success: function(data, textStatus, request) {
window.location.reload(true);
}});

return false;
}

function sendSparqlUpdate() {
var postURI = $('#main').attr('resource');

Expand Down
26 changes: 24 additions & 2 deletions fcrepo-http-api/src/main/resources/views/jcr-namespaces.vsl
Expand Up @@ -9,17 +9,39 @@
#parse("views/common-head.vsl")
</head>
<body>
<div class="container"">
<div id="main" class="container" resource="$uriInfo.baseUriBuilder.build()fcr:namespaces">
#parse("views/common-header.vsl")

<h1>Registered Namespaces</h1>
<div class="row">
<div class="span9">
<h1>Namespaces</h1>

## output other nodes
#foreach($subject in $subjects)
<div class="well" resource="$subject.getURI()">
<h3>$subject.getURI()</h3>
#triples($subject.asNode())
</div>
#end
</div>

<div class="span3">
<form id="action_register_namespace">
<h3>Register Namespace</h3>
<label>
Prefix
<input type="text" name="prefix" id="namespace_prefix"/>
</label>


<label>
URI
<input type="text" name="uri" id="namespace_uri"/>
</label>

<button type="submit" class="btn btn-primary">Create</button>
</form>
</div>
</div>
</body>
</html>

0 comments on commit 42edddb

Please sign in to comment.