| | 1345 | } |
| | 1346 | |
| | 1347 | function jsdoc_get_classlike(&$node) { |
| | 1348 | if (isset($node->jsdoc_classlike)) { |
| | 1349 | return $node->jsdoc_classlike; |
| | 1350 | } |
| | 1351 | |
| | 1352 | if ($node->type == 'jsdoc_variable') { |
| | 1353 | $classlikes = array(); |
| | 1354 | $query = db_query("SELECT j.classlike FROM {jsdoc_objects} j JOIN {node_revisions} nr ON (nr.vid = j.vid) WHERE nr.title = '%s' AND BINARY nr.title = '%s' AND j.version = %d", $node->title, $node->title, jsdoc_get_version($node)->nid); |
| | 1355 | while ($result = db_fetch_object($query)) { |
| | 1356 | $classlikes[] = $result->classlike; |
| | 1357 | } |
| | 1358 | $classlikes = array_unique($classlikes); |
| | 1359 | if (count($classlikes) == 1) { |
| | 1360 | return $node->jsdoc_classlike = $classlikes[0]; |
| | 1361 | } |
| | 1362 | } |
| | 1363 | |
| | 1364 | return $node->jsdoc_classlike = false; |
| | 1365 | } |
| | 1366 | |
| | 1367 | function jsdoc_get_teaser(&$node) { |
| | 1368 | if ($node->type == 'jsdoc_variable' && !$node->teaser) { |
| | 1369 | return $node->teaser = _jsdoc_resolve_variable($node)->teaser; |
| | 1370 | } |
| | 1371 | |
| | 1372 | return $node->teaser; |
| | 1373 | } |
| | 1374 | |
| | 1375 | function jsdoc_get_body(&$node) { |
| | 1376 | if ($node->type == 'jsdoc_variable' && !$node->body) { |
| | 1377 | return $node->body = _jsdoc_resolve_variable($node)->body; |
| | 1378 | } |
| | 1379 | |
| | 1380 | return $node->body; |
| | 1381 | } |
| | 1382 | |
| | 1383 | function jsdoc_get_format(&$node) { |
| | 1384 | if ($node->type == 'jsdoc_variable' && !$node->format) { |
| | 1385 | return $node->format = _jsdoc_resolve_variable($node)->format; |
| | 1386 | } |
| | 1387 | |
| | 1388 | return $node->format; |
| | 1389 | } |
| | 1390 | |
| | 1391 | function jsdoc_get_full_url(&$node) { |
| | 1392 | if ($node->type == 'jsdoc_variable' && !$node->jsdoc_full_url) { |
| | 1393 | return $node->jsdoc_full_url = _jsdoc_resolve_variable($node)->full_url; |
| | 1394 | } |
| | 1395 | |
| | 1396 | return $node->jsdoc_full_url; |
| | 1397 | } |
| | 1398 | |
| | 1399 | function jsdoc_get_variable_object(&$node) { |
| | 1400 | if ($node->type == 'jsdoc_variable') { |
| | 1401 | return _jsdoc_resolve_variable($node)->object; |
| | 1402 | } |
| | 1403 | |
| | 1404 | return $node; |
| | 1405 | } |
| | 1406 | |
| | 1407 | function jsdoc_get_type(&$node) { |
| | 1408 | if (isset($node->jsdoc_type)) { |
| | 1409 | return $node->jsdoc_type; |
| | 1410 | } |
| | 1411 | |
| | 1412 | if ($node->type == 'jsdoc_variable') { |
| | 1413 | $types = array(); |
| | 1414 | $query = db_query("SELECT j.type FROM {jsdoc_objects} j JOIN {node_revisions} nr ON (nr.vid = j.vid) WHERE nr.title = '%s' AND BINARY nr.title = '%s' AND j.version = %d", $node->title, $node->title, jsdoc_get_version($node)->nid); |
| | 1415 | while ($result = db_fetch_object($query)) { |
| | 1416 | if ($result->type) { |
| | 1417 | $types[] = $result->type; |
| | 1418 | } |
| | 1419 | } |
| | 1420 | $types = array_unique($types); |
| | 1421 | if (count($types) == 1) { |
| | 1422 | return $node->jsdoc_type = $types[0]; |
| | 1423 | } |
| | 1424 | elseif (count($types) > 1) { |
| | 1425 | return $node->jsdoc_type = 'mixed'; |
| | 1426 | } |
| | 1427 | } |
| | 1428 | |
| | 1429 | return ''; |
| 1457 | | $version = jsdoc_get_version($node); |
| 1458 | | |
| 1459 | | $additions->jsdoc_disambiguations = array(); |
| 1460 | | $additions->jsdoc_url = 'jsdoc/' . jsdoc_get_project($version)->title . '/' . $version->title . '/object/' . $node->title; |
| 1461 | | |
| 1462 | | $additions->teaser = ''; |
| 1463 | | $additions->body = ''; |
| 1464 | | if ($additions->jsdoc_disambiguation == -1) { |
| 1465 | | $additions->teaser = $node->teaser; |
| 1466 | | $additions->body = $node->body; |
| 1467 | | } |
| 1468 | | |
| 1469 | | $types = array(); |
| 1470 | | $classlikes = array(); |
| 1471 | | |
| 1472 | | $query = db_query("SELECT n.teaser, n.body, j.nid, MAX(j.vid) AS vid, j.resource_nid, MAX(j.resource_vid) AS resource_vid, j.classlike, j.type, j.private FROM {jsdoc_objects} j JOIN {node_revisions} n ON (j.vid = n.vid) WHERE n.title = '%s' AND BINARY n.title = '%s' AND j.used != -1 AND j.new = 0 AND j.version = %d GROUP BY n.nid", $node->title, $node->title, $version->nid); |
| 1473 | | |
| 1474 | | while ($result = db_fetch_object($query)) { |
| 1475 | | if (db_num_rows($query) == 1 || ($additions->jsdoc_disambiguation && $additions->jsdoc_disambiguation->vid == $result->resource_vid)) { |
| 1476 | | $additions->jsdoc_detail = _jsdoc_node_load($result->nid, $result->vid); |
| 1477 | | $sumdesc = db_fetch_object(db_query("SELECT j.type, j.classlike, n.teaser, n.body, n.format, n2.title AS resource FROM {jsdoc_objects} j JOIN {node_revisions} n ON (n.vid = j.vid) JOIN {node_revisions} n2 ON (n2.vid = j.resource_vid) WHERE j.vid = %d", $additions->jsdoc_detail->vid)); |
| 1478 | | if ($additions->jsdoc_disambiguation != -1) { |
| 1479 | | $additions->teaser = $sumdesc->teaser; |
| 1480 | | $additions->format = $sumdesc->format; |
| 1481 | | $additions->body = $sumdesc->body; |
| 1482 | | } |
| 1483 | | $additions->jsdoc_type = $sumdesc->type; |
| 1484 | | $additions->jsdoc_classlike = $sumdesc->classlike; |
| 1485 | | $additions->jsdoc_full_url = 'jsdoc/' . jsdoc_get_project($node)->title . '/' . $version->title . '/object/' . str_replace('/', '__', $sumdesc->resource) . '/' . $node->title; |
| 1486 | | $additions->jsdoc_url = 'jsdoc/' . jsdoc_get_project($node)->title . '/' . $version->title . '/object/' . $node->title; |
| 1487 | | } |
| 1488 | | else { |
| 1489 | | if (!$node->jsdoc_disambiguation) { |
| 1490 | | $types[] = $result->type; |
| 1491 | | $classlikes[] = $result->classlike; |
| 1492 | | if ($result->teaser && !$node->teaser && !$additions->teaser) { |
| 1493 | | $additions->teaser = $result->teaser; |
| 1494 | | } |
| 1495 | | if ($result->body && !$node->body && !$additions->body) { |
| 1496 | | $additions->body = $result->body; |
| 1497 | | } |
| 1498 | | } |
| 1499 | | $additions->jsdoc_disambiguations[] = _jsdoc_node_load($result->nid, $result->vid); |
| 1500 | | } |
| 1501 | | } |
| 1502 | | |
| 1503 | | if (!empty($types)) { |
| 1504 | | $types = array_unique($types); |
| 1505 | | if (count($types) == 1) { |
| 1506 | | $additions->jsdoc_type = $types[0]; |
| 1507 | | } |
| 1508 | | else { |
| 1509 | | $additions->jsdoc_type = 'mixed'; |
| 1510 | | } |
| 1511 | | } |
| 1512 | | |
| 1513 | | if (!empty($classlikes)) { |
| 1514 | | $additions->jsdoc_classlike = false; |
| 1515 | | |
| 1516 | | $classlikes = array_unique($classlikes); |
| 1517 | | if (count($types) == 1) { |
| 1518 | | $additions->jsdoc_classlike = $classlikes[0]; |
| 1519 | | } |
| 1520 | | } |
| 1521 | | |
| 1522 | | if ($additions->jsdoc_detail || count($additions->jsdoc_disambiguations)) { |
| 1523 | | $additions->jsdoc_used = 1; |
| 1524 | | } |
| 1525 | | else { |
| 1526 | | $additions->jsdoc_used = 0; |
| 1527 | | $node->jsdoc_renames = array(); |
| 1528 | | // Check for what the deleted items have been renamed to |
| 1529 | | $query = db_query("SELECT nr.nid, nr.vid FROM {node_revisions} nr JOIN {jsdoc_objects} jo ON (jo.vid = nr.vid) WHERE nr.title = '%s' AND BINARY nr.title = '%s' AND jo.version = %d", $node->title, $node->title, $version->nid); |
| 1530 | | while ($object = db_fetch_object($query)) { |
| 1531 | | $renames_query = db_query("SELECT nr.title FROM {jsdoc_objects} jo JOIN {node_revisions} nr ON (nr.nid = jo.nid) WHERE jo.nid = %d AND nr.vid != %d AND jo.version = %d GROUP BY nr.nid", $object->nid, $object->vid, $version->nid); |
| 1532 | | while ($rename = db_fetch_object($renames_query)) { |
| 1533 | | if ($rename->title == $node->title) continue; |
| 1534 | | if (!$node->jsdoc_renames[$rename->title]) { |
| 1535 | | $node->jsdoc_renames[$rename->title] = jsdoc_object_node_load(jsdoc_get_project($rename), jsdoc_get_version($rename), $rename->title); |
| 1536 | | } |
| 1537 | | } |
| 1538 | | } |
| 1539 | | } |
| 1540 | | |
| 1541 | | if(arg(0) == 'node' && arg(2) == 'edit') { |
| 1542 | | unset($additions->teaser); |
| 1543 | | unset($additions->body); |
| 1544 | | } |
| 1545 | | |
| 1546 | | $additions->jsdoc_title = $node->title; |
| 1547 | | |
| 1548 | | $additions->jsdoc_formatted = _jsdoc_format_type($additions->jsdoc_type, $additions->jsdoc_classlike); |
| | 1536 | $additions->jsdoc_url = 'jsdoc/' . jsdoc_get_project($node)->title . '/' . jsdoc_get_version($node)->title . '/object/' . $node->title; |
| | 2454 | |
| | 2455 | drupal_add_js('misc/collapse.js'); |
| | 2456 | |
| | 2457 | $used = $node->jsdoc_used; |
| | 2458 | $title = $node->title; |
| | 2459 | $teaser = $node->teaser; |
| | 2460 | $body = $node->body; |
| | 2461 | $format = $node->format; |
| | 2462 | $object_type = $node->jsdoc_type; |
| | 2463 | $classlike = false; |
| | 2464 | $full_url = $node->jsdoc_url; |
| | 2465 | |
| | 2466 | $resources = array(); |
| | 2467 | |
| | 2468 | $variables = array(); |
| | 2469 | $source = ''; |
| | 2470 | $signature = ''; |
| | 2471 | $parameters = array(); |
| | 2472 | |
| | 2473 | if ($node->type == 'jsdoc_object') { |
| | 2474 | $object = $node; |
| | 2475 | } |
| | 2476 | elseif ($node->type == 'jsdoc_variable') { |
| | 2477 | $resource = jsdoc_get_resource($node); |
| | 2478 | $version = jsdoc_get_version($node); |
| | 2479 | |
| | 2480 | $teaser = jsdoc_get_teaser($node); |
| | 2481 | $body = jsdoc_get_body($node); |
| | 2482 | $format = jsdoc_get_format($node); |
| | 2483 | $object_type = jsdoc_get_format($node); |
| | 2484 | $classlike = jsdoc_get_classlike($node); |
| | 2485 | $full_url = jsdoc_get_full_url($node); |
| | 2486 | $object = jsdoc_get_variable_object($node); |
| | 2487 | |
| | 2488 | if ($object || count($resources)) { |
| | 2489 | $used = 1; |
| | 2490 | } |
| | 2491 | else { |
| | 2492 | $used = 0; |
| | 2493 | $renames = array(); |
| | 2494 | // Check for what the deleted items have been renamed to |
| | 2495 | $query = db_query("SELECT nr.nid, nr.vid FROM {node_revisions} nr JOIN {jsdoc_objects} jo ON (jo.vid = nr.vid) WHERE nr.title = '%s' AND BINARY nr.title = '%s' AND jo.version = %d", $node->title, $node->title, $version->nid); |
| | 2496 | while ($object = db_fetch_object($query)) { |
| | 2497 | $renames_query = db_query("SELECT nr.title FROM {jsdoc_objects} jo JOIN {node_revisions} nr ON (nr.nid = jo.nid) WHERE jo.nid = %d AND nr.vid != %d AND jo.version = %d GROUP BY nr.nid", $object->nid, $object->vid, $version->nid); |
| | 2498 | while ($rename = db_fetch_object($renames_query)) { |
| | 2499 | if ($rename->title == $node->title) continue; |
| | 2500 | if (!$renamed[$rename->title]) { |
| | 2501 | $renames[$rename->title] = jsdoc_object_node_load(jsdoc_get_project($rename), jsdoc_get_version($rename), $rename->title); |
| | 2502 | } |
| | 2503 | } |
| | 2504 | } |
| | 2505 | } |
| | 2506 | } |
| | 2507 | |
| | 2508 | drupal_set_title($title); |
| | 2509 | |
| | 2510 | $parents = jsdoc_get_parents($node); |
| | 2511 | if ($node->type == 'jsdoc_variable' && $parents['all']) { |
| | 2512 | $parent = $parents['all'][0]; |
| | 2513 | } |
| | 2514 | |
| | 2515 | $display = _jsdoc_theme_clone($node); |
| | 2516 | $display->used = $used; |
| | 2517 | $display->teaser = $teaser; |
| | 2518 | $display->body = $body; |
| | 2519 | $display->format = $format; |
| | 2520 | $display->object_type = $object_type ? $object_type : 'Object'; |
| | 2521 | $display->classlike = $classlike; |
| | 2522 | $display->full_url = $full_url; |
| | 2523 | $display->formatted = _jsdoc_format_type($display->object_type, $classlike);; |
| | 2524 | |
| | 2525 | $display = _jsdoc_theme_clone($node); |
| | 2526 | if (!empty($resources)) { |
| | 2527 | $display->multiple = count($resources) != 1; |
| | 2528 | $display_resources = array(); |
| | 2529 | foreach ($resources as $resource_value) { |
| | 2530 | $display_resources[] = (object)array( |
| | 2531 | 'anchor' => $resource_value->jsdoc_anchor |
| | 2532 | ); |
| | 2533 | } |
| | 2534 | $display->resources = $display_resources; |
| | 2535 | $resources_output = theme('jsdoc_object_resources', $display); |
| | 2536 | } |
| | 2537 | |
| | 2538 | if ($object) { |
| | 2539 | } |
| | 2540 | else { |
| | 2541 | if ($display->object_type == 'Function') { |
| | 2542 | theme('jsdoc_function', $display); |
| | 2543 | } |
| | 2544 | else { |
| | 2545 | theme('jsdoc_object', $display); |
| | 2546 | } |
| | 2547 | } |
| | 2548 | |
| | 2549 | $classes = array(); |
| | 2550 | $functions = array(); |
| | 2551 | $fields = array(); |
| | 2552 | jsdoc_load_children($node); |
| | 2553 | foreach ($node->jsdoc_variables as $variable_name => $variable) { |
| | 2554 | if (jsdoc_get_type($variable) == 'Function') { |
| | 2555 | if (jsdoc_get_classlike($variable)) { |
| | 2556 | $addto = &$classes; |
| | 2557 | } |
| | 2558 | else { |
| | 2559 | $addto = &$functions; |
| | 2560 | } |
| | 2561 | } |
| | 2562 | else { |
| | 2563 | $addto = &$fields; |
| | 2564 | } |
| | 2565 | |
| | 2566 | $display = drupal_clone($variable); |
| | 2567 | $formatted_type = _jsdoc_format_type(jsdoc_get_type($variable), jsdoc_get_classlike($variable)); |
| | 2568 | $display->object_type = $formatted_type['type']; |
| | 2569 | if (jsdoc_get_type($variable) && jsdoc_get_type($variable) != 'mixed') { |
| | 2570 | $display->object_type_link = l($formatted_type['type'], jsdoc_object_node_load(jsdoc_get_project($object), jsdoc_get_version($object), jsdoc_get_type($variable))->jsdoc_url) . $formatted_type['separator']; |
| | 2571 | } |
| | 2572 | $display->title_link = l($variable->title, $variable->jsdoc_url); |
| | 2573 | jsdoc_get_teaser($display); |
| | 2574 | $addto[] = _jsdoc_theme_clone($display); |
| | 2575 | } |
| | 2576 | |
| | 2577 | $node = node_prepare($node); |
| | 2578 | $node->content['teaser'] = array( |
| | 2579 | '#value' => $node->teaser, |
| | 2580 | '#weight' => -1 |
| | 2581 | ); |
| | 2582 | if ($resources_output) { |
| | 2583 | $node->content['jsdoc_resources'] = array( |
| | 2584 | '#value' => $resources_output, |
| | 2585 | '#weight' => 1 |
| | 2586 | ); |
| | 2587 | } |
| | 2588 | |
| | 2589 | $parent = jsdoc_object_node_load(jsdoc_get_project($node), jsdoc_get_version($node), $parent); |
| | 2590 | $formatted_type = _jsdoc_format_type($parent->title, jsdoc_get_classlike($parent)); |
| | 2591 | $parent->object_type = $formatted_type['type']; |
| | 2592 | $parent->object_type_link = l($formatted_type['type'], $parent->jsdoc_url); |
| | 2593 | $node->content['jsdoc_parent'] = array( |
| | 2594 | '#value' => theme('jsdoc_parent', $parent), |
| | 2595 | '#weight' => 1.5 |
| | 2596 | ); |
| | 2597 | |
| | 2598 | $display = _jsdoc_theme_clone($node); |
| | 2599 | $formatted_type = _jsdoc_format_type(jsdoc_get_type($node), jsdoc_get_classlike($node)); |
| | 2600 | $display->object_type = $formatted_type['type']; |
| | 2601 | $display->object_type_link = l($formatted_type['type'], jsdoc_object_node_load(jsdoc_get_project($node), jsdoc_get_version($node), $formatted_type['type'])->jsdoc_url) . $formatted_type['separator']; |
| | 2602 | $node->content['jsdoc_type'] = array( |
| | 2603 | '#value' => theme('jsdoc_object_type', $display), |
| | 2604 | '#weight' => 2 |
| | 2605 | ); |
| | 2606 | |
| | 2607 | $node->content['jsdoc_fields'] = array( |
| | 2608 | '#value' => theme('jsdoc_field_list', $fields), |
| | 2609 | '#weight' => 3 |
| | 2610 | ); |
| | 2611 | |
| | 2612 | $node->content['jsdoc_functions'] = array( |
| | 2613 | '#value' => theme('jsdoc_function_list', $functions), |
| | 2614 | '#weight' => 4 |
| | 2615 | ); |
| | 2616 | |
| | 2617 | $node->content['jsdoc_classes'] = array( |
| | 2618 | '#value' => theme('jsdoc_class_list', $classes), |
| | 2619 | '#weight' => 5 |
| | 2620 | ); |
| | 2621 | |
| | 2622 | return drupal_render_form('jsdoc_object_form', $node->content); |
| | 2623 | |
| | 2624 | /* Reimplement |
| | 3394 | function _jsdoc_resolve_variable(&$node) { |
| | 3395 | if (isset($node->jsdoc_resolved)) { |
| | 3396 | return $node->jsdoc_resolved; |
| | 3397 | } |
| | 3398 | |
| | 3399 | $resource = jsdoc_get_resource($node); |
| | 3400 | $version = jsdoc_get_version($node); |
| | 3401 | |
| | 3402 | $used = $node->jsdoc_used; |
| | 3403 | $title = $node->title; |
| | 3404 | $teaser = $node->teaser; |
| | 3405 | $body = $node->body; |
| | 3406 | $format = $node->format; |
| | 3407 | $object_type = $node->jsdoc_type; |
| | 3408 | $classlike = false; |
| | 3409 | $full_url = $node->jsdoc_url; |
| | 3410 | |
| | 3411 | $query = db_query("SELECT n.teaser, n.body, n.format, j.nid, MAX(j.vid) AS vid, j.resource_nid, MAX(j.resource_vid) AS resource_vid, j.classlike, j.type, j.private FROM {jsdoc_objects} j JOIN {node_revisions} n ON (j.vid = n.vid) WHERE n.title = '%s' AND BINARY n.title = '%s' AND j.used != -1 AND j.new = 0 AND j.version = %d GROUP BY n.nid", $node->title, $node->title, $version->nid); |
| | 3412 | while ($result = db_fetch_object($query)) { |
| | 3413 | // If there's only one object for a given variable, or if a resource is chosen, use this as the object |
| | 3414 | $resources[] = _jsdoc_node_load($result->resource_nid, $result->resource_vid); |
| | 3415 | if (db_num_rows($query) == 1 || ($resource && $resource->vid == $result->resource_vid)) { |
| | 3416 | $object = _jsdoc_node_load($result->nid, $result->vid); |
| | 3417 | $sumdesc = db_fetch_object(db_query("SELECT j.type, j.classlike, n.teaser, n.body, n.format, n2.title AS resource FROM {jsdoc_objects} j JOIN {node_revisions} n ON (n.vid = j.vid) JOIN {node_revisions} n2 ON (n2.vid = j.resource_vid) WHERE j.vid = %d", $result->vid)); |
| | 3418 | if ($sumdesc->teaser && !$teaser) { |
| | 3419 | $teaser = $sumdesc->teaser; |
| | 3420 | } |
| | 3421 | if ($sumdesc->body && !$body) { |
| | 3422 | $body = $sumdesc->body; |
| | 3423 | } |
| | 3424 | if ($sumdesc->format && !$format) { |
| | 3425 | $format = $sumdesc->format; |
| | 3426 | } |
| | 3427 | if ($sumdesc->type && !$object_type) { |
| | 3428 | $object_type = $sumdesc->type; |
| | 3429 | } |
| | 3430 | $classlike = $sumdesc->classlike; |
| | 3431 | $full_url = str_replace('/object/', '/object/' . str_replace('/', '__', $sumdesc->resource) . '/', $full_url); |
| | 3432 | } |
| | 3433 | else { |
| | 3434 | if ($result->teaser && !$teaser) { |
| | 3435 | $teaser = $result->teaser; |
| | 3436 | } |
| | 3437 | if ($result->body && !$body) { |
| | 3438 | $body = $result->body; |
| | 3439 | } |
| | 3440 | $format = $result->format; |
| | 3441 | if ($result->type) { |
| | 3442 | if (!$object_type) { |
| | 3443 | $object_type = $result->type; |
| | 3444 | } |
| | 3445 | elseif ($object_type != $result->type) { |
| | 3446 | $object_type = 'mixed'; |
| | 3447 | } |
| | 3448 | } |
| | 3449 | if ($result->classlike) { |
| | 3450 | $classlike = true; |
| | 3451 | } |
| | 3452 | } |
| | 3453 | } |
| | 3454 | |
| | 3455 | return $node->jsdoc_resolved = (object)array( |
| | 3456 | 'teaser' => $teaser, |
| | 3457 | 'body' => $body, |
| | 3458 | 'format' => $format, |
| | 3459 | 'object_type' => $object_type, |
| | 3460 | 'classlike' => $classlike, |
| | 3461 | 'full_url' => $full_url |
| | 3462 | ); |
| | 3463 | } |
| | 3464 | |
| | 3484 | |
| | 3485 | // Theme functions |
| | 3486 | // =============== |
| | 3487 | |
| | 3488 | /** |
| | 3489 | * Theme the list of resources that this object might appear in. |
| | 3490 | */ |
| | 3491 | function theme_jsdoc_object_resources($node) { |
| | 3492 | $output = '<div class="jsdoc_object_resources">'; |
| | 3493 | $output .= '<fieldset class="collapsible collapsed">'; |
| | 3494 | $output .= '<legend><a href="#">Appears in Resource'; |
| | 3495 | if ($node->multiple) { |
| | 3496 | $output .= 's'; |
| | 3497 | } |
| | 3498 | $output .= '</a></legend>'; |
| | 3499 | $output .= '<div class="fieldset-wrapper">'; |
| | 3500 | foreach ($node->resources as $resource) { |
| | 3501 | $output .= '<div class="form-item">'; |
| | 3502 | $output .= $resource->anchor; |
| | 3503 | $output .= '</div>'; |
| | 3504 | } |
| | 3505 | $output .= '</div>'; |
| | 3506 | $output .= '</fieldset>'; |
| | 3507 | |
| | 3508 | return $output; |
| | 3509 | } |
| | 3510 | |
| | 3511 | /** |
| | 3512 | * Theme the object type block. |
| | 3513 | */ |
| | 3514 | function theme_jsdoc_object_type($node) { |
| | 3515 | return '<div class="form-item"><label>Object Type:</label>' . $node->object_type_link . '</div>'; |
| | 3516 | } |
| | 3517 | |
| | 3518 | function theme_jsdoc_function($node) { |
| | 3519 | return 'Function'; |
| | 3520 | } |
| | 3521 | |
| | 3522 | function theme_jsdoc_object($node) { |
| | 3523 | return 'Object'; |
| | 3524 | } |
| | 3525 | |
| | 3526 | function theme_jsdoc_parent($node) { |
| | 3527 | return '<div class="form-item"><label>Parent Object:</label>' . $node->object_type_link . '</div>'; |
| | 3528 | } |
| | 3529 | |
| | 3530 | /** |
| | 3531 | * Theme a list of nodes that are classlike |
| | 3532 | */ |
| | 3533 | function theme_jsdoc_class_list($nodes) { |
| | 3534 | return theme_jsdoc_field_list($nodes, 'Classes'); |
| | 3535 | } |
| | 3536 | |
| | 3537 | /** |
| | 3538 | * Theme a list of nodes that are functions |
| | 3539 | */ |
| | 3540 | function theme_jsdoc_function_list($nodes) { |
| | 3541 | return theme_jsdoc_field_list($nodes, 'Functions'); |
| | 3542 | } |
| | 3543 | |
| | 3544 | /** |
| | 3545 | * Theme a list of nodes that aren't classes or functions |
| | 3546 | */ |
| | 3547 | function theme_jsdoc_field_list($nodes, $title = 'Fields') { |
| | 3548 | if (!empty($nodes)) { |
| | 3549 | $output = '<div class="jsdoc_field_list">'; |
| | 3550 | $output .= '<fieldset class="collapsible">'; |
| | 3551 | $output .= '<legend><a href="#">' . $title . '</a></legend>'; |
| | 3552 | $output .= '<div class="fieldset-wrapper">'; |
| | 3553 | foreach ($nodes as $node) { |
| | 3554 | $output .= '<div class="form-item">'; |
| | 3555 | $output .= $node->object_type_link . $node->title_link; |
| | 3556 | if ($node->teaser) { |
| | 3557 | $output .= ': ' . $node->teaser; |
| | 3558 | } |
| | 3559 | $output .= '</div>'; |
| | 3560 | } |
| | 3561 | $output .= '</div>'; |
| | 3562 | $output .= '</fieldset>'; |
| | 3563 | |
| | 3564 | return $output; |
| | 3565 | } |
| | 3566 | } |
| | 3567 | |
| | 3568 | /** |
| | 3569 | * Theme all fields for a given object (should only be used if UI is being seriously tweaked). |
| | 3570 | */ |
| | 3571 | function theme_jsdoc_any_list($nodes) { |
| | 3572 | |
| | 3573 | } |