summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Douglass2006-02-27 17:29:13 (GMT)
committerRobert Douglass2006-02-27 17:29:13 (GMT)
commit3ed0b75b14211297050b8c5cf5c87b265d04079b (patch)
treef2bc97fa84e439a066711cec48743b3fbd45f4bc
parent468a35b0692e36331f0e4ae5a924bb5f3ceee1ed (diff)
MySQL tables created with install hook. We need PostgreSQL help with this.
Removed stuff that doesn't work in 4.7 yet: contrib/buddylist_access
-rw-r--r--CREDITS3
-rw-r--r--INSTALL.txt56
-rw-r--r--README.txt126
-rw-r--r--TODO4
-rwxr-xr-xbuddylist.install66
-rw-r--r--buddylist.mysql31
-rw-r--r--buddylist.pgsql6
7 files changed, 178 insertions, 114 deletions
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index 399e4ce..0000000
--- a/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-Written by Adrian Rossouw <adrian@daemon.co.za>
-Thanks to Ratko Kovacina for the comments/debugging info
-Browsing improvements by Doug Sikora
diff --git a/INSTALL.txt b/INSTALL.txt
deleted file mode 100644
index 6a32719..0000000
--- a/INSTALL.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-Readme
-------
-This module allows users to put each other on a personal 'Buddy List' ,
-also enabling them to keep up with their friend's postings via the 'My Friend's Blogs' block.
-
-Send comments to adrian@daemon.co.za.
-
-Requirements
-------------
-This module requires Drupal 4.4.0 or CVS from March 25 2004 or later.
-
-Installation
-------------
-1. Create the SQL tables. This depends a little on your system, but the most
- common method is:
- mysql -u username -ppassword drupal < buddylist.mysql
-
- Postgres database initialization file is also included, but not tested.
-
-2. Copy the buddylist.module to the Drupal modules/ directory.
-
-3. Enable buddy list in the "site settings | modules" administration screen.
-
-4. Enable buddy list blocks you want in the "blocks" administration screen.
-
-5. Optionally add the following theme function to your PHPTemplate's template.php file:
-
-function phptemplate_username($object) {
- global $user;
- /* Use the default theme_username for anonymous users, nodes by this user */
- if ($user->uid == 0 || $object->uid == $user->uid || $object->uid == 0) {
- return theme_username($object);
- }
- if (!user_access('maintain buddy list')) {
- return theme_username($object);
- }
-
- /* an array, keyed on buddy uids */
- $buddies = buddylist_get_buddies($user->uid);
- /* Find out if this buddy is in the user's buddy list */
- foreach ($buddies as $buddyuid => $buddystructure) {
- if ($buddyuid == $object->uid) {
- $output .= theme_username($object);
- $output .= " (";
- $output .= theme('remove_from_buddylist_link', $object);
- $output .= ")";
- return $output;
- }
- }
- /* The user is not in the buddylist, give a link to add */
- $output .= theme_username($object);
- $output .= " (";
- $output .= theme('add_to_buddylist_link', $object);
- $output .= ")";
- return $output;
-}
diff --git a/README.txt b/README.txt
index f0c3ffa..f968102 100644
--- a/README.txt
+++ b/README.txt
@@ -1,9 +1,117 @@
-Readme
-------
-This module allows users to put each other on a personal 'Buddy List' ,
-also enabling them to keep up with their friend's postings via the 'My Friend's Blogs' block.
-
-Users may put their buddies into groups, like many instant messaging applications. These groups may be used for controlling access to nodes using the buddylist_access.module
-
-Send comments to walkah@walkah.net.
-
+Readme
+------
+This module allows users to put each other on a personal 'Buddy List'.
+
+Features include buddy groups and the ability to track your buddies' recent posts.
+
+Send comments to Robert Douglass at: http://drupal.org/user/5449/contact
+
+
+Requirements
+------------
+This module requires Drupal 4.7.
+
+This module does not yet offer PostgreSQL support. If you would like to contribute to this module by creating the appropriate PostgreSQL schema, please submit your code at http://drupal.org/project/issues/buddylist
+
+
+Upgrading from 4.6
+------------------
+WARNING: There is currently no migration path from 4.6 to 4.7. There are significant database schema changes and the 4.7 module will not work with the 4.6 schema. A migration path is forthcoming. If you need one sooner, contact me: http://drupal.org/user/5449/contact
+
+
+Installation
+------------
+1. Copy the buddylist.module to the Drupal modules/ directory.
+
+2. Enable buddy list in the "site settings | modules" administration screen.
+
+ Enabling the buddylist module will trigger the creation of the database schema. If you are shown error messages you may have to create the schema by hand. Please see the database definition at the end of this file.
+
+3. Enable buddy list blocks you want in the "blocks" administration screen.
+
+4. Optionally add the following theme function to your PHPTemplate's template.php file:
+
+function phptemplate_username($object) {
+ global $user;
+ /* Use the default theme_username for anonymous users, nodes by this user */
+ if ($user->uid == 0 || $object->uid == $user->uid || $object->uid == 0) {
+ return theme_username($object);
+ }
+ if (!user_access('maintain buddy list')) {
+ return theme_username($object);
+ }
+
+ /* an array, keyed on buddy uids */
+ $buddies = buddylist_get_buddies($user->uid);
+ /* Find out if this buddy is in the user's buddy list */
+ foreach ($buddies as $buddyuid => $buddystructure) {
+ if ($buddyuid == $object->uid) {
+ $output .= theme_username($object);
+ $output .= " (";
+ $output .= theme('remove_from_buddylist_link', $object);
+ $output .= ")";
+ return $output;
+ }
+ }
+ /* The user is not in the buddylist, give a link to add */
+ $output .= theme_username($object);
+ $output .= " (";
+ $output .= theme('add_to_buddylist_link', $object);
+ $output .= ")";
+ return $output;
+}
+
+
+Database Schema
+---------------
+If the automatic creation of the database tables was unsuccessful you can try creating the tables by hand using the following SQL:
+
+CREATE TABLE `buddylist` (
+ `uid` int(10) unsigned NOT NULL default '0',
+ `buddy` int(10) unsigned NOT NULL default '0',
+ `timestamp` int(11) NOT NULL default '0',
+ `received` tinyint(1) NOT NULL default '0',
+ UNIQUE KEY `uid-buddy-label` (`uid`,`buddy`),
+ KEY `uid` (`uid`)
+) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+
+--
+-- Table structure for table `buddylist_buddy_group`
+--
+
+CREATE TABLE `buddylist_buddy_group` (
+ `uid` int(11) NOT NULL default '0',
+ `buddy` int(11) NOT NULL default '0',
+ `label_id` int(11) NOT NULL default '0',
+ PRIMARY KEY (`uid`,`buddy`,`label_id`)
+) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+
+--
+-- Table structure for table `buddylist_groups`
+--
+
+CREATE TABLE `buddylist_groups` (
+ `uid` int(11) NOT NULL default '0',
+ `label_id` int(11) NOT NULL default '0',
+ `label` varchar(255) NOT NULL default '',
+ `visible` tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (`uid`,`label_id`)
+) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+
+
+Credits
+-------
+Written by Adrian Rossouw.
+Thanks to Ratko Kovacina for the comments/debugging info
+Browsing improvements by Doug Sikora
+
+Maintainer: Robert Douglass
+Status: maintained (Feb. 2006)
+
+TODO
+----
+1. PGSQL schema (see buddylist.install, buddylist_install())
+2. Rework texts so that one is not stuck with "buddy" but could choose "contact", for example
+3. Make a workflow whereby a buddy request is sent to the buddy for confirmation which is required before the buddy can be added.
+4. Make the notification that someone added you to their buddylist use the privatemsg module, if available.
+5. Consider possible Views module integration. \ No newline at end of file
diff --git a/TODO b/TODO
deleted file mode 100644
index e74cb12..0000000
--- a/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-- Using Node Api, create access restrictions whereby users can set nodes to be private,public or buddies only.
-- Add key to pgsql file
-- Update translations
-- Audit permissions
diff --git a/buddylist.install b/buddylist.install
index f484e7b..e16ac6f 100755
--- a/buddylist.install
+++ b/buddylist.install
@@ -1,5 +1,61 @@
-<?php
-function buddylist_update_1() {
- return _system_update_utf8(array('buddylist'));
-}
-?> \ No newline at end of file
+<?php
+
+/**
+ * Install the initial schema.
+ */
+function buddylist_install() {
+ switch ($GLOBALS['db_type']) {
+ case 'mysql':
+ case 'mysqli':
+ $query1 = db_query(
+ <<<MYSQL_UPDATE
+ CREATE TABLE buddylist (
+ uid int(10) unsigned NOT NULL default '0',
+ buddy int(10) unsigned NOT NULL default '0',
+ timestamp int(11) NOT NULL default '0',
+ received tinyint(1) NOT NULL default '0',
+ UNIQUE KEY uid-buddy-label (uid, buddy),
+ KEY uid (uid)
+ ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+MYSQL_UPDATE
+ );
+
+ $query2 = db_query(
+ <<<MYSQL_UPDATE
+ CREATE TABLE `buddylist_buddy_group` (
+ uid int(11) NOT NULL default '0',
+ buddy int(11) NOT NULL default '0',
+ label_id int(11) NOT NULL default '0',
+ PRIMARY KEY (uid, buddy, label_id)
+) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+MYSQL_UPDATE
+ );
+
+ $query3 = db_query(
+ <<<MYSQL_UPDATE
+ CREATE TABLE buddylist_groups (
+ uid int(11) NOT NULL default '0',
+ label_id int(11) NOT NULL default '0',
+ label varchar(255) NOT NULL default '',
+ visible tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (uid, label_id)
+ ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
+MYSQL_UPDATE
+ );
+
+ if ($query1 && $query2 && $query3) {
+ $created = TRUE;
+ }
+ break;
+ }
+ if ($created) {
+ drupal_set_message(t('Buddylist module installed successfully.'));
+ }
+ else {
+ drupal_set_message(t('Table installation for the Buddylist module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries.'), 'error');
+ }
+}
+
+function buddylist_update_1() {
+ return _system_update_utf8(array('buddylist'));
+} \ No newline at end of file
diff --git a/buddylist.mysql b/buddylist.mysql
deleted file mode 100644
index 1957f25..0000000
--- a/buddylist.mysql
+++ /dev/null
@@ -1,31 +0,0 @@
-CREATE TABLE `buddylist` (
- `uid` int(10) unsigned NOT NULL default '0',
- `buddy` int(10) unsigned NOT NULL default '0',
- `timestamp` int(11) NOT NULL default '0',
- `received` tinyint(1) NOT NULL default '0',
- UNIQUE KEY `uid-buddy-label` (`uid`,`buddy`),
- KEY `uid` (`uid`)
-) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
-
---
--- Table structure for table `buddylist_buddy_group`
---
-
-CREATE TABLE `buddylist_buddy_group` (
- `uid` int(11) NOT NULL default '0',
- `buddy` int(11) NOT NULL default '0',
- `label_id` int(11) NOT NULL default '0',
- PRIMARY KEY (`uid`,`buddy`,`label_id`)
-) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
-
---
--- Table structure for table `buddylist_groups`
---
-
-CREATE TABLE `buddylist_groups` (
- `uid` int(11) NOT NULL default '0',
- `label_id` int(11) NOT NULL default '0',
- `label` varchar(255) NOT NULL default '',
- `visible` tinyint(1) NOT NULL default '0',
- PRIMARY KEY (`uid`,`label_id`)
-) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */; \ No newline at end of file
diff --git a/buddylist.pgsql b/buddylist.pgsql
deleted file mode 100644
index 703c2a6..0000000
--- a/buddylist.pgsql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE buddylist (
- uid integer NOT NULL default 0,
- buddy integer NOT NULL default 0,
- timestamp integer NOT NULL default 0
-);
-ALTER TABLE buddylist ADD COLUMN received smallint NOT NULL;