diff -urpN old/workflow_ng/workflow_ng/modules/workflow_ng_system.inc new/workflow_ng/workflow_ng/modules/workflow_ng_system.inc --- old/workflow_ng/workflow_ng/modules/workflow_ng_system.inc 2008-03-02 21:22:22.000000000 +0530 +++ new/workflow_ng/workflow_ng/modules/workflow_ng_system.inc 2008-03-15 01:52:17.546875000 +0530 @@ -67,7 +67,13 @@ function system_condition_info() { ), '#description' => t('Check a boolean value, i.e. TRUE or FALSE.'), '#module' => 'System', - ), + ), + 'workflow_ng_condition_entity_change' => array( + '#label' => t('Check changed entity'), + '#arguments' => array(), + '#description' => t('Check an item exposed by token, and compare to the unchanged token. If ther was a any change condition will return TRUE'), + '#module' => 'System', + ), ); } @@ -107,10 +113,31 @@ function workflow_ng_condition_token_num function workflow_ng_condition_check_boolean($boolean) { return (bool)$boolean; } - - - - + + +/* + * Condition implementation: Content change check + */ +function workflow_ng_condition_entity_change($settings, &$arguments, &$log) { + extract( workflow_ng_token_replace_all(array('tokens'), $settings, $arguments, $log) ); + $updated_tokens = explode("\r\n", $tokens); + + //Copy the settings and change the token arguments to 'unchanged'. + $unchanged_settings = $settings; + + //Get the 'unchanged' tokens. + foreach ($unchanged_settings['tokens_args'] as $args) { + $unchanged_arguments[] = $args . t('_unchanged'); + } + $unchanged_settings['tokens_args'] = $unchanged_arguments; + $unchanged_settings['tokens'] = str_replace (':', '_unchanged:', $unchanged_settings['tokens']); + $tokens = NULL; + extract( workflow_ng_token_replace_all(array('tokens'), $unchanged_settings, $arguments, $log) ); + $unchanged_tokens = explode("\r\n", $tokens); + + return ($updated_tokens != $unchanged_tokens); +} + /* * Implementation of hook_action_info() diff -urpN old/workflow_ng/workflow_ng/modules/workflow_ng_system_forms.inc new/workflow_ng/workflow_ng/modules/workflow_ng_system_forms.inc --- old/workflow_ng/workflow_ng/modules/workflow_ng_system_forms.inc 2008-03-08 16:31:40.000000000 +0530 +++ new/workflow_ng/workflow_ng/modules/workflow_ng_system_forms.inc 2008-03-15 02:21:47.109375000 +0530 @@ -1,4 +1,4 @@ - $form_values['regex']); } + +/* + * Condition: Content change configuration form + */ +function workflow_ng_condition_entity_change_form($settings = array(), $argument_info) { + $form = array(); + $form['tokens'] = array( + '#type' => 'textarea', + '#title' => t('Token items'), + '#required' => TRUE, + '#description' => t('A list of tokens the needs to be comapred, one on each line.
+ For example, [node:title] will be compared to [node_unchanged:title].'), + '#default_value' => $settings['tokens'], + ); + workflow_ng_token_replacement_help($form, $argument_info); + return $form; +} + +function workflow_ng_condition_entity_change_submit($form_id, $form_values) { + return workflow_ng_token_get_settings(array('tokens'), $form_values); +} + /* * Condition: token enabled numeric comparison configuration form