Example #1
0
        /// <summary>
        /// 绑定查询的方法
        /// </summary>
        private List <SearchParam> BindSearch()
        {
            List <SearchParam> Where = new List <SearchParam>();

            Where.Add(new SearchParam("PortalId", Settings_PortalID, SearchType.Equal));
            //Where.Add(new SearchParam("ModuleId", ModuleId, SearchType.Equal));


            //筛选文章的状态
            if (FileType >= 0)
            {
                Where = DNNGo_LayerGallery_Files.ByType(Where, FileType);
            }


            if (!String.IsNullOrEmpty(Search_Title))
            {
                txtSearch.Text = HttpUtility.UrlDecode(Search_Title);
                Where.Add(new SearchParam(DNNGo_LayerGallery_Files._.Name, HttpUtility.UrlDecode(Search_Title), SearchType.Like));
            }



            return(Where);
        }
Example #2
0
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    mTips.IsPostBack = true;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            DNNGo_LayerGallery_Files Multimedia = DNNGo_LayerGallery_Files.FindByKeyForEdit(IDX);
                            if (Multimedia != null && Multimedia.ID > 0)
                            {
                                //if (Multimedia.Status == (Int32)EnumFileStatus.Recycle && Status == (Int32)EnumFileStatus.Recycle)
                                //{
                                //要删除实际的文件
                                String DeletePath = Server.MapPath(GetPhotoPath(Multimedia.FilePath));
                                if (Multimedia.Delete() > 0)
                                {
                                    //删除文件
                                    if (File.Exists(DeletePath))
                                    {
                                        File.Delete(DeletePath);
                                    }

                                    //操作成功
                                    mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                                }
                                else
                                {
                                    //操作失败
                                    mTips.LoadMessage("DeleteMediaLibraryError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                                }

                                //}
                                //else
                                //{
                                //    Multimedia.Status = Status;
                                //    if (Multimedia.Update() > 0)
                                //    {
                                //    }
                                //}
                            }
                        }
                    }
                    BindDataList();
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Example #3
0
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    mTips.IsPostBack = true;

                    DNNGo_LayerGallery_Files Multimedia = DNNGo_LayerGallery_Files.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Multimedia != null && Multimedia.ID > 0)
                    {
                        //if (Multimedia.Status == (Int32)EnumFileStatus.Recycle)
                        //{
                        //要删除实际的文件
                        String DeletePath = Server.MapPath(GetPhotoPath(Multimedia.FilePath));
                        if (Multimedia.Delete() > 0)
                        {
                            //删除文件
                            if (File.Exists(DeletePath))
                            {
                                File.Delete(DeletePath);
                            }

                            //操作成功
                            mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        else
                        {
                            //操作失败
                            mTips.LoadMessage("DeleteMediaLibraryError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        //}
                        //else
                        //{
                        //    Multimedia.Status = (Int32)EnumFileStatus.Recycle;
                        //    if (Multimedia.Update() > 0)
                        //    {
                        //        //移动到回收站操作成功
                        //        mTips.LoadMessage("DeleteCommentSuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //    else
                        //    {
                        //        //移动到回收站操作失败
                        //        mTips.LoadMessage("DeleteCommentError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //}
                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 获取图片的路径
        /// </summary>
        /// <param name="media">媒体文件的实体</param>
        /// <returns></returns>
        public String GetPhotoPath(DNNGo_LayerGallery_Files media)
        {
            String PhotoPath = String.Empty;

            if (media != null && media.ID > 0)
            {
                PhotoPath = GetPhotoPath(media.FilePath);
            }
            return(PhotoPath);
        }
Example #5
0
        public String ViewPicture(DNNGo_LayerGallery_Files DataItem, PortalSettings ps, String ModulePath)
        {
            String Picture = String.Format("{0}Resource/images/DefaultPhoto.png", ModulePath);

            if (DataItem != null && DataItem.ID > 0)
            {
                Picture = GetPhotoPath(DataItem, ps);
            }
            return(Picture);
        }
Example #6
0
 private void SetValues(DNNGo_LayerGallery_Files PhotoItem, int fileLength, PortalSettings ps, String ModulePath)
 {
     name          = WebHelper.leftx(PhotoItem.Name, 35, "...");
     type          = "image/png";
     size          = PhotoItem.FileSize * 1024;
     progress      = "1.0";
     url           = ViewPicture(PhotoItem, ps, ModulePath);
     thumbnail_url = GetPhotoExtension(PhotoItem.FileExtension, PhotoItem.FilePath, ps, ModulePath);
     delete_url    = String.Format("{2}Resource_jQueryFileUpload.ashx?ID={0}&type=DELETE&{1}", PhotoItem.ID, WebHelper.GetScriptNameQueryString, ModulePath);
     delete_type   = "POST";
 }
Example #7
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <DNNGo_LayerGallery_Files> Comments = DNNGo_LayerGallery_Files.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"));


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


            //ctlPagingControl.TotalRecords = RecordCount;

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

            //}

            gvCommentList.DataSource = Comments;
            gvCommentList.DataBind();
            BindGridViewEmpty <DNNGo_LayerGallery_Files>(gvCommentList, new DNNGo_LayerGallery_Files());
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

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

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


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


            #endregion

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

            List <DNNGo_LayerGallery_Files> Articles = DNNGo_LayerGallery_Files.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"));



            //ctlPagingControl.TotalRecords = RecordCount;

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

            //}

            gvArticleList.DataSource = Articles;
            gvArticleList.DataBind();
            BindGridViewEmpty <DNNGo_LayerGallery_Files>(gvArticleList, new DNNGo_LayerGallery_Files());
        }
        /// <summary>
        /// 显示URL控件存放的值
        /// </summary>
        /// <param name="UrlValue"></param>
        /// <returns></returns>
        public String ViewLinkUrl(String UrlValue, int PortalId)
        {
            String DefaultValue = String.Empty;

            if (!String.IsNullOrEmpty(UrlValue))
            {
                if (UrlValue.IndexOf("FileID=", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    var fi = FileManager.Instance.GetFile(Convert.ToInt32(UrlValue.Replace("FileID=", "")));

                    DefaultValue = string.Format("{0}{1}{2}", PortalSettings.HomeDirectory, fi.Folder, Server.UrlPathEncode(fi.FileName));
                    DefaultValue = MapPath(DefaultValue);
                }
                else if (UrlValue.IndexOf("TabID=", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    DefaultValue = Globals.NavigateURL(Convert.ToInt32(UrlValue.Replace("TabID=", "")));
                }
                else if (UrlValue.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    DefaultValue = String.Format("{0}Resource/images/no_image.png", ModulePath);

                    int MediaID = 0;
                    if (int.TryParse(UrlValue.Replace("MediaID=", ""), out MediaID) && MediaID > 0)
                    {
                        DNNGo_LayerGallery_Files Multimedia = DNNGo_LayerGallery_Files.FindByID(MediaID);
                        if (Multimedia != null && Multimedia.ID > 0)
                        {
                            DefaultValue = String.Format("{0}{1}", PortalSettings.HomeDirectory, Multimedia.FilePath);
                        }
                    }
                    DefaultValue = Server.MapPath(DefaultValue);
                }
                else
                {
                    DefaultValue = UrlValue;
                    if (!String.IsNullOrEmpty(DefaultValue) && DefaultValue.IndexOf("http://") < 0)
                    {
                        DefaultValue = MapPath(DefaultValue);
                    }
                }
            }
            return(DefaultValue);
        }
        private void DeliverFile(HttpContext context)
        {
            DNNGo_LayerGallery_Files DataItem = DNNGo_LayerGallery_Files.FindByKeyForEdit(WebHelper.GetStringParam(context.Request, "PhotoID", "0"));

            if (DataItem != null && DataItem.ID > 0)
            {
                String Picture = GetPhotoPath(DataItem);

                if (!String.IsNullOrEmpty(Picture) && File.Exists(context.Server.MapPath(Picture)))
                {
                    context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + DataItem.FileName + "\"");
                    context.Response.ContentType = "application/octet-stream";
                    context.Response.ClearContent();
                    context.Response.WriteFile(context.Server.MapPath(Picture));
                }
                else
                {
                    context.Response.StatusCode = 404;
                }
            }
            else
            {
                context.Response.StatusCode = 404;
            }



            //var filename = context.Request["PhotoID"];
            //var filePath = StorageRoot + filename;

            //if (File.Exists(filePath)) {
            //    context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
            //    context.Response.ContentType = "application/octet-stream";
            //    context.Response.ClearContent();
            //    context.Response.WriteFile(filePath);
            //} else
            //    context.Response.StatusCode = 404;
        }
        // Delete file from the server
        private void DeleteFile(HttpContext context)
        {
            Int32 PhotoID = WebHelper.GetIntParam(context.Request, "ID", 0);
            DNNGo_LayerGallery_Files PhotoItem = DNNGo_LayerGallery_Files.FindByKeyForEdit(PhotoID);

            if (PhotoItem != null && PhotoItem.ID > 0)
            {
                //要删除实际的文件
                String DeletePath = HttpContext.Current.Server.MapPath(GetPhotoPath(PhotoItem.FilePath));


                //删除文件
                if (File.Exists(DeletePath))
                {
                    try
                    {
                        File.Delete(DeletePath);
                    }
                    catch { }
                }
                //删除记录
                PhotoItem.Delete();
            }
        }
Example #12
0
 public Resource_FilesStatus(DNNGo_LayerGallery_Files PhotoItem, PortalSettings ps, String ModulePath)
 {
     SetValues(PhotoItem, PhotoItem.FileSize, ps, ModulePath);
 }
        // Upload entire file
        private void UploadWholeFile(HttpContext context, List <Resource_FilesStatus> statuses)
        {
            for (int i = 0; i < context.Request.Files.Count; i++)
            {
                var file = context.Request.Files[i];

                if (file != null && !String.IsNullOrEmpty(file.FileName) && file.ContentLength > 0)
                {
                    DNNGo_LayerGallery_Files PhotoItem = new DNNGo_LayerGallery_Files();

                    PhotoItem.ModuleId = WebHelper.GetIntParam(context.Request, "ModuleId", 0);
                    PhotoItem.PortalId = WebHelper.GetIntParam(context.Request, "PortalId", 0);


                    PhotoItem.FileName = file.FileName;
                    PhotoItem.FileSize = file.ContentLength / 1024;
                    PhotoItem.FileMate = FileSystemUtils.GetContentType(Path.GetExtension(PhotoItem.FileName).Replace(".", ""));

                    PhotoItem.FileExtension = System.IO.Path.GetExtension(PhotoItem.FileName).Replace(".", "");
                    PhotoItem.Name          = System.IO.Path.GetFileName(file.FileName).Replace(Path.GetExtension(PhotoItem.FileName), "");
                    PhotoItem.Status        = (Int32)EnumFileStatus.Approved;

                    try
                    {
                        if (("png,gif,jpg,jpeg,bmp").IndexOf(PhotoItem.FileExtension) >= 0)
                        {
                            //图片的流
                            Image image = Image.FromStream(file.InputStream);
                            PhotoItem.ImageWidth  = image.Width;
                            PhotoItem.ImageHeight = image.Height;

                            PhotoItem.Exif = Common.Serialize <EXIFMetaData.Metadata>(new EXIFMetaData().GetEXIFMetaData(image));
                        }
                    }
                    catch
                    {
                    }

                    PhotoItem.LastTime = xUserTime.UtcTime();
                    PhotoItem.LastIP   = WebHelper.UserHost;
                    PhotoItem.LastUser = UserInfo.UserID;


                    //将文件存储的路径整理好
                    String fileName = System.IO.Path.GetFileName(FileSystemUtils.HandleFileName(file.FileName)).Replace("." + PhotoItem.FileExtension, ""); //文件名称
                    String WebPath  = String.Format("LayerGallery/uploads/{0}/{1}/{2}/", xUserTime.UtcTime().Year, xUserTime.UtcTime().Month, xUserTime.UtcTime().Day);
                    //检测文件存储路径是否有相关的文件
                    FileInfo fInfo = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));

                    //检测文件夹是否存在
                    if (!System.IO.Directory.Exists(fInfo.Directory.FullName))
                    {
                        System.IO.Directory.CreateDirectory(fInfo.Directory.FullName);
                    }
                    else
                    {
                        Int32 j = 1;
                        while (fInfo.Exists)
                        {
                            //文件已经存在了
                            fileName = String.Format("{0}_{1}", FileSystemUtils.HandleFileName(PhotoItem.Name), j);
                            fInfo    = new FileInfo(HttpContext.Current.Server.MapPath(String.Format("{0}{1}{2}.{3}", PortalSettings.HomeDirectory, WebPath, fileName, PhotoItem.FileExtension)));
                            j++;
                        }
                    }

                    PhotoItem.FilePath = String.Format("{0}{1}.{2}", WebPath, fileName, PhotoItem.FileExtension);
                    PhotoItem.FileName = String.Format("{0}.{1}", fileName, PhotoItem.FileExtension);
                    try
                    {
                        if (!fInfo.Directory.Exists)
                        {
                            fInfo.Directory.Create();

                            // FileSystemUtils.AddFolder(PortalSettings, String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), String.Format("{0}DNNGo_PhotoAlbums/{0}/{1}/"), (int)DotNetNuke.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem);
                        }

                        //构造指定存储路径
                        file.SaveAs(fInfo.FullName);
                        //FileSystemUtils.AddFile(PhotoItem.FileName, PhotoItem.PortalId, String.Format("DNNGo_PhotoAlbums\\{0}\\{1}\\", PhotoItem.ModuleId, PhotoItem.AlbumID), PortalSettings.HomeDirectoryMapPath, PhotoItem.FileMeta);
                    }
                    catch (Exception ex)
                    {
                    }

                    //给上传的相片设置初始的顺序
                    QueryParam qp = new QueryParam();
                    qp.ReturnFields = qp.Orderfld = DNNGo_LayerGallery_Files._.Sort;
                    qp.OrderType    = 1;
                    qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Files._.PortalId, PhotoItem.PortalId, SearchType.Equal));
                    PhotoItem.Sort = Convert.ToInt32(DNNGo_LayerGallery_Files.FindScalar(qp)) + 2;
                    Int32 PhotoId = PhotoItem.Insert();



                    statuses.Add(new Resource_FilesStatus(PhotoItem, PortalSettings, ModulePath));
                }
            }
        }
Example #14
0
 public String ThumbnailUrl(DNNGo_LayerGallery_Files DataItem, PortalSettings ps, String ModulePath)
 {
     return(String.Format("{0}Resource_Service.aspx?Token=thumbnail&PortalId={1}&TabId={2}&ID={3}&width=40&height=40&mode=WH", ModulePath, ps.PortalId, ps.ActiveTab.TabID, DataItem.ID));
 }
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvArticleList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                DNNGo_LayerGallery_Files Media = e.Row.DataItem as DNNGo_LayerGallery_Files;

                if (Media != null && Media.ID > 0)
                {
                    Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label;
                    lblFileExtension.Text = Media.FileExtension;

                    Image imgFileName = e.Row.FindControl("imgFileName") as Image;

                    HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink;
                    hlFileName.Text        = Media.FileName.Replace("." + Media.FileExtension, "");
                    imgFileName.ImageUrl   = GetPhotoExtension(Media.FileExtension, Media.FilePath);
                    hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath);

                    HyperLink hlAdditional = e.Row.FindControl("hlAdditional") as HyperLink;

                    String PhotoPath = GetPhotoPath(Media.FilePath);
                    //String PhotoUrl = string.Format("{2}://{0}{1}", WebHelper.GetHomeUrl(), PhotoPath, PortalSettings.SSLEnabled ? "https" : "http");

                    switch (File_Type.ToLower())
                    {
                    case "media": hlAdditional.Attributes.Add("onclick", String.Format("ReturnHtmlPicture('{0}','MediaID={1}');", PhotoPath, Media.ID));; break;

                    case "thumbnail": hlAdditional.Attributes.Add("onclick", String.Format("ReturnThumbnail('{0}','MediaID={1}');", PhotoPath, Media.ID)); break;

                    case "urllink": hlAdditional.Attributes.Add("onclick", String.Format("ReturnUrlLink('{0}','MediaID={1}');", PhotoPath, Media.ID)); break;

                    case "slider": hlAdditional.Attributes.Add("onclick", String.Format("ReturnImgUrl('{0}','MediaID={1}');", PhotoPath, Media.ID)); break;

                    default: hlAdditional.Attributes.Add("onclick", String.Format("ReturnPicture('{0}','MediaID={1}');", PhotoPath, Media.ID)); break;
                    }

                    //if (InsertType)
                    //{
                    //    //插入到文章内容
                    //    hlAdditional.Attributes.Add("onclick", String.Format("ReturnHtmlPicture('{0}',{1});", GetPhotoExtension(Media.FileExtension, Media.FilePath), Media.ID));
                    //}
                    //else
                    //{
                    //    hlAdditional.Attributes.Add("onclick", String.Format("ReturnPicture('{0}',{1});", GetPhotoExtension(Media.FileExtension, Media.FilePath), Media.ID));

                    //}

                    //发布者信息
                    e.Row.Cells[1].Text = "--";
                    if (Media.LastUser > 0)
                    {
                        UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser);
                        if (uInfo != null && uInfo.UserID > 0)
                        {
                            e.Row.Cells[1].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName);
                        }
                    }


                    //发布时间
                    e.Row.Cells[2].Text = Media.LastTime.ToShortDateString();

                    //状态
                    e.Row.Cells[3].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumFileStatus));
                }
            }
        }
Example #16
0
 public Resource_FilesStatus(DNNGo_LayerGallery_Files PhotoItem, int fileLength, PortalSettings ps, String ModulePath)
 {
     SetValues(PhotoItem, fileLength, ps, ModulePath);
 }
Example #17
0
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvCommentList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                DNNGo_LayerGallery_Files Media = e.Row.DataItem as DNNGo_LayerGallery_Files;

                if (Media != null && Media.ID > 0)
                {
                    #region "编辑&删除按钮"
                    HyperLink  hlEdit          = e.Row.FindControl("hlEdit") as HyperLink;
                    HyperLink  hlMobileEdit    = e.Row.FindControl("hlMobileEdit") as HyperLink;
                    LinkButton btnRemove       = e.Row.FindControl("btnRemove") as LinkButton;
                    LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton;
                    //设置按钮的CommandArgument
                    btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Media.ID.ToString();
                    //设置删除按钮的提示
                    //if (Media.Status == (Int32)EnumFileStatus.Recycle)
                    //{
                    btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                    //}
                    //else
                    //{
                    //    btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    //    btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + ViewResourceText("DeleteRecycleItem", "Are you sure to move it to recycle bin?") + "');");
                    //}

                    hlEdit.NavigateUrl = hlMobileEdit.NavigateUrl = xUrl("ID", Media.ID.ToString(), "AddMedia");
                    #endregion

                    //发布者信息
                    e.Row.Cells[3].Text = "--";
                    if (Media.LastUser > 0)
                    {
                        UserInfo uInfo = UserController.GetUserById(PortalId, Media.LastUser);
                        if (uInfo != null && uInfo.UserID > 0)
                        {
                            e.Row.Cells[3].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName);
                        }
                    }


                    //发布时间
                    e.Row.Cells[4].Text = Media.LastTime.ToShortDateString();

                    //状态
                    e.Row.Cells[5].Text = EnumHelper.GetEnumTextVal(Media.Status, typeof(EnumFileStatus));

                    Label lblFileExtension = e.Row.FindControl("lblFileExtension") as Label;
                    lblFileExtension.Text = Media.FileExtension;

                    Image imgFileName = e.Row.FindControl("imgFileName") as Image;

                    HyperLink hlFileName = e.Row.FindControl("hlFileName") as HyperLink;
                    hlFileName.Text        = Media.FileName.Replace("." + Media.FileExtension, "");
                    imgFileName.ImageUrl   = GetPhotoExtension(Media.FileExtension, Media.FilePath);
                    hlFileName.NavigateUrl = GetPhotoPath(Media.FilePath);

                    Label lblSize = e.Row.FindControl("lblSize") as Label;
                    if (Media.FileSize > 1024)
                    {
                        lblSize.Text = String.Format("{0} MB", Media.FileSize / 1024);
                    }
                    else
                    {
                        lblSize.Text = String.Format("{0} KB", Media.FileSize);
                    }
                }
            }
        }