mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Option to filter navigation links in admin area by 'owner' ie. the plugin who installed it.
This commit is contained in:
@@ -84,7 +84,7 @@ class links_admin_ui extends e_admin_ui
|
|||||||
'link_order' => array('title'=> LAN_ORDER, 'type' => 'number', 'width' => 'auto', 'nolist'=>false, 'inline' => true),
|
'link_order' => array('title'=> LAN_ORDER, 'type' => 'number', 'width' => 'auto', 'nolist'=>false, 'inline' => true),
|
||||||
'link_open' => array('title'=> LCLAN_19, 'type' => 'dropdown', 'inline'=>true, 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first', 'writeParms'=>array('size'=>'xlarge')),
|
'link_open' => array('title'=> LCLAN_19, 'type' => 'dropdown', 'inline'=>true, 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first', 'writeParms'=>array('size'=>'xlarge')),
|
||||||
'link_function' => array('title'=> LCLAN_105, 'type' => 'method', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left first'),
|
'link_function' => array('title'=> LCLAN_105, 'type' => 'method', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left first'),
|
||||||
'link_owner' => array('title'=> LCLAN_106, 'type' => 'hidden', 'data'=>'str'),
|
'link_owner' => array('title'=> LCLAN_106, 'type' => 'hidden', 'filter'=>true, 'data'=>'str'),
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center','readParms'=>'sort=1') // quick workaround
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center','readParms'=>'sort=1') // quick workaround
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -181,9 +181,16 @@ class links_admin_ui extends e_admin_ui
|
|||||||
$this->getTreeModel()->current_id = intval($searchFilter[1]);
|
$this->getTreeModel()->current_id = intval($searchFilter[1]);
|
||||||
$this->current_parent = intval($searchFilter[1]);
|
$this->current_parent = intval($searchFilter[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->fields['link_owner']['type'] = 'method';
|
||||||
|
|
||||||
parent::ListObserver();
|
parent::ListObserver();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function ListAjaxObserver()
|
public function ListAjaxObserver()
|
||||||
{
|
{
|
||||||
$searchFilter = $this->_parseFilterRequest($this->getRequest()->getQuery('filter_options', ''));
|
$searchFilter = $this->_parseFilterRequest($this->getRequest()->getQuery('filter_options', ''));
|
||||||
@@ -595,6 +602,8 @@ class links_admin_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
private $linkFunctions;
|
private $linkFunctions;
|
||||||
|
|
||||||
|
private $link_owner = array();
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -642,8 +651,21 @@ class links_admin_form_ui extends e_admin_form_ui
|
|||||||
$this->linkFunctions[$cat][$newkey] = str_replace('sc_','',$func);
|
$this->linkFunctions[$cat][$newkey] = str_replace('sc_','',$func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($tmp = e107::getDb()->retrieve('links', 'link_owner', "GROUP BY link_owner ORDER BY link_owner", true))
|
||||||
|
{
|
||||||
|
foreach($tmp as $arr)
|
||||||
|
{
|
||||||
|
if(empty($arr['link_owner']))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// var_dump($methods );
|
$plug = $arr['link_owner'];
|
||||||
|
// $def = 'LAN_PLUGIN_'.strtoupper($plug).'_NAME';
|
||||||
|
|
||||||
|
$this->link_owner[$plug] = $plug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -726,6 +748,21 @@ class links_admin_form_ui extends e_admin_form_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function link_owner($curVal,$mode)
|
||||||
|
{
|
||||||
|
if($mode == 'read')
|
||||||
|
{
|
||||||
|
return $curVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($mode === 'filter')
|
||||||
|
{
|
||||||
|
return $this->link_owner;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function link_sefurl($curVal,$mode)
|
function link_sefurl($curVal,$mode)
|
||||||
{
|
{
|
||||||
if($mode == 'read')
|
if($mode == 'read')
|
||||||
|
@@ -2266,7 +2266,10 @@ class e107plugin
|
|||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$link_t = $sql->count('links');
|
$link_t = $sql->count('links');
|
||||||
if (!$sql->count('links', '(*)', "WHERE link_url = '{$path}' OR link_name = '{$link_name}'"))
|
|
||||||
|
$countQry = !empty($options['link_owner']) ? "link_owner = '".$options['link_owner']."' AND link_url = '".$path."'" : "link_url = '{$path}' OR link_name = '".$link_name."'";
|
||||||
|
|
||||||
|
if (!$sql->count('links', '(*)', "WHERE ".$countQry))
|
||||||
{
|
{
|
||||||
$linkData = array(
|
$linkData = array(
|
||||||
'link_name' => $link_name,
|
'link_name' => $link_name,
|
||||||
@@ -2286,6 +2289,7 @@ class e107plugin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
e107::getMessage()->addDebug("Skipped inserting of sitelink. Count Qry: ".$countQry);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3494,6 +3498,7 @@ class e107plugin
|
|||||||
*/
|
*/
|
||||||
function XmlSiteLinks($function, $plug_vars)
|
function XmlSiteLinks($function, $plug_vars)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->log("Running ".__FUNCTION__);
|
$this->log("Running ".__FUNCTION__);
|
||||||
|
|
||||||
$status = false;
|
$status = false;
|
||||||
@@ -3505,6 +3510,8 @@ class e107plugin
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($function == 'refresh')
|
if($function == 'refresh')
|
||||||
{
|
{
|
||||||
$mes->addDebug("Checking Plugin Site-links");
|
$mes->addDebug("Checking Plugin Site-links");
|
||||||
@@ -3512,7 +3519,9 @@ class e107plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$array = $plug_vars['siteLinks'];
|
$array = $plug_vars['siteLinks'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($array['link'] as $link)
|
foreach ($array['link'] as $link)
|
||||||
{
|
{
|
||||||
@@ -4251,7 +4260,7 @@ class e107plugin
|
|||||||
|
|
||||||
$plug = e107plugin::getPluginRecord($dir);
|
$plug = e107plugin::getPluginRecord($dir);
|
||||||
|
|
||||||
$this->options = array('nolinks'=>true);
|
// $this->options = array('nolinks'=>true);
|
||||||
|
|
||||||
if(!is_array($plug))
|
if(!is_array($plug))
|
||||||
{
|
{
|
||||||
|
@@ -1632,7 +1632,7 @@ form#simplesef h4 { margin: 4px }
|
|||||||
.admin-icon-debug i { margin-right:5px; cursor:help}
|
.admin-icon-debug i { margin-right:5px; cursor:help}
|
||||||
|
|
||||||
.admin-icon-debug > li.dropdown > a.dropdown-toggle { border-left: 0 !important }
|
.admin-icon-debug > li.dropdown > a.dropdown-toggle { border-left: 0 !important }
|
||||||
.admin-icon-debug .dropdown-menu > .active > a { font-weight:500 }
|
.admin-icon-debug .dropdown-menu > .active > a { color: orange }
|
||||||
.admin-icon-debug .dropdown-menu > .active > a:after { font-family: FontAwesome; content: '\f0d9'; position: absolute;
|
.admin-icon-debug .dropdown-menu > .active > a:after { font-family: FontAwesome; content: '\f0d9'; position: absolute;
|
||||||
padding-left: 5px; }
|
padding-left: 5px; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user