Ejemplo n.º 1
0
        /// <summary>
        /// 导出
        /// </summary>
        public String Export()
        {
            String PostContent = String.Empty;

            //查询字段的数据,填充待导出的XML实体
            QueryParam qp = new QueryParam();

            qp.OrderType = 0;
            Int32 RecordCount = 0;

            qp.Where.Add(new SearchParam("ModuleId", ModuleID, SearchType.Equal));
            List <DNNGo_DNNGalleryPro_Slider> ArticleList = DNNGo_DNNGalleryPro_Slider.FindAll(qp, out RecordCount);

            if (ArticleList != null && ArticleList.Count > 0)
            {
                List <XmlSliserEntity>       xmlContentList = new List <XmlSliserEntity>();
                List <GallerySettingsEntity> xmlSettingList = new List <GallerySettingsEntity>();
                List <GalleryGroupEntity>    xmlGroupList   = new List <GalleryGroupEntity>();


                //查询出所有的配置项
                List <SettingEntity> EffectSettingDB = Setting_EffectSettingDB;
                if (EffectSettingDB != null && EffectSettingDB.Count > 0)
                {
                    foreach (SettingEntity SettingItem in EffectSettingDB)
                    {
                        String SettingValue = ViewXmlSetting(SettingItem.Name, SettingItem.DefaultValue).ToString();
                        xmlSettingList.Add(new GallerySettingsEntity(EffectSettingsFormat(Settings_EffectName, SettingItem.Name), SettingValue));
                    }

                    foreach (String key in DNNGalleryPro_Settings.Keys)
                    {
                        if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0)
                        {
                            xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryPro_Settings[key])));
                        }
                    }
                }



                foreach (DNNGo_DNNGalleryPro_Slider ContentItem in ArticleList)
                {
                    xmlContentList.Add(EntityToXml(ContentItem));
                }

                foreach (DNNGo_DNNGalleryPro_Group GroupItem in DNNGo_DNNGalleryPro_Group.FindAllByModuleID(ModuleID))
                {
                    xmlGroupList.Add(new GalleryGroupEntity(GroupItem));
                }

                XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/SliderEntity.xml", ModulePath)));
                //将字段列表转换成XML的实体
                PostContent = xf.ToXml <XmlSliserEntity>(xmlContentList, xmlSettingList, xmlGroupList);
            }

            return(PostContent);
        }
        /// <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());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 导入项
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="ContentEntity"></param>
        /// <returns></returns>
        public Int32 ImportLayers(DNNGo_DNNGalleryPro_Slider Content, String ItemList)
        {
            Int32 Result = 0;

            if (Content != null && Content.ID > 0 && !String.IsNullOrEmpty(ItemList))
            {
                //还原出项的列表
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.LoadXml(Common.XmlDecode(ItemList));

                List <XmlLayerEntity> list = xf.ToList <XmlLayerEntity>();

                foreach (XmlLayerEntity itemEntity in list)
                {
                    DNNGo_DNNGalleryPro_Layer item = new DNNGo_DNNGalleryPro_Layer();

                    item.Options = ConvertOptions_XML(Common.XmlDecode(itemEntity.Options), Setting_LayerSettingDB);
                    item.Status  = itemEntity.Status;
                    item.Sort    = itemEntity.Sort;

                    item.CreateTime = itemEntity.CreateTime;

                    item.ModuleId = Content.ModuleId;
                    item.PortalId = Content.PortalId;
                    item.LastTime = Content.LastTime;
                    item.LastUser = Content.LastUser;
                    item.LastIP   = Content.LastIP;
                    item.SliderID = Content.ID;

                    //添加项
                    if (item.Insert() > 0)
                    {
                        Result++;
                    }
                }
            }
            return(Result);
        }
Ejemplo n.º 4
0
        public String ConvertLayers(DNNGo_DNNGalleryPro_Slider SliderItem)
        {
            String Layers_XML = String.Empty;

            if (SliderItem != null && SliderItem.ID > 0)
            {
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderItem.ID, SearchType.Equal));
                List <DNNGo_DNNGalleryPro_Layer> list = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);
                if (list != null && list.Count > 0)
                {
                    List <XmlLayerEntity> LayerList = new List <XmlLayerEntity>();
                    foreach (var item in list)
                    {
                        LayerList.Add(EntityToXml(item));
                    }
                    XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/LayerEntity.xml", ModulePath)));
                    Layers_XML = xf.ToXml <XmlLayerEntity>(LayerList);
                }
            }
            return(Layers_XML);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 效果列表行绑定
        /// </summary>
        protected void gvEffectList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DirectoryInfo EffectDir = e.Row.DataItem as DirectoryInfo;

                if (!EffectDir.Exists)
                {
                    EffectDir.Create();
                }

                //获取效果数据的XML
                String EffectDBPath = String.Format("{0}\\EffectDB.xml", EffectDir.FullName);
                if (File.Exists(EffectDBPath))
                {
                    XmlFormat xf = new XmlFormat(EffectDBPath);

                    EffectDBEntity EffectDB = xf.ToItem <EffectDBEntity>();


                    //构造图片的路径
                    Image imgPicture = e.Row.FindControl("imgPicture") as Image;
                    imgPicture.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/no_image.png'", ModulePath));
                    if (!String.IsNullOrEmpty(EffectDB.Thumbnails))
                    {
                        if (EffectDB.Thumbnails.IndexOf("http://", StringComparison.CurrentCultureIgnoreCase) >= 0)
                        {
                            imgPicture.ImageUrl = EffectDB.Thumbnails;
                        }
                        else
                        {
                            imgPicture.ImageUrl = String.Format("{0}Effects/{1}/{2}", ModulePath, EffectDB.Name, EffectDB.Thumbnails);
                        }
                    }

                    //构造效果标题描述
                    Label labName        = e.Row.FindControl("labName") as Label;
                    Label labDescription = e.Row.FindControl("labDescription") as Label;
                    Label labVersion     = e.Row.FindControl("labVersion") as Label;



                    labName.Text        = EffectDB.Name;
                    labDescription.Text = EffectDB.Description;
                    labVersion.Text     = EffectDB.Version;



                    //演示地址
                    if (!String.IsNullOrEmpty(EffectDB.DemoUrl))
                    {
                        Literal LiDemoUrl = e.Row.FindControl("LiDemoUrl") as Literal;
                        LiDemoUrl.Text = String.Format("<a href=\"{0}\" target=\"_blank\" class=\"btn btn-default btn-sm\"><i class=\"fa clip-link\"></i> {1}</a>", EffectDB.DemoUrl, ViewResourceText("labDemoUrl", "Demo Url"));
                    }

                    //响应式
                    if (EffectDB.Responsive)
                    {
                        Literal LiResponsive = e.Row.FindControl("LiResponsive") as Literal;
                        LiResponsive.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa clip-embed\"></i> {0}</a>", ViewResourceText("labResponsive", "Responsive"));
                    }

                    //带分页
                    if (EffectDB.Pager)
                    {
                        Literal LiPager = e.Row.FindControl("LiPager") as Literal;
                        LiPager.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa clip-arrow-3\"></i> {0}</a>", ViewResourceText("labPager", "Pager"));
                    }

                    if (EffectDB.Layers)
                    {
                        Literal LiLayers = e.Row.FindControl("LiLayers") as Literal;
                        LiLayers.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa clip-stack\"></i> {0}</a>", ViewResourceText("labLayers", "Layers"));
                    }

                    if (EffectDB.Ajax)
                    {
                        Literal LiAjax = e.Row.FindControl("LiAjax") as Literal;
                        LiAjax.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa fa-globe\"></i> {0}</a>", ViewResourceText("labAjax", "Ajax"));
                    }

                    if (EffectDB.Groups)
                    {
                        Literal LiGroups = e.Row.FindControl("LiGroups") as Literal;
                        LiGroups.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa fa-group\"></i> {0}</a>", ViewResourceText("labGroups", "Groups"));
                    }

                    if (EffectDB.Downloads)
                    {
                        Literal liDownloads = e.Row.FindControl("liDownloads") as Literal;
                        liDownloads.Text = String.Format("<a  class=\"btn btn-default btn-sm\"><i class=\"fa clip-folder-download\"></i> {0}</a>", ViewResourceText("labDownloads", "Downloads"));
                    }


                    //应用效果的按钮
                    LinkButton btnApply    = e.Row.FindControl("btnApply") as LinkButton;
                    HyperLink  hlThemeName = e.Row.FindControl("hlThemeName") as HyperLink;
                    btnApply.CommandArgument = EffectDB.Name;
                    if (!String.IsNullOrEmpty(Settings_EffectName) && Settings_EffectName == EffectDB.Name)//判断设置效果是否为当前效果
                    {
                        btnApply.Text     = String.Format("<i class=\"fa fa-stop\"></i> {1}", ModulePath, Localization.GetString("btnApply_Stop", this.LocalResourceFile));
                        btnApply.Enabled  = false;
                        btnApply.CssClass = "btn btn-danger";


                        hlThemeName.Text        = String.Format("<i class=\"fa clip-cogs\"></i> {0}", Settings_EffectThemeName);
                        hlThemeName.NavigateUrl = xUrl("Effect_Options");
                    }
                    else
                    {
                        btnApply.Text       = String.Format("<i class=\"fa fa-play-circle-o\"></i> {1}", ModulePath, Localization.GetString("btnApply_Play", this.LocalResourceFile));
                        btnApply.CssClass   = "btn btn-success";
                        hlThemeName.Visible = false;
                    }
                }
                else
                {
                    e.Row.Visible = false;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="XmlContent"></param>
        /// <returns></returns>
        public Int32 Import(Stream XmlContent)
        {
            //插入成功的数量
            Int32 InsertResult = 0;


            if (XmlContent != null && XmlContent.Length > 0)
            {
                //将XML转换为实体
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.Load(XmlContent);
                List <XmlSliserEntity>       XmlContentList = xf.ToList <XmlSliserEntity>();
                List <GallerySettingsEntity> XmlSettingList = xf.ToList <GallerySettingsEntity>();
                List <GalleryGroupEntity>    XmlGroupList   = xf.ToList <GalleryGroupEntity>();


                //插入分组的记录
                foreach (GalleryGroupEntity XmlGroupItem in XmlGroupList)
                {
                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, XmlGroupItem.Name, SearchType.Equal));
                    if (DNNGo_DNNGalleryPro_Group.FindCount(qp) == 0)
                    {
                        DNNGo_DNNGalleryPro_Group ContentItem = new DNNGo_DNNGalleryPro_Group();
                        ContentItem.Name        = XmlGroupItem.Name;
                        ContentItem.Description = XmlGroupItem.Description;
                        ContentItem.QuoteCount  = Convert.ToInt32(XmlGroupItem.QuoteCount);
                        ContentItem.Sort        = Convert.ToInt32(XmlGroupItem.Sort);

                        ContentItem.ModuleId = ModuleID;
                        ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;
                        ContentItem.Insert();
                    }
                }


                //插入内容的记录
                foreach (XmlSliserEntity XmlContentItem in XmlContentList)
                {
                    DNNGo_DNNGalleryPro_Slider ContentItem = XmlToEntity(XmlContentItem);
                    ContentItem.ID = ContentItem.Insert();
                    if (ContentItem.ID > 0)
                    {
                        InsertResult++;
                        ImportLayers(ContentItem, Common.XmlDecode(XmlContentItem.Layers));


                        //插入分组
                        DNNGo_DNNGalleryPro_Slider_Group.InsertItem(ContentItem, XmlContentItem.Groups);
                    }
                }



                //移除掉部分设置
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfOtherModule");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfPortal");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_TabID");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_ModuleID");

                //插入设置的记录
                foreach (GallerySettingsEntity XmlSettingItem in XmlSettingList)
                {
                    UpdateModuleSetting(ModuleID, XmlSettingItem.SettingName, XmlSettingItem.SettingValue);
                }
            }

            return(InsertResult);
        }