install theme selection
This commit is contained in:
@@ -83,6 +83,7 @@ class Installer
|
||||
'outboundEmailFromName',
|
||||
'outboundEmailFromAddress',
|
||||
'outboundEmailIsShared',
|
||||
'theme',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
@@ -237,7 +238,15 @@ class Installer
|
||||
return $this->app->isInstalled();
|
||||
}
|
||||
|
||||
private function getLanguage(): Language
|
||||
public function createLanguage(string $language): Language
|
||||
{
|
||||
return $this->app
|
||||
->getContainer()
|
||||
->get('injectableFactory')
|
||||
->createWith(Language::class, ['language' => $language]);
|
||||
}
|
||||
|
||||
public function getLanguage(): Language
|
||||
{
|
||||
if (!isset($this->language)) {
|
||||
try {
|
||||
@@ -255,6 +264,14 @@ class Installer
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
public function getThemeList(): array
|
||||
{
|
||||
return [
|
||||
'HazyblueVertical',
|
||||
'DarkVertical',
|
||||
];
|
||||
}
|
||||
|
||||
public function getLanguageList($isTranslated = true): array
|
||||
{
|
||||
$languageList = $this->getMetadata()->get(['app', 'language', 'list']);
|
||||
@@ -349,6 +366,7 @@ class Installer
|
||||
'passwordSalt' => $this->getPasswordHash()->generateSalt(),
|
||||
'cryptKey' => $this->getContainer()->get('crypt')->generateKey(),
|
||||
'hashSecretKey' => Util::generateSecretKey(),
|
||||
'theme' => $saveData['theme'] ?? 'HazyblueVertical',
|
||||
];
|
||||
|
||||
if (empty($saveData['defaultPermissions']['user'])) {
|
||||
@@ -528,6 +546,7 @@ class Installer
|
||||
'thousandSeparator',
|
||||
'decimalMark',
|
||||
'language',
|
||||
'theme',
|
||||
];
|
||||
|
||||
$data = array_intersect_key($preferences, array_flip($permittedSettingList));
|
||||
@@ -605,6 +624,11 @@ class Installer
|
||||
case 'language':
|
||||
$settingDefs['language']['options'] = $this->getLanguageList(false);
|
||||
|
||||
break;
|
||||
|
||||
case 'theme':
|
||||
$settingDefs['theme']['options'] = $this->getThemeList();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,31 +28,48 @@
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = array('success' => true, 'errorMsg' => '');
|
||||
|
||||
$result = ['success' => true, 'errorMsg' => ''];
|
||||
|
||||
if (!$installer->checkPermission()) {
|
||||
$result['success'] = false;
|
||||
$error = $installer->getLastPermissionError();
|
||||
|
||||
$urls = array_keys($error);
|
||||
$group = array();
|
||||
foreach($error as $folder => $permission) {
|
||||
|
||||
$group = [];
|
||||
|
||||
foreach ($error as $folder => $permission) {
|
||||
$group[implode('-', $permission)][] = $folder;
|
||||
}
|
||||
|
||||
ksort($group);
|
||||
|
||||
$instruction = '';
|
||||
$instructionSU = '';
|
||||
$changeOwner = true;
|
||||
|
||||
foreach($group as $permission => $folders) {
|
||||
if ($permission == '0644-0755') $folders = '';
|
||||
$instruction .= $systemHelper->getPermissionCommands(array($folders, ''), explode('-', $permission), false, null, $changeOwner) . "<br>";
|
||||
$instructionSU .= $systemHelper->getPermissionCommands(array($folders, ''), explode('-', $permission), true, null, $changeOwner) . "<br>";
|
||||
if ($permission == '0644-0755') {
|
||||
$folders = '';
|
||||
}
|
||||
|
||||
$instruction .= $systemHelper
|
||||
->getPermissionCommands([$folders, ''], explode('-', $permission), false, null, $changeOwner) . "<br>";
|
||||
|
||||
$instructionSU .= $systemHelper
|
||||
->getPermissionCommands([$folders, ''], explode('-', $permission), true, null, $changeOwner) . "<br>";
|
||||
|
||||
if ($changeOwner) {
|
||||
$changeOwner = false;
|
||||
}
|
||||
}
|
||||
|
||||
$result['errorMsg'] = $langs['messages']['Permission denied to'] . ':<br><pre>'.implode('<br>', $urls).'</pre>';
|
||||
$result['errorFixInstruction'] = str_replace( '"{C}"' , $instruction, $langs['messages']['permissionInstruction']) . "<br>" .
|
||||
str_replace( '{CSU}' , $instructionSU, $langs['messages']['operationNotPermitted']);
|
||||
|
||||
$result['errorFixInstruction'] =
|
||||
str_replace( '"{C}"' , $instruction, $langs['messages']['permissionInstruction']) .
|
||||
"<br>" . str_replace( '{CSU}' , $instructionSU, $langs['messages']['operationNotPermitted']);
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
|
||||
@@ -29,11 +29,14 @@
|
||||
|
||||
$config = $installer->getConfig();
|
||||
|
||||
$fields = array(
|
||||
'user-lang' => array(
|
||||
$fields = [
|
||||
'user-lang' => [
|
||||
'default' => $config->get('language', 'en_US'),
|
||||
),
|
||||
);
|
||||
],
|
||||
'theme' => [
|
||||
'default' => $config->get('theme'),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($fields as $fieldName => $field) {
|
||||
if (isset($_SESSION['install'][$fieldName])) {
|
||||
@@ -43,4 +46,13 @@ foreach ($fields as $fieldName => $field) {
|
||||
}
|
||||
}
|
||||
|
||||
$language = $installer->createLanguage($_SESSION['install']['user-lang'] ?? 'en_US');
|
||||
|
||||
$themes = [];
|
||||
foreach ($installer->getThemeList() as $item) {
|
||||
$themes[$item] = $language->translate($item, 'themes', 'Global');
|
||||
}
|
||||
|
||||
$smarty->assign('themeLabel', $language->translate('theme', 'fields', 'Settings'));
|
||||
$smarty->assign('fields', $fields);
|
||||
$smarty->assign("themes", $themes);
|
||||
@@ -28,19 +28,26 @@
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$result = array('success' => true, 'errorMsg' => '');
|
||||
|
||||
$result = [
|
||||
'success' => true,
|
||||
'errorMsg' => '',
|
||||
];
|
||||
|
||||
// save settings
|
||||
$database = array(
|
||||
$database = [
|
||||
'driver' => 'pdo_mysql',
|
||||
'dbname' => $_SESSION['install']['db-name'],
|
||||
'user' => $_SESSION['install']['db-user-name'],
|
||||
'password' => $_SESSION['install']['db-user-password'],
|
||||
);
|
||||
];
|
||||
|
||||
$host = $_SESSION['install']['host-name'];
|
||||
|
||||
if (strpos($host,':') === false) {
|
||||
$host .= ":";
|
||||
}
|
||||
|
||||
list($database['host'], $database['port']) = explode(':', $host);
|
||||
|
||||
$saveData = [
|
||||
@@ -49,6 +56,10 @@ $saveData = [
|
||||
'siteUrl' => !empty($_SESSION['install']['site-url']) ? $_SESSION['install']['site-url'] : null,
|
||||
];
|
||||
|
||||
if (!empty($_SESSION['install']['theme'])) {
|
||||
$saveData['theme'] = $_SESSION['install']['theme'];
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['install']['default-permissions-user']) && !empty($_SESSION['install']['default-permissions-group'])) {
|
||||
$saveData['defaultPermissions'] = [
|
||||
'user' => $_SESSION['install']['default-permissions-user'],
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript" src="js/install.js"></script>
|
||||
<link href="../client/css/espo/hazyblue.css" rel="stylesheet">
|
||||
<link href="../{$stylesheet}" rel="stylesheet">
|
||||
<link href="css/install.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="../client/img/favicon.ico" type="image/x-icon">
|
||||
</head>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<form id="nav">
|
||||
<div class="panel-body">
|
||||
<div id="msg-box" class="alert hide"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div align="center">
|
||||
@@ -11,9 +12,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell cell-website pull-left" align="left">
|
||||
<label class="field-label-website control-label">{$langs['fields']['Choose your language']}</label>
|
||||
<div class="field field-website">
|
||||
|
||||
<div class="row margin-top">
|
||||
<div class="cell cell-language col-md-4">
|
||||
<label class="field-label-language control-label">{$langs['fields']['Choose your language']}</label>
|
||||
<div class="field field-language">
|
||||
<select name="user-lang" class="form-control">
|
||||
{foreach from=$languageList item=lbl key=val}
|
||||
{if $val == $fields['user-lang'].value}
|
||||
@@ -25,15 +28,37 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cell cell-website pull-right" align="right">
|
||||
<a target="_blank" href="https://www.espocrm.com/documentation/administration/installation/" style="font-weight:600;">{$langs['labels']['Installation Guide']}</a>
|
||||
|
||||
<div class="cell cell-theme col-md-4">
|
||||
<label class="field-label-theme control-label">{$themeLabel}</label>
|
||||
<div class="field field-language">
|
||||
<select name="theme" class="form-control">
|
||||
{foreach from=$themes item=lbl key=val}
|
||||
{if $val == $fields['theme'].value}
|
||||
<option selected="selected" value="{$val}">{$lbl}</option>
|
||||
{else}
|
||||
<option value="{$val}">{$lbl}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cell cell-website col-md-4" align="right" style="padding-top: 24px;">
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://www.espocrm.com/documentation/administration/installation/"
|
||||
style="font-weight: 600;"
|
||||
>{$langs['labels']['Installation Guide']}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="modal-footer">
|
||||
<button class="btn btn-primary btn-s-wide" type="button" id="start">{$langs['labels']['Start']}</button>
|
||||
</footer>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
{literal}
|
||||
$(function(){
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="row">
|
||||
<div class="cell cell-website col-sm-12 form-group">
|
||||
<div class="field field-website">
|
||||
<textarea rows="16" class="license-field">{$license}</textarea>
|
||||
<textarea rows="16" class="license-field form-control">{$license}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+8
-2
@@ -62,6 +62,7 @@ $ignoredFields = [
|
||||
'dbDriver',
|
||||
];
|
||||
|
||||
|
||||
if (!empty($allPostData)) {
|
||||
foreach ($allPostData as $key => $val) {
|
||||
if (!in_array($key, $ignoredFields)) {
|
||||
@@ -152,8 +153,7 @@ $smarty->assign("langsJs", json_encode($langs));
|
||||
// include actions and set tpl name
|
||||
switch ($action) {
|
||||
case 'main':
|
||||
$languageList = $installer->getLanguageList();
|
||||
$smarty->assign("languageList", $languageList);
|
||||
$smarty->assign("languageList", $installer->getLanguageList());
|
||||
|
||||
break;
|
||||
|
||||
@@ -193,6 +193,11 @@ $smarty->assign('action', ucfirst($action));
|
||||
$smarty->assign('config', $config);
|
||||
$smarty->assign('installerConfig', $installer->getInstallerConfigData());
|
||||
|
||||
$theme = $_SESSION['install']['theme'] ?? 'HazyblueVertical';
|
||||
$stylesheet = $installer->getMetadata()->get(['themes', $theme, 'stylesheet']);
|
||||
|
||||
$smarty->assign('stylesheet', $stylesheet);
|
||||
|
||||
if (Utils::checkActionExists($action)) {
|
||||
include $actionFile;
|
||||
}
|
||||
@@ -211,3 +216,4 @@ if (!empty($actionFile) && file_exists('install/core/tpl/' . $tplName)) {
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
|
||||
|
||||
body > .content {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
.license-field {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -7,10 +12,6 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select[name="user-lang"] {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.subpanel {
|
||||
text-align: left ;
|
||||
}
|
||||
@@ -73,7 +74,10 @@ select[name="user-lang"] {
|
||||
|
||||
.cron-help {
|
||||
margin-top: 40px;
|
||||
color: #ad4846;
|
||||
color: var(--state-danger-text);
|
||||
max-width: 800px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.cron-help pre {
|
||||
@@ -84,7 +88,7 @@ select[name="user-lang"] {
|
||||
}
|
||||
|
||||
.cron-help p {
|
||||
color: #333;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.table {
|
||||
@@ -127,23 +131,14 @@ span.ok {
|
||||
}
|
||||
|
||||
.likes {
|
||||
border-left-color: #D7983B;
|
||||
-moz-border-bottom-colors: none;
|
||||
-moz-border-left-colors: #F1AF4E;
|
||||
-moz-border-right-colors: none;
|
||||
-moz-border-top-colors: none;
|
||||
border-color: #eee;
|
||||
border-image: none;
|
||||
border-radius: 3px;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 5px;
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
color: var(--state-success-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.likes p {
|
||||
color: #B56F08;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +90,15 @@ InstallScript.prototype.main = function() {
|
||||
$("#start").click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(nextAction);
|
||||
})
|
||||
});
|
||||
|
||||
$('[name="user-lang"]').change(function(){
|
||||
self.goTo(self.action);
|
||||
})
|
||||
$('[name="user-lang"]').change(() => {
|
||||
this.goTo(self.action);
|
||||
});
|
||||
|
||||
$('[name="theme"]').change(() => {
|
||||
this.goTo(self.action);
|
||||
});
|
||||
}
|
||||
|
||||
InstallScript.prototype.step1 = function() {
|
||||
|
||||
Reference in New Issue
Block a user