Current Path : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/wizards/bitrix/government/ |
Current File : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/wizards/bitrix/government/wizard.php |
<?require_once($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/install/wizard_sol/wizard.php"); require_once("scripts/utils.php"); // Âåëêàì class WelcomeStep extends CWizardStep { function InitStep() { $this->SetTitle(GetMessage("WELCOME_STEP_TITLE")); $this->SetStepID("welcome_step"); $this->SetNextStep("select_type"); $this->SetNextCaption(GetMessage("NEXT_BUTTON")); $wizard =& $this->GetWizard(); $wizard->solutionName = "gossite"; } function ShowStep() { $id = 'bitrix.gossite'; $className = str_replace(".", "_", $id); $wizard =& $this->GetWizard(); $arModules = array(); function OnModuleInstalledEvent($id) { $db_events = GetModuleEvents("main", "OnModuleInstalled"); while ($arEvent = $db_events->Fetch()) ExecuteModuleEventEx($arEvent, array($id)); } if(file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$id."/install/index.php")) { include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$id."/install/index.php"); $obModule = new $className; if(!$obModule->IsInstalled()) { OnModuleInstalledEvent($id); if ($obModule->InstallDB()) { $obModule->InstallEvents(); $obModule->InstallFiles(); } } $this->content .= GetMessage("WELCOME_TEXT"); if (defined("WIZARD_DEFAULT_SITE_ID")) { $wizard =& $this->GetWizard(); $wizard->SetVar("siteID",WIZARD_DEFAULT_SITE_ID); $installed=COption::GetOptionString('bitrix.gossite', 'installed',"",WIZARD_DEFAULT_SITE_ID); if ($installed=="Y") { $wizard->SetVar("WIZARD_IS_RERUN",true); define("WIZARD_REINSTALL", true); define("WIZARD_IS_RERUN", true); } else { $wizard->SetVar("WIZARD_IS_RERUN",false); define("WIZARD_REINSTALL", false); define("WIZARD_IS_RERUN", false); } } else { if($_SERVER["PHP_SELF"] != "/index.php") { $this->content .= '<br/><br/>'.GetMessage("SELECT_SITE")."<br/><br/>"; $this->content .= '<table width="100%" cellspacing="4" cellpadding="8">'; $rsSites = CSite::GetList($by="sort", $order="asc", Array()); while ($arSite = $rsSites->Fetch()) { if ($arSite['DEF'] == "Y") { $defaultSiteId = $arSite['ID']; $wizard->SetDefaultVar("siteID", $defaultSiteId); } $this->content .= "<tr>"; $this->content .= "<td valign=\"top\">".$this->ShowRadioField("siteID", $arSite['ID'], Array("id" => $arSite['ID']))."</td>"; $this->content .= '<td valign="top" width="100%"><label for="'.$arSite['ID'].'">'.$arSite['NAME']."</label></td>"; $this->content .= "</tr>"; $this->content .= "<tr><td><br /></td></tr>"; } $this->content .= "</table>"; } else { $wizard->SetVar("WIZARD_IS_RERUN",false); define("WIZARD_REINSTALL", false); define("WIZARD_IS_RERUN", false); } } } else { $this->SetStepID("finish"); $this->SetNextStep("finish"); $this->SetTitle(GetMessage("ERROR_STEP")); $this->SetNextCaption(GetMessage("wiz_go")); $wizard =& $this->GetWizard(); $this->content .= '<span style="color:red; text-width:bold;">'.GetMessage("MODULE_NO_EXISTS").'</span>'; $wizard->SetFormActionScript("/"); } } function OnPostForm() { $wizard =& $this->GetWizard(); if ($wizard->IsNextButtonClick()) { $siteID = $wizard->GetVar("siteID"); if (!$siteID) $this->SetError(GetMessage("wiz_site_error")); else { $installed=COption::GetOptionString('bitrix.gossite', 'installed',"",$siteID); if ($installed=="Y") { $wizard->SetVar("WIZARD_IS_RERUN",true); define("WIZARD_REINSTALL", true); define("WIZARD_IS_RERUN", true); $wizard->SetCurrentStep("select_template"); } else { $wizard->SetVar("WIZARD_IS_RERUN",false); define("WIZARD_REINSTALL", false); define("WIZARD_IS_RERUN", false); } } } } } // Òèï ïîðòàëà (äåìî-äàííûå) class SelectTypeStep extends CWizardStep { function InitStep() { $this->SetStepID("select_type"); $this->SetTitle(GetMessage("SELECT_TYPE_TITLE")); $this->SetSubTitle(GetMessage("SELECT_TYPE_SUBTITLE")); $this->SetPrevStep("welcome_step"); $this->SetNextStep("select_template"); $this->SetNextCaption(GetMessage("NEXT_BUTTON")); $this->SetPrevCaption(GetMessage("PREVIOUS_BUTTON")); } function OnPostForm() { $wizard =& $this->GetWizard(); if ($wizard->IsNextButtonClick()) { $typeID = $wizard->GetVar("typeID"); if (strlen($typeID) == 0) $this->SetError(GetMessage("wiz_type")); } } function ShowStep() { $wizard =& $this->GetWizard(); $this->content .= GetMessage("SELECT_TYPE_TEXT"); $this->content .= '<table width="100%" cellspacing="4" cellpadding="8">'; $arDemoTypes = array( "demo_mo" => GetMessage("SELECT_TYPE_MO"), //"<b>Ñàéò îðãàíà ìåñòíîãî ñàìîóïðàâëåíèÿ ìóíèöèïàëüíîãî îáðàçîâàíèÿ</b><br /><i>(íà ïðèìåðå àäìèíèñòðàöèè ãîðîäà)</i>", "demo_po" => GetMessage("SELECT_TYPE_PO"), //"<b>Ñàéò îðãàíà âëàñòè ñóáúåêòà ÐÔ</b><br /><i>(íà ïðèìåðå ïðàâèòåëüñòâà îáëàñòè)</i>", "demo_zso" => GetMessage("SELECT_TYPE_ZSO"), //"<b>Ñàéò çàêîíîäàòåëüíîãî îðãàíà âëàñòè ñóáúåêòà ÐÔ</b><br /><i>(íà ïðèìåðå îáëàñòíîé äóìû)</i>", "demo_gd" => GetMessage("SELECT_TYPE_GD"), //"<b>Ñàéò çàêîíîäàòåëüíîãî îðãàíà ìåñòíîãî ñàìîóïðàâëåíèÿ</b><br /><i>(íà ïðèìåðå ãîðîäñêîé äóìû)</i>", "demo_progr" => GetMessage("SELECT_TYPE_PROGR"), //"<b>Ñàéò ïðîåêòà èëè öåëåâîé ïðîãðàììû</b><br /><i>(ðåàëèçóåìîé ãîñóäàðñòâåííîé îðãàíèçàöèåé)</i>", "demo_prokuratura" => GetMessage("SELECT_TYPE_PROKURATURA"), //"<b>Ñàéò ñèëîâîãî âåäîìñòâà</b><br /><i>(íà ïðèìåðå ïðîêóðàòóðû îáëàñòè)</i>", "demo_zags" => GetMessage("SELECT_TYPE_ZAGS"), //"<b>Ñàéò òåððèòîðèàëüíî-ðàñïðåäåëåííîé îðãàíèçàöèè</b><br /><i>(íà ïðèìåðå îðãàíîâ ÇÀÃÑ)</i>", "demo_dep" => GetMessage("SELECT_TYPE_DEP"), //"<b>Ñàéò ãîñóäàðñòâåííîãî ó÷ðåæäåíèÿ èëè ïðåäïðèÿòèÿ</b><br /><i>(ÃÓÏ, ÌÓÏ, íà ïðèìåðå ãîñóäàðñòâåííîãî ïðåäïðèÿòèÿ)</i>", "demo_pov" => GetMessage("SELECT_TYPE_POV"), //"<b>Ñàéò ïîäðàçäåëåíèÿ îðãàíà âëàñòè</b><br /><i>(íà ïðèìåðå äåïàðòàìåíòà ýíåðãåòèêè)</i>", ); $defaultTypeId = "demo_mo"; if (strlen($defaultTypeId) > 0 && array_key_exists($defaultTypeId, $arDemoTypes)) $wizard->SetDefaultVar("typeID", $defaultTypeId); else $defaultTypeId = ""; foreach ($arDemoTypes as $typeId => $typeName) { if ($defaultTypeId == "") { $defaultTypeId = $typeId; $wizard->SetDefaultVar("typeID", $defaultTypeId); } $this->content .= "<tr>"; $this->content .= "<td valign=\"top\">".$this->ShowRadioField("typeID", $typeId, Array("id" => $typeId))."</td>"; $this->content .= '<td valign="top" width="100%"><label for="'.$typeId.'">'.$typeName."</label></td>"; $this->content .= "</tr>"; $this->content .= "<tr><td><br /></td></tr>"; } $this->content .= "</table>"; } } class SelectTemplateStep extends CWizardStep { function InitStep() { $wizard =& $this->GetWizard(); $this->SetStepID("select_template"); $this->SetTitle(GetMessage("SELECT_TEMPLATE_TITLE")); $this->SetSubTitle(GetMessage("SELECT_TEMPLATE_SUBTITLE")); if ($wizard->GetVar("WIZARD_IS_RERUN")) $this->SetPrevStep("welcome_step"); else $this->SetPrevStep("select_type"); $this->SetNextStep("select_theme"); $this->SetNextCaption(GetMessage("NEXT_BUTTON")); $this->SetPrevCaption(GetMessage("PREVIOUS_BUTTON")); } function OnPostForm() { $wizard =& $this->GetWizard(); if ($wizard->IsNextButtonClick()) { $templatesPath = GosWizardServices::GetTemplatesPath($wizard->GetPath()."/site"); $arTemplates = GosWizardServices::GetTemplates($templatesPath); $templateID = $wizard->GetVar("templateID"); if (!array_key_exists($templateID, $arTemplates)) $this->SetError(GetMessage("wiz_template")); } } function ShowStep() { $wizard =& $this->GetWizard(); $wizPath= $_SERVER['DOCUMENT_ROOT'].$wizard->GetPath(); $templatesPath = GosWizardServices::GetTemplatesPath($wizard->GetPath()."/site"); $arTemplates = GosWizardServices::GetTemplates($templatesPath,$wizPath); if (empty($arTemplates)) return; $templateID = $wizard->GetVar("templateID"); if(isset($templateID) && array_key_exists($templateID, $arTemplates)){ $defaultTemplateID = $templateID; $wizard->SetDefaultVar("templateID", $templateID); } else { $defaultTemplateID = COption::GetOptionString("main", "wizard_template_id", "", $wizard->GetVar("siteID")); if (empty($defaultTemplateID)) $defaultTemplateID = COption::GetOptionString("main", "wizard_template_id", ""); if (!(strlen($defaultTemplateID) > 0 && array_key_exists($defaultTemplateID, $arTemplates))) { if (strlen($defaultTemplateID) > 0 && array_key_exists($defaultTemplateID, $arTemplates)) $wizard->SetDefaultVar("templateID", $defaultTemplateID); else $defaultTemplateID = ""; } } $this->content = '<script type="text/javascript"> function SelectTemplate(element, solutionId) { var container = document.getElementById("solutions-container"); var anchors = container.getElementsByTagName("DIV"); for (var i = 0; i < anchors.length; i++) { anchors[i].children[0].checked=false; } element.children[0].checked=true; } </script>'; $this->content .= '<div id="solutions-container" class="inst-template-list-block">'; foreach ($arTemplates as $templateID => $arTemplate) { if ($defaultTemplateID == "") { $defaultTemplateID = $templateID; $wizard->SetDefaultVar("templateID", $defaultTemplateID); } $this->content .= "<div class=\"inst-template-description\" onclick=\"SelectTemplate(this, '".$templateID."');\">"; $arAttributes = Array("id" => $templateID, "class" => "inst-template-list-inp"); if ($templateID == $defaultTemplateID) $arAttributes['checked'] = 'Y'; $this->content .= $this->ShowRadioField("templateID", $templateID, $arAttributes); 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"].'<p>'.$arTemplate["DESCRIPTION"].'</p></label>'; $this->content .= "</div>"; } $this->content .= '</div>'; } } // Öâåòîâàÿ ñõåìà class SelectThemeStep extends CWizardStep { function InitStep() { $this->SetStepID("select_theme"); $this->SetTitle(GetMessage("SELECT_THEME_TITLE")); $this->SetSubTitle(GetMessage("SELECT_THEME_SUBTITLE")); $this->SetPrevStep("select_template"); $this->SetNextStep("site_settings"); $this->SetNextCaption(GetMessage("NEXT_BUTTON")); $this->SetPrevCaption(GetMessage("PREVIOUS_BUTTON")); } function OnPostForm() { $wizard =& $this->GetWizard(); if ($wizard->IsNextButtonClick()) { $templateID = $wizard->GetVar("templateID"); $themeVarName = $templateID."_themeID"; $themeID = $wizard->GetVar($themeVarName); $templatesPath = GosWizardServices::GetTemplatesPath($wizard->GetPath()."/site"); $arThemes = GosWizardServices::GetThemes($templatesPath."/".$templateID."/themes"); if (!array_key_exists($themeID, $arThemes)) $this->SetError(GetMessage("wiz_template_color")); } } function ShowStep() { $wizard =& $this->GetWizard(); $templateID = $wizard->GetVar("templateID"); $templatesPath = GosWizardServices::GetTemplatesPath($wizard->GetPath()."/site"); $arThemes = GosWizardServices::GetThemes($templatesPath."/".$templateID."/themes"); if (empty($arThemes)) return; $themeVarName = $templateID."_themeID"; $ThemeID = $wizard->GetVar($templateID."_themeID"); if(isset($ThemeID) && array_key_exists($ThemeID, $arThemes)){ $defaultThemeID = $ThemeID; $wizard->SetDefaultVar($themeVarName, $ThemeID); } else { $defaultThemeID = COption::GetOptionString("main", "wizard_".$templateID."_theme_id", "", $wizard->GetVar("siteID")); if (!(strlen($defaultThemeID) > 0)) $defaultThemeID = COption::GetOptionString("main", "wizard_".$templateID."_theme_id", ""); if (!(strlen($defaultThemeID) > 0 && array_key_exists($defaultThemeID, $arThemes))) { $defaultThemeID = COption::GetOptionString("main", "wizard_".$templateID."_theme_id", ""); if (strlen($defaultThemeID) > 0 && array_key_exists($defaultThemeID, $arThemes)) $wizard->SetDefaultVar($themeVarName, $defaultThemeID); else $defaultThemeID = ""; } } $this->content = '<script type="text/javascript"> function SelectTheme(element, solutionId, imageUrl) { var container = document.getElementById("solutions-container"); var anchors = container.getElementsByTagName("TD"); for (var i = 0; i < anchors.length; i++) { anchors[i].className = "inst-template-color"; } element.className = "inst-template-color inst-template-color-selected"; var hidden = document.getElementById("selected-solution"); if (!hidden) { hidden = document.createElement("INPUT"); hidden.type = "hidden" hidden.id = "selected-solution"; hidden.name = "selected-solution"; container.appendChild(hidden); } hidden.value = solutionId; var preview = document.getElementById("solution-preview"); if (!imageUrl) preview.style.display = "none"; else { document.getElementById("solution-preview-image").src = imageUrl; preview.style.display = ""; } } </script>'. '<div id="html_container">'. '<div class="inst-template-color-block" id="solutions-container">'; $ii = 0; $arDefaultTheme = array(); $this->content .= '<table width="100%" cellspacing="4" cellpadding="8">'; $arTitle = '<tr>'; $arPreview = '<tr>'; foreach ($arThemes as $themeID => $arTheme) { if ($defaultThemeID == "") { $defaultThemeID = $themeID; $wizard->SetDefaultVar($themeVarName, $defaultThemeID); } if ($defaultThemeID == $themeID) $arDefaultTheme = $arTheme; $ii++; $this->content .= ' <td style="width:30%" class="inst-template-color'.($defaultThemeID == $themeID ? " inst-template-color-selected" : "").'" ondblclick="SubmitForm(\'next\');" onmousedown="SelectTheme(this, \''.$themeID.'\', \''.$arTheme["SCREENSHOT"].'\');"> <span class="inst-templ-color-img">'; if ($arTheme["PREVIEW"]) $this->content .= CFile::ShowImage($arTheme["PREVIEW"], 70, 70, ' border="0" class="solution-image"'); else $this->content .= CFile::ShowImage($arTheme["SCREENSHOT"], 70, 70, ' border="0" class="solution-image"'); $this->content .= '</span> <span class="inst-templ-color-name">'.$arTheme["NAME"].'</span> </td>'; if ($ii==3) { $this->content .= $arPreview.'</tr>'; $this->content .= $arTitle.'</tr>'; $arTitle = '<tr>'; $arPreview = '<tr>'; $ii=0; } } $this->content .= $arPreview.'</tr>'; $this->content .= $arTitle.'</tr>'; $this->content .= "</table>"; $this->content .= $this->ShowHiddenField($themeVarName, $defaultThemeID, array("id" => "selected-solution")); $this->content .= '</div>'. '<div id="solution-preview">'. '<b class="r3"></b><b class="r1"></b><b class="r1"></b>'. '<div class="solution-inner-item">'. CFile::ShowImage($arDefaultTheme["SCREENSHOT"], 450, 450, ' border="0" id="solution-preview-image"'). '</div>'. '<b class="r1"></b><b class="r1"></b><b class="r3"></b>'. '</div>'. '</div>'; }} class SiteSettingsStep extends CWizardStep { function SaveCoat($name, $arRestriction = Array()) { $wizard =& $this->GetWizard(); $deleteFile = $wizard->GetVar($name."_del"); $wizard->UnSetVar($name."_del"); $oldFileID = $wizard->GetVar($name); $fileNew = $wizard->GetRealName($name."_new"); COption::SetOptionString('seo', 'counters',$wizard->GetVar('counter')); COption::SetOptionString('bitrix.gossite', 'indexpage',$wizard->GetVar('indexpage'),$wizard->GetVar("siteID"),$wizard->GetVar("siteID")); if($wizard->GetVar('show_link_map')=="Y") COption::SetOptionString('bitrix.gossite', 'show_link_map',"Y",$wizard->GetVar("siteID"),$wizard->GetVar("siteID")); else COption::SetOptionString('bitrix.gossite', 'show_link_map',"N",$wizard->GetVar("siteID"),$wizard->GetVar("siteID")); if (!array_key_exists($fileNew, $_FILES) || (strlen($_FILES[$fileNew]["name"]) <= 0 && $deleteFile === null)) return; if (strlen($_FILES[$fileNew]["tmp_name"]) <= 0 && $deleteFile === null) { $this->SetError(GetMessage("MAIN_WIZARD_FILE_UPLOAD_ERROR"), $name."_new"); return; } $arFile = $_FILES[$fileNew] + Array( "del" => ($deleteFile == "Y" ? "Y" : ""), "old_file" => (intval($oldFileID) > 0 ? intval($oldFileID): 0 ), "MODULE_ID" => "tmp_wizard" ); $max_file_size = (array_key_exists("max_file_size", $arRestriction) ? intval($arRestriction["max_file_size"]) : 0); $max_width = (array_key_exists("max_width", $arRestriction) ? intval($arRestriction["max_width"]) : 0); $max_height = (array_key_exists("max_height", $arRestriction) ? intval($arRestriction["max_height"]) : 0); $extensions = (array_key_exists("extensions", $arRestriction) && strlen($arRestriction["extensions"]) > 0 ? trim($arRestriction["extensions"]) : false); $error = CFile::CheckFile($arFile, $max_file_size, false, $extensions); if (strlen($error)>0) { $this->SetError($error, $name."_new"); return; } if ($max_width > 0 || $max_height > 0) { $error = CFile::CheckImageFile($arFile, $max_file_size, $max_width, $max_height); if (strlen($error)>0) { $this->SetError($error, $name."_new"); return; } } $this->SaveFile("siteCoatUser", Array("extensions" => "png")); $fileID = $wizard->GetVar("siteCoatUser"); $arFile = CFile::GetFileArray($fileID); if ($arFile['SRC']) $wizard->SetVar("siteCoatSrc", $arFile['SRC']); else $wizard->UnSetVar("siteCoatSrc"); return true; } function InitStep() { $this->SetStepID("site_settings"); $this->SetTitle(GetMessage("wiz_settings")); $this->SetSubTitle(GetMessage("wiz_settings")); $wizard =& $this->GetWizard(); $typeID = $wizard->GetVar("typeID"); if(!$typeID) $typeID=COption::GetOptionString("bitrix.gossite", "demo_type","",$wizard->GetVar("siteID")); $showMobile=array("demo_mo", "demo_po", "demo_gd", "demo_zso"); $this->SetNextCaption(GetMessage("wiz_install")); $this->SetNextStep("data_install"); $this->SetPrevStep("select_theme"); $this->SetPrevCaption(GetMessage("PREVIOUS_BUTTON")); $wizard =& $this->GetWizard(); $wizard->SetDefaultVars( Array( "siteText1" => COption::GetOptionString("bitrix.gossite", "text1", GetMessage("wiz_default_text1_" . $wizard->GetVar("typeID")),$wizard->GetVar("siteID")), "siteText2" => COption::GetOptionString("bitrix.gossite", "text2", GetMessage("wiz_default_text2"),$wizard->GetVar("siteID")), "map_city" => COption::GetOptionString("bitrix.gossite", "map_city", GetMessage("wiz_default_map_city"),$wizard->GetVar("siteID")), "siteCoat" => COption::GetOptionString("bitrix.gossite", "coat", "/upload/coats/unknown.png", $wizard->GetVar("siteID")), "siteRegion" => COption::GetOptionString("bitrix.gossite", "region", 43,$wizard->GetVar("siteID")), "installDemoData" => COption::GetOptionString("main", "wizard_demo_data", "Y",$wizard->GetVar("siteID")), ) ); } function OnPostForm() { $this->SaveCoat("siteCoatUser", Array("extensions" => "png", "max_height" => 70, "max_width" => 70, "make_preview" => "N")); } function ShowStep() { $wizard =& $this->GetWizard(); $this->content .= '<table width="100%" cellspacing="0" cellpadding="0">'; $this->content .= '<tr><td>'; $this->content .= '<label for="site-text1">'.GetMessage("wiz_site_text1").'</label><br />'; $this->content .= $this->ShowInputField("text", "siteText1", Array("id" => "site-text1", "style" => "width:90%")); $this->content .= '</tr></td>'; $this->content .= '<tr><td><br /></td></tr>'; $this->content .= '<tr><td>'; $this->content .= '<label for="site-text2">'.GetMessage("wiz_site_text2").'</label><br />'; $this->content .= $this->ShowInputField("text", "siteText2", Array("id" => "site-text2", "style" => "width:90%")); $this->content .= '</tr></td>'; $this->content .= '<tr><td><br /></td></tr>'; $this->content .= '<tr><td>'; $this->content .= '<label for="site-text2">'.GetMessage("wiz_map_city").'</label> (<span style="cursor:pointer;text-decoration:underline;color:blue;" onclick="showWhatIsIt(\'map_city\');">'.GetMessage("what_is_it").'</span>)<br />'; $this->content .= '<div id="whatIsIt_map_city" style="display:none;margin-top:10px;width:90%">'.GetMessage("what_is_it_map_city").'</div> <br />'; $this->content .= $this->ShowInputField("text", "map_city", Array("id" => "site-text2", "style" => "width:90%")); $this->content .= '</tr></td>'; $this->content .= '<tr><td><br /></td></tr>'; $coatFilename = COption::GetOptionString("bitrix.gossite", "coat", "",$wizard->GetVar("siteID")); if (strlen($coatFilename) > 0) { $wizard->SetVar("siteCoat", $coatFilename); } else { $wizard->SetVar("siteCoat", "/upload/coats/unknown.png"); } $siteCoat = $wizard->GetVar("siteCoat"); $this->content .= '<tr><td>'; $this->content .= '<label for="site-coat"> '.GetMessage("wiz_site_coat").'</label><br />'; $this->content .= '<a href="/bitrix/wizards/bitrix/government/coat-popup.php?SID='.$wizard->GetVar("siteID").'" onclick="popup(this);return false;">'.CFile::ShowImage($siteCoat, 48, 56, "border=0 id='site-coat-image' style='vertical-align:middle;margin-right:6px;'", "", true).GetMessage("wiz_select coat").'</a>'; $this->content .= $this->ShowHiddenField("siteCoatSrc", $siteCoat, Array("id" => "site-coat-src")); $this->content .= '</td></tr>'; $this->content .= '<tr><td><br /></td></tr>'; $this->content .= '<tr><td>'; $this->content .= '<label for="site-coat-user">'.GetMessage("wiz_site_coat_download").'</label><br />'; $this->content .= $this->ShowFileField("siteCoatUser", Array("show_file_info" => "N", "id" => "site-coat-user")); $this->content .= '</td></tr>'; $this->content .= '<tr><td><br /></td></tr>'; $arRegions = array( 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', 13 => '13', 14 => '14', 15 => '15', 16 => '16', 17 => '17', 18 => '18', 19 => '19', 20 => '20', 21 => '21', 22 => '22', 23 => '23', 24 => '24', 25 => '25', 26 => '26', 27 => '27', 28 => '28', 29 => '29', 30 => '30', 31 => '31', 32 => '32', 33 => '33', 34 => '34', 35 => '35', 36 => '36', 37 => '37', 38 => '38', 39 => '39', 40 => '40', 41 => '41', 42 => '42', 43 => '43', 44 => '44', 45 => '45', 46 => '46', 47 => '47', 48 => '48', 49 => '49', 50 => '50', 51 => '51', 52 => '52', 53 => '53', 54 => '54', 55 => '55', 56 => '56', 57 => '57', 58 => '58', 59 => '59', 60 => '60', 61 => '61', 62 => '62', 63 => '63', 64 => '64', 65 => '65', 66 => '66', 67 => '67', 68 => '68', 69 => '69', 70 => '70', 71 => '71', 72 => '72', 73 => '73', 74 => '74', 75 => '75', 76 => '76', 77=> '77', 78=> '78', 79 => '79', 82 => '82', 83 => '83', 86 => '86', 87 => '87', 89 => '89', ); foreach ($arRegions as $i => $arRegionItem) { $arRegions[$i] = $i . ' - ' . GetMessage("wiz_region_" . $i); } $siteCoat = $wizard->GetVar("siteRegion"); $this->content .= '<tr><td>'; $this->content .= '<label for="site-region"> '.GetMessage("wiz_site_region").'</label><br />'; $this->content .= $this->ShowSelectField("siteRegion", $arRegions, Array("id" => "site-region")); $this->content .= '</td></tr>'; $this->content .= '<tr><td> </td></tr>'; if($wizard->GetVar("templateID")!="gos_bitrix" && $wizard->GetVar("templateID")!="stern") { $this->content .= '<tr><td>'; $this->content .= $this->ShowCheckboxField( "indexpage", "Y", (array("id" => "index-page", "style"=>'float:left;')) ); $this->content .= '<label for="index-page" style="float: left; width: 410px; margin-left: 5px;">'.GetMessage("index_page").'</label><div style="clear:both;"></div>'; $this->content .= '</td></tr>'; $this->content .= '<tr><td> </td></tr>'; } if($wizard->GetVar("templateID")=="stern") { $this->content .= '<tr><td>'; $this->content .= $this->ShowCheckboxField( "show_link_map", "Y", (array("id" => "show_link_map", "style"=>'float:left;')) ); $this->content .= '<label for="show_link_map" style="float: left; width: 410px; margin-left: 5px;">'.GetMessage("show_link_map").'</label><div style="clear:both;"></div>'; $this->content .= '</td></tr>'; $this->content .= '<tr><td> </td></tr>'; } $this->content .= '<tr><td>'; $this->content .= '<script type="text/javascript"> function showWhatIsIt(index) { var id = "whatIsIt"; if (index!="") id = id+"_"+index; var el=document.getElementById(id); if(el.style.display=="none") el.style.display="block"; else el.style.display="none"; } </script> <label for="index-page">'.GetMessage("counter").'</label>(<span style="cursor:pointer;text-decoration:underline;color:blue;" onclick="showWhatIsIt(\'\');">'.GetMessage("what_is_it").'</span>) <div id="whatIsIt" style="display:none;margin-top:10px;width:90%">'.GetMessage("what_is_it_text").'</div> <br />'; $this->content .= $this->ShowInputField("textarea", "counter", Array("id" => "counter", "style" => "width:90%", "rows" => "7", "cols" => "50")); $this->content .= '</td></tr>'; $this->content .= '<tr><td> </td></tr>'; if($wizard->GetVar("WIZARD_IS_RERUN")!==true) { $this->content .= '<tr><td> </td></tr>'; $this->content .= '<tr><td style="padding-bottom:5px;font-weight:700;">'.GetMessage("wiz_demo_support").'</td></tr>'; $this->content .= '<tr><td style="padding-bottom:3px;">'; $this->content .= $this->ShowCheckboxField("installSupport", "Y", Array("id" => "install-support", "onchange" => "OnChangeSupport(this)")); $this->content .= '<label for="install-support">'.GetMessage("wiz_demo_support_install").'</label><br />'; $this->content .= '</td></tr>'; $this->content .= '<tr id="support_row0" style="display:none;"><td><div style="background-color:#FEFBDB;border:1px solid #EAE9D5;margin:6px 2px;padding:10px 16px;font-size:11px;">'.GetMessage("wiz_demo_support_warning").'</div></td></tr>'; $this->content .= '<tr id="support_row1" style="display:none;"><td style="padding-left:20px;">'; $this->content .= '<label for="support-server">'.GetMessage("wiz_demo_support_server").'</label><br />'; $this->content .= $this->ShowInputField("text", "supportServer", Array("id" => "support-server", "style" => "width:50%")); $this->content .= '</tr></td>'; $this->content .= '<tr id="support_div1" style="display:none;"><td> </td></tr>'; $this->content .= '<tr id="support_row2" style="display:none;"><td style="padding-left:20px;">'; $this->content .= '<label for="support-port">'.GetMessage("wiz_demo_support_port").'</label><br />'; $this->content .= $this->ShowInputField("text", "supportPort", Array("id" => "support-port", "style" => "width:10%")); $this->content .= '</tr></td>'; $this->content .= '<tr id="support_div2" style="display:none;"><td> </td></tr>'; $this->content .= '<tr id="support_row3" style="display:none;"><td style="padding-left:20px;">'; $this->content .= '<label for="support-email">'.GetMessage("wiz_demo_support_email").'</label><br />'; $this->content .= $this->ShowInputField("text", "supportEMail", Array("id" => "support-email", "style" => "width:50%")); $this->content .= '</tr></td>'; $this->content .= '<tr id="support_div3" style="display:none;"><td> </td></tr>'; $this->content .= '<tr id="support_row4" style="display:none;"><td style="padding-left:20px;">'; $this->content .= '<label for="support-login">'.GetMessage("wiz_demo_support_login").'</label><br />'; $this->content .= $this->ShowInputField("text", "supportLogin", Array("id" => "support-login", "style" => "width:50%")); $this->content .= '</tr></td>'; $this->content .= '<tr id="support_div4" style="display:none;"><td> </td></tr>'; $this->content .= '<tr id="support_row5" style="display:none;"><td style="padding-left:20px;">'; $this->content .= '<label for="support-password">'.GetMessage("wiz_demo_support_password").'</label><br />'; $this->content .= $this->ShowInputField("password", "supportPassword", Array("id" => "support-password", "style" => "width:50%")); $this->content .= '</tr></td>'; } $this->content .= "<tr><td><br /></td></tr>"; $this->content .= '</table>'; $formName = $wizard->GetFormName(); $installCaption = $this->GetNextCaption(); $nextCaption = GetMessage("NEXT_BUTTON"); if(WIZARD_IS_RERUN===true) { $this->content .= ' <script type="text/javascript"> function OnClickDemoData(checkbox) { if (checkbox.checked) checkbox.checked=confirm("'.GetMessage("wiz_galochka_structure").'"); } </script>'; } else { $this->content .= ' <script type="text/javascript"> function OnClickDemoData(checkbox) { if (checkbox.checked) checkbox.checked=confirm("'.GetMessage("wiz_galochka").'"); } </script>'; } $this->content .= ' <script type="text/javascript"> function popup(a) { settings = { width: 800, height: 480, toolbar: 0, scrollbars: 1, status: 0, resizable: 0, left: 200, top: 200, center: 0, createnew: 0, location: 0, menubar: 0 }; parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left + ",screenX=" + settings.left + ",top=" + settings.top + ",screenY=" + settings.top; window.open(a.href, "coat_selector", parameters).focus(); } </script>'; $this->content .= ' <script type="text/javascript"> function OnChangeSupport(checkbox) { if (!checkbox.checked) { document.getElementById("support_row0").style.display = "none"; document.getElementById("support_row1").style.display = "none"; document.getElementById("support_row2").style.display = "none"; document.getElementById("support_row3").style.display = "none"; document.getElementById("support_row4").style.display = "none"; document.getElementById("support_row5").style.display = "none"; document.getElementById("support_div1").style.display = "none"; document.getElementById("support_div2").style.display = "none"; document.getElementById("support_div3").style.display = "none"; document.getElementById("support_div4").style.display = "none"; } else { document.getElementById("support_row0").style.display = ""; document.getElementById("support_row1").style.display = ""; document.getElementById("support_row2").style.display = ""; document.getElementById("support_row3").style.display = ""; document.getElementById("support_row4").style.display = ""; document.getElementById("support_row5").style.display = ""; document.getElementById("support_div1").style.display = ""; document.getElementById("support_div2").style.display = ""; document.getElementById("support_div3").style.display = ""; document.getElementById("support_div4").style.display = ""; } } </script>'; } } class MobileVersionStep extends CWizardStep { function InitStep() { $this->SetStepID("mobile_version"); $this->SetTitle(GetMessage("MOBILE_VERSION_TITLE")); $this->SetSubTitle(GetMessage("MOBILE_VERSION_SUBTITLE")); $this->SetPrevStep("site_settings"); $this->SetNextStep("data_install"); $this->SetNextCaption(GetMessage("wiz_install")); $this->SetPrevCaption(GetMessage("PREVIOUS_BUTTON")); $wizard =& $this->GetWizard(); $alreadyInstalled=COption::GetOptionString("bitrix.gossite", "mobile_installed", "",$wizard->GetVar("siteID")); if($alreadyInstalled!=="Y") $wizard->SetDefaultVar("installMobile", "Y"); } function OnPostForm() { } function ShowStep() { $wizard =& $this->GetWizard(); $this->content .= $this->ShowCheckboxField( "installMobile", "Y", (array("id" => "installMobile", "style"=>'float:left;')) ); $this->content .= '<label for="installMobile" style="float: left; width: 410px; margin-left: 5px;">'; $alreadyInstalled=COption::GetOptionString("bitrix.gossite", "mobile_installed", "",$wizard->GetVar("siteID")); if($alreadyInstalled!="Y") $this->content .= GetMessage("installMobile"); else $this->content .= GetMessage("reinstallMobile"); $this->content .= '</label><div style="clear:both;"></div>'; if($alreadyInstalled=="Y") $this->content .= "<p style='color:red;'>".GetMessage("MOBILE_VERSION_ATTENTION")."</p>"; $this->content .= "<p>"; $this->content .= GetMessage("MOBILE_VERSION_TEXT"); $this->content .= "</p>"; $this->content .= '<table width="100%" cellspacing="4" cellpadding="8"> <tbody><tr>'; $this->content .= '<td><a href="/bitrix/wizards/bitrix/government/images/mobile/mobile1.jpg" target="_blank">'; $this->content .= '<img width="120" height="70" border="0" alt="" class="solution-image" src="/bitrix/wizards/bitrix/government/images/mobile/mobile1_s.jpg">'; $this->content .= '</a></td>'; $this->content .= '<td><a href="/bitrix/wizards/bitrix/government/images/mobile/mobile2.jpg" target="_blank">'; $this->content .= '<img width="120" height="160" border="0" alt="" class="solution-image" src="/bitrix/wizards/bitrix/government/images/mobile/mobile2_s.jpg">'; $this->content .= '</a></td>'; $this->content .= '<td><a href="/bitrix/wizards/bitrix/government/images/mobile/mobile3.jpg" target="_blank">'; $this->content .= '<img width="120" height="80" border="0" alt="" class="solution-image" src="/bitrix/wizards/bitrix/government/images/mobile/mobile3_s.jpg">'; $this->content .= '</a></td>'; $this->content .= '<td><a href="/bitrix/wizards/bitrix/government/images/mobile/mobile4.jpg" target="_blank">'; $this->content .= '<img width="120" height="80" border="0" alt="" class="solution-image" src="/bitrix/wizards/bitrix/government/images/mobile/mobile4_s.jpg">'; $this->content .= '</td>'; $this->content .= '</tr></tbody></table>'; } } class DataInstallStep extends CDataInstallWizardStep { function InitStep() { $this->SetStepID("data_install"); $this->SetTitle(GetMessage("wiz_install_data")); $this->SetSubTitle(GetMessage("wiz_install_data")); } function OnPostForm() { $wizard =& $this->GetWizard(); $serviceID = $wizard->GetVar("nextStep"); $serviceStage = $wizard->GetVar("nextStepStage"); if ($serviceID == "finish") { $wizard->SetCurrentStep("finish"); return; } $demoType = $wizard->GetVar("typeID"); if (empty($demoType)) $demoType = COption::GetOptionString('bitrix.gossite','demo_type','',$wizard->GetVar("siteID")); define("WIZARD_INSTALL_DEMO_TYPE", $demoType); define("WIZARD_INSTALL_MOBILE_VERSION", $wizard->GetVar("installMobile")); if(WIZARD_INSTALL_MOBILE_VERSION == "Y") { COption::SetOptionString("bitrix.gossite", "mobile_installed", "Y",$wizard->GetVar("siteID"),$wizard->GetVar("siteID")); } $arServices = WizardServices::GetServices($_SERVER["DOCUMENT_ROOT"].$wizard->GetPath(), "/site/services/"); if($wizard->GetVar("WIZARD_IS_RERUN")) { unset($arServices["users"]); unset($arServices["iblock_demo_data"]); if($wizard->GetVar("installStructureData")!="Y") { $s = Array(); foreach($arServices["main"]["STAGES"] as $v) if(!in_array($v, array("groups.php", "property.php", "options.php"))) $s[] = $v; $arServices["main"]["STAGES"] = $s; unset($arServices["files"]); unset($arServices["iblock"]); unset($arServices["advertising"]); unset($arServices["vote"]); unset($arServices["blog"]); unset($arServices["support"]); unset($arServices["workflow"]); unset($arServices["fileman"]); unset($arServices["statistic"]); } } if ($serviceStage == "skip") $success = true; else $success = $this->InstallService($serviceID, $serviceStage); list($nextService, $nextServiceStage, $stepsComplete, $status) = $this->GetNextStep($arServices, $serviceID, $serviceStage); if ($nextService == "finish") { $formName = $wizard->GetFormName(); $response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('".$nextService."', '".$nextServiceStage."','".$status."');"; } else { $arServiceID = array_keys($arServices); $lastService = array_pop($arServiceID); $stepsCount = $arServices[$lastService]["POSITION"]; if (array_key_exists("STAGES", $arServices[$lastService]) && is_array($arServices[$lastService])) $stepsCount += count($arServices[$lastService]["STAGES"])-1; $percent = round($stepsComplete/$stepsCount * 100); $response = "window.ajaxForm.SetStatus('".$percent."'); window.ajaxForm.Post('".$nextService."', '".$nextServiceStage."','".$status."');"; } die("[response]".$response."[/response]"); } function InstallService($serviceID, $serviceStage) { $wizard =& $this->GetWizard(); $siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID")); define("WIZARD_SITE_ID", $siteID); define("WIZARD_SITE_PATH", $_SERVER["DOCUMENT_ROOT"]); $rsSites = CSite::GetByID($siteID); if ($arSite = $rsSites->Fetch()) define("WIZARD_SITE_DIR", $arSite["DIR"]); else define("WIZARD_SITE_DIR", "/"); $wizardPath = $wizard->GetPath(); define("WIZARD_RELATIVE_PATH", $wizardPath); define("WIZARD_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"].$wizardPath); $templatesPath = GosWizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH."/site"); $templateID = $wizard->GetVar("templateID"); define("WIZARD_TEMPLATE_ID", $templateID); define("WIZARD_TEMPLATE_RELATIVE_PATH", $templatesPath."/".WIZARD_TEMPLATE_ID); define("WIZARD_TEMPLATE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"].WIZARD_TEMPLATE_RELATIVE_PATH); $themeID = $wizard->GetVar($templateID."_themeID"); $arThemes = WizardServices::GetThemes(WIZARD_TEMPLATE_RELATIVE_PATH."/themes"); define("WIZARD_THEME_ID", $themeID); define("WIZARD_THEME_RELATIVE_PATH", WIZARD_TEMPLATE_RELATIVE_PATH."/themes/".WIZARD_THEME_ID); define("WIZARD_THEME_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"].WIZARD_THEME_RELATIVE_PATH); $servicePath = WIZARD_RELATIVE_PATH."/site/services/".$serviceID; define("WIZARD_SERVICE_RELATIVE_PATH", $servicePath); define("WIZARD_SERVICE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"].$servicePath); define("WIZARD_IS_RERUN", $wizard->GetVar("WIZARD_IS_RERUN")); define("WIZARD_SITE_COAT", $wizard->GetVar("siteCoatSrc")); define("WIZARD_SITE_TEXT1", $wizard->GetVar("siteText1")); define("WIZARD_SITE_TEXT2", $wizard->GetVar("siteText2")); define("WIZARD_SITE_REGION", $wizard->GetVar("siteRegion")); define("WIZARD_SITE_MAP_CITY", $wizard->GetVar("map_city")); define("WIZARD_INSTALL_SUPPORT", $wizard->GetVar("installSupport") == "Y"); define("WIZARD_SUPPORT_SERVER", $wizard->GetVar("supportServer")); define("WIZARD_SUPPORT_PORT", $wizard->GetVar("supportPort")); define("WIZARD_SUPPORT_LOGIN", $wizard->GetVar("supportLogin")); define("WIZARD_SUPPORT_PASSWORD", $wizard->GetVar("supportPassword")); define("WIZARD_SUPPORT_EMAIL", $wizard->GetVar("supportEMail")); $dbUsers = CGroup::GetList($by="id", $order="asc", Array("ACTIVE" => "Y")); while($arUser = $dbUsers->Fetch()) define("WIZARD_".$arUser["STRING_ID"]."_GROUP", $arUser["ID"]); if (!file_exists(WIZARD_SERVICE_ABSOLUTE_PATH."/".$serviceStage)) return false; if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") { if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH."/lang/en/".$serviceStage)) __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH."/lang/en/".$serviceStage); } if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH."/lang/".LANGUAGE_ID."/".$serviceStage)) __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH."/lang/".LANGUAGE_ID."/".$serviceStage); @set_time_limit(3600); global $DB, $DBType, $APPLICATION, $USER, $CACHE_MANAGER; include(WIZARD_SERVICE_ABSOLUTE_PATH."/".$serviceStage); } } 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(); $siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID")); $rsSites = CSite::GetByID($siteID); if ($arSite = $rsSites->Fetch()) $dir=$arSite["DIR"]; else $dir="/"; $wizard->SetFormActionScript($dir."?finish"); $this->CreateNewIndex($dir); COption::SetOptionString('bitrix.gossite', 'installed',"Y",$wizard->GetVar("siteID"),$wizard->GetVar("siteID")); COption::SetOptionString("main", "wizard_solution", $wizard->solutionName, false, $siteID); $wizardPath = $wizard->GetPath(); CWizardUtil::ReplaceMacros($_SERVER["DOCUMENT_ROOT"].$wizardPath."/.description.php", array("not_installed" => "Y")); if (file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bitrix.gossite/_options.php')) { rename($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bitrix.gossite/_options.php',$_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/bitrix.gossite/options.php'); } $this->content .= GetMessage("FINISH_STEP_CONTENT"); } function CreateNewIndex($dir) { CopyDirFiles( $_SERVER["DOCUMENT_ROOT"].$dir."_index.php", $_SERVER["DOCUMENT_ROOT"].$dir."index.php", $rewrite = true, $recursive = true, $delete_after_copy = true ); } } ?>