category: Make currently viewed category the default parent for new categories
This commit is contained in:
@@ -313,12 +313,28 @@ class Category {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputEditor()
|
function objectGetCustomVars($sAction)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case 'add':
|
||||||
|
return array('iParentId');
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function outputEditor($aValues = null)
|
||||||
{
|
{
|
||||||
$aCategories = category::getOrderedList(true);
|
$aCategories = category::getOrderedList(true);
|
||||||
$aCatNames = array();
|
$aCatNames = array();
|
||||||
$aCatIds = array();
|
$aCatIds = array();
|
||||||
|
|
||||||
|
$iParentId = $this->iParentId;
|
||||||
|
if(!$iParentId && $aValues)
|
||||||
|
$iParentId = getInput('iParentId', $aValues);
|
||||||
|
|
||||||
foreach($aCategories as $oCategory)
|
foreach($aCategories as $oCategory)
|
||||||
{
|
{
|
||||||
$aCatNames[] = $oCategory->sName;
|
$aCatNames[] = $oCategory->sName;
|
||||||
@@ -341,7 +357,7 @@ class Category {
|
|||||||
<tr>
|
<tr>
|
||||||
<td width=\"15%\" class=\"box-label\"><b>Parent</b></td>
|
<td width=\"15%\" class=\"box-label\"><b>Parent</b></td>
|
||||||
<td class=\"box-body\">
|
<td class=\"box-body\">
|
||||||
".html_select("iParentId",$aCatIds,$this->iParentId, $aCatNames)."
|
".html_select("iParentId",$aCatIds,$iParentId, $aCatNames)."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>";
|
</table>";
|
||||||
@@ -394,7 +410,7 @@ class Category {
|
|||||||
$oM = new objectManager('category', '', $this->iCatId);
|
$oM = new objectManager('category', '', $this->iCatId);
|
||||||
$oM->setReturnTo($this->objectMakeUrl());
|
$oM->setReturnTo($this->objectMakeUrl());
|
||||||
echo "<p>\n";
|
echo "<p>\n";
|
||||||
echo '<a href="'.$oM->makeUrl('add', null, 'Add Category').'">Add</a>';
|
echo '<a href="'.$oM->makeUrl('add', null, 'Add Category')."&iParentId={$this->iCatId}\">Add</a>";;
|
||||||
if($this->iCatId) // We can't edit the 'Main' category
|
if($this->iCatId) // We can't edit the 'Main' category
|
||||||
{
|
{
|
||||||
echo ' ';
|
echo ' ';
|
||||||
|
|||||||
Reference in New Issue
Block a user