| 1 |
<? |
<? |
| 2 |
// $Id$ |
// $Id: moat.module,v 1.6 2008/01/24 10:09:00 terraces Exp $ |
| 3 |
|
|
| 4 |
// MOAT plugin for Drupal |
// MOAT plugin for Drupal |
| 5 |
// Check http://moat-project.org for more details about MOAT |
// Check http://moat-project.org for more details about MOAT |
| 86 |
$output .= t("<p>Define the meaning of your tag(s) in the current context</p>"); |
$output .= t("<p>Define the meaning of your tag(s) in the current context</p>"); |
| 87 |
$tags = taxonomy_node_get_terms($node->nid); |
$tags = taxonomy_node_get_terms($node->nid); |
| 88 |
if($tags) { |
if($tags) { |
| 89 |
|
drupal_set_html_head('<link href="http://sindice.com/adam/themes/sindice_widget.css" rel="stylesheet" type="text/css"/>'); |
| 90 |
|
// Temporary hack to make sindice widget work with multiple textfields in the same page |
| 91 |
|
drupal_set_html_head('<script id="sindiceSearchWidget" type="text/javascript" src="http://apassant.net/tmp/sindice_widget.js"></script>'); |
| 92 |
|
// Sindice wrapper for multiple textfields |
| 93 |
|
$script = " |
| 94 |
|
<script type='text/javascript'> |
| 95 |
|
function sindice_search_wrapper(id, keyword) { |
| 96 |
|
sindice_id = 'sindiceSearchResult'; |
| 97 |
|
cur = document.getElementById(sindice_id); |
| 98 |
|
defaultKeyword = keyword; |
| 99 |
|
if(cur) { |
| 100 |
|
cur.id = cur.sindice; |
| 101 |
|
cur.sindice = null; |
| 102 |
|
} |
| 103 |
|
doc = document.getElementById(id); |
| 104 |
|
doc.sindice = id; |
| 105 |
|
doc.id = 'sindiceSearchResult'; |
| 106 |
|
sindiceSearchWindow(); |
| 107 |
|
} |
| 108 |
|
</script> |
| 109 |
|
"; |
| 110 |
|
drupal_set_html_head($script); |
| 111 |
$output .= drupal_get_form('moat_form', $tags, $node->nid); |
$output .= drupal_get_form('moat_form', $tags, $node->nid); |
| 112 |
} else { |
} else { |
| 113 |
$output .= t("No tag for this node"); |
$output .= t("No tag for this node"); |
| 142 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 143 |
'#title' => $tag, |
'#title' => $tag, |
| 144 |
'#tree' => true, |
'#tree' => true, |
|
'#collapsible' => true, |
|
|
'#collapsed' => true, |
|
| 145 |
); |
); |
| 146 |
$concepts = moat_get_meanings($term->name); |
$concepts = moat_get_meanings($term->name); |
| 147 |
if($concepts) { |
if($concepts) { |
| 155 |
); |
); |
| 156 |
} |
} |
| 157 |
} |
} |
| 158 |
|
$id = "edit-tags-$tagid-textfield"; |
| 159 |
$form['tags'][$tagid]['textfield'] = array( |
$form['tags'][$tagid]['textfield'] = array( |
| 160 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 161 |
'#title' => 'New URI', |
'#title' => 'New URI ?', |
| 162 |
|
'#description' => '<a href="#" onclick="javascript:sindice_search_wrapper(\''.$id.'\', \''.$tag.'\');">Click there to find relevant URIs from Sindice</a>', |
| 163 |
); |
); |
| 164 |
} |
} |
| 165 |
$form['submit'] = array('#type' => 'submit', '#value' => t('OK')); |
$form['submit'] = array('#type' => 'submit', '#value' => t('OK')); |