mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Start of front-end navigation template. Shortcode handler fix to prevent reloading of existing classes. Bootstrap front-end theme updated.
This commit is contained in:
7
e107_core/shortcodes/single/navigation.php
Normal file
7
e107_core/shortcodes/single/navigation.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function navigation_shortcode($parm='')
|
||||||
|
{
|
||||||
|
return e107::getNav()->frontend();
|
||||||
|
}
|
||||||
|
|
77
e107_core/templates/navigation_template.php
Normal file
77
e107_core/templates/navigation_template.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
|
||||||
|
*
|
||||||
|
* Gallery Template
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['START'] = '<ul class="nav nav-pills">';
|
||||||
|
|
||||||
|
// Main Link
|
||||||
|
$NAVIGATION_TEMPLATE['ITEM'] = '
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" role="button" href="{LINK_URL}" >
|
||||||
|
{LINK_NAME}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
// Main Link which has a sub menu.
|
||||||
|
$NAVIGATION_TEMPLATE['ITEM_SUBMENU'] = '
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" >
|
||||||
|
{LINK_NAME}
|
||||||
|
<b class="caret"></b>
|
||||||
|
</a>
|
||||||
|
{LINK_SUB}
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['ITEM_SUBMENU_ACTIVE'] = '
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}">
|
||||||
|
{LINK_IMAGE} {LINK_NAME}
|
||||||
|
<b class="caret"></b>
|
||||||
|
</a>
|
||||||
|
{LINK_SUB}
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['ITEM_ACTIVE'] = '
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}">
|
||||||
|
{LINK_IMAGE} {LINK_NAME}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['END'] = '</ul>';
|
||||||
|
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['SUBMENU_START'] = '
|
||||||
|
<ul class="dropdown-menu" role="menu" >
|
||||||
|
';
|
||||||
|
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['SUBMENU_ITEM'] = '
|
||||||
|
<li role="menuitem" >
|
||||||
|
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['SUBMENU_ITEM_ACTIVE'] = '
|
||||||
|
<li role="menuitem" class="active">
|
||||||
|
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_NAME}</a>
|
||||||
|
</li>
|
||||||
|
';
|
||||||
|
|
||||||
|
$NAVIGATION_TEMPLATE['SUBMENU_END'] = '</ul>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@@ -1744,10 +1744,20 @@ class e107
|
|||||||
public static function coreTemplatePath($id, $override = true)
|
public static function coreTemplatePath($id, $override = true)
|
||||||
{
|
{
|
||||||
$id = str_replace('..', '', $id); //simple security, '/' is allowed
|
$id = str_replace('..', '', $id); //simple security, '/' is allowed
|
||||||
$override_path = $override ? self::getThemeInfo($override, 'rel').'templates/'.$id.'_template.php' : null;
|
$override_path = $override ? self::getThemeInfo($override, 'rel').'templates/'.$id.'_template.php' : null;
|
||||||
$default_path = e_THEME.'templates/'.$id.'_template.php';
|
$legacy_path = e_THEME.'templates/'.$id.'_template.php';
|
||||||
|
$core_path = e_CORE.'templates/'.$id.'_template.php';
|
||||||
|
|
||||||
return ($override_path && is_readable($override_path) ? $override_path : $default_path);
|
if($override_path && is_readable($override_path))
|
||||||
|
{
|
||||||
|
return $override_path;
|
||||||
|
}
|
||||||
|
elseif(is_readable($legacy_path))
|
||||||
|
{
|
||||||
|
return $legacy_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $core_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -299,6 +299,13 @@ class e_parse_shortcode
|
|||||||
$path = $pathBC;
|
$path = $pathBC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If it already exists - don't include it again.
|
||||||
|
if (class_exists($className, false)) // don't allow __autoload()
|
||||||
|
{
|
||||||
|
$this->registerClassMethods($className, $path);
|
||||||
|
return $this->scClasses[$className];
|
||||||
|
}
|
||||||
|
|
||||||
if (is_readable($path))
|
if (is_readable($path))
|
||||||
{
|
{
|
||||||
require_once($path);
|
require_once($path);
|
||||||
|
@@ -1175,17 +1175,76 @@ class e_navigation
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a clean array structure for all links.
|
||||||
|
*/
|
||||||
|
function getData($cat=1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function frontend() //TODO equivalent for front-end sitelinks etc.
|
|
||||||
{
|
{
|
||||||
|
$sql = e107::getDb('sqlSiteLinks');
|
||||||
|
$ins = ($cat > 0) ? "link_category = ".intval($cat)." AND " : "";
|
||||||
|
$query = "SELECT * FROM #links WHERE ".$ins." link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
if($sql->db_Select_gen($query))
|
||||||
|
{
|
||||||
|
while ($row = $sql->db_Fetch())
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isset($row['link_parent']) && $row['link_parent'] != 0)
|
||||||
|
{
|
||||||
|
$id = $row['link_parent'];
|
||||||
|
$ret[$id]['link_sub'][] = $row;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$id = $row['link_id'];
|
||||||
|
$ret[$id] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vartrue($row['link_function']))
|
||||||
|
{
|
||||||
|
list($path,$method) = explode("::",$row['link_function']);
|
||||||
|
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
||||||
|
{
|
||||||
|
$class = $path."_sitelinks";
|
||||||
|
$sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
|
||||||
|
if(vartrue($sublinkArray))
|
||||||
|
{
|
||||||
|
$ret[$id]['link_sub'] = $sublinkArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Render the Front-end Links.
|
||||||
|
function frontend($cat=1)
|
||||||
|
{
|
||||||
|
$links = $this->getData($cat);
|
||||||
|
$sc = e107::getScBatch('navigation');
|
||||||
|
$template = e107::getCoreTemplate('navigation');
|
||||||
|
$sc->template = $template; // parse the template to the shortcodes. (sub menus)
|
||||||
|
|
||||||
|
$text = $template['START'];
|
||||||
|
|
||||||
|
foreach($links as $lnk)
|
||||||
|
{
|
||||||
|
$sc->setVars($lnk);
|
||||||
|
$item = varset($lnk['link_sub']) ? $template['ITEM_SUBMENU'] : $template['ITEM'];
|
||||||
|
$text .= e107::getParser()->parseTemplate($item,TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= $template['END'];
|
||||||
|
|
||||||
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1194,4 +1253,65 @@ class e_navigation
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO - 'active links', SEF etc.
|
||||||
|
class navigation_shortcodes extends e_shortcode
|
||||||
|
{
|
||||||
|
|
||||||
|
var $template;
|
||||||
|
|
||||||
|
function sc_link_name($parm='')
|
||||||
|
{
|
||||||
|
return e107::getParser()->toHtml($this->var['link_name'],false,'TITLE');
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_link_url($parm='')
|
||||||
|
{
|
||||||
|
return e107::getParser()->replaceConstants($this->var['link_url']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_link_image($parm='')
|
||||||
|
{
|
||||||
|
return e107::getParser()->replaceConstants($this->var['link_image']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sc_link_description($parm='')
|
||||||
|
{
|
||||||
|
return e107::getParser()->toAttribute($this->var['link_description']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_link_sub($parm='')
|
||||||
|
{
|
||||||
|
if(!varset($this->var['link_sub']))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = $this->template['SUBMENU_START'];
|
||||||
|
|
||||||
|
foreach($this->var['link_sub'] as $val)
|
||||||
|
{
|
||||||
|
$this->setVars($val);
|
||||||
|
$text .= e107::getParser()->parseTemplate($this->template['SUBMENU_ITEM'],TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= $this->template['SUBMENU_END'];
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@@ -92,20 +92,24 @@ function tablestyle($caption, $text, $mod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$HEADER['default'] = '
|
$HEADER['default'] = '
|
||||||
<div class="container-fluid">
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
<div class="row-fluid">
|
<div class="navbar-inner">
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top site-header">
|
<div class="container-fluid">
|
||||||
<div class="navbar-inner">
|
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||||
<div class="span9">
|
<span class="icon-bar"></span>
|
||||||
<div class="site-logo pull-left thumbnails"><a class="logolink" href="'.SITEURL.' title="">{LOGO}</a></div><div class="dropdown nav navbar-text pull-left">{SITELINKS}</div>
|
<span class="icon-bar"></span>
|
||||||
</div>
|
<span class="icon-bar"></span>
|
||||||
<div class="span3">
|
</a>
|
||||||
<div class="pull-right">'.$c_login.'</div>
|
<a class="brand" href="'.SITEURL.'">{SITENAME}</a>
|
||||||
</div>
|
<div class="nav-collapse collapse">
|
||||||
</div>
|
<p class="navbar-text pull-right">
|
||||||
</div>
|
Logged in as <a href="#" class="navbar-link">'.USERNAME.'</a>
|
||||||
</div>
|
</p>
|
||||||
</div>
|
{NAVIGATION}
|
||||||
|
</div><!--/.nav-collapse -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span2">
|
<div class="span2">
|
||||||
|
Reference in New Issue
Block a user