? 227751-remove-node-options.patch ? 367752-domain-content-menu.patch ? 367752-domain-list-size.patch ? 367752-domain-list-size_0.patch ? 369928-views-filter.patch ? 397116-relationship.patch ? 529026-outbound-doc.patch ? 539422-grants.patch ? test.patch Index: domain.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.admin.inc,v retrieving revision 1.33 diff -u -p -r1.33 domain.admin.inc --- domain.admin.inc 4 Aug 2009 14:17:09 -0000 1.33 +++ domain.admin.inc 17 Aug 2009 14:05:53 -0000 @@ -50,7 +50,7 @@ function domain_view() { } $sql = 'SELECT d.*'. $select_sql .' FROM {domain} d'. $join_sql . tablesort_sql($header); - $result = pager_query($sql, 24); + $result = pager_query($sql, variable_get('domain_list_size', DOMAIN_LIST_SIZE)); while ($data = db_fetch_array($result)) { $domains[] = $data; } @@ -101,7 +101,7 @@ function domain_view() { } if (!empty($rows)) { $output .= theme_table($header, $rows); - $output .= theme('pager', NULL, 24, 0); + $output .= theme('pager', NULL, variable_get('domain_list_size', DOMAIN_LIST_SIZE), 0); return $output; } else { @@ -205,6 +205,14 @@ function domain_configure_form($form_sta '#options' => $options, '#description' => t('Controls the display of domain lists to end users.') ); + $form['domain_behavior']['domain_list_size'] = array( + '#type' => 'select', + '#title' => t('Domain list size'), + '#required' => TRUE, + '#default_value' => variable_get('domain_list_size', DOMAIN_LIST_SIZE), + '#options' => drupal_map_assoc(array(5, 10, 20, 25, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, 1000)), + '#description' => t('Sets a break point for the size of domain lists shown to users. After this point, user interfaces will use tables, pagination, and select lists to prevent too many domains from appearing in a list. Note: setting this value higher than 200 may cause memory and display issues for your site.') + ); $form['domain_advanced'] = array( '#type' => 'fieldset', Index: domain.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v retrieving revision 1.114 diff -u -p -r1.114 domain.module --- domain.module 28 Jun 2009 15:42:04 -0000 1.114 +++ domain.module 17 Aug 2009 14:05:56 -0000 @@ -32,6 +32,11 @@ define('DOMAIN_SITE_GRANT', TRUE); define('DOMAIN_ASSIGN_USERS', TRUE); /** + * Sets a default value at which to start paginating Domain lists. + */ +define('DOMAIN_LIST_SIZE', 25); + +/** * Adds the domain user data to the $user object. */ function domain_boot() { Index: domain_content/domain_content.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_content/domain_content.admin.inc,v retrieving revision 1.10 diff -u -p -r1.10 domain_content.admin.inc --- domain_content/domain_content.admin.inc 25 Mar 2009 16:23:42 -0000 1.10 +++ domain_content/domain_content.admin.inc 17 Aug 2009 14:05:57 -0000 @@ -29,6 +29,60 @@ function domain_content_page() { } /** + * List the available domains for this user. + * + * See http://drupal.org/node/367752 for a discussion of the + * need for this function. + */ +function domain_content_list() { + global $user; + if (user_access('administer nodes') || user_access('review content for all domains')) { + // Return all domains. + $query = "SELECT domain_id, subdomain, sitename, scheme FROM {domain} d"; + } + else { + if (empty($user->domain_user)) { + return drupal_access_denied(); + } + // Cast the -1 as 0. + if (isset($user->domain_user[-1])) { + unset($user->domain_user[-1]); + $user->domain_user[0] = 0; + } + $query = "SELECT domain_id, subdomain, sitename, scheme FROM {domain} WHERE domain_id IN (". db_placeholders($user->domain_user, 'int') .")"; + } + // Table information + $header = array( + array('data' => t('Edit'), 'field' => 'domain_id'), + array('data' => t('Site name'), 'field' => 'sitename'), + array('data' => t('Domain'), 'field' => 'subdomain'), + array('data' => t('Content count')), + + ); + $query .= tablesort_sql($header); + $result = pager_query($query, variable_get('domain_list_size', DOMAIN_LIST_SIZE), 0, NULL, $user->domain_user); + $rows = array(); + while ($domain = db_fetch_array($result)) { + $path = trim(domain_get_path($domain), '/'); + $rows[] = array( + l(t('Edit content for !sitename', array('!sitename' => $domain['sitename'])), 'admin/domain/content/'. $domain['domain_id']), + check_plain($domain['sitename']), + l($path, $path), + (int) db_result(db_query("SELECT COUNT(*) FROM {domain_access} WHERE gid = %d AND realm = 'domain_id'", $domain['domain_id'])), + ); + } + if (!empty($rows)) { + $output = '
'. t('The table below shows all the affiliates sites whose content you may edit. Click on the site name link to see all content assigned to that affiliate.') .'
'; + $output .= theme_table($header, $rows); + $output .= theme('pager', NULL, variable_get('domain_list_size', DOMAIN_LIST_SIZE), 0); + return $output; + } + else { + return t('You do not have editing access to any domains. Please contact your site administrator.'); + } +} + +/** * Content administration for a specific domain. * This callback puts the user on the current domain and then * fetches the appropirate content for batch editing. @@ -44,10 +98,12 @@ function domain_content_page() { */ function domain_content_view($domain_id = NULL, $all_affiliates = FALSE) { global $_domain; + // Load the active domain, which is not necessarily the current domain. if (!is_null($domain_id) && $domain_id != $_domain['domain_id']) { domain_set_domain($domain_id); } + $output = ''; // Override the $_domain global so we can see the appropriate content if (!is_null($domain_id)) { @@ -58,6 +114,7 @@ function domain_content_view($domain_id $_domain['site_grant'] = TRUE; drupal_set_title(t('Content for all affiliate sites')); } + // KILLSWITCH CASE: returns an error else { drupal_set_message(t('Invalid request'), 'error'); Index: domain_content/domain_content.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_content/domain_content.module,v retrieving revision 1.28 diff -u -p -r1.28 domain_content.module --- domain_content/domain_content.module 31 May 2009 18:16:40 -0000 1.28 +++ domain_content/domain_content.module 17 Aug 2009 14:05:57 -0000 @@ -25,12 +25,12 @@ function domain_content_menu() { $items = array(); $items['admin/domain/content'] = array( 'title' => 'Affiliated content', - 'page callback' => 'domain_content_page', + 'page callback' => 'domain_content_list', 'access callback' => 'domain_content_menu_check', 'file' => 'domain_content.admin.inc', ); $items['admin/domain/content/all'] = array( - 'title' => 'Content for all affiliate sites', + 'title' => 'Content assigned to all affiliates', 'page callback' => 'domain_content_view', 'page arguments' => array(NULL, TRUE), 'access callback' => 'domain_content_menu_check', @@ -40,22 +40,51 @@ function domain_content_menu() { ); // Generate the list of active domains as menu items $domains = domain_domains(); - foreach ($domains as $domain) { - $items['admin/domain/content/'. $domain['domain_id']] = array( - 'title' => filter_xss_admin($domain['sitename']) .' content', + if (count($domains) <= variable_get('domain_list_size', DOMAIN_LIST_SIZE)) { + foreach ($domains as $domain) { + $items['admin/domain/content/'. $domain['domain_id']] = array( + 'title' => filter_xss_admin($domain['sitename']) .' content', + 'page callback' => 'domain_content_view', + 'page arguments' => array($domain['domain_id'], FALSE), + 'access callback' => 'domain_content_check', + 'access arguments' => array($domain), + 'file' => 'domain_content.admin.inc', + 'description' => 'View content assigned to '. filter_xss_admin($domain['subdomain']), + 'weight' => $domain['domain_id'] + ); + } + } + else { + $items['admin/domain/content/list'] = array( + 'title' => 'Affiliate site list', + 'page callback' => 'domain_content_list', + 'access callback' => 'domain_content_menu_check', + 'file' => 'domain_content.admin.inc', + 'description' => 'View your list of affiliates', + 'weight' => -10 + ); + $items['admin/domain/content/%'] = array( + 'title' => 'Affiliate site list', 'page callback' => 'domain_content_view', - 'page arguments' => array($domain['domain_id'], FALSE), + 'page arguments' => array(3, TRUE), 'access callback' => 'domain_content_check', - 'access arguments' => array($domain), + 'access arguments' => array(3), 'file' => 'domain_content.admin.inc', - 'description' => 'View content assigned to '. filter_xss_admin($domain['subdomain']), - 'weight' => $domain['domain_id'] + 'description' => 'Content list for a domain', + 'weight' => -10 ); } return $items; } /** + * Implement hook_perm(). + */ +function domain_content_perm() { + return array('configure domain content', 'review content for all domains'); +} + +/** * Implement hook_theme(). */ function domain_content_theme() { @@ -78,7 +107,7 @@ function domain_content_menu_check() { if (user_access('administer nodes')) { return TRUE; } - if (user_access('edit domain nodes')) { // || user_access('set domain access') + if (user_access('edit domain nodes') || user_access('review content for all domains')) { return TRUE; } return FALSE; @@ -168,3 +197,15 @@ function domain_content_form_alter(&$for $form['#redirect'] = $_GET['q']; } } + +/** + * Implement hook_domainlinks() + */ +function domain_content_domainlinks($domain) { + $links[] = array( + 'title' => t('content'), + 'path' => 'admin/domain/content/'. $domain['domain_id'] + ); + return $links; + +}