Location: PHPKode > projects > BugIn and Ticketing System > bugin-0.65/inc/pre/add.pre.inc.php
<?php

// Frames target...
if (isset($_SESSION['userinfo']) && $_SESSION['userinfo']['options'] & OPTION_FRAMES) {
	$meta .= "<base target=\"view\">\n";
}

$projImg = "";
$catImg = "";

if (isset($_REQUEST['defaultProject']))
	$thisProj = intval($_REQUEST['defaultProject']);
else {
	if (intval($options['defaultAddProject']) == -1)
		$projImg = "<img src=\"gfx/error.gif\" />";
	$thisProj = intval($options['defaultAddProject']);
}


// Assemble the category list
buginError("Generating category list", 1);
if ($options['defaultAddCategory'] == -1)
	$catImg = "<img src=\"gfx/error.gif\" />";
$categories = generateOptionList($bugDatabase->lists['category'], "id", $options['defaultAddCategory']);

// Assemble the project list
buginError("Generating project list", 1);
while (list($key, $value) = each($bugDatabase->lists['project'])) {
	if (($value['acl'][0] & ACL_ADD) || (isset($_SESSION['userinfo']) && ($value['acl'][$_SESSION['userinfo']['uid']] & ACL_ADD)))
		$projs[$key] = $value;
}
$projects = generateOptionList($projs, "id", $thisProj, "optionName");
unset($projs);
unset($key);
unset($value);

// Assemble the priority list
buginError("Generating priority list", 1);
$priority = generateOptionList($bugDatabase->lists['priority'], "id", $options['defaultAddPriority']);	

// Assemble the user list
buginError("Generating user list", 1);
$users = generateOptionList($bugDatabase->lists['user'], "uid");	
	
// Assemble the owner (assigned to)
buginError("Generating Owner list", 1);
$owners = "<option value=0>{$verbage['unowned']}</option>\n";
	
switch ($options['defaultOwner']) {
	case "creator":
		$defaultOwner = $userinfo['uid'];
		break;
	case "unowned":
		$defaultOwner = 0;
		break;
	case "UID":
		$defaultOwner = $options['defaultUID'];
		break;
}

buginError("Default owner is $defaultOwner", 1);

// Go throught the user list
@reset($bugDatabase->lists[user]);
while (list($key, $value) = @each($bugDatabase->lists['user'])) {
	// Now we go through the users groups....
	while (list($blah, $group) = @each($userinfo['user_group'])) {
		// Is this group in this users group list?
		if (in_array($group, $value['user_group'])) {
			$name = htmlentities($value['name']);
			buginError("Added <b>{$name} (UID {$value['uid']} Group {$group})</b> to valid owners", 1);
			if ($value['uid'] == $defaultOwner) {
				$owners .= "\t\t\t\t<option value=\"{$value['uid']}\" SELECTED>{$name}</option>\n";
			}
			else {
				$owners .= "\t\t\t\t<option value=\"{$value['uid']}\">{$name}</option>\n";
			}

			// Have to @reset the array so we don't lose users.
			@reset($userinfo['user_group']);
			continue 2;
		}
	}
	buginError("Skipped <b>{$value['name']} (UID {$value['uid']} Group {$group})</b> to valid owners", 1);
	@reset($userinfo['user_group']);
}

$long_desc_rows = 10;

if (isset($owners)) {
	$owners = <<<EOT

		<td>
			<select name="mod[owner]">
$owners
			</select>
		</td>

EOT;
		$ownersTitle = <<<EOT
		<td bgcolor="{$options['colorTableBgAlt2']}"><b>{$verbage['owner']}</b></td>

EOT;
	$shortDescRowspan = "3";
}
else {
	$shortDescRowspan = "2";
}

// Assemble the "not logged in" row.
if (!isset($_SESSION['loggedin'])) {
	$uid = "";
	if (isset($_SESSION['email']))
		$email = $_SESSION['email'];
	else
		$email = "";
	$nliRow = <<<EOT
		<tr valign=top>
			<td colspan=3 align=left>
				E-Mail Address: <input type="text" name="email" size="32" value="$email">
			</td>
		</tr>

EOT;
}
else {
	$nliRow = "";
	$uid = $_SESSION['userinfo']['uid'];
}

?>
Return current item: BugIn and Ticketing System