1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Theme selection fix. Admin-ui carousel pagination fix.

This commit is contained in:
Cameron 2017-04-13 08:54:59 -07:00
parent 8c5149e20e
commit c766afd954
4 changed files with 49 additions and 16 deletions

View File

@ -280,6 +280,28 @@ class theme_admin_ui extends e_admin_ui
public function ChooseObserver() // action = choose
{
$mes = e107::getMessage();
$tp = e107::getParser();
if(!empty($_POST['selectmain']))
{
$id = key($_POST['selectmain']);
$message = $tp->lanVars(TPVLAN_94,$id);
if($this->themeObj->setTheme($id))
{
$mes->addSuccess($message);
}
else
{
$mes->addError($message);
}
}
$param = array();
$this->perPage = 0;
$param['limitFrom'] = (int) $this->getQuery('from', 0);
@ -851,7 +873,7 @@ class theme_admin_form_ui extends e_admin_form_ui
$infoPath = e_SELF."?mode=".$_GET['mode']."&id=".$theme['path']."&action=info&iframe=1";
$previewPath = $tp->replaceConstants($theme['thumbnail'],'abs');
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['id']."]' alt=\"".TPVLAN_10."\" title=\"".TPVLAN_10."\" >".$tp->toGlyph('fa-home',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
$main_icon = ($pref['sitetheme'] != $theme['path']) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectmain[".$theme['path']."]' alt=\"".TPVLAN_10."\" title=\"".TPVLAN_10."\" >".$tp->toGlyph('fa-home',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
$info_icon = "<a class='btn btn-default btn-small btn-sm btn-inverse e-modal' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" href='".$infoPath."' title='".TPVLAN_7."'>".$tp->toGlyph('fa-info-circle',array('size'=>'2x'))."</a>";
// $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectadmin[".$theme['id']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" >".$tp->toGlyph('fa-gears',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";

View File

@ -6565,17 +6565,32 @@ class e_admin_form_ui extends e_form
}
/**
* Render pagination
* @return string
*/
public function renderPagination()
{
if($this->getController()->getGrid('carousel') === true)
{
return '<div class="btn-group" >
<a class="btn btn-default" href="#admin-ui-carousel" data-slide="prev"><i class="fa fa-backward"></i></a>
<a id="admin-ui-carousel-index" class="btn btn-default">1</a>
<a class="btn btn-default" href="#admin-ui-carousel" data-slide="next"><i class="fa fa-forward"></i></a>
</div>';
<a id="admin-ui-carousel-prev" class="btn btn-default" href="#admin-ui-carousel" data-slide="prev"><i class="fa fa-backward"></i></a>
<a id="admin-ui-carousel-index" class="btn btn-default">1</a>
<a id="admin-ui-carousel-next" class="btn btn-default" href="#admin-ui-carousel" data-slide="next"><i class="fa fa-forward"></i></a>
</div>';
}
$tree = $this->getController()->getTreeModel();
$totalRecords = $tree->getTotal();
$perPage = $this->getController()->getPerPage();
$fromPage = $this->getController()->getQuery('from', 0);
$vars = $this->getController()->getQuery();
$vars['from'] = '[FROM]';
$paginate = http_build_query($vars);
return $this->pagination(e_REQUEST_SELF.'?'.$paginate,$totalRecords,$fromPage,$perPage,array('template'=>'basic'));
}
@ -6627,15 +6642,7 @@ class e_admin_form_ui extends e_form
// $tree = $this->getTree();
// $total = $this->getTotal();
$tree = $this->getController()->getTreeModel();
$totalRecords = $tree->getTotal();
$perPage = $this->getController()->getPerPage();
$fromPage = $this->getController()->getQuery('from', 0);
$vars = $this->getController()->getQuery();
$vars['from'] = '[FROM]';
// var_dump($vars);
$paginate = http_build_query($vars);
$text = "
<form method='get' action='".e_REQUEST_SELF."'>
@ -6656,7 +6663,7 @@ class e_admin_form_ui extends e_form
<div class='e-autocomplete'></div>
".implode("\n", $filter_preserve_var)."
".$this->admin_button('etrigger_filter', 'etrigger_filter', 'filter e-hide-if-js', ADMIN_FILTER_ICON, array('id' => false,'title'=>LAN_FILTER))."
".$this->pagination(e_REQUEST_SELF.'?'.$paginate,$totalRecords,$fromPage,$perPage,array('template'=>'basic'))."
".$this->renderPagination()."
<span class='indicator' style='display: none;'>
<img src='".e_IMAGE_ABS."generic/loading_16.gif' class='icon action S16' alt='".LAN_LOADING."' />

View File

@ -897,6 +897,7 @@ class themeHandler
if($this->setTheme())
{
$mes->addSuccess(TPVLAN_3);
}
else
@ -916,6 +917,7 @@ class themeHandler
// print_a($this -> themeArray);
foreach ($_POST as $key=>$post)
{
if(strstr($key, "preview"))
@ -924,7 +926,8 @@ class themeHandler
$this->id = key($post);
$this->themePreview();
}
if(strstr($key, "selectmain"))
/* if(strstr($key, "selectmain"))
{
// $this -> id = str_replace("selectmain_", "", $key);
$this->id = key($post);
@ -936,7 +939,7 @@ class themeHandler
{
$mes->addError(TPVLAN_3);
}
}
}*/
if(strstr($key, "selectadmin"))
{

View File

@ -128,4 +128,5 @@ define("TPVLAN_91", "Create a new theme based on");
define("TPVLAN_92", "New Theme Folder");
define("TPVLAN_93", "Selection");
define("TPVLAN_94", "Site theme changed to [x].");