Skip to content
Snippets Groups Projects
Commit 508d5476 authored by Earl Miles's avatar Earl Miles
Browse files

Fix some problems with default task handlers and cloning task handlers.

parent 19695fab
No related branches found
No related tags found
No related merge requests found
...@@ -780,7 +780,7 @@ function delegator_admin_list_form_submit($form, &$form_state) { ...@@ -780,7 +780,7 @@ function delegator_admin_list_form_submit($form, &$form_state) {
// @todo -- do we need to clear the handler weight here? // @todo -- do we need to clear the handler weight here?
} }
// Otherwise, check to see if it has moved and, if so, update the weight. // Otherwise, check to see if it has moved and, if so, update the weight.
elseif ($info['weight'] != $form_state['task_handlers'][$id]->weight) { elseif ($info['weight'] != isset($form_state['task_handlers']) && $form_state['task_handlers'][$id]->weight) {
// Theoretically we could only do this for in code objects, but since our // Theoretically we could only do this for in code objects, but since our
// load mechanism checks for all, this is less database work. // load mechanism checks for all, this is less database work.
delegator_update_task_handler_weight($form_state['task_handlers'][$id], $info['weight']); delegator_update_task_handler_weight($form_state['task_handlers'][$id], $info['weight']);
...@@ -894,6 +894,9 @@ function delegator_admin_list_form_action_clone($form, &$form_state, $id, $actio ...@@ -894,6 +894,9 @@ function delegator_admin_list_form_action_clone($form, &$form_state, $id, $actio
// Get the next weight from the form // Get the next weight from the form
$handler->weight = delegator_admin_update_weights($form_state); $handler->weight = delegator_admin_update_weights($form_state);
$handler->export_type = EXPORT_IN_DATABASE;
$handler->type = t('Normal');
// Generate a unique name. Unlike most named objects, we don't let people choose // Generate a unique name. Unlike most named objects, we don't let people choose
// names for task handlers because they mostly don't make sense. // names for task handlers because they mostly don't make sense.
$base = $form_state['task']['name']; $base = $form_state['task']['name'];
......
...@@ -263,8 +263,13 @@ function delegator_load_task_handlers($task, $subtask_id = NULL, $default_handle ...@@ -263,8 +263,13 @@ function delegator_load_task_handlers($task, $subtask_id = NULL, $default_handle
$defaults = isset($default_handlers) ? $default_handlers : delegator_get_default_task_handlers($task, $subtask_id); $defaults = isset($default_handlers) ? $default_handlers : delegator_get_default_task_handlers($task, $subtask_id);
foreach ($defaults as $name => $default) { foreach ($defaults as $name => $default) {
$result = delegator_compare_task_handlers($handlers, $defaults, $name); $result = delegator_compare_task_handlers($handlers, $defaults, $name);
if ($result) { if ($result) {
$handlers[$name] = $result; $handlers[$name] = $result;
// Ensure task and subtask are correct, because it's easy to change task
// names when editing a default and fail to do it on the associated handlers.
$result->task = $task['name'];
$result->subtask = $subtask_id;
} }
} }
......
...@@ -160,8 +160,8 @@ class ctools_context_required { ...@@ -160,8 +160,8 @@ class ctools_context_required {
// Due to a bug, some contexts got recorded with an id of 0. This will // Due to a bug, some contexts got recorded with an id of 0. This will
// convert them to the correct ID allowing for some earlier panels // convert them to the correct ID allowing for some earlier panels
// to continue to work. // to continue to work.
if (!empty($context) && $context[strlen($context) - 1] == 0) { if (!empty($context) && $context[strlen($context) - 1] === '0') {\
$context[strlen($context) -1 ] = 1; $context[strlen($context) - 1] = 1;
} }
if (empty($context) || empty($contexts[$context])) { if (empty($context) || empty($contexts[$context])) {
...@@ -601,6 +601,10 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts) { ...@@ -601,6 +601,10 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts) {
* are unique in the final list. * are unique in the final list.
*/ */
function ctools_context_id($context, $type = 'context') { function ctools_context_id($context, $type = 'context') {
if (!$context['id']) {
$context['id'] = 1;
}
return $type . '_' . $context['name'] . '_' . $context['id']; return $type . '_' . $context['name'] . '_' . $context['id'];
} }
...@@ -616,7 +620,6 @@ function ctools_context_id($context, $type = 'context') { ...@@ -616,7 +620,6 @@ function ctools_context_id($context, $type = 'context') {
*/ */
function ctools_context_next_id($objects, $name) { function ctools_context_next_id($objects, $name) {
// Figure out which instance of this argument we're creating // Figure out which instance of this argument we're creating
$id = 0;
if (!$objects) { if (!$objects) {
return $id; return $id;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment