cvs diff: Diffing modules/signup
Index: modules/signup/INSTALL.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/INSTALL.txt,v
retrieving revision 1.7
diff -u -p -r1.7 INSTALL.txt
--- modules/signup/INSTALL.txt 6 Apr 2007 16:57:00 -0000 1.7
+++ modules/signup/INSTALL.txt 10 May 2007 18:51:32 -0000
@@ -72,4 +72,16 @@ the Drupal package and read the online d
privilege.
-7. Start signing up!
+7. (Optional) If you have enabled the views module on your site
+ (http://drupal.org/project/views), be sure you are running views
+ version 5.x-1.6-beta5 or later. After installing views and signup,
+ you should be sure to clear the views cache to ensure that the
+ default views defined by this module will be used. Visit
+ admin/build/views/tools and press the "Clear views cache" button.
+ The official views 5.x-1.6 release and later versions should no
+ longer need this extra step. Once you have everything installed
+ and working, you should consider customizing any of the
+ signup-related views to better suit the needs of your site.
+
+
+8. Start signing up!
Index: modules/signup/README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/README.txt,v
retrieving revision 1.8
diff -u -p -r1.8 README.txt
--- modules/signup/README.txt 18 Apr 2007 18:39:48 -0000 1.8
+++ modules/signup/README.txt 10 May 2007 18:51:33 -0000
@@ -22,6 +22,8 @@ signup module.
For installation instructions, see INSTALL.txt.
+For instructions on upgrading, see UPGRADE.txt.
+
Send feature requests and bug reports to the issue tracking system for
the signup module: http://drupal.org/node/add/project_issue/signup.
For a list of future work, also see TODO.txt.
Index: modules/signup/UPGRADE.txt
===================================================================
RCS file: modules/signup/UPGRADE.txt
diff -N modules/signup/UPGRADE.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/signup/UPGRADE.txt 10 May 2007 18:51:33 -0000
@@ -0,0 +1,37 @@
+$Id$
+
+======================================================================
+This file contains specific instructions for upgrading your site's
+version of signup.module to a new release. You should always check
+this file when you download a new version to see if there are any
+specific things you need to know about a certain upgrade.
+======================================================================
+
+
+* Upgrading to 5.x-2.2 (from any earlier version)
+
+ The 5.x-2.2 release improves support for the views.module, by moving
+all of the hard-coded parts of the signup interface that can be
+implemented with views into a separate file (signup_no_views.inc).
+This file is only included if the views.module is not enabled on your
+site. Now, you have full control to modify the "Current signups"
+block and the listing of current signups at user/[#]/signups using the
+views administrative user interface (admin/build/views).
+
+ However, this means that if your site had the old "List of users
+current signups" block enabled, and you have the views.module
+installed (or install it at any point when running signup 5.x-2.2 or
+later), you will have to manually enable the "Current signups" block
+(which might also have the name "signup_current_signups") by visiting
+the admin/build/block page on your site.
+
+ After upgrading to signup 5.x-2.2 on a site already running views,
+or after installing views on a site already running 5.x-2.2 or later,
+if you don't see the user/[#]/signups page, you need to clear your
+views cache. Visit admin/build/views/tools and press the "Clear views
+cache" button.
+
+ NOTE: the default views that are defined by signup_views.inc work
+best with at least views version 5.x-1.6-beta5 or later. The problems
+with the views cache described above should be fixed in the official
+5.x-1.6 and later versions of views.
Index: modules/signup/signup.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.install,v
retrieving revision 1.12
diff -u -p -r1.12 signup.install
--- modules/signup/signup.install 21 Apr 2007 01:31:37 -0000 1.12
+++ modules/signup/signup.install 10 May 2007 18:51:33 -0000
@@ -83,7 +83,6 @@ function signup_install() {
}
break;
}
-
if ($created) {
drupal_set_message(t('Signup module installed successfully.'));
}
Index: modules/signup/signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.module,v
retrieving revision 1.107
diff -u -p -r1.107 signup.module
--- modules/signup/signup.module 10 May 2007 07:30:30 -0000 1.107
+++ modules/signup/signup.module 10 May 2007 18:51:34 -0000
@@ -5,44 +5,7 @@
* @defgroup signup_core Core drupal hooks
*/
-/**
- * Implementation of hook_block().
- * @ingroup signup_core
- * @param $op
- * The operation that is being requested. This defaults to 'list', which
- * indicates that the method should return which blocks are available.
- * @param $delta
- * The specific block to display (the offset into an array).
- * @return
- * One of two possibilities. The first is an array of available blocks.
- * The other is an array containing a block.
- */
-function signup_block($op = 'list', $delta = 0) {
- global $user;
- switch ($op) {
- case 'list' :
- $blocks[0]['info'] = t('List of users current signups.');
- return $blocks;
- break;
- case 'view' :
- if (user_access('access content')) {
- switch ($delta) {
- case 0:
- $titles = signup_list_user_signups($user->uid);
- if (count($titles)) {
- $block['subject'] = t('Current Signups');
- $block['content'] = theme_item_list($titles) . l(t('View signup schedule'), "user/$user->uid/signups");
- }
- return $block;
- }
- }
- }
-}
-
function signup_init() {
- if (module_exists('views')) {
- require './'. drupal_get_path('module', 'signup'). '/signup_views.inc';
- }
}
/**
@@ -183,15 +146,17 @@ function signup_menu($may_cache) {
// Include other php code that we need when not serving cached pages:
include_once(drupal_get_path('module', 'signup') . '/signup.theme');
- // User signup schedule callback
- $items[] = array(
- 'path' => 'user/'. arg(1) .'/signups',
- 'access' => ($access || ($user->uid == arg(1))),
- 'type' => MENU_CALLBACK,
- 'callback' => 'signup_user_schedule',
- 'callback arguments' => array($uid => arg(1)),
- );
-
+ // Conditionally load either the views support, or the code that
+ // only should happen if views is not enabled.
+ $signup_path = './'. drupal_get_path('module', 'signup');
+ if (module_exists('views')) {
+ require_once($signup_path .'/signup_views.inc');
+ }
+ else {
+ require_once($signup_path .'/signup_no_views.inc');
+ signup_no_views_menu($items, $may_cache);
+ }
+
// If it's a signup-enabled node, then put in a signup tab for admins.
if (arg(0) == 'node' && is_numeric(arg(1)) && db_num_rows(db_query("SELECT nid FROM {signup} WHERE nid = %d", arg(1)))) {
$node = node_load(array('nid' => arg(1)));
@@ -237,24 +202,6 @@ function signup_perm() {
}
/**
- * Implementation of hook_user().
- * @ingroup signup_core
- */
-function signup_user($op, &$edit, &$user, $category = NULL) {
- switch ($op) {
- case 'view':
- // grab list of events the user signed up for.
- $signups = signup_list_user_signups($user->uid);
- if (count($signups)) {
- $output = '
'. t('Current Signups') .' -- '. l(t('view signup schedule'), "user/$user->uid/signups") .'
'. theme_item_list($signups);
- }
- if (isset($output)) {
- return array(t('Signup information') => array(array('value' => $output, 'class' => 'user')));
- }
- }
-}
-
-/**
* Implementation of hook_form_alter().
* @ingroup signup_core
*/
@@ -1044,11 +991,10 @@ function signup_list_user_signups($uid)
if ($uid != 0) {
$has_event = module_exists('event');
$event_join = $has_event ? ' LEFT JOIN {event} e ON e.nid = n.nid' : '';
- $event_where = $has_event ? ' AND (e.event_start >= '. time() . ' OR e.event_start IS NULL)' : '';
$order_by = $has_event ? 'e.event_start' : 'n.title';
// Pull all open signup nodes for this user.
- $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n INNER JOIN {signup_log} s_l ON n.nid = s_l.nid $event_join WHERE s_l.uid = '%s' $event_where ORDER BY $order_by"), $uid);
+ $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n INNER JOIN {signup_log} s_l ON n.nid = s_l.nid INNER JOIN {signup} s ON n.nid = s.nid $event_join WHERE s_l.uid = '%s' AND s.status = 1 ORDER BY $order_by"), $uid);
while ($node = db_fetch_array($result)) {
$titles[$node['nid']] = l($node['title'], 'node/'. $node['nid']);
}
@@ -1185,26 +1131,6 @@ function signup_sign_up_user($signup_for
}
/**
- * Prints a schedule of the given user's signups.
- * @ingroup signup_callback
- */
-function signup_user_schedule($uid) {
- $output = '';
- $user = user_load(array('uid' => $uid));
- if (!$user) {
- drupal_not_found();
- return;
- }
- drupal_set_title(t('Signups for @user', array('@user' => $user->name)));
- $titles = signup_list_user_signups($user->uid);
- foreach ($titles as $nid => $title) {
- $node = node_load(array('nid' => $nid));
- $output .= theme('signup_user_schedule', $node);
- }
- return $output;
-}
-
-/**
* Prints the signup details for a single node when the signups tab is clicked
* @ingroup signup_callback
*/
Index: modules/signup/signup_no_views.inc
===================================================================
RCS file: modules/signup/signup_no_views.inc
diff -N modules/signup/signup_no_views.inc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/signup/signup_no_views.inc 10 May 2007 18:51:34 -0000
@@ -0,0 +1,100 @@
+uid);
+ if (count($titles)) {
+ $block['subject'] = t('Current signups');
+ $block['content'] = theme_item_list($titles) . l(t('View signup schedule'), "user/$user->uid/signups");
+ }
+ return $block;
+ }
+ }
+ }
+}
+
+/**
+ * Implementation of hook_user().
+ * @ingroup signup_core
+ */
+function signup_user($op, &$edit, &$user, $category = NULL) {
+ switch ($op) {
+ case 'view':
+ // grab list of events the user signed up for.
+ $signups = signup_list_user_signups($user->uid);
+ if (count($signups)) {
+ $output = ''. t('Current Signups') .' -- '. l(t('view signup schedule'), "user/$user->uid/signups") .'
'. theme_item_list($signups);
+ }
+ if (isset($output)) {
+ return array(t('Signup information') => array(array('value' => $output, 'class' => 'user')));
+ }
+ }
+}
+
+/**
+ * Menu items we only need to define if views is not enabled.
+ */
+function signup_no_views_menu(&$items, $may_cache) {
+ global $user;
+ $access = user_access('administer all signups');
+ if (!$may_cache) {
+ // User signup schedule callback
+ $items[] = array(
+ 'path' => 'user/'. arg(1) .'/signups',
+ 'access' => ($access || ($user->uid == arg(1))),
+ 'type' => MENU_CALLBACK,
+ 'callback' => 'signup_user_schedule',
+ 'callback arguments' => array($uid => arg(1)),
+ );
+ }
+}
+
+/**
+ * Prints a schedule of the given user's signups.
+ * @ingroup signup_callback
+ */
+function signup_user_schedule($uid) {
+ $output = '';
+ $user = user_load(array('uid' => $uid));
+ if (!$user) {
+ drupal_not_found();
+ return;
+ }
+ drupal_set_title(t('Signups for @user', array('@user' => $user->name)));
+ $titles = signup_list_user_signups($user->uid);
+ foreach ($titles as $nid => $title) {
+ $node = node_load(array('nid' => $nid));
+ $output .= theme('signup_user_schedule', $node);
+ }
+ return $output;
+}
Index: modules/signup/signup_views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup_views.inc,v
retrieving revision 1.2
diff -u -p -r1.2 signup_views.inc
--- modules/signup/signup_views.inc 21 Apr 2007 01:31:37 -0000 1.2
+++ modules/signup/signup_views.inc 10 May 2007 18:51:34 -0000
@@ -4,8 +4,12 @@
* @file
* Provides support for Views integration.
*
- * Currently, this only exposes signup-related data, but does not
- * define any default views.
+ * This exposes signup-related data and provides fields, filters,
+ * sorts, and arguments.
+ *
+ * Additionally, default views for standard parts of the signup UI are
+ * defined here. If views is not enabled, these UI elements are
+ * implemented in signup_no_views.inc.
*/
/**
@@ -335,3 +339,92 @@ function views_handler_filter_signup_uid
$query->add_where("%s = 0", $field);
}
}
+
+/**
+ * Default views for core features of the signup UI that should always
+ * be enabled and available.
+ *
+ * For now, this is just a single view that implements the user's
+ * signup schedule at user/N/signups and the "Current signups" block.
+ */
+function signup_views_default_views() {
+ $view = new stdClass();
+ $view->name = 'signup_current_signups';
+ $view->description = t('A list of all signups for the current user');
+ $view->access = array (
+);
+ $view->view_args_php = 'if ($type == \'block\') {
+ global $user;
+ return array(0 => $user->uid);
+}
+';
+ $view->page = TRUE;
+ $view->page_title = t('Current signups');
+ $view->page_header = '';
+ $view->page_header_format = '1';
+ $view->page_footer = '';
+ $view->page_footer_format = '1';
+ $view->page_empty = t('This user has not signed up for any content.');
+ $view->page_empty_format = '1';
+ $view->page_type = 'list';
+ $view->url = 'user/$arg/signups';
+ $view->use_pager = TRUE;
+ $view->nodes_per_page = '20';
+ $view->menu = TRUE;
+ $view->menu_title = t('Signups');
+ $view->menu_tab = TRUE;
+ $view->menu_tab_weight = '10';
+ $view->menu_tab_default = FALSE;
+ $view->block = TRUE;
+ $view->block_title = t('Current signups');
+ $view->block_header = '';
+ $view->block_header_format = '1';
+ $view->block_footer = 'uid/signups");
+?>
+';
+ $view->block_footer_format = '2';
+ $view->block_empty = '';
+ $view->block_empty_format = '1';
+ $view->block_type = 'list';
+ $view->nodes_per_block = '10';
+ $view->block_more = TRUE;
+ $view->block_use_page_header = FALSE;
+ $view->block_use_page_footer = FALSE;
+ $view->block_use_page_empty = FALSE;
+ $view->sort = array();
+ $view->argument = array(
+ array(
+ 'type' => 'signup_uid',
+ 'argdefault' => '1',
+ 'title' => '',
+ 'options' => '1',
+ 'wildcard' => '',
+ 'wildcard_substitution' => '',
+ ),
+ );
+ $view->field = array(
+ array(
+ 'tablename' => 'node',
+ 'field' => 'title',
+ 'label' => '',
+ 'handler' => 'views_handler_field_nodelink_with_mark',
+ 'sortable' => '1',
+ 'options' => 'link',
+ ),
+ );
+ $view->filter = array(
+ array(
+ 'tablename' => 'signup',
+ 'field' => 'status',
+ 'operator' => '=',
+ 'options' => '',
+ 'value' => '1',
+ ),
+ );
+ $view->exposed_filter = array();
+ $view->requires = array(node, signup);
+ $views[$view->name] = $view;
+ return $views;
+}
cvs diff: Diffing modules/signup/contrib
cvs diff: Diffing modules/signup/contrib/signup_conflicts
cvs diff: Diffing modules/signup/contrib/signup_ecommerce
cvs diff: Diffing modules/signup/po