From 0f41129f7ea2f47b8bb2d08f13f49aa2a16b631f Mon Sep 17 00:00:00 2001 From: Matthias Ansorg Date: Sat, 24 Jan 2015 04:11:48 +0100 Subject: [PATCH] remove the annotation.uri DB column; fixes #13 --- drupal_annotation/annotation.controller.inc | 2 +- drupal_annotation/annotation.install | 7 ------- drupal_annotation/annotation.store.inc | 6 +----- drupal_annotator/js/annotator_drupalnode.js | 12 +++++++----- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drupal_annotation/annotation.controller.inc b/drupal_annotation/annotation.controller.inc index 897f310..fb89b60 100644 --- a/drupal_annotation/annotation.controller.inc +++ b/drupal_annotation/annotation.controller.inc @@ -44,7 +44,7 @@ class AnnotationAPIController extends EntityAPIController { ), '#formatter' => 'text_default', 0 => array( - '#markup' => '
' . check_plain($entity->quote) . '
' + '#markup' => '
nid}") . '">' . check_plain($entity->quote) . '
' ) ); $content['text'] = array( diff --git a/drupal_annotation/annotation.install b/drupal_annotation/annotation.install index 952f97a..6f1afa0 100644 --- a/drupal_annotation/annotation.install +++ b/drupal_annotation/annotation.install @@ -51,13 +51,6 @@ function annotation_schema() { 'size' => 'big', 'not null' => TRUE, ), - 'uri' => array( - 'description' => 'Type uri of this annotation.', - 'type' => 'varchar', - 'length' => 2048, // Maximum URLs length. - 'not null' => FALSE, // Locations can alternatively be identified by entity ID. - 'sortable' => TRUE - ), 'ranges' => array( 'description' => 'The ranges of the annotation.', 'type' => 'blob', diff --git a/drupal_annotation/annotation.store.inc b/drupal_annotation/annotation.store.inc index 235f69b..43e8f1c 100644 --- a/drupal_annotation/annotation.store.inc +++ b/drupal_annotation/annotation.store.inc @@ -168,7 +168,6 @@ function annotation_api_search() { $updated = isset($_GET['updated']) ? $_GET['updated'] : NULL; $text = isset($_GET['text']) ? $_GET['text'] : NULL; $quote = isset($_GET['quote']) ? $_GET['quote'] : NULL; - $uri = isset($_GET['uri']) ? $_GET['uri'] : NULL; $nid = isset($_GET['nid']) ? $_GET['nid'] : NULL; // Initiate query @@ -177,7 +176,7 @@ function annotation_api_search() { // Add conditions to query if ($id) { - $query->propertyCondition('uri', $id); + $query->propertyCondition('id', $id); } if ($uid) { // Use uid instead of user @@ -195,9 +194,6 @@ function annotation_api_search() { if ($quote) { $query->propertyCondition('quote', $quote, 'LIKE'); } - if ($uri) { - $query->propertyCondition('uri', $uri); - } if ($nid) { $query->propertyCondition('nid', $nid); } diff --git a/drupal_annotator/js/annotator_drupalnode.js b/drupal_annotator/js/annotator_drupalnode.js index e31bda1..0f98f49 100644 --- a/drupal_annotator/js/annotator_drupalnode.js +++ b/drupal_annotator/js/annotator_drupalnode.js @@ -14,11 +14,13 @@ Annotator.Plugin.DrupalNode = (function(_super) { if (!Annotator.supported()) { return; } - this.annotator.subscribe('annotationEditorSubmit', function(editor, annotation){ - nid = editor.element.parents('.node').attr('id').split('-').slice(-1).pop(); - annotation.uri = window.location.origin + '/node/' + nid; - annotation.nid = nid; - }); + + this.annotator.subscribe( + 'annotationEditorSubmit', + function(editor, annotation) { + annotation.nid = editor.element.parents('.node').attr('id').split('-').slice(-1).pop(); + } + ); this.annotator.subscribe('annotationsLoaded', function(annotations){ jQuery('.annotator-hl').each(function(){