Development

Changeset 5604

You must first sign up to be able to contribute.

Changeset 5604

Show
Ignore:
Timestamp:
10/20/07 02:13:45 (1 year ago)
Author:
Mark.Quezada
Message:

Updated thickbox plugin with helpers for inline and ajax content to match the official documentation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/mqThickboxPlugin/lib/helper/ThickboxHelper.php

    r5603 r5604  
    1010   
    1111  return link_to(image_tag($thumbnail, $image_options), image_path($image, true), $link_options); 
     12} 
     13 
     14function thickbox_inline($name = '', $inline_id = '', $options = array(), $thickbox_options = array()) 
     15{ 
     16  _add_resources(); 
     17  $options = _parse_attributes($options); 
     18  $thickbox_options = _parse_attributes($thickbox_options); 
     19   
     20  if (array_key_exists('size', $thickbox_options)) 
     21  { 
     22    list($thickbox_options['width'], $thickbox_options['height']) = explode('x',$thickbox_options['size']); 
     23    unset($thickbox_options['size']); 
     24  } 
     25 
     26  $options['class'] = isset($options['class']) ? $options['class'] : 'thickbox'; 
     27  $thickbox_options['inlineId'] = $inline_id; 
     28     
     29  if (isset($options['query_string'])) 
     30  { 
     31    $options['query_string'] .= '&' . http_build_query($thickbox_options); 
     32  } 
     33  else 
     34  { 
     35    $options['query_string'] = http_build_query($thickbox_options); 
     36  } 
     37   
     38  return link_to($name, '#TB_inline', $options); 
    1239} 
    1340 
     
    3663   
    3764  return link_to($name, $internal_uri, $options); 
     65} 
     66 
     67function thickbox_ajax($name = '', $internal_uri = '', $options = array(), $thickbox_options = array()) 
     68{ 
     69  _add_resources(); 
     70  $options = _parse_attributes($options); 
     71  $thickbox_options = _parse_attributes($thickbox_options); 
    3872   
     73  if (array_key_exists('size', $thickbox_options)) 
     74  { 
     75    list($thickbox_options['width'], $thickbox_options['height']) = explode('x',$thickbox_options['size']); 
     76    unset($thickbox_options['size']); 
     77  } 
     78   
     79  if (!array_key_exists('width', $thickbox_options) && !array_key_exists('height', $thickbox_options)) 
     80  { 
     81    $thickbox_options['width']  = 400; 
     82    $thickbox_options['height'] = 300; 
     83  } 
     84 
     85  $options['class'] = isset($options['class']) ? $options['class'] : 'thickbox'; 
     86     
     87  if (isset($options['query_string'])) 
     88  { 
     89    $options['query_string'] .= '&' . http_build_query($thickbox_options); 
     90  } 
     91  else 
     92  { 
     93    $options['query_string'] = http_build_query($thickbox_options); 
     94  } 
     95   
     96  return link_to($name, $internal_uri, $options); 
    3997} 
    4098