--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-12-08 18:14:56 -08:00
35 changed files with 1156 additions and 143 deletions

View File

@@ -146,6 +146,12 @@ namespace Orchard.Azure {
}
}
public void TryCreateFolder(string path)
{
EnsurePathIsRelative(path);
CreateFile(Combine(path, FolderEntry));
}
public void CreateFolder(string path)
{
EnsurePathIsRelative(path);

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ServiceConfiguration serviceName="OrchardCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<ServiceConfiguration serviceName="OrchardCloudService" osFamily="1" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="Orchard.Azure.Web">
<Instances count="1" />
<ConfigurationSettings>

View File

@@ -75,7 +75,9 @@
<Reference Include="System.Data.DataSetExtensions">
<Private>False</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, PublicKeyToken=89845dcd8080cc91" />
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, PublicKeyToken=89845dcd8080cc91">
<Private>True</Private>
</Reference>
<Reference Include="System.Web.ApplicationServices">
<Private>False</Private>
</Reference>
@@ -164,6 +166,10 @@
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Lucene\Lucene.csproj">
<Project>{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}</Project>
<Name>Lucene</Name>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.ArchiveLater\Orchard.ArchiveLater.csproj">
<Project>{1C981BB3-26F7-494C-9005-CC27A5144233}</Project>
<Name>Orchard.ArchiveLater</Name>

View File

@@ -157,7 +157,7 @@ namespace Orchard.Core.Tests.Common.Providers {
var user = contentManager.New<IUser>("User");
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
_authz.Setup(x => x.TryCheckAccess(Permissions.ChangeOwner, user, item)).Returns(true);
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
item.Owner = user;
@@ -175,7 +175,7 @@ namespace Orchard.Core.Tests.Common.Providers {
var user = contentManager.New<IUser>("User");
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
_authz.Setup(x => x.TryCheckAccess(Permissions.ChangeOwner, user, item)).Returns(true);
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
item.Owner = user;

View File

@@ -57,7 +57,7 @@ namespace Orchard.Core.Common.Drivers {
DriverResult OwnerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
var currentUser = _authenticationService.GetAuthenticatedUser();
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) {
return null;
}
@@ -86,7 +86,7 @@ namespace Orchard.Core.Common.Drivers {
DriverResult ContainerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
var currentUser = _authenticationService.GetAuthenticatedUser();
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) {
return null;
}

View File

@@ -1,26 +0,0 @@
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Orchard.Core.Common {
public class Permissions : IPermissionProvider {
public static readonly Permission ChangeOwner = new Permission { Name = "ChangeOwner", Description = "Change the owner of content items" };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] {
ChangeOwner,
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {ChangeOwner}
},
};
}
}
}

View File

@@ -1,6 +1,7 @@
using System.Web.Mvc;
using Orchard.ContentManagement;
using Orchard.DisplayManagement;
using Orchard.Localization;
using Orchard.Themes;
namespace Orchard.Core.Contents.Controllers {
@@ -8,12 +9,16 @@ namespace Orchard.Core.Contents.Controllers {
public class ItemController : Controller {
private readonly IContentManager _contentManager;
public ItemController(IContentManager contentManager, IShapeFactory shapeFactory) {
public ItemController(IContentManager contentManager, IShapeFactory shapeFactory, IOrchardServices services) {
_contentManager = contentManager;
Shape = shapeFactory;
Services = services;
T = NullLocalizer.Instance;
}
dynamic Shape { get; set; }
public IOrchardServices Services { get; private set; }
public Localizer T { get; set; }
// /Contents/Item/Display/72
public ActionResult Display(int id) {
@@ -31,6 +36,10 @@ namespace Orchard.Core.Contents.Controllers {
versionOptions = VersionOptions.Number((int)version);
var contentItem = _contentManager.Get(id, versionOptions);
if (!Services.Authorizer.Authorize(Permissions.EditOthersContent, contentItem, T("Cannot edit content")))
return new HttpUnauthorizedResult();
dynamic model = _contentManager.BuildDisplay(contentItem);
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
return View("Display", (object)model);

View File

@@ -120,7 +120,6 @@
<Compile Include="Routable\Handlers\RoutePartHandler.cs" />
<Compile Include="Routable\IRoutablePathConstraint.cs" />
<Compile Include="Routable\Models\RoutePart.cs" />
<Compile Include="Common\Permissions.cs" />
<Compile Include="Common\Utilities\LazyField.cs" />
<Compile Include="Common\Handlers\CommonPartHandler.cs" />
<Compile Include="Common\Models\CommonPart.cs" />

View File

@@ -1,24 +1,38 @@
using System.Linq;
using System.Web.Mvc;
using Orchard.Core.Reports.ViewModels;
using Orchard.Localization;
using Orchard.Reports.Services;
using Orchard.Security;
namespace Orchard.Core.Reports.Controllers {
public class AdminController : Controller {
private readonly IReportsManager _reportsManager;
public AdminController(IReportsManager reportsManager) {
public AdminController(
IOrchardServices services,
IReportsManager reportsManager) {
Services = services;
_reportsManager = reportsManager;
T = NullLocalizer.Instance;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public ActionResult Index() {
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to list reports")))
return new HttpUnauthorizedResult();
var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() };
return View(model);
}
public ActionResult Display(int id) {
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to display report")))
return new HttpUnauthorizedResult();
var model = new DisplayReportViewModel { Report = _reportsManager.Get(id) };
return View(model);

View File

@@ -2,6 +2,8 @@
using System.Linq;
using Orchard.ArchiveLater.Models;
using Orchard.ContentManagement;
using Orchard.Core.Contents;
using Orchard.Localization;
using Orchard.Tasks.Scheduling;
namespace Orchard.ArchiveLater.Services {
@@ -10,11 +12,21 @@ namespace Orchard.ArchiveLater.Services {
private readonly IScheduledTaskManager _scheduledTaskManager;
public ArchiveLaterService(IScheduledTaskManager scheduledTaskManager) {
public ArchiveLaterService(
IOrchardServices services,
IScheduledTaskManager scheduledTaskManager) {
Services = services;
_scheduledTaskManager = scheduledTaskManager;
T = NullLocalizer.Instance;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
void IArchiveLaterService.ArchiveLater(ContentItem contentItem, DateTime scheduledArchiveUtc) {
if (!Services.Authorizer.Authorize(Permissions.PublishOthersContent, contentItem, T("Couldn't archive selected content.")))
return;
RemoveArchiveLaterTasks(contentItem);
_scheduledTaskManager.CreateTask(UnpublishTaskType, scheduledArchiveUtc, contentItem);
}

View File

@@ -1,4 +1,5 @@
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Navigation;
namespace Orchard.Indexing {
@@ -9,7 +10,7 @@ namespace Orchard.Indexing {
public void GetNavigation(NavigationBuilder builder) {
builder.Add(T("Configuration"), "50",
menu => menu.Add(T("Search Index"), "15", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
.Permission(Permissions.ManageSearchIndex)));
.Permission(StandardPermissions.SiteOwner)));
}
}
}

View File

@@ -1,6 +1,7 @@
using System.Web.Mvc;
using Orchard.Indexing.Services;
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Notify;
using Orchard.Indexing.ViewModels;
@@ -28,7 +29,7 @@ namespace Orchard.Indexing.Controllers {
[HttpPost]
public ActionResult Update() {
if (!Services.Authorizer.Authorize(Permissions.ManageSearchIndex, T("Not allowed to manage the search index.")))
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
return new HttpUnauthorizedResult();
_indexingService.UpdateIndex();
@@ -38,7 +39,7 @@ namespace Orchard.Indexing.Controllers {
[HttpPost]
public ActionResult Rebuild() {
if (!Services.Authorizer.Authorize(Permissions.ManageSearchIndex, T("Not allowed to manage the search index.")))
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
return new HttpUnauthorizedResult();
_indexingService.RebuildIndex();

View File

@@ -55,7 +55,6 @@
<Compile Include="Handlers\InfosetFieldIndexingHandler.cs" />
<Compile Include="Models\IndexingTask.cs" />
<Compile Include="Models\IndexingTaskRecord.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Services\IndexServiceNotificationProvider.cs" />
<Compile Include="Services\IndexingBackgroundTask.cs" />
<Compile Include="Services\IndexingTaskExecutor.cs" />

View File

@@ -1,24 +0,0 @@
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Orchard.Indexing {
public class Permissions : IPermissionProvider {
public static readonly Permission ManageSearchIndex = new Permission { Description = "Manage Search Index", Name = "ManageSearchIndex" };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] { ManageSearchIndex };
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new [] { ManageSearchIndex }
},
};
}
}
}

View File

@@ -189,7 +189,7 @@ namespace Orchard.Media.Controllers {
// then save them
foreach (string fileName in Request.Files) {
HttpPostedFileBase file = Request.Files[fileName];
_mediaService.UploadMediaFile(viewModel.MediaPath, file);
_mediaService.UploadMediaFile(viewModel.MediaPath, file, viewModel.ExtractZip);
}
Services.Notifier.Information(T("Media file(s) uploaded"));
@@ -222,7 +222,7 @@ namespace Orchard.Media.Controllers {
}
var file = Request.Files[0];
var publicUrl = _mediaService.UploadMediaFile(viewModel.MediaPath, file);
var publicUrl = _mediaService.UploadMediaFile(viewModel.MediaPath, file, viewModel.ExtractZip);
return Content(string.Format("<script type=\"text/javascript\">var result = {{ url: \"{0}\" }};</script>", publicUrl));
}

View File

@@ -1,7 +1,7 @@
using System;
namespace Orchard.Media.Models {
public class MediaFile{
public class MediaFile {
public string Name { get; set; }
public string User { get; set; }
public string Type { get; set; }

View File

@@ -12,7 +12,8 @@ namespace Orchard.Media.Services {
void RenameFolder(string path, string newName);
void DeleteFile(string name, string folderName);
void RenameFile(string name, string newName, string folderName);
string UploadMediaFile(string folderName, HttpPostedFileBase postedFile);
string UploadMediaFile(string folderName, string fileName, byte[] bytes, bool extractZip);
string UploadMediaFile(string folderName, HttpPostedFileBase postedFile, bool extractZip);
bool FileAllowed(HttpPostedFileBase postedFile);
}
}

View File

@@ -91,23 +91,43 @@ namespace Orchard.Media.Services {
_storageProvider.RenameFile(_storageProvider.Combine(folderName, name), _storageProvider.Combine(folderName, newName));
}
public string UploadMediaFile(string folderName, HttpPostedFileBase postedFile) {
if (postedFile.FileName.EndsWith(".zip")) {
UnzipMediaFileArchive(folderName, postedFile);
// Don't save the zip file.
return _storageProvider.GetPublicUrl(folderName);
}
if (FileAllowed(postedFile) && postedFile.ContentLength > 0) {
var filePath = Path.Combine(folderName, Path.GetFileName(postedFile.FileName));
var inputStream = postedFile.InputStream;
public string UploadMediaFile(string folderName, HttpPostedFileBase postedFile, bool extractZip) {
var postedFileLength = postedFile.ContentLength;
var postedFileStream = postedFile.InputStream;
var postedFileData = new byte[postedFileLength];
postedFileStream.Read(postedFileData, 0, postedFileLength);
return UploadMediaFile(folderName, postedFile.FileName, postedFileData, extractZip);
}
public string UploadMediaFile(string folderPath, string fileName, byte [] bytes, bool extractZip) {
if (extractZip && fileName.EndsWith(".zip")) {
UnzipMediaFileArchive(folderPath, bytes);
// Don't save the zip file.
return _storageProvider.GetPublicUrl(folderPath);
}
if (FileAllowed(fileName, true) && bytes.Length > 0) {
string filePath = Path.Combine(folderPath, Path.GetFileName(fileName));
_storageProvider.TryCreateFolder(folderPath);
IStorageFile file = _storageProvider.CreateFile(filePath);
using(var stream = file.OpenWrite()) {
stream.Write(bytes, 0, bytes.Length);
}
SaveStream(filePath, inputStream);
return _storageProvider.GetPublicUrl(filePath);
}
return null;
}
public bool FileAllowed(HttpPostedFileBase postedFile) {
if (postedFile == null) {
return false;
}
return FileAllowed(postedFile.FileName, true);
}
private bool FileAllowed(string name, bool allowZip) {
if (string.IsNullOrWhiteSpace(name)) {
return false;
@@ -138,13 +158,6 @@ namespace Orchard.Media.Services {
return true;
}
public bool FileAllowed(HttpPostedFileBase postedFile) {
if (postedFile == null) {
return false;
}
return FileAllowed(postedFile.FileName, true);
}
private void SaveStream(string filePath, Stream inputStream) {
var file = _storageProvider.CreateFile(filePath);
var outputStream = file.OpenWrite();
@@ -165,6 +178,10 @@ namespace Orchard.Media.Services {
var postedFileData = new byte[postedFileLength];
postedFileStream.Read(postedFileData, 0, postedFileLength);
UnzipMediaFileArchive(targetFolder, postedFileData);
}
private void UnzipMediaFileArchive(string targetFolder, byte [] postedFileData) {
using (var memoryStream = new MemoryStream(postedFileData)) {
var fileInflater = new ZipInputStream(memoryStream);
ZipEntry entry;
@@ -182,13 +199,7 @@ namespace Orchard.Media.Services {
// skip disallowed files
if (FileAllowed(entry.Name, false)) {
try {
_storageProvider.CreateFolder(directoryName);
}
catch {
// no handling needed - this is to force the folder to exist if it doesn't
}
_storageProvider.TryCreateFolder(directoryName);
SaveStream(entryName, fileInflater);
}
}

View File

@@ -1,22 +1,25 @@
using System;
using System.IO;
using System.Web;
using System.Xml.Linq;
using JetBrains.Annotations;
using Orchard.Core.XmlRpc;
using Orchard.Core.XmlRpc.Models;
using Orchard.Security;
using Orchard.Utility.Extensions;
namespace Orchard.Media.Services {
[UsedImplicitly]
public class XmlRpcHandler : IXmlRpcHandler {
private readonly IMembershipService _membershipService;
private readonly IAuthorizationService _authorizationService;
private readonly IMediaService _mediaService;
public XmlRpcHandler(IMembershipService membershipService, IAuthorizationService authorizationService) {
public XmlRpcHandler(
IMembershipService membershipService,
IAuthorizationService authorizationService,
IMediaService mediaService) {
_membershipService = membershipService;
_authorizationService = authorizationService;
_mediaService = mediaService;
}
public void SetCapabilities(XElement options) {
@@ -25,15 +28,8 @@ namespace Orchard.Media.Services {
}
public void Process(XmlRpcContext context) {
var uriBuilder = new UriBuilder(context.HttpContext.Request.ToUrlString()) {
Path = context.HttpContext.Request.ApplicationPath,
Query = string.Empty
};
if (context.Request.MethodName == "metaWeblog.newMediaObject") {
var result = MetaWeblogNewMediaObject(
uriBuilder,
Convert.ToString(context.Request.Params[0].Value),
Convert.ToString(context.Request.Params[1].Value),
Convert.ToString(context.Request.Params[2].Value),
(XRpcStruct)context.Request.Params[3].Value);
@@ -42,8 +38,6 @@ namespace Orchard.Media.Services {
}
private XRpcStruct MetaWeblogNewMediaObject(
UriBuilder uriBuilder,
string blogId,
string userName,
string password,
XRpcStruct file) {
@@ -57,14 +51,8 @@ namespace Orchard.Media.Services {
var name = file.Optional<string>("name");
var bits = file.Optional<byte[]>("bits");
var target = HttpContext.Current.Server.MapPath("~/Media/" + name);
Directory.CreateDirectory(Path.GetDirectoryName(target));
using (var stream = new FileStream(target, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) {
stream.Write(bits, 0, bits.Length);
}
uriBuilder.Path = uriBuilder.Path.TrimEnd('/') + "/Media/" + name.TrimStart('/');
return new XRpcStruct().Set("url", uriBuilder.Uri.AbsoluteUri);
string publicUrl = _mediaService.UploadMediaFile(Path.GetDirectoryName(name), Path.GetFileName(name), bits, true);
return new XRpcStruct().Set("url", publicUrl);
}
}
}

View File

@@ -1,6 +1,11 @@
namespace Orchard.Media.ViewModels {
public class MediaItemAddViewModel {
public MediaItemAddViewModel() {
ExtractZip = true;
}
public string FolderName { get; set; }
public string MediaPath { get; set; }
public bool ExtractZip { get; set; }
}
}

View File

@@ -17,6 +17,10 @@
<fieldset>
<label for="pageTitle">@T("File Path <span> - multiple files must be in a zipped folder</span>")</label>
<input id="MediaItemPath" name="MediaItemPath" type="file" value="@T("Browse")" size="64"/>
@Html.LabelFor(m => m.ExtractZip, T("Extract Zip"))
@Html.CheckBoxFor(m => m.ExtractZip)
<span class="hint">@T("After your files have been uploaded, you can edit the titles and descriptions.")</span>
<input type="hidden" id="FolderName" name="FolderName" value="@Model.FolderName" />
<input type="hidden" id="MediaPath" name="MediaPath" value="@Model.MediaPath" />

View File

@@ -1,4 +1,5 @@
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Navigation;
namespace Orchard.Modules {
@@ -13,7 +14,7 @@ namespace Orchard.Modules {
.Add(T("Features"), "0", item => item.Action("Features", "Admin", new { area = "Orchard.Modules" })
.Permission(Permissions.ManageFeatures))
.Add(T("Modules"), "5", item => item.Action("Index", "Admin", new { area = "Orchard.Modules" })
.Permission(Permissions.ManageModules)));
.Permission(StandardPermissions.SiteOwner)));
}
}
}

View File

@@ -10,6 +10,7 @@ using Orchard.Localization;
using Orchard.Modules.Services;
using Orchard.Modules.ViewModels;
using Orchard.Reports.Services;
using Orchard.Security;
using Orchard.UI.Notify;
namespace Orchard.Modules.Controllers {
@@ -44,7 +45,7 @@ namespace Orchard.Modules.Controllers {
public IOrchardServices Services { get; set; }
public ActionResult Index() {
if (!Services.Authorizer.Authorize(Permissions.ManageModules, T("Not allowed to manage modules")))
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage modules")))
return new HttpUnauthorizedResult();
var modules = _extensionManager.AvailableExtensions().Where(x => DefaultExtensionTypes.IsModule(x.ExtensionType));

View File

@@ -4,20 +4,19 @@ using Orchard.Security.Permissions;
namespace Orchard.Modules {
public class Permissions : IPermissionProvider {
public static readonly Permission ManageModules = new Permission { Description = "Manage Modules", Name = "ManageModules" };
public static readonly Permission ManageFeatures = new Permission { Description = "Manage Features", Name = "ManageFeatures", ImpliedBy = new[] {ManageModules}};
public static readonly Permission ManageFeatures = new Permission {Description = "Manage Features", Name = "ManageFeatures" };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] {ManageModules, ManageFeatures};
return new[] {ManageFeatures};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {ManageModules}
Permissions = new[] {ManageFeatures}
}
};
}

View File

@@ -46,7 +46,7 @@ namespace Orchard.Packaging.Controllers {
[HttpPost, ActionName("RemoveTheme")]
public ActionResult RemoveThemePOST(string themeId, string returnUrl, string retryUrl) {
return UninstallPackage(PackagingSourceManager.ThemesFilter + themeId, returnUrl, retryUrl);
return UninstallPackage(PackagingSourceManager.ThemesPrefix + themeId, returnUrl, retryUrl);
}
public ActionResult AddModule(string returnUrl) {

View File

@@ -20,7 +20,7 @@ namespace Orchard.Packaging {
public void Installed(Feature feature) {
if (feature.Descriptor.Id == "Gallery") {
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://feed.nuget.org/ctp2/odata/v1");
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://orchardproject.net:777/GalleryServer/FeedService.svc");
}
}

View File

@@ -40,6 +40,7 @@
<HintPath>..\..\..\..\lib\nuget\NuGet.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data.Services.Client" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -66,6 +67,11 @@
<Compile Include="Migrations.cs" />
<Compile Include="Models\PackagingSource.cs" />
<Compile Include="ResourceManifest.cs" />
<Compile Include="Service References\GalleryServer\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.datasvcmap</DependentUpon>
</Compile>
<Compile Include="Services\AtomExtensions.cs" />
<Compile Include="Services\ExtensionReferenceRepository.cs" />
<Compile Include="Services\FileBaseProjectSystem.cs" />
@@ -88,6 +94,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Service References\GalleryServer\Reference.datasvcmap">
<Generator>DataServiceClientGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</Content>
<Content Include="Styles\orchard-packaging-admin.css" />
<Content Include="Views\Gallery\AddSource.cshtml" />
<Content Include="Views\Gallery\Modules.cshtml" />
@@ -124,6 +134,17 @@
<ItemGroup>
<Content Include="Views\PackagingServices\AddTheme.cshtml" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ServiceReferenceMetadataStorage Include="Service References\GalleryServer\">
<Type>datasvcmap</Type>
</ServiceReferenceMetadataStorage>
</ItemGroup>
<ItemGroup>
<Content Include="Service References\GalleryServer\service.edmx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -0,0 +1,890 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Original file name:
// Generation date: 12/8/2010 3:18:34 PM
namespace Orchard.Packaging.GalleryServer
{
/// <summary>
/// There are no comments for GalleryFeedContext in the schema.
/// </summary>
public partial class GalleryFeedContext : global::System.Data.Services.Client.DataServiceContext
{
/// <summary>
/// Initialize a new GalleryFeedContext object.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public GalleryFeedContext(global::System.Uri serviceRoot) :
base(serviceRoot)
{
this.ResolveName = new global::System.Func<global::System.Type, string>(this.ResolveNameFromType);
this.ResolveType = new global::System.Func<string, global::System.Type>(this.ResolveTypeFromName);
this.OnContextCreated();
}
partial void OnContextCreated();
/// <summary>
/// Since the namespace configured for this service reference
/// in Visual Studio is different from the one indicated in the
/// server schema, use type-mappers to map between the two.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
protected global::System.Type ResolveTypeFromName(string typeName)
{
if (typeName.StartsWith("Gallery.Infrastructure.FeedModels", global::System.StringComparison.Ordinal))
{
return this.GetType().Assembly.GetType(string.Concat("Orchard.Packaging.GalleryServer", typeName.Substring(33)), false);
}
return null;
}
/// <summary>
/// Since the namespace configured for this service reference
/// in Visual Studio is different from the one indicated in the
/// server schema, use type-mappers to map between the two.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
protected string ResolveNameFromType(global::System.Type clientType)
{
if (clientType.Namespace.Equals("Orchard.Packaging.GalleryServer", global::System.StringComparison.Ordinal))
{
return string.Concat("Gallery.Infrastructure.FeedModels.", clientType.Name);
}
return null;
}
/// <summary>
/// There are no comments for Packages in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Data.Services.Client.DataServiceQuery<PublishedPackage> Packages
{
get
{
if ((this._Packages == null))
{
this._Packages = base.CreateQuery<PublishedPackage>("Packages");
}
return this._Packages;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Data.Services.Client.DataServiceQuery<PublishedPackage> _Packages;
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Data.Services.Client.DataServiceQuery<PublishedScreenshot> Screenshots
{
get
{
if ((this._Screenshots == null))
{
this._Screenshots = base.CreateQuery<PublishedScreenshot>("Screenshots");
}
return this._Screenshots;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Data.Services.Client.DataServiceQuery<PublishedScreenshot> _Screenshots;
/// <summary>
/// There are no comments for Packages in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public void AddToPackages(PublishedPackage publishedPackage)
{
base.AddObject("Packages", publishedPackage);
}
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public void AddToScreenshots(PublishedScreenshot publishedScreenshot)
{
base.AddObject("Screenshots", publishedScreenshot);
}
}
/// <summary>
/// There are no comments for Gallery.Infrastructure.FeedModels.PublishedPackage in the schema.
/// </summary>
/// <KeyProperties>
/// Id
/// Version
/// </KeyProperties>
[global::System.Data.Services.Common.DataServiceKeyAttribute("Id", "Version")]
public partial class PublishedPackage
{
/// <summary>
/// Create a new PublishedPackage object.
/// </summary>
/// <param name="ID">Initial value of Id.</param>
/// <param name="version">Initial value of Version.</param>
/// <param name="downloadCount">Initial value of DownloadCount.</param>
/// <param name="packageSize">Initial value of PackageSize.</param>
/// <param name="rating">Initial value of Rating.</param>
/// <param name="ratingCount">Initial value of RatingCount.</param>
/// <param name="price">Initial value of Price.</param>
/// <param name="requireLicenseAcceptance">Initial value of RequireLicenseAcceptance.</param>
/// <param name="isLatestVersion">Initial value of IsLatestVersion.</param>
/// <param name="created">Initial value of Created.</param>
/// <param name="lastUpdated">Initial value of LastUpdated.</param>
/// <param name="published">Initial value of Published.</param>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public static PublishedPackage CreatePublishedPackage(string ID, string version, int downloadCount, long packageSize, double rating, int ratingCount, decimal price, bool requireLicenseAcceptance, bool isLatestVersion, global::System.DateTime created, global::System.DateTime lastUpdated, global::System.DateTime published)
{
PublishedPackage publishedPackage = new PublishedPackage();
publishedPackage.Id = ID;
publishedPackage.Version = version;
publishedPackage.DownloadCount = downloadCount;
publishedPackage.PackageSize = packageSize;
publishedPackage.Rating = rating;
publishedPackage.RatingCount = ratingCount;
publishedPackage.Price = price;
publishedPackage.RequireLicenseAcceptance = requireLicenseAcceptance;
publishedPackage.IsLatestVersion = isLatestVersion;
publishedPackage.Created = created;
publishedPackage.LastUpdated = lastUpdated;
publishedPackage.Published = published;
return publishedPackage;
}
/// <summary>
/// There are no comments for Property Id in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Id
{
get
{
return this._Id;
}
set
{
this.OnIdChanging(value);
this._Id = value;
this.OnIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Id;
partial void OnIdChanging(string value);
partial void OnIdChanged();
/// <summary>
/// There are no comments for Property Version in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Version
{
get
{
return this._Version;
}
set
{
this.OnVersionChanging(value);
this._Version = value;
this.OnVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Version;
partial void OnVersionChanging(string value);
partial void OnVersionChanged();
/// <summary>
/// There are no comments for Property Title in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Title
{
get
{
return this._Title;
}
set
{
this.OnTitleChanging(value);
this._Title = value;
this.OnTitleChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Title;
partial void OnTitleChanging(string value);
partial void OnTitleChanged();
/// <summary>
/// There are no comments for Property Authors in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Authors
{
get
{
return this._Authors;
}
set
{
this.OnAuthorsChanging(value);
this._Authors = value;
this.OnAuthorsChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Authors;
partial void OnAuthorsChanging(string value);
partial void OnAuthorsChanged();
/// <summary>
/// There are no comments for Property PackageType in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageType
{
get
{
return this._PackageType;
}
set
{
this.OnPackageTypeChanging(value);
this._PackageType = value;
this.OnPackageTypeChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageType;
partial void OnPackageTypeChanging(string value);
partial void OnPackageTypeChanged();
/// <summary>
/// There are no comments for Property Summary in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Summary
{
get
{
return this._Summary;
}
set
{
this.OnSummaryChanging(value);
this._Summary = value;
this.OnSummaryChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Summary;
partial void OnSummaryChanging(string value);
partial void OnSummaryChanged();
/// <summary>
/// There are no comments for Property Description in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Description
{
get
{
return this._Description;
}
set
{
this.OnDescriptionChanging(value);
this._Description = value;
this.OnDescriptionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Description;
partial void OnDescriptionChanging(string value);
partial void OnDescriptionChanged();
/// <summary>
/// There are no comments for Property DownloadCount in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int DownloadCount
{
get
{
return this._DownloadCount;
}
set
{
this.OnDownloadCountChanging(value);
this._DownloadCount = value;
this.OnDownloadCountChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _DownloadCount;
partial void OnDownloadCountChanging(int value);
partial void OnDownloadCountChanged();
/// <summary>
/// There are no comments for Property Copyright in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Copyright
{
get
{
return this._Copyright;
}
set
{
this.OnCopyrightChanging(value);
this._Copyright = value;
this.OnCopyrightChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Copyright;
partial void OnCopyrightChanging(string value);
partial void OnCopyrightChanged();
/// <summary>
/// There are no comments for Property PackageHashAlgorithm in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageHashAlgorithm
{
get
{
return this._PackageHashAlgorithm;
}
set
{
this.OnPackageHashAlgorithmChanging(value);
this._PackageHashAlgorithm = value;
this.OnPackageHashAlgorithmChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageHashAlgorithm;
partial void OnPackageHashAlgorithmChanging(string value);
partial void OnPackageHashAlgorithmChanged();
/// <summary>
/// There are no comments for Property PackageHash in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageHash
{
get
{
return this._PackageHash;
}
set
{
this.OnPackageHashChanging(value);
this._PackageHash = value;
this.OnPackageHashChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageHash;
partial void OnPackageHashChanging(string value);
partial void OnPackageHashChanged();
/// <summary>
/// There are no comments for Property PackageSize in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public long PackageSize
{
get
{
return this._PackageSize;
}
set
{
this.OnPackageSizeChanging(value);
this._PackageSize = value;
this.OnPackageSizeChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private long _PackageSize;
partial void OnPackageSizeChanging(long value);
partial void OnPackageSizeChanged();
/// <summary>
/// There are no comments for Property Rating in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public double Rating
{
get
{
return this._Rating;
}
set
{
this.OnRatingChanging(value);
this._Rating = value;
this.OnRatingChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private double _Rating;
partial void OnRatingChanging(double value);
partial void OnRatingChanged();
/// <summary>
/// There are no comments for Property RatingCount in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int RatingCount
{
get
{
return this._RatingCount;
}
set
{
this.OnRatingCountChanging(value);
this._RatingCount = value;
this.OnRatingCountChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _RatingCount;
partial void OnRatingCountChanging(int value);
partial void OnRatingCountChanged();
/// <summary>
/// There are no comments for Property Price in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public decimal Price
{
get
{
return this._Price;
}
set
{
this.OnPriceChanging(value);
this._Price = value;
this.OnPriceChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private decimal _Price;
partial void OnPriceChanging(decimal value);
partial void OnPriceChanged();
/// <summary>
/// There are no comments for Property RequireLicenseAcceptance in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public bool RequireLicenseAcceptance
{
get
{
return this._RequireLicenseAcceptance;
}
set
{
this.OnRequireLicenseAcceptanceChanging(value);
this._RequireLicenseAcceptance = value;
this.OnRequireLicenseAcceptanceChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private bool _RequireLicenseAcceptance;
partial void OnRequireLicenseAcceptanceChanging(bool value);
partial void OnRequireLicenseAcceptanceChanged();
/// <summary>
/// There are no comments for Property IsLatestVersion in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public bool IsLatestVersion
{
get
{
return this._IsLatestVersion;
}
set
{
this.OnIsLatestVersionChanging(value);
this._IsLatestVersion = value;
this.OnIsLatestVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private bool _IsLatestVersion;
partial void OnIsLatestVersionChanging(bool value);
partial void OnIsLatestVersionChanged();
/// <summary>
/// There are no comments for Property Created in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime Created
{
get
{
return this._Created;
}
set
{
this.OnCreatedChanging(value);
this._Created = value;
this.OnCreatedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _Created;
partial void OnCreatedChanging(global::System.DateTime value);
partial void OnCreatedChanged();
/// <summary>
/// There are no comments for Property LastUpdated in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime LastUpdated
{
get
{
return this._LastUpdated;
}
set
{
this.OnLastUpdatedChanging(value);
this._LastUpdated = value;
this.OnLastUpdatedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _LastUpdated;
partial void OnLastUpdatedChanging(global::System.DateTime value);
partial void OnLastUpdatedChanged();
/// <summary>
/// There are no comments for Property Published in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime Published
{
get
{
return this._Published;
}
set
{
this.OnPublishedChanging(value);
this._Published = value;
this.OnPublishedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _Published;
partial void OnPublishedChanging(global::System.DateTime value);
partial void OnPublishedChanged();
/// <summary>
/// There are no comments for Property ExternalPackageUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ExternalPackageUrl
{
get
{
return this._ExternalPackageUrl;
}
set
{
this.OnExternalPackageUrlChanging(value);
this._ExternalPackageUrl = value;
this.OnExternalPackageUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ExternalPackageUrl;
partial void OnExternalPackageUrlChanging(string value);
partial void OnExternalPackageUrlChanged();
/// <summary>
/// There are no comments for Property ProjectUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ProjectUrl
{
get
{
return this._ProjectUrl;
}
set
{
this.OnProjectUrlChanging(value);
this._ProjectUrl = value;
this.OnProjectUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ProjectUrl;
partial void OnProjectUrlChanging(string value);
partial void OnProjectUrlChanged();
/// <summary>
/// There are no comments for Property LicenseUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string LicenseUrl
{
get
{
return this._LicenseUrl;
}
set
{
this.OnLicenseUrlChanging(value);
this._LicenseUrl = value;
this.OnLicenseUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _LicenseUrl;
partial void OnLicenseUrlChanging(string value);
partial void OnLicenseUrlChanged();
/// <summary>
/// There are no comments for Property IconUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string IconUrl
{
get
{
return this._IconUrl;
}
set
{
this.OnIconUrlChanging(value);
this._IconUrl = value;
this.OnIconUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _IconUrl;
partial void OnIconUrlChanging(string value);
partial void OnIconUrlChanged();
/// <summary>
/// There are no comments for Property ReportAbuseUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ReportAbuseUrl
{
get
{
return this._ReportAbuseUrl;
}
set
{
this.OnReportAbuseUrlChanging(value);
this._ReportAbuseUrl = value;
this.OnReportAbuseUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ReportAbuseUrl;
partial void OnReportAbuseUrlChanging(string value);
partial void OnReportAbuseUrlChanged();
/// <summary>
/// There are no comments for Property Categories in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Categories
{
get
{
return this._Categories;
}
set
{
this.OnCategoriesChanging(value);
this._Categories = value;
this.OnCategoriesChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Categories;
partial void OnCategoriesChanging(string value);
partial void OnCategoriesChanged();
/// <summary>
/// There are no comments for Property Tags in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Tags
{
get
{
return this._Tags;
}
set
{
this.OnTagsChanging(value);
this._Tags = value;
this.OnTagsChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Tags;
partial void OnTagsChanging(string value);
partial void OnTagsChanged();
/// <summary>
/// There are no comments for Property Dependencies in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Dependencies
{
get
{
return this._Dependencies;
}
set
{
this.OnDependenciesChanging(value);
this._Dependencies = value;
this.OnDependenciesChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Dependencies;
partial void OnDependenciesChanging(string value);
partial void OnDependenciesChanged();
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Collections.ObjectModel.Collection<PublishedScreenshot> Screenshots
{
get
{
return this._Screenshots;
}
set
{
if ((value != null))
{
this._Screenshots = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Collections.ObjectModel.Collection<PublishedScreenshot> _Screenshots = new global::System.Collections.ObjectModel.Collection<PublishedScreenshot>();
}
/// <summary>
/// There are no comments for Gallery.Infrastructure.FeedModels.PublishedScreenshot in the schema.
/// </summary>
/// <KeyProperties>
/// Id
/// </KeyProperties>
[global::System.Data.Services.Common.DataServiceKeyAttribute("Id")]
public partial class PublishedScreenshot
{
/// <summary>
/// Create a new PublishedScreenshot object.
/// </summary>
/// <param name="ID">Initial value of Id.</param>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public static PublishedScreenshot CreatePublishedScreenshot(int ID)
{
PublishedScreenshot publishedScreenshot = new PublishedScreenshot();
publishedScreenshot.Id = ID;
return publishedScreenshot;
}
/// <summary>
/// There are no comments for Property Id in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int Id
{
get
{
return this._Id;
}
set
{
this.OnIdChanging(value);
this._Id = value;
this.OnIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _Id;
partial void OnIdChanging(int value);
partial void OnIdChanged();
/// <summary>
/// There are no comments for Property PublishedPackageId in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PublishedPackageId
{
get
{
return this._PublishedPackageId;
}
set
{
this.OnPublishedPackageIdChanging(value);
this._PublishedPackageId = value;
this.OnPublishedPackageIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PublishedPackageId;
partial void OnPublishedPackageIdChanging(string value);
partial void OnPublishedPackageIdChanged();
/// <summary>
/// There are no comments for Property PublishedPackageVersion in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PublishedPackageVersion
{
get
{
return this._PublishedPackageVersion;
}
set
{
this.OnPublishedPackageVersionChanging(value);
this._PublishedPackageVersion = value;
this.OnPublishedPackageVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PublishedPackageVersion;
partial void OnPublishedPackageVersionChanging(string value);
partial void OnPublishedPackageVersionChanged();
/// <summary>
/// There are no comments for Property ScreenshotUri in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ScreenshotUri
{
get
{
return this._ScreenshotUri;
}
set
{
this.OnScreenshotUriChanging(value);
this._ScreenshotUri = value;
this.OnScreenshotUriChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ScreenshotUri;
partial void OnScreenshotUriChanging(string value);
partial void OnScreenshotUriChanged();
/// <summary>
/// There are no comments for Property Caption in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Caption
{
get
{
return this._Caption;
}
set
{
this.OnCaptionChanging(value);
this._Caption = value;
this.OnCaptionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Caption;
partial void OnCaptionChanging(string value);
partial void OnCaptionChanged();
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="bf634e7d-1d71-45cd-b4d8-f06f74cb7bc7" xmlns="urn:schemas-microsoft-com:xml-dataservicemap">
<MetadataSources>
<MetadataSource Address="http://orchardproject.net:777/GalleryServer/FeedService.svc/" Protocol="http" SourceId="1" />
</MetadataSources>
<Metadata>
<MetadataFile FileName="service.edmx" MetadataType="Edmx" ID="ed52956e-0709-4cc7-a9ba-74cca2274614" SourceId="1" SourceUrl="http://orchardproject.net:777/GalleryServer/FeedService.svc/" />
</Metadata>
<Extensions />
</ReferenceGroup>

View File

@@ -0,0 +1,63 @@
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
<Schema Namespace="Gallery.Infrastructure.FeedModels" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityType Name="PublishedPackage" m:HasStream="true">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Version" />
</Key>
<Property Name="Id" Type="Edm.String" Nullable="false" />
<Property Name="Version" Type="Edm.String" Nullable="false" />
<Property Name="Title" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Authors" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationAuthorName" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="PackageType" Type="Edm.String" Nullable="true" />
<Property Name="Summary" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Description" Type="Edm.String" Nullable="true" />
<Property Name="DownloadCount" Type="Edm.Int32" Nullable="false" />
<Property Name="Copyright" Type="Edm.String" Nullable="true" />
<Property Name="PackageHashAlgorithm" Type="Edm.String" Nullable="true" />
<Property Name="PackageHash" Type="Edm.String" Nullable="true" />
<Property Name="PackageSize" Type="Edm.Int64" Nullable="false" />
<Property Name="Rating" Type="Edm.Double" Nullable="false" />
<Property Name="RatingCount" Type="Edm.Int32" Nullable="false" />
<Property Name="Price" Type="Edm.Decimal" Nullable="false" />
<Property Name="RequireLicenseAcceptance" Type="Edm.Boolean" Nullable="false" />
<Property Name="IsLatestVersion" Type="Edm.Boolean" Nullable="false" />
<Property Name="Created" Type="Edm.DateTime" Nullable="false" />
<Property Name="LastUpdated" Type="Edm.DateTime" Nullable="false" m:FC_TargetPath="SyndicationUpdated" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Published" Type="Edm.DateTime" Nullable="false" />
<Property Name="ExternalPackageUrl" Type="Edm.String" Nullable="true" />
<Property Name="ProjectUrl" Type="Edm.String" Nullable="true" />
<Property Name="LicenseUrl" Type="Edm.String" Nullable="true" />
<Property Name="IconUrl" Type="Edm.String" Nullable="true" />
<Property Name="ReportAbuseUrl" Type="Edm.String" Nullable="true" />
<NavigationProperty Name="Screenshots" Relationship="Gallery.Infrastructure.FeedModels.PublishedPackage_Screenshots" FromRole="PublishedPackage" ToRole="Screenshots" />
<Property Name="Categories" Type="Edm.String" Nullable="true" />
<Property Name="Tags" Type="Edm.String" Nullable="true" />
<Property Name="Dependencies" Type="Edm.String" Nullable="true" />
</EntityType>
<EntityType Name="PublishedScreenshot">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
<Property Name="PublishedPackageId" Type="Edm.String" Nullable="true" />
<Property Name="PublishedPackageVersion" Type="Edm.String" Nullable="true" />
<Property Name="ScreenshotUri" Type="Edm.String" Nullable="true" />
<Property Name="Caption" Type="Edm.String" Nullable="true" />
</EntityType>
<Association Name="PublishedPackage_Screenshots">
<End Role="PublishedPackage" Type="Gallery.Infrastructure.FeedModels.PublishedPackage" Multiplicity="*" />
<End Role="Screenshots" Type="Gallery.Infrastructure.FeedModels.PublishedScreenshot" Multiplicity="*" />
</Association>
<EntityContainer Name="GalleryFeedContext" m:IsDefaultEntityContainer="true">
<EntitySet Name="Packages" EntityType="Gallery.Infrastructure.FeedModels.PublishedPackage" />
<EntitySet Name="Screenshots" EntityType="Gallery.Infrastructure.FeedModels.PublishedScreenshot" />
<AssociationSet Name="PublishedPackage_Screenshots" Association="Gallery.Infrastructure.FeedModels.PublishedPackage_Screenshots">
<End Role="PublishedPackage" EntitySet="Packages" />
<End Role="Screenshots" EntitySet="Screenshots" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@@ -94,7 +94,7 @@ namespace Orchard.Packaging.Services {
{
ExtensionName = package.Title ?? package.Id,
ExtensionVersion = package.Version.ToString(),
ExtensionType = package.Id.StartsWith(PackagingSourceManager.ThemesFilter) ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
ExtensionType = package.Id.StartsWith(PackagingSourceManager.ThemesPrefix) ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
ExtensionPath = applicationPath
};
}
@@ -129,9 +129,9 @@ namespace Orchard.Packaging.Services {
} else {
// otherwise delete the folder
string extensionPath = packageId.StartsWith(PackagingSourceManager.ThemesFilter)
? "~/Themes/" + packageId.Substring(PackagingSourceManager.ThemesFilter.Length)
: "~/Modules/" + packageId.Substring(PackagingSourceManager.ModulesFilter.Length);
string extensionPath = packageId.StartsWith(PackagingSourceManager.ThemesPrefix)
? "~/Themes/" + packageId.Substring(PackagingSourceManager.ThemesPrefix.Length)
: "~/Modules/" + packageId.Substring(PackagingSourceManager.ThemesPrefix.Length);
string extensionFullPath = HostingEnvironment.MapPath(extensionPath);

View File

@@ -4,14 +4,16 @@ using System.Linq;
using NuGet;
using Orchard.Data;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
using Orchard.Packaging.GalleryServer;
using Orchard.Packaging.Models;
namespace Orchard.Packaging.Services {
[OrchardFeature("Gallery")]
public class PackagingSourceManager : IPackagingSourceManager {
public const string ModulesFilter = "Orchard.Module.";
public const string ThemesFilter = "Orchard.Theme.";
public const string ThemesPrefix = "Orchard.Themes.";
public const string ModulesPrefix = "Orchard.Modules.";
private readonly IRepository<PackagingSource> _packagingSourceRecordRepository;
@@ -41,32 +43,35 @@ namespace Orchard.Packaging.Services {
}
public IEnumerable<PackagingEntry> GetModuleList(PackagingSource packagingSource = null) {
return GetExtensionList(ModulesFilter, packagingSource);
return GetExtensionList(DefaultExtensionTypes.Module, packagingSource);
}
public IEnumerable<PackagingEntry> GetThemeList(PackagingSource packagingSource = null) {
return GetExtensionList(ThemesFilter, packagingSource);
return GetExtensionList(DefaultExtensionTypes.Theme, packagingSource);
}
private IEnumerable<PackagingEntry> GetExtensionList(string filter = null, PackagingSource packagingSource = null) {
return ( packagingSource == null ? GetSources() : new[] { packagingSource } )
return (packagingSource == null ? GetSources() : new[] {packagingSource})
.SelectMany(
source =>
new DataServicePackageRepository(new Uri(source.FeedUrl))
.GetPackages()
.Where(p => p.Id.StartsWith(filter ?? String.Empty))
new GalleryFeedContext(new Uri(source.FeedUrl)).Packages
.Where(p => p.PackageType == filter)
.ToList()
.Select(p => new PackagingEntry {
Title = String.IsNullOrWhiteSpace(p.Title) ? p.Id : p.Title,
PackageId = p.Id,
PackageStreamUri = p.ProjectUrl != null ? p.ProjectUrl.ToString() : String.Empty,
Source = source,
Version = p.Version != null ? p.Version.ToString() : String.Empty,
Description = p.Description,
Authors = p.Authors != null ? String.Join(", ", p.Authors) : String.Empty,
})
.Select(p => CreatePackageEntry(p, packagingSource))
).ToArray();
}
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PackagingSource source) {
return new PackagingEntry {
Title = String.IsNullOrWhiteSpace(package.Title) ? package.Id : package.Title,
PackageId = package.Id,
PackageStreamUri = package.ProjectUrl != null ? package.ProjectUrl.ToString() : String.Empty,
Source = source,
Version = package.Version ?? String.Empty,
Description = package.Description,
Authors = package.Authors,
LastUpdated = package.LastUpdated
};
}
#endregion
}

View File

@@ -1,5 +1,7 @@
using System;
using Orchard.ContentManagement;
using Orchard.Core.Contents;
using Orchard.Localization;
using Orchard.PublishLater.Models;
using Orchard.Tasks.Scheduling;
@@ -7,11 +9,21 @@ namespace Orchard.PublishLater.Services {
public class PublishLaterService : IPublishLaterService {
private readonly IPublishingTaskManager _publishingTaskManager;
public PublishLaterService(IPublishingTaskManager publishingTaskManager) {
public PublishLaterService(
IOrchardServices services,
IPublishingTaskManager publishingTaskManager) {
Services = services;
_publishingTaskManager = publishingTaskManager;
T = NullLocalizer.Instance;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
void IPublishLaterService.Publish(ContentItem contentItem, DateTime scheduledPublishUtc) {
if (!Services.Authorizer.Authorize(Permissions.PublishOthersContent, contentItem, T("Couldn't publish selected content.")))
return;
_publishingTaskManager.Publish(contentItem, scheduledPublishUtc);
}

View File

@@ -94,12 +94,16 @@ namespace Orchard.FileSystems.Media {
return (di.Attributes & FileAttributes.Hidden) != 0;
}
public void TryCreateFolder(string path) {
Directory.CreateDirectory(Map(path));
}
public void CreateFolder(string path) {
if (Directory.Exists(Map(path))) {
throw new ArgumentException(T("Directory {0} already exists", path).ToString());
}
Directory.CreateDirectory(Map(path));
TryCreateFolder(Map(path));
}
public void DeleteFolder(string path) {

View File

@@ -6,6 +6,7 @@ namespace Orchard.FileSystems.Media {
IStorageFile GetFile(string path);
IEnumerable<IStorageFile> ListFiles(string path);
IEnumerable<IStorageFolder> ListFolders(string path);
void TryCreateFolder(string path);
void CreateFolder(string path);
void DeleteFolder(string path);
void RenameFolder(string path, string newPath);