Commit ac7637bc authored by Gábor Hojtsy's avatar Gábor Hojtsy

#172773 by numerous contributors: Make the actions interface usable by mere...

#172773 by numerous contributors: Make the actions interface usable by mere mortals (including rename of actions.module to trigger, but keeping the actions themselfs).

Complete previous history of actions module:
 - #148410 by jvandyk: added rewrite of the actions module!
 - #155986 by Uwe: fixed typos.
 - #155828 by Eaton, pwolanin and jvandyk: let actions live even if actions.module is not turned on
parent f73786d1
...@@ -2144,16 +2144,16 @@ function comment_hook_info() { ...@@ -2144,16 +2144,16 @@ function comment_hook_info() {
'comment' => array( 'comment' => array(
'comment' => array( 'comment' => array(
'insert' => array( 'insert' => array(
'runs when' => t('When a comment has been created'), 'runs when' => t('After saving a new comment'),
), ),
'update' => array( 'update' => array(
'runs when' => t('When a comment has been updated'), 'runs when' => t('After saving an updated comment'),
), ),
'delete' => array( 'delete' => array(
'runs when' => t('When a comment has been deleted') 'runs when' => t('After deleting a comment')
), ),
'view' => array( 'view' => array(
'runs when' => t('When a comment is being viewed') 'runs when' => t('When a comment is being viewed by an authenticated user')
), ),
), ),
), ),
...@@ -2170,7 +2170,7 @@ function comment_action_info() { ...@@ -2170,7 +2170,7 @@ function comment_action_info() {
'type' => 'comment', 'type' => 'comment',
'configurable' => FALSE, 'configurable' => FALSE,
'hooks' => array( 'hooks' => array(
'comment' => array('insert', 'update', 'view'), 'comment' => array('insert', 'update'),
) )
), ),
'comment_unpublish_by_keyword_action' => array( 'comment_unpublish_by_keyword_action' => array(
...@@ -2209,7 +2209,7 @@ function comment_unpublish_by_keyword_action_form($context) { ...@@ -2209,7 +2209,7 @@ function comment_unpublish_by_keyword_action_form($context) {
$form['keywords'] = array( $form['keywords'] = array(
'#title' => t('Keywords'), '#title' => t('Keywords'),
'#type' => 'textarea', '#type' => 'textarea',
'#description' => t('The comment will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.".'), '#description' => t('The comment will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.". Character sequences are case-sensitive.'),
'#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '', '#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '',
); );
return $form; return $form;
......
...@@ -2308,16 +2308,16 @@ function node_hook_info() { ...@@ -2308,16 +2308,16 @@ function node_hook_info() {
'node' => array( 'node' => array(
'nodeapi' => array( 'nodeapi' => array(
'presave' => array( 'presave' => array(
'runs when' => t('When content is about to be saved'), 'runs when' => t('When either saving a new post or updating an existing post'),
), ),
'insert' => array( 'insert' => array(
'runs when' => t('When content has been created'), 'runs when' => t('After saving a new post'),
), ),
'update' => array( 'update' => array(
'runs when' => t('When content has been updated'), 'runs when' => t('After saving an updated post'),
), ),
'delete' => array( 'delete' => array(
'runs when' => t('When content has been deleted') 'runs when' => t('After deleting a post')
), ),
'view' => array( 'view' => array(
'runs when' => t('When content is viewed by an authenticated user') 'runs when' => t('When content is viewed by an authenticated user')
...@@ -2336,65 +2336,71 @@ function node_action_info() { ...@@ -2336,65 +2336,71 @@ function node_action_info() {
'type' => 'node', 'type' => 'node',
'description' => t('Publish post'), 'description' => t('Publish post'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('insert', 'update'),
), ),
), ),
'node_unpublish_action' => array( 'node_unpublish_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Unpublish post'), 'description' => t('Unpublish post'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('delete', 'insert', 'update'),
), ),
), ),
'node_make_sticky_action' => array( 'node_make_sticky_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Make post sticky'), 'description' => t('Make post sticky'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('insert', 'update'),
), ),
), ),
'node_make_unsticky_action' => array( 'node_make_unsticky_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Make post unsticky'), 'description' => t('Make post unsticky'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('delete', 'insert', 'update'),
), ),
), ),
'node_promote_action' => array( 'node_promote_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Promote post to front page'), 'description' => t('Promote post to front page'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('insert', 'update'),
'user' => array('login'),
), ),
), ),
'node_unpromote_action' => array( 'node_unpromote_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Remove post from front page'), 'description' => t('Remove post from front page'),
'configurable' => FALSE, 'configurable' => FALSE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('delete', 'insert', 'update'),
), ),
), ),
'node_assign_owner_action' => array( 'node_assign_owner_action' => array(
'type' => 'node', 'type' => 'node',
'description' => t('Change the author of a post'), 'description' => t('Change the author of a post'),
'configurable' => TRUE, 'configurable' => TRUE,
'behavior' => array('changes_node_property'),
'hooks' => array( 'hooks' => array(
'any' => TRUE, 'any' => TRUE,
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update', 'view'), 'comment' => array('delete', 'insert', 'update'),
), ),
), ),
'node_save_action' => array( 'node_save_action' => array(
...@@ -2402,9 +2408,7 @@ function node_action_info() { ...@@ -2402,9 +2408,7 @@ function node_action_info() {
'description' => t('Save post'), 'description' => t('Save post'),
'configurable' => FALSE, 'configurable' => FALSE,
'hooks' => array( 'hooks' => array(
'nodeapi' => array('delete', 'insert', 'update', 'view'), 'comment' => array('delete', 'insert', 'update'),
'comment' => array('delete', 'insert', 'update', 'view'),
'user' => array('login'),
), ),
), ),
'node_unpublish_by_keyword_action' => array( 'node_unpublish_by_keyword_action' => array(
...@@ -2412,8 +2416,7 @@ function node_action_info() { ...@@ -2412,8 +2416,7 @@ function node_action_info() {
'description' => t('Unpublish post containing keyword(s)'), 'description' => t('Unpublish post containing keyword(s)'),
'configurable' => TRUE, 'configurable' => TRUE,
'hooks' => array( 'hooks' => array(
'nodeapi' => array('presave', 'insert', 'update', 'view'), 'nodeapi' => array('presave', 'insert', 'update'),
'comment' => array('delete', 'insert', 'update', 'view'),
), ),
), ),
); );
...@@ -2546,7 +2549,7 @@ function node_unpublish_by_keyword_action_form($context) { ...@@ -2546,7 +2549,7 @@ function node_unpublish_by_keyword_action_form($context) {
$form['keywords'] = array( $form['keywords'] = array(
'#title' => t('Keywords'), '#title' => t('Keywords'),
'#type' => 'textarea', '#type' => 'textarea',
'#description' => t('The node will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.".'), '#description' => t('The node will be unpublished if it contains any of the character sequences above. Use a comma-separated list of character sequences. Example: funny, bungee jumping, "Company, Inc.". Character sequences are case-sensitive.'),
'#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '', '#default_value' => isset($context['keywords']) ? drupal_implode_tags($context['keywords']) : '',
); );
return $form; return $form;
......
This diff is collapsed.
...@@ -1149,13 +1149,13 @@ function taxonomy_hook_info() { ...@@ -1149,13 +1149,13 @@ function taxonomy_hook_info() {
'taxonomy' => array( 'taxonomy' => array(
'taxonomy' => array( 'taxonomy' => array(
'insert' => array( 'insert' => array(
'runs when' => t('When a new category has been created'), 'runs when' => t('After saving a new category to the database'),
), ),
'update' => array( 'update' => array(
'runs when' => t('When a category has been updated'), 'runs when' => t('After saving an updated category to the database'),
), ),
'delete' => array( 'delete' => array(
'runs when' => t('When a category has been deleted') 'runs when' => t('After deleting a category')
), ),
), ),
), ),
......
; $Id$ ; $Id$
name = Actions name = Trigger
description = Enables triggerable Drupal actions. description = Enables actions to be fired on certain system events, such as when new content is created.
package = Core - optional package = Core - optional
version = VERSION version = VERSION
core = 6.x core = 6.x
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
/** /**
* Implementation of hook_install(). * Implementation of hook_install().
*/ */
function actions_install() { function trigger_install() {
// Create tables. // Create tables.
drupal_install_schema('actions'); drupal_install_schema('trigger');
// Do initial synchronization of actions in code and the database. // Do initial synchronization of actions in code and the database.
actions_synchronize(actions_list()); actions_synchronize(actions_list());
...@@ -15,7 +15,7 @@ function actions_install() { ...@@ -15,7 +15,7 @@ function actions_install() {
/** /**
* Implementation of hook_uninstall(). * Implementation of hook_uninstall().
*/ */
function actions_uninstall() { function trigger_uninstall() {
// Remove tables. // Remove tables.
drupal_uninstall_schema('actions'); drupal_uninstall_schema('trigger');
} }
<?php <?php
// $Id$ // $Id$
function actions_schema() { function trigger_schema() {
$schema['actions_assignments'] = array( $schema['trigger_assignments'] = array(
'fields' => array( 'fields' => array(
'hook' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'hook' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'op' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'op' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
......
...@@ -1991,22 +1991,22 @@ function user_hook_info() { ...@@ -1991,22 +1991,22 @@ function user_hook_info() {
'user' => array( 'user' => array(
'user' => array( 'user' => array(
'insert' => array( 'insert' => array(
'runs when' => t('When a user account has been created'), 'runs when' => t('After a user account has been created'),
), ),
'update' => array( 'update' => array(
'runs when' => t('When a user account has been updated'), 'runs when' => t("After a user's profile has been updated"),
), ),
'delete' => array( 'delete' => array(
'runs when' => t('When a user account has been deleted') 'runs when' => t('After a user has been deleted')
), ),
'login' => array( 'login' => array(
'runs when' => t('When a user has logged in') 'runs when' => t('After a user has logged in')
), ),
'logout' => array( 'logout' => array(
'runs when' => t('When a user has logged out') 'runs when' => t('After a user has logged out')
), ),
'view' => array( 'view' => array(
'runs when' => t("When a user's account information is displayed") 'runs when' => t("When a user's profile is being viewed")
), ),
), ),
), ),
...@@ -2022,21 +2022,13 @@ function user_action_info() { ...@@ -2022,21 +2022,13 @@ function user_action_info() {
'description' => t('Block current user'), 'description' => t('Block current user'),
'type' => 'user', 'type' => 'user',
'configurable' => FALSE, 'configurable' => FALSE,
'hooks' => array( 'hooks' => array(),
'nodeapi' => array('presave', 'delete', 'insert', 'update', 'view'), ),
'comment' => array('view', 'insert', 'update', 'delete'),
'user' => array('logout'),
),
),
'user_block_ip_action' => array( 'user_block_ip_action' => array(
'description' => t('Ban IP address of current user'), 'description' => t('Ban IP address of current user'),
'type' => 'user', 'type' => 'user',
'configurable' => FALSE, 'configurable' => FALSE,
'hooks' => array( 'hooks' => array(),
'nodeapi' => array('presave', 'delete', 'insert', 'update', 'view'),
'comment' => array('view', 'insert', 'update', 'delete'),
'user' => array('logout'),
)
), ),
); );
} }
...@@ -2073,8 +2065,8 @@ function user_block_ip_action() { ...@@ -2073,8 +2065,8 @@ function user_block_ip_action() {
/** /**
* Submit handler for the user registration form. * Submit handler for the user registration form.
* *
* This function is shared by the installation form and the normal registration form, * This function is shared by the installation form and the normal registration form,
* which is why it can't be in the user.pages.inc file. * which is why it can't be in the user.pages.inc file.
*/ */
function user_register_submit($form, &$form_state) { function user_register_submit($form, &$form_state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment