mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Theme shortcodes may now be used as content for sitelink functions. eg. To generate drop-down mega-menus.
This commit is contained in:
parent
5a5f92392c
commit
be44bc8f09
@ -73,16 +73,16 @@ class links_admin_ui extends e_admin_ui
|
||||
'checkboxes' => array('title'=> '', 'width' => '3%', 'forced' => true, 'thclass'=>'center first', 'class'=>'center first'),
|
||||
'link_button' => array('title'=> LAN_ICON, 'type'=>'icon', 'width'=>'5%', 'thclass'=>'center', 'class'=>'center', 'readParms'=>array('legacy'=>'{e_IMAGE}icons/'), 'writeParms'=>'glyphs=1'),
|
||||
'link_id' => array('title'=> LAN_ID, 'type'=>'method', 'readParms'=>'', 'noedit'=>TRUE),
|
||||
'link_name' => array('title'=> LAN_NAME, 'type'=>'text', 'inline'=>true, 'required'=>false, 'validate'=>false, 'width'=>'auto'), // not required as only an icon may be used.
|
||||
'link_category' => array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'inline'=>true, 'batch'=>true, 'filter'=>true, 'width'=>'auto'),
|
||||
'link_name' => array('title'=> LAN_NAME, 'type'=>'text', 'inline'=>true, 'required'=>false, 'validate'=>false, 'width'=>'auto', 'writeParms'=>array('size'=>'xlarge')), // not required as only an icon may be used.
|
||||
'link_category' => array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'inline'=>true, 'batch'=>true, 'filter'=>true, 'width'=>'auto', 'writeParms'=>array('size'=>'xlarge')),
|
||||
|
||||
'link_parent' => array('title'=> LAN_PARENT, 'type' => 'method', 'data'=>'int', 'width'=>'auto', 'batch'=>true, 'filter'=>true, 'thclass'=>'left first'),
|
||||
'link_parent' => array('title'=> LAN_PARENT, 'type' => 'method', 'data'=>'int', 'width'=>'auto', 'batch'=>true, 'filter'=>true, 'thclass'=>'left first', 'writeParms'=>array('size'=>'xlarge')),
|
||||
'link_url' => array('title'=> LAN_URL, 'width'=>'auto', 'type'=>'method', 'inline'=>true, 'required'=>true,'validate' => true, 'writeParms'=>'size=xxlarge'),
|
||||
'link_sefurl' => array('title'=> LAN_SEFURL, 'type' => 'method', 'inline'=>false, 'width' => 'auto', 'help'=>LCLAN_107),
|
||||
'link_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass','inline'=>true, 'writeParms' => 'classlist=public,guest,nobody,member,classes,admin,main', 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
|
||||
'link_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto'), // 'method'=>'tinymce_plugins', ?
|
||||
'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'),
|
||||
'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_owner' => array('title'=> LCLAN_106, 'type' => 'hidden', 'data'=>'str'),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center','readParms'=>'sort=1') // quick workaround
|
||||
@ -117,7 +117,7 @@ class links_admin_ui extends e_admin_ui
|
||||
|
||||
function init()
|
||||
{
|
||||
$this->fields['link_category']['writeParms'] = array(
|
||||
$this->fields['link_category']['writeParms']['optArray'] = array(
|
||||
1 => "1 - Main",
|
||||
2 => "2 - Sidebar",
|
||||
3 => "3 - Footer",
|
||||
@ -131,7 +131,8 @@ class links_admin_ui extends e_admin_ui
|
||||
255 => "(Unassigned)",
|
||||
);
|
||||
|
||||
$this->fields['link_open']['writeParms'] = array(
|
||||
|
||||
$this->fields['link_open']['writeParms']['optArray'] = array(
|
||||
0 => LCLAN_20, // 0 = same window
|
||||
1 => LCLAN_23, // new window
|
||||
4 => LCLAN_24, // 4 = miniwindow 600x400
|
||||
@ -616,6 +617,37 @@ class links_admin_form_ui extends e_admin_form_ui
|
||||
}
|
||||
$this->linkFunctions[$cat] = $func;
|
||||
}
|
||||
|
||||
$sitetheme = e107::getPref('sitetheme');
|
||||
|
||||
if(!file_exists(e_THEME.$sitetheme.'/theme_shortcodes.php'))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
require_once(e_THEME.$sitetheme.'/theme_shortcodes.php');
|
||||
$methods = get_class_methods('theme_shortcodes');
|
||||
|
||||
asort($methods);
|
||||
|
||||
$cat = defset('LINKLAN_10',"Theme Shortcodes");
|
||||
|
||||
foreach($methods as $func)
|
||||
{
|
||||
if(strpos($func,'sc_') !== 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$newkey = 'theme::'.$func;
|
||||
|
||||
$this->linkFunctions[$cat][$newkey] = str_replace('sc_','',$func);
|
||||
}
|
||||
|
||||
|
||||
// var_dump($methods );
|
||||
|
||||
|
||||
}
|
||||
|
||||
function link_parent($value, $mode)
|
||||
@ -647,7 +679,7 @@ class links_admin_form_ui extends e_admin_form_ui
|
||||
$cats = $this->getController()->getLinkArray($catid);
|
||||
$ret = array();
|
||||
$this->_parent_select_array(0, $cats, $ret);
|
||||
return $this->selectbox('link_parent', $ret, $value, array('default' => LAN_SELECT));
|
||||
return $this->selectbox('link_parent', $ret, $value, array('size'=>'xlarge','default' => LAN_SELECT));
|
||||
break;
|
||||
|
||||
case 'batch':
|
||||
@ -670,7 +702,7 @@ class links_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
if($mode == 'write')
|
||||
{
|
||||
return $this->selectbox('link_function',$this->linkFunctions,$curVal,array('default'=> "(".LAN_OPTIONAL.")"));
|
||||
return $this->selectbox('link_function',$this->linkFunctions,$curVal,array('size'=>'xlarge','default'=> "(".LAN_OPTIONAL.")"));
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -1688,25 +1688,33 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
|
||||
return $row['link_sub'];
|
||||
}
|
||||
|
||||
if(vartrue($row['link_function']))
|
||||
if(!empty($row['link_function']))
|
||||
{
|
||||
$parm = false;
|
||||
|
||||
list($path,$method) = explode("::",$row['link_function']);
|
||||
|
||||
if($path === 'theme')
|
||||
{
|
||||
$text = e107::callMethod('theme_shortcodes',$method, $row); // no parms as theme_shortcodes may be added as needed.
|
||||
|
||||
if(!empty($text))
|
||||
{
|
||||
return '<div class="dropdown-menu">'.$text.'</div>'; // @todo use template?
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($method,"("))
|
||||
{
|
||||
list($method,$prm) = explode("(",$method);
|
||||
$parm = rtrim($prm,")");
|
||||
}
|
||||
|
||||
|
||||
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
||||
{
|
||||
$class = $path."_sitelink";
|
||||
if($sublinkArray = e107::callMethod($class,$method,$parm,$row)) //TODO Cache it.
|
||||
{
|
||||
|
||||
|
||||
return $sublinkArray;
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ define("LINKLAN_6", "Create sublinks from");
|
||||
define("LINKLAN_7", "Create sublinks under which link?");
|
||||
define("LINKLAN_8", "News Categories");
|
||||
define("LINKLAN_9", "Download Categories");
|
||||
|
||||
define("LINKLAN_10", "Theme Shortcodes");
|
||||
_
|
||||
// define("LINKLAN_10", "Create Sublink");
|
||||
// define('LINKLAN_11', 'Nothing changed - not updated');
|
||||
|
||||
|
@ -41,42 +41,12 @@ class news_sitelink // include plugin-folder in the name.
|
||||
'description' => ""
|
||||
);
|
||||
|
||||
$links[] = array(
|
||||
'name' => "Last 10 News Items (News Grid)",
|
||||
'function' => "last_ten_newsgrid",
|
||||
'description' => ""
|
||||
);
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
||||
function last_ten_newsgrid()
|
||||
{
|
||||
|
||||
$text = '<div class="dropdown-menu mega-dropdown-menu">
|
||||
<div class="container">';
|
||||
|
||||
$parm = array();
|
||||
$parm['limit'] = 9;
|
||||
$parm['category'] = 0;
|
||||
$parm['source'] = 'latest';
|
||||
$parm['featured'] = 1;
|
||||
$parm['layout'] = 'sitelink-last-ten';
|
||||
|
||||
$mega = e107::getObject('news')->render_newsgrid($parm);
|
||||
|
||||
// e107::getDebug()->log($mega);
|
||||
|
||||
$text .= $mega;
|
||||
|
||||
$text .= '
|
||||
</div>
|
||||
</div> ';
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
function news_category_page()
|
||||
{
|
||||
|
@ -108,8 +108,6 @@
|
||||
$NEWS_GRID_TEMPLATE['media-list']['end'] = '</div>';
|
||||
|
||||
|
||||
// @see sitelink function "Last 10 News Items (News Grid)"
|
||||
$NEWS_GRID_TEMPLATE['sitelink-last-ten'] = $NEWS_GRID_TEMPLATE['media-list'];
|
||||
|
||||
|
||||
|
||||
|
@ -347,9 +347,3 @@ div.login-page-signup-link, div.login-page-fpw-link { text-align:center }
|
||||
.nav-side li.list-group-item.active { padding:0}
|
||||
|
||||
|
||||
.news-last-ten-newsgrid { position: static !important; }
|
||||
|
||||
.mega-dropdown-menu {
|
||||
padding: 20px 15px 15px;
|
||||
width: 100%;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user