Index: og_teampage.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/og_teampage/og_teampage.module,v
retrieving revision 1.15
diff -u -r1.15 og_teampage.module
--- og_teampage.module 9 Dec 2006 07:26:49 -0000 1.15
+++ og_teampage.module 14 Jan 2007 10:45:05 -0000
@@ -1,5 +1,5 @@
'node/add/teampage', 'title' => t('teampage'), 'access' => user_access('create teampages'));
+ $items[] = array(
+ 'path' => 'node/add/teampage',
+ 'title' => t('teampage'),
+ 'access' => user_access('create teampages')
+ );
+
+ $items[] = array(
+ 'path' => 'admin/og/og_teampage',
+ 'title' => t('OG Teampage'),
+ 'description' => t('Configure where photos are stored and how teampages are displayed'),
+ 'callback' => 'drupal_get_form',
+ 'callback arguments' => array('og_teampage_admin_settings'),
+ 'access' => user_access('administer site configuration'),
+ );
+
} else
{
- if (arg(0) == 'node' && is_numeric(arg(1))) {
- $node = node_load(arg(1));
- if ($node->type == 'teampage') {
- $items[] = array('path' => 'node/'. arg(1). '/members', 'title' => t('admin memberships'), 'callback' => 'og_teampage_admin_members_form', 'callback arguments' => array(arg(1)), 'access' => node_access('update', array('nid' => $node->nid, 'status' => 1)), 'type' => MENU_LOCAL_TASK, 'weight' => 7);
- } else
- if (og_is_group_type($node->type)) {
- $items[] = array('path' => 'node/'. arg(1). '/members', 'title' => t('configure team table view'), 'callback' => 'og_teampage_admin_members_form', 'callback arguments' => array(arg(1)), 'access' => node_access('update', array('nid' => $node->nid, 'status' => 1)), 'type' => MENU_LOCAL_TASK, 'weight' => 7);
- };
- }
+ if (arg(0) == 'node' && is_numeric(arg(1))) {
+ $node = node_load(arg(1));
+ if ($node->type == 'teampage') {
+
+ $items[] = array(
+ 'path' => 'node/'. arg(1). '/members',
+ 'title' => t('admin memberships'),
+ 'callback' => 'og_teampage_admin_members',
+ 'callback arguments' => array(arg(1)),
+ 'access' => node_access('update', array('nid' => $node->nid, 'status' => 1)),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 7
+ );
+
+ } else if (og_is_group_type($node->type)) {
+
+ $items[] = array(
+ 'path' => 'node/'. arg(1). '/members',
+ 'title' => t('configure team table view'),
+ 'callback' => 'og_teampage_admin_members',
+ 'callback arguments' => array(arg(1)),
+ 'access' => node_access('update', array('nid' => $node->nid, 'status' => 1)),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 7
+ );
+ };
+ }
}
return $items;
@@ -50,11 +82,17 @@
/**
* Implementation of hook_node_info().
- * Note that our nodes are type=og instead of type=og_teampage. This is a legacy convenience to when og did n ot support external
+ * Note that our nodes are type=og instead of type=og_teampage. This is a legacy convenience to when og did not support external
* node types. This will help contributed modules catch up without much pain.
*/
function og_teampage_node_info() {
- return array('teampage' => array('name' => t('teampage'), 'base' => 'og_teampage'));
+ return array(
+ 'teampage' => array(
+ 'name' => t('teampage'),
+ 'module' => 'og_teampage',
+ 'description' => t("A teampage displays the members of an organic group")
+ )
+ );
}
/**
@@ -82,25 +120,25 @@
switch ($op) {
case 'list':
return array(0 => t('og group members table'));
- //case 'no cache':
+ //case 'no cache':
// return TRUE;
case 'description':
return t('Show the group members of an organic group in a table.');
case 'process':
- $tag_start = strpos($text, '[teamtable:');
- if ($tag_start === FALSE) {
- return $text;
- } else {
- $tag_end = strpos($text, ']',$tag_start);
- $tag = substr($text, $tag_start, $tag_end - $tag_start + 1);
- $gid = $tag;
- $gid = str_replace('[teamtable:', '', $gid);
- $gid = str_replace(']', '', $gid);
- $text = str_replace($tag, og_teampage_teamtable($gid), $text);
- return $text;
- }
- default:
- return $text;
+ $tag_start = strpos($text, '[teamtable:');
+ if ($tag_start === FALSE) {
+ return $text;
+ } else {
+ $tag_end = strpos($text, ']',$tag_start);
+ $tag = substr($text, $tag_start, $tag_end - $tag_start + 1);
+ $gid = $tag;
+ $gid = str_replace('[teamtable:', '', $gid);
+ $gid = str_replace(']', '', $gid);
+ $text = str_replace($tag, og_teampage_teamtable($gid), $text);
+ return $text;
+ }
+ default:
+ return $text;
}
}
@@ -116,158 +154,170 @@
}
function og_teampage_view(&$node, $teaser = FALSE, $page = FALSE){
- $node = node_prepare($node, $teaser);
- $node->teaser = theme('og_teampage_teaser', $node);
- $node->body = theme('og_teampage_body', $node);
- if ($teaser)
- {
- $node->og_description = $node->teaser;
- }
- $node->readmore = 0;
+ $node = node_prepare($node, $teaser);
+ $node->teaser = theme('og_teampage_teaser', $node);
+ $node->body = theme('og_teampage_body', $node);
+ if ($teaser)
+ {
+ $node->og_description = $node->teaser;
+ }
+ $node->readmore = 0;
}
function theme_og_teampage_teaser($node)
{
- $output .= '
';
- return $output;
+ $output .= '';
+ return $output;
}
function sort_members_array($a, $b) {
- if ($a[data]->weight == $b[data]->weight) return 0;
- return ($a[data]->weight > $b[data]->weight) ? 1 : -1;
+ if ($a[data]->weight == $b[data]->weight) return 0;
+ return ($a[data]->weight > $b[data]->weight) ? 1 : -1;
}
function og_teampage_teamtable($gid) {
- $table = '';
- $table .= '
';
- $min_is_active = 1;
- $min_is_admin = 0;
-
- $sql = "SELECT u.uid, u.name, ou.* FROM {og_uid} ou INNER JOIN {users} u ON ou.uid = u.uid WHERE ou.nid = %b AND u.status > 0 AND is_active >= $min_is_active AND is_admin >= $min_is_admin ORDER BY u.name ASC";
- $result = db_query($sql, $gid);
+ $table = '';
+ $table .= '
';
+ $min_is_active = 1;
+ $min_is_admin = 0;
+
+ $sql = "SELECT u.uid, u.name, ou.* FROM {og_uid} ou INNER JOIN {users} u ON ou.uid = u.uid WHERE ou.nid = %b AND u.status > 0 AND is_active >= $min_is_active AND is_admin >= $min_is_admin ORDER BY u.name ASC";
+ $result = db_query($sql, $gid);
$i=0;
while ($account = db_fetch_object($result)) {
$rows[$i][username] = $account->name;
- $rows[$i][uid] = $account->uid;
-
- $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$account->uid."' AND gid='".$gid."'");
- if (db_num_rows($res) < 1) {
- $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$account->uid."' AND gid='0'");
- }
- $rows[$i][data] = db_fetch_object($res);
+ $rows[$i][uid] = $account->uid;
+
+ $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$account->uid."' AND gid='".$gid."'");
+ if (db_num_rows($res) < 1) {
+ $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$account->uid."' AND gid='0'");
+ }
+ $rows[$i][data] = db_fetch_object($res);
$i++;
}
- $trows = array();
- $rowcounter = 1;
- $colcounter = 0;
- $colcount = variable_get('og_teampage_colcount',5);
- $colwidth = 100/variable_get('og_teampage_colcount',5);
- $colwidth = round($colwidth);
- $colwidthstring = $colwidth.'%';
-
- usort($rows, sort_members_array);
- foreach($rows as $row)
- {
- if ($row[data]->hidden != '1') {
- $colcounter++;
- if ($colcounter > $colcount) {
- $rowcounter++;
- $colcounter = 1;
- }
- $picsource = drupal_get_path('module', 'og_teampage').'/no-pic.png';
- if ($row[data]->picture1 != '')
- {
- $picsource = $row[data]->picture1;
- if (strpos($picsource, 'system/files') === FALSE)
- {
- $picsource = file_create_url($picsource);
- }
- }
- if ($row[data]->name != '')
- {
- $name = $row[data]->name;
- } else $name = $row[username];
- if ($row[data]->description != '')
- {
- $description = $row[data]->description;
- } else $description = ' ';
- $attr=array();
- $attr['target'] = '_blank';
- $piclink = l('
','user/'.$row[uid], $attr, NULL, NULL, FALSE, TRUE);
- $textlink = l($name,'user/'.$row[uid], $attr);
- $member = '| '.$piclink.' |
| '.$textlink.' |
| '.$description.' |
| |
';
-
- $cell = ''.$member.' | ';
- $trows[$rowcounter] .= $cell;
- }
-
+ $trows = array();
+ $rowcounter = 1;
+ $colcounter = 0;
+ $colcount = variable_get('og_teampage_colcount',5);
+ $colwidth = 100/variable_get('og_teampage_colcount',5);
+ $colwidth = round($colwidth);
+ $colwidthstring = $colwidth.'%';
+
+ usort($rows, sort_members_array);
+ foreach($rows as $row)
+ {
+ if ($row[data]->hidden != '1') {
+ $colcounter++;
+ if ($colcounter > $colcount) {
+ $rowcounter++;
+ $colcounter = 1;
+ }
+ $picsource = drupal_get_path('module', 'og_teampage').'/no-pic.png';
+ if ($row[data]->picture1 != '')
+ {
+ $picsource = $row[data]->picture1;
+ if (strpos($picsource, 'system/files') === FALSE)
+ {
+ $picsource = file_create_url($picsource);
+ }
+ }
+ if ($row[data]->name != '')
+ {
+ $name = $row[data]->name;
+ } else $name = $row[username];
+ if ($row[data]->description != '')
+ {
+ $description = $row[data]->description;
+ } else $description = ' ';
+ $attr=array();
+ $attr['target'] = '_blank';
+ $piclink = l('
','user/'.$row[uid], $attr, NULL, NULL, FALSE, TRUE);
+ $textlink = l($name,'user/'.$row[uid], $attr);
+ $member = '| '.$piclink.' |
| '.$textlink.' |
| '.$description.' |
| |
';
+
+ $cell = ''.$member.' | ';
+ $trows[$rowcounter] .= $cell;
+ }
+
}
- foreach ($trows as $trow) {
- $trcount++;
- if (($trcount < $rowcounter) || ($colcounter == $colcount)) {
- $table .= ''.$trow.'
';
- };
- }
- $table .= '
';
- if ($colcounter < $colcount)
- {
- $table .= '
';
- $diff = $colcount - $colcounter;
- $dummywidth = $colwidth * $diff / 2;
- $dummywidth = round($dummywidth);
- $dummywidthstr = $dummywidth.'%';
- $table .= '| | ';
- $table .= $trows[$rowcounter];
- $table .= ' | ';
- $table .= '
';
- }
- $table .= '
';
- $table .= '
';
- return $table;
+ foreach ($trows as $trow) {
+ $trcount++;
+ if (($trcount < $rowcounter) || ($colcounter == $colcount)) {
+ $table .= ''.$trow.'
';
+ };
+ }
+ $table .= '
';
+ if ($colcounter < $colcount)
+ {
+ $table .= '
';
+ $diff = $colcount - $colcounter;
+ $dummywidth = $colwidth * $diff / 2;
+ $dummywidth = round($dummywidth);
+ $dummywidthstr = $dummywidth.'%';
+ $table .= '| | ';
+ $table .= $trows[$rowcounter];
+ $table .= ' | ';
+ $table .= '
';
+ }
+ $table .= '
';
+ $table .= '
';
+ return $table;
}
function theme_og_teampage_body($node)
{
- $output = ''.$node->body;
- $output .= '
'.t('The Team').'
';
- $output .= t('These players are starting in team').' '.$node->title.':
';
- $output .= '
';
- $output .= og_teampage_teamtable($node->nid);
- $output .= ' ';
- return $output;
+ $output = ''.$node->body;
+ $output .= '
'.t('The Team').'
';
+ $output .= t('These players are starting in team').' '.$node->title.':
';
+ $output .= '
';
+ $output .= og_teampage_teamtable($node->nid);
+ $output .= ' ';
+ return $output;
}
function og_teampage_link($type, $node = NULL, $teaser = FALSE) {
if ($node->type == 'teampage')
- {
- $links = array();
- if ($teaser){
- $links[] = l(t('go to teampage'), "node/$node->nid",
- array('title' => t('More about this team on its own teampage.')));
- }
- return $links;
- }
-}
+ {
+ $links = array();
+ if ($teaser){
+ $links[og_teampage_teampage] = array(
+ 'title' => t('go to teampage'),
+ 'href' => "node/$node->nid",
+ 'attributes' => array('title' => t('More about this team on its own teampage.')));
+ }
+ return $links;
+ }
+}
-function og_teampage_settings() {
+function og_teampage_admin_settings() {
-$form['og_teampage_image_default_path'] = array('#type' => 'textfield', '#title' => t('Default image path'), '#default_value' => variable_get('og_teampage_image_default_path', 'teampage images'), '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored. Do not include trailing slash.', array('%dir' => theme('placeholder', variable_get('file_directory_path', 'files')))));
+ $form['og_teampage_image_default_path'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Default image path'),
+ '#default_value' => variable_get('og_teampage_image_default_path', 'teampage images'),
+ '#description' => t('Subdirectory in the directory "%dir" where pictures will be stored. Do not include trailing slash.', array('%dir' => variable_get('file_directory_path', 'files')))
+ );
$form['og_teampage_colcount'] = array('#type' => 'textfield', '#title' => t('Column count in members table'), '#default_value' => variable_get('og_teampage_colcount',5), '#description' => t('How many members should be shown in one row?'));
-return $form;
+return system_settings_form($form);
+}
+
+function og_teampage_admin_members($gid) {
+ return drupal_get_form('og_teampage_admin_members_form', gid);
}
function og_teampage_admin_members_form($gid) {
- $node = node_load($gid);
- $access = node_access('update', $node);
- $form['attributes'] = array("#enctype" => "multipart/form-data");
- $form['#attributes']['enctype'] = 'multipart/form-data';
- $sql = og_list_users_sql(0);
- $result = db_query($sql, $gid);
- while ($account = db_fetch_object($result)) {
- $uid = $account->uid;
- $operations = array();
- if (($access) && ($account->uid != $node->uid)) {
+
+ $node = node_load($gid);
+ $access = node_access('update', $node);
+ $form['attributes'] = array("#enctype" => "multipart/form-data");
+ $form['#attributes']['enctype'] = 'multipart/form-data';
+ $sql = og_list_users_sql(0);
+ $result = db_query($sql, $gid);
+ while ($account = db_fetch_object($result)) {
+ $uid = $account->uid;
+ $operations = array();
+ if (($access) && ($account->uid != $node->uid)) {
if ($account->is_active) {
$operations[] = l(t('unsubscribe'), "og/unsubscribe/$gid/$account->uid", array(), "destination=og/users/$gid");
if ($account->is_admin) {
@@ -282,104 +332,105 @@
$operations[] = l(t('deny'), "og/deny/$gid/$account->uid", array(), "destination=og/users/$gid");
}
}
- $ophtml = '';
- foreach ($operations as $operation) {
- $ophtml .= '| '.$operation.' |
';
- }
- $ophtml .= '
';
-
- $form[$uid]['#tree'] = TRUE;
- $form[$uid][op] = array('#type' => 'markup', '#value' => $ophtml);
- $form[$uid][username] = array('#type' => 'markup', '#value' => theme('username', $account));
-
- $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='".$gid."'");
- if (db_num_rows($res) < 1) {
- $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='0'");
- }
- $data = db_fetch_object($res);
- $form[$uid][weight] = array('#type' => 'weight', '#default_value' => $data->weight, '#title' => t('Weight'), '#delta' => 10);
- $form[$uid][description] = array('#type' => 'textarea', '#default_value' => $data->description, '#title' => t('Description'));
- $form[$uid][name] = array('#type' => 'textfield', '#default_value' => $data->name, '#size' => 20, '#title' => t('Name in team'));
- $form[$uid][hidden] = array('#type' => 'checkbox', '#default_value' => $data->hidden, '#title' => t('Hidden at homepage').'?');
-
- $picsource = '/'.drupal_get_path('module', 'og_teampage').'/no-pic.png';
- if ($data->picture1 != '') {
- $picsource = $data->picture1;
- if (strpos($picsource, 'system/files') === FALSE)
- {
- $picsource = file_create_url($picsource);
- } else $picsource = '/'.$picsource;
- }
- $form[$uid][image] = array('#type' => 'markup', '#value' => '
');
-
- $form['image_upload'.$uid] = array('#type' => 'file', '#size' => 10, '#title' => t('Upload new picture'));
- if ($data->picture1 != '') $form[$uid][image_delete] = array('#type' => 'checkbox', '#title' => t('delete this picture').'?');
-
- $form[$uid][image_oldpath] = array('#type' => 'value', '#value' => $data->picture1);
- $form['gid'] = array('#type' => 'value', '#value' => $gid);
- $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
- }
- drupal_set_title(t('Administer memberships of %group', array('%group' => $node->title)));
- return drupal_get_form('og_teampage_admin_members_form', $form);
-}
-
-function theme_og_teampage_admin_members_form($form) {
- $rows= array();
- foreach ($form as $name => $element) {
- if (isset($element['description'])&& is_array($element['description'])) {
- $rows[] = ''.form_render($element[username]).' | '.form_render($element[op]).' | '.form_render($element[name]).' | '.form_render($element[weight]).' | '.form_render($element[hidden]).' | ';
- $rows[] = ''.form_render($element[description]).' | '.form_render($element[image]).' '.form_render($element['image_delete']).' | | '.form_render($form['image_upload'.$name]).' |
| ';
- unset ($form[$name]);
- unset ($form['image_upload'.$name]);
- }
- }
- $gid = $form['gid']['#value'];
- $output .= ''.t('If you want to add some users to the team, click ').l('here',"og/users/$gid/add").'!
';
- $output .= '';
- $counter = 0;
- $class = 'even';
- foreach ($rows as $row) {
- $counter++;
- if ($counter == 3) {
- $counter = 1;
- if ($class == 'odd') {
- $class = 'even';
- } else $class = 'odd';
- }
- $output .= ''.$row.'
';
- if ($counter == 2) $output .= '| |
';
- }
- $output .= '
';
- $output .= form_render($form);
- return $output;
+ $ophtml = '';
+ foreach ($operations as $operation) {
+ $ophtml .= '| '.$operation.' |
';
+ }
+ $ophtml .= '
';
+
+ $form[$uid]['#tree'] = TRUE;
+ $form[$uid][op] = array('#type' => 'markup', '#value' => $ophtml);
+ $form[$uid][username] = array('#type' => 'markup', '#value' => theme('username', $account));
+
+ $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='".$gid."'");
+ if (db_num_rows($res) < 1) {
+ $res = db_query("SELECT * FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='0'");
+ }
+ $data = db_fetch_object($res);
+ $form[$uid][weight] = array('#type' => 'weight', '#default_value' => $data->weight, '#title' => t('Weight'), '#delta' => 10);
+ $form[$uid][description] = array('#type' => 'textarea', '#default_value' => $data->description, '#title' => t('Description'));
+ $form[$uid][name] = array('#type' => 'textfield', '#default_value' => $data->name, '#size' => 20, '#title' => t('Name in team'));
+ $form[$uid][hidden] = array('#type' => 'checkbox', '#default_value' => $data->hidden, '#title' => t('Hidden at homepage').'?');
+
+ $picsource = '/'.drupal_get_path('module', 'og_teampage').'/no-pic.png';
+ if ($data->picture1 != '') {
+ $picsource = $data->picture1;
+ if (strpos($picsource, 'system/files') === FALSE)
+ {
+ $picsource = file_create_url($picsource);
+ } else $picsource = '/'.$picsource;
+ }
+ $form[$uid][image] = array('#type' => 'markup', '#value' => '
');
+
+ $form['image_upload'.$uid] = array('#type' => 'file', '#size' => 10, '#title' => t('Upload new picture'));
+ if ($data->picture1 != '') $form[$uid][image_delete] = array('#type' => 'checkbox', '#title' => t('delete this picture').'?');
+
+ $form[$uid][image_oldpath] = array('#type' => 'value', '#value' => $data->picture1);
+ $form['gid'] = array('#type' => 'value', '#value' => $gid);
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
+ }
+ drupal_set_title(t('Administer memberships of %group', array('%group' => $node->title)));
+
}
-function og_teampage_admin_members_form_submit($form_id, $form_values) {
+
+function theme_og_teampage_admin_members($form) {
+ $rows= array();
+ foreach ($form as $name => $element) {
+ if (isset($element['description'])&& is_array($element['description'])) {
+ $rows[] = ''.form_render($element[username]).' | '.form_render($element[op]).' | '.form_render($element[name]).' | '.form_render($element[weight]).' | '.form_render($element[hidden]).' | ';
+ $rows[] = ''.form_render($element[description]).' | '.form_render($element[image]).' '.form_render($element['image_delete']).' | | '.form_render($form['image_upload'.$name]).' |
| ';
+ unset ($form[$name]);
+ unset ($form['image_upload'.$name]);
+ }
+ }
+ $gid = $form['gid']['#value'];
+ $output .= ''.t('If you want to add some users to the team, click ').l('here',"og/users/$gid/add").'!
';
+ $output .= '';
+ $counter = 0;
+ $class = 'even';
+ foreach ($rows as $row) {
+ $counter++;
+ if ($counter == 3) {
+ $counter = 1;
+ if ($class == 'odd') {
+ $class = 'even';
+ } else $class = 'odd';
+ }
+ $output .= ''.$row.'
';
+ if ($counter == 2) $output .= '| |
';
+ }
+ $output .= '
';
+ $output .= form_render($form);
+ return $output;
+}
+
+function og_teampage_admin_members_submit($form_id, $form_values) {
$error = FALSE;
- $gid = $form_values['gid'];
- foreach ($form_values as $uid => $value) {
- if (isset($value['description'])&& is_array($value)) {
- if ($value['image_delete'] == 1)
- {
- $value['image_oldpath'] = '';
- }
- $newfilename = '';
- $file = file_check_upload('image_upload'.$uid);
- if ($file) {
- if (substr($file->filemime, 0, 6) == 'image/') {
- file_save_upload('image_upload'.$uid, variable_get('og_teampage_image_default_path', 'images') .'/teampage_overview_'.$gid.'_'.$uid.'.'.substr($file->filemime, 6),FILE_EXISTS_REPLACE);
- $newfilename = variable_get('og_teampage_image_default_path', 'images') .'/teampage_overview_'.$gid.'_'.$uid.'.'.substr($file->filemime, 6);
- } else
- {
- $error = TRUE;
- drupal_set_message(t('Uploaded file "'.$file->filename.'" is not a correct image file!'), 'error');
- }
- }
- if ($newfilename == '') $newfilename = $value['image_oldpath'];
- $res = db_query("DELETE FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='".$gid."'");
- $res = db_query("INSERT INTO {og_teampage_members} SET weight='".$value['weight']."', uid='".$uid."', gid='".$gid."', hidden='".$value['hidden']."', name='".$value['name']."', description='".$value['description']."', picture1='".$newfilename."'");
- }
- }
- $res = db_query("DELETE FROM {cache} WHERE 1 = 1");
- if (!$error) drupal_set_message(t('Saved your changes to group ').$gid.'.');
+ $gid = $form_values['gid'];
+ foreach ($form_values as $uid => $value) {
+ if (isset($value['description'])&& is_array($value)) {
+ if ($value['image_delete'] == 1)
+ {
+ $value['image_oldpath'] = '';
+ }
+ $newfilename = '';
+ $file = file_check_upload('image_upload'.$uid);
+ if ($file) {
+ if (substr($file->filemime, 0, 6) == 'image/') {
+ file_save_upload('image_upload'.$uid, variable_get('og_teampage_image_default_path', 'images') .'/teampage_overview_'.$gid.'_'.$uid.'.'.substr($file->filemime, 6),FILE_EXISTS_REPLACE);
+ $newfilename = variable_get('og_teampage_image_default_path', 'images') .'/teampage_overview_'.$gid.'_'.$uid.'.'.substr($file->filemime, 6);
+ } else
+ {
+ $error = TRUE;
+ drupal_set_message(t('Uploaded file "'.$file->filename.'" is not a correct image file!'), 'error');
+ }
+ }
+ if ($newfilename == '') $newfilename = $value['image_oldpath'];
+ $res = db_query("DELETE FROM {og_teampage_members} WHERE uid='".$uid."' AND gid='".$gid."'");
+ $res = db_query("INSERT INTO {og_teampage_members} SET weight='".$value['weight']."', uid='".$uid."', gid='".$gid."', hidden='".$value['hidden']."', name='".$value['name']."', description='".$value['description']."', picture1='".$newfilename."'");
+ }
+ }
+ $res = db_query("DELETE FROM {cache} WHERE 1 = 1");
+ if (!$error) drupal_set_message(t('Saved your changes to group ').$gid.'.');
}
Index: og_teampage.info
===================================================================
RCS file: og_teampage.info
diff -N og_teampage.info
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ og_teampage.info 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,5 @@
+name = OG Teampage
+description = "Provides a table view with all members (subscribers) of an organic group"
+package = "Organic groups"
+dependencies = og
+version = "$Name$"