2011-12-05 3 views
1

"/ Default/MediaGallery"가 아니라 "/ MyFolder/CurrentMedia /"라는 폴더에 jPlayer 디렉토리를 설정해야합니다. 1.0.1오차드 - 특수 미디어 폴더 설정

감사

+0

와우, 그건 jPlayer의 이전 버전 ... – Lloyd

+0

업데이트가 없습니다. jPlayer에 대해 Orchard에 표시됩니다. Orchard CMS 자체를 하나의 마이너 버전으로 업그레이드하면 다른 것들은 탐색처럼 작동하지 않습니다. 내 질문에 어떤 식 으로든 대답 할 수 있기를 바랍니다. – Nasenbaer

+0

음, jPlayer에서 "Media Gallery Folder"를 설정하는 옵션은 없습니다. 이것은 과수원 문제입니다. 오차드를 도와 드릴 수 없습니다. – Lloyd

답변

1

이 이름 is hardcoded 것 같은데 : 버전 -

, 누구든지 나를 jPlayer의 설정을 변경하는 방법을 찾는 데 도움이 될 수 있습니다하시기 바랍니다. jPlayer 모듈이 각 임차인의 이름을 딴 기본 루트 폴더를 가진 오차드 미디어 기능을 사용하기 때문에 "/ Default" 경로를 제거 할 수있는 방법이 없습니다 (다중 점유자 친화적 인 모듈입니다). 위 링크 된 파일의 12 행에서 이름 (MediaGalleries)을 변경하여 해당 경로의 다음 부분 만 변경할 수 있습니다.

1

@PiotrSzmyd가 맞습니다. 부분적으로 하드 코드되었습니다. "Default"는 에 있으며 경로는 Orchard\FileSystems\Media\FileSystemStorageProvider.cs에 하드 코드되어 있습니다. 안타깝게도 핸들러 등으로이 클래스의 동작을 변경할 수있는 방법이 없습니다. 2 개 옵션

  1. 변화 과수원의 소스 코드 지금있다
  2. 필요할 때 IStorageProvider 및 정의의 구현을 제공하는 모듈을 추가하여 주위
  3. 작업 (미디어 저장 경로를 의미 과수원 디렉토리 구조의 외부에) 미디어 파일을 제공하는 추가 MVC 컨트롤러.

두 번째 옵션을 사용하여 미디어 저장 경로를 \\<server>\Files$\<build_configuration>\Media으로 변경했습니다.

먼저, 여기에 IStorageProvider의 필수 부품이다 :

사용자 지정이 사용자 정의 구현

  • 저장 경로 \\<server>\Files$\<build_configuration>\Media-
  • 가상 PA 매핑

    [Orchard.Environment.Extensions.OrchardSuppressDependency("Orchard.FileSystems.Media.FileSystemStorageProvider")] // adopted from AzureBlobStorageProvider.cs 
    public class FileSystemStorageProvider : Orchard.FileSystems.Media.IStorageProvider 
    { 
        private Orchard.FileSystems.Media.FileSystemStorageProvider mFileSystemStorageProvider; 
    
        public FileSystemStorageProvider(Orchard.Environment.Configuration.ShellSettings settings) 
        { 
        // use Orchard's default IStorageProvider for implementation 
        mFileSystemStorageProvider = new Orchard.FileSystems.Media.FileSystemStorageProvider(settings); 
    
        var lFileSystemStorageProviderType = mFileSystemStorageProvider.GetType(); 
    
        // get media storage path, e.g. from configuration file 
        var lStoragePath = GetMediaStoragePath(); 
    
        lStoragePath = System.IO.Path.Combine(lStoragePath, settings.Name); 
    
        // _storagePath is private read-only, so change it the hard way by using reflection 
        lFileSystemStorageProviderType 
         .GetField("_storagePath", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) 
         .SetValue(mFileSystemStorageProvider, lStoragePath); 
    
        string lVirtualPath = "~/Files/" + settings.Name + "/"; 
    
        lFileSystemStorageProviderType 
         .GetField("_virtualPath", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) 
         .SetValue(mFileSystemStorageProvider, lVirtualPath); 
    
        string lPublicPath = mFileSystemStorageProvider.GetPublicUrl(null).Replace("/Media/" + settings.Name + "/", "/Files/" + settings.Name + "/"); 
    
        lFileSystemStorageProviderType 
         .GetField("_publicPath", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) 
         .SetValue(mFileSystemStorageProvider, lPublicPath); 
        } 
    
        #region Implementation of IStorageProvider 
    
        public bool FileExists(string aPath) 
        { 
         return mFileSystemStorageProvider.FileExists(aPath); 
        } 
        ... 
    
        #endregion 
    } 
    

    IStorageProvider 구현 문제가 생겼 /Files/Default/

~/Files/Default/

  • 절대 경로 토륨. Orchard는 미디어 URL을 www.mysite.de/Files/Default...으로 표시하지만 Orchard 디렉토리 구조에 Files라는 디렉토리가 없습니다. 이제 맞춤 경로가 등장합니다.

    사용자 정의 경로

    public class Routes : Orchard.Mvc.Routes.IRouteProvider 
    { 
        public System.Collections.Generic.IEnumerable<Orchard.Mvc.Routes.RouteDescriptor> GetRoutes() 
        { 
        Orchard.Mvc.Routes.RouteDescriptor[] lRoutes = 
         new Orchard.Mvc.Routes.RouteDescriptor[] 
         { 
         new Orchard.Mvc.Routes.RouteDescriptor() 
         { 
          Name = "Custom route for media files", 
          Priority = 10000, 
          Route = new System.Web.Routing.Route(
          "Files/{*aRelativePath}", 
          new System.Web.Routing.RouteValueDictionary() 
          { 
           {"area", "MyModule"}, 
           {"controller", "Media"}, 
           {"action", "GetFile"} 
          }, 
          new System.Web.Routing.RouteValueDictionary() {}, 
          new System.Web.Routing.RouteValueDictionary() { {"area", "MyModule"} }, 
          new System.Web.Mvc.MvcRouteHandler() 
         ) 
         } 
         }; 
    
        return lRoutes; 
        } 
    
        public void GetRoutes(System.Collections.Generic.ICollection<Orchard.Mvc.Routes.RouteDescriptor> arRoutes) 
        { 
        foreach (var lRouteDescriptor in GetRoutes()) 
         arRoutes.Add(lRouteDescriptor); 
        } 
    } 
    

    이 경로의 구현은 다음과 같습니다 특정 미디어 컨트롤러에 www.mysite.de/Files/Default...의 리디렉션을 보장 :

    미디어 컨트롤러

    public class MediaController 
    { 
        public MediaController(Orchard.FileSystems.Media.IMimeTypeProvider aMimeTypeProvider) 
        { 
        mMimeTypeProvider = aMimeTypeProvider; 
        } 
    
        public System.Web.Mvc.ActionResult GetFile(string aRelativePath) 
        { 
        string lMediaStoragePath, lErrorMessage; 
    
        // get media storage path, e.g. from configuration file 
        if (GetMediaStoragePath(out lMediaStoragePath, out lErrorMessage)) 
        { 
         string lFilename = System.IO.Path.Combine(lMediaStoragePath, aRelativePath); 
         string lMimeType = mMimeTypeProvider.GetMimeType(lFilename); 
    
         return File(lFilename, lMimeType); 
        } 
        else 
         return Content(lErrorMessage); 
        } 
    
        // private 
        private Orchard.FileSystems.Media.IMimeTypeProvider mMimeTypeProvider; 
    }