? 461568-dc-all.patch
? 461568-dc.patch
Index: 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.admin.inc 25 Mar 2009 16:23:42 -0000 1.10
+++ domain_content.admin.inc 13 Jun 2009 21:08:53 -0000
@@ -56,7 +56,9 @@ function domain_content_view($domain_id
}
else if ($all_affiliates) {
$_domain['site_grant'] = TRUE;
- drupal_set_title(t('Content for all affiliate sites'));
+ }
+ else if (!$all_affiliates && is_null($domain_id)) {
+ $_domain['site_grant'] = TRUE;
}
// KILLSWITCH CASE: returns an error
else {
@@ -103,7 +105,7 @@ function domain_content_form($form_state
$filter['join'] .= " INNER JOIN {domain_access} dac ON dac.nid = n.nid ";
$arg = arg(3);
- if ($arg != 'all') {
+ if ($arg != 'all' && $arg != 'overview') {
// In this case, we must check the domain_id grant.
// We use intval() here for security, since we are not filtering the query parameter otherwise.
if (empty($filter['where'])) {
@@ -113,7 +115,7 @@ function domain_content_form($form_state
$filter['where'] .= " AND dac.realm = 'domain_id' AND dac.gid = ". intval($_domain['domain_id']) ." ";
}
}
- else {
+ else if ($arg != 'overview') {
// Or check the domain_site grant.
if (empty($filter['where'])) {
$filter['where'] = " WHERE dac.realm = 'domain_site' AND dac.gid = 0 ";
@@ -122,6 +124,13 @@ function domain_content_form($form_state
$filter['where'] .= " AND dac.realm = 'domain_site' AND dac.gid = 0 ";
}
}
+ else {
+ drupal_add_css(drupal_get_path('module', 'domain_content') .'/domain_content.css');
+ $form['markup'] = array(
+ '#weight' => -1,
+ '#value' => t('Below is all content your account may access. The titles are color-coded and marked with an * to show whether the content is available or unavailable for viewing on the active domain, %domain', array('%domain' => $domain['subdomain'])),
+ );
+ }
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC'), 50, 0, NULL, $filter['args']);
@@ -145,16 +154,34 @@ function domain_content_form($form_state
if ($message) {
$check[$node->nid] = TRUE;
}
- $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
+
+ // Load the domain_access rules directly from domain_nodeapi().
+ domain_nodeapi($node, 'load');
+
+ // The root domain is stored as -1, but cast as zero in the global variable.
+ $inv_key = ($_domain['domain_id'] == 0) ? -1 : $_domain['domain_id'];
+
+ // If the current domain is present in the assigned domains for this node
+ // or if it's set to display on all affiliates, then add the 'domain-visible'
+ // class to the node link
+ if (in_array($inv_key, $node->domains) || $node->domain_site) {
+ $domain_visibility = "domain-visible";
+ $visible = ' * ';
+ }
+ else {
+ $domain_visibility = "domain-invisible";
+ $visible = '';
+ }
+ $attributes = array('class' => $domain_visibility);
+
+ $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid, array('attributes' => $attributes)) .' '. theme('mark', node_mark($node->nid, $node->changed)) . $visible);
$form['name'][$node->nid] = array('#value' => check_plain(node_get_types('name', $node)));
$form['username'][$node->nid] = array('#value' => theme('username', $node));
$form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published')));
- // This routine controls if the editor can see the 'edit' link.
- // Load the domain_access rules directly from domain_nodeapi().
- domain_nodeapi($node, 'load');
$node_domains = array();
+ // This routine controls if the editor can see the 'edit' link.
if (!empty($node->domains)) {
foreach ($node->domains as $domain) {
// Can the user edit this node. We use += here since this is an array loop.
@@ -338,6 +365,9 @@ function theme_domain_content_admin_node
$output = '';
$output .= drupal_render($form['options']);
$output .= drupal_render($form['domain']);
+ if (isset($form['markup'])) {
+ $output .= drupal_render($form['markup']);
+ }
if (isset($form['title']) && is_array($form['title'])) {
foreach (element_children($form['title']) as $key) {
$row = array();
Index: domain_content.css
===================================================================
RCS file: domain_content.css
diff -N domain_content.css
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ domain_content.css 13 Jun 2009 21:08:53 -0000
@@ -0,0 +1,13 @@
+#domain-content-form span.domain-visible,
+#domain-content-form a.domain-visible,
+#domain-content-form a.domain-visible:hover {
+ color: #090;
+ background-color: #cfc;
+}
+
+#domain-content-form span.domain-invisible,
+#domain-content-form a.domain-invisible,
+#domain-content-form a.domain-invisible:hover {
+ color: #900;
+ background-color: #fcc;
+}
Index: 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.module 31 May 2009 18:16:40 -0000 1.28
+++ domain_content.module 13 Jun 2009 21:08:53 -0000
@@ -29,14 +29,23 @@ function domain_content_menu() {
'access callback' => 'domain_content_menu_check',
'file' => 'domain_content.admin.inc',
);
+ $items['admin/domain/content/overview'] = array(
+ 'title' => 'All content',
+ 'page callback' => 'domain_content_view',
+ 'page arguments' => array(NULL, FALSE),
+ 'access callback' => 'domain_content_menu_check',
+ 'file' => 'domain_content.admin.inc',
+ 'description' => 'View all content in the context of the current domain.',
+ 'weight' => -10,
+ );
$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',
'file' => 'domain_content.admin.inc',
'description' => 'View content assigned to all affiliate sites.',
- 'weight' => -10
+ 'weight' => -8,
);
// Generate the list of active domains as menu items
$domains = domain_domains();
@@ -78,7 +87,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')) {
return TRUE;
}
return FALSE;