Only show the 'add entry' link if the class has enabled it. The link is only useful for classes

that have no parent objects. The objectShowAddEntry() method is not required because it only
affects the user interface.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-09-08 22:42:34 +00:00
committed by WineHQ
parent 5a4cbf49a3
commit 4d65a32e17
4 changed files with 26 additions and 3 deletions

View File

@@ -1068,6 +1068,11 @@ class Application {
{ {
return $this->iAppId; return $this->iAppId;
} }
function objectShowAddEntry()
{
return TRUE;
}
} }
function get_vendor_from_keywords($sKeywords) function get_vendor_from_keywords($sKeywords)

View File

@@ -669,6 +669,11 @@ class distribution {
{ {
return FALSE; return FALSE;
} }
function objectShowAddEntry()
{
return TRUE;
}
} }
?> ?>

View File

@@ -130,8 +130,14 @@ class ObjectManager
break; break;
} }
echo "<br /><center><a href=\"".$this->makeUrl("add", false, if(method_exists($oObject, "objectShowAddEntry") &&
"Add $this->sClass entry")."\">Add an entry?</a></center>"; $oObject->objectShowAddEntry())
{
echo "<br /><center><a href=\"".
$this->makeUrl("add", false,
"Add $this->sClass entry").
"\">Add an entry?</a></center>";
}
return; return;
} }
@@ -187,7 +193,9 @@ class ObjectManager
echo "</table>"; echo "</table>";
$oObject = new $this->sClass(); $oObject = new $this->sClass();
if($oObject->canEdit()) if($oObject->canEdit() &&
method_exists($oObject, "objectShowAddEntry") &&
$oObject->objectShowAddEntry())
{ {
echo "<br /><br /><a href=\"".$this->makeUrl("add", false, echo "<br /><br /><a href=\"".$this->makeUrl("add", false,
"Add $this->sClass")."\">Add entry</a>\n"; "Add $this->sClass")."\">Add entry</a>\n";

View File

@@ -395,6 +395,11 @@ class Vendor {
$iDefaultPerPage = 25; $iDefaultPerPage = 25;
return array($aItemsPerPage, $iDefaultPerPage); return array($aItemsPerPage, $iDefaultPerPage);
} }
function objectShowAddEntry()
{
return TRUE;
}
} }
?> ?>