コード例 #1
0
        public VelocityHelper(basePortalModule _bpm, EffectDBEntity _Theme)
        {
            Theme = _Theme;
            bpm   = _bpm;

            Init(_bpm);
        }
コード例 #2
0
        /// <summary>
        /// XmlDB
        /// </summary>
        /// <param name="XmlDB">配置文件</param>
        /// <param name="XmlName">效果/皮肤</param>
        public void BindXmlDBToPage(EffectDBEntity XmlDB, String XmlName)
        {
            int priority = 50;

            //绑定全局附带的脚本
            if (!String.IsNullOrEmpty(XmlDB.GlobalScript))
            {
                List <String> GlobalScripts = WebHelper.GetList(XmlDB.GlobalScript);

                foreach (String Script in GlobalScripts)
                {
                    if (!String.IsNullOrEmpty(Script))
                    {
                        if (Script.IndexOf(".css", StringComparison.CurrentCultureIgnoreCase) > 0)
                        {
                            String FullFileName = String.Format("{0}Resource/css/{1}", ModulePath, Script);
                            BindStyleFile(Script.Replace(".css", ""), FullFileName, priority);
                        }
                        else //if (Script.IndexOf(".js", StringComparison.CurrentCultureIgnoreCase) > 0)
                        {
                            String FullFileName = String.Format("{0}Resource/js/{1}", ModulePath, Script);
                            BindJavaScriptFile(Script.Replace(".js", ""), FullFileName, priority);
                        }
                        priority++;
                    }
                }
            }
            //绑定效果附带的脚本
            if (!String.IsNullOrEmpty(XmlDB.EffectScript))
            {
                List <String> EffectScripts = WebHelper.GetList(XmlDB.EffectScript);

                foreach (String Script in EffectScripts)
                {
                    if (!String.IsNullOrEmpty(Script))
                    {
                        if (Script.IndexOf(".css", StringComparison.CurrentCultureIgnoreCase) > 0)
                        {
                            String FullFileName = String.Format("{0}{1}s/{2}/css/{3}", ModulePath, XmlName, XmlDB.Name, Script);
                            BindStyleFile(Script.Replace(".css", ""), FullFileName, priority);
                        }
                        else
                        {
                            String FullFileName = String.Format("{0}{1}s/{2}/js/{3}", ModulePath, XmlName, XmlDB.Name, Script);
                            BindJavaScriptFile(Script.Replace(".js", ""), FullFileName, priority);
                        }
                        priority++;
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 显示模版
        /// </summary>
        /// <param name="Theme"></param>
        /// <param name="xf"></param>
        /// <param name="Puts"></param>
        /// <returns></returns>
        public String ViewTemplate(EffectDBEntity Theme, String ThemeFile, Hashtable Puts, TemplateFormat xf)
        {
            VelocityHelper vltContext = new VelocityHelper(this, Theme);


            vltContext.Put("xf", xf);             //模版格式化共用方法
            vltContext.Put("ModuleID", ModuleId); //绑定的主模块编号
            vltContext.Put("TabID", TabId);       //绑定的主模块页面编号

            if (Puts != null && Puts.Count > 0)
            {
                foreach (String key in Puts.Keys)
                {
                    vltContext.Put(key, Puts[key]);
                }
            }
            return(vltContext.Display(ThemeFile));
        }
コード例 #4
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(Settings_EffectName))
                {
                    if (!String.IsNullOrEmpty(Settings_EffectThemeName))
                    {
                        EffectDBEntity EffectDB = Setting_EffectDB;
                        if (!IsPostBack)
                        {
                            //绑定数据项到前台
                            BindDataItem(EffectDB);
                        }

                        //需要载入当前设置效果的主题CSS文件
                        String ThemeName = String.Format("{0}_{1}", Settings_EffectName, Settings_EffectThemeName);
                        String ThemePath = String.Format("{0}Effects/{1}/Themes/{2}/Style.css", ModulePath, Settings_EffectName, Settings_EffectThemeName);
                        BindStyleFile(ThemeName, ThemePath);


                        BindXmlDBToPage(EffectDB, "Effect");
                    }
                    else
                    {
                        //未定义效果对应的主题
                        liContent.Text = "";
                    }
                }
                else
                {
                    //未绑定效果
                    liContent.Text = "";
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        /// <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_LayerGallery/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;
                }
            }


            ////获取效果参数
            //List<SettingEntity> EffectSettingDB = Setting_SkinEffectSettingDB;

            //if (EffectSettingDB != null && EffectSettingDB.Count > 0)
            //{
            //    //绑定参数项
            //    RepeaterTheme.DataSource = EffectSettingDB;
            //    RepeaterTheme.DataBind();
            //}
        }
コード例 #6
0
        /// <summary>
        /// 绑定数据项到前台
        /// </summary>
        public void BindDataItem(EffectDBEntity EffectDB)
        {
            List <DNNGo_LayerGallery_Content> DataList = new List <DNNGo_LayerGallery_Content>();
            Hashtable      Puts = new Hashtable();
            TemplateFormat xf   = new TemplateFormat(this);

            xf.PhContent = PhContent;

            //读取需要载入的参数
            QueryParam qp          = new QueryParam();
            int        RecordCount = 0;

            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.Status, (Int32)EnumStatus.Published, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual));
            qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual));
            qp.OrderType = 0;


            if (EffectDB.Pager)//传入分页的数量
            {
                qp.PageSize  = (Int32)xf.ViewXmlSetting("PageSize", 9999);
                qp.PageSize  = qp.PageSize <= 0 ? 9999 : qp.PageSize;
                qp.PageIndex = PageIndex;
            }



            if (Settings_Sortby == (Int32)EnumSortby.Name)
            {
                qp.Orderfld = DNNGo_LayerGallery_Content._.Title;
                DataList    = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount);
            }
            else if (Settings_Sortby == (Int32)EnumSortby.Name_Desc)
            {
                qp.OrderType = 1;
                qp.Orderfld  = DNNGo_LayerGallery_Content._.Title;
                DataList     = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount);
            }
            else if (Settings_Sortby == (Int32)EnumSortby.Time)
            {
                qp.Orderfld = DNNGo_LayerGallery_Content._.StartTime;
                DataList    = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount);
            }
            else if (Settings_Sortby == (Int32)EnumSortby.Time_Desc)
            {
                qp.OrderType = 1;
                qp.Orderfld  = DNNGo_LayerGallery_Content._.StartTime;
                DataList     = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount);
            }
            else if (Settings_Sortby == (Int32)EnumSortby.Random)
            {
                qp.Orderfld = " newid() ";
                DataList    = DNNGo_LayerGallery_Content.FindRandomAll(qp, out RecordCount);
            }
            else
            {
                qp.Orderfld = DNNGo_LayerGallery_Content._.Sort;
                DataList    = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount);
            }

            List <DNNGo_LayerGallery_Content> tList = new List <DNNGo_LayerGallery_Content>();

            //查看需要过滤掉非激活的选项
            foreach (var content in DataList)
            {
                String Activate = Convert.ToString(xf.GetValue(xf.ViewDicts(content), "activate", "on"));
                if (String.IsNullOrEmpty(Activate) || Activate.ToLower() == "on")
                {
                    tList.Add(content);
                }
            }



            Puts.Add("DataList", tList);
            Puts.Add("EffectName", Settings_EffectName);
            Puts.Add("ThemeName", Settings_EffectThemeName);


            //加载LayerList
            Puts.Add("LayerList", GetLayerList());



            if (EffectDB.Pager && RecordCount > qp.PageSize)
            {
                Puts.Add("Pager", new Pager(qp.PageIndex, qp.PageSize, ModuleId, RecordCount, EnumPageType.DnnURL).CreateHtml());//分页
            }
            else
            {
                Puts.Add("Pager", "");
            }

            String HtmlContent = ViewTemplate(EffectDB, "Effect.html", Puts, xf);


            //#if RELEASE  //Release状态下需要格式化HTML代码
            HtmlContent = CodeDeal.DealCode(HtmlContent);    //格式化HTML
            //#endif
            liContent.Text = HtmlContent;
        }
コード例 #7
0
        /// <summary>
        /// 显示模版
        /// </summary>
        /// <param name="Theme"></param>
        /// <param name="ThemeFile"></param>
        /// <param name="Puts"></param>
        /// <returns></returns>
        public String ViewTemplate(EffectDBEntity Theme, String ThemeFile, Hashtable Puts)
        {
            TemplateFormat xf = new TemplateFormat(this);

            return(ViewTemplate(Theme, ThemeFile, Puts, xf));
        }