Changeset 12569
- Timestamp:
- 02/20/08 15:02:44 (11 months ago)
- Files:
-
- 1 modified
-
util/branches/dev/jsdoc/jsdoc.module (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/branches/dev/jsdoc/jsdoc.module
r12567 r12569 2234 2234 } 2235 2235 2236 drupal_set_title(theme('jsdoc_object_title', $node));2236 drupal_set_title(theme('jsdoc_object_title', _jsdoc_get_title_themed($node))); 2237 2237 2238 2238 return drupal_render_form('jsdoc_variable_form', $form); … … 2253 2253 drupal_add_js('misc/collapse.js'); 2254 2254 2255 drupal_set_title(theme('jsdoc_object_title', $node));2255 drupal_set_title(theme('jsdoc_object_title', _jsdoc_get_title_themed($node))); 2256 2256 2257 2257 $form = node_prepare($node, false)->content; … … 2438 2438 } 2439 2439 2440 function _jsdoc_get_title_themed($node) { 2441 $themed = (object)array( 2442 'title' => $node->title, 2443 'crumbs' => array() 2444 ); 2445 2446 if ($type = jsdoc_get_type($node)) { 2447 $type = jsdoc_object_node_load($type, jsdoc_get_project($node), jsdoc_get_version($node), jsdoc_get_all_provide_nids($node, array(3, 4))); 2448 $themed->type = (object)array( 2449 'title' => $type->title, 2450 'url' => $type->jsdoc_url 2451 ); 2452 if ($type->jsdoc_url) { 2453 $themed->type->a = l($type->title, $type->jsdoc_url); 2454 } 2455 else { 2456 $themed->type->a = $type->title; 2457 } 2458 } 2459 2460 $parts = explode('.', $node->title); 2461 $title_text = ""; 2462 $end = array_pop($parts); 2463 foreach ($parts as $part) { 2464 if (!empty($title_text)) { 2465 $title_text .= '.'; 2466 } 2467 $title_text .= $part; 2468 2469 $obj = jsdoc_object_node_load($title_text, jsdoc_get_project($node), jsdoc_get_version($node)); 2470 if ($obj) { 2471 $themed->crumbs[] = l($part, $obj->jsdoc_url); 2472 } 2473 else { 2474 $themed->crumbs[] = $part; 2475 } 2476 } 2477 $themed->crumbs[] = $end; 2478 2479 return $themed; 2480 } 2481 2440 2482 function _jsdoc_get_object_themed($node, $title=null) { 2441 2483 if (is_null($title)) { … … 3054 3096 } 3055 3097 3056 $signature = ' function(';3098 $signature = '('; 3057 3099 3058 3100 if ($parameters) { … … 3501 3543 * Theme the object type block. 3502 3544 */ 3503 function theme_jsdoc_object_title($node) { 3504 $parts = explode('.', $node->title); 3505 $title_text = ""; 3506 $end = array_pop($parts); 3507 $title = ""; 3508 $last_part = ""; 3509 foreach ($parts as $part) { 3510 if (!empty($title_text)) { 3511 $title_text .= '.'; 3512 } 3513 $title_text .= $part; 3514 3515 $obj = jsdoc_object_node_load($title_text, jsdoc_get_project($node), jsdoc_get_version($node)); 3516 if (!empty($title)) { 3517 $title .= '.'; 3518 } 3519 if ($obj) { 3520 $title .= l($part, $obj->jsdoc_url); 3521 } 3522 else { 3523 $title .= $part; 3524 } 3525 } 3526 if (!empty($title)) { 3527 $title .= '.'; 3528 } 3529 3530 $title .= $end; 3531 3532 /* 3533 if (jsdoc_get_type($node)) { 3534 $type_node = jsdoc_object_node_load(jsdoc_get_type($node), jsdoc_get_project($node), jsdoc_get_version($node)); 3535 if ($type_node) { 3536 $title .= ': ' . l(jsdoc_get_type($node), $type_node->jsdoc_url); 3537 } 3538 } 3539 */ 3540 3541 return $title; 3545 function theme_jsdoc_object_title($title) { 3546 $output = implode('.', $title->crumbs); 3547 if ($title->type) { 3548 $output .= ': ' . $title->type->a; 3549 } 3550 return $output; 3542 3551 } 3543 3552 … … 3589 3598 $output .= '<div class="fieldset-wrapper">'; 3590 3599 3591 $statics = array();3592 $functions = array();3593 $constructors = array();3594 $objects = array();3595 3600 foreach($children as $child){ 3601 3596 3602 if($child->type){ 3597 3603 if($child->type->title=="Constructor") $constructors[]=$child; … … 3603 3609 } 3604 3610 } 3605 3611 3606 3612 $types = array("Statics"=>$statics, "Constructors"=>$constructors, "Properties"=>$objects, "Functions"=>$functions); 3607 3613 foreach($types as $key=>$arr){ … … 3614 3620 $output .= ': <small>' . $child->type->a . '</small> '; 3615 3621 } 3616 if($child->parameters){ 3617 $output .= '('; 3618 foreach ($child->parameters as $i => $param){ 3619 if($i){ 3620 $output .= ', '; 3621 } 3622 if($param->types){ 3623 $output .= '/* '; 3624 foreach ($param->types as $j => $type){ 3625 if($j) { 3626 $output .= '|'; 3627 } 3628 $output .= $type->a ; 3629 } 3630 if($param->repeating){ 3631 $output .= '...'; 3632 } 3633 if($param->optional){ 3634 $output .= '?'; 3635 } 3636 $output .= ' */ '; 3637 } 3638 $output .= $param->name; 3639 } 3640 $output .= ') '; 3622 if($child->signature){ 3623 $output .= $child->signature; 3641 3624 } 3642 3625 else if($key=="Functions"){ … … 3705 3688 $output .= '<div class="fieldset-wrapper">'; 3706 3689 $output .= '<div class="form-item">'; 3707 $output .= $function->signature;3690 $output .= 'function ' . $function->signature; 3708 3691 $output .= '</div>'; 3709 3692 $output .= '</div>';