Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("\n<script Type='text/javascript'>").Append("\n");
                sb.Append("<!--").Append("\n");
                sb.Append("d = new dTree('d');").Append("\n");
                sb.Append("d.config.closeSameLevel=true;");

                //读取数据
                KingTop.BLL.SysManage.WebSiteTemplateNode bll = new KingTop.BLL.SysManage.WebSiteTemplateNode();
                DataTable dt = bll.GetList("WEBSITE", Utils.getOneParams(TemplateID));

                if (dt != null)
                {
                    try
                    {
                        string stremp2  = dt.Rows.Count.ToString();
                        string parentid = "";
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["NodeCode"].ToString().Length <= 3)
                            {
                                parentid = "-1";
                            }
                            else
                            {
                                parentid = dr["NodeCode"].ToString().Substring(0, dr["NodeCode"].ToString().Length - 3);
                            }
                            string strPer = "&nbsp;&nbsp;<a HREF=TemplateNodeEdit.aspx?Action=New&TemplateID=" + TemplateID + "&NodeCode=" + dr["NodeCode"] + "&IsFolder=" + dr["NodeType"] + "&Nodeid=" + NodeID + "><img SRC=../images/folder.gif border=0 alt=添加子栏目></a>&nbsp;&nbsp;<a HREF=TemplateNodeEdit.aspx?Action=Edit&ID=" + dr["ID"] + "&TemplateID=" + TemplateID + "&NodeCode=" + dr["NodeCode"] + "><img SRC=../images/pen.gif border=0 alt=修改></a>";
                            //if (parentid == "-1")
                            //{
                            //    sb.Append("d.add(").Append(dr["NodeCode"]).Append(",")
                            //        .Append(parentid).Append(",'").Append(dr["NodeName"])
                            //        .Append("');").Append("\n");
                            //}
                            //else
                            //{
                            sb.Append("d.add(").Append(dr["NodeCode"]).Append(",")
                            .Append(parentid).Append(",'").Append(dr["NodeName"]).Append(strPer)
                            .Append("');").Append("\n");
                            //}
                        }
                    }
                    catch (Exception err)
                    {
                        string stremp = err.Message;
                    }
                }

                sb.Append("document.write(d);").Append("\n");
                //打开所有节点
                sb.Append(" d.openAll();").Append("\n");
                sb.Append("//-->").Append("\n");
                sb.Append("</script>").Append("\n");
                menutree.InnerHtml = sb.ToString();
            }
        }
Esempio n. 2
0
        private void PageInit()
        {
            hidNodeCode.Value = NodeCode;
            //编辑
            if (this.Action == "EDIT")
            {
                DataTable    dt;
                SelectParams selParams = new SelectParams();
                selParams.S1 = this.ID;
                dt           = bll.GetList("ONE", selParams);

                btnTemplateNode.Text = Utils.GetResourcesValue("Common", "Update");

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    this.hidLogTitle.Value    = Utils.HtmlDecode(dr["NodeName"].ToString());
                    txtNodeName.Text          = dr["NodeName"].ToString();
                    txtLink.Text              = dr["LinkURL"].ToString();
                    RBL_IsValid.SelectedValue = dr["IsValid"].ToString();
                    txtNodelOrder.Text        = dr["NodelOrder"].ToString();
                    txtNodelDesc.Text         = dr["NodelDesc"].ToString();
                    txtNodelEngDesc.Text      = dr["NodelEngDesc"].ToString();
                    chkNodeType.Checked       = Utils.ParseBool(dr["NodeType"].ToString());
                    ddlModeID.Enabled         = !chkNodeType.Checked;
                    if (dr["ModuleID"].ToString().Length == 0 || dr["ModuleID"].ToString() == Guid.Empty.ToString())
                    {
                        ddlModeID.SelectedValue = "0";
                    }
                    else
                    {
                        ddlModeID.SelectedValue = dr["ModuleID"].ToString();
                    }
                    chkIsSystem.Checked            = Utils.ParseBool(dr["IsSystem"].ToString());
                    chkIsContainWebContent.Checked = Utils.ParseBool(dr["IsContainWebContent"].ToString());
                    if (string.IsNullOrEmpty(dr["ReviewFlowID"].ToString()))
                    {
                        try
                        {
                            ddlReviewFlow.SelectedValue = dr["ReviewFlowID"].ToString();
                        }
                        catch
                        {
                            throw new Exception("没有相应项与之匹配");
                        }
                    }
                }
            }
            else
            {
                //新增一级节点

                if (this.Action == "NEWPARENTNODE")
                {
                    dlNodeCode.Visible      = true;
                    this.ddlModeID.Enabled  = false;
                    chkNodeType.Checked     = true;
                    chkNodeType.Enabled     = false;
                    ddlModeID.SelectedValue = "0";
                    ddlModeID.Enabled       = false;
                }
                btnDel.Visible = false;
            }
        }