Skip to content

Commit

Permalink
remove the annotation.uri DB column; fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
tanius committed Jan 24, 2015
1 parent 84a3b9d commit 0f41129
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion drupal_annotation/annotation.controller.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AnnotationAPIController extends EntityAPIController {
),
'#formatter' => 'text_default',
0 => array(
'#markup' => '<blockquote cite="' . check_plain($entity->uri) . '">' . check_plain($entity->quote) . '</blockquote>'
'#markup' => '<blockquote cite="' . url("node/{$entity->nid}") . '">' . check_plain($entity->quote) . '</blockquote>'
)
);
$content['text'] = array(
Expand Down
7 changes: 0 additions & 7 deletions drupal_annotation/annotation.install
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 1 addition & 5 deletions drupal_annotation/annotation.store.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
}
Expand Down
12 changes: 7 additions & 5 deletions drupal_annotator/js/annotator_drupalnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit 0f41129

Please sign in to comment.