--- tmp/notify.module	2004-07-01 15:40:10.957722920 +0200
+++ Documents/Projecten/DPL_drupal/repository/drupal44/contributions/modules/notify/notify.module	2004-04-21 08:13:57.000000000 +0200
@@ -1,6 +1,5 @@
 <?php
 // $Id: notify.module,v 2.49 2004/04/09 14:51:12 weitzman Exp $
-// edited: Aldo Hoeben, 2004/07/01
 
 function notify_help($section) {
   switch ($section) {
@@ -77,14 +76,12 @@
         if ($notify->moderate) {
           $body .= strtr(t("%status %type by %author: %title"), array("%status" => "queued", "%type" => $node->type, "%title" => $node->title, "%author" => ($node->name ? $node->name : variable_get(anonymous, "Anonymous")))) ."\n";
           $body .= notify_content($node, $notify);
-		  // 040701AH Applied patch by Capnj (http://drupal.org/node/view/7166#comment-7892)
-          $body .= "  [ ". url("queue/view/$node->nid", NULL, NULL, TRUE) ." ]\n\n";
+          $body .= "  [ ". url("queue/view/$node->nid") ." ]\n\n";
         }
         elseif (!$notify->moderate && $node->nid) {
           $body .= strtr(t("%status %type by %author: %title"), array("%status" => "published", "%type" => $node->type, "%title" => $node->title, "%author" => ($node->name ? $node->name : variable_get(anonymous, "Anonymous")))) ."\n";
           $body .= notify_content($node, $notify);
-		  // 040701AH Applied patch by Capnj (http://drupal.org/node/view/7166#comment-7892)
-		  $body .= "  [ ". url("node/view/$node->nid", NULL, NULL, TRUE) ." ]\n\n";
+          $body .= "  [ ". url("node/view/$node->nid") ." ]\n\n";
         }
       }
     }
@@ -102,9 +99,8 @@
           $nid_old = $nid;
         }
         foreach ($comment as $c) {
-		  // 040701AH Applied patch by Capnj (http://drupal.org/node/view/7166#comment-7892)
           $body .= "  ". strtr(t("%title by %author"), array("%title" => $c->subject, "%author" => ($c->name ? $c->name : variable_get(anonymous, "Anonymous")))) ."\n"
-                .  "    ". url("node/view/$nid/$c->cid#$c->cid", NULL, NULL, TRUE) ."\n\n";
+                .  "    ". url("node/view/$nid/$c->cid#$c->cid") ."\n\n";
         }
       }
     }
@@ -144,13 +140,12 @@
 }
 
 function notify_link($type) {
-  // 040701AH changed positions/titles in menu
   if ($type == "system") {
     if (user_access('access notify')) {
-      menu("user/notify", t("email notification"), "notify_page");
+      menu("notify", t("my notify settings"), "notify_page", 0);
     }
     if (user_access("administer notify")) {
-      menu("admin/user/notify", t("notifications"), "notify_admin");
+      menu("admin/user/notify", "notifications", "notify_admin", NULL, 8);
     }
   }
 
@@ -190,54 +185,38 @@
 }
 
 function notify_admin() {
-  // 040701AH Fixed to show/edit all users instead of only users that have set 
-  // notification settings, fixed theming.
-  
   $op = $_POST["op"];
 
   switch ($op) {
     case "Save":
       $edit = $_POST["edit"];
       foreach ($edit as $uid=>$settings) {
-		// 040701AH Changed to create a new entry in the db in the user doesn't
-		// have one yet
-		$result = db_query("SELECT uid FROM {notify} WHERE uid = %d", $uid);
-
-		if (is_object(db_fetch_object($result))) {
-          db_query("UPDATE {notify} SET status = %d, node = %d, teasers = %d, comment = %d WHERE uid = %d", $settings['status'], $settings['node'], $settings['teasers'], $settings['comment'], $uid);
-		} else if ($settings['status']) {
-          db_query("INSERT INTO {notify} (uid,status,node,teasers,comment) VALUES (%d,%d,%d,%d,%d)", $uid, $settings['status'], $settings['node'], $settings['teasers'], $settings['comment']);
-		}
+        db_query("UPDATE {notify} SET node = %d, teasers = %d, comment = %d WHERE uid = %d", $settings['node'], $settings['teasers'], $settings['comment'], $uid);
       }
     default:
-      // 040701AH Using n.* instead of listing all the n. cells NULLs the uid 
-	  // cells when a notify entry is not available;
-      $result = db_query("SELECT u.uid, u.name, u.mail, n.status, n.node, n.comment, n.attempts, n.teasers FROM {users} u LEFT JOIN {notify} n ON n.uid = u.uid WHERE u.status = 1 ORDER BY u.name");
-	  $header = array (t("username"), t("email address"), t("enable"), t("content"), t("teasers"), t("comment"), t("failed attempts"));
+      $result = db_query("SELECT u.uid, u.name, u.mail, n.* FROM {users} u LEFT JOIN {notify} n ON u.uid = n.uid WHERE n.status = 1 AND u.status = 1 ORDER BY u.name");
+      $header = array (t("username"), t("email address"), t("content"), t("teasers"), t("comment"), t("failed attempts"));
       $i = 0;
       while ($notify = db_fetch_object($result)) {
-		$rows[$i][] = format_name($notify);
+        $rows[$i][] = format_name($notify);
         $rows[$i][] = $notify->mail;
         // 030312AX TODO: it really is a shame that we cannot use form_* functions
         // here (as they wrap everything into <p>title description</p>). implement
         // this once (see mailing list)!
-		// 040701AH Removed hidden form elements that didn't do anything
-		// Reenstated the status field
-        $rows[$i][] = '<input type="checkbox" name="edit['. $notify->uid .'][status]" value="1"'. ($notify->status ? ' checked="checked"' : '') .'>';
-        $rows[$i][] = '<input type="checkbox" name="edit['. $notify->uid .'][node]" value="1"'.   ($notify->node   ? ' checked="checked"' : '') .'>';
+        //$rows[$i][] = form_hidden("$notify->uid][status", 0) ."<input type=\"checkbox\" name=\"edit[$notify->uid][status]\"". ($notify->status ? " checked=\"checked\"" : "") .">";
+        $rows[$i][] = form_hidden("$notify->uid][node", 0) .'<input type="checkbox" name="edit['. $notify->uid .'][node]" value="1"'. ($notify->node ? ' checked="checked"' : '') .'>';
         $select = "";
         foreach (array(t("Title only"), t("Title + Teaser"), t("Title + Body")) as $key => $choice) {
           $select .= '<option value="'. $key .'"'. ($key == $notify->teasers ? " selected=\"selected\"" : "") .">$choice</option>";
         }
         $rows[$i][] = '<select name="edit['. $notify->uid .'][teasers]">'. $select .'</select>';
-        $rows[$i][] = '<input type="checkbox" name="edit['. $notify->uid .'][comment]" value="1"'. ($notify->comment ? ' checked="checked"' : '') .">";
+        $rows[$i][] = form_hidden("$notify->uid][comment", 0) .'<input type="checkbox" name="edit['. $notify->uid .'][comment]" value="1"'. ($notify->comment ? ' checked="checked"' : '') .">";
         $rows[$i][] = $notify->attempts;
         $i++;
       }
+      $rows[$i][] = form_submit("Save");
       $output = theme("table", $header, $rows);
-	  $output .= form_submit("Save");
-	  // 040701AH fixed formatting
-      print theme("page", form($output));
+      print form($output);
   }
 }
 
