You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/02/19 13:52:02 UTC

[1/52] [partial] code contribution, initial import of relevant modules of LMF-3.0.0-SNAPSHOT based on revision 4bf944319368 of the default branch at https://code.google.com/p/lmf/

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c32963d5/lmf-core/src/main/resources/web/admin/prefixes.html
----------------------------------------------------------------------
diff --git a/lmf-core/src/main/resources/web/admin/prefixes.html b/lmf-core/src/main/resources/web/admin/prefixes.html
new file mode 100644
index 0000000..11eac4c
--- /dev/null
+++ b/lmf-core/src/main/resources/web/admin/prefixes.html
@@ -0,0 +1,99 @@
+<!--
+
+    Copyright (C) 2013 Salzburg Research.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<html>
+<head>
+<!--###BEGIN_HEAD###-->
+    <title>Prefix mappings management</title>
+<!--###END_HEAD###-->
+</head>
+<body>
+<div id="main">
+<div id="contents">
+<!--###BEGIN_CONTENT###-->
+    <h1>Prefixes</h1>
+    <h2>Management</h2>
+    <p>
+        Here you can configure the prefix mappings for the RDF namespaces used in LMF:
+    </p>
+    <table id="prefixes" class="simple_table">
+      <tr>
+        <th>Prefix</th>
+        <th>Namespace</th>
+      </tr>
+    </table>
+    
+    <h2 style="margin-top: 5em:">New prefix</h2>
+    <table id="add-new-prefix" style="margin: 2em auto 0 auto; background-color:#eeeeee; padding:20px; border:1px solid gray;-webkit-border-radius: 3px; border-radius: 3px;">
+      <tr>
+        <td>Prefix:</td>        
+        <td><input type="text" size="10" name="prefix" id="new-prefix" /></td>
+      </tr>
+      <tr>
+        <td>Namespace:</td>        
+        <td><input type="text" size="50" name="prefix" id="new-namespace" /></td>
+      </tr>      
+    </table>
+    <p style="width:100%; text-align:center; padding-top:10px; margin-bottom:30px;">
+      <input type="submit" id="add-new-prefix-button" value="Add new prefix" />
+    </p>
+    
+    <script type="text/javascript" src="/webjars/jquery/1.8.2/jquery.min.js"></script>
+    <script type="text/javascript">
+        jQuery(document).ready(function() {
+
+            function appendPrefix(prefix, namespace) {
+            	$("table#prefixes  > tbody:last").append("<tr><td>" + prefix + "</td><td><a href=\"" + namespace + "\">" + namespace + "</a></td></tr>");
+            }
+            
+            $.getJSON("../../prefix", function(data) {
+                $.each(data, function(prefix, namespace) {
+                	appendPrefix(prefix, namespace);
+                });
+            });
+
+            $("#add-new-prefix-button").click(function() {
+                var prefix = $("#new-prefix").val();
+                var namespace = $("#new-namespace").val();
+                var url = "../../prefix/" + prefix + "?uri=" + namespace;
+            	$.ajax({
+            		type: "POST",
+            		url: url,
+            		statusCode: {
+            		    201: function() {
+            		    	   appendPrefix($("#new-prefix").val(), $("#new-namespace").val());
+            		    	   $("#new-prefix").val("");
+	                           $("#new-namespace").val("");
+	                         },
+	                    406: function() {
+	                    	   alert("Invalid namespace URI!");
+	                         },
+	                    409: function() {
+	                    	   alert("Invalid prefix mapping!");
+	                    	 } 		       
+            		},
+            		dataType: "application/json"
+            	});
+            });
+            
+        });
+    </script>
+<!--###END_CONTENT###-->
+</div>
+</div>
+</body>
+</html>