public void Main()
        {
            var builder = new StringBuilder();

            try
            {
                var form = HttpContext.Current.Request.Form;
                var publishmentSystemId = TranslateUtils.ToInt(form["publishmentSystemID"]);
                var parentId            = TranslateUtils.ToInt(form["parentID"]);
                var target              = form["target"];
                var isShowTreeLine      = TranslateUtils.ToBool(form["isShowTreeLine"]);
                var isShowContentNum    = TranslateUtils.ToBool(form["isShowContentNum"]);
                var currentFormatString = form["currentFormatString"];
                var topNodeId           = TranslateUtils.ToInt(form["topNodeID"]);
                var topParentsCount     = TranslateUtils.ToInt(form["topParentsCount"]);
                var currentNodeId       = TranslateUtils.ToInt(form["currentNodeID"]);

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var nodeIdList            = DataProvider.NodeDao.GetNodeIdListByParentId(publishmentSystemId, parentId);

                foreach (int nodeId in nodeIdList)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, nodeId);

                    builder.Append(StlTree.GetChannelRowHtml(publishmentSystemInfo, nodeInfo, target, isShowTreeLine, isShowContentNum, TranslateUtils.DecryptStringBySecretKey(currentFormatString), topNodeId, topParentsCount, currentNodeId));
                }
            }
            catch
            {
                // ignored
            }

            HttpContext.Current.Response.Write(builder);
            HttpContext.Current.Response.End();
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                var builder = new StringBuilder();

                var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList;
                foreach (var publishmentSystemId in publishmentSystemIdList)
                {
                    var loadingUrl            = PageUtils.GetLoadingUrl(PageMain.GetRedirectUrl(publishmentSystemId, string.Empty));
                    var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                    builder.Append($@"
<span class=""icon-span"">
    <a href=""{loadingUrl}"" target=""_top"">
      {EPublishmentSystemTypeUtils.GetIconHtml(publishmentSystemInfo.PublishmentSystemType, "icon-5")}
      <h5>
        {publishmentSystemInfo.PublishmentSystemName}
        <br>
        <small>{publishmentSystemInfo.PublishmentSystemDir}</small>
      </h5>
    </a>
  </span>");
                }

                ltlHtml.Text = builder.ToString();
            }
        }
예제 #3
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var taskID   = SqlUtils.EvalInt(e.Item.DataItem, "TaskID");
                var taskInfo = DataProvider.TaskDao.GetTaskInfo(taskID);

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(taskInfo.PublishmentSystemID);
                if (publishmentSystemInfo == null)
                {
                    e.Item.Visible = false;
                }

                var addDate      = SqlUtils.EvalDateTime(e.Item.DataItem, "AddDate");
                var isSuccess    = SqlUtils.EvalString(e.Item.DataItem, "IsSuccess");
                var errorMessage = SqlUtils.EvalString(e.Item.DataItem, "ErrorMessage");

                var ltlPublishmentSystem = (Literal)e.Item.FindControl("ltlPublishmentSystem");
                var ltlTaskName          = (Literal)e.Item.FindControl("ltlTaskName");
                var ltlServiceType       = (Literal)e.Item.FindControl("ltlServiceType");
                var ltlAddDate           = (Literal)e.Item.FindControl("ltlAddDate");
                var ltlIsSuccess         = (Literal)e.Item.FindControl("ltlIsSuccess");
                var ltlErrorMessage      = (Literal)e.Item.FindControl("ltlErrorMessage");

                ltlPublishmentSystem.Text = publishmentSystemInfo.PublishmentSystemName;
                ltlTaskName.Text          = taskInfo.TaskName;
                ltlServiceType.Text       = EServiceTypeUtils.GetText(taskInfo.ServiceType);

                ltlAddDate.Text      = DateUtils.GetDateAndTimeString(addDate);
                ltlIsSuccess.Text    = StringUtils.GetTrueOrFalseImageHtml(isSuccess);
                ltlErrorMessage.Text = errorMessage;
            }
        }
예제 #4
0
        public string GetPublishmentSystemsHtml(ArrayList allPublishmentSystemIdArrayList, ArrayList managedPublishmentSystemIdArrayList)
        {
            var htmlBuilder = new StringBuilder();

            htmlBuilder.Append("<table width='100%' cellpadding='4' cellspacing='0' border='0'>");
            var count = 1;

            foreach (int publishmentSystemId in allPublishmentSystemIdArrayList)
            {
                var psInfo    = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var imageName = "cantedit";
                if (managedPublishmentSystemIdArrayList.Contains(publishmentSystemId))
                {
                    imageName = "canedit";
                }

                var space = "";
                if (count % 4 == 0)
                {
                    space = "<tr>";
                }

                var    pageUrl = PagePermissionAdd.GetRedirectUrl(publishmentSystemId, Body.GetQueryString("RoleName"));
                string content = $@"
					<td height=20>
                        <img id='PublishmentSystemImage_{publishmentSystemId}' align='absmiddle' border='0' src='../pic/{imageName}.gif'/>
					    <a href='{pageUrl}'>{psInfo.PublishmentSystemName}</a>{space}
                    </td>
				"                ;
                htmlBuilder.Append(content);
                count++;
            }
            htmlBuilder.Append("</table>");
            return(htmlBuilder.ToString());
        }
예제 #5
0
        public const int Default = 0;       //正常录入

        public static string GetSourceName(int sourceId)
        {
            if (sourceId == Default)
            {
                return("正常录入");
            }
            if (sourceId == CaiJi)
            {
                return("系统采集");
            }
            if (sourceId == Preview)
            {
                return("预览插入");
            }
            if (sourceId <= 0)
            {
                return(string.Empty);
            }

            var publishmentSystemId   = DataProvider.NodeDao.GetPublishmentSystemId(sourceId);
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            if (publishmentSystemInfo == null)
            {
                return("内容转移");
            }

            var nodeNames = NodeManager.GetNodeNameNavigation(publishmentSystemId, sourceId);

            if (!string.IsNullOrEmpty(nodeNames))
            {
                return(publishmentSystemInfo.PublishmentSystemName + ":" + nodeNames);
            }
            return(publishmentSystemInfo.PublishmentSystemName);
        }
        public void Main(int publishmentSystemId, int nodeId)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            try
            {
                var queryCode   = PageUtils.FilterSqlAndXss(HttpContext.Current.Request.Form[GovInteractContentAttribute.QueryCode]);
                var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(publishmentSystemInfo, nodeId, queryCode);
                if (contentInfo != null)
                {
                    HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, true, contentInfo, string.Empty));
                }
                else
                {
                    HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, "您输入的查询号不正确"));
                }
            }
            catch (Exception ex)
            {
                //HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, ex.Message));
                HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, "程序错误"));
            }

            HttpContext.Current.Response.End();
        }
예제 #7
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var ltlPublishmentSystem = (Literal)e.Item.FindControl("ltlPublishmentSystem");
                var ltlUserName          = (Literal)e.Item.FindControl("ltlUserName");
                var ltlAddDate           = (Literal)e.Item.FindControl("ltlAddDate");
                var ltlIPAddress         = (Literal)e.Item.FindControl("ltlIPAddress");
                var ltlAction            = (Literal)e.Item.FindControl("ltlAction");
                var ltlSummary           = (Literal)e.Item.FindControl("ltlSummary");

                if (PublishmentSystemId == 0)
                {
                    var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(SqlUtils.EvalInt(e.Item.DataItem, "PublishmentSystemID"));
                    var publishmentSystemName = string.Empty;
                    if (publishmentSystemInfo != null)
                    {
                        publishmentSystemName =
                            $"<a href='{publishmentSystemInfo.PublishmentSystemUrl}' target='_blank'>{publishmentSystemInfo.PublishmentSystemName}</a>";
                    }
                    ltlPublishmentSystem.Text = $@"<td align=""center"" width=""160"">{publishmentSystemName}</td>";
                }
                ltlUserName.Text  = SqlUtils.EvalString(e.Item.DataItem, "UserName");
                ltlAddDate.Text   = DateUtils.GetDateAndTimeString(SqlUtils.EvalDateTime(e.Item.DataItem, "AddDate"));
                ltlIPAddress.Text = SqlUtils.EvalString(e.Item.DataItem, "IPAddress");
                ltlAction.Text    = SqlUtils.EvalString(e.Item.DataItem, "Action");
                ltlSummary.Text   = SqlUtils.EvalString(e.Item.DataItem, "Summary");
            }
        }
예제 #8
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();
                if (!body.IsUserLoggin)
                {
                    return(Unauthorized());
                }

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");
                var nodeId = body.GetPostInt("nodeId");
                var id     = body.GetPostInt("id");

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var tableName             = NodeManager.GetTableName(publishmentSystemInfo, nodeId);

                var title = BaiRongDataProvider.ContentDao.GetValue(tableName, id, ContentAttribute.Title);

                var contentIdArrayList = new List <int> {
                    id
                };
                DataProvider.ContentDao.TrashContents(publishmentSystemId, tableName, contentIdArrayList);

                LogUtils.AddUserLog(body.UserName, EUserActionType.WritingDelete, title);

                return(Ok(new { }));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
예제 #9
0
        public static List <PluginMenu> GetAllMenus(string topId, int siteId)
        {
            var plugins = AllPlugins.Where(o => !o.Metadata.Disabled && o.Metadata.Menus != null);

            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(siteId);
            var apiUrl = PageUtility.GetApiUrl(publishmentSystemInfo);

            var menus = new List <PluginMenu>();

            foreach (var pluginPair in plugins)
            {
                var i = 1;
                foreach (var metadataMenu in pluginPair.Metadata.Menus)
                {
                    if (!StringUtils.EqualsIgnoreCase(metadataMenu.TopId, topId))
                    {
                        continue;
                    }

                    var menu = GetMenu(pluginPair.Metadata.Id, metadataMenu, apiUrl, siteId, i++);

                    menus.Add(menu);
                }
            }

            return(menus);
        }
예제 #10
0
        private void Redirect_DefaultDirection()
        {
            string url;

            if (Request.QueryString["ErrorUrl"] != null)
            {
                url = Request.QueryString["ErrorUrl"];
                url = PageUtils.ParseNavigationUrl(url);
                PageUtils.Redirect(url);
            }
            var publishmentSystemId = PathUtility.GetCurrentPublishmentSystemId();

            if (publishmentSystemId == 0)
            {
                publishmentSystemId = DataProvider.PublishmentSystemDao.GetPublishmentSystemIdByIsHeadquarters();
            }
            if (publishmentSystemId != 0)
            {
                url = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId).PublishmentSystemUrl;
                PageUtils.Redirect(url);
            }
            else
            {
                url = WebConfigUtils.ApplicationPath;
                PageUtils.Redirect(url);
            }
        }
예제 #11
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();
                if (!body.IsUserLoggin)
                {
                    return(Unauthorized());
                }

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");

                var groupInfo     = UserGroupManager.GetGroupInfo(body.UserInfo.GroupId);
                var adminUserName = groupInfo.Additional.WritingAdminUserName;

                var nodeInfoList = PublishmentSystemManager.GetWritingNodeInfoList(adminUserName, publishmentSystemId);
                var nodes        = new List <object>();
                foreach (var nodeInfo in nodeInfoList)
                {
                    nodes.Add(new
                    {
                        nodeInfo.NodeId,
                        nodeInfo.NodeName
                    });
                }

                return(Ok(nodes));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();
                if (!body.IsUserLoggin)
                {
                    return(Unauthorized());
                }

                var publishmentSystemId = body.GetPostInt("publishmentSystemId");
                var nodeId = body.GetPostInt("nodeId");

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var nodeInfo          = NodeManager.GetNodeInfo(publishmentSystemId, nodeId);
                var tableStyle        = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
                var tableName         = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);
                var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(publishmentSystemId, nodeId);

                return(Ok(TableStyleManager.GetTableStyleInfoList(tableStyle, tableName, relatedIdentities)));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
예제 #13
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                var currentPublishmentSystemId = Body.AdministratorInfo.PublishmentSystemId;
                var publishmentSystemInfo      = PublishmentSystemManager.GetPublishmentSystemInfo(currentPublishmentSystemId);
                PublishmentSystemName.Text = publishmentSystemInfo.PublishmentSystemName;
                ImageUrl.Text = publishmentSystemInfo.ImageUrl;
                PublishmentSystemType.Text = DataProvider.MechanismDao.GetMechanismTypeTextById(PublishmentSystemInfo.OrganizationTypeId) + "|" + DataProvider.MechanismDao.GetMechanismCategoryTextById(PublishmentSystemInfo.OrganizationCategory);
                TelePhone.Text             = publishmentSystemInfo.TelePhone;
                Address.Text        = publishmentSystemInfo.Address;
                BasicFacts.Text     = publishmentSystemInfo.BasicFacts;
                Characteristic.Text = publishmentSystemInfo.Characteristic;
                //    var administratorInfo = BaiRongDataProvider.AdministratorDao.GetByAccount(publishmentSystemInfo.AdministratorAccount);
                //try
                //{
                //    var formCollectionBasicFacts = new NameValueCollection();
                //    formCollectionBasicFacts[NodeAttribute.Content] = publishmentSystemInfo.BasicFacts;
                //    BasicFactsContent.SetParameters(new PublishmentSystemInfo(), "Content", new NameValueCollection(), true, false);

                //    var formCollectionCharacteristicContent = new NameValueCollection();
                //    formCollectionCharacteristicContent[NodeAttribute.Content] = publishmentSystemInfo.Characteristic;
                //    BasicFactsContent.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollectionCharacteristicContent, true, IsPostBack);
                //}
                //catch(Exception ex)
                //{
                //}
            }
        }
예제 #14
0
        public int Insert(string tableName, PublishmentSystemInfo publishmentSystemInfo, ContentInfo contentInfo, bool isUpdateContentNum, int taxis)
        {
            var contentId = 0;

            if (!string.IsNullOrEmpty(tableName))
            {
                if (publishmentSystemInfo.Additional.IsAutoPageInTextEditor && contentInfo.ContainsKey(BackgroundContentAttribute.Content))
                {
                    contentInfo.SetExtendedAttribute(BackgroundContentAttribute.Content, ContentUtility.GetAutoPageContent(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content), publishmentSystemInfo.Additional.AutoPageWordNum));
                }

                contentInfo.BeforeExecuteNonQuery();

                contentInfo.Taxis = taxis;

                contentId = BaiRongDataProvider.ContentDao.Insert(tableName, contentInfo);

                if (isUpdateContentNum)
                {
                    new Action(() =>
                    {
                        DataProvider.NodeDao.UpdateContentNum(PublishmentSystemManager.GetPublishmentSystemInfo(contentInfo.PublishmentSystemId), contentInfo.NodeId, true);
                    }).BeginInvoke(null, null);
                }
            }

            return(contentId);
        }
예제 #15
0
        public override void Process()
        {
            Sources = Request.Form.GetValues("source[]");
            if (Sources == null || Sources.Length == 0)
            {
                WriteJson(new
                {
                    state = "参数错误:没有指定抓取源"
                });
                return;
            }
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(PublishmentSystemID);

            Crawlers = Sources.Select(x => new Crawler(x, publishmentSystemInfo, Server).Fetch()).ToArray();
            WriteJson(new
            {
                state = "SUCCESS",
                list  = Crawlers.Select(x => new
                {
                    state  = x.State,
                    source = x.SourceUrl,
                    url    = x.ServerUrl
                })
            });
        }
예제 #16
0
        public void InsertWithTrans(PublishmentSystemInfo info, IDbTransaction trans)
        {
            //获取排序值
            var taxis       = GetMaxTaxis() + 1;
            var insertParms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemId, EDataType.Integer, info.PublishmentSystemId),
                GetParameter(ParmPublishmentsystemName, EDataType.NVarChar, 50, info.PublishmentSystemName),
                GetParameter(ParmPublishmentsystemType, EDataType.VarChar, 50, EPublishmentSystemTypeUtils.GetValue(info.PublishmentSystemType)),
                GetParameter(ParmAuxiliaryTableForContent, EDataType.VarChar, 50, info.AuxiliaryTableForContent),
                GetParameter(ParmAuxiliaryTableForGovpublic, EDataType.VarChar, 50, info.AuxiliaryTableForGovPublic),
                GetParameter(ParmAuxiliaryTableForGovinteract, EDataType.VarChar, 50, info.AuxiliaryTableForGovInteract),
                GetParameter(ParmAuxiliaryTableForVote, EDataType.VarChar, 50, info.AuxiliaryTableForVote),
                GetParameter(ParmAuxiliaryTableForJob, EDataType.VarChar, 50, info.AuxiliaryTableForJob),
                GetParameter(ParmIsCheckContentUseLevel, EDataType.VarChar, 18, info.IsCheckContentUseLevel.ToString()),
                GetParameter(ParmCheckContentLevel, EDataType.Integer, info.CheckContentLevel),
                GetParameter(ParmPublishmentsystemDir, EDataType.VarChar, 50, info.PublishmentSystemDir),
                GetParameter(ParmPublishmentsystemUrl, EDataType.VarChar, 200, info.PublishmentSystemUrl),
                GetParameter(ParmIsHeadquarters, EDataType.VarChar, 18, info.IsHeadquarters.ToString()),
                GetParameter(ParmParentPublishmentsystemid, EDataType.Integer, info.ParentPublishmentSystemId),
                GetParameter(ParmTaxis, EDataType.Integer, taxis),
                GetParameter(ParmSettingsXml, EDataType.NText, info.Additional.ToString()),
                GetParameter(ParmParentsCount, EDataType.Integer, info.ParentsCount)
            };

            ExecuteNonQuery(trans, SqlInsertPublishmentSystem, insertParms);
            PublishmentSystemManager.ClearCache(true);
        }
예제 #17
0
        public void Update(PublishmentSystemInfo info)
        {
            var updateParms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemName, EDataType.NVarChar, 50, info.PublishmentSystemName),
                GetParameter(ParmPublishmentsystemType, EDataType.VarChar, 50, EPublishmentSystemTypeUtils.GetValue(info.PublishmentSystemType)),
                GetParameter(ParmAuxiliaryTableForContent, EDataType.VarChar, 50, info.AuxiliaryTableForContent),
                GetParameter(ParmAuxiliaryTableForGovpublic, EDataType.VarChar, 50, info.AuxiliaryTableForGovPublic),
                GetParameter(ParmAuxiliaryTableForGovinteract, EDataType.VarChar, 50, info.AuxiliaryTableForGovInteract),
                GetParameter(ParmAuxiliaryTableForVote, EDataType.VarChar, 50, info.AuxiliaryTableForVote),
                GetParameter(ParmAuxiliaryTableForJob, EDataType.VarChar, 50, info.AuxiliaryTableForJob),
                GetParameter(ParmIsCheckContentUseLevel, EDataType.VarChar, 18, info.IsCheckContentUseLevel.ToString()),
                GetParameter(ParmCheckContentLevel, EDataType.Integer, info.CheckContentLevel),
                GetParameter(ParmPublishmentsystemDir, EDataType.VarChar, 50, info.PublishmentSystemDir),
                GetParameter(ParmPublishmentsystemUrl, EDataType.VarChar, 200, info.PublishmentSystemUrl),
                GetParameter(ParmIsHeadquarters, EDataType.VarChar, 18, info.IsHeadquarters.ToString()),
                GetParameter(ParmParentPublishmentsystemid, EDataType.Integer, info.ParentPublishmentSystemId),
                GetParameter(ParmTaxis, EDataType.Integer, info.Taxis),
                GetParameter(ParmSettingsXml, EDataType.NText, info.Additional.ToString()),
                GetParameter(ParmPublishmentsystemId, EDataType.Integer, info.PublishmentSystemId)
            };

            if (info.IsHeadquarters)
            {
                UpdateAllIsHeadquarters();
            }

            ExecuteNonQuery(SqlUpdatePublishmentSystem, updateParms);

            PublishmentSystemManager.ClearCache(true);
        }
예제 #18
0
        public void UpdateParentPublishmentSystemIdToZero(int parentPublishmentSystemId)
        {
            var sqlString = "UPDATE siteserver_PublishmentSystem SET ParentPublishmentSystemID = 0 WHERE ParentPublishmentSystemID = " + parentPublishmentSystemId;

            ExecuteNonQuery(sqlString);
            PublishmentSystemManager.ClearCache(true);
        }
예제 #19
0
        private static bool BackupByPublishmentSystemID(TaskInfo taskInfo, int publishmentSystemID, EBackupType backupType)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);

            if (publishmentSystemInfo == null)
            {
                ExecutionUtils.LogError(taskInfo, new Exception("无法找到对应站点"));
                return(false);
            }

            var filePath = PathUtility.GetBackupFilePath(publishmentSystemInfo, backupType);

            DirectoryUtils.CreateDirectoryIfNotExists(filePath);
            FileUtils.DeleteFileIfExists(filePath);

            if (backupType == EBackupType.Templates)
            {
                BackupUtility.BackupTemplates(publishmentSystemInfo.PublishmentSystemId, filePath);
            }
            else if (backupType == EBackupType.ChannelsAndContents)
            {
                BackupUtility.BackupChannelsAndContents(publishmentSystemInfo.PublishmentSystemId, filePath);
            }
            else if (backupType == EBackupType.Files)
            {
                BackupUtility.BackupFiles(publishmentSystemInfo.PublishmentSystemId, filePath);
            }
            else if (backupType == EBackupType.Site)
            {
                BackupUtility.BackupSite(publishmentSystemInfo.PublishmentSystemId, filePath);
            }

            return(true);
        }
예제 #20
0
        public IHttpActionResult Main(int publishmentSystemId)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
            var type = HttpContext.Current.Request.QueryString["type"];

            var jsonAttributes = new NameValueCollection();

            var success = false;
            var message = string.Empty;
            var url     = string.Empty;
            var value   = string.Empty;

            if (type == ActionsUpload.TypeResume)
            {
                success = UploadResumeImage(publishmentSystemInfo, out message, out url, out value);
            }
            else if (type == ActionsUpload.TypeGovPublicApply)
            {
                success = UploadGovPublicApply(publishmentSystemInfo, out message, out url, out value);
            }

            jsonAttributes.Add("success", success.ToString().ToLower());
            jsonAttributes.Add("message", message);
            jsonAttributes.Add("url", url);
            jsonAttributes.Add("value", value);

            return(Ok(jsonAttributes));
        }
        public IHttpActionResult Main(int siteId, int channelId, int contentId)
        {
            try
            {
                var body = new RequestBody();

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(siteId);
                if (!publishmentSystemInfo.Additional.IsCommentable)
                {
                    return(Unauthorized());
                }

                var userName = body.GetPostString("userName");
                if (body.UserName != userName && !body.IsAdministratorLoggin)
                {
                    return(Unauthorized());
                }

                DataProvider.CommentDao.Delete(siteId, channelId, contentId, body.GetPostInt("id"));

                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
예제 #22
0
        public static bool Execute(TaskInfo taskInfo)
        {
            var taskBackupInfo = new TaskBackupInfo(taskInfo.ServiceParameters);

            if (taskInfo.PublishmentSystemID != 0)
            {
                return(BackupByPublishmentSystemID(taskInfo, taskInfo.PublishmentSystemID, taskBackupInfo.BackupType));
            }
            else
            {
                List <int> publishmentSystemIDArrayList = null;
                if (taskBackupInfo.IsBackupAll)
                {
                    publishmentSystemIDArrayList = PublishmentSystemManager.GetPublishmentSystemIdList();
                }
                else
                {
                    publishmentSystemIDArrayList = TranslateUtils.StringCollectionToIntList(taskBackupInfo.PublishmentSystemIDCollection);
                }
                foreach (int publishmentSystemID in publishmentSystemIDArrayList)
                {
                    BackupByPublishmentSystemID(taskInfo, publishmentSystemID, taskBackupInfo.BackupType);
                }
            }

            return(true);
        }
예제 #23
0
        private string GetPublishmentSystemNameHtml(PublishmentSystemInfo publishmentSystemInfo)
        {
            var level  = PublishmentSystemManager.GetPublishmentSystemLevel(publishmentSystemInfo.PublishmentSystemId);
            var psLogo = string.Empty;

            if (publishmentSystemInfo.IsHeadquarters)
            {
                psLogo = "siteHQ.gif";
            }
            else
            {
                psLogo = "site.gif";
                if (level > 0 && level < 10)
                {
                    psLogo = $"subsite{level + 1}.gif";
                }
            }
            psLogo = SiteServerAssets.GetIconUrl("tree/" + psLogo);

            var padding = string.Empty;

            for (var i = 0; i < level; i++)
            {
                padding += " ";
            }
            if (level > 0)
            {
                padding += "└ ";
            }

            return
                ($"{padding}<img align='absbottom' border='0' src='{psLogo}'/>&nbsp;<a href='{publishmentSystemInfo.PublishmentSystemUrl}' target='_blank'>{publishmentSystemInfo.PublishmentSystemName}</a>");
        }
예제 #24
0
        public static string GetSitesTemplateString(string templateString, string containerClientID, PageInfo pageInfo, EContextType contextType, ContextInfo contextInfoRef)
        {
            var itemContainer = DbItemContainer.GetItemContainer(pageInfo);

            var publishmentSystemID   = SqlUtils.EvalInt(itemContainer.SiteItem.DataItem, PublishmentSystemAttribute.PublishmentSystemId);
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);

            var contextInfo = contextInfoRef.Clone();

            contextInfo.ContainerClientID = containerClientID;
            contextInfo.ItemContainer     = itemContainer;
            contextInfo.ContextType       = contextType;

            var prePublishmentSystemInfo = pageInfo.PublishmentSystemInfo;
            var prePageNodeID            = pageInfo.PageNodeId;
            var prePageContentID         = pageInfo.PageContentId;

            pageInfo.ChangeSite(publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId, 0, contextInfo);

            var innerBuilder = new StringBuilder(templateString);

            StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);

            DbItemContainer.PopInputItem(pageInfo);

            pageInfo.ChangeSite(prePublishmentSystemInfo, prePageNodeID, prePageContentID, contextInfo);

            return(innerBuilder.ToString());
        }
        public void Main(int publishmentSystemId, int styleId)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            try
            {
                var isOrganization = TranslateUtils.ToBool(HttpContext.Current.Request.Form[GovPublicApplyAttribute.IsOrganization]);
                var queryName      = PageUtils.FilterSqlAndXss(HttpContext.Current.Request.Form["queryName"]);
                var queryCode      = PageUtils.FilterSqlAndXss(HttpContext.Current.Request.Form[GovPublicApplyAttribute.QueryCode]);
                var applyInfo      = DataProvider.GovPublicApplyDao.GetApplyInfo(publishmentSystemId, isOrganization, queryName, queryCode);
                if (applyInfo != null)
                {
                    HttpContext.Current.Response.Write(GovPublicQueryTemplate.GetCallbackScript(publishmentSystemInfo, true, applyInfo, string.Empty));
                }
                else
                {
                    HttpContext.Current.Response.Write(GovPublicQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, "系统找不到对应的申请,请确认您的输入值是否正确"));
                }
            }
            catch (Exception ex)
            {
                HttpContext.Current.Response.Write(GovPublicQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, ex.Message));
            }

            HttpContext.Current.Response.End();
        }
예제 #26
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _userName    = Body.GetQueryString("UserName");
            _permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            if (IsPostBack)
            {
                return;
            }

            var roles = BaiRongDataProvider.RoleDao.GetRolesForUser(_userName);

            if (_permissions.IsConsoleAdministrator)
            {
                DdlPredefinedRole.Items.Add(EPredefinedRoleUtils.GetListItem(EPredefinedRole.ConsoleAdministrator, false));
                DdlPredefinedRole.Items.Add(EPredefinedRoleUtils.GetListItem(EPredefinedRole.SystemAdministrator, false));
            }
            DdlPredefinedRole.Items.Add(EPredefinedRoleUtils.GetListItem(EPredefinedRole.Administrator, false));

            var type = EPredefinedRoleUtils.GetEnumTypeByRoles(roles);

            ControlUtils.SelectListItems(DdlPredefinedRole, EPredefinedRoleUtils.GetValue(type));

            PublishmentSystemManager.AddListItems(CblPublishmentSystemId);
            ControlUtils.SelectListItems(CblPublishmentSystemId, BaiRongDataProvider.AdministratorDao.GetPublishmentSystemIdList(_userName));

            ListBoxDataBind();

            DdlPredefinedRole_SelectedIndexChanged(null, EventArgs.Empty);
        }
예제 #27
0
        public IHttpActionResult Main()
        {
            try
            {
                var body = new RequestBody();

                var publishmentSystemId   = body.GetPostInt("publishmentSystemId");
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                var pageNodeId            = body.GetPostInt("pageNodeId");
                var templateId            = body.GetPostInt("templateId");
                var totalNum               = body.GetPostInt("totalNum");
                var pageCount              = body.GetPostInt("pageCount");
                var currentPageIndex       = body.GetPostInt("currentPageIndex", 0);
                var stlPageContentsElement = TranslateUtils.DecryptStringBySecretKey(body.GetPostString("stlPageContentsElement"));

                var nodeInfo     = NodeManager.GetNodeInfo(publishmentSystemId, pageNodeId);
                var templateInfo = TemplateManager.GetTemplateInfo(publishmentSystemId, templateId);
                var pageInfo     = new PageInfo(nodeInfo.NodeId, 0, publishmentSystemInfo, templateInfo, body.UserInfo);
                var contextInfo  = new ContextInfo(pageInfo);

                var stlPageContents = new StlPageContents(stlPageContentsElement, pageInfo, contextInfo, false);

                var pageHtml = stlPageContents.Parse(totalNum, currentPageIndex, pageCount, false);

                return(Ok(pageHtml));
            }
            catch (Exception ex)
            {
                //return InternalServerError(ex);
                return(InternalServerError(new Exception("程序错误")));
            }
        }
예제 #28
0
        public int GetCountCheckedImage(int publishmentSystemId, int nodeId)
        {
            var    tableName = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId).AuxiliaryTableForContent;
            string sqlString =
                $"SELECT COUNT(*) AS TotalNum FROM {tableName} WHERE (NodeID = {nodeId} AND ImageUrl <> '' AND {ContentAttribute.IsChecked} = '{true}')";

            return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString));
        }
예제 #29
0
 protected void PublishmentSystemIDCollection_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     NodeIDCollection.Items.Clear();
     if (PlaceHolder_PublishmentSystem.Visible && PublishmentSystemIDCollection.Items.Count > 0)
     {
         NodeManager.AddListItemsForAddContent(NodeIDCollection.Items, PublishmentSystemManager.GetPublishmentSystemInfo(int.Parse(PublishmentSystemIDCollection.SelectedValue)), false, Body.AdministratorName);
     }
 }
예제 #30
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            var mechanismDao = new MechanismDao();

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var publishmentSystemID   = (int)e.Item.DataItem;
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                if (publishmentSystemInfo != null)
                {
                    var ltlPublishmentSystemName   = e.Item.FindControl("ltlPublishmentSystemName") as Literal;
                    var ltlPublishmentSystemType   = e.Item.FindControl("ltlPublishmentSystemType") as Literal;
                    var ltlPublishmentSystemAdress = e.Item.FindControl("ltlPublishmentSystemAdress") as Literal;
                    var ltlOperation = e.Item.FindControl("ltlOperation") as Literal;
                    //var ltlChangeType = e.Item.FindControl("ltlChangeType") as Literal;
                    //var ltlDelete = e.Item.FindControl("ltlDelete") as Literal;

                    //var ltUpLink = e.Item.FindControl("ltUpLink") as Literal;
                    //var ltDownLink = e.Item.FindControl("ltDownLink") as Literal;

                    ltlPublishmentSystemName.Text   = GetPublishmentSystemNameHtml(publishmentSystemInfo);
                    ltlPublishmentSystemAdress.Text = publishmentSystemInfo.Address;
                    ltlPublishmentSystemType.Text   = mechanismDao.GetMechanismTypeTextById(publishmentSystemInfo.OrganizationTypeId); //publishmentSystemInfo.OrganizationTypeId.ToString()+"--类型表未建立,此数字代表id";
                    if (HasWebsitePermissions(AppManager.Cms.Permission.WebSite.SiteEdit))
                    {
                        ltlOperation.Text = $@"<a href=""PageSiteEdit.aspx?PublishmentSystemId={publishmentSystemInfo.PublishmentSystemId}"" target=""content"">操作</a>";
                    }
                    else
                    {
                        ltlOperation.Text = $@"<a href=""javascript:void(0)"" target=""content"">无</a>";
                    }

                    var upUrl = PageUtils.GetSysUrl(nameof(PagePublishmentSystem), new NameValueCollection
                    {
                        { "Up", "True" },
                        { "PublishmentSystemID", publishmentSystemID.ToString() }
                    });
                    //ltUpLink.Text = $@"<a href=""{upUrl}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升""/></a>";

                    var downUrl = PageUtils.GetSysUrl(nameof(PagePublishmentSystem), new NameValueCollection
                    {
                        { "Down", "True" },
                        { "PublishmentSystemID", publishmentSystemID.ToString() }
                    });
                    //ltDownLink.Text = $@"<a href=""{downUrl}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降""/></a>";

                    //if (publishmentSystemInfo.ParentPublishmentSystemId == 0 && (_hqSiteId == 0 || publishmentSystemID == _hqSiteId))
                    //{
                    //    ltlChangeType.Text = GetChangeHtml(publishmentSystemID, publishmentSystemInfo.IsHeadquarters);
                    //}

                    //if (publishmentSystemInfo.IsHeadquarters == false)
                    //{
                    //    ltlDelete.Text = $@"<a href=""{PagePublishmentSystemDelete.GetRedirectUrl(publishmentSystemID)}"">删除</a>";
                    //}
                }
            }
        }