| 1 |
<?php |
<?php |
| 2 |
// $Id: rotor.module,v 1.2.2.18.2.28 2009/05/29 11:49:04 mrfelton Exp $ |
// $Id: rotor.module,v 1.2.2.18.2.29 2009/10/06 19:49:12 mrfelton Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 105 |
'#default_value' => $node->url, |
'#default_value' => $node->url, |
| 106 |
'#description' => t('The link that will be actived for this item. Example: http://www.drupal.org, node/3'), |
'#description' => t('The link that will be actived for this item. Example: http://www.drupal.org, node/3'), |
| 107 |
'#weight' => -4, |
'#weight' => -4, |
| 108 |
); |
); |
| 109 |
$form['link_target'] = array( |
$form['link_target'] = array( |
| 110 |
'#type' => 'select', |
'#type' => 'select', |
| 111 |
'#title' => t('Link target'), |
'#title' => t('Link target'), |
| 152 |
'#description' => t('The content that will be shown in case no image is uploaded.'), |
'#description' => t('The content that will be shown in case no image is uploaded.'), |
| 153 |
); |
); |
| 154 |
$form['body_filter']['filter'] = filter_form($node->format); |
$form['body_filter']['filter'] = filter_form($node->format); |
| 155 |
|
|
| 156 |
$form['#attributes']['enctype'] = 'multipart/form-data'; |
$form['#attributes']['enctype'] = 'multipart/form-data'; |
| 157 |
$form['#submit'] = array('rotor_submit'); |
$form['#submit'] = array('rotor_submit'); |
| 158 |
return $form; |
return $form; |
| 188 |
break; |
break; |
| 189 |
case 'view': |
case 'view': |
| 190 |
$node->content['rotor_image'] = array( |
$node->content['rotor_image'] = array( |
| 191 |
'#value' => |
'#value' => |
| 192 |
'<div>'. theme('rotor_item', $node) .'</div>', |
'<div>'. theme('rotor_item', $node) .'</div>', |
| 193 |
'#weight' => 10, |
'#weight' => 10, |
| 194 |
); |
); |
| 295 |
*/ |
*/ |
| 296 |
function theme_rotor_item($item, $preset_id = NULL) { |
function theme_rotor_item($item, $preset_id = NULL) { |
| 297 |
if ($item->fid) { |
if ($item->fid) { |
| 298 |
|
|
| 299 |
// Separate out the anchor if any. |
// Separate out the anchor if any. |
| 300 |
if (strpos($item->url, '#') !== FALSE) { |
if (strpos($item->url, '#') !== FALSE) { |
| 301 |
$fragment = substr($item->url, strpos($item->url, '#') + 1); |
$fragment = substr($item->url, strpos($item->url, '#') + 1); |
| 306 |
$query = substr($item->url, strpos($item->url, '?') + 1); |
$query = substr($item->url, strpos($item->url, '?') + 1); |
| 307 |
$item->url = substr($item->url, 0, strpos($item->url, '?')); |
$item->url = substr($item->url, 0, strpos($item->url, '?')); |
| 308 |
} |
} |
| 309 |
|
|
| 310 |
$attributes = $item->link_target? array('target' => $item->link_target) : array(); |
$attributes = $item->link_target? array('target' => $item->link_target) : array(); |
| 311 |
|
|
| 312 |
$output .= $item->url |
$output .= $item->url |
| 313 |
?l(theme('rotor_image', $item, $preset_id), $item->url, array('query' => $query, 'fragment' => $fragment, 'html' => TRUE, 'attributes' => $attributes)) |
?l(theme('rotor_image', $item, $preset_id), $item->url, array('query' => $query, 'fragment' => $fragment, 'html' => TRUE, 'attributes' => $attributes)) |
| 314 |
: theme('rotor_image', $item, $preset_id); |
: theme('rotor_image', $item, $preset_id); |
| 328 |
$output = '<div class="rotor-tabs">'; |
$output = '<div class="rotor-tabs">'; |
| 329 |
foreach ($items as $item) { |
foreach ($items as $item) { |
| 330 |
$node = node_load($item->nid); |
$node = node_load($item->nid); |
| 331 |
$output .= theme_rotor_tab($node); |
$output .= theme('rotor_tab', $node); |
| 332 |
} |
} |
| 333 |
$output .= '</div>'; |
$output .= '</div>'; |
| 334 |
return $output; |
return $output; |