/** * Web page used for the setup * * @copyright Copyright (C) 2010-2012 Combodo SARL * @license http://opensource.org/licenses/AGPL-3.0 */ require_once(APPROOT."/application/nicewebpage.class.inc.php"); require_once(APPROOT."setup/modulediscovery.class.inc.php"); require_once(APPROOT."setup/runtimeenv.class.inc.php"); define('INSTALL_LOG_FILE', APPROOT.'/log/setup.log'); date_default_timezone_set('Europe/Paris'); 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(" body { background-color: #eee; margin: 0; padding: 0; font-size: 10pt; overflow-y: auto; } #header { width: 600px; margin-left: auto; margin-right: auto; margin-top: 50px; padding: 20px; background: #f6f6f1; height: 54px; border-top: 1px solid #000; border-left: 1px solid #000; border-right: 1px solid #000; } #header img { border: 0; vertical-align: middle; margin-right: 20px; } #header h1 { vertical-align: middle; height: 54px; noline-height: 54px; margin: 0; } #setup { width: 600px; margin-left: auto; margin-right: auto; padding: 20px; background-color: #fff; border-left: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } .center { text-align: center; } h1 { color: #1C94C4; font-size: 16pt; } h2 { color: #000; font-size: 14pt; } h3 { color: #1C94C4; font-size: 12pt; font-weight: bold; } .next { width: 100%; text-align: right; } .v-spacer { padding-top: 1em; } button { margin-top: 1em; padding-left: 1em; padding-right: 1em; } p.info { padding-left: 50px; background: url(../images/info-mid.png) no-repeat left -5px; min-height: 48px; } p.ok { padding-left: 50px; background: url(../images/clean-mid.png) no-repeat left -8px; min-height: 48px; } p.warning { padding-left: 50px; background: url(../images/messagebox_warning-mid.png) no-repeat left -5px; min-height: 48px; } p.error { padding-left: 50px; background: url(../images/stop-mid.png) no-repeat left -5px; min-height: 48px; } td.label { text-align: left; } label.read-only { color: #666; cursor: text; } td.input { text-align: left; } table.formTable { border: 0; cellpadding: 2px; cellspacing: 0; } .wizlabel, .wizinput { color: #000; font-size: 10pt; } .wizhelp { color: #333; font-size: 8pt; } #progress { border:1px solid #000000; width: 180px; height: 20px; line-height: 20px; text-align: center; margin: 5px; } h3.clickable { background: url(../images/plus.gif) no-repeat left; padding-left:16px; cursor: hand; } h3.clickable.open { background: url(../images/minus.gif) no-repeat left; padding-left:16px; cursor: hand; } "); } /** * Overriden because the application is not fully loaded when the setup is being run */ public function GetAbsoluteUrlAppRoot() { return '../'; } /** * Overriden because the application is not fully loaded when the setup is being run */ public function GetAbsoluteUrlModulesRoot() { return $this->GetAbsoluteUrlAppRoot().utils::GetCurrentEnvironment(); } /** * Overriden because the application is not fully loaded when the setup is being run */ function GetApplicationContext() { return ''; } public function info($sText) { $this->add("

$sText

\n"); $this->log_info($sText); } public function ok($sText) { $this->add("

$sText

\n"); $this->log_ok($sText); } public function warning($sText) { $this->add("

$sText

\n"); $this->log_warning($sText); } public function error($sText) { $this->add("

$sText

\n"); $this->log_error($sText); } public function form($aData) { $this->add("\n"); foreach($aData as $aRow) { $this->add("\n"); if (isset($aRow['label']) && isset($aRow['input']) && isset($aRow['help'])) { $this->add("\n"); $this->add("\n"); $this->add("\n"); } else if (isset($aRow['label']) && isset($aRow['help'])) { $this->add("\n"); $this->add("\n"); } else if (isset($aRow['label']) && isset($aRow['input'])) { $this->add("\n"); $this->add("\n"); } else if (isset($aRow['label'])) { $this->add("\n"); } $this->add("\n"); } $this->add("
{$aRow['label']}{$aRow['input']}{$aRow['help']}{$aRow['label']}{$aRow['help']}{$aRow['label']}{$aRow['input']}{$aRow['label']}
\n"); } public function collapsible($sId, $sTitle, $aItems, $bOpen = true) { $this->add("

$sTitle

"); $this->p(''); $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 = "

 ".htmlentities($this->s_title, ENT_QUOTES, 'UTF-8')."

\n
{$this->s_content}\n
\n"; return parent::output(); } public static function log_error($sText) { self::log("Error - ".$sText); } public static function log_warning($sText) { self::log("Warning - ".$sText); } public static function log_info($sText) { self::log("Info - ".$sText); } public static function log_ok($sText) { self::log("Ok - ".$sText); } public static function log($sText) { $hLogFile = @fopen(INSTALL_LOG_FILE, 'a'); if ($hLogFile !== false) { $sDate = date('Y-m-d H:i:s'); fwrite($hLogFile, "$sDate - $sText\n"); fclose($hLogFile); } } } // End of class