1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Boostrap3 Theme Custom Preferences added.

This commit is contained in:
Cameron
2015-03-29 20:25:33 -07:00
parent 44874d91b0
commit e3e51fa59c
5 changed files with 124 additions and 7 deletions

View File

@@ -1186,7 +1186,7 @@ class themeHandler
if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'config')) && $mode == 1)
{
$text .= "<li><a data-toggle='tab' href='#core-thememanager-customconfig'>".LAN_CUSTOM."</a></li>\n";
$text .= "<li><a data-toggle='tab' href='#core-thememanager-customconfig'>".LAN_PREFS."</a></li>\n";
}
if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help')))

View File

@@ -13,6 +13,11 @@ body {
margin-top:20px
}
img.logo {
margin-top: -5px;
margin-right: 5px;
}
/* Make posted content images responsive too */
.bbcode-img { display: block; max-width: 100%; height: auto; }

View File

@@ -126,11 +126,11 @@ $LAYOUT['_header_'] = '
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{SITEURL}">{SITENAME}</a>
<a class="navbar-brand" href="{SITEURL}">{BOOTSTRAP_BRANDING}</a>
</div>
<div class="navbar-collapse collapse">
<div class="navbar-collapse collapse {BOOTSTRAP_NAV_ALIGN}">
{NAVIGATION=main}
{BOOTSTRAP_USERNAV}
{BOOTSTRAP_USERNAV: placement=top}
</div><!--/.navbar-collapse -->
</div>
</div>
@@ -148,7 +148,9 @@ $LAYOUT['_footer_'] = ' <hr>
</div>
<div class="col-lg-6 text-right">
{XURL_ICONS: size=2x}
{BOOTSTRAP_USERNAV: placement=bottom&dir=up}
</div>
<div class="col-lg-12 text-center">
<small>{SITEDISCLAIMER}</small>
</div>

View File

@@ -0,0 +1,53 @@
<?php
if (!defined('e107_INIT')) { exit; }
// Dummy Theme Configuration File.
class theme_bootstrap3 implements e_theme_config
{
function process() // Save posted values from config() fields.
{
$pref = e107::getConfig();
$tp = e107::getParser();
$theme_pref = array();
$theme_pref['nav_alignment'] = $_POST['nav_alignment'];
$theme_pref['usernav_placement'] = $_POST['usernav_placement'];
$theme_pref['branding'] = $_POST['branding'];
$pref->set('sitetheme_pref', $theme_pref);
return $pref->dataHasChanged();
}
function config()
{
$frm = e107::getForm();
$brandingOpts = array('sitename'=>'Site Name', 'logo' => 'Logo', 'sitenamelogo'=>'Logo &amp; Site Name');
$var[0]['caption'] = "Branding";
$var[0]['html'] = $frm->select('branding', $brandingOpts, e107::pref('theme', 'branding', 'sitename'));
$var[0]['help'] = "";
$var[1]['caption'] = "Navbar Alignment";
$var[1]['html'] = $frm->select('nav_alignment', array('left', 'right'), e107::pref('theme', 'nav_alignment', 'left'),'useValues=1' );
$var[1]['help'] = "";
$var[2]['caption'] = "Signup/Login Placement";
$var[2]['html'] = $frm->select('usernav_placement', array('top', 'bottom'), e107::pref('theme', 'usernav_placement', 'top'),'useValues=1' );
$var[2]['help'] = "";
// $var[1]['caption'] = "Sample configuration field 2";
// $var[1]['html'] = $frm->text('_blank_example2', e107::pref('theme', 'example2', 'default'));
return $var;
}
function help()
{
return '';
}
}
?>

View File

@@ -17,20 +17,77 @@ class theme_shortcodes extends e_shortcode
{
}
function sc_bootstrap_usernav()
function sc_bootstrap_branding()
{
$pref = e107::pref('theme', 'branding', 'sitename');
switch($pref)
{
case 'logo':
return e107::getParser()->parseTemplate('{SITELOGO: h=30}',true);
break;
case 'sitenamelogo':
return "<span class='pull-left'>".e107::getParser()->parseTemplate('{SITELOGO: h=30}',true)."</span>".SITENAME;
break;
case 'sitename':
default:
return SITENAME;
break;
}
}
function sc_bootstrap_nav_align()
{
$pref = e107::pref('theme', 'nav_alignment');
if($pref == 'right')
{
return "navbar-right";
}
else
{
return "";
}
}
function sc_bootstrap_usernav($parm='')
{
$placement = e107::pref('theme', 'usernav_placement', 'top');
if($parm['placement'] != $placement)
{
return '';
}
include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
$tp = e107::getParser();
require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
$direction = vartrue($parm['dir']) == 'up' ? ' dropup' : '';
$userReg = defset('USER_REGISTRATION');
if(!USERID) // Logged Out.
{
$text = '
<ul class="nav navbar-nav navbar-right">';
<ul class="nav navbar-nav navbar-right'.$direction.'"">';
if($userReg==1)
{