<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Site\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Layout\AdminConfigBuilder; use ModStart\Admin\Layout\AdminDialogPage; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Util\CRUDUtil; use ModStart\Core\Util\SerializeUtil; use ModStart\Form\Form; use ModStart\ModStart; use ModStart\Support\Concern\HasFields; use Module\Vendor\Provider\SiteTemplate\SiteTemplateProvider; class ConfigController extends Controller { public static $PermitMethodMap = array('config' => 'setting'); public function config(AdminDialogPage $iXUoW) { goto H0Kds; zgEy0: $tDnAb->config($NX6uw); goto XPb1W; gUs4N: return $iXUoW->pageTitle('主题设置')->body($NX6uw)->handleForm($NX6uw, function (Form $NX6uw) { AdminPermission::demoCheck(); $MK0sx = modstart_config(); foreach ($NX6uw->dataForming() as $KAKiA => $Iim2u) { $MK0sx->set($KAKiA, $Iim2u); } return Response::redirect(CRUDUtil::jsDialogClose()); }); goto DXsg7; Q5ZmN: $NX6uw->fields()->each(function ($jJyrp) use(&$MK0sx, &$avcnU) { if ($MK0sx->has($jJyrp->name())) { $avcnU[$jJyrp->name()] = $MK0sx->get($jJyrp->name()); } else { $avcnU[$jJyrp->name()] = null; } }); goto BMQrQ; XPb1W: $MK0sx = modstart_config(); goto TnwyY; q6Gvz: BizException::throwsIfEmpty('请选择主题', $oqfDC); goto N3a7n; eF6j4: BizException::throwsIfEmpty('主题不存在', $tDnAb); goto gBCWE; N3a7n: $tDnAb = SiteTemplateProvider::get($oqfDC); goto eF6j4; gBCWE: $NX6uw = Form::make(''); goto zgEy0; eMc4C: $oqfDC = $Km8YS->getTrimString('template'); goto q6Gvz; gWky1: $NX6uw->showSubmit(false)->showReset(false); goto gUs4N; BMQrQ: $NX6uw->item($avcnU)->fillFields(); goto gWky1; H0Kds: $Km8YS = InputPackage::buildFromInput(); goto eMc4C; TnwyY: $avcnU = array(); goto Q5ZmN; DXsg7: } public function setting(AdminConfigBuilder $P2vse) { goto B3A_3; l4XHg: return $P2vse->perform(); goto hw11D; B3A_3: $P2vse->pageTitle('基本设置'); goto Jy63a; xkOSx: $P2vse->layoutPanel('备案信息', function ($P2vse) { $P2vse->text('siteBeian', 'ICP备案编号'); $P2vse->text('siteBeianGonganText', '公安备案文字'); $P2vse->text('siteBeianGonganLink', '公安备案链接'); $P2vse->textarea('Site_CopyrightOthers', '其他备案信息')->help('支持HTML'); }); goto Q49Gs; Jy63a: $P2vse->layoutPanel('网站信息', function ($P2vse) { $P2vse->image('siteLogo', '网站Logo'); $P2vse->text('siteName', '网站名称'); $P2vse->text('siteSlogan', '网站副标题'); $P2vse->text('siteDomain', '网站域名')->help('如 example.com'); $P2vse->text('siteUrl', '网站地址')->help('如 https://example.com 主要用于后台任务地址转换')->ruleRegex('/^https?:\\/\\/.+/'); $P2vse->text('siteKeywords', '网站关键词'); $P2vse->textarea('siteDescription', '网站描述'); $P2vse->image('siteFavIco', '网站ICO'); }); goto ZeAUI; Y8FKi: $P2vse->contentFixedBottomContentSave(); goto c7jpo; KQ36j: $P2vse->layoutPanel('其他配置', function ($P2vse) { $P2vse->complexFieldsList('Site_PublicInternalUrlMap', '存储节流映射')->fields(array(array('name' => 'public', 'title' => '外网地址', 'type' => 'text', 'defaultValue' => '', 'placeholder' => 'https://public.example.com', 'tip' => ''), array('name' => 'internal', 'title' => '内网地址', 'type' => 'text', 'defaultValue' => '', 'placeholder' => 'https://internal.example.com', 'tip' => '')))->help('在使用第三方存储时，程序拉取外网地址会造成流量浪费，使用此功能可将外网地址映射为内网地址，节省流量'); }); goto Y8FKi; c7jpo: $P2vse->disableBoxWrap(true); goto xBnpw; Q49Gs: $P2vse->layoutPanel('联系信息', function ($P2vse) { $P2vse->text('Site_ContactEmail', '邮箱'); $P2vse->text('Site_ContactPhone', '电话'); $P2vse->text('Site_ContactAddress', '地址'); $P2vse->image('Site_ContactQrcode', '联系二维码')->help('可传带二维码的公众号/微信/QQ等，方便用户扫码联系'); }); goto KQ36j; xBnpw: $P2vse->showReset(false)->showSubmit(false); goto l4XHg; ZeAUI: $P2vse->layoutPanel('主题设置', function ($P2vse) { $P2vse->color('sitePrimaryColor', '网站主色调'); $P2vse->select('siteTemplate', '网站主题')->options(SiteTemplateProvider::map())->help('<a href=\'javascript:;\' id=\'siteTemplateConfig\'><i class=\'iconfont icon-cog\'></i> 主题设置</a>'); $P42I2 = array(); foreach (SiteTemplateProvider::all() as $tDnAb) { $P42I2[$tDnAb->name()] = array('hasConfig' => $tDnAb->hasConfig()); } $P42I2 = SerializeUtil::jsonEncodeObject($P42I2); $TCB1q = modstart_admin_url('site/config/config'); $gK3Gr = "var templates = {$P42I2};\nvar checkTemplate = function () {\n    var template = \$('[name=siteTemplate]').val();\n    \$('#siteTemplateConfig').attr('data-dialog-request', '{$TCB1q}?template=' + template);\n    if (templates[template].hasConfig) {\n        \$('#siteTemplateConfig').show();\n    } else {\n        \$('#siteTemplateConfig').hide();\n    }\n};\n\$('[name=siteTemplate]').change(checkTemplate);\ncheckTemplate();"; ModStart::script($gK3Gr); }); goto xkOSx; hw11D: } }