webdav portal search view added

This commit is contained in:
vfedosevich 2015-03-03 06:41:52 -08:00
parent 839f6cda2b
commit 0ebe24141e
24 changed files with 345 additions and 99 deletions

View file

@ -145,6 +145,7 @@ namespace WebsitePanel.Providers.OS
} }
public string RelativeUrl { get; set; } public string RelativeUrl { get; set; }
public string Summary { get; set; }
public string DriveLetter public string DriveLetter
{ {

View file

@ -304,7 +304,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage
var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder); var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder);
rootFolder = Path.Combine(rootFolder, organizationId); rootFolder = Path.Combine(rootFolder, organizationId);
var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})", var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType, System.Search.AutoSummary FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})",
searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray())); searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray()));
conn.Open(); conn.Open();
@ -318,7 +318,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage
var file = new SystemFile {Name = reader[0] as string}; var file = new SystemFile {Name = reader[0] as string};
file.Changed = file.CreatedDate = reader[1] is DateTime ? (DateTime)reader[1] : new DateTime(); file.Changed = file.CreatedDate = reader[1] is DateTime ? (DateTime)reader[1] : new DateTime();
file.Size = reader[2] is long ? (long) reader[2] : 0; file.Size = reader[2] is Decimal ? Convert.ToInt64((Decimal) reader[2]) : 0;
var kind = reader[3] is IEnumerable ? ((IEnumerable)reader[3]).Cast<string>().ToList() : null; var kind = reader[3] is IEnumerable ? ((IEnumerable)reader[3]).Cast<string>().ToList() : null;
var itemType = reader[5] as string ?? string.Empty; var itemType = reader[5] as string ?? string.Empty;
@ -342,6 +342,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage
} }
} }
file.Summary = reader[6] as string;
result.Add(file); result.Add(file);
} }
} }

View file

@ -3,7 +3,7 @@ using System.Linq;
namespace WebsitePanel.WebDav.Core.Extensions namespace WebsitePanel.WebDav.Core.Extensions
{ {
static class UriExtensions public static class UriExtensions
{ {
public static Uri Append(this Uri uri, params string[] paths) public static Uri Append(this Uri uri, params string[] paths)
{ {

View file

@ -9,6 +9,7 @@ namespace WebsitePanel.WebDav.Core
long ContentLength { get; } long ContentLength { get; }
long AllocatedSpace { get; set; } long AllocatedSpace { get; set; }
string ContentType { get; } string ContentType { get; }
string Summary { get; set; }
void Download(string filename); void Download(string filename);
byte[] Download(); byte[] Download();

View file

@ -89,6 +89,8 @@ namespace WebsitePanel.WebDav.Core
} }
} }
public string Summary { get; set; }
/// <summary> /// <summary>
/// Downloads content of the resource to a file specified by filename /// Downloads content of the resource to a file specified by filename
/// </summary> /// </summary>

View file

@ -19,5 +19,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Managers
string GetFileUrl(string path); string GetFileUrl(string path);
void DeleteResource(string path); void DeleteResource(string path);
void LockFile(string path); void LockFile(string path);
string GetFileFolderPath(string path);
} }
} }

View file

@ -103,7 +103,7 @@ namespace WebsitePanel.WebDav.Core.Managers
public bool IsFile(string path) public bool IsFile(string path)
{ {
string folder = GetFileFolder(path); string folder = GetFileFolderPath(path);
if (string.IsNullOrWhiteSpace(folder)) if (string.IsNullOrWhiteSpace(folder))
{ {
@ -124,7 +124,7 @@ namespace WebsitePanel.WebDav.Core.Managers
{ {
try try
{ {
string folder = GetFileFolder(path); string folder = GetFileFolderPath(path);
var resourceName = GetResourceName(path); var resourceName = GetResourceName(path);
@ -212,7 +212,7 @@ namespace WebsitePanel.WebDav.Core.Managers
path = RemoveLeadingFromPath(path, "edit"); path = RemoveLeadingFromPath(path, "edit");
path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId); path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId);
string folderPath = GetFileFolder(path); string folderPath = GetFileFolderPath(path);
OpenFolder(folderPath); OpenFolder(folderPath);
@ -232,7 +232,7 @@ namespace WebsitePanel.WebDav.Core.Managers
{ {
try try
{ {
string folder = GetFileFolder(path); string folder = GetFileFolderPath(path);
var resourceName = GetResourceName(path); var resourceName = GetResourceName(path);
@ -250,7 +250,7 @@ namespace WebsitePanel.WebDav.Core.Managers
{ {
try try
{ {
string folder = GetFileFolder(path); string folder = GetFileFolderPath(path);
var resourceName = GetResourceName(path); var resourceName = GetResourceName(path);
@ -270,7 +270,7 @@ namespace WebsitePanel.WebDav.Core.Managers
{ {
try try
{ {
string folder = GetFileFolder(path); string folder = GetFileFolderPath(path);
var resourceName = GetResourceName(path); var resourceName = GetResourceName(path);
@ -345,6 +345,7 @@ namespace WebsitePanel.WebDav.Core.Managers
webDavitem.SetLastModified(file.Changed); webDavitem.SetLastModified(file.Changed);
webDavitem.ContentLength = file.Size; webDavitem.ContentLength = file.Size;
webDavitem.AllocatedSpace = file.FRSMQuotaMB; webDavitem.AllocatedSpace = file.FRSMQuotaMB;
webDavitem.Summary = file.Summary;
convertResult.Add(webDavitem); convertResult.Add(webDavitem);
} }
@ -372,7 +373,7 @@ namespace WebsitePanel.WebDav.Core.Managers
targetStream.Write(buffer, 0, n); targetStream.Write(buffer, 0, n);
} }
private string GetFileFolder(string path) public string GetFileFolderPath(string path)
{ {
path = path.TrimEnd('/'); path = path.TrimEnd('/');

View file

@ -46,6 +46,18 @@ namespace WebsitePanel.WebDavPortal
#region Enterprise storage #region Enterprise storage
routes.MapRoute(
name: FileSystemRouteNames.SearchFiles,
url: "storage/search/{org}/{*pathPart}",
defaults: new { controller = "FileSystem", action = "SearchFiles", pathPart = UrlParameter.Optional }
);
routes.MapRoute(
name: FileSystemRouteNames.SearchFilesContent,
url: "storage/ajax/search/{org}/{*pathPart}",
defaults: new { controller = "FileSystem", action = "SearchFilesContent", pathPart = UrlParameter.Optional }
);
routes.MapRoute( routes.MapRoute(
name: FileSystemRouteNames.ChangeWebDavViewType, name: FileSystemRouteNames.ChangeWebDavViewType,
url: "storage/change-view-type/{viewType}", url: "storage/change-view-type/{viewType}",

View file

@ -21,5 +21,8 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
public const string DeleteFiles = "DeleteFilesRoute"; public const string DeleteFiles = "DeleteFilesRoute";
public const string DownloadFile = "DownloadFileRoute"; public const string DownloadFile = "DownloadFileRoute";
public const string SearchFiles = "SearchFilesRoute";
public const string SearchFilesContent = "SearchFilesPostRoute";
} }
} }

View file

@ -60,6 +60,17 @@ tr.selected-file {
.table-icon { .table-icon {
height: 30px; height: 30px;
vertical-align: top;
}
.column-name .file-info {
display: inline-block;
padding-left: 5px;
width: 90%;
}
.table-icon.search {
height: 45px;
} }
.noselect { .noselect {
@ -77,6 +88,8 @@ tr.selected-file {
#webdav-items-table .file-link { #webdav-items-table .file-link {
padding-left: 5px; padding-left: 5px;
padding-top: 5px;
display: inline-block;
vertical-align: middle !important; vertical-align: middle !important;
} }
@ -86,6 +99,11 @@ tr.selected-file {
height: 32px; height: 32px;
} }
#summary.summary {
font-size: 11px;
color: rgb(152, 152, 152);
}
.drag-and-drop-area input { .drag-and-drop-area input {
/* IE 8 */ /* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
@ -252,16 +270,29 @@ tr.selected-file {
width: 200px; width: 200px;
} }
.search-block { .breadcrumb-wsp {
float: right; display: inline-block;
padding-top: 5px;
} }
.search-block input, .search-block label { .search-block {
float: right;
margin-right: 10px !important;
width: 36%;
}
.search-block input{
display: inline-block;
font-weight: normal;
}
.search-block label {
display: inline-block; display: inline-block;
width: initial; width: initial;
font-weight: normal; font-weight: normal;
} }
.elements-container { .elements-container {
padding-top: 10px; padding-top: 10px;
} }
@ -371,4 +402,10 @@ div#breadcrumb_wrapper a:last-child {
.header-portal-title { .header-portal-title {
float: none; float: none;
display: inline-block; display: inline-block;
}
@media (min-width: 768px) {
.navbar-right {
margin-right: 0;
}
} }

View file

@ -35,6 +35,7 @@ using WebsitePanel.WebDavPortal.Models.Common.Enums;
using WebsitePanel.WebDavPortal.Models.FileSystem; using WebsitePanel.WebDavPortal.Models.FileSystem;
using WebsitePanel.WebDavPortal.UI; using WebsitePanel.WebDavPortal.UI;
using WebsitePanel.WebDavPortal.UI.Routes; using WebsitePanel.WebDavPortal.UI.Routes;
using WebsitePanel.WebDav.Core.Extensions;
namespace WebsitePanel.WebDavPortal.Controllers namespace WebsitePanel.WebDavPortal.Controllers
@ -143,7 +144,6 @@ namespace WebsitePanel.WebDavPortal.Controllers
} }
} }
[HttpGet] [HttpGet]
public ActionResult GetContentDetails(string org, string pathPart, [ModelBinder(typeof (JqueryDataTableModelBinder))] JqueryDataTableRequest dtRequest) public ActionResult GetContentDetails(string org, string pathPart, [ModelBinder(typeof (JqueryDataTableModelBinder))] JqueryDataTableRequest dtRequest)
{ {
@ -160,7 +160,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
var tableItems = Mapper.Map<IEnumerable<WebDavResource>, IEnumerable<ResourceTableItemModel>>(folderItems).ToList(); var tableItems = Mapper.Map<IEnumerable<WebDavResource>, IEnumerable<ResourceTableItemModel>>(folderItems).ToList();
FillContentModel(tableItems); FillContentModel(tableItems, org);
var orders = dtRequest.Orders.ToList(); var orders = dtRequest.Orders.ToList();
orders.Insert(0, new JqueryDataTableOrder{Column = 3, Ascending = false}); orders.Insert(0, new JqueryDataTableOrder{Column = 3, Ascending = false});
@ -184,6 +184,24 @@ namespace WebsitePanel.WebDavPortal.Controllers
return PartialView("_ResourseCollectionPartial", result); return PartialView("_ResourseCollectionPartial", result);
} }
public ActionResult SearchFiles(string org, string pathPart, string searchValue)
{
if (string.IsNullOrEmpty(searchValue))
{
return RedirectToRoute(FileSystemRouteNames.ShowContentPath);
}
var model = new ModelForWebDav
{
UrlSuffix = pathPart,
Permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart),
UserSettings = _userSettingsManager.GetUserSettings(WspContext.User.AccountId),
SearchValue = searchValue
};
return View("ShowContentSearchResultTable", model);
}
[HttpGet] [HttpGet]
public ActionResult DownloadFile(string org, string pathPart) public ActionResult DownloadFile(string org, string pathPart)
{ {
@ -329,17 +347,17 @@ namespace WebsitePanel.WebDavPortal.Controllers
} }
#endregion #endregion
private void FillContentModel(IEnumerable<ResourceTableItemModel> items) private void FillContentModel(IEnumerable<ResourceTableItemModel> items, string organizationId)
{ {
foreach (var item in items) foreach (var item in items)
{ {
var opener = _openerManager[Path.GetExtension(item.DisplayName)]; var opener = _openerManager[Path.GetExtension(item.DisplayName)];
var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/');
switch (opener) switch (opener)
{ {
case FileOpenerType.OfficeOnline: case FileOpenerType.OfficeOnline:
{ {
var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/');
item.Url = string.Concat(Url.RouteUrl(FileSystemRouteNames.EditOfficeOnline, new {org = WspContext.User.OrganizationId, pathPart = ""}), pathPart); item.Url = string.Concat(Url.RouteUrl(FileSystemRouteNames.EditOfficeOnline, new {org = WspContext.User.OrganizationId, pathPart = ""}), pathPart);
break; break;
} }
@ -350,6 +368,11 @@ namespace WebsitePanel.WebDavPortal.Controllers
} }
} }
var folderPath = Server.UrlDecode(_webdavManager.GetFileFolderPath(pathPart));
item.FolderUrlAbsoluteString = Server.UrlDecode(Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new {org = organizationId, pathPart = folderPath}, Request.Url.Scheme));
item.FolderUrlLocalString = Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new { org = organizationId, pathPart = folderPath });
if (Request.Browser.IsMobileDevice) if (Request.Browser.IsMobileDevice)
{ {
item.IsTargetBlank = false; item.IsTargetBlank = false;

View file

@ -45,6 +45,7 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav
.ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified)) .ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified))
.ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt"))) .ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt")))
.ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary))
.ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem)) .ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem))
.ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength)) .ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength))
.ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace)) .ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace))

View file

@ -18,7 +18,10 @@ namespace WebsitePanel.WebDavPortal.Models.FileSystem
public DateTime LastModified { get; set; } public DateTime LastModified { get; set; }
public string LastModifiedFormated { get; set; } public string LastModifiedFormated { get; set; }
public string IconHref { get; set; } public string IconHref { get; set; }
public string FolderUrlAbsoluteString { get; set; }
public string FolderUrlLocalString { get; set; }
public string FolderName { get; set; }
public string Summary { get; set; }
public override dynamic this[int index] public override dynamic this[int index]
{ {

View file

@ -150,6 +150,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to File.
/// </summary>
public static string File {
get {
return ResourceManager.GetString("File", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to File Upload. /// Looks up a localized string similar to File Upload.
/// </summary> /// </summary>
@ -168,6 +177,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Info.
/// </summary>
public static string Info {
get {
return ResourceManager.GetString("Info", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to {0} items was removed.. /// Looks up a localized string similar to {0} items was removed..
/// </summary> /// </summary>
@ -258,6 +276,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Search Documents.
/// </summary>
public static string SearchDocuments {
get {
return ResourceManager.GetString("SearchDocuments", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Search Results.
/// </summary>
public static string SearchResults {
get {
return ResourceManager.GetString("SearchResults", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Select files to upload. /// Looks up a localized string similar to Select files to upload.
/// </summary> /// </summary>

View file

@ -147,12 +147,18 @@
<data name="Error" xml:space="preserve"> <data name="Error" xml:space="preserve">
<value>Error</value> <value>Error</value>
</data> </data>
<data name="File" xml:space="preserve">
<value>File</value>
</data>
<data name="FileUpload" xml:space="preserve"> <data name="FileUpload" xml:space="preserve">
<value>File Upload</value> <value>File Upload</value>
</data> </data>
<data name="GigabyteShort" xml:space="preserve"> <data name="GigabyteShort" xml:space="preserve">
<value>Gb</value> <value>Gb</value>
</data> </data>
<data name="Info" xml:space="preserve">
<value>Info</value>
</data>
<data name="ItemsWasRemovedFormat" xml:space="preserve"> <data name="ItemsWasRemovedFormat" xml:space="preserve">
<value>{0} items was removed.</value> <value>{0} items was removed.</value>
</data> </data>
@ -183,6 +189,12 @@
<data name="Search" xml:space="preserve"> <data name="Search" xml:space="preserve">
<value>Search</value> <value>Search</value>
</data> </data>
<data name="SearchDocuments" xml:space="preserve">
<value>Search Documents</value>
</data>
<data name="SearchResults" xml:space="preserve">
<value>Search Results</value>
</data>
<data name="SelectFilesToUpload" xml:space="preserve"> <data name="SelectFilesToUpload" xml:space="preserve">
<value>Select files to upload</value> <value>Select files to upload</value>
</data> </data>

View file

@ -1,18 +1,19 @@
function CheckAuthenticationExpiration(authcookieName, logoutUrl) { function CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl) {
var c = $.cookie(authcookieName); var c = $.cookie(authTimeOutCookieName);
if (c != null && c != "" && !isNaN(c)) { if (c != null && c != "" && !isNaN(c)) {
var now = new Date(); var now = new Date();
var ms = parseInt(c, 10); var ms = parseInt(c, 10);
var expiration = new Date().setTime(ms); var expiration = new Date().setTime(ms);
if (now > expiration) { if (now > expiration) {
$.removeCookie(authTimeOutCookieName, { path: '/' });
window.location.replace(logoutUrl); window.location.replace(logoutUrl);
} }
} }
} }
function StartAuthExpirationCheckTimer(authcookieName, logoutUrl) { function StartAuthExpirationCheckTimer(authTimeOutCookieName, authCookieName, logoutUrl) {
setInterval(function() { setInterval(function() {
CheckAuthenticationExpiration(authcookieName, logoutUrl); CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl);
}, 20000); }, 20000);
} }

View file

@ -1,6 +1,12 @@
function WspFileBrowser() { function WspFileBrowser() {
this.settings = { deletionBlockSelector: ".file-actions-menu .file-deletion", deletionUrl: "storage/files-group-action/delete" }; this.settings = {
this.table = null; deletionBlockSelector: ".file-actions-menu .file-deletion",
deletionUrl: "storage/files-group-action/delete",
textDateModified: "Date modified",
textSize: "Size"
};
this.itemsTable = null;
this.searchTable = null;
} }
WspFileBrowser.prototype = { WspFileBrowser.prototype = {
@ -34,7 +40,8 @@ WspFileBrowser.prototype = {
}).get(); }).get();
}, },
deleteSelectedItems: function(e) { deleteSelectedItems: function (e) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: wsp.fileBrowser.settings.deletionUrl, url: wsp.fileBrowser.settings.deletionUrl,
@ -45,7 +52,7 @@ WspFileBrowser.prototype = {
wsp.fileBrowser.clearDeletedItems(model.DeletedFiles); wsp.fileBrowser.clearDeletedItems(model.DeletedFiles);
wsp.fileBrowser.refreshDeletionBlock(); wsp.fileBrowser.refreshDeletionBlock();
wsp.fileBrowser.refreshDataTable(); wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable);
wsp.dialogs.hideProcessDialog(); wsp.dialogs.hideProcessDialog();
}, },
@ -53,7 +60,7 @@ WspFileBrowser.prototype = {
wsp.messages.addErrorMessage(errorThrown); wsp.messages.addErrorMessage(errorThrown);
wsp.fileBrowser.refreshDeletionBlock(); wsp.fileBrowser.refreshDeletionBlock();
wsp.fileBrowser.refreshDataTable(); wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable);
wsp.dialogs.hideProcessDialog(); wsp.dialogs.hideProcessDialog();
} }
@ -79,10 +86,11 @@ WspFileBrowser.prototype = {
}, },
initDataTable: function (tableId, ajaxUrl) { initDataTable: function (tableId, ajaxUrl) {
this.table = $(tableId).dataTable({ this.itemsTable = $(tableId).dataTable({
"ajax": ajaxUrl, "ajax": ajaxUrl,
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
"dom": 'rtlp',
"columnDefs": [ "columnDefs": [
{ {
"render": function(data, type, row) { "render": function(data, type, row) {
@ -128,18 +136,87 @@ WspFileBrowser.prototype = {
$(tableId).removeClass('dataTable'); $(tableId).removeClass('dataTable');
var oTable = this.table; //var oTable = this.table;
$(tableId+'_filter input').unbind();
$(tableId+'_filter input').bind('keyup', function (e) { //$(searchInputId).bind('keyup', function (e) {
if (e.keyCode == 13) { // if (e.keyCode == 13) {
oTable.fnFilter(this.value); // oTable.fnFilter(this.value);
} // }
}); //});
//$(searchInputId).keydown(function (event) {
// if (event.keyCode == 13) {
// event.preventDefault();
// return false;
// }
// return true;
//});
}, },
refreshDataTable: function () { initSearchDataTable: function (tableId, ajaxUrl, initSearch) {
if (this.table != null) {
this.table.fnDraw(false); var settings = this.settings;
var classThis = this;
this.searchTable = $(tableId).dataTable({
"ajax": ajaxUrl,
"processing": false,
"serverSide": true,
"oSearch": { "sSearch": initSearch },
"dom": 'rtlp',
"columnDefs": [
{
"render": function (data, type, row) {
return '<div class="column-name">' +
'<img class="table-icon search" src="' + row.IconHref + '"/>' +
'<div class="file-info">' +
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link" title="' + row.DisplayName + '">' +
row.DisplayName +
'</a>' +
'<div id="summary" class="summary">' + (row.Summary ? (row.Summary + '').substring(0, 500) + '...' : '') + '</div>' +
'<div>' +
'<a href="' + row.FolderUrlLocalString + '" ' + 'target="_blank" class="file-link" >' +
row.FolderUrlAbsoluteString +
'</a>' +
'</div>' +
'</div>' +
'</div>';
},
"targets": 0
},
{
"render": function (data, type, row) {
return '<div>' +settings.textDateModified+': '+ row.LastModifiedFormated+ '</div>' +
'<div>' + settings.textSize + ': ' + classThis.bytesToSize(row.Size) + '</div>';
},
"orderable": false,
"width": "25%",
"targets": 1
}
],
"createdRow": function (row, data, index) {
$(row).addClass('element-container');
},
"fnPreDrawCallback": function () {
// gather info to compose a message
wsp.dialogs.showProcessDialog();
return true;
},
"fnDrawCallback": function () {
// in case your overlay needs to be put away automatically you can put it here
wsp.dialogs.hideProcessDialog();
}
});
$(tableId).removeClass('dataTable');
},
refreshDataTable: function (table) {
if (table != null) {
table.fnDraw(false);
} }
}, },

View file

@ -53,9 +53,3 @@ else
</script> </script>
} }
} }
@section popups
{
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
}

View file

@ -0,0 +1,28 @@
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
@Html.Partial("_ShowContentTopMenu", Model)
<div class="prevent-deselect container">
<table id="search-items-table" class="display table table-striped table-bordered noselect" cellspacing="0" width="100%">
<thead>
<tr>
<th>@UI.File</th>
<th>@UI.Details</th>
</tr>
</thead>
</table>
</div>
@section scripts
{
<script>
$(document).ready(function() {
wsp.fileBrowser.setSettings({ deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)" });
wsp.fileBrowser.initSearchDataTable('#search-items-table', '@Url.RouteUrl(FileSystemRouteNames.ShowContentDetails)', '@Model.SearchValue');
});
</script>
}

View file

@ -3,21 +3,6 @@
@using WebsitePanel.WebDavPortal.UI.Routes @using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav @model WebsitePanel.WebDavPortal.Models.ModelForWebDav
<div class="container">
<div class="search-block navbar-right">
<div>
@using (Html.BeginRouteForm(FileSystemRouteNames.ShowContentPath))
{
<label>
@UI.Search:
</label>
@Html.TextBoxFor(x => x.SearchValue, new { @class = "form-control input-sm"})
}
</div>
</div>
</div>
<div class="container"> <div class="container">

View file

@ -15,8 +15,3 @@
</table> </table>
</div> </div>
@section popups
{
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
}

View file

@ -10,42 +10,69 @@
@if (Model != null) @if (Model != null)
{ {
string header = WspContext.User.OrganizationId; string header = WspContext.User.OrganizationId;
<a href="/@header/" class="processing-dialog">@header</a>
string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < elements.Length; i++)
{ <div class="breadcrumb-wsp">
<span style="top: 2px;"> / </span> @if (String.IsNullOrEmpty(Model.SearchValue))
<a href="@string.Concat("/" + header + "/", string.Join("/", elements.Take(i + 1)))" class="processing-dialog">@elements[i]</a> {
} <a href="/@header/" class="processing-dialog">@header</a>
}
</div> for (int i = 0; i < elements.Length; i++)
<div class="container file-actions-menu prevent-deselect"> {
@if (Model.Permissions.HasFlag(WebDavPermissions.Write)) <span style="top: 2px;"> / </span>
{ <a href="@string.Concat("/" + header + "/", string.Join("/", elements.Take(i + 1)))" class="processing-dialog">@elements[i]</a>
<div class="file-deletion navbar-left"> }
<a id="delete-button" class="btn btn-danger btn-sm active" role="button" }
data-target="#confirm-dialog" else
data-target-positive-button-text="@UI.Delete" {
data-target-title-text="@UI.DeleteFileQuestion" <a href="@Url.RouteUrl(FileSystemRouteNames.ShowContentPath)" class="processing-dialog">@UI.SearchResults</a>
data-target-content="@UI.DialogsContentConfrimFileDeletion">@UI.Delete</a> }
</div>
<div class="search-block navbar-right">
<div>
@using (Html.BeginRouteForm(FileSystemRouteNames.SearchFiles, FormMethod.Post))
{
<div>
<label>
@UI.SearchDocuments:
</label>
@Html.TextBox("searchValue", Model.SearchValue, new { @class = "form-control input-sm" })
</div>
}
</div>
</div> </div>
} }
</div>
<div class="file-upload navbar-right"> @if (string.IsNullOrEmpty(Model.SearchValue))
@if (Request.Browser.IsMobileDevice == false) {
<div class="container file-actions-menu prevent-deselect">
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
{ {
<div class="btn-toolbar change-view-block" role="toolbar"> <div class="file-deletion navbar-left">
<div class="btn-group"> <a id="delete-button" class="btn btn-danger btn-sm active" role="button"
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a> data-target="#confirm-dialog"
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a> data-target-positive-button-text="@UI.Delete"
</div> data-target-title-text="@UI.DeleteFileQuestion"
data-target-content="@UI.DialogsContentConfrimFileDeletion">@UI.Delete</a>
</div> </div>
} }
@if (Model.Permissions.HasFlag(WebDavPermissions.Write)) <div class="file-upload navbar-right">
{ @if (Request.Browser.IsMobileDevice == false)
<a id="upload-button" class="btn btn-success btn-sm active" href="@Url.RouteUrl(FileSystemRouteNames.UploadFile)" role="button">@UI.FileUpload</a> {
} <div class="btn-toolbar change-view-block" role="toolbar">
<div class="btn-group">
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a>
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a>
</div>
</div>
}
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
{
<a id="upload-button" class="btn btn-success btn-sm active" href="@Url.RouteUrl(FileSystemRouteNames.UploadFile)" role="button">@UI.FileUpload</a>
}
</div>
</div> </div>
}
</div>

View file

@ -47,6 +47,9 @@
</div> </div>
<div class="prevent-deselect"> <div class="prevent-deselect">
@Html.Partial("_ProcessDialog", null)
@Html.Partial("_ConfirmDialog")
@RenderSection("popups", required: false) @RenderSection("popups", required: false)
</div> </div>
@ -62,9 +65,9 @@
@Scripts.Render("~/bundles/authScripts") @Scripts.Render("~/bundles/authScripts")
<script> <script>
$(document).ready(function() { $(document).ready(function () {
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)"); StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@FormsAuthentication.FormsCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
}); });
</script> </script>
} }

View file

@ -459,6 +459,7 @@
<Content Include="Views\FileSystem\_ShowContentTopMenu.cshtml" /> <Content Include="Views\FileSystem\_ShowContentTopMenu.cshtml" />
<Content Include="Views\FileSystem\_ShowContentBigIcons.cshtml" /> <Content Include="Views\FileSystem\_ShowContentBigIcons.cshtml" />
<Content Include="Views\FileSystem\UploadFiles.cshtml" /> <Content Include="Views\FileSystem\UploadFiles.cshtml" />
<Content Include="Views\FileSystem\ShowContentSearchResultTable.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\FileSystem\Enums\" /> <Folder Include="Models\FileSystem\Enums\" />