Ejemplo n.º 1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("attribute_field", OSEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                                     //成功数量
            int errorCount = 0;                                                     //失败数量

            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(OSEnums.ActionEnum.Delete.ToString(), "删除扩展字段成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            Response.Redirect(Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords));
        }
Ejemplo n.º 2
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("attribute_field", OSEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0; //成功数量
     int errorCount = 0; //失败数量
     BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount++;
             }
             else
             {
                 errorCount++;
             }
         }
     }
     AddAdminLog(OSEnums.ActionEnum.Delete.ToString(), "删除扩展字段成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     Response.Redirect(Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords));
 }
Ejemplo n.º 3
0
        private void ShowSysField(int _category_id)
        {
            //查找该频道所选的默认字段
            List <Model.contents.article_attribute_field> ls = new BLL.contents.article_attribute_field().GetModelList(this.category_id, "is_sys=1");

            foreach (Model.contents.article_attribute_field modelt in ls)
            {
                //查找相应的控件,如找到则显示
                HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl;
                if (htmlDiv != null)
                {
                    htmlDiv.Visible = true;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text  = modelt.title;
                    ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text    = modelt.valid_tip_msg;
                }
            }
            //查找该频道所开启的功能
            Model.contents.article_category categoryModel = new BLL.contents.article_category().GetModel(_category_id);
            if (categoryModel.is_albums == 1)
            {
                div_albums_container.Visible = true;
            }
            if (categoryModel.is_attach == 1)
            {
                div_attach_container.Visible = true;
            }
        }
Ejemplo n.º 4
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.contents.article_attribute_field   bll   = new BLL.contents.article_attribute_field();
            Model.contents.article_attribute_field model = bll.GetModel(_id);

            if (model.is_sys == 0)
            {
                model.control_type = ddlControlType.SelectedValue;
                model.data_length  = Utils.StrToInt(txtDataLength.Text.Trim(), 0);
                model.data_place   = Utils.StrToInt(ddlDataPlace.SelectedValue, 0);
                model.data_type    = rblDataType.SelectedValue;
            }
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.title   = txtTitle.Text;
            if (cbIsRequired.Checked == true)
            {
                model.is_required = 1;
            }
            else
            {
                model.is_required = 0;
            }
            if (cbIsPassword.Checked == true)
            {
                model.is_password = 1;
            }
            else
            {
                model.is_password = 0;
            }
            if (cbIsHtml.Checked == true)
            {
                model.is_html = 1;
            }
            else
            {
                model.is_html = 0;
            }
            model.editor_type     = Utils.StrToInt(rblEditorType.SelectedValue, 0);
            model.item_option     = txtItemOption.Text.Trim();
            model.default_value   = txtDefaultValue.Text.Trim();
            model.valid_pattern   = txtValidPattern.Text.Trim();
            model.valid_tip_msg   = txtValidTipMsg.Text.Trim();
            model.valid_error_msg = txtValidErrorMsg.Text.Trim();

            if (bll.Update(model))
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "修改扩展字段:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Ejemplo n.º 5
0
        private void FieldBind()
        {
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            this.cblAttributeField.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                this.cblAttributeField.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }
        }
Ejemplo n.º 6
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_attribute_field   bll   = new BLL.contents.article_attribute_field();
            Model.contents.article_attribute_field model = bll.GetModel(_id);

            txtName.Enabled = false;
            txtName.Attributes.Remove("ajaxurl");
            txtName.Attributes.Remove("datatype");
            ddlControlType.SelectedValue = model.control_type;
            showControlHtml(model.control_type); //显示对应的HTML
            txtSortId.Text = model.sort_id.ToString();
            txtName.Text   = model.name;
            txtTitle.Text  = model.title;
            if (model.is_required == 1)
            {
                cbIsRequired.Checked = true;
            }
            else
            {
                cbIsRequired.Checked = false;
            }
            if (model.is_password == 1)
            {
                cbIsPassword.Checked = true;
            }
            else
            {
                cbIsPassword.Checked = false;
            }
            if (model.is_html == 1)
            {
                cbIsHtml.Checked = true;
            }
            else
            {
                cbIsHtml.Checked = false;
            }
            rblEditorType.SelectedValue = model.editor_type.ToString();
            rblDataType.SelectedValue   = model.data_type;
            txtDataLength.Text          = model.data_length.ToString();
            ddlDataPlace.SelectedValue  = model.data_place.ToString();
            txtItemOption.Text          = model.item_option;
            txtDefaultValue.Text        = model.default_value;
            txtValidPattern.Text        = model.valid_pattern;
            txtValidTipMsg.Text         = model.valid_tip_msg;
            txtValidErrorMsg.Text       = model.valid_error_msg;
            if (model.is_sys == 1)
            {
                ddlControlType.Enabled = false;
            }
        }
Ejemplo n.º 7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = OSRequest.GetQueryInt("page", 1);
            this.ddlControlType.SelectedValue = this.control_type;
            this.txtKeywords.Text             = this.keywords;
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}&page={2}", this.control_type, this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Ejemplo n.º 8
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("attribute_field", OSEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "保存扩展字段排序"); //记录日志
     Response.Redirect(Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords));
 }
Ejemplo n.º 9
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("attribute_field", OSEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "保存扩展字段排序"); //记录日志
     Response.Redirect(Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords));
 }
Ejemplo n.º 10
0
        private void attribute_field_validate(HttpContext context)
        {
            string column_name = OSRequest.GetString("param");

            if (string.IsNullOrEmpty(column_name))
            {
                context.Response.Write("{ \"info\":\"名称不可为空\", \"status\":\"n\" }");
                return;
            }
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            if (bll.Exists(column_name))
            {
                context.Response.Write("{ \"info\":\"该名称已被占用,请更换!\", \"status\":\"n\" }");
                return;
            }
            context.Response.Write("{ \"info\":\"该名称可使用\", \"status\":\"y\" }");
            return;
        }
Ejemplo n.º 11
0
        private Dictionary <string, string> SetFieldValues(int _channel_id)
        {
            DataTable dt = new BLL.contents.article_attribute_field().GetList(_channel_id, "").Tables[0];
            Dictionary <string, string> dic = new Dictionary <string, string>();

            foreach (DataRow dr in dt.Rows)
            {
                //查找相应的控件
                switch (dr["control_type"].ToString())
                {
                case "single-text":     //单行文本
                    TextBox txtControl = FindControl("field_control_" + dr["name"].ToString()) as TextBox;
                    if (txtControl != null)
                    {
                        dic.Add(dr["name"].ToString(), txtControl.Text.Trim());
                    }
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea htmlTextAreaControl = FindControl("field_control_" + dr["name"].ToString()) as HtmlTextArea;
                    if (htmlTextAreaControl != null)
                    {
                        dic.Add(dr["name"].ToString(), htmlTextAreaControl.Value);
                    }
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBox;
                    if (cbControl != null)
                    {
                        if (cbControl.Checked == true)
                        {
                            dic.Add(dr["name"].ToString(), "1");
                        }
                        else
                        {
                            dic.Add(dr["name"].ToString(), "0");
                        }
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = FindControl("field_control_" + dr["name"].ToString()) as RadioButtonList;
                    if (rblControl != null)
                    {
                        dic.Add(dr["name"].ToString(), rblControl.SelectedValue);
                    }
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBoxList;
                    if (cblControl != null)
                    {
                        StringBuilder tempStr = new StringBuilder();
                        for (int i = 0; i < cblControl.Items.Count; i++)
                        {
                            if (cblControl.Items[i].Selected)
                            {
                                tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ",");
                            }
                        }
                        dic.Add(dr["name"].ToString(), Utils.DelLastComma(tempStr.ToString()));
                    }
                    break;
                }
            }
            return(dic);
        }
Ejemplo n.º 12
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = OSRequest.GetQueryInt("page", 1);
            this.ddlControlType.SelectedValue = this.control_type;
            this.txtKeywords.Text = this.keywords;
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}&page={2}", this.control_type, this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Ejemplo n.º 13
0
        private void CreateOtherField(int _channel_id)
        {
            List <Model.contents.article_attribute_field> ls = new BLL.contents.article_attribute_field().GetModelList(this.category_id, "is_sys=0");

            if (ls.Count > 0)
            {
                field_tab_item.Visible    = true;
                field_tab_content.Visible = true;
            }
            foreach (Model.contents.article_attribute_field modelt in ls)
            {
                //创建一个dl标签
                HtmlGenericControl htmlDL = new HtmlGenericControl("dl");
                HtmlGenericControl htmlDT = new HtmlGenericControl("dt");
                HtmlGenericControl htmlDD = new HtmlGenericControl("dd");
                htmlDT.InnerHtml = modelt.title;

                switch (modelt.control_type)
                {
                case "single-text":     //单行文本
                    //创建一个TextBox控件
                    TextBox txtControl = new TextBox();
                    txtControl.ID = "field_control_" + modelt.name;
                    //CSS样式及TextMode设置
                    if (modelt.control_type == "single-text")     //单行
                    {
                        txtControl.CssClass = "input normal";
                        //是否密码框
                        if (modelt.is_password == 1)
                        {
                            txtControl.TextMode = TextBoxMode.Password;
                        }
                    }
                    else if (modelt.control_type == "multi-text")     //多行
                    {
                        txtControl.CssClass = "input";
                        txtControl.TextMode = TextBoxMode.MultiLine;
                    }
                    else if (modelt.control_type == "number")     //数字
                    {
                        txtControl.CssClass = "input small";
                    }
                    else if (modelt.control_type == "images")     //图片
                    {
                        txtControl.CssClass = "input normal upload-path";
                    }
                    //设置默认值
                    txtControl.Text = modelt.default_value;
                    //验证提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        txtControl.Attributes.Add("tipmsg", modelt.valid_tip_msg);
                    }
                    //验证失败提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_error_msg))
                    {
                        txtControl.Attributes.Add("errormsg", modelt.valid_error_msg);
                    }
                    //验证表达式
                    if (!string.IsNullOrEmpty(modelt.valid_pattern))
                    {
                        txtControl.Attributes.Add("datatype", modelt.valid_pattern);
                        txtControl.Attributes.Add("sucmsg", " ");
                    }
                    //创建一个Label控件
                    Label labelControl = new Label();
                    labelControl.CssClass = "Validform_checktip";
                    labelControl.Text     = modelt.valid_tip_msg;

                    //将控件添加至DD中
                    htmlDD.Controls.Add(txtControl);
                    //如果是图片则添加上传按钮
                    if (modelt.control_type == "images")
                    {
                        HtmlGenericControl htmlBtn = new HtmlGenericControl("div");
                        htmlBtn.Attributes.Add("class", "upload-box upload-img");
                        htmlBtn.Attributes.Add("style", "margin-left:4px;");
                        htmlDD.Controls.Add(htmlBtn);
                    }
                    htmlDD.Controls.Add(labelControl);
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea txtTextArea = new HtmlTextArea();
                    txtTextArea.ID = "field_control_" + modelt.name;
                    txtTextArea.Attributes.Add("style", "visibility:hidden;");
                    //是否简洁型编辑器
                    if (modelt.editor_type == 1)
                    {
                        txtTextArea.Attributes.Add("class", "editor-mini");
                    }
                    else
                    {
                        txtTextArea.Attributes.Add("class", "editor");
                    }
                    txtTextArea.Value = modelt.default_value;     //默认值
                    //验证提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        txtTextArea.Attributes.Add("tipmsg", modelt.valid_tip_msg);
                    }
                    //验证失败提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_error_msg))
                    {
                        txtTextArea.Attributes.Add("errormsg", modelt.valid_error_msg);
                    }
                    //验证表达式
                    if (!string.IsNullOrEmpty(modelt.valid_pattern))
                    {
                        txtTextArea.Attributes.Add("datatype", modelt.valid_pattern);
                        txtTextArea.Attributes.Add("sucmsg", " ");
                    }
                    //创建一个Label控件
                    Label labelControl2 = new Label();
                    labelControl2.CssClass = "Validform_checktip";
                    labelControl2.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(txtTextArea);
                    htmlDD.Controls.Add(labelControl2);
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = new CheckBox();
                    cbControl.ID = "field_control_" + modelt.name;
                    //默认值
                    if (modelt.default_value == "1")
                    {
                        cbControl.Checked = true;
                    }
                    HtmlGenericControl htmlDiv1 = new HtmlGenericControl("div");
                    htmlDiv1.Attributes.Add("class", "rule-single-checkbox");
                    htmlDiv1.Controls.Add(cbControl);
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv1);
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        //创建一个Label控件
                        Label labelControl3 = new Label();
                        labelControl3.CssClass = "Validform_checktip";
                        labelControl3.Text     = modelt.valid_tip_msg;
                        htmlDD.Controls.Add(labelControl3);
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = new RadioButtonList();
                    rblControl.ID = "field_control_" + modelt.name;
                    rblControl.RepeatDirection = RepeatDirection.Horizontal;
                    rblControl.RepeatLayout    = RepeatLayout.Flow;
                    HtmlGenericControl htmlDiv2 = new HtmlGenericControl("div");
                    htmlDiv2.Attributes.Add("class", "rule-multi-radio");
                    htmlDiv2.Controls.Add(rblControl);
                    //赋值选项
                    string[] valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
                    for (int i = 0; i < valArr.Length; i++)
                    {
                        string[] valItemArr = valArr[i].Split('|');
                        if (valItemArr.Length == 2)
                        {
                            rblControl.Items.Add(new ListItem(valItemArr[0], valItemArr[1]));
                        }
                    }
                    rblControl.SelectedValue = modelt.default_value;     //默认值
                    //创建一个Label控件
                    Label labelControl4 = new Label();
                    labelControl4.CssClass = "Validform_checktip";
                    labelControl4.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv2);
                    htmlDD.Controls.Add(labelControl4);
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = new CheckBoxList();
                    cblControl.ID = "field_control_" + modelt.name;
                    cblControl.RepeatDirection = RepeatDirection.Horizontal;
                    cblControl.RepeatLayout    = RepeatLayout.Flow;
                    HtmlGenericControl htmlDiv3 = new HtmlGenericControl("div");
                    htmlDiv3.Attributes.Add("class", "rule-multi-checkbox");
                    htmlDiv3.Controls.Add(cblControl);
                    //赋值选项
                    string[] valArr2 = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
                    for (int i = 0; i < valArr2.Length; i++)
                    {
                        string[] valItemArr2 = valArr2[i].Split('|');
                        if (valItemArr2.Length == 2)
                        {
                            cblControl.Items.Add(new ListItem(valItemArr2[0], valItemArr2[1]));
                        }
                    }
                    cblControl.SelectedValue = modelt.default_value;     //默认值
                    //创建一个Label控件
                    Label labelControl5 = new Label();
                    labelControl5.CssClass = "Validform_checktip";
                    labelControl5.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv3);
                    htmlDD.Controls.Add(labelControl5);
                    break;
                }

                //将DT和DD添加到DL中
                htmlDL.Controls.Add(htmlDT);
                htmlDL.Controls.Add(htmlDD);
                //将DL添加至field_tab_content中
                field_tab_content.Controls.Add(htmlDL);
            }
        }
Ejemplo n.º 14
0
        private bool DoAdd()
        {
            bool result = false;
            Model.contents.article_attribute_field model = new Model.contents.article_attribute_field();
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();

            model.control_type = ddlControlType.SelectedValue;
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.name = txtName.Text.Trim();
            model.title = txtTitle.Text;
            if (cbIsRequired.Checked == true)
            {
                model.is_required = 1;
            }
            else
            {
                model.is_required = 0;
            }
            if (cbIsPassword.Checked == true)
            {
                model.is_password = 1;
            }
            else
            {
                model.is_password = 0;
            }
            if (cbIsHtml.Checked == true)
            {
                model.is_html = 1;
            }
            else
            {
                model.is_html = 0;
            }
            model.editor_type = Utils.StrToInt(rblEditorType.SelectedValue, 0);
            model.data_length = Utils.StrToInt(txtDataLength.Text.Trim(), 0);
            model.data_place = Utils.StrToInt(ddlDataPlace.SelectedValue, 0);
            model.data_type = rblDataType.SelectedValue;
            model.item_option = txtItemOption.Text.Trim();
            model.default_value = txtDefaultValue.Text.Trim();
            model.valid_pattern = txtValidPattern.Text.Trim();
            model.valid_tip_msg = txtValidTipMsg.Text.Trim();
            model.valid_error_msg = txtValidErrorMsg.Text.Trim();

            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加扩展字段:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
Ejemplo n.º 15
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            Model.contents.article_attribute_field model = bll.GetModel(_id);

            txtName.Enabled = false;
            txtName.Attributes.Remove("ajaxurl");
            txtName.Attributes.Remove("datatype");
            ddlControlType.SelectedValue = model.control_type;
            showControlHtml(model.control_type); //显示对应的HTML
            txtSortId.Text = model.sort_id.ToString();
            txtName.Text = model.name;
            txtTitle.Text = model.title;
            if (model.is_required == 1)
            {
                cbIsRequired.Checked = true;
            }
            else
            {
                cbIsRequired.Checked = false;
            }
            if (model.is_password == 1)
            {
                cbIsPassword.Checked = true;
            }
            else
            {
                cbIsPassword.Checked = false;
            }
            if (model.is_html == 1)
            {
                cbIsHtml.Checked = true;
            }
            else
            {
                cbIsHtml.Checked = false;
            }
            rblEditorType.SelectedValue = model.editor_type.ToString();
            rblDataType.SelectedValue = model.data_type;
            txtDataLength.Text = model.data_length.ToString();
            ddlDataPlace.SelectedValue = model.data_place.ToString();
            txtItemOption.Text = model.item_option;
            txtDefaultValue.Text = model.default_value;
            txtValidPattern.Text = model.valid_pattern;
            txtValidTipMsg.Text = model.valid_tip_msg;
            txtValidErrorMsg.Text = model.valid_error_msg;
            if (model.is_sys == 1)
            {
                ddlControlType.Enabled = false;
            }
        }
Ejemplo n.º 16
0
        private void FieldBind()
        {
            BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
            DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            this.cblAttributeField.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                this.cblAttributeField.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }
        }
Ejemplo n.º 17
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article   bll   = new BLL.contents.article();
            Model.contents.article model = bll.GetModel(_id);

            txtCallIndex.Text = model.call_index;
            txtTitle.Text     = model.title;
            txtLinkUrl.Text   = model.link_url;
            //不是相册图片就绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);

            if (!filename.StartsWith("thumb_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtSeoTitle.Text        = model.seo_title;
            txtSeoKeywords.Text     = model.seo_keywords;
            txtSeoDescription.Text  = model.seo_description;
            txtZhaiyao.Text         = model.zhaiyao;
            txtContent.Value        = model.content;
            txtSortId.Text          = model.sort_id.ToString();
            txtClick.Text           = model.click.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtAddTime.Text         = model.add_time.ToString("yyyy-MM-dd HH:mm:ss");
            //if (model.is_msg == 1)
            //{
            //	cblItem.Items[0].Selected = true;
            //}
            if (model.is_top == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            //if (model.is_hot == 1)
            //{
            //	cblItem.Items[3].Selected = true;
            //}
            //if (model.is_slide == 1)
            //{
            //	cblItem.Items[4].Selected = true;
            //}
            //扩展字段赋值
            List <Model.contents.article_attribute_field> ls1 = new BLL.contents.article_attribute_field().GetModelList(this.category_id, "");

            foreach (Model.contents.article_attribute_field modelt1 in ls1)
            {
                switch (modelt1.control_type)
                {
                case "single-text":     //单行文本
                    TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox;
                    if (txtControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (modelt1.is_password == 1)
                        {
                            txtControl.Attributes.Add("value", model.fields[modelt1.name]);
                        }
                        else
                        {
                            txtControl.Text = model.fields[modelt1.name];
                        }
                    }
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea;
                    if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        txtAreaControl.Value = model.fields[modelt1.name];
                    }
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox;
                    if (cbControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (model.fields[modelt1.name] == "1")
                        {
                            cbControl.Checked = true;
                        }
                        else
                        {
                            cbControl.Checked = false;
                        }
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList;
                    if (rblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        rblControl.SelectedValue = model.fields[modelt1.name];
                    }
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList;
                    if (cblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        string[] valArr = model.fields[modelt1.name].Split(',');
                        for (int i = 0; i < cblControl.Items.Count; i++)
                        {
                            cblControl.Items[i].Selected = false;     //先取消默认的选中
                            foreach (string str in valArr)
                            {
                                if (cblControl.Items[i].Value == str)
                                {
                                    cblControl.Items[i].Selected = true;
                                }
                            }
                        }
                    }
                    break;
                }
            }
            //绑定图片相册
            if (filename.StartsWith("thumb_"))
            {
                hidFocusPhoto.Value = model.img_url; //封面图片
            }
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
            //绑定内容附件
            rptAttachList.DataSource = model.attach;
            rptAttachList.DataBind();
        }
Ejemplo n.º 18
0
 private void attribute_field_validate(HttpContext context)
 {
     string column_name = OSRequest.GetString("param");
     if (string.IsNullOrEmpty(column_name))
     {
         context.Response.Write("{ \"info\":\"名称不可为空\", \"status\":\"n\" }");
         return;
     }
     BLL.contents.article_attribute_field bll = new BLL.contents.article_attribute_field();
     if (bll.Exists(column_name))
     {
         context.Response.Write("{ \"info\":\"该名称已被占用,请更换!\", \"status\":\"n\" }");
         return;
     }
     context.Response.Write("{ \"info\":\"该名称可使用\", \"status\":\"y\" }");
     return;
 }