Index: relativity.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/relativity/relativity.module,v retrieving revision 1.24 diff -u -F^f -r1.24 relativity.module --- relativity.module 7 May 2006 21:24:04 -0000 1.24 +++ relativity.module 12 May 2006 20:22:01 -0000 @@ -83,7 +83,7 @@ function relativity_list_possible_childr //drupal_set_message("executing query ".print_r($query,1)); foreach(relativity_execute_query($query, NULL, $parent_nid) as $chnid => $child) { if ($child->type == $type) { - $links[] = theme("relativity_link",$child->title, "addparent/$child->nid/parent/$parent_nid", $parent_nid, ' '.theme_relativity_trace($child->relativity_trace)); + $links[] = theme('relativity_link', $child->title, "addparent/$child->nid/parent/$parent_nid", $parent_nid, ' '.theme_relativity_trace($child->relativity_trace)); } } } @@ -92,7 +92,7 @@ function relativity_list_possible_childr foreach($otherparents as $childparent) { if (node_access("view",$childparent)) { - $links[] = theme("relativity_link",$childparent->title, "addparent/$childparent->nid/parent/$parent_nid", $parent_nid, 'common child required'); + $links[] = theme('relativity_link', $childparent->title, "addparent/$childparent->nid/parent/$parent_nid", $parent_nid, 'common child required'); } } } @@ -121,13 +121,13 @@ function relativity_list_possible_childr while($child = db_fetch_object($result)) { $child_node = node_load($child->nid); - if (node_access("view",$child_node)) { - $links[] = theme("relativity_link",$child_node->title, "addparent/$child_node->nid/parent/$parent_nid", $parent_nid); + if (node_access('view', $child_node)) { + $links[] = theme('relativity_link', $child_node->title, "addparent/$child_node->nid/parent/$parent_nid", $parent_nid); } } if (count($links)) { - print(theme("page", theme("relativity_bullets", $links))); + print(theme('page', theme('relativity_bullets', $links))); } else { drupal_set_message(t('There are no available %s items to attach', array('%s'=>node_get_name($type)))); @@ -444,9 +444,12 @@ function relativity_settings($tab='') { } } + $collapsed = (count(relativity_node_list()) == 1) ? FALSE : TRUE; foreach(relativity_node_list() as $type=>$name) { $group['advanced_settings']['node_'.$type.'_options'] = array( '#type' => 'fieldset', + '#collapsible' => TRUE, + '#collapsed' => $collapsed, '#title' => t('%label Options for %name (%type) nodes', array('%name'=>$name, '%type' =>$type, '%label'=>$label[$tab])), ); @@ -528,9 +531,12 @@ function relativity_settings($tab='') { '#description' => t('If checked, a listing of the node\'s ancestors will be displayed below each node.'), ); + $collapsed = (count(relativity_node_list()) == 1) ? FALSE : TRUE; foreach(relativity_node_list() as $type=>$name) { $group['display_settings']['node_'.$type.'_options'] = array( '#type' => 'fieldset', + '#collapsible' => TRUE, + '#collapsed' => $collapsed, '#title' => t('%label Options for %name (%type) nodes', array('%name'=>$name, '%type' =>$type, '%label'=>$label[$tab])), ); @@ -632,9 +638,12 @@ function relativity_settings($tab='') { '#maxlength' => 250, ); + $collapsed = (count(relativity_node_list()) == 1) ? FALSE : TRUE; foreach (relativity_node_list() as $type=>$name) { $group['regular_settings']['node_'.$type.'_options'] = array( '#type' => 'fieldset', + '#collapsible' => TRUE, + '#collapsed' => $collapsed, '#title' => t('%label Options for %name (%type) nodes', array('%name'=>$name, '%type' =>$type, '%label'=>$label[$tab])), ); @@ -649,7 +658,7 @@ function relativity_settings($tab='') { $group['regular_settings']['node_'.$type.'_options']['relativity_type_'.$type] = array( '#type' => 'select', '#title' => t('Allowable Child Node types'), - '#default_value' => variable_get('relativity_type_'.$type, 'default'), + '#default_value' => variable_get('relativity_type_'.$type, $type), '#options' => relativity_node_list('none'), '#description' => t('What types of nodes are allowed to be attached to this type?'), '#size' => 5, @@ -1221,7 +1230,7 @@ function relativity_nodeapi(&$node, $op, $output = drupal_get_form('relativity_nodeapi', $form); } if ($types = variable_get('relativity_type_'. $node->type, FALSE)) { - $output .= theme("relativity_links", $types, $node, 'edit'); + $output .= theme('relativity_links', $types, $node, 'edit'); } return $output; @@ -1292,7 +1301,7 @@ function relativity_nodeapi(&$node, $op, // output links to attach allowed children types if ($types = variable_get('relativity_type_'. $node->type, FALSE)) { - $output .= theme("relativity_links", $types, $node, 'view'); + $output .= theme('relativity_links', $types, $node, 'view'); } $node->body .= $output; @@ -1902,7 +1911,7 @@ function theme_relativity_links($types, foreach(relativity_sort_types() as $type) { foreach($removables as $child_node) { if ($child_node->type == $type) { - $output .= theme("relativity_link", '['.t('Remove ').node_get_name($child_node->type).": ".$child_node->title.']', 'unparent/'.$parent_nid.'/'.$child_node->nid); + $output .= theme('relativity_link', '['.t('Remove ').node_get_name($child_node->type).": ".$child_node->title.']', 'unparent/'.$parent_nid.'/'.$child_node->nid); } } } @@ -1931,12 +1940,12 @@ function theme_relativity_ancestors($nod foreach($ancestors as $ancestor) { if (is_array($ancestor)) { foreach($ancestor as $sibling) { - $content .= theme("relativity_ancestor", $sibling, $indent); + $content .= theme('relativity_ancestor', $sibling, $indent); } $indent++; } else { - $content .= theme("relativity_ancestor", $ancestor, $indent++); + $content .= theme('relativity_ancestor', $ancestor, $indent++); } } return $content;