? gsitemap.info
? gsitemap.install
Index: gsitemap.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gsitemap/gsitemap.module,v
retrieving revision 1.52
diff -u -p -r1.52 gsitemap.module
--- gsitemap.module	25 May 2006 04:52:08 -0000	1.52
+++ gsitemap.module	19 Oct 2006 21:47:45 -0000
@@ -11,10 +11,9 @@
  */
 function gsitemap_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      return t('Creates a Google Sitemap at q=gsitemap');
     case 'admin/settings/gsitemap':
-      return t('The following options allow you to alter the behavior of the Google Sitemap module.');
+      $link = url('gsitemap', NULL, NULL, TRUE);
+      return t('The following options allow you to alter the behavior of the Google Sitemap module. Your sitemap can be found at <a href="!link">@link</a>.', array('@link' => $link, '!link' => $link));
   }
 }
 
@@ -33,17 +32,25 @@ function gsitemap_menu($may_cache) {
   $items = array();
 
   if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/gsitemap',
+      'title' => t('google sitemap'),
+      'description' => t('Adjust the settings used to generate your sitemap.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'gsitemap_admin_settings',
+      'access' => user_access('administer site configuration'),
+    );
 
     $items[] = array('path' => 'gsitemap', 'title' => t('gsitemap'),
-        'callback' => 'gsitemap_output',
-        'type' => MENU_CALLBACK,
-        'access' => 1);
+      'callback' => 'gsitemap_output',
+      'type' => MENU_CALLBACK,
+      'access' => 1);
 
     if($verify = variable_get('gsitemap_verify','')) {
       $items[] = array('path' => $verify, 'title' => t('gsitemap verification page'),
-          'callback' => 'gsitemap_verify', 
-          'type' => MENU_CALLBACK,
-          'access' => 1);
+        'callback' => 'gsitemap_verify', 
+        'type' => MENU_CALLBACK,
+        'access' => 1);
     }
   }
 
@@ -55,19 +62,19 @@ function gsitemap_form_alter($form_id, &
   if (user_access('override node priority') && isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
     $node = $form['#node'];
     $form['gsitemap_settings'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('gsitemap Settings'),
-        '#collapsible' => TRUE,
-        '#collapsed' => TRUE,
-        );
+      '#type' => 'fieldset',
+      '#title' => t('gsitemap Settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
     $form['gsitemap_settings']['priority_override'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Priority override'),
-        '#default_value' => $node->priority_override,
-        '#size' => 10,
-        '#maxlength' => 5,
-        '#description' => t('Optionally specify a value for the priority in the Google Sitemap, or -1 to prevent it from appearing in the sitemap.'),
-        );
+      '#type' => 'textfield',
+      '#title' => t('Priority override'),
+      '#default_value' => $node->priority_override,
+      '#size' => 10,
+      '#maxlength' => 5,
+      '#description' => t('Optionally specify a value for the priority in the Google Sitemap, or -1 to prevent it from appearing in the sitemap.'),
+    );
   }
 }
 
@@ -179,108 +186,108 @@ function gsitemap_comment($op, $comment)
 }
 
 /**
- * Implementation of hook_settings().
+ * Settings form
  */
-function gsitemap_settings() {
+function gsitemap_admin_settings() {
   $form['priority_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Priority Settings'),
-      '#collapsible' => TRUE,
-      );
+    '#type' => 'fieldset',
+    '#title' => t('Priority Settings'),
+    '#collapsible' => TRUE,
+  );
   $form['priority_settings']['gsitemap_frontpage'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Front page priority'),
-      '#default_value' => variable_get('gsitemap_frontpage', '1.0'),
-      '#size' => 10,
-      '#maxlength' => 5,
-      '#description' => t('This is the absolute priority for the front page.  Values can range between 0.0 and 1.0.'),
-      );
+    '#type' => 'textfield',
+    '#title' => t('Front page priority'),
+    '#default_value' => variable_get('gsitemap_frontpage', '1.0'),
+    '#size' => 10,
+    '#maxlength' => 5,
+    '#description' => t('This is the absolute priority for the front page.  Values can range between 0.0 and 1.0.'),
+  );
   $form['priority_settings']['gsitemap_promotewt'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Promotion adjustment'),
-      '#default_value' => variable_get('gsitemap_promotewt', 0.3),
-      '#size' => 10,
-      '#maxlength' => 5,
-      '#description' => t('This number will be added to the priority of each node that is promoted to the front page.'),
-      );
+    '#type' => 'textfield',
+    '#title' => t('Promotion adjustment'),
+    '#default_value' => variable_get('gsitemap_promotewt', 0.3),
+    '#size' => 10,
+    '#maxlength' => 5,
+    '#description' => t('This number will be added to the priority of each node that is promoted to the front page.'),
+  );
   $form['priority_settings']['gsitemap_commentwt'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Comment ratio weight'),
-      '#default_value' => variable_get('gsitemap_commentwt', 0.5),
-      '#size' => 10,
-      '#maxlength' => 5,
-      '#description' => t('This number will be multiplied with the ratio of the number of comments on the node over the number of comments on the node with the most comments, i.e., this number will be added to the priority of the node with the most comments.'),
-      );
+    '#type' => 'textfield',
+    '#title' => t('Comment ratio weight'),
+    '#default_value' => variable_get('gsitemap_commentwt', 0.5),
+    '#size' => 10,
+    '#maxlength' => 5,
+    '#description' => t('This number will be multiplied with the ratio of the number of comments on the node over the number of comments on the node with the most comments, i.e., this number will be added to the priority of the node with the most comments.'),
+  );
 
   // markup
   $form['priority_settings']['note'] = array(
-      '#type' => 'markup',
-      '#value' => t('You can enter -1 in any of the following fields to prevent nodes of that type from appearing in the sitemap.'),
-      );
+    '#type' => 'markup',
+    '#value' => t('You can enter -1 in any of the following fields to prevent nodes of that type from appearing in the sitemap.'),
+  );
 
   foreach(node_get_types() as $type => $name) {
     $form['priority_settings']['gsitemap_'. $type .'wt'] =  array(
-        '#type' => 'textfield',
-        '#title' => t('%name adjustment', array('%name' => ucfirst($name))),
-        '#default_value' => variable_get('gsitemap_'. $type .'wt', 0.1),
-        '#size' => 10,
-        '#maxlength' => 5,
-        '#description' => t('This number will be added to the priority of nodes of type %name.', array('%name' => $name)),
-        );
+      '#type' => 'textfield',
+      '#title' => t('%name adjustment', array('%name' => ucfirst($name))),
+      '#default_value' => variable_get('gsitemap_'. $type .'wt', 0.1),
+      '#size' => 10,
+      '#maxlength' => 5,
+      '#description' => t('This number will be added to the priority of nodes of type %name.', array('%name' => $name)),
+    );
   }
 
   $form['other_settings'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Other Settings'),
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      );
+    '#type' => 'fieldset',
+    '#title' => t('Other Settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
   $form['other_settings']['gsitemap_verify'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Verification link'),
-      '#return value' => '',
-      '#default_value' => variable_get('gsitemap_verify',''),
-      '#description' => t('In order to view stats, Google will ask you to verify that you control this site by creating a page with a certain name.  Enter that name here and the gsitemap module will hook that filename.  Note that this will only work if you have clean URLs enabled.'),
-      );
+    '#type' => 'textfield',
+    '#title' => t('Verification link'),
+    '#return value' => '',
+    '#default_value' => variable_get('gsitemap_verify',''),
+    '#description' => t('In order to view stats, Google will ask you to verify that you control this site by creating a page with a certain name.  Enter that name here and the gsitemap module will hook that filename.  Note that this will only work if you have clean URLs enabled.'),
+  );
   $form['other_settings']['gsitemap_countcom'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Count comments in change date and frequency'),
-      '#return_value' => 1,
-      '#default_value' => variable_get('gsitemap_countcom', 1),
-      '#description' => t('If enabled, the frequency of comments on a node will affect its change frequency and last modification date.'),
-      );
+    '#type' => 'checkbox',
+    '#title' => t('Count comments in change date and frequency'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('gsitemap_countcom', 1),
+    '#description' => t('If enabled, the frequency of comments on a node will affect its change frequency and last modification date.'),
+  );
   $form['other_settings']['gsitemap_showterms'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Include links to taxonomy term pages'),
-      '#return_value' => 1,
-      '#default_value' => variable_get('gsitemap_showterms', 0),
-      '#description' => t('If enabled, links to taxonomy term pages will be included in the sitemap.'),
-      );
+    '#type' => 'checkbox',
+    '#title' => t('Include links to taxonomy term pages'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('gsitemap_showterms', 0),
+    '#description' => t('If enabled, links to taxonomy term pages will be included in the sitemap.'),
+  );
   $form['other_settings']['gsitemap_submit'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Submit sitemap to Google when updated'),
-      '#return_value' => 1,
-      '#default_value' => variable_get('gsitemap_submit', 0),
-      '#description' => t('If enabled, the sitemap will be submitted to Google via HTTP request each time it is updated.  If you have submitted your sitemap using a Google Account, this is probably unnecessary.'),
-      );
+    '#type' => 'checkbox',
+    '#title' => t('Submit sitemap to Google when updated'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('gsitemap_submit', 0),
+    '#description' => t('If enabled, the sitemap will be submitted to Google via HTTP request each time it is updated.  If you have submitted your sitemap using a Google Account, this is probably unnecessary.'),
+  );
   $form['other_settings']['gsitemap_cron_submit'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Submit sitemap to Google on cron run'),
-      '#return_value' => 1,
-      '#default_value' => variable_get('gsitemap_cron_submit', 0),
-      '#description' => t('If enabled, the sitemap will be submitted to Google via HTTP request each time the cron job is run.  If you have submitted your sitemap using a Google Account, this is probably unnecessary.'),
-      );
+    '#type' => 'checkbox',
+    '#title' => t('Submit sitemap to Google on cron run'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('gsitemap_cron_submit', 0),
+    '#description' => t('If enabled, the sitemap will be submitted to Google via HTTP request each time the cron job is run.  If you have submitted your sitemap using a Google Account, this is probably unnecessary.'),
+  );
   $form['other_settings']['gsitemap_logacc'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Log accesses'),
-      '#return_value' => 1,
-      '#default_value' => variable_get('gsitemap_logacc', 0),
-      '#description' => t('If enabled, an watchdog entry will be made each time the sitemap is accessed, containing information about the requestor.'),
-      );
+    '#type' => 'checkbox',
+    '#title' => t('Log accesses'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('gsitemap_logacc', 0),
+    '#description' => t('If enabled, an watchdog entry will be made each time the sitemap is accessed, containing information about the requestor.'),
+  );
 
   menu_rebuild(); // Needed for verification link
 
-  return $form;
+  return system_settings_form($form);
 }
 
 function gsitemap_cron() {
