Permalink
Browse files

#269946 by david_g and moshe weitzman. move code into a new og_views …

…module and as a result, don't depend OG on Views.
  • Loading branch information...
1 parent f68edfd commit 75ab1ed11c475868867098d4cf301e54dddb6d95 moshe weitzman committed Jul 31, 2008
View
@@ -6,40 +6,38 @@ Groups may choose their own theme and language. Groups have RSS feeds and email
INSTALLATION
---------------
-- Enable the og module. If you want to protect some posts so that only certain users may view them, enable the 'Organic Groups access control' module as well. Please make sure og is working well on its own before enabling other OG related modules.
-- Visit the admin/og/og page.
-- On admin/og/og, see the content types table at the top. Click edit beside each type to set its 'usage'. You usually want to create a new node type via admin/content/types page and then designate that node type as a group from here. See the first item in NOTES below.
+- Enable the Organic groups and Organic groups Views integration modules. If you want to protect some posts so that only certain users may view them, enable the 'Organic Groups access control' module as well. Please make sure og is working well on its own before enabling other OG related modules.
+- On the Administer > Organic groups configuration page, see the content types table at the top. Click edit beside each type to set its 'usage'. Disable comments and attachments for node types which are designated as group nodes. You usually want to create a new node type via admin/content/types page and then designate that content type as a group node. See the first item in NOTES below.
- Set other preferences on admin/og/og as desired. It may take some experimenting before you arrive at a configuration well suited to your needs.
-- On the admin/content/types page, disable comments and attachments for node types which are designated as groups. Click the edit link beside those types.
-- On the admin/build/block page, enable the 'Group details' and drag it toward the top of your list. Optionally enable the other 'Group' blocks.
+- On the Administer › Site building > Blocks page, enable the 'Group details' and drag it toward the top of your list. Optionally enable the other 'Group' blocks.
- Grant permissions as needed on the admin/user/permission page
- Begin creating groups (visit the node/add page), joining those groups, and posting into those groups. The join link appears in the Group details block, for non invite-only groups.
-- Consider enabling the following modules which work well with OG: Pathauto, Locale, Job queue. After your install is working nicely, consider enabling og add-on modules like og_mandatory_group, og_vocab, and og_panels. Those are know to work well with OG. Many others of varying quality are listed at http://drupal.org/project/Modules/category/90.
+- Consider enabling the following modules which work well with OG: Pathauto, Locale, Notifications. After your install is working nicely, consider enabling more og add-on modules like og_mandatory_group, og_vocab, and og_panels. Those are known to work well with OG. Some of the others on drupal.org are uite poorly integrated and will cause problems. See http://drupal.org/project/Modules/category/90.
NOTES
----------------
-- This module supports designating any type of node to be a group. This node type should be defined by a custom module or via the admin/content/types page. When defining your type, you usually want the title label to be 'Group name' and the body label to be 'Welcome message'. Since all nodes of this type are treated as groups, you will usually not want to designate the standard page, story, or book node types as groups. The capacity to make custom node types groups means that you can have custom fields for your groups and even several different kinds of groups.
+- This module supports designating any contnt type to act as a group. This content type should be defined by a custom module or via the admin/content/types page. When defining your type, you usually want the title label to be 'Group name' and the body label to be 'Welcome message'. Since all nodes of this type are treated as groups, you will usually not want to designate the standard page, story, or book node types as groups. The feature where custom content types may act as groups enables you to have custom fields for your groups and even different fields for different kinds of groups (i.e. content types).
- There are a few handy tabs at the path 'group'. You might want to add a link in your Navigation to that url. Each tab also provides a useful RSS feed.
- 'Administer nodes' permission is required for changing the Manager of a group (do so by changing the posts' Author.)
- 'Administer nodes' permission enables viewing of all nodes regardless of private/public status.
- All membership management happens on the 'membership list' page which is linked from the group details Block (while viewing a group page). This includes approving membership requests (for selective groups), adding/removing users and promoting users into group admins.
-- If you decide to stop using this module, just disable it as usual. If you ever decide to re-enable, all your prior group access control information will be restored. If you want to really start fresh, uninstall og and og_access modules.
+- If you decide to stop using Organic groups, just disable it as usual. If you ever decide to re-enable, all your prior group access control information will be restored. If you want to start fresh, uninstall og, og_views and og_access modules.
DEVELOPERS & SITE BUILDERS
------------------
- You may craft your own URLs which produce useful behavior. For example, user/register?gids[]=4 will add a checked checkbox for to the user's registration page for subscribing to group nid=4. This feature overrides the usual preference for groups to always appear during registration.
-- You alter the links in the group details block using hook_og_link_alter($links, $group_node). Or you may completely take over this block by defining a og_block_details for each of your custom group node types. See og_block_details().
+- You alter the links in the group details block using hook_og_link_alter($links, $group_node). See og_block_details().
- The current group context is available to javascript code at Drupal.settings.og. This is useful for enriching ad tags and analytics calls with group information.
THEMES
------------------
You may wish to stylize nodes which have properties assigned by this module.
--- public vs. private posts are denoted by $node->og_public (og_access provides private posts)
---- provided in this package are two template files for the phptemplate engine. One stylizes group nodes and the other stylizes all other stylizes group posts. These can be starting points for your customization of look and feel of your group. Or you might use the included og_panels module to achieve custom group homepages (and other group pages) that group admins can design themselves.
+--- provided in this package are two template files for the phptemplate engine. One stylizes group nodes and the other stylizes all other stylizes group posts. These can be starting points for your customization of look and feel of your group. Just copy them to your theme directory and edit as desired. Or you might use the included og_panels module to achieve custom group homepages (and other group pages) that group admins can design themselves.
INTEGRATION
---------------------
-- I recommend enabling the job_queue.module. When you do, group email notifications are sent during cron runs, instead of immediately after a post is submitted. This speeds up posting a lot, for big groups. The delay also helps authors fix typos in their posts before the mail is sent.
+- I recommend enabling the cron features of Notifications/Messaging modules. When you do, group email notifications are sent during cron runs, instead of immediately after a post is submitted. This speeds up posting a lot, for big groups. The delay also helps authors fix typos in their posts before the mail is sent.
- This module exposes an API for retrieving and managing membership via direct PHP functions [og_save_subscription()] and via XMLRPC.
UNIT TESTING
@@ -52,8 +50,10 @@ TODO/BUGS/FEATURE REQUESTS
UPGRADING FROM 5.0 TO 6.x
-----------------
+- The upgrade auto-enables the new og_views module. This is needed to get the same functionality that was present in D5.
- The user interface for selecting alternate Views for your group homepage is gone. You may still select an alternate view by setting 'og_home_page_view' variable in your settings.php. Alternative, just customize your og_ghp_ron View. You can always revert it if it breaks
- Group members block (og/2) block is now served by Views: views/og_members_block-block_1
+- Group search is now in its own block which must be enabled manually. It used to be integrated into the Group details block.
UPGRADING FROM 4.7 TO 5.x
-----------------
View
@@ -1,5 +1,4 @@
name = Organic groups
-description = "Enable users to create and manage their own 'groups'"
+description = "Enable users to create and manage groups. OG Views integration module is recommended for best experience."
package = "Organic groups"
-dependencies[] = views
core = 6.x
View
@@ -369,6 +369,15 @@ function og_update_6000() {
}
}
+// Update to support views modularization while retaining backward compatibility.
+function og_update_6001() {
+ $ret = array();
+ module_enable(array('og_views'));
+ //enable the og_views block instead of the plain og one
+ db_query("UPDATE {blocks} SET module = 'og_views', delta = '1' WHERE module = 'og' AND delta = '5'");
+ return $ret;
+}
+
// end updates //
function og_enable() {
View
@@ -140,16 +140,6 @@ function og_menu() {
'file' => 'og.admin.inc',
'weight' => -5,
);
-
- // This exists because I can't easily restrict access based on pictures_enabled using Views.
- $items['og/users/%/faces'] = array(
- 'title' => 'Faces',
- 'page callback' => 'views_page',
- 'page arguments' => array('og_members_faces', 'default', 2),
- 'type' => MENU_LOCAL_TASK,
- 'access callback' => 'og_menu_access_picture',
- 'access arguments' => array(2),
- );
// group admin only
$items['og/users/%node/add_user'] = array(
@@ -172,17 +162,6 @@ function og_menu() {
'type' => MENU_LOCAL_TASK,
'weight' => 7
);
-
- // Group feed
- $items['node/%node/feed'] = array(
- 'page callback' => 'og_feed',
- 'page arguments' => array(1),
- 'title callback' => 'node_page_title',
- 'title arguments' => array(1),
- 'type' => MENU_CALLBACK,
- 'access callback' => 'node_access',
- 'access arguments' => array('view', 1),
- );
return $items;
}
@@ -500,7 +479,7 @@ function og_set_theme($nid) {
function og_email_form($form_state, $node) {
drupal_set_title(t('Send email to %group', array('%group' => $node->title)));
- if (!$form_state['post']) {
+ if (!empty($form_state['post'])) {
drupal_set_message(t('Your email will be sent to all members of this group. Please use this feature sparingly.'));
}
@@ -1201,30 +1180,6 @@ function og_view_group(&$node, $teaser = FALSE, $page = FALSE) {
'#weight' => -3,
'#theme' => 'og_mission',
);
-
- $view = views_get_view(variable_get('og_home_page_view', 'og_ghp_ron'));
- if (!empty($view->disabled)) {
- // Do nothing. Assume the group node type handles homepage, or theme layer - i.e. node-<node_type>.tpl.php
- }
- else {
- $view->is_cacheable = FALSE;
- // $view->url = 'node'; // for pager
- $view->set_arguments(array($node->nid));
- $view->set_display('default');
- $built = $view->render();
-
-
- // Views will set either total_rows or num_rows depending on whether View has a pager.
- if (@$view->total_rows || @$view->num_rows || @$view->page_empty) {
- $node->content['view'] = array('#value' => $built);
- }
- elseif (empty($_POST)) {
- // Use this default empty text unless overridden by View (which is a usually not a good idea. This text is smart)
- og_home_empty($node);
- }
- drupal_set_title(filter_xss_admin($view->build_info['title']));
- drupal_add_feed(url("node/$node->nid/feed"), drupal_get_title());
- }
}
}
@@ -2565,21 +2520,6 @@ function og_is_group_type($type) {
}
/**
- * Menu callback. Render group feed.
- */
-function og_feed($node) {
- $view = views_get_view(variable_get('og_home_page_view', 'og_ghp_ron'));
- $view->is_cacheable = FALSE;
- $view->set_display('feed');
- // TODOL: not working
- $view->override_path = "node/$node->nid";
- $view->set_arguments(array($node->nid));
- $view->display['feed']->display_options['style_options']['description'] = $node->og_description;
- print $view->render();
-}
-
-
-/**
* Implementation of hook_block().
*/
function og_block($op = 'list', $delta = 0, $edit = array()) {
@@ -2673,23 +2613,7 @@ function og_block_notifications() {
global $user;
if ($groupnode = og_get_group_context()) {
- $content = t('This group offers a <a href="@groupfeed">RSS feed</a> and an <a href="@email">email subscription</a>.', array('@groupfeed' => url("node/$groupnode->nid/feed"), '@email' => url('og/manage/'. $groupnode->nid)));
- // NOTE: See og.css for styling specific to these lists
- $content .= ' '. t('Or subscribe to these personalized, sitewide feeds:');
- $inline = array('class' => 'links inline');
- if ($user->uid) {
- $l1[] = array('title' => t('Feed'), 'href' => 'group/myunread/feed');
- $l1[] = array('title' => t('Page'), 'href' => 'group/myunread');
- $links['my_unread'] = t('My unread: !links.', array('!links' => theme('links', $l1, $inline)));
-
- $l2[] = array('title' => t('Feed'), 'href' => 'group/mytracker/feed');
- $l2[] = array('title' => t('Page'), 'href' => 'group/mytracker');
- $links['my_group'] = t('My group: !links.', array('!links' => theme('links', $l2, $inline)));
- }
- $l3[] = array('title' => t('Feed'), 'href' => 'group/tracker/feed');
- $l3[] = array('title' => t('Page'), 'href' => 'group/tracker');
- $links['all_posts'] = array('data' => t('All posts: !links', array('!links' => theme('links', $l3, $inline))));
- $content .= theme('item_list', $links);
+ $content = t('This group offers an <a href="@email">email subscription</a>.', array('@email' => url('og/manage/'. $groupnode->nid)));
$block['content'] = $content;
$block['subject'] = t('Group notifications');
return $block;
@@ -2728,7 +2652,6 @@ function og_block_details() {
// Only display group details if we have a group context.
if (($node = og_get_group_context()) && node_access('view', $node)) {
- $suffix = '';
list($txt, $subscription) = og_subscriber_count_link($node);
if ($subscription == 'active' || user_access('administer nodes')) {
$links = module_invoke_all('og_create_links', $node);
@@ -2744,10 +2667,6 @@ function og_block_details() {
if(isset($subscribe)) {
$links['my_membership'] = $subscribe;
}
-
- if (module_exists('search') && user_access('search content')) {
- $suffix = drupal_get_form('og_search_form', $node);
- }
}
elseif ($subscription == 'requested') {
$links['approval'] = t('Your membership request awaits approval.');
@@ -2768,9 +2687,9 @@ function og_block_details() {
}
// Modify these links by reference. If you want control of the whole block, see og_block_details().
- drupal_alter('og_links', $links);
+ drupal_alter('og_links', $links, $node);
- $block['content'] = theme('item_list', $links). $suffix;
+ $block['content'] = theme('item_list', $links);
$block['subject'] = l($node->title, "node/$node->nid");
return $block;
}
@@ -2802,7 +2721,7 @@ function og_block_details() {
}
}
$txt = format_plural($cntall-$cntpending, '1 member', '@count members');
- $txt = og_is_picture() ? l($txt, "og/users/$node->nid/faces") : l($txt, "og/users/$node->nid");
+ // The hyperlinked version of this text is supplied by og_views.module in alter hook.
$txt .= $cntpending ? " ($cntpending)" : '';
return array($txt, $subscription);
}
@@ -2839,30 +2758,6 @@ function og_og_create_links($group) {
return isset($links) ? $links : array();
}
-function og_search_form($form_state, $group) {
- $form['keys'] = array(
- '#type' => 'textfield',
- '#title' => '',
- '#description' => '',
- '#size' => 19,
- '#maxlength' => 255,
- );
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Search'),
- );
- // $form['#pre_render'][] = 'og_search_form_pre_render';
- $form['#method'] = 'get';
- $form['#action'] = url("og/search/$group->nid");
- return $form;
-}
-
-// Clean up query string like Views does.
-function og_search_form_pre_render($form_state) {
- // unset($form_state['form_build_id'], $form_state['form_token'], $form_state['form_id']);
- return $form_state;
-}
-
function og_is_picture() {
return variable_get('user_pictures', 0);
}
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,7 @@
+; $Id$
+name = Organic groups Views integration
+description = "Use Views to search and display organic groups. Highly recommended."
+package = "Organic groups"
+dependencies[] = og
+dependencies[] = views
+core = 6.x
Oops, something went wrong. Retry.

0 comments on commit 75ab1ed

Please sign in to comment.