check if assigned attribute was inherited

in that case do not allow to delete it
This commit is contained in:
Uwe Steinmann 2016-08-02 10:38:44 +02:00
parent 01999ec3a7
commit 8ede764db0

View File

@ -70,7 +70,8 @@ $(document).ready(function() {
$allGroups = $this->params['allattrgrps'];
$strictformcheck = $this->params['strictformcheck'];
$attrgrpList = $folder->getAttributeDefintionGroupList();
$ifolder = null; // will be set to folder the current folder inherits a attr def group
$attrgrpList = $folder->getAttributeDefintionGroupList(true, $ifolder);
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
@ -88,23 +89,33 @@ $(document).ready(function() {
}
else {
foreach ($attrgrpList as $attrgrp) {
print "<tr>";
print "<td><i class=\"icon-tags\"></i></td>";
print "<td>" . htmlspecialchars($attrgrp['group']->getName()) . "</td>";
if ($user->isAdmin()) {
print "<form action=\"../op/op.FolderAttributeGroup.php\" method=\"post\">\n";
echo createHiddenFieldWithKey('folderattributegroup')."\n";
print "<input type=\"Hidden\" name=\"folderid\" value=\"".$folder->getID()."\">\n";
print "<input type=\"Hidden\" name=\"action\" value=\"delattributegroup\">\n";
print "<input type=\"Hidden\" name=\"groupid\" value=\"".$attrgrp['group']->getID()."\">\n";
print "<td>";
print "<button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button>";
print "</td>";
print "</form>\n";
}else print "<td></td>";
print "</tr>";
$attrgrpIDs[] = $attrgrp['group']->getID();
if($ifolder->getID() == $folder->getID()) {
foreach ($attrgrpList as $attrgrp) {
print "<tr>";
print "<td><i class=\"icon-tags\"></i></td>";
print "<td>" . htmlspecialchars($attrgrp['group']->getName()) . "</td>";
if ($user->isAdmin()) {
print "<form action=\"../op/op.FolderAttributeGroup.php\" method=\"post\">\n";
echo createHiddenFieldWithKey('folderattributegroup')."\n";
print "<input type=\"Hidden\" name=\"folderid\" value=\"".$folder->getID()."\">\n";
print "<input type=\"Hidden\" name=\"action\" value=\"delattributegroup\">\n";
print "<input type=\"Hidden\" name=\"groupid\" value=\"".$attrgrp['group']->getID()."\">\n";
print "<td>";
print "<button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button>";
print "</td>";
print "</form>\n";
}else print "<td></td>";
print "</tr>";
$attrgrpIDs[] = $attrgrp['group']->getID();
}
} else {
foreach ($attrgrpList as $attrgrp) {
print "<tr>";
print "<td><i class=\"icon-tags\"></i></td>";
print "<td>" . htmlspecialchars($attrgrp['group']->getName()) . "</td>";
print "<td><i class=\"icon-folder-close\"></i> <a href=\"../out/out.ViewFolder.php?folderid=".$ifolder->getID()."\">" . htmlspecialchars($ifolder->getName()) . "</a></td>";
print "</tr>";
}
}
}
print "</table>\n";