Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions CS/FileManagerOpenDocuments.sln

This file was deleted.

50 changes: 0 additions & 50 deletions CS/FileManagerOpenDocuments/Controllers/HomeController.cs

This file was deleted.

14 changes: 0 additions & 14 deletions CS/FileManagerOpenDocuments/FileManagerOpenDocuments.csproj

This file was deleted.

6 changes: 6 additions & 0 deletions CS/FileManagerOpenDocuments/FileManagerOpenDocuments.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Solution>
<Folder Name="/DevExtreme NuGet.config/">
<File Path="NuGet.config" />
</Folder>
<Project Path="FileManagerOpenDocuments/FileManagerOpenDocuments.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using DevExtreme.AspNet.Mvc.FileManagement;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace T845880.Controllers {
namespace FileManagerOpenDocuments.Controllers {
public class FileManagerApiController : ControllerBase {
public IWebHostEnvironment HostingEnvironment { get; }
public FileManagerApiController(IWebHostEnvironment hostingEnvironment) {
Expand All @@ -33,11 +26,5 @@ public object FileSystem(FileSystemCommand command, string arguments) {
var result = processor.Execute(command, arguments);
return result.GetClientCommandResult();
}
string GetFileItemUrl(FileSystemInfo fileSystemItem) {
var relativeUrl = fileSystemItem.FullName
.Replace(HostingEnvironment.WebRootPath, "")
.Replace(Path.DirectorySeparatorChar, '/');
return $"{Request.Scheme}://{Request.Host}{Request.PathBase}{relativeUrl}";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using DevExpress.AspNetCore.Spreadsheet;
using FileManagerOpenDocuments.Models;
using Microsoft.AspNetCore.Mvc;

namespace FileManagerOpenDocuments.Controllers {
public class HomeController : Controller {
private readonly string rootPath;

public HomeController(IWebHostEnvironment hostingEnvironment) {
rootPath = Path.Combine(hostingEnvironment.WebRootPath, "SampleDocs");
}

[HttpPost]
public IActionResult OpenDocInSpreadsheet(string filePath) {
if (string.IsNullOrWhiteSpace(filePath)) {
return BadRequest("A document path is required.");
}

string path = Path.GetFullPath(Path.Combine(rootPath, filePath));
string relativePath = Path.GetRelativePath(rootPath, path);
if (Path.IsPathRooted(relativePath) || relativePath == ".." ||
relativePath.StartsWith($"..{Path.DirectorySeparatorChar}") ||
!string.Equals(Path.GetExtension(path), ".xlsx", StringComparison.OrdinalIgnoreCase)) {
return BadRequest("Select an XLSX document in SampleDocs.");
}
if (!System.IO.File.Exists(path)) {
return NotFound("The document was not found.");
}

return PartialView("SpreadsheetPartial", new DocumentModel {
DocumentID = relativePath,
FileBytes = System.IO.File.ReadAllBytes(path)
});
}

[HttpPost]
[HttpGet]
public IActionResult DxDocRequest() {
return SpreadsheetRequestProcessor.GetResponse(HttpContext);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DevExpress.AspNetCore.RichEdit" Version="26.2.2-beta" />
<PackageReference Include="DevExpress.AspNetCore.Spreadsheet" Version="26.2.2-beta" />
<PackageReference Include="DevExtreme.AspNet.Data" Version="6.0.0-beta" />
<PackageReference Include="DevExtreme.AspNet.Core" Version="26.2.2-beta" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties TemplateFeatures="NETCORE" /></VisualStudio></ProjectExtensions>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace FileManagerOpenDocuments.Models {
public class DocumentModel {
public string DocumentID { get; set; }
public byte[] FileBytes { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@page
<h2 class="content-block">About</h2>

<p class="content-block dx-card responsive-paddings">Use this area to provide additional information.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace FileManagerOpenDocuments.Pages {
public class AboutModel : PageModel {
public void OnGet() {

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@page

<h2 class="content-block">An error occurred while the server was processing your request.</h2>

<div class="content-block dx-card responsive-paddings">
To display detailed information about the error, set the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> and restart the app.
<br /><br />
<strong>The Development environment should not be enabled for deployed applications</strong> because it provides users access to exceptions that can contain sensitive information.
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace FileManagerOpenDocuments.Pages {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel {
public void OnGet() {
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@{
@page
@model IndexModel
@{
ViewData["Title"] = "File Manager - How to open documents";
}
<h1>File Manager - How to open documents</h1>
Expand Down Expand Up @@ -33,15 +35,15 @@
.Width("1300px")
.Height("900px")
.DeferRendering(false)
.CloseOnOutsideClick(true)
.HideOnOutsideClick(true)
)
@using (Html.DevExtreme().NamedTemplate("text")) {
await Html.RenderPartialAsync("RichEditPartial");
}

@using (Html.DevExtreme().NamedTemplate("excel")) {
ViewContext.Writer.Write("<div id='excelContainer'>");
await Html.RenderPartialAsync("SpreadsheetPartial");
await Html.RenderPartialAsync("SpreadsheetPartial", new FileManagerOpenDocuments.Models.DocumentModel());
ViewContext.Writer.Write("</div>");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace FileManagerOpenDocuments.Pages {
public class IndexModel : PageModel {
public void OnGet() {

}
}
}
Loading
Loading