diff --git a/deepamehta-topicmaps/src/main/java/de/deepamehta/plugins/topicmaps/TopicmapsPlugin.java b/deepamehta-topicmaps/src/main/java/de/deepamehta/plugins/topicmaps/TopicmapsPlugin.java index c77bcbce7..51c0632b8 100644 --- a/deepamehta-topicmaps/src/main/java/de/deepamehta/plugins/topicmaps/TopicmapsPlugin.java +++ b/deepamehta-topicmaps/src/main/java/de/deepamehta/plugins/topicmaps/TopicmapsPlugin.java @@ -4,7 +4,6 @@ import de.deepamehta.plugins.topicmaps.service.TopicmapsService; import de.deepamehta.core.Association; -import de.deepamehta.core.Topic; import de.deepamehta.core.model.AssociationModel; import de.deepamehta.core.model.AssociationRoleModel; import de.deepamehta.core.model.CompositeValue; @@ -16,13 +15,12 @@ import javax.ws.rs.POST; import javax.ws.rs.DELETE; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.Consumes; -import javax.ws.rs.CookieParam; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,45 +41,6 @@ public class TopicmapsPlugin extends Plugin implements TopicmapsService { - // ************************************************** - // *** Core Hooks (called from DeepaMehta 4 Core) *** - // ************************************************** - - - - /* ### @Override - public void postDeleteRelationHook(long relationId) { - // remove the relation from all topicmaps - List refTopics = dms.getTopics("de/deepamehta/core/property/RelationID", relationId); - logger.info("### Removing relation " + relationId + " from " + refTopics.size() + " topicmaps"); - for (Topic refTopic : refTopics) { - removeAssociationFromTopicmap(refTopic.id); - } - } */ - - // --- - - /* ### @Override - public void providePropertiesHook(Topic topic) { - if (topic.typeUri.equals("de/deepamehta/core/topictype/TopicmapRelationRef")) { - PropValue relation_id = dms.getTopicProperty(topic.id, "de/deepamehta/core/property/RelationID"); - topic.setProperty("de/deepamehta/core/property/RelationID", relation_id); - } - } */ - - /* ### @Override - public void providePropertiesHook(Relation relation) { - if (relation.typeId.equals("TOPICMAP_TOPIC")) { - // transfer all relation properties - Properties properties = dms.getRelation(relation.id).getProperties(); - for (String key : properties.keySet()) { - relation.setProperty(key, properties.get(key)); - } - } - } */ - - - // ********************** // *** Plugin Service *** // ********************** @@ -131,6 +90,26 @@ public void removeAssociationFromTopicmap(@PathParam("id") long topicmapId, removeAssociationFromTopicmap(refId); } + // --- + + // Note: not part of topicmaps service + @GET + @Path("/{id}") + @Produces("text/html") + public InputStream getTopicmapInWebclient() { + // Note: the template parameter is evaluated at client-side + return invokeWebclient(); + } + + // Note: not part of topicmaps service + @GET + @Path("/{id}/topic/{topic_id}") + @Produces("text/html") + public InputStream getTopicmapAndTopicInWebclient() { + // Note: the template parameters are evaluated at client-side + return invokeWebclient(); + } + // ------------------------------------------------------------------------------------------------- Private Methods @@ -141,4 +120,14 @@ public void removeAssociationFromTopicmap(@PathParam("id") long topicmapId, private void removeAssociationFromTopicmap(long refId) { dms.deleteAssociation(refId, null); // clientContext=null } + + // --- + + private InputStream invokeWebclient() { + try { + return dms.getPlugin("de.deepamehta.webclient").getResourceAsStream("web/index.html"); + } catch (Exception e) { + throw new WebApplicationException(e); + } + } } diff --git a/deepamehta-topicmaps/src/main/resources/web/script/topicmaps_plugin.js b/deepamehta-topicmaps/src/main/resources/web/script/topicmaps_plugin.js index f875cc6be..88c0e7560 100644 --- a/deepamehta-topicmaps/src/main/resources/web/script/topicmaps_plugin.js +++ b/deepamehta-topicmaps/src/main/resources/web/script/topicmaps_plugin.js @@ -79,16 +79,24 @@ function topicmaps_plugin() { } function select_initial_topicmap() { - if (location.search.match(/topicmap=(\d+)/)) { - var topicmap_id = RegExp.$1 + var groups = location.pathname.match(/\/topicmap\/(\d+)(\/topic\/(\d+))?/) + if (groups) { + var topicmap_id = groups[1] + var topic_id = groups[3] + var no_history_update = false // ### FIXME: rethink about history select_menu_item(topicmap_id) } else { var topicmap_id = get_topicmap_id_from_menu() + var no_history_update = false // ### FIXME: rethink about history } // update model select_topicmap(topicmap_id) // update view - display_topicmap() + display_topicmap(no_history_update) + // + if (topic_id) { + dm4c.do_select_topic(topic_id, no_history_update) + } } } diff --git a/deepamehta-webclient/src/main/resources/web/index.html b/deepamehta-webclient/src/main/resources/web/index.html index 5f88b4265..74f348009 100644 --- a/deepamehta-webclient/src/main/resources/web/index.html +++ b/deepamehta-webclient/src/main/resources/web/index.html @@ -3,31 +3,31 @@ DeepaMehta ${project.version} - - - + + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/deepamehta-webclient/src/main/resources/web/script/field_renderers/html_field_renderer.js b/deepamehta-webclient/src/main/resources/web/script/field_renderers/html_field_renderer.js index cc93973cf..2b668531f 100644 --- a/deepamehta-webclient/src/main/resources/web/script/field_renderers/html_field_renderer.js +++ b/deepamehta-webclient/src/main/resources/web/script/field_renderers/html_field_renderer.js @@ -2,7 +2,7 @@ function HTMLFieldRenderer(topic, field, rel_topics) { tinymce_options = { theme: "advanced", - content_css: "style/tinymce.css", + content_css: "/style/tinymce.css", plugins: "autoresize", width: "98%", extended_valid_elements: "iframe[align