/// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDataToPage()
        {
            cbCopyOfOtherModule.Checked = Settings["DNNGalleryPro_CopyOfOtherModule"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_CopyOfOtherModule"].ToString()) ? Convert.ToBoolean(Settings["DNNGalleryPro_CopyOfOtherModule"]) : false;


            //绑定当前站点列表
            DotNetNuke.Entities.Portals.PortalController portalController = new DotNetNuke.Entities.Portals.PortalController();
            WebHelper.BindList <PortalInfo>(ddlPortals, Common.Split <PortalInfo>(portalController.GetPortals(), 1, int.MaxValue), "PortalName", "PortalID");
            WebHelper.SelectedListByValue(ddlPortals, Settings["DNNGalleryPro_CopyOfPortal"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_CopyOfPortal"].ToString()) ? Convert.ToInt32(Settings["DNNGalleryPro_CopyOfPortal"]) : PortalId);


            BindModuleList();
            WebHelper.SelectedListByValue(ddlTabModule, String.Format("{0}-{1}", Settings_TabID, Settings_ModuleID));

            WebHelper.BindList(ddlSortby, typeof(EnumSortby));
            WebHelper.SelectedListByValue(ddlSortby, Settings["DNNGalleryPro_Sortby"] != null && !string.IsNullOrEmpty(Settings["DNNGalleryPro_Sortby"].ToString()) ? Convert.ToInt32(Settings["DNNGalleryPro_Sortby"]) : 0);

            divSortbyHelp.Visible = !Setting_SliderSettingDB.Exists(r => r.Name == "Title");


            cbFilterStartTime.Checked = Settings["DNNGalleryPro_FilterStartTime"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_FilterStartTime"]) : true;

            cbFilterEndTime.Checked = Settings["DNNGalleryPro_FilterEndTime"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_FilterEndTime"]) : true;


            cbCompressionEnable.Checked = Settings["DNNGalleryPro_CompressionEnable"] != null?Convert.ToBoolean(Settings["DNNGalleryPro_CompressionEnable"]) : false;

            txtCompressionQuality.Text = Settings["DNNGalleryPro_CompressionQuality"] != null?Convert.ToString(Settings["DNNGalleryPro_CompressionQuality"]) : "90";
        }
        /// <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));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindDataToPage()
        {
            EffectDBEntity XmlDB = Setting_EffectDB;

            if (!(XmlDB != null && String.IsNullOrEmpty(XmlDB.Name)))
            {
                lblEffectName.Text        = XmlDB.Name;
                lblEffectDescription.Text = XmlDB.Description;

                //绑定效果的主题
                String        EffectDirPath = String.Format("{0}Effects/{1}/Themes/", Server.MapPath(ModulePath), XmlDB.Name);
                DirectoryInfo EffectDir     = new DirectoryInfo(EffectDirPath);
                if (!EffectDir.Exists)
                {
                    EffectDir.Create();
                }
                DirectoryInfo[]       ThemeDirs = EffectDir.GetDirectories();
                List <KeyValueEntity> dirs      = new List <KeyValueEntity>();
                if (ThemeDirs != null && ThemeDirs.Length > 0)
                {
                    foreach (DirectoryInfo dir in ThemeDirs)
                    {
                        KeyValueEntity dirEntity = new KeyValueEntity();
                        dirEntity.Key = dir.Name;

                        FileInfo imgFile = new FileInfo(MapPath(String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name)));
                        if (imgFile.Exists)
                        {
                            dirEntity.Value = String.Format("{0}Effects/{1}/Themes/{2}/image.jpg", ModulePath, XmlDB.Name, dir.Name);
                        }
                        else
                        {
                            dirEntity.Value = String.Format("http://www.dnngo.net/DesktopModules/DNNGo_DNNGalleryPro/Effects/{0}/Themes/{1}/image.jpg", XmlDB.Name, dir.Name);
                        }


                        dirs.Add(dirEntity);
                    }
                    WebHelper.BindList <KeyValueEntity>(ddlThemeName, dirs, "Key", "Value");
                }
                WebHelper.SelectedListByText(ddlThemeName, Settings_EffectThemeName);


                // hfThemeThumbnails.Value = String.Format("{0}Effects/{1}/Themes/[EffectThemeName]/image.jpg", ModulePath, XmlDB.Name);
                if (!String.IsNullOrEmpty(Settings_EffectThemeName))
                {
                    imgThemeThumbnails.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/no_image.png'", ModulePath));
                    imgThemeThumbnails.ToolTip = Settings_EffectThemeName;
                    KeyValueEntity dirEntity = dirs.Find(r1 => r1.Key.IndexOf(Settings_EffectThemeName, StringComparison.CurrentCultureIgnoreCase) >= 0);
                    imgThemeThumbnails.ImageUrl = dirEntity != null?dirEntity.Value.ToString() : "";

                    imgThemeThumbnails.Visible = true;
                }
            }
        }
Ejemplo n.º 4
0
        /// <Description>
        /// 绑定页面项
        /// </Description>
        private void BindPageItem()
        {
            //链接
            String Element_UrlLink = FieldItem != null ? FieldItem.DefaultValue : String.Empty;

            //imgUrlLink.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/1-1.png'", ModulePath));

            WebHelper.BindList <TabInfo>(ddlUrlLink, TabController.GetPortalTabs(Settings_PortalID, Null.NullInteger, true, true, false, false), "IndentedTabName", "TabId");

            List <EnumEntity> EnumList = EnumHelper.GetEnumList(typeof(EnumUrlControls));


            //设置和选择哪些类型可以显示出来

            if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                if (!FindUrlType(FieldItem.ListContent, "U"))
                {
                    EnumList.RemoveAll(r => r.Value == 1);
                }
                if (!FindUrlType(FieldItem.ListContent, "P"))
                {
                    EnumList.RemoveAll(r => r.Value == 2);
                }
                if (!FindUrlType(FieldItem.ListContent, "F"))
                {
                    EnumList.RemoveAll(r => r.Value == 3);
                }

                if (EnumList.Count == 1)
                {
                    rblUrlLink.Visible = false;
                }

                WebHelper.BindList <EnumEntity>(rblUrlLink, EnumList, "Text", "Value");

                String defaultType = WebHelper.leftx(FieldItem.ListContent, 1).ToUpper();
                if (!String.IsNullOrEmpty(defaultType))
                {
                    ShowHideControl(defaultType);
                }
            }
            else
            {
                WebHelper.BindList <EnumEntity>(rblUrlLink, EnumList, "Text", "Value");
                ShowHideControl("U");
            }



            if (!String.IsNullOrEmpty(Element_UrlLink) && Element_UrlLink.IndexOf("TabID=", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                WebHelper.SelectedListByValue(ddlUrlLink, Element_UrlLink.Replace("TabID=", ""));
                //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Page);
                //txtUrlLink.Attributes.Add("style", "display:none");
                //panUrlLink.Attributes.Add("style", "display:none");
                ShowHideControl("P");
            }
            else if (!String.IsNullOrEmpty(Element_UrlLink) && Element_UrlLink.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                TemplateFormat xf = new TemplateFormat(this);
                hfUrlLink.Value = Element_UrlLink;
                //imgUrlLink.ImageUrl = xf.ViewLinkUrl(Element_UrlLink);

                div_Image.Attributes.Add("data-MediaID", Element_UrlLink);

                ShowHideControl("F");
                //hlRemoveUrlLink.Attributes.Add("style", "display:;");
                //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Files);
                //txtUrlLink.Attributes.Add("style", "display:none");
                //ddlUrlLink.Attributes.Add("style", "display:none");
            }
            else
            {
                if (!String.IsNullOrEmpty(Element_UrlLink))
                {
                    if (Element_UrlLink.IndexOf("FileID=", StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        int FileID = 0;
                        if (int.TryParse(Element_UrlLink.Replace("FileID=", ""), out FileID) && FileID > 0)
                        {
                            var fi = FileManager.Instance.GetFile(FileID);
                            if (fi != null && fi.FileId > 0)
                            {
                                txtUrlLink.Text = string.Format("{0}{1}{2}", PortalSettings.HomeDirectory, fi.Folder, Server.UrlPathEncode(fi.FileName));
                            }
                        }
                    }
                    else
                    {
                        txtUrlLink.Text = Element_UrlLink;
                    }
                    ShowHideControl("U");
                }

                //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Url);
                //ddlUrlLink.Attributes.Add("style", "display:none");
                //panUrlLink.Attributes.Add("style", "display:none");
            }
        }