/// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <DNNGo_ThemePlugin_Multimedia> Comments = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));

            hlFileMateAll.Text   = String.Format("{1} ({0})", DNNGo_ThemePlugin_Multimedia.FindCountByType(0, -1), ViewResourceText("hlFileMateAll", "All"));
            hlFileMateImage.Text = String.Format("{1} ({0})", DNNGo_ThemePlugin_Multimedia.FindCountByType(0, (Int32)EnumFileMate.Image), ViewResourceText("hlFileMateImage", "Image"));
            hlFileMateZip.Text   = String.Format("{1} ({0})", DNNGo_ThemePlugin_Multimedia.FindCountByType(0, (Int32)EnumFileMate.Zip), ViewResourceText("hlFileMateZip", "Zip"));
            hlFileMateVideo.Text = String.Format("{1} ({0})", DNNGo_ThemePlugin_Multimedia.FindCountByType(0, (Int32)EnumFileMate.Video), ViewResourceText("hlFileMateVideo", "Video"));
            hlFileMateDoc.Text   = String.Format("{1} ({0})", DNNGo_ThemePlugin_Multimedia.FindCountByType(0, (Int32)EnumFileMate.Doc), ViewResourceText("hlFileMateDoc", "Doc"));


            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            gvCommentList.DataSource = Comments;
            gvCommentList.DataBind();
            BindGridViewEmpty <DNNGo_ThemePlugin_Multimedia>(gvCommentList, new DNNGo_ThemePlugin_Multimedia());
        }
예제 #2
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <DNNGo_ThemePlugin_Multimedia> Articles = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            //Boolean is_admin = !IsAdministrator && !IsAdmin;



            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            gvArticleList.DataSource = Articles;
            gvArticleList.DataBind();
            BindGridViewEmpty <DNNGo_ThemePlugin_Multimedia>(gvArticleList, new DNNGo_ThemePlugin_Multimedia());
        }
예제 #3
0
        /// <summary>
        /// 绑定相册集
        /// </summary>
        private void BindPictures(TabInfo Article)
        {
            List <String> SelectList = new List <String>();

            if (Article != null && Article.TabID > 0)
            {
                //填充相册集的关系
                List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllByID(EditTabID, PortalId, FileType);

                RepeaterFields.DataSource = Relationships;
                RepeaterFields.DataBind();

                foreach (DNNGo_ThemePlugin_Relationships Albums in Relationships)
                {
                    SelectList.Add(Albums.FileID.ToString());
                }
            }

            if (Article != null && Article.TabID > 0 && SelectList.Count > 0)
            {
                //绑定所有分类到页面
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalId, SearchType.Equal));
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(SelectList), SearchType.In));
                List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

                //拼接顶级分类的方法
                StringBuilder sb    = new StringBuilder();
                StringBuilder sbIDs = new StringBuilder();
                foreach (String FileID in SelectList)
                {
                    if (lst.Exists(r => r.ID.ToString() == FileID))
                    {
                        DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID);
                        sb.AppendFormat("<tr data-value='{0}'>", PictureItem.ID).AppendLine();
                        sb.AppendFormat("<td>{0}<br/><img src=\"{1}\" style=\"max-width:120px; margin-right:15px;\"/></td>", PictureItem.FileName, GetPhotoExtension(PictureItem.FileExtension, PictureItem.FilePath)).AppendLine();
                        sb.AppendFormat("<td class=\"center\"><a  data-value='{0}' class=\"btn btn-xs btn-bricky tooltips\" href=\"javascript:;\" data-placement=\"top\" data-original-title=\"Delete\"><i class=\"fa fa-times fa fa-white\"></i></a></td>", PictureItem.ID).AppendLine();
                        sb.Append("</tr>").AppendLine();

                        sbIDs.AppendFormat("{0},", PictureItem.ID);
                    }
                }
                hfPictures.Value = sbIDs.ToString();
                liPictures.Text  = sb.ToString();
            }
        }
예제 #4
0
        /// <summary>
        /// 页面加载需要绑定的方法
        /// </summary>
        public void BindPageLoad()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendFormat("<ul id=\"{0}\" class=\"{1}\">", SkinClientID, CssClass).AppendLine();

            DNNGo_ThemePlugin_Menu Item = GetGlobalSettings();

            EnumRelationshipsFileType FileType = Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? EnumRelationshipsFileType.Breadcrumb : EnumRelationshipsFileType.Background;
            Boolean isGlobal = (Token.IndexOf("Breadcrumb", StringComparison.CurrentCultureIgnoreCase) >= 0 ? Item.Globals_Breadcrumb : Item.Globals_Background) == 1;

            List <String> FileIDs = new List <String>();
            List <DNNGo_ThemePlugin_Relationships> Relationships = DNNGo_ThemePlugin_Relationships.FindAllViewByID(PortalSettings.ActiveTab.TabID, PortalSettings.PortalId, (Int32)FileType, isGlobal);

            foreach (DNNGo_ThemePlugin_Relationships Relationship in Relationships)
            {
                FileIDs.Add(Relationship.FileID.ToString());
            }


            if (FileIDs != null && FileIDs.Count > 0)
            {
                //绑定所有分类到页面
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, PortalSettings.PortalId, SearchType.Equal));
                qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.ID, Common.GetStringByList(FileIDs), SearchType.In));
                List <DNNGo_ThemePlugin_Multimedia> lst = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

                foreach (String FileID in FileIDs)
                {
                    if (lst.Exists(r => r.ID.ToString() == FileID))
                    {
                        DNNGo_ThemePlugin_Multimedia PictureItem = lst.Find(r => r.ID.ToString() == FileID);
                        if (PictureItem != null && PictureItem.ID > 0)
                        {
                            sb.AppendFormat("<li style=\"background-image:url('{0}')\"></li>", GetPhotoPath(PictureItem.FilePath)).AppendLine();
                        }
                    }
                }
            }


            sb.Append("</ul>").AppendLine();
            liHTML.Text = sb.ToString();
        }
        public void Execute(BasePage Context)
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld = DNNGo_ThemePlugin_Multimedia._.ID;

            qp.PageIndex = WebHelper.GetIntParam(Context.Request, "PageIndex", 1);
            qp.PageSize  = WebHelper.GetIntParam(Context.Request, "PageSize", Int32.MaxValue);
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.Status, (Int32)EnumFileStatus.Approved, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_ThemePlugin_Multimedia._.PortalId, Context.PortalId, SearchType.Equal));

            int RecordCount = 0;
            List <DNNGo_ThemePlugin_Multimedia> fileList = DNNGo_ThemePlugin_Multimedia.FindAll(qp, out RecordCount);

            Dictionary <String, Object> jsonPictures = new Dictionary <string, Object>();

            TemplateFormat       xf           = new TemplateFormat();
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();


            foreach (var fileItem in fileList)
            {
                int index = fileList.IndexOf(fileItem); //index 为索引值

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

                jsonPicture.Add("Pages", qp.Pages);


                jsonPicture.Add("ID", fileItem.ID);

                jsonPicture.Add("CreateTime", fileItem.LastTime);

                jsonPicture.Add("Name", WebHelper.leftx(fileItem.Name, 20, "..."));
                jsonPicture.Add("Extension", fileItem.FileExtension);


                String ThumbnailUrl = Context.ViewLinkUrl(String.Format("MediaID={0}", fileItem.ID));
                jsonPicture.Add("ThumbnailUrl", ThumbnailUrl);
                jsonPicture.Add("FileUrl", Context.GetPhotoPath(fileItem.FilePath));

                jsonPicture.Add("Thumbnail", String.Format("<img style=\"border-width:0px; max-height:60px;max-width:80px;\"  src=\"{0}\"  /> ", ThumbnailUrl));
                //判断当前文件是否为图片
                if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("gif,jpg,jpeg,bmp,png").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsVideo", false);
                    jsonPicture.Add("IsPicture", true);
                }
                else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("mp4,mkv,avi,ogv,webm,m4v").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsVideo", true);
                    jsonPicture.Add("IsPicture", false);


                    switch (fileItem.FileExtension)
                    {
                    case "mp4": jsonPicture.Add("IsMp4", true); break;

                    case "m4v": jsonPicture.Add("IsM4v", true); break;

                    case "ogv": jsonPicture.Add("IsOgv", true); break;

                    case "webm": jsonPicture.Add("IsWebm", true); break;

                    default: break;
                    }
                }
                else if (!String.IsNullOrEmpty(fileItem.FileExtension) && ("flv,swf").IndexOf(fileItem.FileExtension, StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    jsonPicture.Add("IsFlash", true);
                    jsonPicture.Add("IsPicture", false);
                    jsonPicture.Add("Guid", Guid.NewGuid().ToString());
                }
                else
                {
                    jsonPicture.Add("IsVideo", false);
                    jsonPicture.Add("IsPicture", false);
                }

                jsonPicture.Add("Json", jsSerializer.Serialize(jsonPicture));

                jsonPictures.Add(index.ToString(), jsonPicture);
            }

            //转换数据为json

            ResponseString = jsSerializer.Serialize(jsonPictures);
        }