uid"));
}
if ($uname) {
- $node->body = _delicious_tag_text($node->body, $uname);
- $node->teaser = _delicious_tag_text($node->teaser, $uname);
+ if ($node->content['teaser']) {
+ $node->content['teaser'] = array('#value' => _delicious_tag_text($node->teaser, $uname), '#weight' => 10);
+ }
+ if ($node->content['body']) {
+ $node->content['body'] = array('#value' => _delicious_tag_text($node->body, $uname), '#weight' => 10 );
+ }
}
}
break;
@@ -369,7 +370,7 @@ function delicious_page_tag($tag = "", $
$output = "" . l(t('View "%n" for all users', array('%n' => $tag)), "delicious/tag/$tag") . "
";
$output .= theme('table', $header, $rows);
- $output = "$output
\n";
+ $output = "$output
\n";
return $output;
}
@@ -390,7 +391,7 @@ function delicious_page_user($uid = 0) {
//
function delicious_page_settings() {
$uid = arg(1);
- $output = delicious_page_settings_form($uid, $existence);
+ $output = drupal_get_form('delicious_page_settings_form',$uid);
return $output;
}
@@ -467,10 +468,10 @@ function delicious_page_settings_form($u
);
}
- return drupal_get_form('delicious_page_settings', $form);
+ return $form ;
}
-function delicious_page_settings_submit($form_id, $form_values) {
+function delicious_page_settings_form_submit($form_id, $form_values) {
if ($_POST['op'] == t('Enable')) {
// create a delicious_user entry
$result = db_query("INSERT INTO {delicious_user} (uid) VALUES (%d)", $form_values['uid']);
@@ -528,31 +529,43 @@ function delicious_admin_edit($block = 0
return drupal_access_denied();
}
- $output = delicious_block_form($block);
+ $output = drupal_get_form('delicious_block_form',$block);
return $output;
}
+
+function delicious_admin_delete_confirm_submit($form_id, $form_values) {
+ if ($form_values['confirm']) {
+ delicious_delete_block($form_values['block']);
+ }
+ return 'admin/delicious';
+}
+
function delicious_admin_delete($dbid = 0) {
$block = delicious_load_block($dbid);
if ($block['title'] == '') {
return drupal_access_denied();
}
+ return drupal_get_form('delicious_admin_delete_confirm', $dbid);
+}
+
+function delicious_admin_delete_confirm_page() {
+ return drupal_get_form('delicious_admin_delete_confirm', arg(1));
+}
+
+function delicious_admin_delete_confirm($dbid){
+
+
$form['block'] = array('#type' => 'value', '#value' => $dbid);
- return confirm_form('delicious_admin_delete_confirm', $form,
+ return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => $block['title'])),
$_GET['destination'] ? $_GET['destination'] : 'admin/delicious',
t('This action cannot be undone.'),
t('Delete'), t('Cancel')
);
-}
-function delicious_admin_delete_confirm_submit($form_id, $form_values) {
- if ($form_values['confirm']) {
- delicious_delete_block($form_values['block']);
- }
- return 'admin/delicious';
}
//
@@ -605,13 +618,13 @@ function delicious_block_form($dbid = 0)
);
}
- return drupal_get_form('delicious_block_edit', $form);
+ return $form ;
}
//
// save block to db
//
-function delicious_block_edit_submit($form_id, $form_values) {
+function delicious_block_form_submit($form_id, $form_values) {
if ($form_values['dbid']) {
db_query("UPDATE {delicious_block} SET title='%s', users='%s', tags='%s', maxentries=%d WHERE dbid=%d", $form_values['title'], $form_values['users'], $form_values['tags'], $form_values['maxentries'], $form_values['dbid']);
}
@@ -903,26 +916,14 @@ function _delicious_term_link(&$node) {
// smart-tagging support
//
function _delicious_tag_string($text, $tags, $username) {
-
- if (!$tags)
- return $text;
-
- // error, it must start with a tag... :-(
- foreach ($tags AS $tag) {
- if (!empty($tag) && $tag != ' ') {
- $path = DELICIOUS_BASE_URL . urlencode($username) . '/' .urlencode($tag);
+ // TODO: url checking
+ // TODO: cache this! what about a filter?
$modulepath = drupal_get_path('module', 'delicious');
- $deliciousLink = "