| 1 |
<?php |
<?php |
| 2 |
// $Id: actions.module,v 1.34 2008/04/17 18:40:47 jvandyk Exp $ |
// $Id: actions.module,v 1.35 2008/04/24 19:56:37 jvandyk Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 1091 |
'#default_value' => $context['message'], |
'#default_value' => $context['message'], |
| 1092 |
'#cols' => '80', |
'#cols' => '80', |
| 1093 |
'#rows' => '20', |
'#rows' => '20', |
| 1094 |
'#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %uid, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'), |
'#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %uid, %node_url, %node_alias, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'), |
| 1095 |
); |
); |
| 1096 |
return $form; |
return $form; |
| 1097 |
} |
} |
| 1197 |
if (isset($node)) { |
if (isset($node)) { |
| 1198 |
$variables += array( |
$variables += array( |
| 1199 |
'%uid' => $node->uid, |
'%uid' => $node->uid, |
| 1200 |
'%node_url' => url('node/'. $node->nid, NULL, NULL, TRUE), |
'%node_url' => actions_node_url($node->nid), |
| 1201 |
|
'%node_alias' => url('node/'. $node->nid, NULL, NULL, TRUE), |
| 1202 |
'%node_type' => node_get_types('name', $node), |
'%node_type' => node_get_types('name', $node), |
| 1203 |
'%title' => $node->title, |
'%title' => $node->title, |
| 1204 |
'%teaser' => $node->teaser, |
'%teaser' => $node->teaser, |
| 1217 |
} |
} |
| 1218 |
} |
} |
| 1219 |
|
|
| 1220 |
|
function system_message_action_form($context) { |
| 1221 |
|
$form['message'] = array( |
| 1222 |
|
'#type' => 'textarea', |
| 1223 |
|
'#title' => t('Message'), |
| 1224 |
|
'#default_value' => isset($context['message']) ? $context['message'] : '', |
| 1225 |
|
'#required' => TRUE, |
| 1226 |
|
'#rows' => '8', |
| 1227 |
|
'#description' => t('The message to be displayed to the current user. You may include the following variables: %site_name, %username, %node_url, %node_alias, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'), |
| 1228 |
|
); |
| 1229 |
|
return $form; |
| 1230 |
|
} |
| 1231 |
|
|
| 1232 |
function system_message_action_submit($form_id, $form_values) { |
function system_message_action_submit($form_id, $form_values) { |
| 1233 |
return array('message' => $form_values['message']); |
return array('message' => $form_values['message']); |
| 1234 |
} |
} |
| 1278 |
if (isset($node) && is_object($node)) { |
if (isset($node) && is_object($node)) { |
| 1279 |
$variables = array_merge($variables, array( |
$variables = array_merge($variables, array( |
| 1280 |
'%uid' => $node->uid, |
'%uid' => $node->uid, |
| 1281 |
'%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)), |
'%node_url' => actions_node_url($node->nid), |
| 1282 |
|
'%node_alias' => url(drupal_get_path_alias('node/' . $node->nid), NULL, NULL, TRUE), |
| 1283 |
'%node_type' => check_plain(node_get_types('name', $node)), |
'%node_type' => check_plain(node_get_types('name', $node)), |
| 1284 |
'%title' => filter_xss($node->title), |
'%title' => filter_xss($node->title), |
| 1285 |
'%teaser' => filter_xss($node->teaser), |
'%teaser' => filter_xss($node->teaser), |
| 1824 |
); |
); |
| 1825 |
} |
} |
| 1826 |
|
|
| 1827 |
|
/** |
| 1828 |
|
* Stripped-down version of url() that does not do path translation; use only |
| 1829 |
|
* for building urls of the form http://example.com/node/3. |
| 1830 |
|
* |
| 1831 |
|
* @param $nid |
| 1832 |
|
* @return |
| 1833 |
|
* Absolute URL built without path alias. |
| 1834 |
|
*/ |
| 1835 |
|
function actions_node_url($nid) { |
| 1836 |
|
global $base_url; |
| 1837 |
|
$script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : ''; |
| 1838 |
|
$clean_url = (bool)variable_get('clean_url', '0'); |
| 1839 |
|
if ($clean_url) { |
| 1840 |
|
return $base_url . '/node/' . $nid; |
| 1841 |
|
} |
| 1842 |
|
else { |
| 1843 |
|
return $base_url . '/' . $script . '?q=node/' . $nid; |
| 1844 |
|
} |
| 1845 |
|
} |
| 1846 |
|
|
| 1847 |
include_once(drupal_get_path('module', 'actions') .'/actions.inc'); |
include_once(drupal_get_path('module', 'actions') .'/actions.inc'); |