1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Admin skin option added to installation wizard.

This commit is contained in:
Cameron
2017-12-15 14:50:54 -08:00
parent 72351da914
commit ff2b79145e
8 changed files with 118 additions and 11 deletions

View File

@@ -960,7 +960,7 @@ class e_install
$this->template->SetTag("installation_heading", LANINS_001);
$this->template->SetTag("stage_pre", LANINS_002);
$this->template->SetTag("stage_num", LANINS_046);
$this->template->SetTag("stage_title", LANINS_047);
$this->template->SetTag("stage_title", defset('LANINS_147', 'Administration'));
// $this->template->SetTag("onload", "document.getElementById('u_name').focus()");
$this->template->SetTag("percent", 60);
$this->template->SetTag("bartype", 'warning');
@@ -969,6 +969,10 @@ class e_install
$output = "
<div style='width: 100%; padding-left: auto; padding-right: auto;'>
<table class='table table-striped table-bordered'>
<colgroup>
<col style='width:35%' />
<col />
</colgroup>
<tr>
<td><label for='u_name'>".LANINS_072."</label></td>
<td>
@@ -1006,6 +1010,46 @@ class e_install
<td>
<input class='form-control' type='text' name='email' size='30' id='email' required='required' placeholder='admin@mysite.com' value='".(isset($this->previous_steps['admin']['email']) ? $this->previous_steps['admin']['email'] : '')."' maxlength='100' />
<span class='field-help'>".LANINS_081."</span>
</td>
</tr>
</table>
<table class='table table-striped table-bordered'>
<colgroup>
<col style='width:35%' />
<col />
</colgroup>
<tr>
<td><label for='admincss'>".LANINS_146."</label></td>
<td>";
$d = $this->get_theme_xml('bootstrap3');
$opts = array();
foreach($d['css'] as $val)
{
$key = $val['name'];
if(empty($val['thumbnail']))
{
continue;
}
$opts[$key] = array (
'title' => $val['info'],
'preview' => e_THEME."bootstrap3/".$val['thumbnail'],
'description' =>'',
'category'=>''
);
}
$output .= $this->thumbnailSelector('admincss', $opts, 'css/bootstrap-dark.min.css');
$output .= "
</td>
</tr>
</table>
@@ -1072,6 +1116,11 @@ class e_install
}
}
if(!empty($_POST['admincss']))
{
$this->previous_steps['prefs']['admincss'] = $tp->filter($_POST['admincss']);
}
// ------------- Validate Step 5 Data. --------------------------
if(!vartrue($this->previous_steps['admin']['user']) || !vartrue($this->previous_steps['admin']['password']))
{
@@ -1123,6 +1172,8 @@ class e_install
$themes = $this->get_themes();
$opts = array();
foreach($themes as $val)
{
@@ -1131,17 +1182,29 @@ class e_install
continue;
}*/
$themeInfo = $this->get_theme_xml($val);
$title = vartrue($themeInfo['@attributes']['name']);
$opts[$val] = array(
'title' =>vartrue($themeInfo['@attributes']['name']),
'category' => vartrue($themeInfo['category']),
'preview' => e_THEME.$val."/".$themeInfo['thumbnail'],
'description' => vartrue($themeInfo['info'])
);
/* $title = vartrue($themeInfo['@attributes']['name']);
$category = vartrue($themeInfo['category']);
$preview = e_THEME.$val."/".$themeInfo['thumbnail'];
$description = vartrue($themeInfo['description']);
$description = vartrue($themeInfo['info']);
if(!is_readable($preview))
{
continue;
}
$thumbnail = "<img class='img-responsive img-fluid thumbnail' src='".$preview ."' alt='".$val."' />";
@@ -1154,9 +1217,12 @@ class e_install
<h5>".$title." <small>(".$category.")</small><span class='glyphicon glyphicon-ok text-success'></span></h5>
</div>
</label>
</div>";
</div>";*/
}
$output .= $this->thumbnailSelector('sitetheme', $opts, DEFAULT_INSTALL_THEME);
$output .= "
</td>
@@ -1189,6 +1255,43 @@ class e_install
$this->logLine('Stage 6 completed');
}
private function thumbnailSelector($name, $opts, $default='')
{
$ret = '';
foreach($opts as $key=>$val)
{
if(!is_readable($val['preview']) || !is_file($val['preview']))
{
continue;
}
$thumbnail = "<img class='img-responsive img-fluid thumbnail' src='".$val['preview'] ."' alt='".$key."' />";
$selected = ($key === $default) ? " checked" : "";
$categoryInfo = !empty($val['category']) ? "<small>(".$val['category'].")</small>" : "";
$ret .= "
<div class='col-md-6 theme-cell' >
<label class='theme-selection' title=\"".$val['description']."\"><input type='radio' name='".$name."' value='{$key}' required='required' $selected />
<div>".$thumbnail."
<h5>".$val['title']." ".$categoryInfo."<span class='glyphicon glyphicon-ok text-success'></span></h5>
</div>
</label>
</div>";
}
return $ret;
}
private function stage_7()
{
global $e_forms;
@@ -1757,7 +1860,7 @@ if($this->pdo == true)
* get_theme_xml - check theme.xml file of specific theme
*
* @param string $theme_folder
* @return array $xmlArray OR boolean FALSE if result is no array
* @return array|bool $xmlArray OR boolean FALSE if result is no array
*/
function get_theme_xml($theme_folder)
{
@@ -1774,7 +1877,7 @@ if($this->pdo == true)
// require_once($this->e107->e107_dirs['HANDLERS_DIRECTORY']."theme_handler.php");
// $tm = new themeHandler;
$xmlArray = e107::getTheme($theme_folder)->get();
$xmlArray = e107::getTheme($theme_folder,true)->get();
return (is_array($xmlArray)) ? $xmlArray : false;
}