Skip to content

Commit

Permalink
addin new suggestor, fixing some bugs2
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugen Mayer committed Oct 17, 2010
1 parent 7b7b338 commit 3468e04
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
18 changes: 18 additions & 0 deletions alchemy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- tagging_alchemy_suggest.module 2010-07-14 13:38:49.000000000 +0000
+++ change/tagging_alchemy_suggest.module 2010-10-04 17:59:27.000000000 +0000
@@ -13,6 +13,8 @@
}

$postContent = $node->body;
+ if( null == $postContent )
+ return;
$entityResult = $alchemyObj->HTMLGetRankedNamedEntities($postContent, "http://www.alchemyapi.com/tools/alchemytagger/?type=post");

$keywordParams = new AlchemyAPI_KeywordParams();
@@ -89,4 +91,4 @@
}
}
return $returnKeywordsArr;
-}
\ No newline at end of file
+}
21 changes: 21 additions & 0 deletions tagging.module
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ function tagging_form_alter(&$form, $form_state, $form_id) {
}
}
}

// Check if user_terms is present
if (isset($form['user_terms'])) {
// Iterate all the available vocabularies
foreach ($form['user_terms'] as $key => $value) {
// Only act on form items containing vocabularies
if (strstr($key, 'user_terms_')) {
// Extract the vid
$id = str_replace('user_terms_', '', $key);
// Make sure it's numeric
if (is_numeric($id)) {
// Check if the tagging widget is enabled for this
if (variable_get('tagging_inject_' . $id, 0)) {
$form['user_terms'][$key]['#type'] = 'tagging_widget';
$form['user_terms'][$key]['#vid'] = $id;
$form['user_terms'][$key]['#uid'] = $form['#uid'];
}
}
}
}
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tagging.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
var tag = $.trim(tag.toLowerCase());
var found = false;
$(wrapper_sel+' '+tag_sel).each(function() {
if($(this).text().toLowerCase().trim() == tag) {
if($.trim($(this).text().toLowerCase()) == tag) {
found = true;
return;
}
Expand Down

0 comments on commit 3468e04

Please sign in to comment.