73 lines
2.2 KiB
PHP
Executable file
73 lines
2.2 KiB
PHP
Executable file
<?php
|
|
|
|
$NewPartType = (isset($_POST['NewPartType']))? $_POST['NewPartType']:0;
|
|
|
|
function WritePackageList($ParentId, $ParentIsLocked)
|
|
{
|
|
global $GlobalMysqlHandler;
|
|
global $GlobalContent;
|
|
global $GlobalTemplate;
|
|
global $EditTypesEditId;
|
|
|
|
$ListQuery="SELECT * FROM `Packages` WHERE `ParentId` =$ParentId";
|
|
$ListQuery=mysqli_query($GlobalMysqlHandler, $ListQuery);
|
|
|
|
if (!$ParentId || NestedListVisibilityIsSet($ParentId, 'AddPartPackage'))
|
|
$GlobalContent .= "<ul style=\"display:block;\">\n";
|
|
else
|
|
$GlobalContent .= "<ul style=\"display:none;\">\n";
|
|
|
|
if (mysqli_num_rows($ListQuery))
|
|
{
|
|
while ($ListData=mysqli_fetch_array($ListQuery))
|
|
{
|
|
$GlobalContent .= " <li>\n";
|
|
if (LockIsActive('Types',$ListData['Id']) || $ParentIsLocked)
|
|
{
|
|
$GlobalContent .= OtherGetIcon('LockActive.png',0);
|
|
$ParentIsLocked = 1;
|
|
}
|
|
else
|
|
{
|
|
$GlobalContent .= ' <input type="radio" name="NewPartPackage" value="'.$ListData['Id'].'">';
|
|
}
|
|
$GlobalContent .= " <a href=\"index.php?Page=AddPart&AddNewPartSetp=SelectPackage&ToDo=OpenSublist&SublistId=".$ListData['Id']."\">".LangStr2Html($ListData['Name'])."</a>";
|
|
$GlobalContent .= " (".NestedListCountSubElements($ListData['Id'],'Packages').")";
|
|
$GlobalContent .= " \n</li>\n";
|
|
|
|
WritePackageList($ListData['Id'],$ParentIsLocked);
|
|
}
|
|
}
|
|
$GlobalContent .= "</ul>\n";
|
|
}
|
|
|
|
|
|
if (UserHasRight('EditParts'))
|
|
{
|
|
///////////////
|
|
// open sublist
|
|
if ($ToDo=="OpenSublist")
|
|
{
|
|
if (isset($_GET['SublistId']) && $_GET['SublistId'])
|
|
{
|
|
NestedListVisibilityToggle($_GET['SublistId'], 'AddPartPackage');
|
|
}
|
|
else
|
|
{
|
|
ErrorLog("[add_part1.php] No SublistId to open type!");
|
|
MessageError(LangSpell('SentenceUnknownError'));
|
|
}
|
|
$ToDo="";
|
|
}
|
|
|
|
$GlobalContent .= '<h1>'.LangSpellHtml('SentencePleaseSelectPackage').'</h1>';
|
|
$GlobalContent .= '<form action="index.php?Page=AddPart&AddNewPartSetp=SelectValues" method="post">';
|
|
WritePackageList(0, 0);
|
|
$GlobalContent .= '<input type="submit" value="'.LangSpellHtml('ButtonProceed').'"class="Button">';
|
|
$GlobalContent .= '</form>';
|
|
}
|
|
else
|
|
{
|
|
MessageError(LangSpell("ScentenceNoUserRights"));
|
|
}
|
|
?>
|