<?
header("Pragma: no-cache");

$list = new iconlist($_GET['tabid']);




$rs = $db->query("SELECT * from ".$settings->config['groups_tablename']."");


while (!$rs->EOF) {

$us = $db->query("SELECT ".$settings->config['interauth_tablename'].".username FROM ".$settings->config['users_tablename'].",".$settings->config['interauth_tablename'].",".$settings->config['auth_tablename']." WHERE ".$settings->config['users_tablename'].".gid='".$rs->fields['id']."' AND ".$settings->config['interauth_tablename'].".username=".$settings->config['auth_tablename'].".username AND ".$settings->config['interauth_tablename'].".id=".$settings->config['users_tablename'].".id");
$usernames = "";
while (!$us->EOF) {
	$usernames[] = $us->fields["username"];
	$us->MoveNext();
}
if (is_array($usernames)) {
	if (sizeof($usernames) == 1) {
		$listViewDetails = $lang->get("One user (%1)", array($str->previewArray($usernames, 3)));
	} else {
		$listViewDetails = 
$lang->get("%1 users (%2)", array(sizeof($usernames), $str->previewArray($usernames, 3)));
	}
} else {
$listViewDetails = $lang->get("Group empty");
}


		$fullPath = gluePath($permissions['path'], $rs->fields['path']);
		$shareInfo = $share->getInfoByFid($rs->fields['id']);
		$tmp = "";
		while (!$shareInfo->EOF) {
			if (strlen($tmp) > 0) {
				$tmp .= ", ";
			}
			$tmp .= $auth->id2username($shareInfo->fields['to_uid']);
			$shareInfo->MoveNext();
		}
			$data['name'] = $rs->fields['name'];
			$data['lcname'] = strtolower($data['name']);
			$data['mdate'] = "";
			$data['isdir'] = true;
			$data['size'] = "";
			$data['ext'] = "";
			$data['filetypedescription'] = $listViewDetails;
			$data['icon_img'] = "images/tree/groups.gif";
			$data['thumb_img'] = "images/tree/groups.gif";
			$data['list_img'] = "images/tree/groups.gif";
			$data['filetype'] = "folder";
			$data['ondblclick'] = "openAdmUsers('".$rs->fields['id']."', '".$rs->fields['name']."')";
			$data['input_value'] = $rs->fields['id'];
			$data['extra'] = "";
			
			$list->setIcon($data);
			
			$rs->MoveNext();
}


?>
<script>
tb = parent.AfianHandler['allTabs']['<?echo $_GET['tabid'];?>']
if(tb != undefined){
tb.removeAll();
}


<?

for ($i = 0 ; $i < sizeof($list->icons) ; $i++) {
	$list->drawIcon($list->icons[$i]);
}

?>


if(tb != undefined){
parent.cancelTimeOut(tb.id);
tb.sortItems('name', 'desc');
tb.buildItems();
tb.countSelected = 0;
tb.onselect();
if (tb.active) {
	tb.showItems();
	parent.toggleTreeByPath('admin_groups@afian');
}
	tb.hideHourGlass();
tb.browsed = true;
tb.onload();
}

</script>