Index: headerimage.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/headerimage/headerimage.module,v
retrieving revision 1.13.2.7
diff -u -p -r1.13.2.7 headerimage.module
--- headerimage.module	28 Jul 2008 09:31:00 -0000	1.13.2.7
+++ headerimage.module	29 Jul 2008 19:20:19 -0000
@@ -588,43 +588,67 @@ function headerimage_nodeapi(&$node, $op
 function headerimage_help($path, $arg) {
   switch ($path) {
     case 'admin/help#headerimage':
-      // Determine the status of the installation
-      $type_is_set = count(variable_get('headerimage_node_type', array())) ? t('(DONE)') : t('(TO DO)');
-      $block_is_created = count(headerimage_get_blocks()) ? t('(DONE)') : t('(TO DO)');
+      $output  = "<p>". t('Header Image allows you to to display an image on selected pages. It can display one image at the front page, a different one at FAQ pages and yet another at all other pages.') ."</p>\n";
+      $output .= "<p>". t('Visibility of each image, included in a node, can be determined by node ID, path, taxonomy, book, node type or custom PHP code. Header Image uses an arbitrary node type.') ."</p>\n";
+      $output .= "<p>". t('Multiple images (nodes) can be displayed in one block, with each image having its own conditions. Using a weight per node the order of selection can be controlled.') ."</p>\n";
+      $output .= "<h2>". t('Configuration') ."</h2>\n";
+      
+      // Determine the status of the Header Image configuration
+      $node_types = variable_get('headerimage_node_type', array());
+      
+      // See if someone's got permission to view header images
+      $count = db_result(db_query("SELECT COUNT(perm) FROM {permission} WHERE perm LIKE '%view header image%'"));
+      $status['permissions'] = $count > 0 ? 'ok' : (user_access('administer permissions') ? 'warning' : 'error');
+      
+      // Is the user allowed to create a new node type?
+      $status['node_type_created'] = user_access('admnister content types') ? NULL : 'error';
+      
+      // Has a node type been associated with Header Image?
+      $status['node_type_set'] = count($node_types) ? 'ok' : 'warning';
+      
+      // Has any Header Image block yet been created.
+      $status['block_created'] = count(headerimage_get_blocks()) ? 'ok' : 'warning';
+      
+      // Have any image nodes been created?
       foreach (headerimage_get_blocks() as $delta => $name) {
         $block_has_nodes = db_result(db_query("SELECT nid FROM {headerimage} WHERE block = %d", $delta));
         if ($block_has_nodes) break;
       }
-      $block_has_nodes = $block_has_nodes ? t('(DONE)') : t('(TO DO)');
+      $access = FALSE;
+      foreach ($node_types as $node_type) {
+        if (user_access('create ' . $node_type . 'content')) {
+          $access = TRUE;
+          break;
+        }
+      }
+      $status['block_has_nodes'] = $block_has_nodes ? 'ok' : ($access ? 'warning' : 'error');
+      
+      // Has a block been assigned to a region?
       foreach (headerimage_get_blocks() as $delta => $name) {
         $block_in_region = db_result(db_query("SELECT region FROM {blocks} WHERE module = '%s' AND theme = '%s' AND delta = %d", 'headerimage', variable_get('theme_default', 'garland'), $delta));
         if ($block_in_region) break;
       }
-      $block_in_region = $block_in_region ? t('(DONE)') : t('(TO DO)');
+      $status['block_assigned'] = $block_in_region ? 'ok' : (user_access('administer blocks') ? 'warning' : 'error');
+      
+      // Set up all configuration steps
+      $config['permissions'] = t('Set up <a href="!permissions">permissions</a>.', array('!permissions' => url('admin/user/permissions', array('fragment' => 'module-headerimage'))));
+      $config['node_type_created'] = t('Optionally <a href="!create_node_type">create a node type</a> which will contain the header image.', array('!create_node_type' => url('admin/content/types/add')));
+      $config['node_type_set'] = t('<a href="!set_node_type">Select a node type</a> to be used as Header Image.', array('!set_node_type' => url('admin/settings/headerimage/settings')));
+      $config['block_created'] = t('<a href="!create_header_image_block">Create a Header Image block</a>.', array('!create_header_image_block' => url('admin/settings/headerimage')));
+      $config['block_has_nodes'] = t('Create Header Image nodes. Select a Header Image block and set display conditions for each node.');
+      $config['block_assigned'] = t('<a href="!assign_header_image_block">Assign a Header Image block</a> to a region.', array('!assign_header_image_block' => url('admin/build/block')));
+
+      $output .= '<ol id="headerimage-config">' . "\n";
+      $header = array(t('Status'), t('Task'));
+      foreach ($config as $key => $message) {
+        if (!is_null($status[$key])) {
+          $icon = '<img src="'. url('misc/watchdog-'. $status[$key] .'.png') .'" title="'. $title[$key] .'" />';
+        }
+        $rows[] = array($icon, $message);
+      }
+      $output .= theme('table', $header, $rows);
+
       
-      $output  = "<p>". t('Header Image allows you to to display an image on selected pages. It can display one image at the front page, a different one at FAQ pages and yet another at all other pages.') ."</p>\n";
-      $output .= "<p>". t('Visibility of each image, included in a node, can be determined by node ID, path, taxonomy, book, node type or custom PHP code. Header Image uses an arbitrary node type.') ."</p>\n";
-      $output .= "<p>". t('Multiple images (nodes) can be displayed in one block, with each image having its own conditions. Using a weight per node the order of selection can be controlled.') ."</p>\n";
-      $output .= "<h2>". t('Installation') ."</h2>\n";
-      $output .= "<p>". t('<ol>
-<li>Set up <a href="!permissions">permissions</a>.</li>
-<li>Optionally <a href="!create_node_type">create a node type</a> which will contain the header image.</li>
-<li><a href="!set_node_type">Select a node type</a> to be used as Header Image. %status_type</li>
-<li><a href="!create_header_image_block">Create a Header Image block</a>. %status_create</li>
-<li>Create Header Image nodes. Select a Header Image block and set display conditions for each node. %status_assign</li>
-<li><a href="!assign_header_image_block">Assign the Header Image block</a> to a region. %status_region</li>
-</ol>', array(
-  '!permissions' => url('admin/user/permissions'),
-  '!create_node_type' => url('admin/content/types/add'),
-  '!set_node_type' => url('admin/settings/headerimage/settings'),
-  '%status_type' => $type_is_set,
-  '!create_header_image_block' => url('admin/settings/headerimage'),
-  '%status_create' => $block_is_created,
-  '!assign_header_image_block' => url('admin/build/block'),
-  '%status_assign' => $block_has_nodes,
-  '%status_region' => $block_in_region,
-  )
-) ."</p>\n";
       $output .= "<p>". t('For more information please read the <a href="@handbook">configuration and customization handbook</a> on Header Image.', array('@handbook' => 'http://drupal.org/node/201426/')) ."</p>\n";
       return $output;
   }
