Beispiel #1
0
        /// <summary>
        /// 更新分类关系
        /// </summary>
        /// <param name="ArticleID">文章编号</param>
        /// <param name="CategoryIDs">分类编号字符串集合</param>
        /// <returns></returns>
        public static Int32 Update(Int32 ArticleID, String CategoryIDs)
        {
            //分类编号
            List <String> CategoryIDList = Common.GetList(CategoryIDs);

            return(Update(ArticleID, CategoryIDList));
        }
 /// <summary>
 /// 检测并过滤图标
 /// </summary>
 /// <param name="OptionText"></param>
 /// <returns></returns>
 public String FormatIcon(String OptionText)
 {
     if (!String.IsNullOrEmpty(OptionText) && OptionText.IndexOf("[*]") >= 0)
     {
         List <String> TextImages = Common.GetList(OptionText, "[*]");
         OptionText = FormatIcon(TextImages[0], TextImages[1]);
     }
     return(OptionText);
 }
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="FieldItem"></param>
        /// <param name="ControlName"></param>
        /// <returns></returns>
        public String ViewCreateCheckBoxList(SettingEntity FieldItem, String ControlName, String ControlID)
        {
            StringBuilder ControlHtml = new StringBuilder();//控件的HTML

            ControlHtml.AppendFormat("<span id=\"{1}\" name=\"{0}\" class=\"auto\">", ControlName, ControlID);



            if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                List <String> list             = Common.GetList(FieldItem.ListContent.Replace("\r\n", "|").Replace("\r", "|"), "|");
                List <String> DefaultListValue = Common.GetList(FieldItem.DefaultValue);
                for (Int32 i = 0; i < list.Count; i++)
                {
                    if (!String.IsNullOrEmpty(list[i]))
                    {
                        String OptionText  = list[i];
                        String OptionValue = list[i];
                        //判断是否包含有键值对,将键值对分离开
                        if (list[i].IndexOf(":") >= 0)
                        {
                            List <String> ItemKeyValue = Common.GetList(list[i], ":");
                            OptionText  = ItemKeyValue[0];
                            OptionValue = ItemKeyValue[1];

                            //如果有图标就检测,没有就忽略
                            OptionText = FormatIcon(OptionText);
                        }


                        ControlHtml.AppendFormat("<label  for=\"{0}_{1}\"  class=\"checkbox-inline\" >", ControlID, i);

                        String CheckedStr = DefaultListValue.Count > 0 && DefaultListValue.Contains(OptionValue) ? "checked=\"checked\"" : "";

                        ControlHtml.AppendFormat("<input id=\"{1}_{2}\" type=\"checkbox\" name=\"{0}\"", ControlName, ControlID, i);

                        if (FieldItem.Required)
                        {
                            ControlHtml.AppendFormat(" class=\"square-green grey {0}\" ", "validate[minCheckbox[1]]");
                        }

                        ControlHtml.AppendFormat("value=\"{0}\" {1} />", OptionValue, CheckedStr);

                        ControlHtml.AppendFormat(" {0}</label>", OptionText);

                        if (FieldItem.Direction == EnumControlDirection.Vertical.ToString())
                        {
                            ControlHtml.Append("<br />");
                        }
                    }
                }
            }

            ControlHtml.Append(" </span>");
            return(ControlHtml.ToString());
        }
        /// <summary>
        /// 将字符串转化为列表,逗号为分隔符
        /// </summary>
        /// <param name="Items"></param>
        /// <returns></returns>
        public List <String> ToList(String Items)
        {
            List <String> list = new List <String>();

            if (!String.IsNullOrEmpty(Items))
            {
                list = Common.GetList(Items);
            }
            return(list);
        }
        /// <Description>
        /// 绑定页面项
        /// </Description>
        private void BindPageItem()
        {
            EffectDBEntity EffectDB = Setting_EffectDB;


            hlAddGroups.NavigateUrl = xUrl("Groups");
            hlAddGroups.Attributes.Add("onclick", String.Format("return confirm('{0}');", Localization.GetString("hlAddGroups.Confirm", this.LocalResourceFile)));
            divGroups.Visible       = EffectDB.Groups;
            divCustomModels.Visible = EffectDB.CustomModels;
            divNumbers.Visible      = EffectDB.Downloads;

            //增加权限用户
            DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName");


            //构造增加按钮
            if (EffectDB.Layers && SliderID > 0)
            {
                liTitle_Layers.Text = String.Format("{0} List", EffectDB.LayerName);


                StringBuilder AddNewBuilder = new StringBuilder();
                //通用按钮
                AddNewBuilder.Append(AddNewLayerHtml(""));

                if (!String.IsNullOrEmpty(EffectDB.LayerType))
                {
                    List <String> AddNewList = Common.GetList(EffectDB.LayerType);
                    foreach (String AddNew in AddNewList)
                    {
                        if (!String.IsNullOrEmpty(AddNew))
                        {
                            AddNewBuilder.Append(AddNewLayerHtml(AddNew));
                        }
                    }
                }

                liAddNewLink_List.Text = AddNewBuilder.ToString();

                div_Layers.Visible = true;
            }
            else
            {
                div_Layers.Visible = false;
            }



            ////插入用户按钮的连接
            //hlCreateUser.NavigateUrl = String.Format("{0}Resource_UserList.aspx?ModuleId={1}&PortalId={2}&UserId={3}&HomeDirectory={4}&TB_iframe=true&keepThis=true&height=400&width=600", ModulePath, ModuleId, PortalId, UserId, HttpUtility.UrlEncode(PortalSettings.HomeDirectory));

            //绑定状态代码
            WebHelper.BindList(ddlArticleStatus, typeof(EnumStatus));
        }
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="FieldItem"></param>
        /// <param name="ControlName"></param>
        /// <returns></returns>
        public String ViewCreateIconPicker(SettingEntity FieldItem, String ControlName, String ControlID)
        {
            StringBuilder ControlHtml = new StringBuilder();//控件的HTML


            ControlHtml.AppendFormat("<select id=\"{0}\" name=\"{1}\" class=\"form-control search-select search-select-auto {2}\" ", ControlID, ControlName, ViewVerification(FieldItem));


            ControlHtml.AppendFormat(" style=\"width:{0}px;\" >", FieldItem.Width);


            List <OptionItem> Optins = new List <OptionItem>();

            if (String.IsNullOrEmpty(FieldItem.ListContent))//没有列表项的时候,需要加载默认的字体
            {
                String    xml_url = BaseModule.Server.MapPath(String.Format("{0}Resource/xml/SelectIcons.xml", BaseModule.ModulePath));
                XmlFormat xf      = new XmlFormat(xml_url);

                Optins = xf.ToList <OptionItem>();
            }
            else if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                List <String> list = Common.GetList(FieldItem.ListContent.Replace("\r\n", "|").Replace("\r", "|"), "|");

                for (Int32 i = 0; i < list.Count; i++)
                {
                    if (!String.IsNullOrEmpty(list[i]))
                    {
                        OptionItem Optin = new OptionItem();
                        Optin.Text  = list[i];
                        Optin.Value = list[i];
                        //判断是否包含有键值对,将键值对分离开
                        if (list[i].IndexOf(":") >= 0)
                        {
                            List <String> ItemKeyValue = Common.GetList(list[i], ":");
                            Optin.Text  = ItemKeyValue[0];
                            Optin.Value = ItemKeyValue[1];
                        }
                        Optins.Add(Optin);
                    }
                }
            }


            foreach (var Optin in Optins)
            {
                String DisabledStr = String.IsNullOrEmpty(Optin.Value) ? "disabled=\"disabled\"" : "";
                String CheckedStr  = !String.IsNullOrEmpty(Optin.Value) && FieldItem.DefaultValue.IndexOf(Optin.Value, StringComparison.CurrentCultureIgnoreCase) >= 0 ? "selected=\"selected\"" : "";
                ControlHtml.AppendFormat("<option value=\"{0}\" {2} {3}> {1}</option>", Optin.Value, Optin.Text, CheckedStr, DisabledStr).AppendLine();
            }

            ControlHtml.Append("</select>");

            return(ControlHtml.ToString());
        }
Beispiel #7
0
        public String ConvertParameter(String parameter)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            if (!String.IsNullOrEmpty(parameter))
            {
                List <String> ss = Common.GetList(parameter);
                foreach (String s in ss)
                {
                    sb.AppendFormat("&{0}", s);
                }
            }
            return(sb.ToString());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="FieldItem"></param>
        /// <param name="ControlName"></param>
        /// <returns></returns>
        public String ViewCreateRadioButtonList(SettingEntity FieldItem, String ControlName, String ControlID)
        {
            StringBuilder ControlHtml = new StringBuilder();//控件的HTML

            ControlHtml.AppendFormat("<span id=\"{0}\"  class=\"{1} auto\" >", ControlID, ViewVerification(FieldItem));


            if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                List <String> list = Common.GetList(FieldItem.ListContent.Replace("\r\n", "|").Replace("\r", "|"), "|");
                for (Int32 i = 0; i < list.Count; i++)
                {
                    if (!String.IsNullOrEmpty(list[i]))
                    {
                        String OptionText  = list[i];
                        String OptionValue = list[i];
                        String OptionImage = String.Empty;
                        //判断是否包含有键值对,将键值对分离开
                        if (list[i].IndexOf(":") >= 0)
                        {
                            List <String> ItemKeyValue = Common.GetList(list[i], ":");
                            OptionText  = ItemKeyValue[0];
                            OptionValue = ItemKeyValue[1];

                            //如果有图标就检测,没有就忽略
                            OptionText = FormatIcon(OptionText);
                        }

                        String CheckedStr = FieldItem.DefaultValue.IndexOf(OptionValue, StringComparison.CurrentCultureIgnoreCase) >= 0 ? "checked=\"checked\"" : "";
                        ControlHtml.AppendFormat("<label  class=\"radio-inline\" for=\"{1}_{2}\" ><input id=\"{1}_{2}\"  type=\"radio\" name=\"{0}\" value=\"{3}\" {4} /> {5}</label>", ControlName, ControlID, i, OptionValue, CheckedStr, OptionText);
                        if (FieldItem.Direction == EnumControlDirection.Vertical.ToString())
                        {
                            ControlHtml.Append("<br />");
                        }
                    }
                }
            }

            ControlHtml.Append(" </span>");
            return(ControlHtml.ToString());
        }
Beispiel #9
0
        /// <summary>
        /// 插入单项
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <param name="GroupName"></param>
        /// <returns></returns>
        public static Int32 InsertItem(DNNGo_DNNGalleryPro_Slider ContentItem, String GroupName)
        {
            int RecordCount = 0;

            if (!String.IsNullOrEmpty(GroupName))
            {
                List <String> GroupNames = Common.GetList(GroupName);

                if (GroupNames != null && GroupNames.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (String GroupString in GroupNames)
                    {
                        sb.AppendFormat("'{0}',", GroupString);
                    }

                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ContentItem.ModuleId, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, sb.ToString().Trim(','), SearchType.In));

                    List <DNNGo_DNNGalleryPro_Group> Groups = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount);

                    if (Groups != null && Groups.Count > 0)
                    {
                        RecordCount = 0;
                        foreach (DNNGo_DNNGalleryPro_Group GroupItem in Groups)
                        {
                            DNNGo_DNNGalleryPro_Slider_Group Content_Group = new DNNGo_DNNGalleryPro_Slider_Group();
                            Content_Group.GroupID  = GroupItem.ID;
                            Content_Group.SliderID = ContentItem.ID;
                            if (Content_Group.Insert() > 0)
                            {
                                RecordCount++;
                            }
                        }
                    }
                }
            }
            return(RecordCount);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="FieldItem"></param>
        /// <param name="ControlName"></param>
        /// <returns></returns>
        public String ViewCreateListBox(SettingEntity FieldItem, String ControlName, String ControlID)
        {
            StringBuilder ControlHtml = new StringBuilder();//控件的HTML

            ControlHtml.AppendFormat("<select name=\"{0}\" id=\"{1}\"", ControlName, ControlID);

            ControlHtml.AppendFormat(" class=\"form-control input_text {0}\"", ViewVerification(FieldItem));

            ControlHtml.AppendFormat(" style=\"width:{0}px;\"", FieldItem.Width);

            ControlHtml.AppendFormat(" size=\"{0}\" multiple=\"multiple\">", FieldItem.Rows);

            if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                List <String> list             = Common.GetList(FieldItem.ListContent.Replace("\r\n", "|").Replace("\r", "|"), "|");
                List <String> DefaultListValue = Common.GetList(FieldItem.DefaultValue);
                for (Int32 i = 0; i < list.Count; i++)
                {
                    if (!String.IsNullOrEmpty(list[i]))
                    {
                        String OptionText  = list[i];
                        String OptionValue = list[i];
                        //判断是否包含有键值对,将键值对分离开
                        if (list[i].IndexOf(":") >= 0)
                        {
                            List <String> ItemKeyValue = Common.GetList(list[i], ":");
                            OptionText  = ItemKeyValue[0];
                            OptionValue = ItemKeyValue[1];
                        }


                        String CheckedStr  = DefaultListValue.Count > 0 && DefaultListValue.Contains(OptionValue) ? "selected=\"selected\"" : "";
                        String DisabledStr = String.IsNullOrEmpty(OptionValue) ? "disabled=\"disabled\"" : "";
                        ControlHtml.AppendFormat("<option {0} {1} value=\"{2}\">{3}</option>", CheckedStr, DisabledStr, OptionValue, OptionText);
                    }
                }
            }
            ControlHtml.Append(" </select>");
            return(ControlHtml.ToString());
        }
        /// <summary>
        /// 拼接扩展数据项的设置参数
        /// </summary>
        /// <returns></returns>
        public String SetExtensionSettings()
        {
            List <KeyValueEntity> list = new List <KeyValueEntity>();
            String Names  = Request.Form[String.Format("Model$Name${0}", ModuleId)];
            String Values = Request.Form[String.Format("Model$Value${0}", ModuleId)];

            if (!String.IsNullOrEmpty(Names) && !String.IsNullOrEmpty(Values))
            {
                List <String> NameList  = Common.GetList(Names, ",");
                List <String> ValueList = Common.GetList(Values, ",");

                for (Int32 i = 0; i < NameList.Count && i < ValueList.Count; i++)
                {
                    KeyValueEntity kv = new KeyValueEntity();
                    if (!String.IsNullOrEmpty(NameList[i]))
                    {
                        kv.Key   = NameList[i];
                        kv.Value = ValueList[i];
                        list.Add(kv);
                    }
                }
            }
            return(ConvertTo.Serialize <List <KeyValueEntity> >(list));
        }
Beispiel #12
0
        /// <summary>
        /// 创建文章自定义模型的JSON信息
        /// </summary>
        public void PushCustomModels()
        {
            Dictionary <String, Object> jsonCustomModels = new Dictionary <String, Object>();

            //读取出该事件的信息
            Int32 SliderID = WebHelper.GetIntParam(HttpContext.Current.Request, "SliderID", 0);

            if (SliderID > 0)
            {
                DNNGo_DNNGalleryPro_Slider EventItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);

                if (EventItem != null && EventItem.ID > 0 && !String.IsNullOrEmpty(EventItem.Extension))
                {
                    //取出扩展项
                    List <KeyValueEntity> ExtensionSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(EventItem.Extension);

                    foreach (KeyValueEntity k in ExtensionSettings)
                    {
                        if (!jsonCustomModels.ContainsKey(k.Key))
                        {
                            Dictionary <String, Object> jsonItem = new Dictionary <String, Object>();
                            jsonItem.Add("Name", k.Key);
                            jsonItem.Add("Value", k.Value);
                            jsonItem.Add("Index", jsonCustomModels.Count);

                            jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonItem);
                        }
                    }
                }
            }

            //提取预设值的自定义模型
            String CustomModels = ViewXmlSettingT <String>("CustomModels", "");

            if (!String.IsNullOrEmpty(CustomModels))
            {
                //提取共用属性名
                List <String> ExtensionKeys = Common.GetList(CustomModels, "\r\n");;
                foreach (String k in ExtensionKeys)
                {
                    if (!String.IsNullOrEmpty(k) && !jsonCustomModels.ContainsKey(k))
                    {
                        Dictionary <String, Object> jsonItem = new Dictionary <String, Object>();
                        jsonItem.Add("Name", k);
                        jsonItem.Add("Value", "");
                        jsonItem.Add("Index", jsonCustomModels.Count);

                        jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonItem);
                    }
                }
            }


            Dictionary <String, Object> jsonNull = new Dictionary <String, Object>();

            jsonNull.Add("Name", "");
            jsonNull.Add("Value", "");
            jsonNull.Add("Index", jsonCustomModels.Count);
            jsonCustomModels.Add(jsonCustomModels.Count.ToString(), jsonNull);



            //转换数据为json
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            Response.Clear();
            Response.Write(jsSerializer.Serialize(jsonCustomModels));
            Response.End();
        }