Permalink
Browse files

Documentation

  • Loading branch information...
ianshward committed Jul 24, 2010
1 parent 8731a63 commit eb8299b3ab178cba84f0b80d6fdbe8ee540511ac
Showing with 38 additions and 8 deletions.
  1. +38 −8 mailgroup.module
View
@@ -6,14 +6,6 @@ require('mailgroup.features.inc');
* Implementation of hook_mailhandler()
*
* Assigns OG id and type to incoming message based on group feature's settings
- *
- * @param $node
- * Object - node object
- * @param $result
- * @param $i
- * @param $header
- * @param $mailbox
- * @return unknown_type
*/
function mailgroup_mailhandler($node, $result, $i, $header, $mailbox) {
$groupname = mailgroup_parse_groupname($header);
@@ -64,6 +56,9 @@ function mailgroup_block($op = 'list', $delta = 0) {
}
}
+/**
+ * Implementation of hook_menu()
+ */
function mailgroup_menu() {
$items = array();
$items['features/mailgroup'] = array(
@@ -99,6 +94,9 @@ function mailgroup_menu() {
return $items;
}
+/**
+ * Provides settings form for mailgroup feature within each group.
+ */
function mailgroup_features_settings_form() {
$id = spaces_get_space()->id;
$settings = mailgroup_get_settings($id);
@@ -150,13 +148,19 @@ function mailgroup_features_settings_form() {
return $form;
}
+/**
+ * Validate handler for mailgroup_features_settings_form().
+ */
function mailgroup_features_settings_form_validate($form, &$form_state) {
$values = $form_state['values'];
if (($id = db_result(db_query("SELECT id FROM {mailgroup} WHERE prefix = '%s'", $values['prefix']))) && $id != $values['id']) {
form_set_error('prefix', t('Prefix %prefix already in use by another group. Please enter a different prefix.', array('%prefix' => $values['prefix'])));
}
}
+/**
+ * Submit handler for mailgroup_features_settings_form().
+ */
function mailgroup_features_settings_form_submit($form, &$form_state) {
if (db_result(db_query("SELECT id FROM {mailgroup} WHERE id = %d", $form_state['values']['id']))) {
drupal_write_record('mailgroup', $form_state['values'], 'id');
@@ -168,6 +172,9 @@ function mailgroup_features_settings_form_submit($form, &$form_state) {
}
}
+/**
+ * Provides sitewide mailgroup settings form.
+ */
function mailgroup_global_settings() {
$form = array();
$form['mailgroup'] = array(
@@ -186,6 +193,9 @@ function mailgroup_global_settings() {
return system_settings_form($form);
}
+/**
+ * Implementation of hook_message_alter().
+ */
function mailgroup_message_alter(&$message, $info) {
// TODO: Use static cache of spaces object if id is same for following message
$event = current($message->notifications['events']);
@@ -201,6 +211,13 @@ function mailgroup_message_alter(&$message, $info) {
}
}
+/**
+ * Provides block content that displays user's tokenauth token address and AJAX reset button.
+ *
+ * @TODO: degrade when no JS is available
+ *
+ * @return themed block content.
+ */
function mailgroup_block_information() {
if (($space = spaces_get_space()) && $space->type == 'og') {
global $user;
@@ -216,6 +233,9 @@ function mailgroup_block_information() {
return FALSE;
}
+/**
+ * Main page callback for Mailgroup feature.
+ */
function mailgroup_page() {
$output = '';
// TODO: Causes js settings to get added twice.
@@ -226,6 +246,13 @@ function mailgroup_page() {
/**
* Returns array of mailgroup settings for specified group
+ *
+ * @param $id
+ * Id of spaces space.
+ * @param $type
+ * Specify type to select record based on id or prefix.
+ *
+ * @return array of mailgroup settings
*/
function mailgroup_get_settings($id, $type = 'id') {
if ($type == 'id') {
@@ -236,6 +263,9 @@ function mailgroup_get_settings($id, $type = 'id') {
}
}
+/**
+ * Resets user's tokenauth token, AJAX callback
+ */
function mailgroup_tokenauth_reset() {
tokenauth_user_reset();
print tokenauth_get_token();

0 comments on commit eb8299b

Please sign in to comment.