Example #1
0
        private void InitPage()
        {
            DataTable dt     = bllarticletype.GetList(fiter + " order by id asc").Tables[0];
            DataTable dttemp = bllarticletype.getChildNodes(dt, 0);

            this.ddlType.Items.Add(new ListItem("所有类型", "0"));
            FillDdlFatherType(dt, null, 0, (dttemp.Rows.Count <= 1));
        }
Example #2
0
        private string writeTree(DataTable dt, DataRow fatherRow, int layer)
        {
            string spcId = "0";

            if (Request.QueryString["spcId"] != null)
            {
                spcId = Request.QueryString["spcId"].ToString();
            }
            StringBuilder sb         = new StringBuilder();
            DataTable     dtChildren = null;

            int fatherid = 0;

            if (fatherRow != null)
            {
                fatherid = Convert.ToInt32(fatherRow["id"]);
            }
            dtChildren = bllarticletype.getChildNodes(dt, fatherid);

            if (fatherRow != null)
            {
                sb.Append("<tr>\n");
                sb.Append("      <td>" + fatherRow["id"].ToString() + "</td>\n");

                if (dtChildren.Rows.Count > 0)
                {
                    sb.Append("      <td class='typename' valign='middle'><span style='padding-left:" + (layer * 30).ToString() + "px;'></span><img src='../images/th.gif' border='0'><img src='../images/dir.bmp' border='0'>");
                }
                else
                {
                    sb.Append("      <td class='typename' valign='middle'><span style='padding-left:" + (layer * 30).ToString() + "px;'></span><img src='../images/tn.gif' border='0'><img src='../images/dir.bmp' border='0'>");
                }

                sb.Append("      " + fatherRow["dbo_typename"].ToString() + "</td>\n");
                sb.Append("      <td class='childTypeAdd'><a href='typeAdd.aspx?fatherid=" + fatherRow["id"].ToString() + "&spcId=" + spcId + "'>添加子节点</a></td>\n");
                sb.Append("      <td class='typeEdit' valign='middle'><a href='typeAdd.aspx?typeid=" + fatherRow["id"].ToString() + "&spcId=" + spcId + "'>编辑</a></td>\n");
                sb.Append("      <td class='typeDelete' valign='middle'><a href='typeLIst.aspx?action=delete&typeid=" + fatherRow["id"].ToString() + "&spcId=" + spcId + "' onclick='return confirm(\"将删除该节点及子节点下的所有内容,确定吗?\");'>删除</a></td>\n");


                sb.Append("</tr>\n");
            }
            //if (fatherRow != null)
            //{
            //    dt.Rows.Remove(fatherRow);
            //}

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dtChildren.Rows.Count; i++)
                {
                    sb.Append(writeTree(dt, dtChildren.Rows[i], layer + 1));
                }
            }
            return(sb.ToString());
        }
Example #3
0
        private void InitPage()
        {
            string fiter = "dbo_specialityId=" + spcId + " and dbo_isArticleType=True";

            if (!currentAdmin.validationSpcAdmin(spcId))
            {
                string ids = adminOpers.getChannelPower(spcId, currentAdmin.Channels);
                if (ids == "-2")
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alertNoTypes", "alert('专题下未创建任何文章类型或者您在该专题下没有任何权限');", true);
                    pnlContent.Visible = false;
                    return;
                }
                fiter = " id in(" + ids + ") ";
            }


            DataTable dt     = bllarticletype.GetList(fiter + " order by id asc").Tables[0];
            DataTable dttemp = bllarticletype.getChildNodes(dt, 0);

            if (dttemp.Rows.Count == 0)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alertNoTypes", "alert('专题下未创建任何文章类型,请先添加文章类型');", true);
                pnlContent.Visible = false;
                return;
            }

            if (!Page.IsPostBack)
            {
                this.ddlType.Items.Add(new ListItem("请选择分类", "0"));
                FillDdlFatherType(dt, null, 0, (dttemp.Rows.Count <= 1));
                this.txtSource.Text = sys.webName;
                this.txtAuthor.Text = currentAdmin.Name;
            }
            if (!Page.IsPostBack && theState == MyPageState.edit)
            {
                this.btnSubmit.Text = "保存修改";
                FillContent();
            }
        }
Example #4
0
        private void FillDdlFatherType(DataTable dt, DataRow fatherRow, int layer, bool IsTypeEnd)
        {
            int fatherid = 0;

            if (fatherRow != null)
            {
                if (theState == MyPageState.edit && Request.QueryString["typeid"].ToString() == fatherRow["id"].ToString())
                {
                    return;
                }
                fatherid = Convert.ToInt32(fatherRow["id"]);
                string fathertypename = fatherRow["dbo_typename"].ToString();
                if (!IsTypeEnd)
                {
                    fathertypename = "├" + fathertypename;
                }
                else
                {
                    fathertypename = "└" + fathertypename;
                }

                for (int i = 2; i < layer; i++)
                {
                    fathertypename = " " + fathertypename;
                }

                if (layer != 1)
                {
                    fathertypename = "│" + fathertypename;
                }

                this.ddlFatherType.Items.Add(new ListItem(fathertypename, fatherid.ToString()));
            }


            DataTable dtChildren = bllarticletype.getChildNodes(dt, fatherid);

            for (int i = 0; i < dtChildren.Rows.Count; i++)
            {
                FillDdlFatherType(dt, dtChildren.Rows[i], layer + 1, (dtChildren.Rows.Count == (i + 1)));
            }
        }