Improve 'move to another parent' texts

This commit is contained in:
Alexander Nicolaysen Sørnes
2009-04-30 23:14:55 +02:00
committed by Alexander Nicolaysen Sørnes
parent d817ffa77a
commit 0dc6d47958
4 changed files with 32 additions and 6 deletions

View File

@@ -939,6 +939,11 @@ class Application {
return $oTable->GetString();
}
public function objectGetClassDisplayName()
{
return 'application';
}
public function objectMakeUrl()
{
$sUrl = APPDB_ROOT."objectManager.php?sClass=application&iId=$this->iAppId";

View File

@@ -912,8 +912,13 @@ class ObjectManager
return FALSE;
}
$oParent = $oObject->objectGetParent();
$oParentOM = new objectManager(get_class($oParent), '', $oParent->objectGetId());
$sClassDisplayName = $oParentOM->GetOptionalSetting('objectGetClassDisplayName', 'parent entry');
/* Display some help text */
echo "<p>Move ".$oObject->objectMakeLink()." to the parent entry ";
echo "<p>Move ".$oObject->objectMakeLink()." to the $sClassDisplayName ";
echo "selected below:</p>\n";
echo "<table width=\"50%\" cellpadding=\"3\">\n";
@@ -922,16 +927,12 @@ class ObjectManager
"Move here"),
"color4");
$oParent = $oObject->objectGetParent();
if(method_exists($oParent, 'objectGetParent'))
{
$oGrandFather = $oParent->objectGetParent();
$oParentOM = new objectManager(get_class($oParent), '', $oParent->objectGetId());
} else
{
$oGrandFather = null;
$oParentOM = null;
}
if($oGrandFather && $oParentOM->GetOptionalSetting('objectRestrictMoveObjectListsToParents', false))
@@ -1149,13 +1150,23 @@ class ObjectManager
exit;
}
private function displayChangeParent($oObject, $sLinkText = 'Move to another parent entry')
private function displayChangeParent($oObject, $sLinkText = 'default')
{
/* Display a link to the move child objects page if the class has the necessary
functions and the user has edit rights. Not all classes have child objects. */
if(method_exists($oObject, "objectSetParent") &&
method_exists($oObject, "objectGetId") && $oObject->canEdit())
{
if($sLinkText == 'default')
{
$oParent = $oObject->objectGetParent();
$oParentOM = new objectManager(get_class($oParent), '', $oParent->objectGetId());
$sClassName = $oParentOM->getOptionalSetting('objectGetClassDisplayName', false);
if($sClassName)
$sLinkText = "Move to another $sClassName";
else
$sLinkText = 'Move to another parent entry';
}
echo "<a href=\"".$this->makeUrl("showChangeParent", $this->iId,
"Move to another parent entry")."\">$sLinkText</a>\n";
}

View File

@@ -398,6 +398,11 @@ class Vendor {
}
}
public function objectGetClassDisplayName()
{
return 'developer';
}
/* Make a URL for viewing the specified vendor */
function objectMakeUrl()
{

View File

@@ -1447,6 +1447,11 @@ class version {
return FALSE;
}
public function objectGetClassDisplayName()
{
return 'version';
}
public function objectMakeUrl()
{
return APPDB_ROOT."objectManager.php?sClass=version&amp;iId=$this->iVersionId";