blob: 3973dad730f9aacd5647182aca56e3eb53b5ff46 [file]
<?php
/*******************************************************************************
* Copyright (c) 2006 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nathan Gervais (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
#*****************************************************************************
#
# member_management.php
#
# Author: Nathan Gervais
# Date: Feb 6th, 2007
#
# Description:
# Management page for members, displays a list of members, allows for adds, edits , removals.
#****************************************************************************
include('scripts/common.php');
include('scripts/header.php');
if ($_POST['submit'])
{
$id = $_POST['orgName'];
$companyURL = $_POST['companyURL'];
$shortDesc = $_POST['shortDesc'];
$longDesc = $_POST['longDesc'];
if (is_uploaded_file($_FILES['smallLogo']['tmp_name']))
{
if ($_FILES['smallLogo']['size'] < 100000)
{
$smallImgData = addslashes (file_get_contents($_FILES['smallLogo']['tmp_name']));
$smallSize = getimagesize($_FILES['smallLogo']['tmp_name']);
$smallMime = $smallSize['mime'];
}
}
if (is_uploaded_file($_FILES['largeLogo']['tmp_name']))
{
if ($_FILES['largeLogo']['size'] < 100000)
{
$largeImgData = addslashes (file_get_contents($_FILES['largeLogo']['tmp_name']));
$largeSize = getimagesize($_FILES['largeLogo']['tmp_name']);
$largeMime = $largeSize['mime'];
}
}
$query = "INSERT INTO OrganizationInformation VALUES ($id, '$shortDesc' ,'$longDesc', '$companyURL', '$smallMime', '$smallImgData', '$largeMime', '$largeImgData')";
mysql_query($query) or die(mysql_error());
//echo $query;
echo "Organization added successfully!<br/>";
echo "<a href=\"edit_member_tags.php?id=" . $id . "\">Edit Tags</a> for this new member";
}
?>
<h2>Member Management</h2>
<table style="border:1px solid #000;" cellspacing=0 cellpadding=1>
<tr class="header">
<td width="125">Organization ID</td>
<td width="175">Organization Name</td>
<td width="175">Membership Type</td>
<td width="175">Tags</td>
<td width="75">Products</td>
<td width="75">Edit</td>
<td width="75">Edit Tags</td>
<td width="75">Remove</td>
</tr>
<?
$query = "SELECT OI.OrganizationID, ORG.name1, ORG.member_type FROM OrganizationInformation as OI INNER JOIN organizations as ORG on OI.OrganizationID = ORG.organization_id WHERE ORG.member_type != '' ORDER BY ORG.name1";
$result = mysql_query($query);
while($orgIterator = mysql_fetch_array($result))
{
$id = $orgIterator['OrganizationID'];
$companyName = $orgIterator['name1'];
$memberType = $orgIterator['member_type'];
$productQuery = "SELECT count(*) from OrganizationProducts where OrganizationID = $id";
$productResult = mysql_query($productQuery);
$productIterator = mysql_fetch_array($productResult);
$numProducts = $productIterator[0];
$subQuery = "SELECT TAG.tag_name, TAGORG.TagID FROM OrganizationTags as TAGORG INNER JOIN TagNames as TAG on TAGORG.TagID = TAG.TagID WHERE TAGORG.OrganizationID = $id ORDER by TAG.tag_name";
$subResult = mysql_query($subQuery);
$tagList = "<select>";
while ($tagIterator = mysql_fetch_array($subResult))
{
$tagName = $tagIterator['tag_name'];
$tagList .= "<option>" . $tagName . "</option>";
}
$tagList .= "</select>";
?>
<tr onMouseOver="this.style.background='#CDE3FB';" onMouseOut="this.style.background='#FFFFFF';">
<td><?=$id;?></td>
<td><?=$companyName;?></td>
<td><?=memberType($memberType);?></td>
<td><?=$tagList;?></td>
<td><a href="product_management.php?id=<?=$id;?>"><?=$numProducts;?></a></td>
<td><a href="edit_member.php?id=<?=$id;?>">Edit</a></td>
<td><a href="edit_member_tags.php?id=<?=$id;?>">Edit Tags</a></td>
<td><a href="remove_member.php?id=<?=$id;?>">Remove</a></td>
</tr>
<?
}
?>
</table>
<br/>
<h3>Add a Member</h3>
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<table>
<tr>
<td>Organization Name:</td>
<td>
<select name="orgName">
<?
$query = "CREATE TEMPORARY TABLE orgTempTable SELECT ORG.organization_id, OI.OrganizationID, ORG.name1, ORG.member_type from organizations as ORG left join OrganizationInformation as OI on ORG.organization_id = OI.OrganizationID";
mysql_query($query) or die(mysql_error());
$query = "SELECT * from orgTempTable WHERE OrganizationID IS NULL and member_type != '' ORDER BY name1";
$result = mysql_query($query);
while ($orgIterator = mysql_fetch_array($result))
{
$id = $orgIterator['organization_id'];
$orgName = $orgIterator['name1'];
?><option value="<?=$id;?>"><?=$orgName;?></option>
<?
}
?>
</td>
</tr>
<tr>
<td>Company URL</td>
<td><input type="text" name="companyURL" size="80"/></td>
</tr>
<td>Short Description</td>
<td><textarea name="shortDesc" id="shortDesc" cols="60" rows="5" onkeyup="CheckFieldLength(shortDesc, 'myCounter', 180);" onkeydown="CheckFieldLength(shortDesc, 'myCounter', 180);" onmouseout="CheckFieldLength(shortDesc, 'myCounter', 180);" maxLength="180"></textarea>
<br/>You have <B><SPAN id=myCounter>180</SPAN></B> characters remaining for your short description...</font></td>
</tr>
<tr>
<td>Long Description</td>
<td><textarea name="longDesc" cols="60" rows="10"></textarea></td>
</tr>
<tr>
<td>Small Logo</td>
<td><input name="smallLogo" type="file"/></td>
</tr>
<tr>
<td>Large Logo</td>
<td><input name="largeLogo" type="file"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Add Member"></td>
</tr>
</table>
</form>
<?
include('scripts/footer.php');
?>