Skip to content
This repository was archived by the owner on Feb 21, 2022. It is now read-only.

Commit 6381136

Browse files
author
magicodes
committed
V0.0.0.5 Beta版
1 parent 9a7bb0f commit 6381136

File tree

46 files changed

+84
-1746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+84
-1746
lines changed

Magicodes.Core.Web/Controllers/Viewer/DocumentViewerController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public ActionResult Index()
4343
var protocol = ApplicationContext.DocumentsOpenProtocolManager.DocumentOpenProtocols.FirstOrDefault(p => p.ContentType.Equals(contentType, StringComparison.CurrentCultureIgnoreCase));
4444
if (protocol != null)
4545
{
46-
//return RedirectToAction(protocol.ViewerUrl, new { FilePath = filePath });
47-
return View(protocol.ViewerUrl, new DocumentProtocolInfo() { FilePath = filePath, ContentType = contentType });
46+
TempData["DocumentProtocolInfo"] = new DocumentProtocolInfo() { FilePath = filePath, ContentType = contentType };
47+
//return RedirectToAction("Index", "PDFViewer", new { FilePath = filePath, ContentType = contentType, pluginName = "Magicodes.PDFViewer" });
48+
return RedirectToAction(protocol.Action, protocol.Controller, new { pluginName = protocol.PluginName });
4849
}
4950
//如果不存在,则下载
5051
return File(filePath, contentType);

Magicodes.Core.Web/GlobalConfigurationManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,16 @@ static void GlobalConfigurationManager_OnConfiguration_Config_MVC(object sender,
126126
RouteHelper.MapRouteMVCPlus(mvcPlus);
127127
documentsOpenProtocolManager.RegisterDocumentsOpenProtocols(mvcPlus);
128128
}
129+
RouteHelper.RouteEnd();
129130
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
130131
AreaRegistration.RegisterAllAreas();
132+
RegisterBundlesRequest();
133+
}
134+
/// <summary>
135+
/// 注册插件Bundles请求(只接受以下链接的请求:/{插件名}/bundles/{Bundle名}
136+
/// </summary>
137+
private static void RegisterBundlesRequest()
138+
{
131139
#region 注册请求事件,处理插件资源加载问题
132140
//注册请求事件,处理插件资源加载问题
133141
GlobalApplicationObject.Current.EventsManager.BeginRequest += (requestSender, arg) =>
@@ -171,7 +179,7 @@ static void GlobalConfigurationManager_OnConfiguration_Config_MVC(object sender,
171179
return;
172180
}
173181
}
174-
};
182+
};
175183
#endregion
176184
}
177185

Magicodes.Core.Web/Route/RouteHelper.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,29 @@ namespace Magicodes.Core.Web.Route
2525
{
2626
public class RouteHelper
2727
{
28+
/// <summary>
29+
/// 路由结束方法
30+
/// </summary>
31+
public static void RouteEnd()
32+
{
33+
//最后注册门户MVC插件
34+
var mvcHomePlus = MvcConfigManager.MVCPlusList.First(p => p.MvcPlusType == MvcPlusTypes.MVCHome);
35+
RouteTable.Routes.MapRoute(
36+
name: "MCV_" + mvcHomePlus.PlusName,
37+
url: "{controller}/{action}/{id}",
38+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, pluginName = mvcHomePlus.PlusName });
39+
}
40+
/// <summary>
41+
/// 映射MVC插件路由
42+
/// </summary>
43+
/// <param name="mvcPlus"></param>
2844
public static void MapRouteMVCPlus(IMVCPlusInfo mvcPlus)
2945
{
3046
switch (mvcPlus.MvcPlusType)
3147
{
32-
//此类型插件只支持一个
33-
case MvcPlusTypes.MVCHome:
34-
{
35-
RouteTable.Routes.MapRoute(
36-
name: "MCV_" + mvcPlus.PlusName,
37-
url: "{controller}/{action}/{id}",
38-
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, pluginName = mvcPlus.PlusName });
39-
}
40-
break;
48+
////此类型插件只支持一个
49+
//case MvcPlusTypes.MVCHome:
50+
// break;
4151
case MvcPlusTypes.MVC:
4252
{
4353
RouteTable.Routes.MapRoute(

Magicodes.Core/DocumentProtocols/DocumentOpenProtocol.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ public class DocumentOpenProtocol : IDocumentOpenProtocol
2929
/// </summary>
3030
public string ContentType { get; set; }
3131
/// <summary>
32-
/// 查看器路径
32+
/// 控制器
3333
/// </summary>
34-
public string ViewerUrl { get; set; }
34+
public string Controller { get; set; }
35+
/// <summary>
36+
/// 操作
37+
/// </summary>
38+
public string Action { get; set; }
39+
/// <summary>
40+
/// 插件名
41+
/// </summary>
42+
public string PluginName { get; set; }
3543
}
3644
}

Magicodes.Web.Interfaces/DocumentProtocols/IDocumentOpenProtocol.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,16 @@ public class IDocumentOpenProtocol
2828
/// </summary>
2929
public string ContentType { get; set; }
3030
/// <summary>
31-
/// 查看器路径
31+
/// 控制器
3232
/// </summary>
33-
public string ViewerUrl { get; set; }
33+
public string Controller { get; set; }
34+
/// <summary>
35+
/// 操作
36+
/// </summary>
37+
public string Action { get; set; }
38+
/// <summary>
39+
/// 插件名
40+
/// </summary>
41+
public string PluginName { get; set; }
3442
}
3543
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

Magicodes.Web/Plus/Plugins/Magicodes.Mvc.Default/Areas/Admin/Views/Config/UtilTemplate.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

Magicodes.Web/Plus/Plugins/Magicodes.Mvc.Default/Areas/Admin/Views/Roles/Create.cshtml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)