Index: vocabindex.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex.admin.inc,v
retrieving revision 1.1.2.3.2.1
diff -u -r1.1.2.3.2.1 vocabindex.admin.inc
--- vocabindex.admin.inc	10 Feb 2008 12:34:58 -0000	1.1.2.3.2.1
+++ vocabindex.admin.inc	19 May 2008 19:30:12 -0000
@@ -1,274 +1,255 @@
 <?php
-/**
-*Admin general settings page
-*/
-function vocabindex_admin()
-{
-	$form['vocabindex_terms_order']=array(
-		'#type'=>'select',
-		'#title'=>t('Terms order'),
-		'#description'=>t('Select the order in which the terms should be displayed.'),
-		'#default_value'=>variable_get('vocabindex_terms_order', 'weight'),
-		'#options'=>array(
-			'weight'=>t('By weight'),
-			'name'=>t('By name'),
-		),
-	);
-	
-	$form['vocabindex_list_style']=array(
-		'#type'=>'select',
-		'#title'=>t('List style'),
-		'#description'=>t('Select the display style for the terms lists.'),
-		'#default_value'=>variable_get('vocabindex_list_style', 'threaded'),
-		'#options'=>array(
-			'threaded'=>t('Threaded'),
-			'flat'=>t('Flat'),
-			'flat-toplevel'=>t('Flat (top-level terms only)'),
-		),
-	);
-	
-	$form['vocabindex_stylesheet']=array(
-		'#type'=>'checkbox',
-		'#title'=>t('Use default stylesheet'),
-		'#description'=>t('Uncheck if you don\'t want to use the default Vocabindex stylesheet.'),
-		'#default_value'=>variable_get('vocabindex_stylesheet', TRUE),
-	);
-	
-	$form['vocabindex_caching']=array(
-		'#type'=>'checkbox',
-		'#title'=>t('Aggressive caching'),
-		'#description'=>t('When using aggressive caching entire index pages are being cached, so changes to the template files won\'t have any effect until the cache is rebuilt.'),
-		'#default_value'=>variable_get('vocabindex_caching', FALSE),
-	);
-	
-	return system_settings_form($form);
-}
-
-/**
-*Admin paths page
-*/
-function vocabindex_page_admin_paths()
-{
-	$count=db_result(db_query("SELECT COUNT(*) FROM {vocabulary}"));
-	if($count!=0)
-	{
-		$output=t('Paths may only contain alphanumeric characters and dashes. For best SEO results, use dashes as word separators. Paths will automatically be converted to lowercase.');
-		$output.=drupal_get_form('vocabindex_form_admin_paths');
-	}
-	else
-	{
-		$output=t('There are no vocabularies to create index pages for. You can create vocabularies at <a href="!link">the Taxonomy page</a>.', array('!link'=>url(_vocabindex_menu_paths('taxonomy'))));
-	}
-	
-	return $output;
-}
-function vocabindex_form_admin_paths()
-{
-	$result=db_query("SELECT vi.path, v.name, v.vid FROM {vocabulary} v LEFT JOIN {vocabindex} vi ON v.vid=vi.vid ORDER BY v.name ASC");
-	while($row=db_fetch_object($result))
-	{
-		if($row->path)
-		{
-			$description=t('Currently located at <a href="!url">/!relative_url</a>', array('!url'=>url($row->path), '!relative_url'=>$row->path));
-		}
-		else
-		{
-			$description=t('There is currently no index page set for this vocabulary.');
-		}
-		
-		$form['vocabindex_path_'.$row->vid]=array(
-			'#type'=>'textfield',
-			'#title'=>t('Path for %title index page', array('%title'=>$row->name)),
-			'#default_value'=>$row->path,
-			'#maxlength'=>'128',
-			'#description'=>$description,
-		);
-	}
-	
-	$form['submit']=array(
-		'#type'=>'submit',
-		'#value'=>t('Save')
-	);
-	
-	return $form;
-}
-
-function vocabindex_form_admin_paths_validate($form, &$form_state)
-{
-	foreach($form_state['values'] as $element=>$path)
-	{
-		if(strpos($element, 'vocabindex_path_')!==FALSE)
-		{
-			$vid=str_replace('vocabindex_path_', '', $element);
-			if(!empty($path) && !preg_match('#[a-z0-9-]#i', $path))
-			{
-				form_set_error($element, t('Paths may only contain alphanumeric characters and dashes.'));
-			}
-			else
-			{
-				$vid=db_result(db_query("SELECT vid FROM {vocabindex} WHERE path = '%s'", $path));
-				$message=vocabindex_check_index($vid, $path);
-				if($message=='used')
-				{
-					form_set_error($element, t('Path already exists.'));
-				}
-			}
-		}
-	}
-}
-
-function vocabindex_form_admin_paths_submit($form, &$form_state)
-{	
-	foreach($form_state['values'] as $element=>$path)
-	{
-		if(strpos($element, 'vocabindex_path_')!==FALSE)
-		{
-			$vid=str_replace('vocabindex_path_', '', $element);
-			
-			$old_path=db_result(db_query("SELECT path FROM {vocabindex} WHERE vid = %d", $vid));
-			vocabindex_create_index($vid, $path);
-			
-		}
-	}
-	
-	//Present the user with a confirmation message
-	drupal_set_message(t('The paths have been updated.'));
-}
-
-/**
-*Check if the given path is already being used. Returns 'vocab' if the path for an index hasn't changed, 'unused' if it isn't used or 'used' when it is in use.
-*/
-function vocabindex_check_index($vid, $path)
-{
-	//Check if path is already used for this vocabulary. If false, check if it's already being used by other items or nodes. If true, do nothing.
-	$count=db_result(db_query("SELECT COUNT(*) FROM {vocabindex} WHERE vid = %d AND path = '%s'", $vid, $path));
-	if($count==0)
-	{
-		//Check for existing aliases and menu paths
-		$count=db_result(db_query("SELECT COUNT(*) FROM {menu_links} WHERE link_path LIKE '%s'", $path));
-		if(drupal_lookup_path('source', $path)==TRUE || $count>0)
-		{
-			$message='used';
-		}
-		else
-		{
-			$message='unused';
-		}
-	}
-	else
-	{
-		$message='vocab';
-	}
-	
-	return $message;
-}
+// $Id$
 
 /**
-*Creates or deletes the paths for the index pages
-*/
-function vocabindex_create_index($vid, $path)
-{
-	//Delete the old vocabindex path
-	vocabindex_delete_index(NULL, $vid);
-	
-	if($vid && $path)
-	{
-		//Create the new path
-		$vocab=taxonomy_vocabulary_load($vid);
-		$description=$vocab->description;
-		$title=$vocab->name;
-		$path=strtolower($path);
-		
-		db_query("INSERT INTO {vocabindex} (vid, path) VALUES (%d, '%s')", $vid, $path);
-		
-		//Rebuild the menu
-		menu_rebuild();
-	}
-}
+ * Admin general settings page
+ */
+function vocabindex_admin() {
+  $form['vocabindex_terms_order'] = array(
+    '#type' => 'select',
+    '#title' => t('Terms order'),
+    '#description' => t('Select the order in which the terms should be displayed.'),
+    '#default_value' => variable_get('vocabindex_terms_order', 'weight'),
+    '#options' => array(
+      'weight' => t('By weight'),
+      'name' => t('By name'),
+    ),
+  );
+
+  $form['vocabindex_list_style'] = array(
+    '#type' => 'select',
+    '#title' => t('List style'),
+    '#description' => t('Select the display style for the terms lists.'),
+    '#default_value' => variable_get('vocabindex_list_style', 'threaded'),
+    '#options' => array(
+      'threaded' => t('Threaded'),
+      'flat' => t('Flat'),
+      'flat-toplevel' => t('Flat (top-level terms only)'),
+    ),
+  );
+
+  $form['vocabindex_stylesheet'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use default stylesheet'),
+    '#description' => t('Uncheck if you don\'t want to use the default Vocabindex stylesheet.'),
+    '#default_value' => variable_get('vocabindex_stylesheet', TRUE),
+  );
+
+  $form['vocabindex_caching'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Aggressive caching'),
+    '#description' => t('When using aggressive caching entire index pages are being cached, so changes to the template files won\'t have any effect until the cache is rebuilt.'),
+    '#default_value' => variable_get('vocabindex_caching', FALSE),
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * Admin paths page
+ */
+function vocabindex_page_admin_paths() {
+  $count = db_result(db_query("SELECT COUNT(*) FROM {vocabulary}"));
+  if ($count != 0) {
+    $output = t('Paths may only contain alphanumeric characters and dashes. For best SEO results, use dashes as word separators. Paths will automatically be converted to lowercase.');
+    $output .= drupal_get_form('vocabindex_form_admin_paths');
+  }
+  else {
+    $output = t('There are no vocabularies to create index pages for. You can create vocabularies at <a href="!link">the Taxonomy page</a>.', array('!link' => url(_vocabindex_menu_paths('taxonomy'))));
+  }
+
+  return $output;
+}
+
+function vocabindex_form_admin_paths() {
+  $result = db_query("SELECT vi.path, v.name, v.vid FROM {vocabulary} v LEFT JOIN {vocabindex} vi ON v.vid=vi.vid ORDER BY v.name ASC");
+  while ($row=db_fetch_object($result)) {
+    if ($row->path) {
+      $description = t('Currently located at <a href="!url">/!relative_url</a>', array('!url' => url($row->path), '!relative_url' => $row->path));
+    }
+    else {
+      $description = t('There is currently no index page set for this vocabulary.');
+    }
+
+    $form['vocabindex_path_'. $row->vid] = array(
+      '#type' => 'textfield',
+      '#title' => t('Path for %title index page', array('%title' => $row->name)),
+      '#default_value' => $row->path,
+      '#maxlength' => '128',
+      '#description' => $description,
+    );
+  }
+
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save')
+  );
+
+  return $form;
+}
+
+function vocabindex_form_admin_paths_validate($form, &$form_state) {
+  foreach ($form_state['values'] as $element => $path) {
+    if (strpos($element, 'vocabindex_path_') !== FALSE) {
+      $vid = str_replace('vocabindex_path_', '', $element);
+      if (!empty($path) && !preg_match('#[a-z0-9-]#i', $path)) {
+        form_set_error($element, t('Paths may only contain alphanumeric characters and dashes.'));
+      }
+      else {
+        $vid = db_result(db_query("SELECT vid FROM {vocabindex} WHERE path = '%s'", $path));
+        $message = vocabindex_check_index($vid, $path);
+        if ($message == 'used') {
+          form_set_error($element, t('Path already exists.'));
+        }
+      }
+    }
+  }
+}
+
+function vocabindex_form_admin_paths_submit($form, &$form_state) {
+  foreach ($form_state['values'] as $element => $path) {
+    if (strpos($element, 'vocabindex_path_') !== FALSE) {
+      $vid = str_replace('vocabindex_path_', '', $element);
+
+      $old_path = db_result(db_query("SELECT path FROM {vocabindex} WHERE vid = %d", $vid));
+      vocabindex_create_index($vid, $path);
+
+    }
+  }
+
+  //Present the user with a confirmation message
+  drupal_set_message(t('The paths have been updated.'));
+}
+
+/**
+ * Check if the given path is already being used.
+ * Returns 'vocab' if the path for an index hasn't changed,
+ * 'unused' if it isn't used or 'used' when it is in use.
+ */
+function vocabindex_check_index($vid, $path) {
+  //Check if path is already used for this vocabulary. If false, check if it's already being used by other items or nodes. If true, do nothing.
+  $count = db_result(db_query("SELECT COUNT(*) FROM {vocabindex} WHERE vid = %d AND path = '%s'", $vid, $path));
+  if ($count == 0) {
+    //Check for existing aliases and menu paths
+    $count = db_result(db_query("SELECT COUNT(*) FROM {menu_links} WHERE link_path LIKE '%s'", $path));
+    if (drupal_lookup_path('source', $path) == TRUE || $count > 0) {
+      $message = 'used';
+    }
+    else {
+      $message = 'unused';
+    }
+  }
+  else {
+    $message = 'vocab';
+  }
+
+  return $message;
+}
+
+/**
+ * Creates or deletes the paths for the index pages
+ */
+function vocabindex_create_index($vid, $path) {
+  //Delete the old vocabindex path
+  vocabindex_delete_index(NULL, $vid);
+
+  if ($vid && $path) {
+    //Create the new path
+    $vocab = taxonomy_vocabulary_load($vid);
+    $description = $vocab->description;
+    $title = $vocab->name;
+    $path = strtolower($path);
+
+    db_query("INSERT INTO {vocabindex} (vid, path) VALUES (%d, '%s')", $vid, $path);
+
+    //Rebuild the menu
+    menu_rebuild();
+  }
+}
+
+/**
+ * Deletes index pages.
+ */
+function vocabindex_delete_index($path = NULL, $vid = NULL) {
+  if (!$path && $vid) {
+    $path = db_result(db_query("SELECT path FROM {vocabindex} WHERE vid = %d", $vid));
+  }
+
+  //Delete the index page
+  db_query("DELETE FROM {vocabindex} WHERE vid = %d", $vid);
+  _vocabindex_menu_delete_item($path);
+  cache_clear_all('vocabindex_page_'. $vid, 'cache');
+
+  menu_rebuild();
+}
+
+/**
+ * Deletes menu items by force. Some parts are a rough copy of _menu_delete_item(), but without the check for System links or updated items.
+ */
+function _vocabindex_menu_delete_item($path) {
+  //Select the menu item that matches the path.
+  $result = db_query("SELECT * FROM {menu_links} WHERE link_path = '%s'", $path);
+  while ($link=db_fetch_array($result)) {
+    //Check for child elements and append them to their new parent
+    if ($link['has_children']) {
+      $result = db_query("SELECT mlid FROM {menu_links} WHERE plid = %d", $link['mlid']);
+      while ($m = db_fetch_array($result)) {
+        $child=menu_link_load($m['mlid']);
+        $child['plid'] = $link['plid'];
+        menu_link_save($child);
+      }
+    }
+    db_query("DELETE FROM {menu_links} WHERE mlid = %d", $link['mlid']);
+
+    // Update the has_children status of the parent.
+    _menu_update_parental_status($link);
+    menu_cache_clear($link->menu_name);
+    _menu_clear_page_cache();
+  }
+}
+
+/**
+ * Delete all cached index pages and - if requested - menu items
+ */
+function vocabindex_clear_cache($menu = FALSE) {
+  //Do not clear cache if caching is disabled
+  if (!variable_get('vocabindex_caching', FALSE)) {
+    return;
+  }
+
+  //Delete cached pages and menu links
+  $result = db_query("SELECT * FROM {vocabindex}");
+  while ($row = db_fetch_object($result)) {
+    cache_clear_all('vocabindex_page_'. $row->vid, 'cache');
+    if ($menu) {
+      vocabindex_delete_index($row->path);
+    }
+  }
+}
+
+/**
+ * Manually clear the entire vocabindex cache
+ */
+function vocabindex_form_cache() {
+  if ($disabled = !variable_get('vocabindex_caching', FALSE)) {
+    $disabled_msg = t('<p><strong>Aggressive caching has been disabled. You can enabled it at <a href="!settings">the settings page</a>.</strong></p>', array('!settings' => url(_vocabindex_menu_paths('admin_settings'))));
+  }
+
+  $form['vocabindex_cache_intro'] = array(
+    '#value' => t('<p>When you have enabled aggressive caching and you have changed the Vocabulary Index template files you can clear all the cached index pages here, so they will be rebuilt using your new template files.</p>') . $disabled_msg,
+  );
+
+  $form['vocabindex_cache_clear'] = array(
+    '#type' => 'submit',
+    '#value' => 'Clear cache',
+    '#disabled' => $disabled,
+  );
 
-/**
-*Deletes index pages.
-*/
-function vocabindex_delete_index($path=NULL, $vid=NULL)
-{
-	if(!$path && $vid)
-	{
-		$path=db_result(db_query("SELECT path FROM {vocabindex} WHERE vid = %d", $vid));
-	}
-	
-	//Delete the index page
-	db_query("DELETE FROM {vocabindex} WHERE vid = %d", $vid);
-	_vocabindex_menu_delete_item($path);
-	cache_clear_all('vocabindex_page_'.$vid, 'cache');
-	
-	menu_rebuild();
+  return $form;
 }
 
-/**
-*Deletes menu items by force. Some parts are a rough copy of _menu_delete_item(), but without the check for System links or updated items.
-*/
-function _vocabindex_menu_delete_item($path)
-{
-	//Select the menu item that matches the path.
-	$result=db_query("SELECT * FROM {menu_links} WHERE link_path = '%s'", $path);
-	while($link=db_fetch_array($result))
-	{
-		//Check for child elements and append them to their new parent
-		if($link['has_children'])
-		{			$result=db_query("SELECT mlid FROM {menu_links} WHERE plid = %d", $link['mlid']);			while($m=db_fetch_array($result))
-			{				$child=menu_link_load($m['mlid']);				$child['plid']=$link['plid'];				menu_link_save($child);			}		}		db_query("DELETE FROM {menu_links} WHERE mlid = %d", $link['mlid']);			// Update the has_children status of the parent.		_menu_update_parental_status($link);		menu_cache_clear($link->menu_name);		_menu_clear_page_cache();
-	}
-}
+function vocabindex_form_cache_submit($form, &$form_state) {
+  vocabindex_clear_cache();
 
-/**
-*Delete all cached index pages and - if requested - menu items
-*/
-function vocabindex_clear_cache($menu=FALSE)
-{
-	//Do not clear cache if caching is disabled
-	if(!variable_get('vocabindex_caching', FALSE))
-	{
-		return;
-	}
-	
-	//Delete cached pages and menu links
-	$result=db_query("SELECT * FROM {vocabindex}");
-	while($row=db_fetch_object($result))
-	{
-		cache_clear_all('vocabindex_page_'.$row->vid, 'cache');
-		if($menu)
-		{
-			vocabindex_delete_index($row->path);
-		}
-	}
+  drupal_set_message(t('The Vocabulary Index cache has been cleared.'));
 }
-
-/**
-*Manually clear the entire vocabindex cache
-*/
-function vocabindex_form_cache()
-{
-	if($disabled=!variable_get('vocabindex_caching', FALSE))
-	{
-		$disabled_msg=t('<p><strong>Aggressive caching has been disabled. You can enabled it at <a href="!settings">the settings page</a>.</strong></p>', array('!settings'=>url(_vocabindex_menu_paths('admin_settings'))));
-	}
-	
-	$form['vocabindex_cache_intro']=array(
-		'#value'=>t('<p>When you have enabled aggressive caching and you have changed the Vocabulary Index template files you can clear all the cached index pages here, so they will be rebuilt using your new template files.</p>').$disabled_msg,
-	);
-	
-	$form['vocabindex_cache_clear']=array(
-		'#type'=>'submit',
-		'#value'=>'Clear cache',
-		'#disabled'=>$disabled,
-	);
-	
-	return $form;
-}
-
-function vocabindex_form_cache_submit($form, &$form_state)
-{
-	vocabindex_clear_cache();
-	
-	drupal_set_message(t('The Vocabulary Index cache has been cleared.'));
-}
\ No newline at end of file
Index: vocabindex.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex.install,v
retrieving revision 1.1.2.3.4.1
diff -u -r1.1.2.3.4.1 vocabindex.install
--- vocabindex.install	10 Feb 2008 12:34:58 -0000	1.1.2.3.4.1
+++ vocabindex.install	19 May 2008 19:30:12 -0000
@@ -1,25 +1,57 @@
-<?phpfunction vocabindex_schema()
-{
-	 $schema['vocabindex']=array(		'description'=>t('The table in which the aliases for vocabulary index pages are stored.'),		'fields'=>array(			'vid'=>array(				'description'=>t('The primary identifier for a vocabulary index page.'),				'type'=>'int',				'not null'=>TRUE
-				),			'path'=>array(				'description'=>t('The path to a vocabulary index page.'),				'type'=>'varchar',
-				'length'=>'128',				'not null'=>TRUE,				),
-			),		'primary key'=>array('vid'),		);
-		return $schema;}function vocabindex_install()
-{	drupal_install_schema('vocabindex');
-	
-	module_load_include('module', 'vocabindex');
-	drupal_set_message(t('Vocabulary Index has been succesfully installed. Please proceed to <a href="!settings">the settings page</a> and <a href="!permissions">set up the permissions</a> to get started.', array('!settings'=>url(_vocabindex_menu_paths('admin_settings')), '!permissions'=>url('/admin/user/permissions', array('fragment'=>'module-vocabindex')))));}function vocabindex_uninstall()
-{	
-	//Delete variables
-	variable_del('vocabindex_terms_order');
-	variable_del('vocabindex_list_style');
-	variable_del('vocabindex_stylesheet');
-	variable_del('vocabindex_caching');
-	
-	//Clear cached pages and menu items
-	module_load_include('inc', 'vocabindex', 'vocabindex.admin');
-	vocabindex_clear_cache(TRUE);
-	
-	//Delete DB table. Must be performed at the end, as cache and menu path removal depend on the vocabindex table.	drupal_uninstall_schema('vocabindex');
-	
-	drupal_set_message(t('Vocabulary Index has been succesfully uninstalled. We hope you enjoyed the ride!'));}
\ No newline at end of file
+<?php
+// $Id$
+
+/**
+ * Impelementation of hook_schema().
+ */
+function vocabindex_schema() {
+  $schema['vocabindex'] = array(
+    'description' => t('The table in which the aliases for vocabulary index pages are stored.'),
+    'fields' => array(
+      'vid' => array(
+        'description' => t('The primary identifier for a vocabulary index page.'),
+        'type' => 'int',
+        'not null' => TRUE
+        ),
+      'path' => array(
+        'description' => t('The path to a vocabulary index page.'),
+        'type' => 'varchar',
+        'length' => '128',
+        'not null' => TRUE,
+        ),
+      ),
+    'primary key' => array('vid'),
+  );
+
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function vocabindex_install() {
+  drupal_install_schema('vocabindex');
+
+  module_load_include('module', 'vocabindex');
+  drupal_set_message(t('Vocabulary Index has been succesfully installed. Please proceed to <a href="!settings">the settings page</a> and <a href="!permissions">set up the permissions</a> to get started.', array('!settings' => url(_vocabindex_menu_paths('admin_settings')), '!permissions' => url('/admin/user/permissions', array('fragment' => 'module-vocabindex')))));
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function vocabindex_uninstall() {
+  //Delete variables
+  variable_del('vocabindex_terms_order');
+  variable_del('vocabindex_list_style');
+  variable_del('vocabindex_stylesheet');
+  variable_del('vocabindex_caching');
+
+  //Clear cached pages and menu items
+  module_load_include('inc', 'vocabindex', 'vocabindex.admin');
+  vocabindex_clear_cache(TRUE);
+
+  //Delete DB table. Must be performed at the end, as cache and menu path removal depend on the vocabindex table.
+  drupal_uninstall_schema('vocabindex');
+
+  drupal_set_message(t('Vocabulary Index has been succesfully uninstalled. We hope you enjoyed the ride!'));
+}
\ No newline at end of file
Index: vocabindex.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex.module,v
retrieving revision 1.1.2.5.2.1
diff -u -r1.1.2.5.2.1 vocabindex.module
--- vocabindex.module	10 Feb 2008 12:34:58 -0000	1.1.2.5.2.1
+++ vocabindex.module	19 May 2008 19:30:12 -0000
@@ -1,141 +1,133 @@
-<?php
-/* $Id$ */
+<?php
+// $Id$
 
 /**
-*Define all menu paths in one central place. This makes it easier to change the paths without having to search the entire code.
-*/
-function _vocabindex_menu_paths($path)
-{
-	$paths=array(
-		'taxonomy'=>'admin/content/taxonomy',
-		'admin_main'=>'admin/content/vocabindex',
-		'admin_paths'=>'admin/content/vocabindex/paths',
-		'admin_settings'=>'admin/content/vocabindex/settings',
-		'admin_cache'=>'admin/content/vocabindex/cache',
-	);
-	
-	return $paths[$path];
+ * Define all menu paths in one central place. This makes it easier to change the paths without having to search the entire code.
+ */
+function _vocabindex_menu_paths($path) {
+  $paths = array(
+    'taxonomy' => 'admin/content/taxonomy',
+    'admin_main' => 'admin/content/vocabindex',
+    'admin_paths' => 'admin/content/vocabindex/paths',
+    'admin_settings' => 'admin/content/vocabindex/settings',
+    'admin_cache' => 'admin/content/vocabindex/cache',
+  );
+
+  return $paths[$path];
 }
-
-/**
-*Implementation of hook_perm()
-*/
-function vocabindex_perm()
-{
-	return array('manage vocabulary index pages', 'view vocabulary index pages');
-}
-
-/**
-*Implementation of hook_menu()
-*/
-function vocabindex_menu()
-{
-	$items[_vocabindex_menu_paths('admin_main')]=array(
-		'title'=>'Vocabulary index pages',
-		'description'=>'Create index pages for vocabularies.',
-		'access arguments'=>array('manage vocabulary index pages'),
-		'page callback'=>'vocabindex_page_admin_paths',
-		'file'=>'vocabindex.admin.inc',
-	);
-	
-	$items[_vocabindex_menu_paths('admin_paths')]=array(
-		'title'=>'Paths',
-		'type'=>MENU_DEFAULT_LOCAL_TASK,
-		'file'=>'vocabindex.admin.inc',
-		'weight'=>-10,
-	);
-	
-	$items[_vocabindex_menu_paths('admin_settings')]=array(
-		'title'=>'Settings',
-		'description'=>'General settings.',
-		'page callback'=>'drupal_get_form',
-		'page arguments'=>array('vocabindex_admin'),
-		'type'=>MENU_LOCAL_TASK,
-		'file'=>'vocabindex.admin.inc',
-	);
-	
-	$items[_vocabindex_menu_paths('admin_cache')]=array(
-		'title'=>'Caching',
-		'description'=>'Clear all cached index pages.',
-		'page callback'=>'drupal_get_form',
-		'page arguments'=>array('vocabindex_form_cache'),
-		'type'=>MENU_LOCAL_TASK,
-		'file'=>'vocabindex.admin.inc',
-		'weight'=>10,
-	);
-	
-	//Prevent the DB request if the module doesn't exist anymore. Without this prevention this code would cause an error right after uninstalling the module.
-	if(module_exists('vocabindex'))
-	{
-		$result=db_query("SELECT vi.path, v.name, v.description FROM {vocabindex} vi LEFT JOIN	{vocabulary} v ON vi.vid=v.vid");
-		while($row=db_fetch_object($result))
-		{
-			//Menu callbacks for every vocabindex page
-			$items[$row->path]=array(
-				'title'=>$row->name,
-				'description'=>$row->description,
-				'access arguments'=>array('view vocabulary index pages'),
-				'page callback'=>'vocabindex_view_page',
-				'page arguments'=>array($row->path),
-				'type'=>MENU_SUGGESTED_ITEM,
-				'file'=>'vocabindex.view.inc',
-			);
-		}
-	}
-
-	return $items;
+
+/**
+ * Implementation of hook_perm()
+ */
+function vocabindex_perm() {
+  return array('manage vocabulary index pages', 'view vocabulary index pages');
 }
 
 /**
-*Implementation of hook_theme()
-*/
-function vocabindex_theme()
-{
-	$functions['vocabindex_page']=array(
-		'template'=>'vocabindex_page',
-		'arguments'=>array(
-			'description'=>NULL,
-			'list'=>NULL,
-		),
-	);
-	
-	$functions['vocabindex_list']=array(
-		'template'=>'vocabindex_list',
-		'arguments'=>array(
-			'list_items'=>NULL,
-			'list_style'=>'threaded',
-		),
-	);
-	
-	$functions['vocabindex_list_item']=array(
-		'template'=>'vocabindex_list_item',
-		'arguments'=>array(
-			'url'=>NULL,
-			'name'=>NULL,
-			'description'=>NULL,
-			'zebra'=>NULL,
-			'children'=>NULL,
-		),
-	);
-	
-	return $functions;
+ * Implementation of hook_menu()
+ */
+function vocabindex_menu() {
+  $items = array();
+  $items[_vocabindex_menu_paths('admin_main')] = array(
+    'title' => 'Vocabulary index pages',
+    'description' => 'Create index pages for vocabularies.',
+    'access arguments' => array('manage vocabulary index pages'),
+    'page callback' => 'vocabindex_page_admin_paths',
+    'file' => 'vocabindex.admin.inc',
+  );
+
+  $items[_vocabindex_menu_paths('admin_paths')] = array(
+    'title' => 'Paths',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'file' => 'vocabindex.admin.inc',
+    'weight' => -10,
+  );
+
+  $items[_vocabindex_menu_paths('admin_settings')] = array(
+    'title' => 'Settings',
+    'description' => 'General settings.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('vocabindex_admin'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'vocabindex.admin.inc',
+  );
+
+  $items[_vocabindex_menu_paths('admin_cache')] = array(
+    'title' => 'Caching',
+    'description' => 'Clear all cached index pages.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('vocabindex_form_cache'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'vocabindex.admin.inc',
+    'weight' => 10,
+  );
+
+  //Prevent the DB request if the module doesn't exist anymore. Without this prevention this code would cause an error right after uninstalling the module.
+  if (module_exists('vocabindex')) {
+    $result = db_query("SELECT vi.path, v.name, v.description FROM {vocabindex} vi LEFT JOIN {vocabulary} v ON vi.vid = v.vid");
+    while ($row = db_fetch_object($result)) {
+      //Menu callbacks for every vocabindex page
+      $items[$row->path] = array(
+        'title' => $row->name,
+        'description' => $row->description,
+        'access arguments' => array('view vocabulary index pages'),
+        'page callback' => 'vocabindex_view_page',
+        'page arguments' => array($row->path),
+        'type' => MENU_SUGGESTED_ITEM,
+        'file' => 'vocabindex.view.inc',
+      );
+    }
+  }
+
+  return $items;
 }
 
 /**
-*Implementation of hook_taxonomy()
-*/
-function vocabindex_taxonomy($op, $type, $array)
-{
-	module_load_include('inc', 'vocabindex', 'vocabindex.admin');
-	
-	//When deleting vocabularies, remove all traces of the vocabindex page
-	if($type=='vocabulary' && $op=='delete')
-	{
-		vocabindex_delete_index(NULL, $array['vid']);
-	}
-	//In any other case simply clear the cache of the current vocabulary
-	else
-	{
-		cache_clear_all('vocabindex_page_'.$array['vid'], 'cache');
-	}
+ * Implementation of hook_theme()
+ */
+function vocabindex_theme() {
+  $functions['vocabindex_page'] = array(
+    'template' => 'vocabindex_page',
+    'arguments' => array(
+      'description' => NULL,
+      'list' => NULL,
+    ),
+  );
+
+  $functions['vocabindex_list'] = array(
+    'template' => 'vocabindex_list',
+    'arguments' => array(
+      'list_items' => NULL,
+      'list_style' => 'threaded',
+    ),
+  );
+
+  $functions['vocabindex_list_item'] = array(
+    'template' => 'vocabindex_list_item',
+    'arguments' => array(
+      'url' => NULL,
+      'name' => NULL,
+      'description' => NULL,
+      'zebra' => NULL,
+      'children' => NULL,
+    ),
+  );
+
+  return $functions;
+}
+
+/**
+ * Implementation of hook_taxonomy()
+ */
+function vocabindex_taxonomy($op, $type, $array) {
+  module_load_include('inc', 'vocabindex', 'vocabindex.admin');
+
+  //When deleting vocabularies, remove all traces of the vocabindex page
+  if ($type == 'vocabulary' && $op == 'delete') {
+    vocabindex_delete_index(NULL, $array['vid']);
+  }
+  //In any other case simply clear the cache of the current vocabulary
+  else {
+    cache_clear_all('vocabindex_page_'. $array['vid'], 'cache');
+  }
 }
\ No newline at end of file
Index: vocabindex.view.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex.view.inc,v
retrieving revision 1.1.2.2.2.1
diff -u -r1.1.2.2.2.1 vocabindex.view.inc
--- vocabindex.view.inc	10 Feb 2008 12:34:58 -0000	1.1.2.2.2.1
+++ vocabindex.view.inc	19 May 2008 19:30:12 -0000
@@ -1,181 +1,156 @@
 <?php
-/**
-*Views a vocabulary index page
-*/
-function vocabindex_view_page($path)
-{
-	$vid=db_result(db_query("SELECT vid FROM {vocabindex} WHERE path='%s'", $path));
-	$list_style=variable_get('vocabindex_list_style', 'threaded');
-	$sort_by=variable_get('vocabindex_terms_order', 'weight');
-	
-	$list_tmp=taxonomy_get_tree($vid);
-	
-	//Don't try to render the list if there are no terms to display
-	if(count($list_tmp)!=0)
-	{
-		//The eventual list. The different types of keys are used for sorting
-		$list=array();
-		if($sort_by=='weight')
-		{
-			foreach($list_tmp as $term)
-			{
-				//Sort by weight. Use the name as well to prevent duplicate keys and to sort by name after the terms have been sorted by weight
-				$list[$term->weight.$term->name]=$term;
-			}
-		}
-		else if($sort_by=='name')
-		{
-			foreach($list_tmp as $term)
-			{
-				//Sort by name
-				$list[$term->name]=$term;
-			}
-		}
-		
-		//Check if the page hasn't already been cached. If not, create and cache it.
-		//NOTE: aggressive caching hier weghalen, moet hier niet staan.
-		$cache_data=cache_get('vocabindex_page_'.$vid)->data;
-		if($cache_data && variable_get('vocabindex_caching', FALSE))
-		{
-			$output=$cache_data;
-		}
-		else
-		{
-			//Check list-style and call the right function
-			if($list_style!='threaded')
-			{
-				$output=vocabindex_render_list_flat($list, $sort_by, $list_style);
-			}
-			else
-			{
-				$output=vocabindex_render_list_threaded($list, $sort_by);
-			}
-			
-			//And render the top list and page
-			$output=theme('vocabindex_list', $output, $list_style);
-			$vocab=taxonomy_vocabulary_load($vid);		
-			$output=theme('vocabindex_page', $vocab->description, $output);
-			
-			//Cache the fully rendered page in case of aggressive caching
-			if(variable_get('vocabindex_caching', FALSE))
-			{
-				cache_set('vocabindex_page_'.$vid, $output);
-			}
-		}
-	}
-	else
-	{
-		$output=t('There are no categories to display.');
-	}
-	
-	//Only add the stylesheet if the site administrator wants it
-	if(variable_get('vocabindex_stylesheet', TRUE))
-	{
-		drupal_add_css('modules/vocabindex/vocabindex-style.css', 'module', 'screen', FALSE);
-	}	
-	
-	return $output;
+// $Id$
+
+/**
+ * Views a vocabulary index page
+ */
+function vocabindex_view_page($path) {
+  $vid = db_result(db_query("SELECT vid FROM {vocabindex} WHERE path = '%s'", $path));
+  $list_style = variable_get('vocabindex_list_style', 'threaded');
+  $sort_by = variable_get('vocabindex_terms_order', 'weight');
+
+  $list_tmp = taxonomy_get_tree($vid);
+
+  //Don't try to render the list if there are no terms to display
+  if (count($list_tmp) != 0) {
+    //The eventual list. The different types of keys are used for sorting
+    $list = array();
+    if ($sort_by == 'weight') {
+      foreach ($list_tmp as $term) {
+        //Sort by weight. Use the name as well to prevent duplicate keys and to sort by name after the terms have been sorted by weight
+        $list[$term->weight . $term->name] = $term;
+      }
+    }
+    else if ($sort_by == 'name') {
+      foreach ($list_tmp as $term) {
+        //Sort by name
+        $list[$term->name] = $term;
+      }
+    }
+
+    // Check if the page hasn't already been cached. If not, create and cache it.
+    // NOTE: aggressive caching hier weghalen, moet hier niet staan.
+    $cache_data = cache_get('vocabindex_page_'. $vid)->data;
+    if ($cache_data && variable_get('vocabindex_caching', FALSE)) {
+      $output = $cache_data;
+    }
+    else {
+      //Check list-style and call the right function
+      if ($list_style != 'threaded') {
+        $output = vocabindex_render_list_flat($list, $sort_by, $list_style);
+      }
+      else {
+        $output = vocabindex_render_list_threaded($list, $sort_by);
+      }
+
+      //And render the top list and page
+      $output = theme('vocabindex_list', $output, $list_style);
+      $vocab = taxonomy_vocabulary_load($vid);
+      $output = theme('vocabindex_page', $vocab->description, $output);
+
+      //Cache the fully rendered page in case of aggressive caching
+      if (variable_get('vocabindex_caching', FALSE)) {
+        cache_set('vocabindex_page_'. $vid, $output);
+      }
+    }
+  }
+  else {
+    $output = t('There are no categories to display.');
+  }
+
+  //Only add the stylesheet if the site administrator wants it
+  if (variable_get('vocabindex_stylesheet', TRUE)) {
+    drupal_add_css('modules/vocabindex/vocabindex-style.css', 'module', 'screen', FALSE);
+  }
+
+  return $output;
 }
 
 /**
-*Function to render a flat list
-*/
-function vocabindex_render_list_flat($list, $sort_by, $list_style)
-{
-	ksort($list);
-	
-	if($list_style=='flat-toplevel')
-	{
-		//Filter $list so only terms with $term->parents[0]==0 will be kept
-		$list_tmp=array();
-		foreach($list as $key => $term)
-		{
-			if($term->parents[0]==0)
-			{
-				$list_tmp[$key]=$term;
-			}
-		}
-		$list=$list_tmp;
-	}
-	
-	//Loop through all the terms from the list and render them
-	$i=1;
-	foreach($list as $term)
-	{
-		$zebra=($i%2==0?'even':'odd');
-		$url=url('taxonomy/term/'.$term->tid);
-		$url=($alias=drupal_lookup_path($url)?$alias:$url);
-		$output.=theme('vocabindex_list_item', $url, $term->name, $term->description, $zebra);
-		$i++;
-	}
-	
-	return $output;
+ * Function to render a flat list
+ */
+function vocabindex_render_list_flat($list, $sort_by, $list_style) {
+  ksort($list);
+
+  if ($list_style == 'flat-toplevel') {
+    //Filter $list so only terms with $term->parents[0]==0 will be kept
+    $list_tmp = array();
+    foreach ($list as $key => $term) {
+      if ($term->parents[0] == 0) {
+        $list_tmp[$key] = $term;
+      }
+    }
+    $list = $list_tmp;
+  }
+
+  //Loop through all the terms from the list and render them
+  $i = 1;
+  foreach ($list as $term) {
+    $zebra = ($i % 2 == 0 ? 'even' : 'odd');
+    $url = url('taxonomy/term/'. $term->tid);
+    $url = ($alias = drupal_lookup_path($url) ? $alias : $url);
+    $output .= theme('vocabindex_list_item', $url, $term->name, $term->description, $zebra);
+    $i++;
+  }
+
+  return $output;
 }
 
 /**
-*Function to render a threaded list
-*/
-function vocabindex_render_list_threaded($list, $sort_by)
-{
-	//A list of terms that are parents
-	$parents=array();
-	//A list of the depths all terms are at.
-	$depths=array();
-	//Maximum depth.
-	$max_depth=0;
-	
-	//Set up all the arrays necessary for rendering the eventual list
-	foreach($list as $term)
-	{			
-		foreach($term->parents as $parent)
-		{
-			//Build up a list of terms that are parents
-			$parents[$parent][]=$term->tid;
-			
-			//Set up an array with all the depths so we can render the list from the inside out later on
-			$depths[$term->depth][]=$term;
-			if($term->depth>$max_depth)
-			{
-				//And to know where to start rendering we need to know the maximum depth
-				$max_depth=$term->depth;
-			}
-		}
-		
-	}
-		
-	//Render the list from the inside out
-	$rendered_terms=array();
-	for($i=$max_depth; $i>=0; $i--)
-	{
-		//Loop through all the terms at this depth
-		foreach($depths[$i] as $term)
-		{
-			//Check if term is a parent
-			if($parents[$term->tid])
-			{
-				//The term is a parent. Because we render inside out all the children have been rendered already and can simply be put together
-				foreach($parents[$term->tid] as $child)
-				{
-					$children.=$rendered_terms[$child];
-				}
-				$children=theme('vocabindex_list', $children);
-			}
-			
-			//Render term
-			$url=url('taxonomy/term/'.$term->tid);
-			$url=($alias=drupal_lookup_path($url)?$alias:$url);
-			$rendered_terms[$term->tid]=theme('vocabindex_list_item', $url, $term->name, $term->description, NULL, $children);
-			
-			//And clear all children
-			$children=NULL;
-		}
-	}
-	
-	//Put the top-level terms together
-	foreach($depths[0] as $term)
-	{
-		$output.=$rendered_terms[$term->tid];
-	}
-	
-	return $output;
-}
\ No newline at end of file
+ * Function to render a threaded list
+ */
+function vocabindex_render_list_threaded($list, $sort_by) {
+  //A list of terms that are parents
+  $parents = array();
+  //A list of the depths all terms are at.
+  $depths = array();
+  //Maximum depth.
+  $max_depth = 0;
+
+  //Set up all the arrays necessary for rendering the eventual list
+  foreach ($list as $term) {
+    foreach ($term->parents as $parent) {
+      //Build up a list of terms that are parents
+      $parents[$parent][] = $term->tid;
+
+      //Set up an array with all the depths so we can render the list from the inside out later on
+      $depths[$term->depth][] = $term;
+      if ($term->depth > $max_depth) {
+        //And to know where to start rendering we need to know the maximum depth
+        $max_depth = $term->depth;
+      }
+    }
+
+  }
+
+  //Render the list from the inside out
+  $rendered_terms = array();
+  for ($i = $max_depth; $i >= 0; $i--) {
+    //Loop through all the terms at this depth
+    foreach ($depths[$i] as $term) {
+      //Check if term is a parent
+      if ($parents[$term->tid]) {
+        //The term is a parent. Because we render inside out all the children have been rendered already and can simply be put together
+        foreach ($parents[$term->tid] as $child) {
+          $children .= $rendered_terms[$child];
+        }
+        $children = theme('vocabindex_list', $children);
+      }
+
+      //Render term
+      $url = url('taxonomy/term/'. $term->tid);
+      $url = ($alias=drupal_lookup_path($url) ? $alias : $url);
+      $rendered_terms[$term->tid] = theme('vocabindex_list_item', $url, $term->name, $term->description, NULL, $children);
+
+      //And clear all children
+      $children = NULL;
+    }
+  }
+
+  //Put the top-level terms together
+  foreach ($depths[0] as $term) {
+    $output .= $rendered_terms[$term->tid];
+  }
+
+  return $output;
+}
Index: vocabindex_list_item.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex_list_item.tpl.php,v
retrieving revision 1.1.2.2.4.1
diff -u -r1.1.2.2.4.1 vocabindex_list_item.tpl.php
--- vocabindex_list_item.tpl.php	10 Feb 2008 12:34:58 -0000	1.1.2.2.4.1
+++ vocabindex_list_item.tpl.php	19 May 2008 19:30:12 -0000
@@ -1,6 +1,7 @@
 <?php
-if($description)
-{
-	$description='<span class="description">'.$description.'</span>';
+// $Id$
+
+if ($description) {
+  $description = '<span class="description">'. $description .'</span>';
 }
-echo '<li class="'.$zebra.($children?' parent':NULL).'"><a href="'.$url.'">'.$name.$description.'</a>'.$children."</li>\n";
\ No newline at end of file
+echo '<li class="'. $zebra . ($children ? ' parent' : NULL) .'"><a href="'. $url .'">'. $name . $description .'</a>'. $children ."</li>\n";
\ No newline at end of file
Index: vocabindex_page.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/vocabindex/vocabindex_page.tpl.php,v
retrieving revision 1.1
diff -u -r1.1 vocabindex_page.tpl.php
--- vocabindex_page.tpl.php	7 Jan 2008 19:34:19 -0000	1.1
+++ vocabindex_page.tpl.php	19 May 2008 19:30:12 -0000
@@ -1,7 +1,7 @@
 <?php
-if($description)
-{
-echo '<p class="vocabindex-desc">'.$description.'</p>';
+// $Id$
+
+if ($description) {
+  echo '<p class="vocabindex-desc">'. $description .'</p>';
 }
 echo $list;
-?>
\ No newline at end of file
