--- original/cck_redirection.module 2008-08-28 20:06:33.000000000 -0500 +++ ./cck_redirection.module 2008-10-06 10:45:11.000000000 -0500 @@ -112,10 +112,10 @@ function cck_redirection_form_alter(&$fo // We don't want the user to be able to have this field work with multiple values, so we will // hide this option from the admin when he is configuring the field. - if ($form_id == '_content_admin_field' && $form['main']['type']['#value'] == 'cck_redirection') { +/* if ($form_id == '_content_admin_field' && $form['main']['type']['#value'] == 'cck_redirection') { $form['field']['multiple']['#type'] = 'hidden'; $form['field']['multiple']['#value'] = $form['field']['multiple']['#default_value']; - } + }*/ } /********************************************************************* @@ -462,7 +462,7 @@ function template_preprocess_cck_redirec * Theme a frameset header. */ function template_preprocess_cck_redirection_frameset_header(&$vars) { - template_preprocess_page($vars); + template_preprocess_page(&$vars); } /** @@ -553,6 +553,9 @@ function _cck_redirection_redirect_types * Accomplish redirection using the widget settings. */ function _cck_redirection_redirect(&$element) { + static $split_rand = -1; + static $count = 0; + $teaser = $GLOBALS['cck_redirection_teaser']; $page = $GLOBALS['cck_redirection_page']; @@ -563,24 +566,36 @@ function _cck_redirection_redirect(&$ele $field = content_fields($element['#field_name'], $node->type); $widget = $field['widget']; - $method = is_numeric($widget['redirect_type']) ? $widget['redirect_type'] : NULL; + $method = is_numeric($widget['redirect_type']) ? $widget['redirect_type'] : NULL; - if (user_access('bypass redirection')) { - drupal_set_message(t('This node is redirected to a !r.', array('!r' => l(t('remote URI'), $element['#item']['value'])))); + if ($field['multiple'] > 1) { + $count++; + if ($split_rand == -1) { + $split_rand = rand(1, $field['multiple']); + } + $redirect = $count == $split_rand; } else { - switch ($widget['redirect_type']) { - case CCK_REDIRECTION_DIVERT: - _cck_redirection_divert($element); - break; - case CCK_REDIRECTION_DELAY: - _cck_redirection_delay($element); - break; - case CCK_REDIRECTION_FRAMESET: - _cck_redirection_frameset($element); - break; - default: - // This takes care of CCK_REDIRECTION_NONE by doing nothing - break; + $redirect = true; + } + + if ($redirect) { + if (user_access('bypass redirection')) { + drupal_set_message(t('This node is redirected to a !r.', array('!r' => l(t('remote URI'), $element['#item']['value'])))); + } else { + switch ($widget['redirect_type']) { + case CCK_REDIRECTION_DIVERT: + _cck_redirection_divert($element); + break; + case CCK_REDIRECTION_DELAY: + _cck_redirection_delay($element); + break; + case CCK_REDIRECTION_FRAMESET: + _cck_redirection_frameset($element); + break; + default: + // This takes care of CCK_REDIRECTION_NONE by doing nothing + break; + } } } }