| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: actions.module,v 1.31 2008/03/17 04:21:38 jvandyk Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 47 |
function actions_menu($may_cache) { |
function actions_menu($may_cache) { |
| 48 |
$items = array(); |
$items = array(); |
| 49 |
$access = user_access('administer_actions'); |
$access = user_access('administer_actions'); |
| 50 |
|
|
| 51 |
if ($may_cache) { |
if ($may_cache) { |
| 52 |
$items[] = array( |
$items[] = array( |
| 53 |
'path' => 'admin/settings/actions', |
'path' => 'admin/settings/actions', |
| 134 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 135 |
); |
); |
| 136 |
|
|
| 137 |
// We want contributed modules to be able to describe |
// We want contributed modules to be able to describe |
| 138 |
// their hooks and have actions assignable to them. |
// their hooks and have actions assignable to them. |
| 139 |
$hooks = module_invoke_all('hook_info'); |
$hooks = module_invoke_all('hook_info'); |
| 140 |
foreach ($hooks as $module => $hook) { |
foreach ($hooks as $module => $hook) { |
| 141 |
// We've already done these. |
// We've already done these. |
| 142 |
if (in_array($module, array('node', 'comment', 'user', 'system', 'taxonomy'))) { |
if (in_array($module, array('node', 'comment', 'user', 'system', 'taxonomy'))) { |
| 143 |
continue; |
continue; |
| 144 |
} |
} |
| 145 |
|
/* // Drupal 5 doesn't have an info column. |
| 146 |
$info = db_result(db_query("SELECT info FROM {system} WHERE name = '%s'", $module)); |
$info = db_result(db_query("SELECT info FROM {system} WHERE name = '%s'", $module)); |
| 147 |
$info = unserialize($info); |
$info = unserialize($info); |
| 148 |
$nice_name = $info['name']; |
$nice_name = $info['name']; // */ |
| 149 |
|
// We get the name from the .info file of the module. |
| 150 |
|
$filename = db_result(db_query("SELECT filename FROM {system} WHERE name = '%s' AND type = 'module'", $module)); |
| 151 |
|
$info = _module_parse_info_file(dirname($filename) .'/'. $module .'.info'); |
| 152 |
$items[] = array( |
$items[] = array( |
| 153 |
'path' => 'admin/build/trigger/'. $module, |
'path' => 'admin/build/trigger/'. $module, |
| 154 |
'title' => $nice_name, |
'title' => $info['name'], |
| 155 |
'callback' => 'actions_assign', |
'callback' => 'actions_assign', |
| 156 |
'callback arguments' => array($module), |
'callback arguments' => array($module), |
| 157 |
'access' => $module, |
'access' => $access, |
| 158 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 159 |
); |
); |
| 160 |
} |
} |
| 166 |
'callback arguments' => array('actions_unassign'), |
'callback arguments' => array('actions_unassign'), |
| 167 |
'type' => MENU_CALLBACK, |
'type' => MENU_CALLBACK, |
| 168 |
); |
); |
| 169 |
|
|
| 170 |
return $items; |
return $items; |
| 171 |
} |
} |
| 172 |
} |
} |
| 461 |
* HTML form. |
* HTML form. |
| 462 |
*/ |
*/ |
| 463 |
function actions_assign($type = NULL) { |
function actions_assign($type = NULL) { |
| 464 |
|
|
| 465 |
// If no type is specified we default to node actions, since they |
// If no type is specified we default to node actions, since they |
| 466 |
// are the most common. |
// are the most common. |
| 467 |
if (!isset($type)) { |
if (!isset($type)) { |
| 1336 |
|
|
| 1337 |
/** |
/** |
| 1338 |
* Implementation of hook_action_info(). |
* Implementation of hook_action_info(). |
| 1339 |
|
* Renamed from node_action_info() to avoid namespace collision with workflow-ng. |
| 1340 |
*/ |
*/ |
| 1341 |
function node_action_info() { |
function actions_action_info() { |
| 1342 |
return array( |
return array( |
| 1343 |
'node_publish_action' => array( |
'node_publish_action' => array( |
| 1344 |
'type' => 'node', |
'type' => 'node', |