public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } var isRetainFiles = TranslateUtils.ToBool(RblRetainFiles.SelectedValue); if (isRetainFiles == false) { DirectoryUtility.DeleteSiteFiles(SiteInfo); SuccessMessage("成功删除站点以及相关文件!"); } else { SuccessMessage("成功删除站点,相关文件未被删除!"); } if (AuthRequest.AdminInfo.SiteId != SiteId) { AddWaitAndRedirectScript(PageSite.GetRedirectUrl()); } else { AddScript( $@"setTimeout(""window.top.location.href='{PageMain.GetRedirectUrl()}'"", 1500);"); } AuthRequest.AddAdminLog("删除站点", $"站点:{SiteInfo.SiteName}"); DataProvider.SiteDao.Delete(SiteId); }
public void Return_OnClick(object sender, EventArgs e) { PageUtils.Redirect(PageSite.GetRedirectUrl()); }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } SiteInfo.SiteName = TbSiteName.Text; SiteInfo.Taxis = TranslateUtils.ToInt(TbTaxis.Text); SiteInfo.Additional.IsCheckContentLevel = TranslateUtils.ToBool(RblIsCheckContentUseLevel.SelectedValue); if (SiteInfo.Additional.IsCheckContentLevel) { SiteInfo.Additional.CheckContentLevel = TranslateUtils.ToInt(DdlCheckContentLevel.SelectedValue); } var isTableChanged = false; var tableName = string.Empty; var tableRule = ETableRuleUtils.GetEnumType(RblTableRule.SelectedValue); if (tableRule == ETableRule.Choose) { tableName = DdlTableChoose.SelectedValue; } else if (tableRule == ETableRule.HandWrite) { tableName = TbTableHandWrite.Text; if (!DataProvider.DatabaseDao.IsTableExists(tableName)) { DataProvider.ContentDao.CreateContentTable(tableName, DataProvider.ContentDao.TableColumnsDefault); } else { DataProvider.DatabaseDao.AlterSystemTable(tableName, DataProvider.ContentDao.TableColumnsDefault); } } if (!StringUtils.EqualsIgnoreCase(SiteInfo.TableName, tableName)) { isTableChanged = true; SiteInfo.TableName = tableName; } if (SiteInfo.IsRoot == false) { if (!StringUtils.EqualsIgnoreCase(PathUtils.GetDirectoryName(SiteInfo.SiteDir, false), TbSiteDir.Text)) { var list = DataProvider.SiteDao.GetLowerSiteDirList(SiteInfo.ParentId); if (list.IndexOf(TbSiteDir.Text.ToLower()) != -1) { FailMessage("站点修改失败,已存在相同的发布路径!"); return; } var parentPsPath = WebConfigUtils.PhysicalApplicationPath; if (SiteInfo.ParentId > 0) { var parentSiteInfo = SiteManager.GetSiteInfo(SiteInfo.ParentId); parentPsPath = PathUtility.GetSitePath(parentSiteInfo); } DirectoryUtility.ChangeSiteDir(parentPsPath, SiteInfo.SiteDir, TbSiteDir.Text); } if (PhParentId.Visible && SiteInfo.ParentId != TranslateUtils.ToInt(DdlParentId.SelectedValue)) { var newParentId = TranslateUtils.ToInt(DdlParentId.SelectedValue); var list = DataProvider.SiteDao.GetLowerSiteDirList(newParentId); if (list.IndexOf(TbSiteDir.Text.ToLower()) != -1) { FailMessage("站点修改失败,已存在相同的发布路径!"); return; } DirectoryUtility.ChangeParentSite(SiteInfo.ParentId, TranslateUtils.ToInt(DdlParentId.SelectedValue), SiteId, TbSiteDir.Text); SiteInfo.ParentId = newParentId; } SiteInfo.SiteDir = TbSiteDir.Text; } DataProvider.SiteDao.Update(SiteInfo); if (isTableChanged) { ContentManager.RemoveCountCache(tableName); } AuthRequest.AddAdminLog("修改站点属性", $"站点:{SiteInfo.SiteName}"); SuccessMessage("站点修改成功!"); AddWaitAndRedirectScript(PageSite.GetRedirectUrl()); }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } SiteInfo.SiteName = TbSiteName.Text; SiteInfo.Taxis = TranslateUtils.ToInt(TbTaxis.Text); SiteInfo.Additional.IsCheckContentLevel = TranslateUtils.ToBool(RblIsCheckContentUseLevel.SelectedValue); if (SiteInfo.Additional.IsCheckContentLevel) { SiteInfo.Additional.CheckContentLevel = TranslateUtils.ToInt(DdlCheckContentLevel.SelectedValue); } var isTableChanged = false; if (SiteInfo.TableName != DdlTableName.SelectedValue) { isTableChanged = true; SiteInfo.TableName = DdlTableName.SelectedValue; } if (SiteInfo.IsRoot == false) { if (!StringUtils.EqualsIgnoreCase(PathUtils.GetDirectoryName(SiteInfo.SiteDir), TbSiteDir.Text)) { var list = DataProvider.SiteDao.GetLowerSiteDirList(SiteInfo.ParentId); if (list.IndexOf(TbSiteDir.Text.ToLower()) != -1) { FailMessage("站点修改失败,已存在相同的发布路径!"); return; } var parentPsPath = WebConfigUtils.PhysicalApplicationPath; if (SiteInfo.ParentId > 0) { var parentSiteInfo = SiteManager.GetSiteInfo(SiteInfo.ParentId); parentPsPath = PathUtility.GetSitePath(parentSiteInfo); } DirectoryUtility.ChangeSiteDir(parentPsPath, SiteInfo.SiteDir, TbSiteDir.Text); } if (PhParentId.Visible && SiteInfo.ParentId != TranslateUtils.ToInt(DdlParentId.SelectedValue)) { var newParentId = TranslateUtils.ToInt(DdlParentId.SelectedValue); var list = DataProvider.SiteDao.GetLowerSiteDirList(newParentId); if (list.IndexOf(TbSiteDir.Text.ToLower()) != -1) { FailMessage("站点修改失败,已存在相同的发布路径!"); return; } DirectoryUtility.ChangeParentSite(SiteInfo.ParentId, TranslateUtils.ToInt(DdlParentId.SelectedValue), SiteId, TbSiteDir.Text); SiteInfo.ParentId = newParentId; } SiteInfo.SiteDir = TbSiteDir.Text; } DataProvider.SiteDao.Update(SiteInfo); if (isTableChanged) { DataProvider.ChannelDao.UpdateContentNum(SiteInfo); } Body.AddAdminLog("修改站点属性", $"站点:{SiteInfo.SiteName}"); SuccessMessage("站点修改成功!"); AddWaitAndRedirectScript(PageSite.GetRedirectUrl()); }