Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<? require_once "../connect2.php"; ?>
<html>
<head>
<title>Kategorie ausw&auml;hlen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
input {  font-family: Arial, Helvetica, sans-serif; width=100%}
-->
</style>
</head>
<script language=Javascript>
function set(elem)
{
        with(elem.previousSibling)
        {
                v=value;
                t=options[selectedIndex].text;
        }

        source=window.name;
        eval("opener.eBay."+source+".value=v;");
        eval("opener.eBay._"+source+".value=t;");
        window.close();
}

function preset(elem)
{
        document.location.href='<?=$self;?>?ID='+elem.options.value
}
</script>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form>
<?
        function show_path($ID)
        {
                $query="select * from eBay.Categories where CategoryId = $ID order by CategoryName";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
                $Category=mysql_fetch_assoc($result);

                $buffer=array();
                $buffer[]=$Category;

                if ($Category[CategoryParentId] != $ID)
                {
                        $buffer=array_merge($buffer,show_path($Category[CategoryParentId]));
                }
                return $buffer;
        }

        if ($ID) 
        {
                $cats=array_reverse(show_path($ID));
                if ($cats[count($cats)-1][LeafCategory] == 0) {$cats[][CategoryParentId]=$ID;}
        }
        else
                {$cats=array(array(CategoryLevel=>1));}
        
        foreach($cats as $cat)
        {
                ?><select size=20 onClick="preset(this)"><?
                        if ($cat[CategoryLevel] == 1)
                                {$cond="CategoryId";}
                        else
                                {$cond=$cat[CategoryParentId];}

                        $query="
                                select * from eBay.Categories
                                where
                                        CategoryParentId = $cond
                                order by
                                        CategoryName
                                ";
                        $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
                        while($Category=mysql_fetch_assoc($result))
                        {
                                ?><option value=<?=$Category[CategoryId];?><? if ($cat[CategoryId] == $Category[CategoryId]) {echo " selected";} ?>><?=$Category[CategoryName];?></option><?
                        }
                ?></select><?
        }
        if ($cats[count($cats)-1][LeafCategory] == 1)
        {
                ?><input type="button" value="OK" onClick="set(this)"><?
        }
?>
</form>
</body>
</html>