--- cloud.module	Mon Jun 28 22:15:49 2004
+++ cloud.module.new	Mon Jun 28 22:11:32 2004
@@ -12,18 +12,18 @@
       $output .= "<li>Drupal's cron function, triggers the cloud module to check all the registered web sites for recent changes or updates.  (A page is updated when there is an <i>x</i>-byte difference since the last time it checked, where <i>x</i> is a configuration option.)</li>";
       $output .= " <li>The module exports both a page and a block that display the registered sites ordered by their last modification date.</li>";
       $output .= "</ul>";
-      $output = t($output, array("%cloud-add" => l(t("content") ." &raquo; ". t("syndication") ." &raquo; ". t("site cloud") ." &raquo; ". t("add new site"), "admin/node/syndication/cloud/add")));
+      $output = t($output, array("%cloud-add" => l(t("content") ." &raquo; ". t("syndication") ." &raquo; ". t("site cloud") ." &raquo; ". t("add new site"), "admin/settings/cloud/add")));
       break;
     case 'cloud':
       $output .= t("<p>The cloud monitor tracks or crawls other interesting web sites and displays their latest modification dates.  It acts as a link watcher such that you can keep an eye on the other sites in the cloud.</p>");
       break;
-    case 'admin/system/modules#description':
+    case 'admin/modules#description':
       $output = t("Tracks other sites and displays last date changed.");
       break;
-    case 'admin/node/syndication/cloud':
-      $output = t("The cloud monitor tracks or crawls other interesting web sites and displays their last modification dates. Visitors to this site learn about other relevant sites and can easily see if there is new content. To get this working you <b>must</b> setup cron support. To get the site cloud block to display you must turn on the <i>site cloud</i> block in %block. To go to a monitored site, click on the site name, to immediately load and/or update the record for a site, click on \"update site\", to delete a site go to \"edit site\". ", array("%block" => l(t("administer") ." &raquo; ". t("configuration") ." &raquo; ". t("blocks"), "admin/block")));
+    case 'admin/settings/cloud':
+      $output = t("The cloud monitor tracks or crawls other interesting web sites and displays their last modification dates. Visitors to this site learn about other relevant sites and can easily see if there is new content. To get this working you <b>must</b> setup cron support. To get the site cloud block to display you must turn on the <i>site cloud</i> block in %block. To go to a monitored site, click on the site name, to immediately load and/or update the record for a site, click on \"update site\", to delete a site go to \"edit site\". ", array("%block" => l(t("administer") ." &raquo; ". t("settings") ." &raquo; ". t("blocks"), "admin/block")));
       break;
-    case 'admin/node/syndication/cloud/add':
+    case 'admin/settings/cloud/add':
       $output = t("Add a site to the site cloud. Don't forget the \"http://\" for your URLs.");
       break;
   }
@@ -43,25 +43,35 @@
   return array("access site cloud", "administer site cloud");
 }
 
+/**
+ * Implementation of hook_link()
+ */
+
 function cloud_link($type) {
-  $links = array();
+  $items = array();
 
   if ($type == "page" && user_access("access site cloud")) {
-    $links[] = l(t("site cloud"), "cloud", array("title" => t("Monitor other sites in the cloud.")));
+    $items[] = l(t("site cloud"), "cloud", array("title" => t("Monitor other sites in the cloud.")));
   }
+  return $items;
+}
 
-  if ($type == "system") {
-    if (user_access("access site cloud")) {
-      menu('cloud', t('site cloud'), 'cloud_page', NULL, MENU_HIDE);
-    }
-    if (user_access("administer site cloud")) {
-      menu("admin/node/syndication/cloud", t("site cloud"), "cloud_admin");
-      menu("admin/node/syndication/cloud/add", t("add new site"), "cloud_admin");
-      menu("admin/node/syndication/cloud/help", t("help"), "cloud_help", 9);
-    }
-  }
+/**
+ * Implementation of hook_menu()
+ */
+
+function cloud_menu() {
+  $items = array();
 
-  return $links;
+  $items[] = array('path' => 'cloud', 'callback' => 'cloud_page','title' => t('site cloud'), 'access' => user_access('access site cloud'),'type' => 'callback');
+
+  // Admin > Settings:
+  $items[] = array('path' => 'admin/settings/cloud','callback' => 'cloud_admin','title' => t('site cloud'),'access' => user_access('administer site cloud'));
+
+  // Tabs:
+  $items[] = array('path' => 'admin/settings/cloud/add','callback' => 'cloud_admin','title' => t('add new site'),'access' => user_access('administer site cloud'),'type' => MENU_LOCAL_TASK);
+
+  return $items;
 }
 
 function cloud_update($site) {
@@ -71,11 +81,11 @@
   */
 
   if (!ereg("^http://|https://|ftp://", $site["link"])) {
-    watchdog("warning", "cloud: invalid or missing URL for '". $site["name"] ."'", l(t("edit site"), "admin/node/syndication/cloud/edit/". $site["sid"]));
+    watchdog("warning", "cloud: invalid or missing URL for '". $site["name"] ."'", l(t("edit site"), "admin/settings/cloud/". $site["sid"]. "edit/"));
   }
 
   if (!ereg("^http://|https://|ftp://", $site["feed"])) {
-    watchdog("warning", "cloud: invalid or missing URL to monitor for '". $site["name"] ."'", l(t("edit site"), "admin/node/syndication/cloud/edit/". $site["sid"]));
+    watchdog("warning", "cloud: invalid or missing URL to monitor for '". $site["name"] ."'", l(t("edit site"), "admin/settings/cloud/". $site["sid"]. "edit/"));
   }
 
   /*
@@ -146,7 +156,7 @@
 
   $header = array(t("site"), t("last update"), array("data" => t("operations"), "colspan" => 2));
   while ($site = db_fetch_object($result)) {
-    $rows[] = array("<a href=\"$site->link\">$site->name</a>", ($site->changed ? format_interval(time() - $site->changed) ." ago" : "never"), l(t("edit site"), "admin/node/syndication/cloud/edit/$site->sid"), l(t("update site"), "admin/node/syndication/cloud/update/$site->sid"));
+    $rows[] = array("<a href=\"$site->link\">$site->name</a>", ($site->changed ? format_interval(time() - $site->changed) ." ago" : "never"), l(t("edit site"), "admin/settings/cloud/$site->sid/edit"), l(t("update site"), "admin/settings/cloud/$site->sid/update"));
   }
 
   return theme("table", $header, $rows);
@@ -217,7 +227,13 @@
   $edit = $_POST["edit"];
 
   if (empty($op)) {
-    $op = arg(4);
+    // check if URL contains a cloud-id
+    if (is_numeric(arg(3))) {
+      $op = arg(4);
+    }
+    else {
+      $op = arg(3);
+    }
   }
 
   if (user_access("administer site cloud")) {
@@ -226,10 +242,10 @@
         $output = cloud_form();
         break;
       case "edit":
-        $output = cloud_form(cloud_get_site(arg(5)));
+        $output = cloud_form(cloud_get_site(arg(3)));
         break;
       case "update":
-        drupal_set_message(cloud_update(cloud_get_site(arg(5))));
+        drupal_set_message(cloud_update(cloud_get_site(arg(3))));
         $output .= cloud_display();
         break;
      case "Delete":
