Changeset 12556

Show
Ignore:
Timestamp:
02/20/08 07:38:18 (11 months ago)
Author:
pottedmeat
Message:

Refs #5602. Pass fields to jsdoc_function_information

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/branches/dev/jsdoc/jsdoc.module

    r12550 r12556  
    157157      } 
    158158    } 
    159  
    160     /* 
    161     if (arg(0) == 'jsdoc' && arg(3)) { 
    162       // jsdoc/namespace/'HEAD'/resource/object 
    163       if (arg(4) && arg(4) != 'view' && arg(4) != 'edit' && arg(4) != 'private') { 
    164         $item = arg(3) . '/' . arg(4); 
    165         $object = $node = jsdoc_object_node_load(arg(4), arg(1), arg(2), str_replace('__', '/', arg(3))); 
    166       } 
    167       // jsdoc/namespace/'HEAD'/object 
    168       else { 
    169         $item = arg(3); 
    170         $object = $node = jsdoc_object_node_load(arg(3), arg(1), arg(2)); 
    171       } 
    172  
    173       if (jsdoc_get_variable_object($node)) { 
    174         $object = jsdoc_get_variable_object($node); 
    175       } 
    176       $items[] = array('path' => 'jsdoc/' . arg(1) . '/' . arg(2) . '/' . $item, 
    177         'title' => t('View'), 
    178         'callback' => 'jsdoc_object_node_view', 
    179         'callback arguments' => array($node), 
    180         'access' => node_access('view', $node), 
    181         'type' => MENU_CALLBACK 
    182       ); 
    183       $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/view', 
    184         'title' => t('View'), 
    185         'type' => MENU_DEFAULT_LOCAL_TASK, 
    186         'weight' => -10 
    187       ); 
    188       $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/private', 
    189         'title' => t('View w/ Private'), 
    190         'callback' => 'jsdoc_object_node_view', 
    191         'callback arguments' => array($node, null, true), 
    192         'access' => node_access('view', $node), 
    193         'weight' => -9, 
    194         'type' => MENU_LOCAL_TASK 
    195       ); 
    196       $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/edit', 
    197         'title' => t('Edit'), 
    198         'callback' => 'jsdoc_object_edit_redirect', 
    199         'callback arguments' => array($node), 
    200         'access' => node_access('update', $node), 
    201         'weight' => 1, 
    202         'type' => MENU_LOCAL_TASK 
    203       ); 
    204       $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/edit/' . arg(6), 
    205         'title' => t('Edit'), 
    206         'callback' => 'jsdoc_object_edit_redirect', 
    207         'callback arguments' => array($node, arg(6)), 
    208         'access' => node_access('update', $node), 
    209         'weight' => 1, 
    210         'type' => MENU_LOCAL_TASK 
    211       ); 
    212  
    213       if (jsdoc_get_type($object) == 'Function') { 
    214         if (jsdoc_get_classlike($object) || jsdoc_is_initialized($object)) { 
    215           $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/view/init', 
    216             'title' => t('Initialized'), 
    217             'type' => MENU_DEFAULT_LOCAL_TASK, 
    218             'weight' => -10 
    219           ); 
    220           if (!jsdoc_is_initialized($object)) { 
    221             $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/view/normal', 
    222               'title' => t('Uninitialized'), 
    223               'callback' => 'jsdoc_object_node_view', 
    224               'callback arguments' => array($node, false), 
    225               'access' => node_access('view', $node), 
    226               'type' => MENU_LOCAL_TASK 
    227             ); 
    228             $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/private/init', 
    229               'title' => t('Initialized'), 
    230               'type' => MENU_DEFAULT_LOCAL_TASK, 
    231               'weight' => -10 
    232             ); 
    233             $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/private/normal', 
    234               'title' => t('Uninitialized'), 
    235               'callback' => 'jsdoc_object_node_view', 
    236               'callback arguments' => array($node, false, true), 
    237               'access' => node_access('view', $node), 
    238               'type' => MENU_LOCAL_TASK 
    239             ); 
    240           } 
    241         } 
    242         else { 
    243           $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/view/normal', 
    244             'title' => t('Uninitialized'), 
    245             'type' => MENU_DEFAULT_LOCAL_TASK, 
    246             'weight' => -10 
    247           ); 
    248           $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/view/init', 
    249             'title' => t('Initialized'), 
    250             'callback' => 'jsdoc_object_node_view', 
    251             'callback arguments' => array($node, true), 
    252             'access' => node_access('view', $node), 
    253             'type' => MENU_LOCAL_TASK 
    254           ); 
    255           $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/private/normal', 
    256             'title' => t('Uninitialized'), 
    257             'type' => MENU_DEFAULT_LOCAL_TASK, 
    258             'weight' => -10 
    259           ); 
    260           $items[] = array('path' => 'jsdoc/'. arg(1) . '/' . arg(2) . '/' . $item . '/private/init', 
    261             'title' => t('Initialized'), 
    262             'callback' => 'jsdoc_object_node_view', 
    263             'callback arguments' => array($node, true, true), 
    264             'access' => node_access('view', $node), 
    265             'type' => MENU_LOCAL_TASK 
    266           ); 
    267         } 
    268       } 
    269     } 
    270     */ 
    271159  } 
    272160 
     
    275163 
    276164/** 
    277  * shutdown function to make sure we always mark the last node processed. 
    278  */ 
    279 function jsdoc_update_shutdown() { 
    280   global $last_change, $last_nid; 
    281  
    282   if ($last_change && $last_nid) { 
    283     variable_set('jsdoc_cron_last', $last_change); 
    284     variable_set('jsdoc_cron_last_nid', $last_nid); 
    285   } 
     165 * Impelementation of hook_block 
     166 */ 
     167function jsdoc_block($op='list', $delta=0) { 
     168  if ($op == 'list') { 
     169    $block[0]['info'] = t('JavaScript Documentation Search'); 
     170    return $block; 
     171  } 
     172  else if ($op == 'view') { 
     173    $block['subject'] = 'Search'; 
     174    $block['content'] = drupal_get_form('_jsdoc_block_search'); 
     175    return $block; 
     176  } 
     177} 
     178 
     179function _jsdoc_block_search(){ 
     180  $form['search'] = array( 
     181    '#type' => 'textfield' 
     182  ); 
     183 
     184  return $form; 
    286185} 
    287186 
     
    15371436} 
    15381437 
     1438function jsdoc_is_function(&$node) { 
     1439  return (jsdoc_get_type($node) == 'Function' || jsdoc_get_type($node) == 'Constructor'); 
     1440} 
     1441 
    15391442function jsdoc_get_type(&$node) { 
    15401443  if (isset($node->jsdoc_type)) { 
     
    27812684      '#value' => theme('jsdoc_object_prototype_chain', $prototype_chain), 
    27822685      '#weight' => 10 
    2783     ); 
    2784   } 
    2785  
    2786   if (jsdoc_get_type($node) == 'Function' || jsdoc_get_type($node) == 'Constructor') { 
    2787     // TODO: jsdoc_get_parameters_themed goes here 
    2788     $parameters = _jsdoc_get_parameters_themed($node); 
    2789  
    2790     if (count($parameters)) { 
    2791       $form['parameters'] = array( 
    2792         '#value' => theme('jsdoc_function_parameters', $parameters), 
    2793         '#weight' => 20 
    2794       ); 
    2795     } 
    2796  
    2797     $function = (object)array( 
    2798       'source' => jsdoc_get_source($node), 
    2799       'signature' => _jsdoc_build_function_signature($node, $parameters) 
    2800     ); 
    2801     if (count($parameters)) { 
    2802       $function->parameters = $parameters; 
    2803     } 
    2804     $form['function'] = array( 
    2805       '#value' => theme('jsdoc_function_information', $function, $fields), 
    2806       '#weight' => 30 
    28072686    ); 
    28082687  } 
     
    29112790  uksort($children, "strnatcasecmp"); 
    29122791 
     2792  if (jsdoc_is_function($node)) { 
     2793    // TODO: jsdoc_get_parameters_themed goes here 
     2794    $parameters = _jsdoc_get_parameters_themed($node); 
     2795 
     2796    if (count($parameters)) { 
     2797      $form['parameters'] = array( 
     2798        '#value' => theme('jsdoc_function_parameters', $parameters), 
     2799        '#weight' => 20 
     2800      ); 
     2801    } 
     2802 
     2803    $function = (object)array( 
     2804      'source' => jsdoc_get_source($node), 
     2805      'signature' => _jsdoc_build_function_signature($node, $parameters) 
     2806    ); 
     2807    if (count($parameters)) { 
     2808      $function->parameters = $parameters; 
     2809    } 
     2810    $form['function'] = array( 
     2811      '#value' => theme('jsdoc_function_information', $function, $children), 
     2812      '#weight' => 30 
     2813    ); 
     2814  } 
     2815 
    29132816  if (count($children)) { 
    29142817    $form['children'] = array(