public static string GetOpenWindowString() { return(LayerUtils.GetOpenScript("手动升级 网站管理平台 版本", PageUtils.GetSettingsUrl(nameof(ModalManualUpdateSystem), null), 560, 430)); }
public override void Submit_OnClick(object sender, EventArgs e) { var checkedLevel = TranslateUtils.ToIntWithNagetive(DdlCheckType.SelectedValue); var isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel; var contentInfoListToCheck = new List <ContentInfo>(); var idsDictionaryToCheck = new Dictionary <int, List <int> >(); foreach (var channelId in _idsDictionary.Keys) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdList = _idsDictionary[channelId]; var contentIdListToCheck = new List <int>(); int checkedLevelOfUser; var isCheckedOfUser = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissions, SiteInfo, channelId, out checkedLevelOfUser); foreach (var contentId in contentIdList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId); if (contentInfo != null) { if (CheckManager.IsCheckable(SiteInfo, contentInfo.ChannelId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser)) { contentInfoListToCheck.Add(contentInfo); contentIdListToCheck.Add(contentId); } DataProvider.ContentDao.Update(tableName, SiteInfo, contentInfo); CreateManager.CreateContentAndTrigger(SiteId, contentInfo.ChannelId, contentId); } } if (contentIdListToCheck.Count > 0) { idsDictionaryToCheck[channelId] = contentIdListToCheck; } } if (contentInfoListToCheck.Count == 0) { LayerUtils.CloseWithoutRefresh(Page, "alert('您的审核权限不足,无法审核所选内容!');"); return; } var translateChannelId = TranslateUtils.ToInt(DdlTranslateChannelId.SelectedValue); foreach (var channelId in idsDictionaryToCheck.Keys) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdList = idsDictionaryToCheck[channelId]; DataProvider.ContentDao.UpdateIsChecked(tableName, SiteId, channelId, contentIdList, translateChannelId, true, AuthRequest.AdminName, isChecked, checkedLevel, TbCheckReasons.Text); DataProvider.ChannelDao.UpdateContentNum(SiteInfo, channelId, true); } if (translateChannelId > 0) { DataProvider.ChannelDao.UpdateContentNum(SiteInfo, translateChannelId, true); } AuthRequest.AddSiteLog(SiteId, SiteId, 0, "设置内容状态为" + DdlCheckType.SelectedItem.Text, TbCheckReasons.Text); foreach (var channelId in idsDictionaryToCheck.Keys) { var contentIdList = _idsDictionary[channelId]; if (contentIdList != null) { foreach (var contentId in contentIdList) { CreateManager.CreateContentAndTrigger(SiteId, channelId, contentId); } } } LayerUtils.CloseAndRedirect(Page, _returnUrl); }
public static string GetOpenWindowString(int siteId) { return(LayerUtils.GetOpenScript("添加栏目组", PageUtils.GetCmsUrl(siteId, nameof(ModalNodeGroupAdd), null), 600, 300)); }
public static string GetOpenWindowString(int siteId) { return(LayerUtils.GetOpenScriptWithCheckBoxValue("生成栏目页", PageUtils.GetCmsUrl(siteId, nameof(ModalCreateChannels), null), "ChannelIDCollection", "请选择需要生成页面的栏目!", 550, 300)); }
public virtual void Submit_OnClick(object sender, EventArgs e) { LayerUtils.Close(Page); }
protected override LayerDocument GetLayerDocumentCore() { string path = ConfigurationUtils.GetConfigFilePath(_templateLayer); return(LayerUtils.CreateLayerDocument(path)); }
public static string GetOpenWindowString(int siteId, int channelId) { return(LayerUtils.GetOpenScript("转办办件", $"{nameof(ModalApplySwitchTo)}.aspx?siteId={siteId}&channelId={channelId}", 500, 500)); }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; if (!string.IsNullOrEmpty(_tagName)) { try { if (!string.Equals(_tagName, TbTags.Text)) { var tagCollection = TagUtils.ParseTagsString(TbTags.Text); var contentIdList = DataProvider.TagDao.GetContentIdListByTag(_tagName, SiteId); if (contentIdList.Count > 0) { foreach (int contentId in contentIdList) { if (!tagCollection.Contains(_tagName))//删除 { var tagInfo = DataProvider.TagDao.GetTagInfo(SiteId, _tagName); if (tagInfo != null) { var idArrayList = TranslateUtils.StringCollectionToIntList(tagInfo.ContentIdCollection); idArrayList.Remove(contentId); tagInfo.ContentIdCollection = TranslateUtils.ObjectCollectionToString(idArrayList); tagInfo.UseNum = idArrayList.Count; DataProvider.TagDao.Update(tagInfo); } } TagUtils.AddTags(tagCollection, SiteId, contentId); var contentTags = DataProvider.ContentDao.GetValue(SiteInfo.TableName, contentId, ContentAttribute.Tags); var contentTagArrayList = TranslateUtils.StringCollectionToStringList(contentTags); contentTagArrayList.Remove(_tagName); foreach (var theTag in tagCollection) { if (!contentTagArrayList.Contains(theTag)) { contentTagArrayList.Add(theTag); } } DataProvider.ContentDao.SetValue(SiteInfo.TableName, contentId, ContentAttribute.Tags, TranslateUtils.ObjectCollectionToString(contentTagArrayList)); } } else { DataProvider.TagDao.DeleteTag(_tagName, SiteId); } } Body.AddSiteLog(SiteId, "修改内容标签", $"内容标签:{TbTags.Text}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "标签修改失败!"); } } else { try { var tagCollection = TagUtils.ParseTagsString(TbTags.Text); TagUtils.AddTags(tagCollection, SiteId, 0); Body.AddSiteLog(SiteId, "添加内容标签", $"内容标签:{TbTags.Text}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "标签添加失败!"); } } if (isChanged) { LayerUtils.Close(Page); } }
public static string GetOpenWindowString(int siteId, int channelId) { return(LayerUtils.GetOpenScript("负责部门设置", $"{nameof(ModalDepartmentSelectSingle)}.aspx?siteId={siteId}&channelId={channelId}", 700, 0)); }
public override void Submit_OnClick(object sender, EventArgs e) { bool isChanged; var parentChannelId = TranslateUtils.ToInt(Request.Form["channelId"]); if (parentChannelId == 0) { parentChannelId = SiteId; } try { if (string.IsNullOrEmpty(TbNodeNames.Text)) { FailMessage("请填写需要添加的栏目名称"); return; } var insertedChannelIdHashtable = new Hashtable { [1] = parentChannelId }; //key为栏目的级别,1为第一级栏目 var nodeNameArray = TbNodeNames.Text.Split('\n'); List <string> nodeIndexNameList = null; foreach (var item in nodeNameArray) { if (string.IsNullOrEmpty(item)) { continue; } //count为栏目的级别 var count = (StringUtils.GetStartCount('-', item) == 0) ? StringUtils.GetStartCount('-', item) : StringUtils.GetStartCount('-', item); var nodeName = item.Substring(count, item.Length - count); var nodeIndex = string.Empty; count++; if (!string.IsNullOrEmpty(nodeName) && insertedChannelIdHashtable.Contains(count)) { if (CbIsNameToIndex.Checked) { nodeIndex = nodeName.Trim(); } if (StringUtils.Contains(nodeName, "(") && StringUtils.Contains(nodeName, ")")) { var length = nodeName.IndexOf(')') - nodeName.IndexOf('('); if (length > 0) { nodeIndex = nodeName.Substring(nodeName.IndexOf('(') + 1, length); nodeName = nodeName.Substring(0, nodeName.IndexOf('(')); } } nodeName = nodeName.Trim(); nodeIndex = nodeIndex.Trim(' ', '(', ')'); if (!string.IsNullOrEmpty(nodeIndex)) { if (nodeIndexNameList == null) { nodeIndexNameList = DataProvider.ChannelDao.GetIndexNameList(SiteId); } if (nodeIndexNameList.IndexOf(nodeIndex) != -1) { nodeIndex = string.Empty; } else { nodeIndexNameList.Add(nodeIndex); } } var parentId = (int)insertedChannelIdHashtable[count]; var contentModelPluginId = DdlContentModelPluginId.SelectedValue; if (string.IsNullOrEmpty(contentModelPluginId)) { var parentNodeInfo = ChannelManager.GetChannelInfo(SiteId, parentId); contentModelPluginId = parentNodeInfo.ContentModelPluginId; } var channelTemplateId = TranslateUtils.ToInt(DdlChannelTemplateId.SelectedValue); var contentTemplateId = TranslateUtils.ToInt(DdlContentTemplateId.SelectedValue); var insertedChannelId = DataProvider.ChannelDao.Insert(SiteId, parentId, nodeName, nodeIndex, contentModelPluginId, ControlUtils.GetSelectedListControlValueCollection(CblContentRelatedPluginIds), channelTemplateId, contentTemplateId); insertedChannelIdHashtable[count + 1] = insertedChannelId; CreateManager.CreateChannel(SiteId, insertedChannelId); } } Body.AddSiteLog(SiteId, parentChannelId, 0, "快速添加栏目", $"父栏目:{ChannelManager.GetChannelName(SiteId, parentChannelId)},栏目:{TbNodeNames.Text.Replace('\n', ',')}"); isChanged = true; } catch (Exception ex) { isChanged = false; FailMessage(ex, ex.Message); } if (isChanged) { LayerUtils.CloseAndRedirect(Page, _returnUrl); } }
public static string GetOpenWindowStringToAdd(int siteId) { return(LayerUtils.GetOpenScript("添加标签", PageUtils.GetCmsUrl(siteId, nameof(ModalContentTagAdd), null), 600, 360)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (Body.IsQueryExists("CreateChannelsOneByOne") && Body.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(SiteId, channelId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列")); } else if (Body.IsQueryExists("CreateContentsOneByOne") && Body.IsQueryExists("channelId") && Body.IsQueryExists("contentIdCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("contentIdCollection"))) { CreateManager.CreateContent(SiteId, Body.GetQueryInt("channelId"), contentId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列")); } else if (Body.IsQueryExists("CreateByTemplate") && Body.IsQueryExists("templateID")) { CreateManager.CreateFile(SiteId, Body.GetQueryInt("templateID")); PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } else if (Body.IsQueryExists("CreateByIDsCollection") && Body.IsQueryExists("IDsCollection")) { foreach (var channelIdContentId in TranslateUtils.StringCollectionToStringCollection(Body.GetQueryString("IDsCollection"))) { var pair = channelIdContentId.Split('_'); CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (Body.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var downloadUrl = TranslateUtils.DecryptStringBySecretKey(Body.GetQueryString("DownloadUrl")); var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(Body.GetQueryString("DirectoryName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("SiteTemplateUnZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(Body.GetQueryString("FileName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } //---------------------------------------------------------------------------------------// else if (Body.IsQueryExists("PluginDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetPluginDownloadParameters(Body.GetQueryString("DownloadUrl"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (HifUpload.PostedFile == null || "" == HifUpload.PostedFile.FileName) { return; } var filePath = HifUpload.PostedFile.FileName; try { var fileExtName = PathUtils.GetExtension(filePath).ToLower(); var localDirectoryPath = PathUtility.GetUploadDirectoryPath(SiteInfo, fileExtName); if (!string.IsNullOrEmpty(_realtedPath)) { localDirectoryPath = PathUtility.MapPath(SiteInfo, _realtedPath); DirectoryUtils.CreateDirectoryIfNotExists(localDirectoryPath); } var localFileName = PathUtility.GetUploadFileName(SiteInfo, filePath, DateTime.Now, TranslateUtils.ToBool(DdlIsFileUploadChangeFileName.SelectedValue)); var localFilePath = PathUtils.Combine(localDirectoryPath, localFileName); if (_uploadType == EUploadType.Image && !EFileSystemTypeUtils.IsImageOrFlashOrPlayer(fileExtName)) { FailMessage("此格式不允许上传,此文件夹只允许上传图片以及音视频文件!"); return; } if (_uploadType == EUploadType.Video && !EFileSystemTypeUtils.IsImageOrFlashOrPlayer(fileExtName)) { FailMessage("此格式不允许上传,此文件夹只允许上传图片以及音视频文件!"); return; } if (_uploadType == EUploadType.File && !PathUtility.IsFileExtenstionAllowed(SiteInfo, fileExtName)) { FailMessage("此格式不允许上传,请选择有效的文件!"); return; } if (!PathUtility.IsFileSizeAllowed(SiteInfo, HifUpload.PostedFile.ContentLength)) { FailMessage("上传失败,上传文件超出规定文件大小!"); return; } HifUpload.PostedFile.SaveAs(localFilePath); FileUtility.AddWaterMark(SiteInfo, localFilePath); var fileUrl = PageUtility.GetSiteUrlByPhysicalPath(SiteInfo, localFilePath, true); var textBoxUrl = PageUtility.GetVirtualUrl(SiteInfo, fileUrl); if (string.IsNullOrEmpty(_textBoxClientId)) { LayerUtils.Close(Page); } else { LtlScript.Text = $@" <script type=""text/javascript"" language=""javascript""> if (parent.document.getElementById('{_textBoxClientId}') != null) {{ parent.document.getElementById('{_textBoxClientId}').value = '{textBoxUrl}'; }} {LayerUtils.CloseScript} </script>"; } } catch (Exception ex) { FailMessage(ex, "文件上传失败"); } }
public static string GetOpenWindowString(int siteId, int channelId, int contentId) { return(LayerUtils.GetOpenScript("流动轨迹", $"{nameof(ModalApplyFlow)}.aspx?siteId={siteId}&channelId={channelId}&contentId={contentId}", 300, 500)); }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { if (HihType.Value == "1") { if (CbIsRecommend.Checked || CbIsHot.Checked || CbIsColor.Checked || CbIsTop.Checked) { foreach (var contentId in _idList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableName, contentId); if (contentInfo != null) { if (CbIsRecommend.Checked) { contentInfo.IsRecommend = true; } if (CbIsHot.Checked) { contentInfo.IsHot = true; } if (CbIsColor.Checked) { contentInfo.IsColor = true; } if (CbIsTop.Checked) { contentInfo.IsTop = true; } DataProvider.ContentDao.Update(_tableName, SiteInfo, contentInfo); } } AuthRequest.AddSiteLog(SiteId, "设置内容属性"); isChanged = true; } } else if (HihType.Value == "2") { if (CbIsRecommend.Checked || CbIsHot.Checked || CbIsColor.Checked || CbIsTop.Checked) { foreach (var contentId in _idList) { var contentInfo = DataProvider.ContentDao.GetContentInfo(_tableName, contentId); if (contentInfo != null) { if (CbIsRecommend.Checked) { contentInfo.IsRecommend = false; } if (CbIsHot.Checked) { contentInfo.IsHot = false; } if (CbIsColor.Checked) { contentInfo.IsColor = false; } if (CbIsTop.Checked) { contentInfo.IsTop = false; } DataProvider.ContentDao.Update(_tableName, SiteInfo, contentInfo); } } AuthRequest.AddSiteLog(SiteId, "取消内容属性"); isChanged = true; } } else if (HihType.Value == "3") { var hits = TranslateUtils.ToInt(TbHits.Text); foreach (var contentId in _idList) { DataProvider.ContentDao.SetValue(_tableName, contentId, ContentAttribute.Hits, hits.ToString()); } AuthRequest.AddSiteLog(SiteId, "设置内容点击量"); isChanged = true; } } catch (Exception ex) { FailMessage(ex, ex.Message); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
public void CanGetKeyPathForProperty() { Assert.AreEqual("position.x", LayerUtils.GetKeyPath("PositionX")); }
private void Save(bool isClose) { var isSuccess = false; var errorMessage = string.Empty; var content = TranslateUtils.ToBool(DdlIsPureText.SelectedValue) ? TbFileContent.Text : UeFileContent.Text; if (_isCreate == false) { var fileExtName = PathUtils.GetExtension(_theFileName); if (!PathUtility.IsFileExtenstionAllowed(SiteInfo, fileExtName)) { FailMessage("此格式不允许创建,请选择有效的文件名"); return; } var filePath = SiteInfo != null ? PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, _theFileName)) : PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName)); try { try { if (!string.IsNullOrEmpty(DdlCharset.SelectedValue)) { _fileCharset = ECharsetUtils.GetEnumType(DdlCharset.SelectedValue); } FileUtils.WriteText(filePath, _fileCharset, content); } catch { FileUtils.RemoveReadOnlyAndHiddenIfExists(filePath); FileUtils.WriteText(filePath, _fileCharset, content); } AuthRequest.AddSiteLog(SiteId, "新建文件", $"文件名:{_theFileName}"); isSuccess = true; } catch (Exception ex) { errorMessage = ex.Message; } } else { var fileExtName = PathUtils.GetExtension(TbFileName.Text); if (!PathUtility.IsFileExtenstionAllowed(SiteInfo, fileExtName)) { FailMessage("此格式不允许创建,请选择有效的文件名"); return; } var filePath = SiteInfo != null ? PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, TbFileName.Text)) : PathUtils.MapPath(PathUtils.Combine(_relatedPath, TbFileName.Text)); if (FileUtils.IsFileExists(filePath)) { errorMessage = "文件名已存在!"; } else { try { try { FileUtils.WriteText(filePath, _fileCharset, content); } catch { FileUtils.RemoveReadOnlyAndHiddenIfExists(filePath); FileUtils.WriteText(filePath, _fileCharset, content); } AuthRequest.AddSiteLog(SiteId, "编辑文件", $"文件名:{_theFileName}"); isSuccess = true; } catch (Exception ex) { errorMessage = ex.Message; } } } if (isSuccess) { if (isClose) { if (_isCreate) { LayerUtils.Close(Page); } else { LayerUtils.CloseWithoutRefresh(Page); } } else { SuccessMessage("文件保存成功!"); } } else { FailMessage(errorMessage); } }
public static string GetOpenWindowString() { return(LayerUtils.GetOpenScript("导出用户", PageUtils.GetSettingsUrl(nameof(ModalUserExport), null), 450, 270)); }
public override void Submit_OnClick(object sender, EventArgs e) { string scripts = $"window.parent.document.all.{_textBoxClientId}.value = '{TbRule.Text}';"; LayerUtils.CloseWithoutRefresh(Page, scripts); }
public override void Submit_OnClick(object sender, EventArgs e) { if (HifUpload.PostedFile == null || "" == HifUpload.PostedFile.FileName) { return; } var filePath = HifUpload.PostedFile.FileName; try { var fileExtName = PathUtils.GetExtension(filePath).ToLower(); var localDirectoryPath = PathUtility.GetUploadDirectoryPath(SiteInfo, fileExtName); if (!string.IsNullOrEmpty(_currentRootPath)) { localDirectoryPath = PathUtility.MapPath(SiteInfo, _currentRootPath); DirectoryUtils.CreateDirectoryIfNotExists(localDirectoryPath); } var localFileName = PathUtility.GetUploadFileName(SiteInfo, filePath); var localFilePath = PathUtils.Combine(localDirectoryPath, localFileName); if (!PathUtility.IsImageExtenstionAllowed(SiteInfo, fileExtName)) { FailMessage("上传失败,上传图片格式不正确!"); return; } if (!PathUtility.IsImageSizeAllowed(SiteInfo, HifUpload.PostedFile.ContentLength)) { FailMessage("上传失败,上传图片超出规定文件大小!"); return; } HifUpload.PostedFile.SaveAs(localFilePath); var isImage = EFileSystemTypeUtils.IsImage(fileExtName); if (isImage && _isNeedWaterMark) { FileUtility.AddWaterMark(SiteInfo, localFilePath); } if (string.IsNullOrEmpty(_textBoxClientId)) { LayerUtils.Close(Page); } else { var imageUrl = PageUtility.GetSiteUrlByPhysicalPath(SiteInfo, localFilePath, true); var textBoxUrl = PageUtility.GetVirtualUrl(SiteInfo, imageUrl); LtlScript.Text = $@" <script type=""text/javascript"" language=""javascript""> if (parent.document.getElementById('{_textBoxClientId}') != null) {{ parent.document.getElementById('{_textBoxClientId}').value = '{textBoxUrl}'; }} {LayerUtils.CloseScript} </script>"; } } catch (Exception ex) { FailMessage(ex, "图片上传失败!"); } }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; switch (HihType.Value) { case "1": if (CbIsRecommend.Checked || CbIsHot.Checked || CbIsColor.Checked || CbIsTop.Checked) { foreach (var contentId in _idList) { var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId); if (contentInfo != null) { if (CbIsRecommend.Checked) { contentInfo.IsRecommend = true; } if (CbIsHot.Checked) { contentInfo.IsHot = true; } if (CbIsColor.Checked) { contentInfo.IsColor = true; } if (CbIsTop.Checked) { contentInfo.IsTop = true; } DataProvider.ContentDao.Update(SiteInfo, _channelInfo, contentInfo); } } AuthRequest.AddSiteLog(SiteId, "设置内容属性"); isChanged = true; } break; case "2": if (CbIsRecommend.Checked || CbIsHot.Checked || CbIsColor.Checked || CbIsTop.Checked) { foreach (var contentId in _idList) { var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId); if (contentInfo != null) { if (CbIsRecommend.Checked) { contentInfo.IsRecommend = false; } if (CbIsHot.Checked) { contentInfo.IsHot = false; } if (CbIsColor.Checked) { contentInfo.IsColor = false; } if (CbIsTop.Checked) { contentInfo.IsTop = false; } DataProvider.ContentDao.Update(SiteInfo, _channelInfo, contentInfo); } } AuthRequest.AddSiteLog(SiteId, "取消内容属性"); isChanged = true; } break; case "3": var hits = TranslateUtils.ToInt(TbHits.Text); foreach (var contentId in _idList) { var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId); if (contentInfo != null) { contentInfo.Hits = hits; DataProvider.ContentDao.Update(SiteInfo, _channelInfo, contentInfo); } } AuthRequest.AddSiteLog(SiteId, "设置内容点击量"); isChanged = true; break; } if (isChanged) { LayerUtils.Close(Page); } }
public static string GetOpenWindowString() { return(LayerUtils.GetOpenScript("添加辅助表", PageUtils.GetSettingsUrl(nameof(ModalAuxiliaryTableAdd), null), 580, 450)); }
public static string GetOpenScript(int siteId, int formId, int fieldId) { return(LayerUtils.GetOpenScript("设置验证规则", $"{nameof(ModalFieldValidate)}.aspx?siteId={siteId}&formId={formId}&fieldId={fieldId}")); }
private bool MayCling(Collider2D col) { // We may only cling to Ground or Platforms. return(LayerUtils.IsLayer(col.gameObject, Layers.Ground) || LayerUtils.IsLayer(col.gameObject, Layers.Platform)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _isSiteSelect = Body.GetQueryBool("isSiteSelect"); _jsMethod = Body.GetQueryString("jsMethod"); _targetSiteId = Body.GetQueryInt("TargetSiteId"); if (_targetSiteId == 0) { _targetSiteId = SiteId; } if (IsPostBack) { return; } PhSiteId.Visible = _isSiteSelect; var siteIdList = ProductPermissionsManager.Current.SiteIdList; var mySystemInfoArrayList = new ArrayList(); var parentWithChildren = new Hashtable(); foreach (var siteId in siteIdList) { var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo.ParentId == 0) { mySystemInfoArrayList.Add(siteInfo); } else { var children = new ArrayList(); if (parentWithChildren.Contains(siteInfo.ParentId)) { children = (ArrayList)parentWithChildren[siteInfo.ParentId]; } children.Add(siteInfo); parentWithChildren[siteInfo.ParentId] = children; } } foreach (SiteInfo siteInfo in mySystemInfoArrayList) { AddSite(DdlSiteId, siteInfo, parentWithChildren, 0); } ControlUtils.SelectSingleItem(DdlSiteId, _targetSiteId.ToString()); var targetChannelId = Body.GetQueryInt("TargetChannelId"); if (targetChannelId > 0) { var siteName = SiteManager.GetSiteInfo(_targetSiteId).SiteName; var nodeNames = ChannelManager.GetChannelNameNavigation(_targetSiteId, targetChannelId); if (_targetSiteId != SiteId) { nodeNames = siteName + ":" + nodeNames; } string value = $"{_targetSiteId}_{targetChannelId}"; if (!_isSiteSelect) { value = targetChannelId.ToString(); } string scripts = $"window.parent.{_jsMethod}('{nodeNames}', '{value}');"; LayerUtils.CloseWithoutRefresh(Page, scripts); } else { var nodeInfo = ChannelManager.GetChannelInfo(_targetSiteId, _targetSiteId); var linkUrl = GetRedirectUrl(_targetSiteId, _targetSiteId.ToString()); LtlChannelName.Text = $"<a href='{linkUrl}'>{nodeInfo.ChannelName}</a>"; var additional = new NameValueCollection { ["linkUrl"] = GetRedirectUrl(_targetSiteId, string.Empty) }; ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteManager.GetSiteInfo(_targetSiteId), ELoadingType.ChannelSelect, additional)); RptChannel.DataSource = DataProvider.ChannelDao.GetIdListByParentId(_targetSiteId, _targetSiteId); RptChannel.ItemDataBound += RptChannel_ItemDataBound; RptChannel.DataBind(); } }
public override void Submit_OnClick(object sender, EventArgs e) { bool isChanged; try { if (_isContent) { var groupNameList = new List <string>(); foreach (ListItem item in CblGroupNameCollection.Items) { if (item.Selected) { groupNameList.Add(item.Value); } } foreach (var channelId in _idsDictionary.Keys) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdArrayList = _idsDictionary[channelId]; if (contentIdArrayList != null) { foreach (var contentId in contentIdArrayList) { DataProvider.ContentDao.AddContentGroupList(tableName, contentId, groupNameList); } } } Body.AddSiteLog(SiteId, "添加内容到内容组", $"内容组:{TranslateUtils.ObjectCollectionToString(groupNameList)}"); isChanged = true; } else { var groupNameList = new List <string>(); foreach (ListItem item in CblGroupNameCollection.Items) { if (item.Selected) { groupNameList.Add(item.Value); } } foreach (int channelId in _channelIdArrayList) { DataProvider.ChannelDao.AddGroupNameList(SiteId, channelId, groupNameList); } Body.AddSiteLog(SiteId, "添加栏目到栏目组", $"栏目组:{TranslateUtils.ObjectCollectionToString(groupNameList)}"); isChanged = true; } } catch (Exception ex) { FailMessage(ex, ex.Message); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } var isChanged = false; try { var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (!nodeInfo.IndexName.Equals(TbNodeIndexName.Text) && TbNodeIndexName.Text.Length != 0) { var nodeIndexNameList = DataProvider.ChannelDao.GetIndexNameList(SiteId); if (nodeIndexNameList.IndexOf(TbNodeIndexName.Text) != -1) { FailMessage("栏目修改失败,栏目索引已存在!"); return; } } if (PhFilePath.Visible) { TbFilePath.Text = TbFilePath.Text.Trim(); if (!nodeInfo.FilePath.Equals(TbFilePath.Text) && TbFilePath.Text.Length != 0) { if (!DirectoryUtils.IsDirectoryNameCompliant(TbFilePath.Text)) { FailMessage("栏目页面路径不符合系统要求!"); return; } if (PathUtils.IsDirectoryPath(TbFilePath.Text)) { TbFilePath.Text = PageUtils.Combine(TbFilePath.Text, "index.html"); } var filePathArrayList = DataProvider.ChannelDao.GetAllFilePathBySiteId(SiteId); if (filePathArrayList.IndexOf(TbFilePath.Text) != -1) { FailMessage("栏目修改失败,栏目页面路径已存在!"); return; } } } var extendedAttributes = new ExtendedAttributes(); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, relatedIdentities); BackgroundInputTypeParser.SaveAttributes(extendedAttributes, SiteInfo, styleInfoList, Request.Form, null); if (extendedAttributes.Count > 0) { nodeInfo.Additional.Load(extendedAttributes.ToDictionary()); } nodeInfo.ChannelName = TbNodeName.Text; nodeInfo.IndexName = TbNodeIndexName.Text; if (PhFilePath.Visible) { nodeInfo.FilePath = TbFilePath.Text; } var list = new ArrayList(); foreach (ListItem item in CblNodeGroupNameCollection.Items) { if (item.Selected) { list.Add(item.Value); } } nodeInfo.GroupNameCollection = TranslateUtils.ObjectCollectionToString(list); nodeInfo.ImageUrl = TbImageUrl.Text; nodeInfo.Content = ContentUtility.TextEditorContentEncode(SiteInfo, Request.Form[ChannelAttribute.Content]); if (TbKeywords.Visible) { nodeInfo.Keywords = TbKeywords.Text; } if (TbDescription.Visible) { nodeInfo.Description = TbDescription.Text; } if (PhLinkUrl.Visible) { nodeInfo.LinkUrl = TbLinkUrl.Text; } if (PhLinkType.Visible) { nodeInfo.LinkType = DdlLinkType.SelectedValue; } nodeInfo.Additional.DefaultTaxisType = ETaxisTypeUtils.GetValue(ETaxisTypeUtils.GetEnumType(DdlTaxisType.SelectedValue)); if (PhChannelTemplateId.Visible) { nodeInfo.ChannelTemplateId = DdlChannelTemplateId.Items.Count > 0 ? TranslateUtils.ToInt(DdlChannelTemplateId.SelectedValue) : 0; } nodeInfo.ContentTemplateId = DdlContentTemplateId.Items.Count > 0 ? TranslateUtils.ToInt(DdlContentTemplateId.SelectedValue) : 0; DataProvider.ChannelDao.Update(nodeInfo); AuthRequest.AddSiteLog(SiteId, _channelId, 0, "修改栏目", $"栏目:{nodeInfo.ChannelName}"); isChanged = true; } catch (Exception ex) { FailMessage(ex, $"栏目修改失败:{ex.Message}"); LogUtils.AddErrorLog(ex); } if (isChanged) { CreateManager.CreateChannel(SiteId, _channelId); if (string.IsNullOrEmpty(_returnUrl)) { LayerUtils.Close(Page); } else { LayerUtils.CloseAndRedirect(Page, _returnUrl); } } }
public static string GetOpenWindowStringToAdd() { return(LayerUtils.GetOpenScript("添加敏感词", PageUtils.GetSettingsUrl(nameof(ModalKeywordAdd), null), 460, 300)); }
public static void To(object target, float duration, KeyPaths properties, object options, EasingFormula easing, Action onComplete) { CALayer layer; if (TypeUtils.IsUIView(target)) { layer = (target as UIView).Layer; } else { layer = target as CALayer; } // layer.RemoveAllAnimations(); // kill any previous animations hanging around if (easing == null) { easing = Easing.EaseInSine; } var animations = new List <CAKeyFrameAnimation>(); var propType = properties.GetType(); foreach (var field in propType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) { if (field.GetValue(properties) != null) { var ka = new CAKeyFrameAnimation(); ka.KeyPath = LayerUtils.GetKeyPath(field.Name); ka.BeginTime = 0; ka.Duration = duration; ka.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.Linear); var fromValue = LayerUtils.GetCurrentValue(layer, field.Name); var toValue = Convert.ToSingle(field.GetValue(properties)); ka.Values = KeyFrameUtils.CreateKeyValues((float)fromValue, (float)toValue, easing); if (TypeUtils.IsUIView(target)) { setLayerProperties(layer, field.Name, toValue); } animations.Add(ka); } } var localTime = CAAnimation.CurrentMediaTime(); var group = CAAnimationGroup.CreateAnimation(); group.BeginTime = localTime; // TODO + delay from options... group.Duration = duration; group.FillMode = CAFillMode.Forwards; group.RemovedOnCompletion = false; // group.AutoReverses = false; // group.RepeatCount = 0; if (onComplete != null) { group.AnimationStopped += (object sender, CAAnimationStateEventArgs e) => { onComplete.Invoke(); }; } group.Animations = animations.ToArray(); layer.AddAnimation(group, null); }
public static string GetContentTitle(SiteInfo siteInfo, ContentInfo contentInfo, string pageUrl) { string url; var title = ContentUtility.FormatTitle(contentInfo.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)), contentInfo.Title); var displayString = contentInfo.IsColor ? $"<span style='color:#ff0000;text-decoration:none' title='醒目'>{title}</span>" : title; if (contentInfo.IsChecked && contentInfo.ChannelId > 0) { url = $"<a href='{PageRedirect.GetRedirectUrlToContent(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id)}' target='blank'>{displayString}</a>"; } else { var layerUrl = $@"contentsLayerView.cshtml?siteId={siteInfo.Id}&channelId={-contentInfo.ChannelId}&contentId={contentInfo.Id}"; //ModalContentView.GetOpenWindowString(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id, pageUrl) url = $@"<a href=""javascript:;"" onclick=""{LayerUtils.GetOpenScript2("查看内容", layerUrl)}"">{displayString}</a>"; } var image = string.Empty; if (contentInfo.IsRecommend) { image += " <img src='../pic/icon/recommend.gif' title='推荐' align='absmiddle' border=0 />"; } if (contentInfo.IsHot) { image += " <img src='../pic/icon/hot.gif' title='热点' align='absmiddle' border=0 />"; } if (contentInfo.IsTop) { image += " <img src='../pic/icon/top.gif' title='置顶' align='absmiddle' border=0 />"; } if (contentInfo.ReferenceId > 0) { if (contentInfo.GetString(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString()) { image += " <img src='../pic/icon/reference.png' title='引用内容' align='absmiddle' border=0 />(引用内容)"; } else if (contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString()) { image += " <img src='../pic/icon/reference.png' title='引用地址' align='absmiddle' border=0 />(引用地址)"; } } if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.LinkUrl))) { image += " <img src='../pic/icon/link.png' title='外部链接' align='absmiddle' border=0 />"; } if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.ImageUrl))) { var imageUrl = PageUtility.ParseNavigationUrl(siteInfo, contentInfo.GetString(BackgroundContentAttribute.ImageUrl), true); var openWindowString = ModalMessage.GetOpenWindowString(siteInfo.Id, "预览图片", $"<img src='{imageUrl}' />", 500, 500); image += $@" <a href=""javascript:;"" onclick=""{openWindowString}""><img src='../assets/icons/img.gif' title='预览图片' align='absmiddle' border=0 /></a>"; } if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.VideoUrl))) { var openWindowString = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(siteInfo.Id, contentInfo.GetString(BackgroundContentAttribute.VideoUrl)); image += $@" <a href=""javascript:;"" onclick=""{openWindowString}""><img src='../pic/icon/video.png' title='预览视频' align='absmiddle' border=0 /></a>"; } if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.FileUrl))) { image += " <img src='../pic/icon/attachment.gif' title='附件' align='absmiddle' border=0 />"; } return(url + image); }