コード例 #1
0
 /// <summary>
 /// 显示URL控件存放的值
 /// </summary>
 /// <param name="UrlValue"></param>
 /// <returns></returns>
 public String ViewLinkUrl(String UrlValue, String DefaultValue, int PortalId)
 {
     if (!String.IsNullOrEmpty(UrlValue) && UrlValue != "0")
     {
         if (UrlValue.IndexOf("FileID=", StringComparison.CurrentCultureIgnoreCase) == 0)
         {
             int FileID = 0;
             if (int.TryParse(UrlValue.Replace("FileID=", ""), out FileID) && FileID > 0)
             {
                 var fi = FileManager.Instance.GetFile(FileID);
                 if (fi != null && fi.FileId > 0)
                 {
                     DefaultValue = string.Format("{0}{1}{2}", bpm.DNNGalleryPro_PortalSettings.HomeDirectory, fi.Folder, bpm.Server.UrlPathEncode(fi.FileName));
                 }
             }
         }
         else if (UrlValue.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) == 0)
         {
             int MediaID = 0;
             if (int.TryParse(UrlValue.Replace("MediaID=", ""), out MediaID) && MediaID > 0)
             {
                 DNNGo_DNNGalleryPro_Files Multimedia = DNNGo_DNNGalleryPro_Files.FindByID(MediaID);
                 if (Multimedia != null && Multimedia.ID > 0)
                 {
                     DefaultValue = bpm.Server.UrlPathEncode(bpm.GetPhotoPath(Multimedia.FilePath)); // String.Format("{0}{1}", bpm.DNNGalleryPro_PortalSettings.HomeDirectory, Multimedia.FilePath);
                 }
             }
         }
         else if (UrlValue.IndexOf("TabID=", StringComparison.CurrentCultureIgnoreCase) == 0)
         {
             DefaultValue = Globals.NavigateURL(Convert.ToInt32(UrlValue.Replace("TabID=", "")), false, bpm.DNNGalleryPro_PortalSettings, Null.NullString, "", "");
         }
         else
         {
             DefaultValue = UrlValue;
         }
     }
     return(bpm.FullPortalUrl(DefaultValue));
 }