Changeset 127
- Timestamp:
- 01/02/09 17:24:11 (20 months ago)
- Location:
- external/current/sites/all/modules/og
- Files:
-
- 47 added
- 1 removed
- 15 modified
-
CVS (added)
-
CVS/Entries (added)
-
CVS/Entries.Log (added)
-
CVS/Repository (added)
-
CVS/Root (added)
-
CVS/Tag (added)
-
CVS/Template (added)
-
LICENSE.txt (deleted)
-
README.txt (modified) (1 diff)
-
includes/CVS (added)
-
includes/CVS/Entries (added)
-
includes/CVS/Repository (added)
-
includes/CVS/Root (added)
-
includes/CVS/Tag (added)
-
includes/CVS/Template (added)
-
includes/groupcontent.inc (modified) (2 diffs)
-
includes/groupcontext.inc (modified) (2 diffs)
-
og.info (modified) (1 diff)
-
og.install (modified) (14 diffs)
-
og.module (modified) (74 diffs)
-
og_access.info (modified) (1 diff)
-
og_access.module (modified) (6 diffs)
-
og_notifications (added)
-
og_notifications/CVS (added)
-
og_notifications/CVS/Entries (added)
-
og_notifications/CVS/Entries.Log (added)
-
og_notifications/CVS/Repository (added)
-
og_notifications/CVS/Root (added)
-
og_notifications/CVS/Tag (added)
-
og_notifications/CVS/Template (added)
-
og_notifications/README.txt (added)
-
og_notifications/og_notifications.info (added)
-
og_notifications/og_notifications.install (added)
-
og_notifications/og_notifications.module (added)
-
og_notifications/po (added)
-
og_notifications/po/CVS (added)
-
og_notifications/po/CVS/Entries (added)
-
og_notifications/po/CVS/Repository (added)
-
og_notifications/po/CVS/Root (added)
-
og_notifications/po/CVS/Tag (added)
-
og_notifications/po/CVS/Template (added)
-
og_notifications/po/og_notifications-module.po (added)
-
og_notifications/po/og_notifications-module.pot (added)
-
og_panels.info (modified) (1 diff)
-
og_panels.install (modified) (2 diffs)
-
og_panels.module (modified) (10 diffs)
-
og_views.inc (modified) (49 diffs)
-
og_workflow_ng.inc (modified) (5 diffs)
-
og_xmlrpc.inc (modified) (2 diffs)
-
po/CVS (added)
-
po/CVS/Entries (added)
-
po/CVS/Repository (added)
-
po/CVS/Root (added)
-
po/CVS/Tag (added)
-
po/CVS/Template (added)
-
po/de.po (modified) (2 diffs)
-
po/og.pot (added)
-
tests/CVS (added)
-
tests/CVS/Entries (added)
-
tests/CVS/Repository (added)
-
tests/CVS/Root (added)
-
tests/CVS/Tag (added)
-
tests/CVS/Template (added)
Legend:
- Unmodified
- Added
- Removed
-
external/current/sites/all/modules/og/README.txt
r42 r127 42 42 INTEGRATION 43 43 --------------------- 44 - 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.45 44 - This module exposes an API for retrieving and managing membership via direct PHP functions [og_save_subscription()] and via XMLRPC. 45 - Enabling og_notifications provides subscription support for groups and group 46 posts. The README in the og_notifications directory provides more information. 46 47 47 48 UNIT TESTING -
external/current/sites/all/modules/og/includes/groupcontent.inc
r42 r127 6 6 'icon' => 'user-multiple.png', 7 7 'path' => drupal_get_path('module', 'og_panels'). '/', 8 'description' => t('The welcome message for the group. Specified on group edit form '),8 'description' => t('The welcome message for the group. Specified on group edit form.'), 9 9 'required context' => new panels_required_context(t('Group'), 'group'), 10 10 'category' => array(t('Organic groups'), -10), … … 184 184 '#type' => 'textfield', 185 185 '#title' => t('Number of members'), 186 '#description' => t('Maximum number of members that should appear on the list '),186 '#description' => t('Maximum number of members that should appear on the list.'), 187 187 '#default_value' => isset($conf['num_items']) ? $conf['num_items'] : 10, 188 188 '#size' => 5, -
external/current/sites/all/modules/og/includes/groupcontext.inc
r42 r127 1 1 <?php 2 // $Id: groupcontext.inc,v 1.1.2. 3 2008/03/22 21:50:52weitzman Exp $2 // $Id: groupcontext.inc,v 1.1.2.4 2008/05/26 14:03:35 weitzman Exp $ 3 3 /** 4 4 * @file contexts/group.inc … … 35 35 '#type' => 'checkbox', 36 36 '#default_value' => $conf['external'], 37 '#title' => t('Require this context from an external source (such as containing panel page) '),37 '#title' => t('Require this context from an external source (such as containing panel page).'), 38 38 '#description' => t('If selected, group selection (below) will be ignored'), 39 39 ); -
external/current/sites/all/modules/og/og.info
r42 r127 3 3 package = "Organic groups" 4 4 dependencies = views views_rss 5 ; Information added by drupal.org packaging script on 2008-05-126 version = "5.x-7.2"7 project = "og"8 datestamp = "1210629035"9 -
external/current/sites/all/modules/og/og.install
r42 r127 1 1 <?php 2 // $Id: og.install,v 1.21.2.3 1 2008/05/05 21:27:57weitzman Exp $2 // $Id: og.install,v 1.21.2.32.2.8 2008/10/09 15:06:14 weitzman Exp $ 3 3 4 4 function og_install() { … … 13 13 register int(1) NOT NULL default 0, 14 14 directory int(1) NOT NULL default 0, 15 notification int(1) NOT NULL default 0,16 15 language varchar(12) NOT NULL default '', 17 16 private int(1) NOT NULL default 0, … … 25 24 is_admin int(1) NOT NULL DEFAULT 0, 26 25 uid int(11) NOT NULL, 27 mail_type int(11) NULL, 28 created int(11) NULL DEFAULT 0, 29 changed int(11) NULL DEFAULT 0, 26 created int(11) NULL DEFAULT 0, 27 changed int(11) NULL DEFAULT 0, 30 28 PRIMARY KEY (nid, uid) 31 29 ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); 32 30 33 db_query("CREATE TABLE {og_uid_global} (34 uid int(11) NOT NULL,35 og_email int(11) NOT NULL DEFAULT 2,36 PRIMARY KEY (uid)37 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");38 31 db_query("CREATE TABLE {og_ancestry} ( 39 32 nid int(11) NOT NULL, … … 53 46 register smallint NOT NULL default 0, 54 47 directory smallint NOT NULL default 0, 55 notification smallint NOT NULL default 0,56 48 language varchar(12) NOT NULL default '', 57 49 private smallint NOT NULL default 0, … … 65 57 is_admin smallint NOT NULL DEFAULT 0, 66 58 uid int NOT NULL, 67 mail_type int NULL, 68 created int NULL DEFAULT 0, 69 changed int NULL DEFAULT 0, 59 created int NULL DEFAULT 0, 60 changed int NULL DEFAULT 0, 70 61 PRIMARY KEY (nid, uid) 71 62 );"); 72 63 73 db_query("CREATE TABLE {og_uid_global} ( 74 uid int NOT NULL, 75 og_email int NOT NULL DEFAULT 2, 76 PRIMARY KEY (uid) 77 );"); 78 79 db_query(" 80 CREATE TABLE {og_ancestry} ( 64 db_query("CREATE TABLE {og_ancestry} ( 81 65 nid int NOT NULL, 82 66 group_nid int NOT NULL, … … 89 73 90 74 // enable standard og blocks. for custom profiles, block may not be included yet. 91 if (function_exists(' block_rehash')) {75 if (function_exists('_block_rehash')) { 92 76 _block_rehash(); 93 77 } … … 312 296 } 313 297 314 // populate the og_uid_global table. we have to choose selective here for backward compatibility. 315 // to set everyone up for 'always' notifications, run this after the update: UPDATE og_uid_global SET og_email=1 298 // populate the og_uid_global table. we have to choose selective here for 299 // backward compatibility. To set everyone up for 'always' notifications, run 300 // this after the update: UPDATE og_uid_global SET og_email=1 301 // og_uid_global is later moved into og_notifications. This update is only 302 // around to retain schema consistency - the population script has been removed. 316 303 function og_update_13() { 317 304 switch ($GLOBALS['db_type']) { … … 332 319 break; 333 320 } 334 335 // works for mysql and postgres 336 $sql = 'SELECT uid FROM {users} WHERE uid > 0'; 337 $result = db_query($sql); 338 while ($row = db_fetch_object($result)) { 339 $sql = "INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)"; 340 db_query($sql, $row->uid, OG_NOTIFICATION_SELECTIVE); 341 } 321 342 322 return array(); 343 323 } … … 424 404 } 425 405 406 // Formerly contained og_uid_global code which is no longer required. 426 407 function og_update_19() { 427 og_populate_uid_global_table(); 428 return array('Populated og_uid_global table'); 408 return array(); 429 409 } 430 410 … … 464 444 $ret = array(); 465 445 if (variable_get('og_enabled', FALSE) && !module_exists('og_access')) { 466 module_enable('og_access');446 drupal_install_modules(array('og_access')); 467 447 } 468 448 // variable_del('og_enabled'); is harmless to leave around, and will help if someone reruns the update. … … 497 477 return $ret; 498 478 } 499 500 // end updates // 501 502 function og_enable() { 503 og_populate_uid_global_table(); 504 } 505 506 // need to populate og_uid_global for existing users on enable 507 // this is called from update 13 & 19 & og_enable. 508 // TODO: conditionally use subquery 509 function og_populate_uid_global_table() { 510 $sql = 'SELECT u.uid FROM {users} u LEFT JOIN {og_uid_global} oug ON u.uid=oug.uid WHERE u.uid > 0 AND oug.og_email IS NULL'; 511 $result = db_query($sql); 512 while ($row = db_fetch_object($result)) { 513 $sql = "INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)"; 514 db_query($sql, $row->uid, OG_NOTIFICATION_SELECTIVE); 515 } 516 } 479 480 /** 481 * Force menu rebuild since subscribe/unsubscribe paths are better protected now. 482 */ 483 function og_update_5702() { 484 $ret[] = array('success' => TRUE, 'query' => 'Menu has been rebuilt.'); 485 menu_rebuild(); 486 return $ret; 487 } 488 489 /** 490 * Notifications upgrade: Set flag to indicate that this is an upgraded 491 * installation. 492 */ 493 function og_update_5703() { 494 // Remove mail / no mail options from OG group types and move preferences to 495 // og_notifications. 496 $types = og_get_types('group_post'); 497 $mail_types = array(); 498 foreach ($types as $type) { 499 $variable = 'og_content_type_usage_'. $type; 500 $usage = variable_get($variable, ''); 501 switch ($usage) { 502 case 'group_post_standard_mail': 503 $mail_types[$type] = $type; 504 case 'group_post_standard_nomail': 505 variable_set($variable, 'group_post_standard'); 506 break; 507 case 'group_post_wiki_mail': 508 $mail_types[$type] = $type; 509 case 'group_post_wiki_nomail': 510 variable_set($variable, 'group_post_wiki'); 511 break; 512 } 513 } 514 // Set variable for og_notifications. If it is never enabled, this variable 515 // is also deleted in og_uninstall. 516 variable_set('og_notifications_content_types', $mail_types); 517 518 // Vestigial variable. 519 variable_del('og_omitted_email_node_types'); 520 521 // Set update flag for og_notifications. 522 variable_set('og_notifications_update_required', 1); 523 524 return array(); 525 } 526 527 // end updates // 517 528 518 529 function og_uninstall() { … … 520 531 db_query('DROP TABLE {og}'); 521 532 db_query('DROP TABLE {og_uid}'); 522 db_query('DROP TABLE {og_uid_global}');523 533 db_query('DROP TABLE {og_ancestry}'); 534 535 // In case og_notifications has never been enabled, the vestigial 536 // og_uid_global table will still be around. 537 if (variable_get('og_notifications_update_required', FALSE)) { 538 db_query('DROP TABLE {og_uid_global}'); 539 } 524 540 525 541 // Delete variables … … 527 543 'og_member_pics', 'og_help', 'og_block_cnt_2', 'og_block_cnt_3', 528 544 'og_audience_checkboxes', 'og_omitted', 'og_content_type_usage', 529 'og_audience_required', 'og_omitted_email_node_types',545 'og_audience_required', 530 546 'og_visibility_directory', 'og_visibility_registration', 531 547 'og_home_page_view', 'og_email_max', 'og_node_types', … … 536 552 'og_new_admin_body', 'og_new_admin_subject', 537 553 'og_new_node_body', 'og_new_node_subject', 538 'og_notification', 'og_request_user_body', 'og_request_user_subject', 554 'og_request_user_body', 'og_request_user_subject', 555 'og_notifications_update_required', 'og_notifications_content_types' 539 556 ); 540 557 foreach ($variables as $variable) { -
external/current/sites/all/modules/og/og.module
r42 r127 1 1 <?php 2 // $Id: og.module,v 1.298.2.1 85 2008/05/08 19:49:26weitzman Exp $2 // $Id: og.module,v 1.298.2.197.2.15 2008/11/02 20:30:45 weitzman Exp $ 3 3 4 4 // Selective groups states. chosen by the group admin … … 19 19 define('OG_DIRECTORY_CHOOSE_TRUE', 2); 20 20 define('OG_DIRECTORY_CHOOSE_FALSE', 3); 21 22 // site admin chooses in og_admin_settings() whether new registrants receive group email notifications by default23 define('OG_NOTIFICATION_NEVER', 0);24 define('OG_NOTIFICATION_ALWAYS', 1);25 define('OG_NOTIFICATION_SELECTIVE', 2);26 21 27 22 function og_help($section) { … … 41 36 if ($may_cache) { 42 37 // anon users should be able to get to the join page 43 $items[] = array('path' => 'og/subscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_ subscribe', 'access' => TRUE, 'title' => t('Join group'));38 $items[] = array('path' => 'og/subscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_menu_check_node_view', 'access' => TRUE, 'callback arguments' => array('og_subscribe'), 'title' => t('Join group')); 44 39 45 40 $items[] = array('path' => 'og/opml', 'type' => MENU_CALLBACK, 'callback' => 'og_opml', 'access' => $access, 'title' => t('OPML')); 46 $items[] = array('path' => 'og/unsubscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_ unsubscribe', 'access' => $access, 'title' => t('Leave group'));41 $items[] = array('path' => 'og/unsubscribe', 'type' => MENU_CALLBACK, 'callback' => 'og_menu_check_node_view', 'callback arguments' => array('og_unsubscribe'), 'access' => $access, 'title' => t('Leave group')); 47 42 $items[] = array('path' => 'og/approve', 'type' => MENU_CALLBACK, 'callback' => 'og_approve', 'access' => $access, 'title' => t('Approve membership request')); 48 43 $items[] = array('path' => 'og/deny', 'type' => MENU_CALLBACK, 'callback' => 'og_deny', 'access' => $access, 'title' => t('Deny membership request')); … … 66 61 'path' => 'admin/og', 67 62 'title' => t('Organic groups'), 68 'description' => t('Administer the suite of Organic groups modules.'),63 'description' => t('Administer the suite of organic groups modules.'), 69 64 'position' => 'right', 70 65 'weight' => -5, … … 78 73 79 74 // we get a NOTICE if doing this from within og_theme() so I do it here for now. 80 $_SESSION['og_last'] = og_get_group_context(); 75 if ($group_node = og_get_group_context()) { 76 if ($user->uid || variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED) { 77 $_SESSION['og_last'] = og_get_group_context(); 78 } 79 } 81 80 82 81 //membership page and its 'add members' tab … … 92 91 $items[] = array('path' => "og/users/$gid/add_user", 'callback' => 'drupal_get_form', 'title' => t('Add members'), 'callback arguments' => array('og_add_users', $gid), 'type' => MENU_LOCAL_TASK, 'weight' => 5, 'access' => og_is_node_admin($node)); 93 92 } 94 95 // email tab on group node93 94 // Broadcast tab on group node. 96 95 if (arg(0) == 'node' && is_numeric(arg(1))) { 97 96 $node = node_load(arg(1)); 98 97 if (og_is_group_type($node->type)) { 99 $items[] = array('path' => 'node/'. arg(1). '/email', 'title' => t('E-mail'), 'callback' => 'drupal_get_form', 'callback arguments' => array('og_email_form', arg(1)), 'access' => og_is_node_admin($node), 'type' => MENU_LOCAL_TASK, 'weight' => 7); 98 $items[] = array( 99 'path' => 'node/'. arg(1) .'/broadcast', 100 'title' => t('Broadcast'), 101 'callback' => 'drupal_get_form', 102 'callback arguments' => array('og_broadcast_form', arg(1)), 103 'access' => og_broadcast_access($node), 104 'type' => MENU_LOCAL_TASK, 105 'weight' => 7 106 ); 100 107 } 101 108 } … … 119 126 drupal_access_denied(); 120 127 } 128 } 129 130 // check for node access 'view' and then pass along to the real menu callback 131 // arguments must be in this order: function, $gid, <extra params required by function> 132 function og_menu_check_node_view() { 133 global $user; 134 135 $args = func_get_args(); 136 $function = array_shift($args); 137 $gid = $args[0]; 138 $node = node_load((int)$gid); 139 if (node_access('view', $node)) { 140 return call_user_func_array($function, $args); 141 } 142 else { 143 drupal_access_denied(); 144 } 145 121 146 } 122 147 … … 280 305 281 306 /** 282 * Admins may broadcast email to all their members307 * Admins may broadcast messages to all their members. 283 308 * 284 309 * @param $gid 285 310 * the nid of a group. 286 311 */ 287 function og_ email_form($gid) {312 function og_broadcast_form($gid) { 288 313 $node = node_load($gid); 289 drupal_set_title(t('Send emailto %group', array('%group' => $node->title)));314 drupal_set_title(t('Send message to %group', array('%group' => $node->title))); 290 315 291 316 $result = db_query(og_list_users_sql(1), $gid); 292 317 $txt = format_plural(db_num_rows($result), 'the sole member', 'all @count members'); 293 318 if (!$_POST) { 294 drupal_set_message(t('Your email will be sent to !count in this group. Please use this feature sparingly.', array('!count' => l($txt, "og/users/$gid"))));295 } 296 297 $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 70, '#maxlength' => 250, '#description' => t("Enter a subject for your email."), '#required' => true);298 $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#rows' => 5, '#cols' => 90, '#description' => t('Enter a body for your email.'), '#required' => true);299 $form['send'] = array('#type' => 'submit', '#value' => t('Send email'));319 drupal_set_message(t('Your message will be sent to !count in this group.', array('!count' => l($txt, "og/users/$gid")))); 320 } 321 322 $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#size' => 70, '#maxlength' => 250, '#description' => t("Enter a subject for your message."), '#required' => true); 323 $form['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#rows' => 5, '#cols' => 90, '#description' => t('Enter the body of your message.'), '#required' => true); 324 $form['send'] = array('#type' => 'submit', '#value' => t('Send message')); 300 325 $form['gid'] = array('#type' => 'value', '#value' => $gid); 301 326 return $form; 302 327 } 303 328 304 function og_email_form_submit($form_id, $form_values) { 329 function og_broadcast_form_submit($form_id, $form_values) { 330 global $user; 331 332 $sql = og_list_users_sql(1); 333 $result = db_query($sql, $form_values['gid']); 334 $recipients = array(); 335 while ($row = db_fetch_object($result)) { 336 $recipients[] = $row->uid; 337 } 338 305 339 $node = node_load($form_values[gid]); 306 307 340 $variables = array( 308 341 '@group' => $node->title, … … 312 345 '!url_unsubscribe' => url("og/unsubscribe/$node->nid", NULL, NULL, TRUE) 313 346 ); 314 315 global $user; 316 $from = $user->mail; 317 $sql = og_list_users_sql(1); 318 $result = db_query($sql, $form_values['gid']); 319 while ($row = db_fetch_object($result)) { 320 $emails[] = $row->mail; 321 } 322 foreach ($emails as $mail) { 323 drupal_mail('og_mail', trim($mail), $form_values['subject'], _og_user_mail_text('og_admin_email_body', $variables), $from); 324 } 325 drupal_set_message(format_plural(count($emails), '1 email sent.', '@count emails sent')); 347 $message = array( 348 'from' => $user, 349 'subject' => $form_values['subject'], 350 'body' => _og_user_mail_text('og_admin_email_body', $variables) 351 ); 352 353 // Send notifications to each member; Sending an array of recipients implies 354 // that this is a bulk message. 355 module_invoke_all('og', 'user broadcast', $gid, $recipients, $message); 356 drupal_set_message(format_plural(count($recipients), '1 message queued for delivery.', '@count messages queued for delivery.')); 357 326 358 drupal_goto("node/{$form_values[gid]}"); 327 359 } … … 330 362 global $user; 331 363 332 // warn users who can't receive mail anyway333 if ($txt = user_validate_mail($user->mail)) {334 drupal_set_message($txt, 'error');335 return '';336 }337 338 364 $group = node_load($gid); 339 365 $bc[] = array('path' => "og", 'title' => t('Groups')); … … 362 388 } 363 389 364 switch ($user->og_email) {365 // og_email can be NULL when you enable og on an existing site.366 case NULL:367 case OG_NOTIFICATION_SELECTIVE:368 $form['mail_type'] = array('#type' => 'radios', '#title' => t('Email notification'), '#default_value' => $user->og_groups[$group->nid]['mail_type'], '#options' => array(1 => t('enabled'), 0 => t('disabled')), '#description' => t('Do you want to receive an email each time a message is posted to this group?'));369 $submit = TRUE;370 break;371 case OG_NOTIFICATION_ALWAYS:372 $form['mail_type'] = array('#type' => 'item', '#title' => t('Email notification'), '#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Always receive email notifications</em>.', array('!prof' => url("user/$user->uid/edit"))));373 break;374 case OG_NOTIFICATION_NEVER:375 $form['mail_type'] = array('#type' => 'item', '#title' => t('Email notification'), '#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Never receive email notifications</em>.', array('!prof' => url("user/$user->uid/edit"))));376 break;377 }378 if ($submit) {379 $form['op'] = array('#type' => 'submit', '#value' => t('Submit'));380 }381 390 $form['gid'] = array('#type' => 'value', '#value' => $group->nid); 382 391 return $form; … … 397 406 * @param $uid user ID of user 398 407 * @param $args an array with details of this membership. Possible array keys are: 399 is_active, is_admin, mail_type,created408 is_active, is_admin, created 400 409 */ 401 410 function og_save_subscription($gid, $uid, $args = array()) { … … 403 412 $cnt = db_result(db_query($sql, $gid, $uid)); 404 413 $time = time(); 414 415 // Allow other modules to pass their data inside the $args. 416 $og_allowed_args = array('is_active', 'is_admin', 'created'); 417 $return_args = $args; 418 foreach ($args as $key => $value) { 419 if (!in_array($key, $og_allowed_args)) { 420 unset($args[$key]); 421 } 422 } 405 423 if ($cnt == 0) { 406 424 // this pattern borrowed from user_save() … … 411 429 $fields[] = db_escape_string($key); 412 430 $values[] = $value; 413 $s[] = "'%s'"; 431 $s[] = "'%s'"; 414 432 } 415 433 db_query('INSERT INTO {og_uid} ('. implode(', ', $fields). ') VALUES (%d, %d, %d, %d, '. implode(', ', $s). ')', $values); 416 module_invoke_all('og', 'user insert', $gid, $uid, $ args);434 module_invoke_all('og', 'user insert', $gid, $uid, $return_args); 417 435 } 418 436 else { … … 423 441 $cond = implode(', ', $cond); 424 442 db_query("UPDATE {og_uid} SET $cond WHERE nid = %d AND uid = %d", $gid, $uid); 425 module_invoke_all('og', 'user update', $gid, $uid, $ args);426 } 427 } 428 429 function og_delete_subscription($gid, $uid ){443 module_invoke_all('og', 'user update', $gid, $uid, $return_args); 444 } 445 } 446 447 function og_delete_subscription($gid, $uid, $args = array()){ 430 448 $sql = "DELETE FROM {og_uid} WHERE nid = %d AND uid = %d"; 431 449 db_query($sql, $gid, $uid); 432 module_invoke_all('og', 'user delete', $gid, $uid, array()); 450 // Allow other modules to pass their data inside the $args. 451 module_invoke_all('og', 'user delete', $gid, $uid, $args); 433 452 } 434 453 … … 442 461 } 443 462 if (in_array($gid, array_keys($account->og_groups))) { 444 drupal_set_message(t("!name already approved to group %group ", array('!name' => theme('username', $account), '%group' => $node->title)), 'error');463 drupal_set_message(t("!name already approved to group %group.", array('!name' => theme('username', $account), '%group' => $node->title)), 'error'); 445 464 return ''; 446 465 } … … 450 469 451 470 $variables = array( 452 '@title' => $node->title, 453 '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 454 ); 455 456 $from = variable_get('site_mail', ini_get('sendmail_from')); 457 $account = user_load(array('uid' => $uid)); 458 drupal_mail('og_approve', $account->mail, _og_user_mail_text('og_approve_user_subject', $variables), _og_user_mail_text('og_approve_user_body', $variables), $from); 471 '@title' => $node->title, 472 '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 473 ); 474 $message = array( 475 'subject' => _og_user_mail_text('og_approve_user_subject', $variables), 476 'body' => _og_user_mail_text('og_approve_user_body', $variables) 477 ); 478 479 module_invoke_all('og', 'user approve', $gid, $uid, $message); 459 480 drupal_goto("node/$gid"); 460 481 } … … 473 494 $variables = array( 474 495 '@title' => $node->title, 475 '!group_url' => url("node/$node->nid", NULL, NULL, TRUE)496 '!group_url'=> url("node/$node->nid", NULL, NULL, TRUE) 476 497 ); 477 478 $from = variable_get('site_mail', ini_get('sendmail_from')); 479 $account = user_load(array('uid' => $uid)); 480 drupal_mail('og_deny', $account->mail, _og_user_mail_text('og_deny_user_subject', $variables), _og_user_mail_text('og_deny_user_body', $variables), $from); 498 $message = array( 499 'subject' => _og_user_mail_text('og_deny_user_subject', $variables), 500 'body' => _og_user_mail_text('og_deny_user_body', $variables) 501 ); 502 503 module_invoke_all('og', 'user deny', $gid, $uid, $message); 481 504 drupal_goto("node/$gid"); 482 505 } … … 519 542 520 543 og_save_subscription($node->nid, $account->uid, array('is_admin' => 1)); 521 drupal_set_message(t('%name was promoted to %ga ', array('%name' => $account->name, '%ga' => t('group administrator'))));544 drupal_set_message(t('%name was promoted to %ga.', array('%name' => $account->name, '%ga' => t('group administrator')))); 522 545 523 546 $variables = array( … … 526 549 '@username' => $account->name 527 550 ); 528 529 $from = variable_get('site_mail', ini_get('sendmail_from')); 530 drupal_mail('og_new_admin', $account->mail, _og_user_mail_text('og_new_admin_subject', $variables), _og_user_mail_text('og_new_admin_body', $variables), $from); 551 $message = array( 552 'subject' => _og_user_mail_text('og_new_admin_subject', $variables), 553 'body' => _og_user_mail_text('og_new_admin_body', $variables) 554 ); 555 556 module_invoke_all('og', 'admin create', $node->nid, $account->uid, $message); 531 557 return "og/users/$node->nid"; 532 558 } … … 564 590 $gid = $form_values['gid']; 565 591 og_save_subscription($gid, $account->uid, array('is_admin' => 0)); 566 drupal_set_message(t('%name is no longer a %ga ', array('%name' => $account->name, '%ga' => t('group administrator'))));592 drupal_set_message(t('%name is no longer a %ga.', array('%name' => $account->name, '%ga' => t('group administrator')))); 567 593 return "og/users/$gid"; 568 594 } … … 599 625 $emails = explode(',', $mails); 600 626 if (count($emails) > $max) { 601 form_set_error('mails', t( "You may not specify more than %max email addresses or usernames.", array('%max' => $max)));627 form_set_error('mails', t('You may not specify more than %max email addresses or usernames.', array('%max' => $max))); 602 628 } 603 629 elseif (in_array($user->mail, $emails)) { 604 form_set_error('mails', t( "You may not invite yourself - @self", array('@self' => $user->mail)));630 form_set_error('mails', t('You may not invite yourself - @self', array('@self' => $user->mail))); 605 631 } 606 632 else { … … 626 652 } 627 653 if (count($bad)) { 628 form_set_error('mails', t(' invalid email address or username: '). implode(' ', $bad));654 form_set_error('mails', t('Invalid email address or username:') .' '. implode(' ', $bad)); 629 655 } 630 656 else { … … 670 696 } 671 697 $node = node_load($gid); 672 if ($node->og_selective >= OG_INVITE_ONLY || $node->status == 0 ) {698 if ($node->og_selective >= OG_INVITE_ONLY || $node->status == 0 || !og_is_group_type($node->type)) { 673 699 drupal_access_denied(); 674 700 exit(); … … 718 744 719 745 /** 720 * Create a new membership for a given user to given group and send proper email. Edits to membership should746 * Create a new membership for a given user to given group. Edits to membership should 721 747 * go through og_save_subscription(). No access control since this is an API function. 722 748 * … … 729 755 case OG_MODERATED: 730 756 og_save_subscription($gid, $account->uid, array('is_active' => 0)); 757 731 758 $sql = og_list_users_sql(1, 1); 732 759 $res = db_query($sql, $node->nid); 760 $admins = array(); 733 761 while ($row = db_fetch_object($res)) { 734 if ($row->mail) { 735 $admins[] = $row->mail; 762 $admins[] = $row->uid; 763 } 764 765 if (!empty($admins)) { 766 // Prepend user's request text with standard cruft. Should be a 767 // variable but that's a bit annoying. 768 if ($request) { 769 $request = t("\n\nPersonal message from @name:\n------------------\n\n@request", array('@name' => $account->name, '@request' => $request)); 736 770 } 737 }738 if ($admins) {739 771 $variables = array( 740 772 '@group' => $node->title, … … 743 775 '!group_url' => url("og/users/$node->nid", NULL, NULL, TRUE) 744 776 ); 745 746 $from = variable_get('site_mail', ini_get('sendmail_from')); 747 // prepend user's request text with standard cruft. should be a mail variable but thats a bit annoying 748 if ($request) { 749 $request = t("\n\nPersonal message from @name:\n------------------\n\n@request", array('@name' => $account->name, '@request' => $request)); 750 } 751 drupal_mail('og_subscription_request', implode(', ', $admins), _og_user_mail_text('og_request_user_subject', $variables), _og_user_mail_text('og_request_user_body', $variables). $request, $from); 752 } 777 $message = array( 778 'subject' => _og_user_mail_text('og_request_user_subject', $variables), 779 'body' => _og_user_mail_text('og_request_user_body', $variables) . $request 780 ); 781 782 // Send notifications to each admin; Sending an array of recipients 783 // implies that this is a bulk message. 784 module_invoke_all('og', 'user request', $gid, $admins, $message); 785 } 786 753 787 $return_value = array('type' => 'approval', 754 788 'message' => t('Membership request to the %group group awaits approval by an administrator.', array('%group' => $node->title))); … … 758 792 og_save_subscription($gid, $account->uid, array('is_active' => 1)); 759 793 $return_value = array('type' => 'subscribed', 760 'message' => t('You are now a member of the %group ', array('%group' => $node->title)));794 'message' => t('You are now a member of the %group.', array('%group' => $node->title))); 761 795 break; 762 796 case OG_CLOSED: … … 780 814 } 781 815 $node = node_load($gid); 782 if ($uid != $user->uid && !og_is_node_admin($node)) { 783 // only admins can remove another member 816 $account = user_load(array('uid' => $uid)); 817 if (!in_array($gid, array_keys(og_get_subscriptions($account->uid, 0))) || ($uid != $user->uid && !og_is_node_admin($node))) { 818 // Ubsubscribee must be a member or awaiting approval 819 // Only admins can remove another member. 784 820 drupal_access_denied(); 785 821 exit(); 786 822 } 787 if ( ($node->og_selective == OG_CLOSED && !og_is_node_admin($node)) || $node->uid == $uid){823 if (!og_is_group_type($node->type) || ($node->og_selective == OG_CLOSED && !og_is_node_admin($node)) || $node->uid == $uid){ 788 824 // Regular users may not leave from a closed group 789 825 // Group manager may never leave (TODO: fix), such a link should never be generated … … 880 916 } 881 917 else { 882 $bad[] = $name;918 $bad[] = check_plain($name); 883 919 $err = TRUE; 884 920 } 885 921 } 886 922 if ($err) { 887 form_set_error('og_names', t('Unrecognized %names: ', array('%names' => format_plural(count($bad), 'name', 'names'))). implode(', ', $bad));923 form_set_error('og_names', t('Unrecognized %names:', array('%names' => format_plural(count($bad), 'name', 'names'))) .' '. implode(', ', $bad)); 888 924 } 889 925 } … … 901 937 og_save_subscription($form_values['gid'], $account->uid, array('is_active' => 1)); 902 938 } 903 drupal_set_message(format_plural(count($accounts), '1 user added to the group ', '@count users added to the group'));939 drupal_set_message(format_plural(count($accounts), '1 user added to the group.', '@count users added to the group.')); 904 940 } 905 941 … … 912 948 // prepend the group manager 913 949 $i=0; 914 $rows[$i][] = array('data' => theme('username', $node). ' <em>'. t(' manager'). '</em>', 'colspan' => 3);950 $rows[$i][] = array('data' => theme('username', $node). ' <em>'. t('Manager'). '</em>', 'colspan' => 3); 915 951 $i++; 916 952 … … 921 957 if ($account->uid != $node->uid) { 922 958 $username = theme('username', $account); 923 if (!$account->is_active) { $username .= ' <em>'. t('(approval needed)'). '</em>'; }924 elseif ($account->is_admin) { $username .= ' <em>'. t('administrator'). '</em>'; }959 if (!$account->is_active) { $username .= ' <em>'. t('(approval needed)'). '</em>'; } 960 elseif ($account->is_admin) { $username .= ' <em>'. t('Administrator'). '</em>'; } 925 961 $rows[$i][] = $username; 926 962 if ($access) { 927 963 if ($account->is_active) { 928 $rows[$i][] = l(t(' remove'), "og/unsubscribe/$gid/$account->uid", array(), "destination=og/users/$gid");964 $rows[$i][] = l(t('Remove'), "og/unsubscribe/$gid/$account->uid", array(), "destination=og/users/$gid"); 929 965 if ($account->is_admin) { 930 $rows[$i][] = l(t(' admin: remove'), "og/delete_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']);966 $rows[$i][] = l(t('Admin: Remove'), "og/delete_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 931 967 } 932 968 else { 933 $rows[$i][] = l(t(' admin: create'), "og/create_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']);969 $rows[$i][] = l(t('Admin: Create'), "og/create_admin/$gid/$account->uid", array(), 'destination='. $_GET['q']); 934 970 } 935 971 } 936 972 else { 937 $rows[$i][] = l(t(' approve'), "og/approve/$gid/$account->uid", array(), "destination=og/users/$gid");938 $rows[$i][] = l(t(' deny'), "og/deny/$gid/$account->uid", array(), "destination=og/users/$gid");973 $rows[$i][] = l(t('Approve'), "og/approve/$gid/$account->uid", array(), "destination=og/users/$gid"); 974 $rows[$i][] = l(t('Deny'), "og/deny/$gid/$account->uid", array(), "destination=og/users/$gid"); 939 975 } 940 976 } … … 956 992 function og_list_users_faces_page($gid, $column_count = 5, $row_count = 10, $pager_id = 0) { 957 993 $max_per_page = $row_count * $column_count; 958 $sql = og_list_users_sql( 0, 0, 'ou.is_admin DESC, u.picture DESC, u.name ASC');994 $sql = og_list_users_sql(1, 0, 'ou.is_admin DESC, u.picture DESC, u.name ASC'); 959 995 /* list group admins first, members with pics second, regular members last. Alphabetize within each of these categories */ 960 996 $result = pager_query($sql, $max_per_page, $pager_id, NULL, $gid); … … 1073 1109 unset($node->content['body']); 1074 1110 $node->content['og_mission'] = array( 1075 '#value' => check_markup($node->body, $node->format, FALSE),1111 '#value' => $node->body, // node_prepare() already ran check_markup() 1076 1112 '#node' => $node, 1077 1113 '#weight' => -3, … … 1101 1137 og_home_empty($node); 1102 1138 } 1103 drupal_set_title( filter_xss_admin(views_get_title($view, 'page')));1139 drupal_set_title(check_plain(views_get_title($view, 'page'))); 1104 1140 } 1105 1141 } … … 1270 1306 1271 1307 function og_load_group(&$node) { 1272 $sql = 'SELECT selective AS og_selective, description AS og_description, theme AS og_theme, register AS og_register, directory AS og_directory, notification AS og_notification,language AS og_language, private AS og_private FROM {og} WHERE nid = %d';1308 $sql = 'SELECT selective AS og_selective, description AS og_description, theme AS og_theme, register AS og_register, directory AS og_directory, language AS og_language, private AS og_private FROM {og} WHERE nid = %d'; 1273 1309 $result = db_query($sql, $node->nid); 1274 1310 $node = (object) array_merge((array)$node, (array)db_fetch_array($result)); … … 1277 1313 1278 1314 function og_insert_group($node) { 1279 $sql = "INSERT INTO {og} (nid, theme, selective, description, register, directory, notification, language, private) VALUES (%d, '%s', %d, '%s', %d, %d, %d, '%s', %d)";1280 db_query($sql, $node->nid, $node->og_theme, $node->og_selective, $node->og_description, $node->og_register, $node->og_directory, $node->og_ notification, $node->og_language, $node->og_private);1315 $sql = "INSERT INTO {og} (nid, theme, selective, description, register, directory, language, private) VALUES (%d, '%s', %d, '%s', %d, %d, '%s', %d)"; 1316 db_query($sql, $node->nid, $node->og_theme, $node->og_selective, $node->og_description, $node->og_register, $node->og_directory, $node->og_language, $node->og_private); 1281 1317 } 1282 1318 1283 1319 function og_update_group($node) { 1284 $sql = "UPDATE {og} SET theme = '%s', selective = %d, register = %d, description = '%s', directory = %d, notification = %d,language = '%s', private = %d WHERE nid = %d";1285 db_query($sql, $node->og_theme, $node->og_selective, $node->og_register, $node->og_description, $node->og_directory, $node->og_ notification, $node->og_language, $node->og_private, $node->nid);1320 $sql = "UPDATE {og} SET theme = '%s', selective = %d, register = %d, description = '%s', directory = %d, language = '%s', private = %d WHERE nid = %d"; 1321 db_query($sql, $node->og_theme, $node->og_selective, $node->og_register, $node->og_description, $node->og_directory, $node->og_language, $node->og_private, $node->nid); 1286 1322 if (!db_affected_rows()) { 1287 1323 og_insert_group($node); … … 1326 1362 break; 1327 1363 case 'validate': 1328 if (og_is_group_type($node->type)) { 1329 // Email address is required for contacting the Manager 1330 $account = user_load(array('uid' => $node->uid)); 1331 if ($account->uid > 0 && empty($account->mail)) { 1332 form_set_error('name', t('The group manager, %name, must have an email address in his <a href="!profile">profile</a>.', array('%name' => $account->name, '!profile' => url("user/$node->uid/edit")))); 1364 // Ensure that a group is selected if groups are required. needed when author has no groups. In other cases, fapi does the validation 1365 if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) { 1366 if (!isset($node->og_groups)) { 1367 form_set_error('title', t('You must !join before posting on this web site.', array('!join' => l(t('join a group'), 'og')))); 1333 1368 } 1334 1335 // Must be authored in the default input format or else admins might not get their admin perms1336 // If Body field is omitted, there may not yet be a $node->format1337 if (isset($node->format) && $node->format != filter_resolve_format(FILTER_FORMAT_DEFAULT)) {1338 form_set_error('body', t("You must use the default input format when authoring a group node."));1339 }1340 }1341 else {1342 // Ensure that a group is selected if groups are required. needed when author has no groups. In other cases, fapi does the validation1343 if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) {1344 if (!isset($node->og_groups)) {1345 form_set_error('title', t('You must !join before posting on this web site.', array('!join' => l(t('join a group'), 'og'))));1346 }1347 }1348 1349 1369 } 1350 1370 break; … … 1383 1403 '!invite_url' => url("og/invite/$node->nid", NULL, NULL, TRUE) 1384 1404 ); 1385 1386 // alert the user that they are now the admin of the group 1387 $from = variable_get('site_mail', ini_get('sendmail_from')); 1388 drupal_mail('og_new_admin', $account->mail, _og_user_mail_text('og_new_admin_subject', $variables), _og_user_mail_text('og_new_admin_body', $variables), $from); 1405 $message = array( 1406 'subject' => _og_user_mail_text('og_new_admin_subject', $variables), 1407 'body' => _og_user_mail_text('og_new_admin_body', $variables) 1408 ); 1409 1410 // Alert the user that they are now the admin of the group. 1411 module_invoke_all('og', 'admin new', $gid, $account->uid, $message); 1389 1412 } 1390 1413 else { 1391 1414 og_save_ancestry($node); 1392 }1393 1394 $skip_notification = FALSE;1395 // Any module that returns TRUE from its hook_og_notify($node) will prevent sending notifications.1396 // og2list and og_subscriptions use this to send own notifications.1397 foreach(module_implements('og_notify') as $module) {1398 if (module_invoke($module,'og_notify',$node)) {1399 $skip_notification = TRUE;1400 break;1401 }1402 }1403 if (!$skip_notification && $node->status && og_is_mail_type($node->type) && $node->og_groups) {1404 if (module_exists('job_queue')) {1405 $description = t('OG: notify group members about node %nid - !link', array('%nid' => $node->nid, '!link' => l($node->title, "node/$node->nid")));1406 job_queue_add('og_mail', $description, array('node', $node->nid));1407 }1408 else {1409 og_mail('node', $node);1410 }1411 1415 } 1412 1416 break; … … 1435 1439 $ret[] = array('key' => 'group', 1436 1440 'value' => check_plain($title), 1437 'attributes' => array('domain' => url("node/$gid", NULL, NULL, TRUE))); 1441 'attributes' => array( 1442 'domain' => url("node/$gid", NULL, NULL, TRUE), 1443 'xmlns' => 'http://drupal.org/project/og', 1444 ), 1445 ); 1438 1446 } 1439 1447 // to get these modifications to work on 4.7, one needs to patch as per http://drupal.org/node/41703 … … 1500 1508 1501 1509 if ($form_id == 'views_edit_view') { 1502 $form['page-info']['url']['#description'] .= t("<p>To display a View as a tab on your Organic Groups group home pages, set the url to 'node/\$group/custom' (where <em>custom</em> is whatever you wish). Then open Page >> Menu and check <em>Provide Menu</em> and <em>Provide Menu as Tab</em>; also make the first argument in the View be the <em>OG: Group nid(s)</em> argument. The <em>\$group</em> path element is a placeholder for the group nid and it ensures that the tab <strong>only</strong> appears on OG group nodes.</p>");1510 $form['page-info']['url']['#description'] .= '<p>'. t("To display a View as a tab on your Organic Groups group home pages, set the url to 'node/\$group/custom' (where <em>custom</em> is whatever you wish). Then open Page >> Menu and check <em>Provide Menu</em> and <em>Provide Menu as Tab</em>; also make the first argument in the View be the <em>OG: Group nid(s)</em> argument. The <em>\$group</em> path element is a placeholder for the group nid and it ensures that the tab <strong>only</strong> appears on OG group nodes.") .'</p>'; 1503 1511 } 1504 1512 … … 1561 1569 function og_node_delete_group_form(&$form) { 1562 1570 $options[] = t('Do nothing.'); 1563 $options[] = t( 'Delete all group posts which don\'t also belong to another group.');1571 $options[] = t("Delete all group posts which don't also belong to another group."); 1564 1572 if (user_access('administer nodes')) { 1565 1573 $options[] = t('Move all group posts to the group listed below.'); … … 1570 1578 unset($options[$form['nid']['#value']]); 1571 1579 $form['target'] = array('#type' => 'select', '#title' => t('Target group'), '#default_value' => 0, '#options' => $options, '#weight' => 0, '#description' => t('If you chose <b>Move all group posts</b> above, specify a destination group.')); 1572 // register a submit handler1573 $form['#submit']['og_node_delete_confirm_submit'] = array();1574 }1580 } 1581 // register a submit handler 1582 $form['#submit']['og_node_delete_confirm_submit'] = array(); 1575 1583 $form['actions']['submit']['#value'] = t('Delete group'); 1576 1584 } … … 1596 1604 } 1597 1605 1598 // submit handler for node delete form. handles deletes to group nodes1606 // Submit handler for node delete form. handles deletes to group nodes. 1599 1607 function og_node_delete_confirm_submit($form_id, $form_values) { 1600 1608 $deleted_group_nid = $form_values['nid']; … … 1606 1614 unset($node->og_groups[$deleted_group_nid]); 1607 1615 if ($move_children) { 1608 // there is an array_unique() in og_save_ancestry which giards against duplicates so don't worry here.1609 $node->og_groups[ ] = $target_group_nid;1616 // There is an array_unique() in og_save_ancestry() which guards against duplicates so don't worry here. 1617 $node->og_groups[$target_group_nid] = $target_group_nid; 1610 1618 } 1611 1619 if ($delete_orphans && count($node->og_groups) == 0) { … … 1738 1746 } 1739 1747 1740 // show read only item if we are non-admin, and in simple mode (i.e. non-checkboxes) and at least one group is in querystring1748 // Show read only item if we are non-admin, and in simple mode (i.e. non-checkboxes) and at least one group is in querystring 1741 1749 $simple = !user_access('administer organic groups') && !variable_get('og_audience_checkboxes', TRUE) && count($gids); 1742 1750 … … 1775 1783 if (count($groups)) { 1776 1784 foreach ($groups as $gid) { 1777 $titles[] = $options[$gid];1785 $titles[] = check_plain($options[$gid]); 1778 1786 $item_value = implode(', ', $titles); 1779 1787 } … … 1809 1817 } 1810 1818 1811 function og_comment($comment, $op) {1812 switch ($op) {1813 case 'publish':1814 $comment = (array) $comment;1815 // fall through1816 case 'insert':1817 $skip_notification = FALSE;1818 // Any module that returns true from its hook_og_notify($node) will prevent sending notifications.1819 // og2list uses this to send its own notifications instead for mailing list content.1820 $node = node_load($comment['nid']);1821 1822 foreach(module_implements('og_notify') as $module) {1823 if (module_invoke($module, 'og_notify', $node)) {1824 $skip_notification = TRUE;1825 break;1826 }1827 }1828 // remove the perm check after 5.3 is released.1829 if ($comment['status'] == COMMENT_PUBLISHED && !$skip_notification && og_is_mail_type($node->type) && isset($node->og_groups) && !empty($node->og_groups)) {1830 if (module_exists('job_queue')) {1831 $description = t('OG: notify group members about comment %id on !link', array('%id' => $comment['cid'], '!link' => l($node->title, "node/$node->nid", NULL, NULL, 'comment-'. $comment['cid'])));1832 job_queue_add('og_mail', $description, array('comment', $comment['cid']));1833 }1834 else {1835 og_mail('comment', (object)$comment);1836 }1837 }1838 break;1839 }1840 }1841 1842 1843 /**1844 * Send this node/comment via email to all email members. Called from og_nodeapi() and og_comment().1845 * Sometimes called from during cron if job_queue.module is enabled (recommended).1846 * TODO: this function is a bit messy. rethink.1847 *1848 * @param $type1849 * the object type: node or comment1850 * @param $id1851 * a node or comment object. if a non object is supplied, a load() operation is performed.1852 * @return1853 * none1854 */1855 function og_mail($type, $obj) {1856 if ($type == 'comment') {1857 if (!is_object($obj)) {1858 $obj = _comment_load($obj);1859 }1860 // registered user1861 if ($obj->uid) {1862 $account = user_load(array('uid' => $obj->uid));1863 $obj->name = $account->name;1864 }1865 else {1866 $obj->name = variable_get('anonymous', 'Anonymous');1867 }1868 $rendered = check_markup($obj->comment, $obj->format, FALSE);1869 1870 $obj->body = $rendered;1871 $obj->teaser = $rendered;1872 $originalurl = url("node/$obj->nid", NULL, "comment-$obj->cid", TRUE);1873 $replyurl = url("comment/reply/$obj->nid/$obj->cid", NULL, NULL, TRUE);1874 $node = node_load($obj->nid);1875 $obj->og_groups = $node->og_groups;1876 $obj->title = $node->title;1877 $obj->msgid = $obj->nid. '-'. $obj->cid. og_msgid_server();1878 $reply = $obj->nid. '-';1879 if ($obj->pid) {1880 $reply .= $obj->pid;1881 }1882 else {1883 $reply .= '0';1884 }1885 $obj->in_reply_to .= $reply. og_msgid_server();1886 $type_friendly = 'comment';1887 }1888 else {1889 if (!is_object($obj)) {1890 $obj = node_load($obj);1891 }1892 $account = user_load(array('uid' => $obj->uid));1893 $obj->name = $account->name;1894 $obj->subject = $obj->title;1895 // These calls to og_node_view() setup the node body and teaser, apply the1896 // appropriate input filters, and handle CCK fields, event fields, etc.1897 $obj->body = og_node_view($obj, FALSE);1898 $obj->teaser = og_node_view($obj, TRUE);1899 $obj->msgid = $obj->nid. '-0'. og_msgid_server();1900 $originalurl = url("node/$obj->nid", NULL, NULL, TRUE);1901 $replyurl = url("comment/reply/$obj->nid", NULL, 'comment-form', TRUE);1902 $type_friendly = node_get_types('name', $obj);1903 }1904 1905 // set email from variables1906 $variables = array(1907 '@user_mail' => $account->mail ? $account->mail : variable_get("site_mail", ini_get("sendmail_from")),1908 '@user_name' => mime_header_encode($obj->name),1909 '@site_mail' => variable_get("site_mail", ini_get("sendmail_from")),1910 '@site_name' => mime_header_encode(variable_get("site_name", 'Drupal')),1911 );1912 $from_mail = strtr(variable_get("og_email_notification_pattern", '@user_name <@site_mail>'), $variables);1913 1914 $headers = array('X-Mailer' => 'Drupal - og_mail', 'Precedence' => 'list', 'Message-Id' => "<$obj->msgid>");1915 if ($obj->in_reply_to) {1916 $headers['In-Reply-To'] = "<$obj->in_reply_to>";1917 }1918 1919 // set email body variables1920 $variables = array(1921 '@site' => variable_get('site_name', 'drupal'),1922 '!read_more' => $obj->readmore ? t('Read more') : t('View original'),1923 '!content_url' => $originalurl,1924 '!reply_url' => $replyurl,1925 '@title' => trim($obj->title),1926 '@subject' => trim($obj->subject),1927 '@node_full' => trim(og_mail_output($obj->body)),1928 '@node_teaser' => trim(og_mail_output($obj->teaser)),1929 '@username' => $obj->name1930 );1931 1932 // Send email to selective subscribers and global subscribers.1933 // We use if() here in case node/comment no longer has any groups (i.e. this function can be called from cron).1934 if (is_array($obj->og_groups) && !empty($obj->og_groups)) {1935 $groups = implode(', ', $obj->og_groups);1936 // tricky query here. mysql returns NULL in the case of NULL != 0 so i rework this for 2 positive statements about og_email field1937 // ORDER BY favors newer groups to help them get ramped up. Thus, they are perceived as active.1938 $sql = "SELECT u.mail, ou.nid AS gid, n.title AS group_name, n.uid AS group_uid, u.name AS group_owner, oug.og_email1939 FROM {og_uid} ou INNER JOIN {users} u ON ou.uid=u.uid1940 INNER JOIN {og_uid_global} oug ON ou.uid=oug.uid1941 INNER JOIN {node} n ON ou.nid=n.nid1942 WHERE ou.nid IN ($groups) AND (1943 (oug.og_email = %d AND ou.mail_type=1) OR1944 (oug.og_email = %d)1945 ) AND u.status = 1 AND u.mail != '' AND ou.is_active = 11946 ORDER by u.mail DESC, n.created DESC1947 ";1948 $result = db_query($sql, OG_NOTIFICATION_SELECTIVE, OG_NOTIFICATION_ALWAYS);1949 $last_mail = '';1950 while ($row = db_fetch_object($result)) {1951 // only notify each user once. we used to do this with GROUP BY but got very hard to assure that all the selected fields came from same record.1952 if ($row->mail == $last_mail) {1953 continue;1954 }1955 $last_mail = $row->mail;1956 1957 // TODO: add node_access('view') call here in case node is moderated or other.1958 // Hopefully D6 will avert need to impersonate.1959 // Append these group specific variables.1960 $variables['@group'] = $row->group_name;1961 $variables['!group_url'] = url("og/manage/$row->gid", NULL, NULL, TRUE);1962 $variables['@type'] = $type_friendly;1963 1964 $unsubscribe = url("og/manage/$row->gid", NULL, NULL, TRUE);1965 $ownerurl = url("user/$row->group_uid", NULL, NULL, TRUE);1966 $group_home = url("node/$row->gid", NULL, NULL, TRUE);1967 $groupheaders = $headers + array(1968 'List-Id' => mime_header_encode($row->group_name). " <$group_home>",1969 'List-Unsubscribe' => "<$unsubscribe>",1970 'List-Owner' => mime_header_encode($row->group_owner). " <$ownerurl>",1971 "List-Archive" => "<$group_home>"1972 );1973 drupal_mail('og_mail', $row->mail, _og_user_mail_text('og_new_node_subject', $variables), _og_user_mail_text('og_new_node_body', $variables), $from_mail, $groupheaders);1974 }1975 }1976 }1977 1978 1819 /** 1979 1820 * Similar to node_view() but without calling theme('node'). 1980 1821 * 1981 1822 * This is needed to get the proper body or teaser for nodes (e.g. Event, 1982 * Location, CCK node types) and to clean up the body for use in email 1983 * notifications. 1823 * Location, CCK node types) and to clean up the body for use in notifications. 1984 1824 * 1985 1825 * @param $node … … 2013 1853 } 2014 1854 2015 // 2 functions ripped from mail.inc in project.module package 2016 function og_mail_urls($url = 0) { 2017 static $urls = array(); 2018 if ($url) { 2019 $urls[] = strpos($url, '://') ? $url : url($url, NULL, NULL, 1); 2020 return count($urls); 2021 } 2022 return $urls; 2023 } 2024 2025 // takes filtered HTML as input and transforms for email 2026 // modified from project.module 2027 function og_mail_output($body, $html = TRUE) { 2028 static $i = 0; 2029 2030 if ($html) { 2031 $pattern = '@<a +([^ >]+ )*?href *= *"([^>"]+?)"[^>]*>([^<]+?)</a>@ei'; 2032 $body = preg_replace($pattern, "'\\3 ['. og_mail_urls('\\2') .']'", $body); 2033 $urls = og_mail_urls(); 2034 if (count($urls)) { 2035 $body .= "\n"; 2036 for ($max = count($urls); $i < $max; $i++) { 2037 $body .= '['. ($i + 1) .'] '. $urls[$i] ."\n"; 2038 } 2039 } 2040 2041 $body = preg_replace('!</?blockquote>!i', '"', $body); 2042 $body = preg_replace('!</?(em|i)>!i', '/', $body); 2043 $body = preg_replace('!</?(b|strong)>!i', '*', $body); 2044 $body = preg_replace("@<br />(?!\n)@i", "\n", $body); 2045 $body = preg_replace("@</p.*>(?!\n\n)@i", "\n\n", $body); 2046 $body = preg_replace("@</h1>(?!\n\n)@i", " #\n", $body); 2047 $body = preg_replace("@</h2>(?!\n\n)@i", " ##\n", $body); 2048 $body = preg_replace("@</h3>(?!\n\n)@i", " ###\n", $body); 2049 $body = preg_replace("@</h4>(?!\n\n)@i", " ####\n", $body); 2050 $body = preg_replace("@</(li|dd)>\n?@i", "\n", $body); 2051 $body = preg_replace("@<h1.*>@i", "\n\n# ", $body); 2052 $body = preg_replace("@<h2.*>@i", "\n\n## ", $body); 2053 $body = preg_replace("@<h3.*>@i", "\n\n### ", $body); 2054 $body = preg_replace("@<h4.*>@i", "\n\n#### ", $body); 2055 $body = preg_replace("@<li.*>@i", "* ", $body); 2056 $body = strip_tags($body); 2057 $body = decode_entities($body); 2058 $body = wordwrap($body, 72); 2059 } 2060 else { 2061 $body = decode_entities($body); 2062 } 2063 return $body; 2064 } 2065 2066 /** 2067 * Define all OG emails 1855 /** 1856 * Define all OG message strings. 2068 1857 * Modelled after Drupal's user.module 2069 1858 */ … … 2079 1868 return t("@group: '@title' at @site", $variables); 2080 1869 case 'og_new_node_body': 2081 return t("@type '@subject' by @username\n\n@node_teaser\n\n!read_more: !content_url\nPost reply: !reply_url\n\n--\nYou are subscribed from the group '@group' at @site.\nTo manage your subscription, visit !group_url ", $variables);1870 return t("@type '@subject' by @username\n\n@node_teaser\n\n!read_more: !content_url\nPost reply: !reply_url\n\n--\nYou are subscribed from the group '@group' at @site.\nTo manage your subscription, visit !group_url.", $variables); 2082 1871 case 'og_admin_email_body': 2083 return t("@body\n\n--\nThis message was sent by an administrator in the '@group' group at @site. To visit this group, browse to !url_group. To unsubscribe from this group, visit !url_unsubscribe ", $variables);1872 return t("@body\n\n--\nThis message was sent by an administrator in the '@group' group at @site. To visit this group, browse to !url_group. To unsubscribe from this group, visit !url_unsubscribe.", $variables); 2084 1873 case 'og_approve_user_subject': 2085 1874 return t("Membership request approved for '@title'", $variables); 2086 1875 case 'og_approve_user_body': 2087 return t("You may now post messages in this group located at !group_url ", $variables);1876 return t("You may now post messages in this group located at !group_url.", $variables); 2088 1877 case 'og_deny_user_subject': 2089 return t("Membership request denied for '@title' ", $variables);1878 return t("Membership request denied for '@title'.", $variables); 2090 1879 case 'og_deny_user_body': 2091 1880 return t("Sorry, your membership request was denied.", $variables); 2092 1881 case 'og_invite_user_subject': 2093 return t("Invitation to join the group '@group' at @site ", $variables);1882 return t("Invitation to join the group '@group' at @site.", $variables); 2094 1883 case 'og_invite_user_body': 2095 1884 return t("Hi. I'm a member of '@group' and I welcome you to join this group as well. Please see the link and message below.\n\n@group\n@description\nJoin: !group_url\n@body", $variables); 2096 1885 case 'og_request_user_subject': 2097 return t("Membership request for '@group' from '@username' ", $variables);1886 return t("Membership request for '@group' from '@username'.", $variables); 2098 1887 case 'og_request_user_body': 2099 1888 return t("To instantly approve this request, visit !approve_url.\nYou may deny this request or manage members at !group_url.", $variables); 2100 1889 case 'og_new_admin_subject': 2101 return t("You are now an administrator for the group '@group' ", $variables);1890 return t("You are now an administrator for the group '@group'.", $variables); 2102 1891 case 'og_new_admin_body': 2103 1892 return t("@username, you are now an administrator for the group '@group'.\n\nYou can administer this group by logging in here:\n !group_url", $variables); … … 2122 1911 */ 2123 1912 function og_is_node_admin($node) { 2124 return node_access('update', $node); 1913 global $user; 1914 return og_is_group_type($node->type) && (user_access('administer nodes') || !empty($user->og_groups[$node->nid]['is_admin'])); 2125 1915 } 2126 1916 … … 2161 1951 } 2162 1952 return $form; 2163 case 'form':2164 if ($category == 'account' && !empty($account->og_groups)) {2165 $form['og_settings'] = array(2166 '#type' => 'fieldset',2167 '#title' => t('Organic groups settings'),2168 '#collapsible' => TRUE,2169 '#weight' => 4);2170 $options = array(OG_NOTIFICATION_NEVER => t('Never send email notifications. Useful when tracking activity via RSS feed instead.'),2171 OG_NOTIFICATION_ALWAYS => t('Always send email notifications'),2172 OG_NOTIFICATION_SELECTIVE => t('Selectively send email notification based on the checkbox for each of my group\'s <em>My Membership</em> page'),2173 );2174 2175 $form['og_settings']['og_email'] = array('#type' => 'radios',2176 '#title' => t('Email notifications'),2177 '#options' => $options,2178 '#default_value' => isset($account->og_email) ? $account->og_email : variable_get('og_notification', 2),2179 '#description' => t('When posts are submitted into your groups, you may be notified via email.'),2180 );2181 return $form;2182 }2183 break;2184 1953 case 'insert': 2185 1954 if (is_array($edit['og_register'])) { … … 2192 1961 } 2193 1962 2194 $sql = 'INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)';2195 db_query($sql, $account->uid, variable_get('og_notification', OG_NOTIFICATION_ALWAYS));2196 $account->og_email = NULL;2197 break;2198 case 'update':2199 if (isset($edit['og_email'])) {2200 $sql = 'UPDATE {og_uid_global} SET og_email=%d WHERE uid=%d';2201 db_query($sql, $edit['og_email'], $account->uid);2202 $account->og_email = NULL;2203 }2204 1963 break; 2205 1964 case 'delete': 2206 // user delete doesn't exist, but it should and will one day.2207 $sql = 'DELETE FROM {og_uid_global} WHERE uid=%d';2208 db_query($sql, $account->uid);2209 2210 1965 $sql = 'DELETE FROM {og_uid} WHERE uid=%d'; 2211 1966 db_query($sql, $account->uid); … … 2213 1968 case 'load': 2214 1969 $account->og_groups = og_get_subscriptions($account->uid); 2215 2216 $result = db_query("SELECT og_email FROM {og_uid_global} WHERE uid = %d", $account->uid);2217 if (db_num_rows($result)) {2218 $account->og_email = db_result($result);2219 }2220 1970 break; 2221 1971 case 'view': … … 2251 2001 */ 2252 2002 function og_node_type($op, $info) { 2253 $values = variable_get($variable, array());2254 2003 switch ($op) { 2255 2004 case 'delete': … … 2267 2016 'group' => t('Group node'), 2268 2017 'omitted' => t('May not be posted into a group.'), 2269 'group_post_standard_mail' => t('Standard group post (typically only author may edit). Sends email notifications.'), 2270 'group_post_standard_nomail' => t('Standard group post (typically only author may edit). No email notification.'), 2018 'group_post_standard' => t('Standard group post (typically only author may edit).') 2271 2019 ); 2272 2020 2273 2021 if (module_exists('og_access')) { 2274 $usages['group_post_wiki_mail'] = t('Wiki group post (any group member may edit). Sends email notifications.'); 2275 $usages['group_post_wiki_nomail'] = t('Wiki group post (any group member may edit). No email notification.'); 2022 $usages['group_post_wiki'] = t('Wiki group post (any group member may edit).'); 2276 2023 } 2277 2024 … … 2296 2043 } 2297 2044 2298 // returns TRUE if node type should generate email notifications when posted to a group.2299 function og_is_mail_type($type) {2300 $usage = variable_get('og_content_type_usage_'. $type, 'omitted');2301 return strpos($usage, 'mail') && !strpos($usage, 'nomail') ? TRUE : FALSE;2302 }2303 2304 2045 // returns TRUE if node type lets all subscribers edit the node. 2305 2046 function og_is_wiki_type($type) { … … 2336 2077 header("HTTP/1.1 301 Moved Permanently"); 2337 2078 header('Location: '. url("node/$gid/feed", NULL, NULL, TRUE)); 2079 } 2080 2081 /** 2082 * Check a user's membership in a group. Site admins always return TRUE. 2083 */ 2084 function og_is_group_member($gid, $user) { 2085 $groups = array_keys($user->og_groups); 2086 return user_access('administer nodes') || in_array($gid, $groups) ? TRUE : FALSE; 2338 2087 } 2339 2088 … … 2422 2171 // only members can see this block 2423 2172 if (in_array($groupnode->nid, array_keys($user->og_groups))) { 2424 $content = t('This group offers a !groupfeed and a n !email.', array('!groupfeed' => l(t('RSS feed'), "node/$groupnode->nid/feed"), '!email' => l(t('email subscription'), 'og/manage/'. $groupnode->nid)));2173 $content = t('This group offers a !groupfeed and a !subscription.', array('!groupfeed' => l(t('RSS feed'), "node/$groupnode->nid/feed"), '!subscription' => l(t('subscription option'), 'og/manage/'. $groupnode->nid))); 2425 2174 if (module_exists('views') && module_exists('views_rss')) { 2426 2175 // NOTE: See og.css for styling specific to these lists 2427 $content .= t('Or subscribe to these personalized, sitewide feeds:');2176 $content .= ' '. t('Or subscribe to these personalized, sitewide feeds:'); 2428 2177 $inline = array('class' => 'links inline'); 2429 $l1[] = array('title' => t(' feed'), 'href' => 'group/myunread/feed');2430 $l1[] = array('title' => t(' page'), 'href' => 'group/myunread');2431 $links['my_unread'] = t(' my unread: '). theme('links', $l1, $inline);2178 $l1[] = array('title' => t('Feed'), 'href' => 'group/myunread/feed'); 2179 $l1[] = array('title' => t('Page'), 'href' => 'group/myunread'); 2180 $links['my_unread'] = t('My unread:') .' '. theme('links', $l1, $inline); 2432 2181 2433 $l2[] = array('title' => t(' feed'), 'href' => 'group/mytracker/feed');2434 $l2[] = array('title' => t(' page'), 'href' => 'group/mytracker');2435 $links['my_group'] = t(' my group: '). theme('links', $l2, $inline);2182 $l2[] = array('title' => t('Feed'), 'href' => 'group/mytracker/feed'); 2183 $l2[] = array('title' => t('Page'), 'href' => 'group/mytracker'); 2184 $links['my_group'] = t('My group:') .' '. theme('links', $l2, $inline); 2436 2185 2437 $l3[] = array('title' => t(' feed'), 'href' => 'group/tracker/feed');2438 $l3[] = array('title' => t(' page'), 'href' => 'group/tracker');2439 $links['all_posts'] = array('data' => t(' all posts: '). theme('links', $l3, $inline));2186 $l3[] = array('title' => t('Feed'), 'href' => 'group/tracker/feed'); 2187 $l3[] = array('title' => t('Page'), 'href' => 'group/tracker'); 2188 $links['all_posts'] = array('data' => t('All posts:') .' '. theme('links', $l3, $inline)); 2440 2189 $content .= theme('item_list', $links); 2441 2190 } … … 2511 2260 * An HTML list. 2512 2261 **/ 2513 function og_block_subscribers_list($gid, $max = 10, $is_admin = array('members', 'admin '), $show_more = TRUE, $show_picture = NULL) {2262 function og_block_subscribers_list($gid, $max = 10, $is_admin = array('members', 'admins'), $show_more = TRUE, $show_picture = NULL) { 2514 2263 $placeholders = array_fill(0, count(array_filter($is_admin)), '%d'); 2515 2264 $placeholders = implode(', ', $placeholders); … … 2585 2334 } 2586 2335 $links['subscribers'] = $txt; 2587 $links['manager'] = t('Manager: '). theme('username', $node);2336 $links['manager'] = t('Manager:') .' '. theme('username', $node); 2588 2337 $subscribe = isset($subscription) ? l(t('My membership'), "og/manage/$node->nid") : og_subscribe_link($node); 2589 2338 if(isset($subscribe)) { … … 2696 2445 return $form; 2697 2446 } 2447 2698 2448 function og_admin_settings() { 2699 2449 drupal_set_title(t('Organic groups configuration')); … … 2722 2472 $form['og_settings']['group_details'] = array('#type' => 'fieldset', '#title' => t('Group details'), '#collapsible' => TRUE, '#collapsed' => TRUE); 2723 2473 // groups directory visibility 2724 $options = array(t( 'New groups don\'t appear in the groups directory. Administrators control the directory exclusively.'),2474 $options = array(t("New groups don't appear in the groups directory. Administrators control the directory exclusively."), 2725 2475 t('New groups always appear in the groups directory.'), 2726 2476 t('Group creator chooses whether her group appears in the directory. Defaults to %in.', array('%in' => t('in directory'))), … … 2730 2480 2731 2481 // groups registration visibility 2732 $options = array(t( 'New groups don\'t appear on the registration form. Administrators control the form exclusively.'),2482 $options = array(t("New groups don't appear on the registration form. Administrators control the form exclusively."), 2733 2483 t('New groups always appear on the registration form.'), 2734 2484 t('Group creator chooses whether her group appears on the registration form. Defaults to %in.', array('%in' => t('on form'))), … … 2737 2487 $form['og_settings']['group_details']['og_visibility_registration'] = array('#type' => 'radios', '#title' => t('Registration form control'), '#default_value' => variable_get('og_visibility_registration', OG_REGISTRATION_CHOOSE_FALSE), '#description' =>t('OG admins always see the checkbox for adding a group to the %dir. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting.', array('%dir' => t('registration form'))), '#options' => $options); 2738 2488 2739 // email notifications default2740 $options = array(OG_NOTIFICATION_SELECTIVE => t('New members are not subscribed to group email notifications by default. A member may choose to enable this from her profile page or her My membership page.'),2741 OG_NOTIFICATION_ALWAYS => t('New members are subscribed to group email notifications by default. A member may choose to disable this from her profile page.'),2742 );2743 $form['og_settings']['group_details']['og_notification'] = array('#type' => 'radios', '#title' => t('Group email notifications'), '#default_value' => variable_get('og_notification', OG_NOTIFICATION_ALWAYS), '#description' =>t('Should new members automatically be notified via email when new content is posted to their group? Note that changing this setting has no effect on existing members.'), '#options' => $options);2744 2745 2489 // audience checkboxes 2746 2490 $form['og_settings']['group_details']['og_audience_checkboxes'] = array('#type' => 'checkbox', '#title' => t('Audience checkboxes'), '#default_value' => variable_get('og_audience_checkboxes', TRUE), '#description' => t('Show each group that the user is a member of as a checkbox in the Audience section. This enables the member to place her post into multiple groups. If unchecked, simplify the user interface by omitting the checkboxes and assuming user wants to post into the current group. This simplification only applies to new nodes, and not to edits of existing nodes. Group administrators always see checkboxes.')); … … 2758 2502 $form['og_settings']['group_details']['og_member_pics'] = array('#type' => 'checkbox', '#title' => t('Member pictures'), '#default_value' => variable_get('og_member_pics', TRUE), '#description' => t('Should member pictures be shown on the members page, the group members block, and group details block? You must also enable pictures in !user.', array('!user' => l(t('User configuration'), 'admin/user/settings')))); 2759 2503 2760 $form['og_settings']['email'] = array('#type' => 'fieldset', '#title' => t('Email settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); 2761 2762 $form['og_settings']['email']['og_email_notification_pattern'] = array( 2504 // Messages fieldset. 2505 $form['og_settings']['notifications'] = array( 2506 '#type' => 'fieldset', 2507 '#title' => t('Messaging & Notifications'), 2508 '#collapsible' => TRUE, 2509 '#collapsed' => TRUE 2510 ); 2511 $form['og_settings']['notifications']['og_email_notification_pattern'] = array( 2763 2512 '#type' => 'textfield', 2764 2513 '#title' => t('Format of From: field'), … … 2766 2515 '#description' => t('Specify the format of the "From:" field on outgoing notifications. Available variables: @user_mail, @user_name, @site_mail, @site_name. Note that the @user_mail token reveals the author\'s email address. If the admin email examples above appear blank, you need to set your site email in the Site Configuration panel.'), 2767 2516 ); 2768 $form['og_settings']['email']['og_new_node_subject'] = array('#type' => 'textfield', '#title' => t('New content subject'), '#description' => 'Subject of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_subject')); 2769 $form['og_settings']['email']['og_new_node_body'] = array('#type' => 'textarea', '#title' => t('New content body'), '#rows' => 10, '#description' => 'Body of email for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.', '#default_value' => _og_user_mail_text('og_new_node_body')); 2770 $form['og_settings']['email']['og_admin_email_body'] = array('#type' => 'textarea', '#title' => t('Group admin email body'), '#rows' => 10, '#description' => 'The body of the email sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe', '#default_value' => _og_user_mail_text('og_admin_email_body')); 2771 $form['og_settings']['email']['og_approve_user_subject'] = array('#type' => 'textfield', '#title' => t('User approved email subject'), '#description' => 'The subject of the email sent to new approved members. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_approve_user_subject')); 2772 $form['og_settings']['email']['og_approve_user_body'] = array('#type' => 'textarea', '#title' => t('User approved email body'), '#rows' => 10, '#description' => 'The body of the email sent to new approved members. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_approve_user_body')); 2773 $form['og_settings']['email']['og_deny_user_subject'] = array('#type' => 'textfield', '#title' => t('User denied email subject'), '#description' => 'The subject of the email sent to denied users. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_deny_user_subject')); 2774 $form['og_settings']['email']['og_deny_user_body'] = array('#type' => 'textarea', '#title' => t('User denied email body'), '#rows' => 10, '#description' => 'The body of the email sent to denied users. Available variables: !group_url, @title', '#default_value' => _og_user_mail_text('og_deny_user_body')); 2775 $form['og_settings']['email']['og_invite_user_subject'] = array('#type' => 'textfield', '#title' => t('Invite user email subject'), '#description' => 'The subject of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body', '#default_value' => _og_user_mail_text('og_invite_user_subject')); 2776 $form['og_settings']['email']['og_invite_user_body'] = array('#type' => 'textarea', '#title' => t('Invite user email body'), '#rows' => 10, '#description' => 'The body of the email sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body', '#default_value' => _og_user_mail_text('og_invite_user_body')); 2777 $form['og_settings']['email']['og_request_user_subject'] = array('#type' => 'textfield', '#title' => t('Request user email subject'), '#description' => 'The subject of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url', '#default_value' => _og_user_mail_text('og_request_user_subject')); 2778 $form['og_settings']['email']['og_request_user_body'] = array('#type' => 'textarea', '#title' => t('Request user email body'), '#rows' => 10, '#description' => 'The body of the email sent to a user\'s request to join a group. Available variables: @group, @username, !approve_url, !group_url', '#default_value' => _og_user_mail_text('og_request_user_body')); 2779 $form['og_settings']['email']['og_new_admin_subject'] = array('#type' => 'textfield', '#title' => t('New admin user email subject'), '#description' => 'The subject of the email sent to a new admin for a group. Available variables: @group, @username, !group_url', '#default_value' => _og_user_mail_text('og_new_admin_subject')); 2780 $form['og_settings']['email']['og_new_admin_body'] = array('#type' => 'textarea', '#title' => t('New admin user email body'), '#rows' => 10, '#description' => 'The body of the email sent to a new admin for a group. Available variables: @group, @username, !group_url, !invite_url', '#default_value' => _og_user_mail_text('og_new_admin_body')); 2517 $form['og_settings']['notifications']['og_new_node_subject'] = array( 2518 '#type' => 'textfield', 2519 '#title' => t('New content subject'), 2520 '#description' => t('Subject of notification message for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. %subject contains the comment title in the case of a comment but the node title in the case of a new post. @title is always the node title.'), 2521 '#default_value' => _og_user_mail_text('og_new_node_subject') 2522 ); 2523 $form['og_settings']['notifications']['og_new_node_body'] = array( 2524 '#type' => 'textarea', 2525 '#title' => t('New content body'), 2526 '#rows' => 10, 2527 '#description' => t('Body of the notification for new content. Available variables: @group, !group_url, @type, @site, !content_url, !reply_url, @title, @subject, @node_full, @node_teaser, @username. @subject contains the comment title in the case of a comment but the node title in the case of a new post. %title is always the node title.'), 2528 '#default_value' => _og_user_mail_text('og_new_node_body') 2529 ); 2530 $form['og_settings']['notifications']['og_admin_email_body'] = array( 2531 '#type' => 'textarea', 2532 '#title' => t('Group admin notification body'), 2533 '#rows' => 10, 2534 '#description' => t('The body of the message sent to users from the group admin. Available variables: @group, @body, @site, !url_group, !url_unsubscribe'), 2535 '#default_value' => _og_user_mail_text('og_admin_email_body') 2536 ); 2537 $form['og_settings']['notifications']['og_approve_user_subject'] = array( 2538 '#type' => 'textfield', 2539 '#title' => t('User approved notification subject'), 2540 '#description' => t('The subject of the message sent to new approved members. Available variables: !group_url, @title'), 2541 '#default_value' => _og_user_mail_text('og_approve_user_subject') 2542 ); 2543 $form['og_settings']['notifications']['og_approve_user_body'] = array( 2544 '#type' => 'textarea', 2545 '#title' => t('User approved notification body'), 2546 '#rows' => 10, 2547 '#description' => t('The body of the message sent to new approved members. Available variables: !group_url, @title'), 2548 '#default_value' => _og_user_mail_text('og_approve_user_body') 2549 ); 2550 $form['og_settings']['notifications']['og_deny_user_subject'] = array( 2551 '#type' => 'textfield', 2552 '#title' => t('User denied notification subject'), 2553 '#description' => t('The subject of the message sent to denied users. Available variables: !group_url, @title'), 2554 '#default_value' => _og_user_mail_text('og_deny_user_subject') 2555 ); 2556 $form['og_settings']['notifications']['og_deny_user_body'] = array( 2557 '#type' => 'textarea', 2558 '#title' => t('User denied notification body'), 2559 '#rows' => 10, 2560 '#description' => t('The body of the message sent to denied users. Available variables: !group_url, @title'), 2561 '#default_value' => _og_user_mail_text('og_deny_user_body') 2562 ); 2563 $form['og_settings']['notifications']['og_invite_user_subject'] = array( 2564 '#type' => 'textfield', 2565 '#title' => t('Invite user notification subject'), 2566 '#description' => t('The subject of the message sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body'), 2567 '#default_value' => _og_user_mail_text('og_invite_user_subject') 2568 ); 2569 $form['og_settings']['notifications']['og_invite_user_body'] = array( 2570 '#type' => 'textarea', 2571 '#title' => t('Invite user notification body'), 2572 '#rows' => 10, 2573 '#description' => t('The body of the message sent to users invited to join a group. Available variables: @group, @site, @description, !group_url, @body'), 2574 '#default_value' => _og_user_mail_text('og_invite_user_body') 2575 ); 2576 $form['og_settings']['notifications']['og_request_user_subject'] = array( 2577 '#type' => 'textfield', 2578 '#title' => t('Request user notification subject'), 2579 '#description' => t("The subject of the message sent to a user's request to join a group. Available variables: @group, @username, !approve_url, !group_url"), 2580 '#default_value' => _og_user_mail_text('og_request_user_subject') 2581 ); 2582 $form['og_settings']['notifications']['og_request_user_body'] = array( 2583 '#type' => 'textarea', 2584 '#title' => t('Request user notification body'), 2585 '#rows' => 10, 2586 '#description' => t("The body of the message sent to a user's request to join a group. Available variables: @group, @username, !approve_url, !group_url"), 2587 '#default_value' => _og_user_mail_text('og_request_user_body') 2588 ); 2589 $form['og_settings']['notifications']['og_new_admin_subject'] = array( 2590 '#type' => 'textfield', 2591 '#title' => t('New admin user notification subject'), 2592 '#description' => t('The subject of the message sent to a new admin for a group. Available variables: @group, @username, !group_url'), 2593 '#default_value' => _og_user_mail_text('og_new_admin_subject') 2594 ); 2595 $form['og_settings']['notifications']['og_new_admin_body'] = array( 2596 '#type' => 'textarea', 2597 '#title' => t('New admin user notification body'), 2598 '#rows' => 10, 2599 '#description' => t('The body of the message sent to a new admin for a group. Available variables: @group, @username, !group_url, !invite_url'), 2600 '#default_value' => _og_user_mail_text('og_new_admin_body') 2601 ); 2781 2602 2782 2603 return system_settings_form($form); … … 2828 2649 'og_xmlrpc_subscribe_user', 2829 2650 array('struct', 'string', 'string', 'int', 'int'), 2830 t('Add a user to a group ')),2651 t('Add a user to a group.')), 2831 2652 array( 2832 2653 'og.getAllSubscribers', … … 2886 2707 switch ($type) { 2887 2708 case 'node': 2709 // Set some defaults. 2710 $values['ogname'] = ''; 2711 $values['ogname-raw'] = ''; 2712 $values['og-id'] = ''; 2713 2888 2714 if (is_array($object->og_groups)) { 2889 2715 $gids = array_filter($object->og_groups); … … 2895 2721 break; 2896 2722 } 2897 return $values; 2898 } 2899 break; 2900 } 2901 2902 // No group info found. Return defaults. 2903 $values['ogname'] = ''; 2904 $values['ogname-raw'] = ''; 2905 $values['og-id'] = ''; 2906 return $values; 2723 } 2724 return $values; 2725 } 2726 2727 return; 2907 2728 } 2908 2729 … … 2919 2740 $query['where'] = 'oga.group_nid = '. $args['og_nid']; 2920 2741 return $query; 2921 }2922 }2923 2924 // A hook from replies.module. Return TRUE if og is handling the notification to a given recipient on a given reply2925 function og_replies_mine($comment, $recipient) {2926 $node = node_load($comment->nid);2927 // check each group that this node is in2928 foreach ((array)$node->og_groups as $gid) {2929 // check if recipient is an active member2930 if (isset($recipient->og_groups[$gid]) && $recipient->og_groups[$gid]['is_active']) {2931 // check if user is already getting this group notification2932 if ($recipient->og_email || $recipient->og_groups[$gid]['mail_type']) {2933 return TRUE;2934 }2935 }2936 2742 } 2937 2743 } … … 2952 2758 } 2953 2759 2954 if (!module_exists('job_queue')) {2955 $requirements['og_modules'] = array(2956 'title' => $t('Organic groups modules'),2957 'value' => $t('Organic groups works best when !job_queue.module is enabled. See the Integration section of the !readme.', array('!job_queue' => l('job_queue.module', 'http://drupal.org/project/job_queue'), '!readme' => og_readme())),2958 'severity' => REQUIREMENT_INFO2959 );2960 }2961 2962 2760 if (!module_exists('og_access')) { 2963 2761 $requirements['og_access'] = array( … … 2994 2792 return FALSE; 2995 2793 } 2794 2795 /** 2796 * Access callback: og_notifications (or similar) is required for the broadcast 2797 * tab. Override menu item to amend. 2798 */ 2799 function og_broadcast_access($node) { 2800 return og_is_node_admin($node) && module_exists('og_notifications'); 2801 } -
external/current/sites/all/modules/og/og_access.info
r42 r127 3 3 package = "Organic groups" 4 4 dependencies = og 5 ; Information added by drupal.org packaging script on 2008-05-126 version = "5.x-7.2"7 project = "og"8 datestamp = "1210629035"9 -
external/current/sites/all/modules/og/og_access.module
r42 r127 1 1 <?php 2 // $Id: og_access.module,v 1.1.2.1 0 2008/05/08 19:49:26weitzman Exp $2 // $Id: og_access.module,v 1.1.2.11 2008/05/26 14:03:35 weitzman Exp $ 3 3 4 4 // visibility states for private groups. site admin chooses in og_access_settings() … … 18 18 $items[] = array( 19 19 'path' => 'admin/og/og_access', 20 'title' => t('Organic Groups Access configuration'),20 'title' => t('Organic groups access configuration'), 21 21 'description' => t('Choose whether new groups should be private or public'), 22 22 'callback' => 'drupal_get_form', … … 31 31 drupal_add_js(drupal_get_path('module', 'og_access'). '/og_access.js'); // load the form javascript to handle private groups / node visibility conflicts in the og access settings form. 32 32 33 $options = array(t('Visible only within the targeted groups '), t('Visible within the targeted groups and on other pages'), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pub.', array('@pub' => t('Public'))), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pri.', array('@pri' => t('Private'))));34 $form['og_visibility'] = array('#type' => 'radios', '#title' => t('Visibility of posts'), '#default_value' => variable_get('og_visibility', 0), '#description' =>t('Determine how broadly available a given post should be when it is affiliated with a group. OG admins always see the checkbox for making a post @pub. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting. If the setting you want is disabled here, check the settings under <em>Private Groups</em> setting below.You cannot set node visibility to always be public if private groups are set to always on and vice versa.', array('@pub' => t('Public'))), '#options' => $options);33 $options = array(t('Visible only within the targeted groups.'), t('Visible within the targeted groups and on other pages.'), t('Visibility chosen by author/editor using a checkbox on the posting form.') .' '. t('Checkbox defaults to @pub.', array('@pub' => t('Public'))), t('Visibility chosen by author/editor using a checkbox on the posting form. '). t('Checkbox defaults to @pri.', array('@pri' => t('Private')))); 34 $form['og_visibility'] = array('#type' => 'radios', '#title' => t('Visibility of posts'), '#default_value' => variable_get('og_visibility', 0), '#description' =>t('Determine how broadly available a given post should be when it is affiliated with a group. OG admins always see the checkbox for making a post @pub. Note that changing this setting has no effect on existing posts. Re-save those posts to acquire this new setting. If the setting you want is disabled here, check the settings under <em>Private Groups</em> setting below. You cannot set node visibility to always be public if private groups are set to always on and vice versa.', array('@pub' => t('Public'))), '#options' => $options); 35 35 36 36 // private groups control … … 45 45 '#options' => $options, 46 46 '#default_value' => variable_get('og_private_groups', OG_PRIVATE_GROUPS_CHOOSE_FALSE), 47 '#description' => t("<p>A private group's group home page cannot be seen by non-members, and new posts created in the group will default to being private. This setting controls what private groups options can be used when creating a new group or editing an existing group. If you select one of the <em>group administrator chooses</em> options then it will be up to group admins whether their new groups are private or not, with the default you specify here.<p><p>Note that the privacy of all <em>content</em> in the group is determined as each node is created or edited, according to the <em>Node authoring form / Visibility of Posts</em> setting on this page. Note also that changing this setting only affects the default for new groups being created, not the privacy of any existing groups! To change those you must edit the groups and their individual content nodes directly. If the setting you want is disabled here, check <em>Visibility of Posts</em> above. You cannot choose to only have private groups if node visibility is set to be always public, and vice versa.</p>"),47 '#description' => '<p>'. t("A private group's group home page cannot be seen by non-members, and new posts created in the group will default to being private. This setting controls what private groups options can be used when creating a new group or editing an existing group. If you select one of the <em>group administrator chooses</em> options then it will be up to group admins whether their new groups are private or not, with the default you specify here.") .'<p><p>'. t('Note that the privacy of all <em>content</em> in the group is determined as each node is created or edited, according to the <em>Node authoring form / Visibility of Posts</em> setting on this page. Note also that changing this setting only affects the default for new groups being created, not the privacy of any existing groups! To change those you must edit the groups and their individual content nodes directly. If the setting you want is disabled here, check <em>Visibility of Posts</em> above. You cannot choose to only have private groups if node visibility is set to be always public, and vice versa.') .'</p>', 48 48 ); 49 49 return system_settings_form($form); … … 82 82 $form['og_private'] = array ( 83 83 '#type' => 'checkbox', 84 '#title' => t(' private group'),84 '#title' => t('Private group'), 85 85 '#default_value' => $node->nid ? $node->og_private : $default, 86 '#description' => t('Should this group be visible only to its members? Disabled if the group is set to <em>List in Directory</em> or <em>Membership requests: open</em>'));86 '#description' => t('Should this group be visible only to its members? Disabled if the group is set to <em>List in Directory</em> or <em>Membership requests: open</em>.')); 87 87 break; 88 88 } … … 258 258 function og_access_node_access_explain($row) { 259 259 if ($row->realm == 'og_public') { 260 return t('All users may view this node.' , array('@op' => $op));260 return t('All users may view this node.'); 261 261 } 262 262 elseif ($row->realm == 'og_subscriber') { 263 263 $node = node_load((int)$row->gid); 264 return t('Members of !group_n may view this node.', array(' @op' => $op, '!group_n' => l($node->title, "node/$row->gid")));265 } 266 } 264 return t('Members of !group_n may view this node.', array('!group_n' => l($node->title, "node/$row->gid"))); 265 } 266 } -
external/current/sites/all/modules/og/og_panels.info
r42 r127 4 4 package = "Organic groups" 5 5 dependencies = og panels panels_views 6 ; Information added by drupal.org packaging script on 2008-05-127 version = "5.x-7.2"8 project = "og"9 datestamp = "1210629035"10 -
external/current/sites/all/modules/og/og_panels.install
r42 r127 1 1 <?php 2 // $Id: og_panels.install,v 1.1.2.4 2008/03/17 15:04:28weitzman Exp $2 // $Id: og_panels.install,v 1.1.2.4.2.1 2008/10/31 12:16:14 weitzman Exp $ 3 3 4 4 function og_panels_install() { … … 27 27 default_page integer NULL, 28 28 show_blocks integer NULL, 29 weight integer(4)NOT NULL DEFAULT 0,29 weight smallint NOT NULL DEFAULT 0, 30 30 PRIMARY KEY (did) 31 31 );"); -
external/current/sites/all/modules/og/og_panels.module
r42 r127 1 1 <?php 2 // $Id: og_panels.module,v 1.1.2.3 0 2008/04/20 17:51:10weitzman Exp $2 // $Id: og_panels.module,v 1.1.2.32.2.1 2008/10/31 12:12:27 weitzman Exp $ 3 3 4 4 function og_panels_help($section) { … … 7 7 return t('After enabling this module, visit the new Pages tab on any group. There, group admins may create as many pages as desired for their group. The pages may contain any layout that the site offers and admins may arrange many different types of content as desired. Site admins can restrict the types of content that may be added on the <a href="!settings">og_panels settings</a> page. You might want to make some Views available using <a href="!apv">admin/panels/views</a>. Group admins may designate one page as their group home page.', array('!settings' => url('admin/og/og_panels'), '!apv' => url('admin/panels/views'))); 8 8 case (arg(0) == 'node' && arg(2) == 'og_panels' && !arg(3)): 9 return t( 10 '<p>Create custom pages for your group. Use custom pages to organize your content in a pretty and informative manner. Your group can group to be a whole website within a web site. Each custom page becomes a tab when viewing your group. One of your custom pages should be designated as your <em>group home page</em>. That page will then display when visitors first arrive at your group.</p> 11 <p>Start by clicking the <a href="!url">Add new page</a> tab. Then you will choose a custom layout for your page. Then you will want to <em>edit content</em> for your custom page.</p>', array('!url' => url('node/'. arg(1). '/og_panels/form'))); 9 return '<p>'. t('Create custom pages for your group. Use custom pages to organize your content in a pretty and informative manner. Your group can group to be a whole website within a web site. Each custom page becomes a tab when viewing your group. One of your custom pages should be designated as your <em>group home page</em>. That page will then display when visitors first arrive at your group.') .'</p><p>'. t('Start by clicking the <a href="!url">Add new page</a> tab. Then you will choose a custom layout for your page. Then you will want to <em>edit content</em> for your custom page.', array('!url' => url('node/'. arg(1). '/og_panels/form'))) .'</p>'; 12 10 } 13 11 } … … 17 15 $items[] = array( 18 16 'path' => 'admin/og/og_panels', 19 'title' => 'Organic groups panels',20 'description' => 'Configure the content that is available to group admins when creating group pages.',17 'title' => t('Organic groups panels'), 18 'description' => t('Configure the content that is available to group admins when creating group pages.'), 21 19 'callback' => 'og_panels_admin_content', 22 20 'access' => user_access('administer organic groups'), … … 152 150 function og_panels_delete_confirm_submit($form_id, $form_values) { 153 151 og_panels_delete($form_values['did']); 154 drupal_set_message(t('%title has been deleted ', array('%title' => $form_values['page_title'])));152 drupal_set_message(t('%title has been deleted.', array('%title' => $form_values['page_title']))); 155 153 } 156 154 … … 184 182 $item['page_title'] = array('#value' => l($display->page_title, "node/$nid/$display->path")); 185 183 $item['weight'] = array('#type' => 'weight', '#default_value' => $display->weight); 186 $item['edit content'] = array('#value' => l(t(' edit content'), "node/$nid/og_panels/$display->did/panel_content", array(), drupal_get_destination()));187 $item['change layout'] = array('#value' => l(t(' change layout'), "node/$nid/og_panels/$display->did/panel_layout"));188 $item['edit layout settings'] = array('#value' => l(t(' edit layout settings'), "node/$nid/og_panels/$display->did/panel_settings"));189 $item['edit page'] = array('#value' => l(t(' edit page'), "node/$nid/og_panels/form/$display->did", array(), drupal_get_destination()));190 $item['delete page'] = array('#value' => l(t(' delete page'), "node/$nid/og_panels/$display->did/delete", array(), drupal_get_destination()));184 $item['edit content'] = array('#value' => l(t('Edit content'), "node/$nid/og_panels/$display->did/panel_content", array(), drupal_get_destination())); 185 $item['change layout'] = array('#value' => l(t('Change layout'), "node/$nid/og_panels/$display->did/panel_layout")); 186 $item['edit layout settings'] = array('#value' => l(t('Edit layout settings'), "node/$nid/og_panels/$display->did/panel_settings")); 187 $item['edit page'] = array('#value' => l(t('Edit page'), "node/$nid/og_panels/form/$display->did", array(), drupal_get_destination())); 188 $item['delete page'] = array('#value' => l(t('Delete page'), "node/$nid/og_panels/$display->did/delete", array(), drupal_get_destination())); 191 189 192 190 $form['displays'][$display->did] = $item; … … 207 205 $form['submit'] = array( 208 206 '#type' => 'submit', 209 '#value' => t('Save Settings'),207 '#value' => t('Save settings'), 210 208 ); 211 209 … … 273 271 drupal_set_breadcrumb($bc); 274 272 // Mark node as read and show feed icon for any group panel page (how to do this better?) 275 drupal_add_feed(url("node/$ nid/feed"), t('@name at @site', array('@name' => $node->title, '@site' => variable_get('site_name', 'drupal'))));276 node_tag_new($ node->nid);273 drupal_add_feed(url("node/$group_node->nid/feed"), t('@name at @site', array('@name' => $group_node->title, '@site' => variable_get('site_name', 'drupal')))); 274 node_tag_new($group_node->nid); 277 275 278 276 … … 581 579 582 580 $items['og_subscribers'] = array( 583 'title' => t('OG Members'),581 'title' => t('OG members'), 584 582 'content_types' => 'og_panels_ct_list_subscribers', 585 583 'single' => TRUE, // only provides a single content type … … 604 602 if (og_is_picture()) { 605 603 $items['og_faces'] = array( 606 'title' => t('OG Faces'),604 'title' => t('OG faces'), 607 605 'content_types' => 'og_panels_ct_list_faces', 608 606 'single' => TRUE, // only provides a single content type … … 636 634 switch ($delta) { 637 635 case 2: 638 // Provide alternate versions ascontent items636 // Provide alternate versions of these content items 639 637 unset($info); 640 638 break; 641 case 'default':639 default: 642 640 $info['icon'] = 'user-multiple.png'; 643 641 $info['required context'] = new panels_required_context(t('Group'), 'group'); -
external/current/sites/all/modules/og/og_views.inc
r42 r127 1 1 <?php 2 // $Id: og_views.inc,v 1.12.2.5 4 2008/05/08 19:49:26 weitzmanExp $2 // $Id: og_views.inc,v 1.12.2.55.2.4 2008/10/06 07:56:45 karthik Exp $ 3 3 /** 4 4 * Implementation of the hook_views_tables() … … 32 32 ), 33 33 'count' => array( 34 'name' => t('OG: Group: Members Count'),34 'name' => t('OG: Group: Members count'), 35 35 'handler' => 'og_handler_field_count', 36 36 'help' => t('Number of members for a group. Excludes memberships which are pending approval.'), … … 39 39 ), 40 40 'post_count' => array( 41 'name' => t('OG: Group: Post Count'),41 'name' => t('OG: Group: Post count'), 42 42 'handler' => 'og_handler_post_count', 43 43 'sortable' => FALSE, … … 53 53 ), 54 54 'post_count_new' => array( 55 'name' => t('OG: Group: Post Count *New*'),55 'name' => t('OG: Group: Post count *new*'), 56 56 'handler' => 'og_handler_post_count_new', 57 57 'sortable' => FALSE, … … 61 61 '#type' => 'select', 62 62 '#options' => array( 63 'normal' => 'Normal',64 'withmark' => 'With new mark'63 'normal' => t('Normal'), 64 'withmark' => t('With new mark') 65 65 ), 66 66 ), … … 71 71 'private' => array( 72 72 'name' => t('OG: Group: Private'), 73 'handler' => 'og_handler_field_private', 74 'sortable' => TRUE, 75 'help' => t('Displays whether a group is private or public with respect to groups.'), 73 76 ), 74 77 'subscribe' => array( … … 79 82 'notafield' => TRUE, 80 83 'help' => t('Displays a links for joining a group when a user is not already a member.'), 81 ),82 'notification' => array(83 'name' => t('OG: Group: Notification'),84 'handler' => 'og_handler_field_yesempty',85 'help' => t('Displays <em>yes</em> if group automatically sends email notifications to members'),86 84 ), 87 85 'language' => array( … … 226 224 ), 227 225 'fields' => array( 228 'mail_type' => array(229 'name' => t('OG: Subscription email'),230 'handler' => 'og_handler_field_yesempty',231 'sortable' => false,232 'help' => t('Does member receive email notifications for a group.'),233 ),234 226 'managelink' => array( 235 227 'name' => t('OG: Manage membership link'), … … 247 239 'currentuidsimple' => array( 248 240 'field' => 'uid', 249 'name' => t( 'OG: Group in User\'s Groups'),241 'name' => t("OG: Group in user's groups"), 250 242 'operator' => 'views_handler_operator_eqneq', 251 243 'list' => 'views_handler_filter_usercurrent', … … 332 324 ), 333 325 'help' => t('Filter for the one or more organic groups. Groups should be specified by name, or part of a name. Use the <em>Option</em> field to specify how to match the supplied name.'), 334 ) 326 ), 327 'og_uid' => array( 328 'name' => t('OG: User is subscribed to group'), 329 'handler' => 'og_views_handler_argument_uid', 330 'help' => t("Filter for groups that user is subscribed to. User is specified by user ID (integer). This argument exposes a user's group subscriptions to other users. Depending on your site, this may be a violation of their privacy. Use it thoughfully."), 331 ), 335 332 ); 336 333 return $args; … … 363 360 case 'title': 364 361 return db_result(db_query_range('SELECT title FROM {node} WHERE nid = %d', $query, 0, 1));; 362 } 363 } 364 365 /** 366 * Custom argument for filtering by groups that a user is subscribed to 367 */ 368 function og_views_handler_argument_uid($op, &$query, $a1, $a2 = null) { 369 switch ($op) { 370 case 'filter': 371 $query->ensure_table('og_uid'); 372 $query->add_where("og_uid.uid = %d", $a2); 373 break; 374 case 'title': 375 // This returns the title for this node in the title, breadcrumb, etc. 376 return db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $a2)); 365 377 } 366 378 } … … 425 437 $view = new stdClass(); 426 438 $view->name = 'og_mytracker'; 427 $view->description = 'Shows all activity in subscribed groups.';439 $view->description = t('Shows all activity in subscribed groups.'); 428 440 $view->access = array ( 429 441 0 => '2', … … 431 443 $view->view_args_php = ''; 432 444 $view->page = TRUE; 433 $view->page_title = 'Recent posts in my groups';445 $view->page_title = t('Recent posts in my groups'); 434 446 $view->page_header = ''; 435 447 $view->page_header_format = '1'; 436 448 $view->page_footer = ''; 437 449 $view->page_footer_format = '1'; 438 $view->page_empty = 'There are no posts in your subscribed groups.';450 $view->page_empty = t('There are no posts in your subscribed groups.'); 439 451 $view->page_empty_format = '1'; 440 452 $view->page_type = 'table'; … … 443 455 $view->nodes_per_page = '25'; 444 456 $view->menu = TRUE; 445 $view->menu_title = 'My recent';457 $view->menu_title = t('My recent'); 446 458 $view->menu_tab = TRUE; 447 459 $view->menu_tab_weight = '0'; … … 478 490 'tablename' => 'node', 479 491 'field' => 'title', 480 'label' => 'Title',492 'label' => t('Title'), 481 493 'handler' => 'views_handler_field_nodelink_with_mark', 482 494 'sortable' => '1', … … 486 498 'tablename' => 'users', 487 499 'field' => 'name', 488 'label' => 'Author',500 'label' => t('Author'), 489 501 'sortable' => '1', 490 502 ), … … 492 504 'tablename' => 'node_comment_statistics', 493 505 'field' => 'comment_count', 494 'label' => 'Replies',506 'label' => t('Replies'), 495 507 'handler' => 'views_handler_comments_with_new', 496 508 'sortable' => '1', … … 499 511 'tablename' => 'node_comment_statistics', 500 512 'field' => 'last_comment_timestamp', 501 'label' => 'Last Post',513 'label' => t('Last post'), 502 514 'handler' => 'views_handler_field_since', 503 515 'sortable' => '1', … … 529 541 $view = new stdClass(); 530 542 $view->name = 'og_unread'; 531 $view->description = 'Shows unread posts in subscribed groups.';543 $view->description = t('Shows unread posts in subscribed groups.'); 532 544 $view->access = array ( 533 545 0 => '2', … … 535 547 $view->view_args_php = ''; 536 548 $view->page = TRUE; 537 $view->page_title = 'Unread posts in my groups';549 $view->page_title = t('Unread posts in my groups'); 538 550 $view->page_header = ''; 539 551 $view->page_header_format = '1'; 540 552 $view->page_footer = ''; 541 553 $view->page_footer_format = '1'; 542 $view->page_empty = 'There are no new posts in your subscribed groups.';554 $view->page_empty = t('There are no new posts in your subscribed groups.'); 543 555 $view->page_empty_format = '1'; 544 556 $view->page_type = 'table'; … … 547 559 $view->nodes_per_page = '25'; 548 560 $view->menu = TRUE; 549 $view->menu_title = 'My unread';561 $view->menu_title = t('My unread'); 550 562 $view->menu_tab = TRUE; 551 563 $view->menu_tab_weight = '-5'; … … 571 583 'tablename' => 'og_node_data', 572 584 'field' => 'title', 573 'label' => 'Group',585 'label' => t('Group'), 574 586 ), 575 587 array ( 576 588 'tablename' => 'node', 577 589 'field' => 'type', 578 'label' => 'Type',590 'label' => t('Type'), 579 591 'sortable' => '1', 580 592 ), … … 582 594 'tablename' => 'node', 583 595 'field' => 'title', 584 'label' => 'Title',596 'label' => t('Title'), 585 597 'handler' => 'views_handler_field_nodelink_with_mark', 586 598 'sortable' => '1', … … 590 602 'tablename' => 'users', 591 603 'field' => 'name', 592 'label' => 'Author',604 'label' => t('Author'), 593 605 'sortable' => '1', 594 606 ), … … 596 608 'tablename' => 'node_comment_statistics', 597 609 'field' => 'comment_count', 598 'label' => 'Replies',610 'label' => t('Replies'), 599 611 'handler' => 'views_handler_comments_with_new', 600 612 'sortable' => '1', … … 603 615 'tablename' => 'node_comment_statistics', 604 616 'field' => 'last_comment_timestamp', 605 'label' => 'Last Post',617 'label' => t('Last post'), 606 618 'handler' => 'views_handler_field_since', 607 619 'sortable' => '1', … … 644 656 $view = new stdClass(); 645 657 $view->name = 'og_ghp_ron'; 646 $view->description = 'OG: Group home page - River of news. Default';658 $view->description = t('OG: Group home page - River of news. Default'); 647 659 $view->page = TRUE; 648 660 $view->page_type = 'teaser'; … … 699 711 $view = new stdClass(); 700 712 $view->name = 'og_my'; 701 $view->description = 'List user\'s subscribed groups and provide link to manage subscription';713 $view->description = t("List user's subscribed groups and provide link to manage subscription"); 702 714 $view->access = array ( 703 715 0 => '2', … … 705 717 $view->view_args_php = ''; 706 718 $view->page = TRUE; 707 $view->page_title = 'My groups';708 $view->page_header = strtr('You may edit all your email subscriptions using this convenient page. Also, you might be interested in an <a href="!url" rel="nofollow">OPML feed containing feeds from all your subscribed groups</a>.', array('!url' => url('og/opml')));719 $view->page_title = t('My groups'); 720 $view->page_header = t('You might be interested in an <a href="!url" rel="nofollow">OPML feed containing feeds from all your subscribed groups</a>.', array('!url' => url('og/opml'))); 709 721 $view->page_header_format = '1'; 710 722 $view->page_footer = '<?php … … 715 727 ?>'; 716 728 $view->page_footer_format = '2'; 717 $view->page_empty = 'No subscribed groups';729 $view->page_empty = t('No subscribed groups'); 718 730 $view->page_empty_format = '1'; 719 731 $view->page_type = 'table'; … … 752 764 'tablename' => 'node', 753 765 'field' => 'title', 754 'label' => 'Group',766 'label' => t('Group'), 755 767 'handler' => 'views_handler_field_nodelink', 756 768 'options' => 'link', … … 759 771 'tablename' => 'users', 760 772 'field' => 'name', 761 'label' => 'Manager',773 'label' => t('Manager'), 762 774 ), 763 775 array ( 764 776 'tablename' => 'og', 765 777 'field' => 'count', 766 'label' => 'Members', 767 ), 768 array ( 769 'tablename' => 'og_uid', 770 'field' => 'mail_type', 771 'label' => 'Email', 778 'label' => t('Members'), 772 779 ), 773 780 array ( 774 781 'tablename' => 'og_uid', 775 782 'field' => 'managelink', 776 'label' => 'Manage',783 'label' => t('Manage'), 777 784 ), 778 785 ); … … 814 821 $view->view_args_php = ''; 815 822 $view->page = TRUE; 816 $view->page_title = 'Groups directory';823 $view->page_title = t('Groups directory'); 817 824 $view->page_header = ''; 818 825 $view->page_header_format = '2'; 819 826 $view->page_footer = ''; 820 827 $view->page_footer_format = '1'; 821 $view->page_empty = 'No groups';828 $view->page_empty = t('No groups'); 822 829 $view->page_empty_format = '1'; 823 830 $view->page_type = 'table'; … … 826 833 $view->nodes_per_page = '90'; 827 834 $view->menu = TRUE; 828 $view->menu_title = 'Groups';835 $view->menu_title = t('Groups'); 829 836 $view->menu_tab = TRUE; 830 837 $view->menu_tab_weight = '-5'; … … 850 857 'tablename' => 'node', 851 858 'field' => 'title', 852 'label' => 'Group',859 'label' => t('Group'), 853 860 'handler' => 'views_handler_field_nodelink', 854 861 'sortable' => '1', … … 858 865 'tablename' => 'users', 859 866 'field' => 'name', 860 'label' => 'Manager',867 'label' => t('Manager'), 861 868 ), 862 869 array ( 863 870 'tablename' => 'og', 864 871 'field' => 'count', 865 'label' => 'Members',872 'label' => t('Members'), 866 873 ), 867 874 array ( 868 875 'tablename' => 'og', 869 876 'field' => 'description', 870 'label' => 'Description',877 'label' => t('Description'), 871 878 ), 872 879 array ( 873 880 'tablename' => 'og', 874 881 'field' => 'subscribe', 875 'label' => 'Join',882 'label' => t('Join'), 876 883 ), 877 884 ); … … 910 917 'tablename' => 'node', 911 918 'field' => 'title', 912 'label' => 'Search for a group by name',919 'label' => t('Search for a group by name'), 913 920 'optional' => '1', 914 921 'is_default' => '0', … … 924 931 $view = new stdClass(); 925 932 $view->name = 'og_tracker'; 926 $view->description = 'Shows active posts across the whole site';933 $view->description = t('Shows active posts across the whole site'); 927 934 $view->access = array ( 928 935 ); 929 936 $view->view_args_php = ''; 930 937 $view->page = TRUE; 931 $view->page_title = 'Recent posts across whole site';938 $view->page_title = t('Recent posts across whole site'); 932 939 $view->page_header = ''; 933 940 $view->page_header_format = '1'; … … 941 948 $view->nodes_per_page = '25'; 942 949 $view->menu = TRUE; 943 $view->menu_title = 'Recent posts';950 $view->menu_title = t('Recent posts'); 944 951 $view->menu_tab = TRUE; 945 952 $view->menu_tab_weight = '5'; … … 961 968 'type' => 'uid', 962 969 'argdefault' => '2', 963 'title' => 'Recent posts for %1',970 'title' => t('Recent posts for %1'), 964 971 'options' => '', 965 972 'wildcard' => '', … … 984 991 'tablename' => 'node', 985 992 'field' => 'title', 986 'label' => 'Title',993 'label' => t('Title'), 987 994 'handler' => 'views_handler_field_nodelink_with_mark', 988 995 'options' => 'link', … … 991 998 'tablename' => 'users', 992 999 'field' => 'name', 993 'label' => 'Author',1000 'label' => t('Author'), 994 1001 ), 995 1002 array ( 996 1003 'tablename' => 'node_comment_statistics', 997 1004 'field' => 'comment_count', 998 'label' => 'Replies',1005 'label' => t('Replies'), 999 1006 'handler' => 'views_handler_comments_with_new', 1000 1007 ), … … 1002 1009 'tablename' => 'og_node_data', 1003 1010 'field' => 'title', 1004 'label' => 'Groups',1011 'label' => t('Groups'), 1005 1012 ), 1006 1013 array ( 1007 1014 'tablename' => 'node_comment_statistics', 1008 1015 'field' => 'last_comment_timestamp', 1009 'label' => 'Last Post',1016 'label' => t('Last post'), 1010 1017 'handler' => 'views_handler_field_since', 1011 1018 ), … … 1029 1036 $view = new stdClass(); 1030 1037 $view->name = 'og_search'; 1031 $view->description = 'Search within a particular group';1038 $view->description = t('Search within a particular group'); 1032 1039 $view->access = array ( 1033 1040 ); 1034 1041 $view->view_args_php = ''; 1035 1042 $view->page = TRUE; 1036 $view->page_title = 'Search';1043 $view->page_title = t('Search'); 1037 1044 $view->page_header = ''; 1038 1045 $view->page_header_format = '1'; 1039 1046 $view->page_footer = ''; 1040 1047 $view->page_footer_format = '1'; 1041 $view->page_empty = 'No posts found.';1048 $view->page_empty = t('No posts found.'); 1042 1049 $view->page_empty_format = '1'; 1043 1050 $view->page_type = 'teaser'; … … 1057 1064 'type' => 'gid', 1058 1065 'argdefault' => '1', 1059 'title' => 'Search results for %1',1066 'title' => t('Search results for %1'), 1060 1067 'options' => '', 1061 1068 'wildcard' => '', … … 1085 1092 'tablename' => 'temp_search_results', 1086 1093 'field' => 'word', 1087 'label' => 'Enter keyword',1094 'label' => t('Enter keyword'), 1088 1095 'optional' => '1', 1089 1096 'is_default' => '0', … … 1098 1105 $view = new stdClass(); 1099 1106 $view->name = 'og_comments_recent'; 1100 $view->description = 'Display recent comments block in a group';1107 $view->description = t('Display recent comments block in a group'); 1101 1108 $view->access = array ( 1102 1109 ); 1103 1110 $view->view_args_php = ''; 1104 1111 $view->block = TRUE; 1105 $view->block_title = 'Recent comments';1112 $view->block_title = t('Recent comments'); 1106 1113 $view->block_header = ''; 1107 1114 $view->block_header_format = '1'; … … 1171 1178 $view = new stdClass(); 1172 1179 $view->name = 'og_recent_type_term'; 1173 $view->description = 'Recent posts for current term filtered by node type and/or taxonomy term';1180 $view->description = t('Recent posts for current term filtered by node type and/or taxonomy term'); 1174 1181 $view->access = array ( 1175 1182 ); … … 1263 1270 } 1264 1271 1272 function og_handler_field_private($fieldinfo, $fielddata, $value, $data) { 1273 return $value ? t('Private') : t('Public'); 1274 } 1275 1276 1265 1277 function og_handler_field_language($fieldinfo, $fielddata, $value, $data) { 1266 1278 global $locale; -
external/current/sites/all/modules/og/og_workflow_ng.inc
r42 r127 1 1 <?php 2 // $Id: og_workflow_ng.inc,v 1.1.2. 2 2008/04/14 14:02:14weitzman Exp $2 // $Id: og_workflow_ng.inc,v 1.1.2.4 2008/07/31 20:08:16 weitzman Exp $ 3 3 4 4 /** 5 5 * @file 6 * workflow_ng integration for og module 6 * workflow_ng integration for og module. 7 7 */ 8 8 9 9 /** 10 * Implementation of hook_event_info() 10 * Implementation of hook_event_info(). 11 11 */ 12 12 function og_event_info() { … … 17 17 '#arguments' => og_workflow_ng_events_hook_og_arguments(), 18 18 ), 19 'og_user_approved' => array( 20 '#label' => t('User approved to group by admin'), 21 '#module' => t('OG'), 22 '#description' => t('A pending member is approved by a group administrator.'), 23 '#arguments' => og_workflow_ng_events_hook_og_arguments(), 24 ), 19 25 'og_user_delete' => array( 20 26 '#label' => t('User leaves group'), 21 27 '#module' => t('OG'), 22 28 '#arguments' => og_workflow_ng_events_hook_og_arguments(), 23 ),24 );29 ), 30 ); 25 31 } 26 32 27 33 /** 28 * Describes the arguments available for the og hook 34 * Describes the arguments available for the og hook. 29 35 * 30 36 * We pass uid and gid to workflow-ng so that the argument handlers can load the full entities. … … 41 47 42 48 /** 43 * handler to get user 49 * handler to get user. 44 50 */ 45 51 function og_workflow_ng_events_argument_og_user($uid, $gid) { … … 48 54 49 55 /** 50 * handler to get node 56 * handler to get node. 51 57 */ 52 58 function og_workflow_ng_events_argument_og_node($uid, $gid) { …
