changeset 93:3d1a00418b42 admin_ui_rel_links

starting web admin ui with relative links. doesn't fully work yet.
author casties
date Mon, 09 Feb 2015 12:55:51 +0100
parents aadf8760216d
children
files src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsResource.java src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java src/main/webapp/index.html
diffstat 4 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java	Mon Feb 09 12:50:47 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java	Mon Feb 09 12:55:51 2015 +0100
@@ -122,7 +122,7 @@
         } else {
             // output person content
             result = "<html><body>\n<h1>Annotation</h1>\n";
-            result += String.format("<p><a href=\"%s\">All annotations</a></p>", this.getReference().getParentRef());
+            result += "<p><a href=\"./\">All annotations</a></p>";
             result += "<table>";
             result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", annotation.getUri());
             result += String.format("<tr><td><b>text</b></td><td>%s</td></tr>\n", annotation.getBodyText());
@@ -141,9 +141,7 @@
             result += "</table>\n";
             //result += "<p><a href=\"?form=edit\">Edit annotation</a></p>\n";
             // tunnel POST as DELETE
-            result += String.format(
-                    "<form method=\"post\" action=\"%s?method=DELETE\"><input type=\"submit\" value=\"Delete annotation\"/></form>\n",
-                    this.getReference().getHierarchicalPart());
+            result += "<form method=\"post\" action=\"?method=DELETE\"><input type=\"submit\" value=\"Delete annotation\"/></form>\n";
             result += "</body>\n</html>";
         }
         return new StringRepresentation(result, MediaType.TEXT_HTML);
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsResource.java	Mon Feb 09 12:50:47 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsResource.java	Mon Feb 09 12:55:51 2015 +0100
@@ -75,8 +75,7 @@
         result += "<tr><th>uri</th><th>text</th><th>target</th><th>fragment</th><th>creator</th></tr>";
         List<Annotation> annotations = store.getAnnotations("id", "*");
         for (Annotation annotation : annotations) {
-            Reference url = this.getReference().clone();
-            url.addSegment(annotation.getUrlId());
+            String url = annotation.getUrlId();
             result += String.format("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", url,
                     annotation.getUri(), annotation.getBodyText(), annotation.getTargetBaseUri(), annotation.getTargetFragment(),
                     annotation.getCreatorName());
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java	Mon Feb 09 12:50:47 2015 +0100
+++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java	Mon Feb 09 12:55:51 2015 +0100
@@ -1,6 +1,3 @@
-/**
- * 
- */
 package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
 
 /*
@@ -41,7 +38,7 @@
  */
 public class AnnotationsUiRestlet extends BaseRestlet {
 
-    public final String version = "AnnotationManagerN4J/AnnotationsUI 0.3";
+    public final String version = "AnnotationManagerN4J/AnnotationsUI 0.4";
 
     public static Logger logger = Logger.getLogger("de.mpiwg.itgroup.annotations.restlet.annotations_ui.AnnotationsUiRestlet");
 
@@ -83,7 +80,7 @@
             logger.severe("Admin user and password missing in serverconfig!");
         }
         // Create a Guard
-        ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial");
+        ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Annotation Server");
         guard.setVerifier(verifier);
         // put everything through guard
         guard.setNext(router);
--- a/src/main/webapp/index.html	Mon Feb 09 12:50:47 2015 +0100
+++ b/src/main/webapp/index.html	Mon Feb 09 12:55:51 2015 +0100
@@ -24,9 +24,9 @@
 -->
   <h2>Admin</h2>
   <ul>
-    <li><a href="annotations/groups">View and edit groups</a></li>
-    <li><a href="annotations/persons">View and edit persons</a></li>
-    <li><a href="annotations/annotations">View and edit annotations</a></li>
+    <li><a href="annotations/groups/">View and edit groups</a></li>
+    <li><a href="annotations/persons/">View and edit persons</a></li>
+    <li><a href="annotations/annotations/">View and edit annotations</a></li>
   </ul>
 </body>
 </html>