cvs diff: Diffing . Index: INSTALL.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/INSTALL.txt,v retrieving revision 1.13.2.2 diff -u -p -r1.13.2.2 INSTALL.txt --- INSTALL.txt 22 Jan 2009 19:00:54 -0000 1.13.2.2 +++ INSTALL.txt 22 Sep 2009 07:32:22 -0000 @@ -101,23 +101,17 @@ the Drupal package and read the online d privilege. -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 or later. 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. For example, if you - are using the event module, you might want to add a filter to the - 'current signups' view to restrict it to events that have not - started yet. +7. (Optional) Consider customizing any of the signup-related views to + better suit the needs of your site. For example, if you are using + the event module, you might want to add a filter to the 'current + signups' view to restrict it to events that have not started yet. 8. (Optional) Configure if and how you want a list of users signed up for each node to appear. Under the 'Advanced settings' at admin/settings/signup, if the signup form and related information is being displayed on the node itself or on a separate tab, you will find a setting to control how you want the list of signed up - users to appear. You can either use the built-in listing, no - listing at all, or if you have enabled the Views module on your - site (see step #7 above), you can also embed a view for this. + users to appear. You can embed a view for this or leave it blank. There is a default view included called 'signup_user_list' which is disabled by default. If you enable this view to customize it at @@ -141,3 +135,4 @@ the Drupal package and read the online d 9. Start signing up! + Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/README.txt,v retrieving revision 1.14.2.1 diff -u -p -r1.14.2.1 README.txt --- README.txt 24 Jul 2009 17:52:08 -0000 1.14.2.1 +++ README.txt 22 Sep 2009 07:32:22 -0000 @@ -17,9 +17,13 @@ Both can receive confirmation and remind users are optionally able to cancel or edit their own signups and view listings of their current signups. -There is extensive integration with the Views module -(http://druapl.org/project/views), and also support to embed the -signup form as a pane using panels (http://druapl.org/project/panels). +The Views module (http://druapl.org/project/views) is a dependency +which is used to create various listings, and there is extensive views +support for your own customizations. Installing the View Bulk +Operations (VBO) module (http://druapl.org/project/views_bulk_operations) +is strongly encouraged to facilitate various administrative tasks. +There is also support to embed the signup form as a pane using panels +(http://druapl.org/project/panels). Some add-on modules that enhance the basic functionality are available in the "modules" subdirectory, and there is a listing of other add-on @@ -38,3 +42,4 @@ For a list of future work, also see http This module was originally co-developed by Chad Phillips and Jeff Robbins, and sponsored by Jeff Robbins. It is now being maintained by: Derek Wright (http://drupal.org/user/46549) a.k.a. "dww". + Index: UPGRADE.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/UPGRADE.txt,v retrieving revision 1.2.4.1 diff -u -p -r1.2.4.1 UPGRADE.txt --- UPGRADE.txt 20 Dec 2008 00:53:06 -0000 1.2.4.1 +++ UPGRADE.txt 22 Sep 2009 07:32:22 -0000 @@ -7,6 +7,11 @@ this file when you download a new versio specific things you need to know about a certain upgrade. ====================================================================== +* Upgrading to 6.x-1.0-rc6 (from any earlier version) + There is a new dependency on Views (http://drupal.org/project/views). +Be sure to install at least version 6.x-2.6 for the best results. + + * Upgrading to 6.x-1.0-rc3 (from any earlier version) There is a new permission called "cancel signups" which is required to cancel other user's signups at the signup administration tab at Index: signup.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.info,v retrieving revision 1.5.2.1 diff -u -p -r1.5.2.1 signup.info --- signup.info 19 Sep 2009 09:18:32 -0000 1.5.2.1 +++ signup.info 22 Sep 2009 07:32:22 -0000 @@ -2,4 +2,6 @@ name = Signup description = "Allow users to sign up for content (especially events)." package = Signup +dependencies[] = views core = 6.x + Index: signup.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.install,v retrieving revision 1.24.2.4 diff -u -p -r1.24.2.4 signup.install --- signup.install 19 Sep 2009 01:42:58 -0000 1.24.2.4 +++ signup.install 22 Sep 2009 07:32:23 -0000 @@ -482,3 +482,30 @@ function signup_update_6003() { return $ret; } +/** + * Make views a required dependency. + */ +function signup_update_6004() { + $ret = array(); + + $user_list = variable_get('signup_display_signup_user_list', ''); + if (!empty($user_list)) { + switch ($user_list) { + case 'signup': + variable_set('signup_display_signup_user_list', 'embed-view'); + break; + + case 'signup-tab': + variable_set('signup_display_signup_user_list', 'embed-view-tab'); + break; + } + } + + $admin_list = variable_get('signup_display_signup_admin_list', ''); + if (!empty($admin_list) && $admin_list == 'signup') { + variable_set('signup_display_signup_admin_list', 'embed-view'); + } + + return $ret; +} + Index: signup.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.module,v retrieving revision 1.205.2.34 diff -u -p -r1.205.2.34 signup.module --- signup.module 19 Sep 2009 01:42:58 -0000 1.205.2.34 +++ signup.module 22 Sep 2009 07:32:24 -0000 @@ -75,22 +75,6 @@ function signup_theme() { 'cooked_message' => NULL, ), ), - 'signup_user_list' => array( - 'file' => 'no_views.inc', - 'path' => $path, - 'arguments' => array( - 'node' => NULL, - 'registered_signups' => NULL, - 'anon_signups' => NULL, - ), - ), - 'signup_user_schedule' => array( - 'file' => 'no_views.inc', - 'path' => $path, - 'arguments' => array( - 'node' => NULL, - ), - ), 'signup_node_admin_page' => array( 'file' => 'node.admin.inc', 'path' => $path, @@ -108,13 +92,6 @@ function signup_theme() { 'form' => NULL, ), ), - 'signup_node_admin_details_form' => array( - 'file' => 'node.admin.inc', - 'path' => $path, - 'arguments' => array( - 'form' => NULL, - ), - ), 'signup_custom_data' => array( 'file' => 'node.admin.inc', 'path' => $path, @@ -424,12 +401,6 @@ function signup_menu() { 'file path' => $path, ); - // Add extra menu items if we're not using views. - if (!module_exists('views')) { - module_load_include('inc', 'signup', 'includes/no_views'); - signup_no_views_menu($items); - } - return $items; } @@ -493,8 +464,8 @@ function _signup_menu_access($node, $men case 'list-tab': // See if this user can view signups, and if the site is configured to // display the signup user list as a tab. - $user_list = variable_get('signup_display_signup_user_list', 'signup'); - if ($user_list == 'signup-tab' || $user_list == 'embed-view-tab') { + $user_list = variable_get('signup_display_signup_user_list', 'embed-view'); + if ($user_list == 'embed-view-tab') { $user_list_tab = TRUE; } else { @@ -671,14 +642,6 @@ function signup_user($type, &$edit, &$us } break; } - - // If we're not using views, we need to support additional user - // operations, for example, to add the user's current signup - // schedule to their user profile page. - if (!module_exists('views')) { - module_load_include('inc', 'signup', 'includes/no_views'); - return _signup_user_no_views($type, $edit, $user, $category); - } } /** @@ -780,8 +743,8 @@ function signup_nodeapi(&$node, $op, $te // a page, not during the view from comment validation, etc. if ($page && _signup_needs_output($node)) { $info_location = variable_get('signup_form_location', 'node'); - $list_location = variable_get('signup_display_signup_user_list', 'signup'); - if ($info_location == 'node' || $list_location == 'signup' || $list_location == 'embed-view') { + $list_location = variable_get('signup_display_signup_user_list', 'embed-view'); + if ($info_location == 'node' || $list_location == 'embed-view') { module_load_include('inc', 'signup', 'includes/node_output'); } if ($info_location == 'node') { @@ -805,7 +768,7 @@ function signup_nodeapi(&$node, $op, $te ); } } - if ($list_location == 'signup' || $list_location == 'embed-view') { + if ($list_location == 'embed-view') { $signup_list = signup_user_list_output($node); if (!empty($signup_list)) { if (module_exists('content')) { @@ -1045,8 +1008,7 @@ function signup_content_extra_fields($ty 'weight' => 10, ); } - $user_list = variable_get('signup_display_signup_user_list', 'signup'); - if ($user_list == 'signup' || $user_list == 'embed-view') { + if (variable_get('signup_display_signup_user_list', 'embed-view') == 'embed-view') { $extra['signup_node_list'] = array( 'label' => t('Signup user list'), 'description' => t('List of users currently signed up.'), cvs diff: Diffing includes Index: includes/admin.settings.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/admin.settings.inc,v retrieving revision 1.2.2.5 diff -u -p -r1.2.2.5 admin.settings.inc --- includes/admin.settings.inc 24 Jan 2009 08:52:46 -0000 1.2.2.5 +++ includes/admin.settings.inc 22 Sep 2009 07:32:24 -0000 @@ -46,13 +46,6 @@ function signup_settings_form() { '#default_value' => variable_get('signup_date_format', 'small'), '#description' => t('Whenever this module needs to print a date (both in the administrative interface, and in the various e-mail messages it can send), this setting controls which date format string to use. The format strings are defined at the Date and time settings page.', array('!settings_url' => url('admin/settings/date-time'))), ); - if (!module_exists('views')) { - $form['adv_settings']['signup_no_views_user_info'] = array( - '#title' => t('Display signup information on user profile pages'), - '#type' => 'checkbox', - '#default_value' => variable_get('signup_no_views_user_info', TRUE), - ); - } $form['adv_settings']['signup_form_location'] = array( '#title' => t('Location of the signup form'), @@ -91,96 +84,84 @@ function signup_settings_form() { '#suffix' => '', ); - $list_options = array(); - $list_options['signup'] = t('Use the signup-provided listing on each node'); - $list_options['signup-tab'] = t('Use the signup-provided listing under the %signups tab', array('%signups' => t('Signups'))); - $views_help_text = ''; - if (module_exists('views')) { - $list_options['embed-view'] = t('Embed a view on each node'); - $list_options['embed-view-tab'] = t('Embed a view under the %signups tab', array('%signups' => t('Signups'))); - $views_help_text = t('If you choose to embed a view, you will be able to select which view you want to use below. The view you select will have a single argument passed in, the node id (nid) of the signup-enabled node being viewed. You can also use views to display this listing on its own tab or in a block if you disable this setting.'); - } - else { - $views_help_text = t('If you enable the !views_url, you will be able to embed a view directly onto the page for this listing.', array('!views_url' => l(t('Views module'), 'http://drupal.org/project/views', array('absolute' => TRUE)))); - } - $list_options['none'] = t('Do not display a listing at all'); + $list_options = array( + 'embed-view' => t('Embed a view on each node'), + 'embed-view-tab' => t('Embed a view under the %signups tab', array('%signups' => t('Signups'))), + 'none' => t('Do not display a listing at all'), + ); $form['adv_settings']['signup_display_signup_user_list'] = array( '#title' => t('How to display the list of signed-up users'), '#type' => 'radios', '#options' => $list_options, - '#default_value' => variable_get('signup_display_signup_user_list', 'signup'), - '#description' => t('Users with the %view_signups permission can be presented with a list of all users who have signed up. This setting controls if, how, and where that list should be generated. !views_help_text', array('%view_signups' => t('view all signups'), '!views_help_text' => $views_help_text)), + '#default_value' => variable_get('signup_display_signup_user_list', 'embed-view'), + '#description' => t('Users with the %view_signups permission can be presented with a list of all users who have signed up. This setting controls if, how, and where that list should be generated. If you choose to embed a view, you will be able to select which view you want to use below. The view you select will have a single argument passed in, the node id (nid) of the signup-enabled node being viewed. You can also use views to display this listing on its own tab or in a block if you disable this setting.', array('%view_signups' => t('view all signups'))), '#prefix' => '
', '#suffix' => '
', '#weight' => 1, ); - $admin_options = array(); - $admin_options['signup'] = t('Use the signup-provided listing'); - if (module_exists('views')) { - $admin_options['embed-view'] = t('Embed a view'); - } - $admin_options['none'] = t('Do not display a listing at all'); + $admin_options = array( + 'embed-view' => t('Embed a view'), + 'none' => t('Do not display a listing at all'), + ); $form['adv_settings']['signup_display_signup_admin_list'] = array( '#title' => t('How to display the administrative list of signed-up users'), '#type' => 'radios', '#options' => $admin_options, '#default_value' => variable_get('signup_display_signup_admin_list', 'signup'), - '#description' => t('Users with permission to administer signups for a given node will see a list of users of all users who have signed up. This setting controls if and how that list should be generated. !views_help_text', array('%view_signups' => t('view all signups'), '!views_help_text' => $views_help_text)), + '#description' => t('Users with permission to administer signups for a given node will see a list of users of all users who have signed up. This setting controls if and how that list should be generated. If you choose to embed a view, you will be able to select which view you want to use below. The view you select will have a single argument passed in, the node id (nid) of the signup-enabled node being viewed. You can also use views to display this listing on its own tab or in a block if you disable this setting.', array('%view_signups' => t('view all signups'))), '#prefix' => '
', '#suffix' => '
', '#weight' => 5, ); - if (module_exists('views')) { - $class = 'signup-user-list-view-settings'; - $user_list = variable_get('signup_display_signup_user_list', 'signup'); - if ($user_list != 'embed-view' && $user_list != 'embed-view-tab') { - $class .= ' js-hide'; - } - $form['adv_settings']['view_settings'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#weight' => 2, - ); + $class = 'signup-user-list-view-settings'; + $user_list = variable_get('signup_display_signup_user_list', 'embed-view'); + if ($user_list == 'none') { + $class .= ' js-hide'; + } + $form['adv_settings']['view_settings'] = array( + '#prefix' => '
', + '#suffix' => '
', + '#weight' => 2, + ); - $views = views_get_all_views(); - foreach ($views as $view) { - foreach (array_keys($view->display) as $display_id) { - if ($display_id != 'default' || 1) { - $key = $view->name .':'. $display_id; - $view_options[$key] = theme('signup_settings_view_label', $view, $display_id); - } + $views = views_get_all_views(); + foreach ($views as $view) { + foreach (array_keys($view->display) as $display_id) { + if ($display_id != 'default' || 1) { + $key = $view->name .':'. $display_id; + $view_options[$key] = theme('signup_settings_view_label', $view, $display_id); } } - $form['adv_settings']['view_settings']['signup_user_list_view'] = array( - '#title' => t('View to embed for the signup user list'), - '#type' => 'select', - '#options' => $view_options, - '#default_value' => variable_get('signup_user_list_view', 'signup_user_list:default'), - '#description' => t("If the signup user list is being generated by embedding a view, this selects which view should be used. The view's name, description, and display(s) it defines are listed."), - ); - - $class = 'signup-admin-list-view-settings'; - if (variable_get('signup_display_signup_admin_list', 'signup') != 'embed-view') { - $class .= ' js-hide'; - } - $form['adv_settings']['admin_view_settings'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#weight' => 6, - ); + } + $form['adv_settings']['view_settings']['signup_user_list_view'] = array( + '#title' => t('View to embed for the signup user list'), + '#type' => 'select', + '#options' => $view_options, + '#default_value' => variable_get('signup_user_list_view', 'signup_user_list:default'), + '#description' => t("If the signup user list is being generated by embedding a view, this selects which view should be used. The view's name, description, and display(s) it defines are listed."), + ); - // $view_options is still initialized from above. - $form['adv_settings']['admin_view_settings']['signup_admin_list_view'] = array( - '#title' => t('View to embed for the signup administrative list'), - '#type' => 'select', - '#options' => $view_options, - '#default_value' => _signup_get_admin_list_view(), - '#description' => t("If the administer signups user list is being generated by embedding a view, this selects which view should be used. The view's name, description, and display(s) it defines are listed."), - ); + $class = 'signup-admin-list-view-settings'; + if (variable_get('signup_display_signup_admin_list', 'embed-view') != 'embed-view') { + $class .= ' js-hide'; } + $form['adv_settings']['admin_view_settings'] = array( + '#prefix' => '
', + '#suffix' => '
', + '#weight' => 6, + ); + + // $view_options is still initialized from above. + $form['adv_settings']['admin_view_settings']['signup_admin_list_view'] = array( + '#title' => t('View to embed for the signup administrative list'), + '#type' => 'select', + '#options' => $view_options, + '#default_value' => _signup_get_admin_list_view(), + '#description' => t("If the administer signups user list is being generated by embedding a view, this selects which view should be used. The view's name, description, and display(s) it defines are listed."), + ); // Use our own submit handler, so we can do some processing before // we hand control to system_settings_form_submit. Index: includes/no_views.inc =================================================================== RCS file: includes/no_views.inc diff -N includes/no_views.inc --- includes/no_views.inc 10 Aug 2009 17:45:53 -0000 1.15.2.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,145 +0,0 @@ -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; - } - } - } -} - -/** - * Private helper as a partial implementation of hook_user(). - * - * @see signup_user() - */ -function _signup_user_no_views($op, &$edit, &$user, $category = NULL) { - switch ($op) { - case 'view': - // grab list of nodes the user signed up for. - $signups = signup_list_user_signups($user->uid); - if (count($signups) && variable_get('signup_no_views_user_info', TRUE)) { - $user->content['signup'] = array( - '#type' => 'user_profile_category', - '#attributes' => array('class' => 'signup'), - '#weight' => 5, - '#title' => t('Signup information'), - ); - $user->content['signup']['current'] = array( - '#type' => 'user_profile_item', - '#attributes' => array('class' => 'signup-current'), - '#title' => t('Current signups'), - '#value' => theme_item_list($signups), - '#weight' => 0, - ); - $user->content['signup']['schedule'] = array( - '#type' => 'user_profile_item', - '#attributes' => array('class' => 'signup-schedule'), - '#title' => t('Signup schedule'), - '#value' => l(t('View full signup schedule'), 'user/'. $user->uid .'/signups'), - '#weight' => 2, - ); - } - break; - } -} - -/** - * Add menu items we only need to define if views is not enabled. - */ -function signup_no_views_menu(&$items) { - // User signup schedule callback - $items['user/%user/signups'] = array( - 'title' => 'Signups', - 'page callback' => 'signup_user_schedule', - 'page arguments' => array(1), - 'type' => MENU_CALLBACK, - 'access callback' => '_signup_no_views_user_menu_access', - 'access arguments' => array(1), - 'file' => 'includes/no_views.inc', - ); -} - -function _signup_no_views_user_menu_access($account) { - return variable_get('signup_no_views_user_info', TRUE) && _signup_user_menu_access($account); -} - -/** - * Print a schedule of the given user's signups. - * - * @ingroup signup_callback - */ -function signup_user_schedule($account) { - $output = ''; - drupal_set_title(t('Signups for @user', array('@user' => $account->name))); - $titles = signup_list_user_signups($account->uid); - foreach ($titles as $nid => $title) { - $node = node_load($nid); - $output .= theme('signup_user_schedule', $node); - } - return $output; -} - -/** - * Return an array of all nodes the specified user has signed up for. - * - * @param $uid - * The ID of the user to generate a list of signups for. - * - * @return - * Array of all nodes the given user has signed up for. The array is indexed - * by node ID, and contains titles as links to each node. - */ -function signup_list_user_signups($uid) { - $titles = array(); - - // We don't want to return anything for anon users. - if ($uid != 0) { - $sql = "SELECT n.nid, n.title FROM {node} n INNER JOIN {signup_log} s_l ON n.nid = s_l.nid WHERE s_l.uid = %d ORDER BY n.nid"; - $result = db_query(db_rewrite_sql($sql), $uid); - while ($node = db_fetch_array($result)) { - $titles[$node['nid']] = l($node['title'], 'node/'. $node['nid']); - } - } - return $titles; -} Index: includes/node_admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/node_admin.inc,v retrieving revision 1.1.2.5 diff -u -p -r1.1.2.5 node_admin.inc --- includes/node_admin.inc 14 Jan 2009 18:11:21 -0000 1.1.2.5 +++ includes/node_admin.inc 22 Sep 2009 07:32:24 -0000 @@ -29,12 +29,7 @@ function signup_node_admin_page($node) { $signup_node_admin_summary_form = ''; } - // Signup details table, including cancel checkboxes. - $display_list = variable_get('signup_display_signup_admin_list', 'signup'); - if ($display_list == 'signup') { - $signup_node_admin_details_form = drupal_get_form('signup_node_admin_details_form', $node); - } - elseif ($display_list == 'embed-view' && module_exists('views')) { + if (variable_get('signup_display_signup_admin_list', 'embed-view') == 'embed-view') { $signup_view = _signup_get_admin_list_view(); $signup_view_parts = explode(':', $signup_view); $view_name = $signup_view_parts[0]; @@ -52,172 +47,3 @@ function signup_node_admin_page($node) { return theme('signup_node_admin_page', $node, $signup_node_admin_summary_form, $signup_node_admin_details_form); } -function signup_node_admin_details_form(&$form_state, $node) { - unset($_SESSION['signup_cancel_multiple_users']); - $form = array(); - - // Prepare a table header that allows sorting on name and signup time. - $header = array( - theme('table_select_header_cell'), - array('data' => t('Name'), 'field' => 'u.name', 'sort' => 'asc'), - array('data' => t('Signup time'), 'field' => 's.signup_time'), - array('data' => t('Extra information')), - array('data' => t('Attendance'), 'field' => 's.attended'), - ); - - $sql = "SELECT u.uid, u.name, s.* FROM {signup_log} s INNER JOIN {users} u ON u.uid = s.uid WHERE s.nid = %d"; - $sql .= tablesort_sql($header); - $result = db_query($sql, $node->nid); - - // Loop through the users, unserializing their user data. - while ($signed_up_user = db_fetch_object($result)) { - // The "username" to print is different for anon signups and registered - // user signups. For registered users, provide a link to the user profile - // For anon, use the user's email address as the name. - if ($signed_up_user->uid == 0) { - $username = check_plain($signed_up_user->anon_mail); - } - else { - $username = theme('username', $signed_up_user); - } - $key = $signed_up_user->sid; - $users[$key] = ''; - $form['username'][$key] = array('#value' => $username); - $form['signup_date'][$key] = array('#value' => format_date($signed_up_user->signup_time, variable_get('signup_date_format', 'small'))); - $form['signup_form_data'][$key] = array('#value' => theme('signup_custom_data', unserialize($signed_up_user->form_data))); - $form['attended'][$key] = array('#value' => theme('signup_attended_text', $signed_up_user->attended)); - } - if (empty($users)) { - $form['no_users'] = array('#value' => t('No users have signed up for this %node_type.', array('%node_type' => node_get_types('name', $node->type)))); - } - else { - $form['nid'] = array( - '#type' => 'hidden', - '#value' => $node->nid, - ); - $form['users'] = array('#type' => 'checkboxes', '#options' => $users); - $form['operation'] = array( - '#type' => 'select', - '#options' => array( - 'attend_yes' => t('Mark as attended'), - 'attend_no' => t('Mark as did not attend'), - ), - ); - if (user_access('cancel signups')) { - $form['operation']['#options']['cancel'] = t('Cancel signup'); - } - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Update'), - '#submit' => array('signup_node_admin_multiple_submit'), - '#validate' => array('signup_node_admin_multiple_validate'), - ); - $form['#header'] = $header; - } - return $form; -} - -/** - * Validate handler for updating multiple signups via node/N/signups. - */ -function signup_node_admin_multiple_validate($form, &$form_state) { - $users = array_filter($form_state['values']['users']); - if (empty($users)) { - form_set_error('', t('No users selected.')); - } -} - -/** - * Submit handler for updating multiple signups via node/N/signups. - * - * If the operation is non-destructive (recording attendance), do the deed. - * For cancelling multiple users, this just saves the selected users into - * SESSION and redirects to a confirm form which is registered at - * node/N/signups/confirm. - */ -function signup_node_admin_multiple_submit($form, &$form_state) { - $users = array_filter($form_state['values']['users']); - switch ($form_state['values']['operation']) { - case 'cancel': - if (user_access('cancel signups')) { - $_SESSION['signup_cancel_multiple_users'] = $users; - $form_state['redirect'] = 'node/'. $form_state['values']['nid'] .'/signups/confirm'; - return; - } - else { - drupal_set_message(t('You do not have permission to cancel signups.'), 'error'); - return; - } - - case 'attend_yes': - $attend = 1; - break; - - case 'attend_no': - $attend = 0; - break; - - } - $placeholders = db_placeholders($users); - db_query("UPDATE {signup_log} SET attended = %d WHERE sid IN ($placeholders)", array($attend) + $users); -} - -/** - * Builds the confirm form when canceling multiple signups from node/N/signups. - */ -function signup_cancel_multiple_confirm(&$form_state, $node) { - $form = array(); - $form['nid'] = array( - '#type' => 'hidden', - '#value' => $node->nid, - ); - $form['users'] = array( - '#prefix' => '', - '#tree' => TRUE, - ); - $placeholders = db_placeholders($_SESSION['signup_cancel_multiple_users']); - $query = db_query("SELECT u.name, u.uid, s.* FROM {signup_log} s INNER JOIN {users} u ON s.uid = u.uid WHERE s.sid IN (". $placeholders .")", $_SESSION['signup_cancel_multiple_users']); - while ($signup = db_fetch_object($query)) { - $key = $signup->sid; - if ($signup->uid) { - $label = theme('username', $signup); - } - else { - $label = t('Anonymous signup: %anon_mail', array('%anon_mail' => $signup->anon_mail)); - } - $form['users'][$key] = array( - '#type' => 'hidden', - '#value' => $key, - '#prefix' => '
  • ', - '#suffix' => $label ."
  • \n", - ); - } - $form['#submit'][] = 'signup_cancel_multiple_confirm_submit'; - return confirm_form( - $form, - t('Are you sure you want to cancel signups for these users?'), - 'node/'. $node->nid .'/signups', - t('This action cannot be undone.'), - t('Cancel signups'), t('Keep signups') - ); -} - -/** - * Submit handler for the confirm form to cancel multiple signups. - */ -function signup_cancel_multiple_confirm_submit($form, &$form_state) { - $nid = $form_state['values']['nid']; - if (user_access('cancel signups')) { - foreach ($form_state['values']['users'] as $key) { - signup_cancel_signup($key); - } - } - else { - drupal_set_message(t('You do not have permission to cancel signups.'), 'error'); - } - $form_state['redirect'] = 'node/'. $nid .'/signups'; - unset($_SESSION['signup_cancel_multiple_users']); -} - Index: includes/node_output.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/node_output.inc,v retrieving revision 1.1.2.11 diff -u -p -r1.1.2.11 node_output.inc --- includes/node_output.inc 23 Aug 2009 15:44:54 -0000 1.1.2.11 +++ includes/node_output.inc 22 Sep 2009 07:32:24 -0000 @@ -115,41 +115,23 @@ function signup_user_list_output($node) $output = ''; // How should the list of signed-up users be displayed, if at all? - $display_list = variable_get('signup_display_signup_user_list', 'signup'); + $display_list = variable_get('signup_display_signup_user_list', 'embed-view'); // Ensure the user has permission to view the signup list for this node. - if (_signup_menu_access($node, 'list')) { - if ($display_list == 'signup' || $display_list == 'signup-tab') { - // Admin wants the hard-coded signup listing. - $registered_query = db_query("SELECT u.uid, u.name, s.signup_time, s.form_data FROM {signup_log} s INNER JOIN {users} u ON u.uid = s.uid WHERE s.nid = %d AND u.uid <> 0", $node->nid); - $registered_signups = array(); - while ($signed_up_user = db_fetch_object($registered_query)) { - $registered_signups[] = $signed_up_user; - } - $anon_query = db_query("SELECT * FROM {signup_log} WHERE nid = %d AND uid = 0", $node->nid); - $anon_signups = array(); - while ($signed_up_user = db_fetch_object($anon_query)) { - $anon_signups[] = $signed_up_user; - } - $output .= theme('signup_user_list', $node, $registered_signups, $anon_signups); + if (_signup_menu_access($node, 'list') && ($display_list == 'embed-view' || $display_list == 'embed-view-tab')) { + $signup_view = variable_get('signup_user_list_view', 'signup_user_list:default'); + $signup_view_parts = explode(':', $signup_view); + $view_name = $signup_view_parts[0]; + $view_display = $signup_view_parts[1]; + $view = views_get_view($view_name); + if ($display_list == 'embed-view-tab') { + $view->override_path = 'node/%/signups/list'; } - elseif (($display_list == 'embed-view' || $display_list == 'embed-view-tab') && module_exists('views')) { - $signup_view = variable_get('signup_user_list_view', 'signup_user_list:default'); - $signup_view_parts = explode(':', $signup_view); - $view_name = $signup_view_parts[0]; - $view_display = $signup_view_parts[1]; - $view = views_get_view($view_name); - if ($display_list == 'embed-view-tab') { - $view->override_path = 'node/%/signups/list'; - } - else { - $view->override_path = 'node/%'; - } - $view_args = array($node->nid); - $output .= $view->preview($view_display, $view_args); + else { + $view->override_path = 'node/%'; } - // Otherwise, they're on their own, and either don't want it displayed at - // all, or they want to handle where/how it's displayed via views. + $view_args = array($node->nid); + $output .= $view->preview($view_display, $view_args); } return $output; } cvs diff: Diffing js cvs diff: Diffing modules cvs diff: Diffing modules/signup_confirm_email cvs diff: Diffing modules/signup_confirm_email/translations cvs diff: Diffing panels cvs diff: Diffing panels/content_types cvs diff: Diffing theme cvs diff: Diffing translations cvs diff: Diffing views cvs diff: Diffing views/handlers cvs diff: Diffing views/plugins