1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02: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 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(); $param = array();
$this->perPage = 0; $this->perPage = 0;
$param['limitFrom'] = (int) $this->getQuery('from', 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"; $infoPath = e_SELF."?mode=".$_GET['mode']."&id=".$theme['path']."&action=info&iframe=1";
$previewPath = $tp->replaceConstants($theme['thumbnail'],'abs'); $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>"; $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>"; // $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() public function renderPagination()
{ {
if($this->getController()->getGrid('carousel') === true) if($this->getController()->getGrid('carousel') === true)
{ {
return '<div class="btn-group" > 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-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-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> <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>'; </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(); // $tree = $this->getTree();
// $total = $this->getTotal(); // $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 = " $text = "
<form method='get' action='".e_REQUEST_SELF."'> <form method='get' action='".e_REQUEST_SELF."'>
@@ -6656,7 +6663,7 @@ class e_admin_form_ui extends e_form
<div class='e-autocomplete'></div> <div class='e-autocomplete'></div>
".implode("\n", $filter_preserve_var)." ".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->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()." ".$this->renderPagination()."
<span class='indicator' style='display: none;'> <span class='indicator' style='display: none;'>
<img src='".e_IMAGE_ABS."generic/loading_16.gif' class='icon action S16' alt='".LAN_LOADING."' /> <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()) if($this->setTheme())
{ {
$mes->addSuccess(TPVLAN_3); $mes->addSuccess(TPVLAN_3);
} }
else else
@@ -916,6 +917,7 @@ class themeHandler
// print_a($this -> themeArray); // print_a($this -> themeArray);
foreach ($_POST as $key=>$post) foreach ($_POST as $key=>$post)
{ {
if(strstr($key, "preview")) if(strstr($key, "preview"))
@@ -924,7 +926,8 @@ class themeHandler
$this->id = key($post); $this->id = key($post);
$this->themePreview(); $this->themePreview();
} }
if(strstr($key, "selectmain"))
/* if(strstr($key, "selectmain"))
{ {
// $this -> id = str_replace("selectmain_", "", $key); // $this -> id = str_replace("selectmain_", "", $key);
$this->id = key($post); $this->id = key($post);
@@ -936,7 +939,7 @@ class themeHandler
{ {
$mes->addError(TPVLAN_3); $mes->addError(TPVLAN_3);
} }
} }*/
if(strstr($key, "selectadmin")) 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_92", "New Theme Folder");
define("TPVLAN_93", "Selection"); define("TPVLAN_93", "Selection");
define("TPVLAN_94", "Site theme changed to [x].");