Index: modules/bookmarks/CHANGELOG
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks/CHANGELOG,v
retrieving revision 1.7
diff -u -r1.7 CHANGELOG
--- modules/bookmarks/CHANGELOG	9 Aug 2005 13:27:32 -0000	1.7
+++ modules/bookmarks/CHANGELOG	9 Aug 2005 14:27:27 -0000
@@ -1,3 +1,5 @@
+Add optional login reminder. (deekayen)
+
 9 Aug 2005
 -----------
 Issue 27109, PostgreSQL DB schema. (Daniel)
Index: modules/bookmarks/README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks/README.txt,v
retrieving revision 1.2
diff -u -r1.2 README.txt
--- modules/bookmarks/README.txt	5 Nov 2004 19:43:58 -0000	1.2
+++ modules/bookmarks/README.txt	23 Jul 2005 20:59:57 -0000
@@ -43,6 +43,7 @@
 
 Marco Molinari <marco [at] porciletto.org>
 Al Maw         <drupal [at] almaw.com>
+David Norman   <deekayen [at] deekayen.net>
 Matt Westgate  <drupal [at] asitis.org>
 Gabor Hojtsy   <goba [at] php.net> (active maintainer)
 
@@ -56,7 +57,7 @@
 The module was mostly rewritten in October 2003 to support arbitrary
 Drupal URL bookmarks by Gabor Hojtsy (<goba [at] php.net>). Matt Westgate
 rewritten the module to make it capable of handling outbound links in
-February 2004.
+February 2004. David Norman added the optional login reminder in July 2005.
 
 TODO
 ------------------------------------------------------------------------------
Index: modules/bookmarks/bookmarks.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks/bookmarks.module,v
retrieving revision 1.36
diff -u -r1.36 bookmarks.module
--- modules/bookmarks/bookmarks.module	21 Apr 2005 21:42:21 -0000	1.36
+++ modules/bookmarks/bookmarks.module	23 Jul 2005 21:01:00 -0000
@@ -25,6 +25,8 @@
 
 /**
  * Implementation of hook_help().
+ *
+ * @return string
  */
 function bookmarks_help($section) {
   switch ($section) {
@@ -60,10 +62,30 @@
 }
 
 /**
+ * Settings Hook
+ *
+ * @return
+ *   string of form content or error message
+ */
+function bookmarks_settings() {
+  // only administrators can access this module
+  if (!user_access('administer bookmarks')) {
+    return message_access();
+  }
+  $group = form_checkbox(t('activate login reminder'), 'bookmarks_activate_login_reminder',
+             1, variable_get('bookmarks_activate_login_reminder', 0) == 0 ? false : true,
+             t('Add optional username and password input fields to the bookmark creation form that will display on the bookmark list as a login reminder'));
+  $output = form_group(t('Login reminder'), $group);
+  return $output;
+}
+
+/**
  * Implementation of hook_perm().
+ *
+ * @return array
  */
 function bookmarks_perm() {
-  return array('access bookmarks');
+  return array('access bookmarks', 'administer bookmarks');
 }
 
 /********************************************************************
@@ -78,10 +100,10 @@
 **/
 
 /**
- Returns an user's bookmarks block.
-
- @return array the paramter to pass to the block function.
-**/
+ * Returns an user's bookmarks block.
+ *
+ * @return array the paramter to pass to the block function.
+ */
 function theme_bookmarks_block() {
 
   global $user;
@@ -116,11 +138,11 @@
 }
 
 /**
- Returns a bookmarks delete icon.
-
- @param bookmark_url The URL of the page to remove
- @return string the delete icon to be emitted
-**/
+ * Returns a bookmarks delete icon.
+ *
+ * @param bookmark_url The URL of the page to remove
+ * @return string the delete icon to be emitted
+ */
 function theme_bookmarks_delete($url) {
   global $user;
 
@@ -199,13 +221,22 @@
   }
 }
 
+/**
+ * @return string of form content
+ */
 function bookmarks_form($edit = null) {
   $group = form_textfield(t('Title'), 'title', $edit['title'], 60, 128, null, null, true);
-  $group .= form_textfield(t('URL'), 'url', $edit['url'], 60, 128, t('Enter the address of the page you want to bookmark. This can be an internal or external reference.'), null, true);
+  $group .= form_textfield(t('URL'), 'url', $edit['url'], 60, 128, t('Enter the address of the page you want to bookmark. This can be an internal or external reference. Don\'t forget to prefix external links with http://'), null, true);
   $group .= form_hidden('old_url', urlencode($edit['url']));
-  $group .= form_submit(t('Save'));
   $form = form_group(t('Bookmark details'), $group);
 
+  if(variable_get('bookmarks_activate_login_reminder', 0) == 1) {
+    $group = form_textfield(t('Username'), 'uname', $edit['uname'], 30, 80, null, null, false);
+    $group .= form_textfield(t('Password'), 'pword', $edit['pword'], 30, 50, null, null, false);
+    $form .= form_group(t('Login reminder'), $group, 'Optionally store a username and/or password for this bookmark as a reminder.');
+  }
+  $form .= form_submit(t('Save'));
+
   return form($form);
 }
 
@@ -252,6 +283,12 @@
   return $edit;
 }
 
+/**
+ * @return
+ *   An associative array representing the next row of the result.
+ *   The keys of this object are the names of the table fields selected by the query,
+ *   and the values are the field values for this result row.
+ */
 function bookmarks_load_weblink($nid) {
   return db_fetch_array(db_query('SELECT n.title, w.weblink url FROM {node} n, {weblink} w WHERE n.nid = w.nid AND n.nid = %d', $nid));
 }
@@ -262,15 +299,28 @@
 
   $header = array(
     array('data' => t('title'), 'field' => 'title', 'sort' => 'desc'),
-    array('data' => t('link'), 'field' => 'url'),
-    array('data' => t('operations'), 'colspan' => 2)
-  );
-  $sql = 'SELECT url, title FROM {bookmarks} WHERE uid = '. db_escape_string($user->uid). tablesort_sql($header);
+    array('data' => t('link'), 'field' => 'url'));
+
+  if(variable_get('bookmarks_activate_login_reminder', 0) == 1) {
+    $header[] = array('data' => t('username'), 'field' => 'uname');
+    $header[] = array('data' => t('password'), 'field' => 'pword');
+  }
+
+  $header[] = array('data' => t('operations'), 'colspan' => 2);
+  
+  $sql = 'SELECT url, title, uname, pword FROM {bookmarks} WHERE uid = '. db_escape_string($user->uid). tablesort_sql($header);
   $result = pager_query($sql, 50);
 
   while ($data = db_fetch_object($result)) {
-    $title = (strlen($data->url) > 50) ? substr($data->url, 0, 47). '...' : $data->url;
-    $rows[] = array($data->title, _bookmarks_get_link($data->url, $title), '&nbsp;'.l(t('edit'), "bookmarks/$user->uid/edit", null, 'url=' . urlencode($data->url)).' '. l(t('delete'), "bookmarks/$user->uid/delete", null, 'url=' . urlencode($data->url)));
+    $title    = (strlen($data->url) > 50) ? substr($data->url, 0, 47). '...' : $data->url;
+    $row_data = array($data->title, _bookmarks_get_link($data->url, $title));
+
+    if(variable_get('bookmarks_activate_login_reminder', 0) == 1) {
+      $row_data = array_merge($row_data, array($data->uname, $data->pword));
+    }
+
+    $row_data = array_merge($row_data, array('&nbsp;'.l(t('edit'), "bookmarks/$user->uid/edit", null, 'url=' . urlencode($data->url)).' '. l(t('delete'), "bookmarks/$user->uid/delete", null, 'url=' . urlencode($data->url))));
+    $rows[]   = $row_data;
   }
 
   $pager = theme('pager', null, 50, 0, tablesort_pager());
@@ -287,11 +337,23 @@
 
   $edit['old_url'] = urldecode($edit['old_url']);
   if ($edit['old_url'] && db_result(db_query("SELECT COUNT(uid) FROM {bookmarks} WHERE uid = %d AND url = '%s'", $user->uid, $edit['old_url']))) {
-    db_query("UPDATE {bookmarks} SET title = '%s', url = '%s' WHERE uid = %d AND url = '%s'", $edit['title'], $edit['url'], $user->uid, $edit['old_url']);
+    if(variable_get('bookmarks_activate_login_reminder', 0) == 1) {
+      db_query("UPDATE {bookmarks} SET title = '%s', url = '%s', uname = '%s', pword = '%s' WHERE uid = %d AND url = '%s'", $edit['title'], $edit['url'], $edit['uname'], $edit['pword'], $user->uid, $edit['old_url']);
+    }
+    else {
+      // login reminder is turned off, so set username and password to NULL
+      db_query("UPDATE {bookmarks} SET title = '%s', url = '%s', uname = NULL, pword = NULL WHERE uid = %d AND url = '%s'", $edit['title'], $edit['url'], $user->uid, $edit['old_url']);      
+    }
     drupal_set_message(t('The bookmark has been updated.'));
   }
   else {
-    db_query("INSERT INTO {bookmarks} (uid, url, title) VALUES (%d, '%s', '%s')", $user->uid, $edit['url'], $edit['title']);
+    if(variable_get('bookmarks_activate_login_reminder', 0) == 1) {
+      db_query("INSERT INTO {bookmarks} (uid, url, title, uname, pword) VALUES (%d, '%s', '%s', '%s', '%s')", $user->uid, $edit['url'], $edit['title'], $edit['uname'], $edit['pword']);
+    }
+    else {
+      // login reminder is turned off, so set username and password to NULL
+      db_query("INSERT INTO {bookmarks} (uid, url, title, uname, pword) VALUES (%d, '%s', '%s', NULL, NULL)", $user->uid, $edit['url'], $edit['title']);
+    }
     drupal_set_message(t('The link has been added to your bookmarks.'));
   }
 }
@@ -314,6 +376,10 @@
 
 /**
  * Return a relative URI that Drupal can recognize internally.
+ *
+ * @param $url
+ *   string
+ * @return string
  */
 function bookmarks_get_canonical_path($url) {
   global $base_url;
@@ -327,6 +393,12 @@
 
 /**
  * Generate a link based on the URL being internal or external
+ *
+ * @param $url
+ *   string
+ * @param $title
+ *   string
+ * @return string
  */
 function _bookmarks_get_link($url, $title) {
   return (preg_match("!^[a-zA-Z]+://!", $url)) ? "<a href=\"$url\">$title</a>" : l($title, $url);
Index: modules/bookmarks/bookmarks.mysql
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks/bookmarks.mysql,v
retrieving revision 1.2
diff -u -r1.2 bookmarks.mysql
--- modules/bookmarks/bookmarks.mysql	11 Oct 2003 18:46:36 -0000	1.2
+++ modules/bookmarks/bookmarks.mysql	9 Aug 2005 14:25:25 -0000
@@ -5,3 +5,4 @@
 );
 
 ALTER TABLE bookmarks ADD INDEX (uid);
+ALTER TABLE bookmarks ADD uname VARCHAR(80), ADD pword VARCHAR(50);
\ No newline at end of file
Index: modules/bookmarks/bookmarks.pgsql
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bookmarks/bookmarks.pgsql,v
retrieving revision 1.2
diff -u -r1.2 bookmarks.pgsql
--- modules/bookmarks/bookmarks.pgsql	9 Aug 2005 13:27:32 -0000	1.2
+++ modules/bookmarks/bookmarks.pgsql	9 Aug 2005 13:33:37 -0000
@@ -1,5 +1,7 @@
-CREATE TABLE bookmarks (
-  uid SERIAL PRIMARY KEY,
-  url VARCHAR(255) NOT NULL,
-  title VARCHAR(255) NOT NULL
-);
+CREATE TABLE bookmarks (
+  uid SERIAL PRIMARY KEY,
+  url VARCHAR(128) NOT NULL,
+  title VARCHAR(128) NOT NULL,
+  uname VARCHAR(80) default NULL,
+  pword VARCHAR(50) default NULL
+);
\ No newline at end of file
