🎨 SetupPage code formatting

This commit is contained in:
Pierre Goiffon
2019-10-03 18:28:24 +02:00
parent c3915ee48e
commit 14c25e3d9b

View File

@@ -37,13 +37,13 @@ SetupLog::Enable(APPROOT.'/log/setup.log');
*/
class SetupPage extends NiceWebPage
{
public function __construct($sTitle)
{
parent::__construct($sTitle);
$this->add_linked_script("../js/jquery.blockUI.js");
$this->add_linked_script("../setup/setup.js");
$this->add_style(
<<<CSS
public function __construct($sTitle)
{
parent::__construct($sTitle);
$this->add_linked_script("../js/jquery.blockUI.js");
$this->add_linked_script("../setup/setup.js");
$this->add_style(
<<<CSS
body {
background-color: #eee;
margin: 0;
@@ -175,12 +175,12 @@ h3.clickable.open {
cursor: hand;
}
CSS
);
);
}
/**
* Overriden because the application is not fully loaded when the setup is being run
*/
*/
public function GetAbsoluteUrlAppRoot()
{
return '../';
@@ -188,7 +188,7 @@ CSS
/**
* Overriden because the application is not fully loaded when the setup is being run
*/
*/
public function GetAbsoluteUrlModulesRoot()
{
return $this->GetAbsoluteUrlAppRoot().utils::GetCurrentEnvironment();
@@ -196,7 +196,7 @@ CSS
/**
* Overriden because the application is not fully loaded when the setup is being run
*/
*/
function GetApplicationContext()
{
return '';
@@ -207,29 +207,29 @@ CSS
$this->add("<p class=\"info\">$sText</p>\n");
$this->log_info($sText);
}
public function ok($sText)
{
$this->add("<p class=\"ok\">$sText</p>\n");
$this->log_ok($sText);
}
public function warning($sText)
{
$this->add("<p class=\"warning\">$sText</p>\n");
$this->log_warning($sText);
}
public function error($sText)
{
$this->add("<p class=\"error\">$sText</p>\n");
$this->log_error($sText);
}
public function form($aData)
{
$this->add("<table class=\"formTable\">\n");
foreach($aData as $aRow)
foreach ($aData as $aRow)
{
$this->add("<tr>\n");
if (isset($aRow['label']) && isset($aRow['input']) && isset($aRow['help']))
@@ -238,47 +238,58 @@ CSS
$this->add("<td class=\"wizinput\">{$aRow['input']}</td>\n");
$this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
}
else if (isset($aRow['label']) && isset($aRow['help']))
else
{
$this->add("<td colspan=\"2\" class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
}
else if (isset($aRow['label']) && isset($aRow['input']))
{
$this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td colspan=\"2\" class=\"wizinput\">{$aRow['input']}</td>\n");
}
else if (isset($aRow['label']))
{
$this->add("<td colspan=\"3\" class=\"wizlabel\">{$aRow['label']}</td>\n");
if (isset($aRow['label']) && isset($aRow['help']))
{
$this->add("<td colspan=\"2\" class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
}
else
{
if (isset($aRow['label']) && isset($aRow['input']))
{
$this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td colspan=\"2\" class=\"wizinput\">{$aRow['input']}</td>\n");
}
else
{
if (isset($aRow['label']))
{
$this->add("<td colspan=\"3\" class=\"wizlabel\">{$aRow['label']}</td>\n");
}
}
}
}
$this->add("</tr>\n");
}
$this->add("</table>\n");
}
public function collapsible($sId, $sTitle, $aItems, $bOpen = true)
{
$this->add("<h3 class=\"clickable open\" id=\"{$sId}\">$sTitle</h3>");
$this->p('<ul id="'.$sId.'_list">');
foreach($aItems as $sItem)
foreach ($aItems as $sItem)
{
$this->p("<li>$sItem</li>\n");
}
}
$this->p('</ul>');
$this->add_ready_script("$('#{$sId}').click( function() { $(this).toggleClass('open'); $('#{$sId}_list').toggle();} );\n");
if (!$bOpen)
{
$this->add_ready_script("$('#{$sId}').toggleClass('open'); $('#{$sId}_list').toggle();\n");
}
}
}
public function output()
{
$this->s_content = "<div id=\"header\"><h1><a href=\"http://www.combodo.com/itop\" target=\"_blank\"><img title=\"iTop by Combodo\" src=\"../images/itop-logo.png?t=".utils::GetCacheBusterTimestamp()."\"></a>&nbsp;".htmlentities($this->s_title, ENT_QUOTES, 'UTF-8')."</h1>\n</div><div id=\"setup\">{$this->s_content}\n</div>\n";
$this->s_content = "<div id=\"header\"><h1><a href=\"http://www.combodo.com/itop\" target=\"_blank\"><img title=\"iTop by Combodo\" src=\"../images/itop-logo.png?t=".utils::GetCacheBusterTimestamp()."\"></a>&nbsp;".htmlentities($this->s_title,
ENT_QUOTES, 'UTF-8')."</h1>\n</div><div id=\"setup\">{$this->s_content}\n</div>\n";
return parent::output();
}
public static function log_error($sText)
{
SetupLog::Error($sText);