Доброго времени суток!
Делаю мастер установки сайта
На последнем шаге FinishStep выводится сообщение о том, что решение установлено. Проблема в том, что по нажатию на кнопку "перейти на сайт" ничего не происходит
Код wizard.php
Делаю мастер установки сайта
На последнем шаге FinishStep выводится сообщение о том, что решение установлено. Проблема в том, что по нажатию на кнопку "перейти на сайт" ничего не происходит
Код wizard.php
| Код |
|---|
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
require_once($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/install/wizard_sol/wizard.php");
class SelectSiteStep extends CSelectSiteWizardStep
{
function InitStep()
{
parent::InitStep();
$wizard =& $this->GetWizard();
$wizard->solutionName = "coderoid_solution";
}
}
class SelectTemplateStep extends CSelectTemplateWizardStep
{
function InitStep()
{
$this->SetStepID("select_template");
$this->SetTitle(GetMessage("SELECT_TEMPLATE_TITLE"));
$this->SetSubTitle(GetMessage("SELECT_TEMPLATE_SUBTITLE"));
//$this->SetPrevStep("welcome_step");
$this->SetNextStep("select_theme");
$this->SetNextCaption(GetMessage("NEXT_BUTTON"));
}
function OnPostForm()
{
$wizard =& $this->GetWizard();
$proactive = COption::GetOptionString("statistic", "DEFENCE_ON", "N");
if ($proactive == "Y")
{
COption::SetOptionString("statistic", "DEFENCE_ON", "N");
$wizard->SetVar("proactive", "Y");
}
else
{
$wizard->SetVar("proactive", "N");
}
if ($wizard->IsNextButtonClick())
{
$arTemplates = array("coderoid_adaptive_shop", "eshop_adapt_vertical", "eshop_vertical", "eshop_horizontal", "eshop_vertical_popup");
$templateID = $wizard->GetVar("wizTemplateID");
if (!in_array($templateID, $arTemplates))
$this->SetError(GetMessage("wiz_template"));
if (in_array($templateID, array("coderoid_adaptive_shop", "eshop_adapt_vertical")))
$wizard->SetVar("templateID", "coderoid_adaptive_shop");
else
$wizard->SetVar("templateID", "coderoid_adaptive_shop");
}
}
function ShowStep()
{
$wizard =& $this->GetWizard();
$templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath()."/site");
$arTemplates = WizardServices::GetTemplates($templatesPath);
/*if (empty($arTemplates))
return; */
$arTemplateOrder = array();
if (in_array("coderoid_adaptive_shop", array_keys($arTemplates)))
{
$arTemplateOrder[] = "coderoid_adaptive_shop";
}
if (in_array("eshop", array_keys($arTemplates)))
{
$arTemplateOrder[] = "eshop_horizontal";
$arTemplateOrder[] = "eshop_vertical";
$arTemplateOrder[] = "eshop_vertical_popup";
}
$defaultTemplateID = COption::GetOptionString("main", "wizard_template_id", "coderoid_adaptive_shop", $wizard->GetVar("siteID"));
if (!in_array($defaultTemplateID, array("coderoid_adaptive_shop", "eshop_adapt_vertical", "eshop_vertical", "eshop_horizontal", "eshop_vertical_popup"))) $defaultTemplateID = "coderoid_adaptive_shop";
$wizard->SetDefaultVar("wizTemplateID", $defaultTemplateID);
$arTemplateInfo = array(
"coderoid_adaptive_shop" => array(
"NAME" => GetMessage("WIZ_TEMPLATE_ADAPT_HORIZONTAL"),
"DESCRIPTION" => "",
"PREVIEW" => $wizard->GetPath()."/site/templates/coderoid_adaptive_shop/images/".LANGUAGE_ID."/coderoid_adaptive_small.png",
"SCREENSHOT" => $wizard->GetPath()."/site/templates/coderoid_adaptive_shop/images/".LANGUAGE_ID."/coderoid_adaptive.png",
),
"eshop_adapt_vertical" => array(
"NAME" => GetMessage("WIZ_TEMPLATE_ADAPT_VERTICAL"),
"DESCRIPTION" => "",
"PREVIEW" => $wizard->GetPath()."/site/templates/coderoid_adaptive_shop/images/".LANGUAGE_ID."/preview_vertical.gif",
"SCREENSHOT" => $wizard->GetPath()."/site/templates/coderoid_adaptive_shop/images/".LANGUAGE_ID."/screen_vertical.gif",
),
"eshop_horizontal" => array(
"NAME" => GetMessage("WIZ_TEMPLATE_HORIZONTAL"),
"DESCRIPTION" => "",
"PREVIEW" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/preview_horizontal.gif",
"SCREENSHOT" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/screen_horizontal.gif",
),
"eshop_vertical" => array(
"NAME" => GetMessage("WIZ_TEMPLATE_VERTICAL"),
"DESCRIPTION" => "",
"PREVIEW" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/preview_vertical.gif",
"SCREENSHOT" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/screen_vertical.gif",
),
"eshop_vertical_popup" => array(
"NAME" => GetMessage("WIZ_TEMPLATE_VERTICAL_POPUP"),
"DESCRIPTION" => "",
"PREVIEW" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/preview_vertical_popup.gif",
"SCREENSHOT" => $wizard->GetPath()."/site/templates/eshop/lang/".LANGUAGE_ID."/screen_vertical_popup.gif",
),
);
// $this->content .= "<input type='hidden' value='eshop' name='templateID' id='templateID'>";//$this->ShowInputField('hidden', 'templateID', array("id" => "templateID", "value" => "eshop"));
global $SHOWIMAGEFIRST;
$SHOWIMAGEFIRST = true;
$this->content .= '<div class="inst-template-list-block">';
foreach ($arTemplateOrder as $templateID)
{
$arTemplate = $arTemplateInfo[$templateID];
if (!$arTemplate)
continue;
$this->content .= '<div class="inst-template-description">';
$this->content .= $this->ShowRadioField("wizTemplateID", $templateID, Array("id" => $templateID, "class" => "inst-template-list-inp"));
global $SHOWIMAGEFIRST;
$SHOWIMAGEFIRST = true;
if ($arTemplate["SCREENSHOT"] && $arTemplate["PREVIEW"])
$this->content .= CFile::Show2Images($arTemplate["PREVIEW"], $arTemplate["SCREENSHOT"], 150, 150, ' class="inst-template-list-img"');
else
$this->content .= CFile::ShowImage($arTemplate["SCREENSHOT"], 150, 150, ' class="inst-template-list-img"', "", true);
$this->content .= '<label for="'.$templateID.'" class="inst-template-list-label">'.$arTemplate["NAME"]."</label>";
$this->content .= "</div>";
}
$this->content .= "</div>";
$this->content .= '<sc ript>
function ImgShw(ID, width, height, alt)
{
var scroll = "no";
var top=0, left=0;
if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
width = Math.min(width, screen.width-10);
height = Math.min(height, screen.height-28);
var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
wnd.document.write(
"<ht ml><head>"+
"<"+"script type=\"text/javascript\">"+
"function KeyPress()"+
"{"+
" if(window.event.keyCode == 27) "+
" window.close();"+
"}"+
"</"+"script>"+
"<title></title></head>"+
"<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" on KeyPress=\"KeyPress()\">"+
"<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\" />"+
"</body></html>"
);
wnd.document.close();
}
</sc ript>';
}
}
class SelectThemeStep extends CSelectThemeWizardStep
{
function InitStep()
{
//$this->SetPrevStep("welcome_step");
// $this->SetNextStep("data_install");
// $this->SetNextCaption(GetMessage("NEXT_BUTTON"));
parent::InitStep();
}
function OnPostForm()
{
parent::OnPostForm();
}
function ShowStep()
{
parent::ShowStep();
}
}
class SiteSettingsStep extends CSiteSettingsWizardStep
{
function InitStep()
{
$wizard =& $this->GetWizard();
$wizard->solutionName = "coderoid_solution";
parent::InitStep();
$this->SetNextCaption(GetMessage("NEXT_BUTTON"));
$this->SetTitle(GetMessage("WIZ_STEP_SITE_SET"));
$siteID = $wizard->GetVar("siteID");
$this->SetNextStep("data_install");
$wizard->SetVar("locations_csv", "loc_ussr.csv");
$wizard->SetVar("personType", Array(
"fiz" => "Y",
"ur" => "Y",
));
$wizard->SetVar("paysystem", Array(
"cash" => "Y",
"sber" => "Y",
"bill" => "Y",
"collect" => "Y" //cash on delivery
));
$wizard->SetVar("delivery", Array(
"courier" => "Y",
"self" => "Y",
"russianpost" => "N",
"rus_post" => "N",
"rus_post_first" => "N",
"ua_post" => "N",
"kaz_post" => "N"
));
$wizard->SetVar("shopLocalization", "ru");
}
function ShowStep()
{
$wizard =& $this->GetWizard();
$this->content .= '<div class="wizard-input-form">';
/*---*/
$firstStep = COption::GetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), false, $wizard->GetVar("siteID"));
//install Demo data
// if($firstStep == "Y")
// {
$this->content .= '
<div class="wizard-input-form-block"'.(LANGUAGE_ID != "ru" ? ' style="display:none"' : '').'>
'.$this->ShowCheckboxField(
"installDemoData",
"Y",
(array('checked' => 'checked', "id" => "installDemoData", "onClick" => "if(this.checked == true){document.getElementById('bx_metadata').style.display='block';}else{document.getElementById('bx_metadata').style.display='none';}"))
).'
<label for="installDemoData">'.GetMessage("wiz_structure_data").'</label>
</div>';
// }
// else
// {
// $this->content .= $this->ShowHiddenField("installDemoData","Y");
// }
$this->content .= '</div>';
}
function OnPostForm()
{
$wizard =& $this->GetWizard();
$res = $this->SaveFile("siteLogo", Array("extensions" => "gif,jpg,jpeg,png", "max_height" => 40, "max_width" => 280, "make_preview" => "Y"));
}
}
class DataInstallStep extends CDataInstallWizardStep
{
function CorrectServices(&$arServices)
{
if($_SESSION["BX_ESHOP_LOCATION"] == "Y")
$this->repeatCurrentService = true;
else
$this->repeatCurrentService = false;
$wizard =& $this->GetWizard();
if($wizard->GetVar("installDemoData") != "Y")
{
}
}
}
class FinishStep extends CFinishWizardStep
{
function InitStep()
{
$this->SetStepID("finish");
$this->SetNextStep("finish");
$this->SetTitle(GetMessage("FINISH_STEP_TITLE"));
$this->SetNextCaption(GetMessage("wiz_go"));
}
function ShowStep()
{
$wizard =& $this->GetWizard();
if ($wizard->GetVar("proactive") == "Y")
COption::SetOptionString("statistic", "DEFENCE_ON", "Y");
$siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID"));
$rsSites = CSite::GetByID($siteID);
$siteDir = "/";
if ($arSite = $rsSites->Fetch())
$siteDir = $arSite["DIR"];
$wizard->SetFormActionScript(str_replace("//", "/", $siteDir."/?finish"));
$this->CreateNewIndex();
COption::SetOptionString("main", "wizard_solution", $wizard->solutionName, false, $siteID);
$this->content .= GetMessage("FINISH_STEP_CONTENT");
if ($wizard->GetVar("installDemoData") == "Y")
$this->content .= GetMessage("FINISH_STEP_REINDEX");
}
}
?>
|