Beispiel #1
0
        public override object Do(PanelContext data)
        {
            List <DataKey> dataKeys = data.State as List <DataKey>;

            if (dataKeys != null)
            {
                foreach (DataKey key in dataKeys)
                {
                    string id = key["ID"] as string;
                    if (ChannelProcess(id))
                    {
                        Article    a  = ArticleHelper.GetArticle(id);
                        Processing ap = ArticleProcessHelper.GetArticleProcess(a);
                        if (ap.ArticleState != ArticleStates.Checking)
                        {
                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(a, ap);
                        }
                    }
                }
            }
            CacheRecord.Create(data.ModelName).Release();
            return(null);
        }
        void InsertArticleProcessHistory(string id)
        {
            Processing     ap  = ArticleProcessHelper.GetArticleProcess(id);
            ProcessHistory aph = new ProcessHistory();

            //aph.ID = ap.ID;
            aph.ObjectID         = ap.ObjectID;
            aph.ToProcessState   = "-1";
            aph.ProcessDirection = ap.ProcessDirection;
            aph.ProcessAccountID = ap.ProcessAccountID;
            aph.Remark           = ap.Remark;
            aph.CreateDate       = DateTime.Now;
            aph.UpdateDate       = DateTime.Now;
            ArticleProcessHistoryHelper.InsertAdviceProcessHistory(aph);
        }
Beispiel #3
0
        public void BindingData()
        {
            //取出所有待审批文章,逐一判断是否具有权限
            ArticleQuery query = new ArticleQuery();

            query.State = ArticleStates.Checking;
            List <Article> GetAllArticles = ArticleHelper.QueryArtilcesByAll(query);

            if (GetAllArticles == null)
            {
                return;
            }
            List <Article> articles = new List <Article>();

            foreach (Article article in GetAllArticles)
            {
                if (article.Title.Length > 25)
                {
                    article.Title = article.Title.Substring(0, 25) + "...";
                }
                try
                {
                    string curLayerNOText = ArticleProcessHelper.GetCurLayerNOText(article.ID);
                    if (curLayerNOText != "") //文章当前审批进程:类似 Channel.FirstAudit
                    {
                        string        channelID = ArticleHelper.GetArticle(article.ID).OwnerID;
                        List <string> contents  = AccountHelper.GetPermissionContents(AccountID, channelID);
                        if (contents.Contains(curLayerNOText))
                        {
                            articles.Add(article);
                        }
                    }
                }
                catch
                { }
            }
            if (articles.Count > 5)
            {
                DataGridView.DataSource = articles.GetRange(0, 5);
            }
            else
            {
                DataGridView.DataSource = articles;
            }
            DataGridView.DataBind();
        }
        public string GetProcessState(string id)
        {
            Advice a = AdviceHelper.GetAdvice(id);

            if (a == null)
            {
                return("");
            }
            Processing ap          = ArticleProcessHelper.GetAdviceProcess(a);
            string     processText = "";

            if (ap != null && ap.ProcessState != ProcessStates.Finished)
            {
                processText = ap.ProcessDirectionText + ap.ProcessText;
            }
            else
            {
                processText = ap.ProcessText;
            }
            return(processText);
        }
Beispiel #5
0
        private string GetProcessState(string id)
        {
            if (!ChannelProcess(id))
            {
                return("[流转历程]");
            }
            Article a = ArticleHelper.GetArticle(id);

            if (a != null && a.State != 2)
            {
                return("[流转历程]");
            }
            Processing ap          = ArticleProcessHelper.GetArticleProcess(a);
            string     processText = "草稿";

            if (ap != null)
            {
                processText = ap.ProcessDirectionText + ap.ProcessText;
            }
            return(processText);
        }
Beispiel #6
0
        void SaveArticle()
        {
            try
            {
                if (CDHelper.Config.EnableLoginAuhenCode == "true" && this.ValidateTextBox.Text != Request.Cookies["AreYouHuman"].Value)
                {
                    Messages.ShowError("错误:您输入的验证码不正确,请重新输入!");
                    // Clear the input and create a new random code.
                    this.ValidateTextBox.Text             = "";
                    Response.Cookies["AreYouHuman"].Value = CaptchaImage.GenerateRandomCode();
                    return;
                }

                string ownerId = OwnerID;
                if (ownerId == null)
                {
                    ownerId = ChannelDropDownList.SelectedValue;
                }

                if (String.IsNullOrEmpty(ownerId))
                {
                    Messages.ShowError("文章栏目不能为空!");
                    return;
                }

                Article a = ThisArticle;
                a.Description = DescriptionTextBox.Value;
                a.Title       = TitleTextBox.Value;
                a.SubTitle    = SubTitleTextBox.Value;
                a.Color       = ddlColor.SelectedValue;
                a.FontStyle   = chkItalic.Checked ? "Italic" : "";
                a.FontWeight  = chkBold.Checked ? "Bold" : "";
                //a.ID = ArticleID;
                if (IndexTextBox.Value.Trim() == "")
                {
                    a.Index = 0;
                }
                else
                {
                    a.Index = Convert.ToInt32(IndexTextBox.Value);
                }
                a.Source        = SourceTextBox.Value;
                a.AllowComments = AllowCommentsCheckBox.Checked ? 1 : 0;
                //if (IsShowCheckBox.Checked)
                //{
                //    a.EnumState = StateMgr.StateInitialize();
                //    a.EnumState = StateMgr.StateProcess(a.EnumState, EnumLibrary.Business.HomeRecommend, 1);
                //}
                //a.IsShow = IsShowCheckBox.Checked ? 1 : 0;
                a.Author      = AuthorTextBox.Value;
                a.State       = Convert.ToInt32(StateDropDownList.SelectedValue);
                a.ContentType = Convert.ToInt32(ActicleTypeDropDownList.SelectedValue);
                //a.IsImage = (TypeOfArticle)a.ContentType == TypeOfArticle.QuoteArticle || (TypeOfArticle)a.ContentType == TypeOfArticle.ShareArticle ? 1 : 0;
                a.ContentUrl     = ContentUrlTextBox.Value;
                a.Content        = We7Helper.ConvertPageBreakFromVisualToChar(ContentTextBox.Value);
                a.KeyWord        = KeywordTextBox.Value;
                a.DescriptionKey = DescriptionKeyTextBox.Value;

                if (GeneralConfigs.GetConfig().AllowParentArticle&& !string.IsNullOrEmpty(ParentArticleID.Value))
                {
                    a.ParentID = ParentArticleID.Value;
                }
                else
                {
                    a.ParentID = We7Helper.EmptyGUID;
                }

                if (UpdatedTextBox.Value.Trim() == "")
                {
                    a.Updated = DateTime.Now;
                }
                else
                {
                    a.Updated = Convert.ToDateTime(UpdatedTextBox.Value);
                }
                if (txtInvalidDate.Value != "")
                {
                    a.Overdue = Convert.ToDateTime(txtInvalidDate.Value.Trim());
                }
                else
                {
                    GeneralConfigInfo si = GeneralConfigs.GetConfig();
                    int OverdueDateTime  = si.OverdueDateTime;
                    a.Overdue = a.Updated.AddDays(OverdueDateTime);
                }
                if (ArticleID == null)
                {
                    a.AccountID = AccountID;
                    a.OwnerID   = ownerId;
                    Channel ch = ChannelHelper.GetChannel(ownerId, null);
                    if (ch.FullUrl != null && ch.FullUrl != "")
                    {
                        a.ChannelFullUrl = ch.FullUrl;
                    }
                    if (ch.Process != null && ch.Process == "1")
                    {
                        a.State = 2;
                    }
                    //a.ChannelName = ch.ChannelName;
                    /*这儿把上面一句注了,改成了下面的。上面一句与老系统不兼容*/
                    a.ChannelName     = ch.Name;
                    a.FullChannelPath = ch.FullPath;
                    //int type = StateMgr.GetStateValue(ch.EnumState, EnumLibrary.Business.ChannelContentType);
                    //a.EnumState = StateMgr.StateProcess(a.EnumState, EnumLibrary.Business.ArticleType, type);
                    // a.State = 0;

                    //如果禁用
                    if (StateDropDownList.SelectedValue == "0")
                    {
                        a.state = 0;
                    }
                    Article article = ArticleHelper.AddArticles(a);
                    // 往全文检索里插入数据

                    ArticleIndexHelper.InsertData(article.ID, 0);

                    #region 自动提交一审(mxy2011-10-18)
                    if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                    {
                        Processing ap = ArticleProcessHelper.GetArticleProcess(article);
                        if (ap.ArticleState != ArticleStates.Checking)
                        {
                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(article, ap);
                        }
                    }
                    #endregion

                    //记录日志
                    string content = string.Format("新建文章:“{0}”", a.Title);
                    AddLog("新建文章", content);
                }
                else
                {
                    Channel  ch     = ChannelHelper.GetChannel(ownerId, null);
                    string[] fields = new string[] { "Description", "Title", "Content", "Updated", "Index", "Source", "AllowComments", "Author", "State", "IsShow", "IsImage", "SubTitle", "ContentUrl", "ContentType", "IsDeleted", "Overdue", "KeyWord", "DescriptionKey", "ParentID", "FullChannelPath", "ChannelFullUrl", "Color", "FontWeight", "FontStyle" };

                    ArticleHelper.UpdateArticle(a, fields);

                    // 往全文检索里更新数据
                    ArticleIndexHelper.InsertData(a.ID, 0);

                    if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                    {
                        Processing ap = ArticleProcessHelper.GetArticleProcess(a);
                        if (ap.ArticleState != ArticleStates.Checking && ap.ProcessState != ProcessStates.EndAudit)
                        {
                            //编辑审核启用
                            if (ch.Process != null && ch.Process == "1" && StateDropDownList.SelectedValue != "0")
                            {
                                a.State = 2;
                                ArticleHelper.UpdateArticle(a, new string[] { "State" });
                            }

                            string accName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                            ap.ProcessState     = ProcessStates.FirstAudit;
                            ap.ProcessDirection = ((int)ProcessAction.Next).ToString();
                            ap.ProcessAccountID = AccountID;
                            ap.ApproveName      = accName;
                            ArticleProcessHelper.SaveFlowInfoToDB(a, ap);
                        }
                    }
                    //记录日志
                    string content = string.Format("修改了文章“{0}”", a.Title);
                    AddLog("编辑文章", content);
                }

                string rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "saved");
                if (!String.IsNullOrEmpty(ArticleID))
                {
                    rawurl = We7Helper.AddParamToUrl(rawurl, "saved", "1");
                    rawurl = We7Helper.AddParamToUrl(rawurl, "Submit", "1");
                }
                else
                {
                    rawurl = We7Helper.RemoveParamFromUrl(Request.RawUrl, "oid");
                    rawurl = We7Helper.RemoveParamFromUrl(rawurl, "ParentID");
                    rawurl = We7Helper.AddParamToUrl(rawurl, "id", a.ID);
                    rawurl = We7Helper.AddParamToUrl(rawurl, "Submit", "0");
                }

                Response.Redirect(rawurl);
            }
            catch (FormatException)
            {
                Messages.ShowError("无法保存文章信息:可能是文章排序或修改日期格式不正确。");
                return;
            }
            catch (Exception ex)
            {
                Messages.ShowError("无法保存文章信息:" + ex.Message);
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ArticleProcessHelper.IsExistProcess(ArticleID))
                {
                    SaveButton.Style["display"] = "none";
                    Processing ap = ArticleProcessHelper.GetArticleProcess(ArticleHelper.GetArticle(ArticleID));
                    SaveButton2.Style["display"] = "none";
                    if (ap.ArticleState == ArticleStates.Stopped)
                    {
                        SaveButton2.Style["display"] = "block";
                    }
                }
                //初始化
                InitControls();
                //读文章
                LoadArticle();


                Channel channel = ChannelHelper.GetChannel(OwnerID, null);
                //栏目是否为审核栏目
                if (channel != null && channel.Process == "1")
                {
                    if (ArticleID != null && ArticleID != "")
                    {
                        Article    a  = ArticleHelper.GetArticle(ArticleID);
                        Processing ap = ArticleProcessHelper.GetArticleProcess(a);
                        //加判断启用dropdownlist
                        if (a.ProcessState != "99" && !string.IsNullOrEmpty(ap.ApproveName))
                        {
                            StateDropDownList.Enabled = false;
                        }
                    }
                    if (ArticleID != null && ArticleID != "")
                    {
                    }
                    else
                    {
                        StateDropDownList.Items[0].Selected = false;
                        StateDropDownList.Items[2].Selected = true;
                    }
                }
                InitEditorParameter();

                if (InfomationType == null)
                {
                    ChannelDropDownList.Visible = false;
                }
                else
                {
                    BindChannel();
                }

                GenerateRandomCode();
            }
            if (Request["Submit"] != null)
            {
                if (Request["Submit"].ToString() == "0")
                {
                    Messages.ShowMessage(
                        "成功创建文章信息。<a href='/admin/addins/ArticleEdit.aspx?type=0'>继续添加</a>");
                }
                if (Request["Submit"].ToString() == "1")
                {
                    Messages.ShowMessage("文章信息已成功修改。");
                }
            }
        }