diff --git a/App_LocalResources/Settings.ascx.resx b/App_LocalResources/Settings.ascx.resx
index a3c57aa..787fae2 100644
--- a/App_LocalResources/Settings.ascx.resx
+++ b/App_LocalResources/Settings.ascx.resx
@@ -315,4 +315,22 @@
Show Icon:
+
+ Check to allow image preview. This features can consume CPU resources when a lot of visitors use it, because the image is resized on the fly.
+
+
+ Image Preview:
+
+
+ Max height in pixel of the thumbnail when image preview is enabled.
+
+
+ Thumbnail Height:
+
+
+ Max width in pixel of the thumbnail when image preview is enabled.
+
+
+ Thumbnail Width:
+
\ No newline at end of file
diff --git a/App_LocalResources/SharedResources.resx b/App_LocalResources/SharedResources.resx
index 5d88247..d39a2fa 100644
--- a/App_LocalResources/SharedResources.resx
+++ b/App_LocalResources/SharedResources.resx
@@ -267,4 +267,13 @@
Select all
+
+ Preview
+
+
+ Close
+
+
+ Image preview
+
\ No newline at end of file
diff --git a/Common/Options.cs b/Common/Options.cs
index ea63ca8..516fbc2 100644
--- a/Common/Options.cs
+++ b/Common/Options.cs
@@ -12,5 +12,6 @@ public sealed class Options
public bool SynchronizeFolder { get; set; }
public bool FileManagement { get; set; }
public bool OpenOnDblclick { get; set; }
+ public bool ImagePreview { get; set; }
}
}
\ No newline at end of file
diff --git a/Components/ServicesController.cs b/Components/ServicesController.cs
index e0184fc..f9f2954 100644
--- a/Components/ServicesController.cs
+++ b/Components/ServicesController.cs
@@ -60,7 +60,8 @@ public HttpResponseMessage Options()
Columns = GetColumns(settings),
SynchronizeFolder = IsAdmin,
FileManagement = settings.FileManagement,
- OpenOnDblclick = settings.OpenOnDblclick
+ OpenOnDblclick = settings.OpenOnDblclick,
+ ImagePreview = settings.ImagePreview
};
return Request.CreateResponse(HttpStatusCode.OK, options, GetFormatter());
@@ -164,7 +165,48 @@ public HttpResponseMessage DownloadURL([FromUri] ItemCommand itemCommand)
string url = Globals.LinkClick(string.Format("FileID={0}", file.FileId), -1, -1, false, forceDownload);
return Request.CreateResponse(HttpStatusCode.OK, url);
+ }
+
+ return Request.CreateResponse(HttpStatusCode.NotFound, filePath);
+ }
+ catch
+ {
+ return Request.CreateErrorResponse(HttpStatusCode.BadRequest, LocalizeString("UnattentedError"));
+ }
+ }
+ ///
+ /// Get image thumbnail.
+ ///
+ /// Options
+ [HttpGet]
+ [ValidateAntiForgeryToken]
+ [SupportedModules("TidyModules.DocumentExplorer")]
+ [DnnAuthorize]
+ public HttpResponseMessage Thumbnail([FromUri] ItemCommand itemCommand)
+ {
+ try
+ {
+ string folderPath = PathUtils.Instance.FormatFolderPath(itemCommand.Path);
+ string filePath = folderPath + itemCommand.Files[0];
+ IFileInfo file = FileManager.Instance.GetFile(PortalSettings.PortalId, filePath);
+
+ if (file != null)
+ {
+ DocumentSettings settings = new DocumentSettings(ActiveModule);
+ int height = settings.ThumbnailHeight;
+ int width = settings.ThumbnailWidth;
+ string extension = "." + file.Extension;
+
+ using (Stream content = FileManager.Instance.GetFileContent(file))
+ {
+ using (Stream thumbnail = ImageUtils.CreateImage(content, height, width, extension))
+ {
+ string img64 = string.Format("data:{0};base64,{1}", file.ContentType, ReadFullyAsBase64(thumbnail));
+
+ return Request.CreateResponse(HttpStatusCode.OK, img64);
+ }
+ }
}
return Request.CreateResponse(HttpStatusCode.NotFound, filePath);
@@ -522,8 +564,10 @@ private Dictionary GetResources()
resources.Add("renameFolderTitle", LocalizeString("RenameFolderTitle"));
resources.Add("renameFileTitle", LocalizeString("RenameFileTitle"));
resources.Add("packNameTitle", LocalizeString("PackNameTitle"));
+ resources.Add("imagePreviewTitle", LocalizeString("ImagePreviewTitle"));
resources.Add("dialogOk", LocalizeString("DialogOk"));
resources.Add("dialogCancel", LocalizeString("DialogCancel"));
+ resources.Add("dialogClose", LocalizeString("DialogClose"));
resources.Add("deleteFolderMessage", LocalizeString("DeleteFolderMessage"));
resources.Add("deleteFilesMessage", LocalizeString("DeleteFilesMessage"));
resources.Add("itemSelectAll", LocalizeString("ItemSelectAll"));
@@ -534,6 +578,7 @@ private Dictionary GetResources()
resources.Add("cantPaste", LocalizeString("CantPaste"));
resources.Add("itemRename", LocalizeString("ItemRename"));
resources.Add("itemDelete", LocalizeString("ItemDelete"));
+ resources.Add("imagePreview", LocalizeString("ImagePreview"));
resources.Add("fileOpen", LocalizeString("FileOpen"));
resources.Add("fileDownload", LocalizeString("FileDownload"));
resources.Add("fileClipboard", LocalizeString("FileClipboard"));
@@ -833,6 +878,22 @@ private string ZipFiles(IEnumerable zipFileList, IFolderInfo folder, str
return error;
}
+ ///
+ /// Convert content from a stream to a base 64 string.
+ ///
+ /// Stream
+ /// Base 64 string
+ private string ReadFullyAsBase64(Stream input)
+ {
+ using (MemoryStream ms = new MemoryStream())
+ {
+ input.Position = 0;
+ input.CopyTo(ms);
+
+ return Convert.ToBase64String(ms.ToArray());
+ }
+ }
+
#endregion
}
}
\ No newline at end of file
diff --git a/DocumentExplorer.csproj b/DocumentExplorer.csproj
index 3b68ef7..15a16e2 100644
--- a/DocumentExplorer.csproj
+++ b/DocumentExplorer.csproj
@@ -187,9 +187,6 @@
-
-
-
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
diff --git a/DocumentSettings.cs b/DocumentSettings.cs
index f3187ae..0c167c9 100644
--- a/DocumentSettings.cs
+++ b/DocumentSettings.cs
@@ -100,6 +100,15 @@ public DocumentSettings(ModuleInfo module) : base(module)
[ModuleSetting("OpenOnDblclick", "false")]
public bool OpenOnDblclick { get; set; }
+ [ModuleSetting("ImagePreview", "true")]
+ public bool ImagePreview { get; set; }
+
+ [ModuleSetting("ThumbnailWidth", "450")]
+ public int ThumbnailWidth { get; set; }
+
+ [ModuleSetting("ThumbnailHeight", "300")]
+ public int ThumbnailHeight { get; set; }
+
#endregion
}
}
\ No newline at end of file
diff --git a/Package/TidyModules.DocumentExplorer_00.01.00_Install.zip b/Package/TidyModules.DocumentExplorer_00.01.00_Install.zip
deleted file mode 100644
index 2e58709..0000000
Binary files a/Package/TidyModules.DocumentExplorer_00.01.00_Install.zip and /dev/null differ
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index f760bd4..c755b77 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
+[assembly: AssemblyVersion("0.1.1.0")]
+[assembly: AssemblyFileVersion("0.1.1.0")]
diff --git a/Scripts/explorer.js b/Scripts/explorer.js
index 055e7e3..d839a0b 100644
--- a/Scripts/explorer.js
+++ b/Scripts/explorer.js
@@ -5,7 +5,8 @@
locale = null,
sizes = null,
showIcon = false,
- fileManagement = false,
+ fileManagement = false
+ imagePreview = false,
hasFilter = false,
resetFilters = false,
dlgWindow = null,
@@ -282,6 +283,10 @@
options.push(itemTmpl.format("cmfDelete", "fa-trash", locale["itemDelete"]));
}
+ if (imagePreview) {
+ options.push(itemTmpl.format("cmfPreview", "fa-eye", locale["imagePreview"]));
+ }
+
options.push(itemTmpl.format("cmfOpen", "fa-external-link", locale["fileOpen"]));
options.push(itemTmpl.format("cmfDownload", "fa-download", locale["fileDownload"]));
options.push(itemTmpl.format("cmfClipboard", "fa-link", locale["fileClipboard"]));
@@ -328,6 +333,14 @@
});
}
+ // Check if the file is an image
+ function isImage(extension) {
+ if (extension == "bmp" || extension == "jpg" || extension == "png" || extension == "gif")
+ return true;
+
+ return false;
+ }
+
// Build full url from relative path
function buildURL(relativePath) {
if (relativePath.length > 0 & relativePath[0] != "/") {
@@ -426,6 +439,39 @@
});
});
break;
+ case "cmfPreview":
+ var file = deFiles.puidatatable("getContextMenuSelection");
+ var cmd = new ItemCommand(folder.path, getFileNames(file));
+
+ $.ajax({
+ type: "GET",
+ url: services.format("Thumbnail"),
+ data: cmd,
+ beforeSend: sf.setModuleHeaders
+ }).done(function (result, status, xhr) {
+ var html = "";
+
+ $(html).dialog({
+ modal: true,
+ width: "auto",
+ title: locale["imagePreviewTitle"],
+ dialogClass: "dnnFormPopup",
+ buttons: [
+ {
+ text: locale["dialogClose"],
+ click: function () {
+ $(this).dialog("close");
+ }
+ }
+ ],
+ close: function () {
+ $(this).dialog("destroy").remove();
+ }
+ });
+ }).fail(function (xhr, result, status) {
+ showError(status, xhr.responseText);
+ });
+ break;
case "cmfOpen":
var file = deFiles.puidatatable("getContextMenuSelection");
var cmd = new ItemCommand(folder.path, getFileNames(file));
@@ -683,9 +729,12 @@
if (counter > 1) {
cmFiles.find("#cmfRename").addClass("ui-state-disabled");
+ cmFiles.find("#cmfPreview").addClass("ui-state-disabled");
cmFiles.find("#cmfOpen").addClass("ui-state-disabled");
cmFiles.find("#cmfDownload").addClass("ui-state-disabled");
cmFiles.find("#cmfClipboard").addClass("ui-state-disabled");
+ } else if (!isImage(data.extension)) {
+ cmFiles.find("#cmfPreview").addClass("ui-state-disabled");
}
}
@@ -696,6 +745,7 @@
sizes = locale["sizes"].split(",");
showIcon = options.showIcon;
fileManagement = options.fileManagement;
+ imagePreview = options.imagePreview;
resetFilters = options.resetFilters;
// Init dialog windows
diff --git a/Scripts/explorer.min.js b/Scripts/explorer.min.js
index d34a0fb..0a84b1d 100644
--- a/Scripts/explorer.min.js
+++ b/Scripts/explorer.min.js
@@ -1,25 +1,27 @@
-(function(K,d,L){function g(a,c,b,d){this.path=a;this.files=null!=c?c instanceof Array?c:[c]:[];this.flag="boolean"===typeof b?b:!1;this.toPath=d}function q(a){var c=[];if(a instanceof Array)for(var b=0;b"+e.loading+""),b=a.outerHeight();0==b&&a.children().each(function(){var a=d(this).outerHeight();a>b&&(b=a)});
-c.find("i").css("margin-top",b/2-20+"px");c.height(b);c.width(a.width());c.prependTo(a);return c}function M(a,c){var b="",e=y(m);a.data&&null!=a.data.path&&(b=a.data.path);var t=x.format("Folders"),E=new g(b);d.ajax({type:"GET",url:t,dataType:"json",data:E,context:this,beforeSend:v.setModuleHeaders}).done(function(t,d,E){null!=t&&c.call(this,t,a.node);""==b&&(t=this.rootContainer.find(".ui-treenode-parent:first"),this.selectNode(t))}).fail(function(a,c,b){k(b,a.responseText)}).complete(function(){e.remove()})}
-function N(a){var c=y(f),b=x.format("Files");a=new g(a,null,F);d.ajax({type:"GET",url:b,dataType:"json",data:a,context:this,beforeSend:v.setModuleHeaders}).done(function(a,c,b){f.puidatatable("option","datasource",a);C&&(G&&f.find(".ui-column-filter").each(function(){d(this).val("")}),f.puidatatable("filter"))}).fail(function(a,c,b){k(b,a.responseText)}).complete(function(){c.remove()})}function z(a,c){return d.ajax({type:"GET",url:x.format(a),dataType:"json",data:c,beforeSend:v.setModuleHeaders})}
-function p(a,c){return d.ajax({type:"POST",url:x.format(a),dataType:"json",data:c,beforeSend:v.setModuleHeaders})}function O(a,c){return"{0} {1}".format(a.icon,a.name)}function P(a,c){var b=a.size;if(0==b)return lr.ZeroByte;var d=parseInt(Math.floor(Math.log(b)/Math.log(1024)));return Math.round(b/Math.pow(1024,d),2)+" "+H[d]}function Q(a){a=new Date(a.modified);return a.toLocaleDateString()+" "+a.toLocaleTimeString()}function k(a,c){var b="{0}: {1}".format(a,c);D.text(b);A.dialog("open")}function I(a,
-c){var b=d.Deferred();d("").html(a).dialog({modal:!0,minWidth:350,title:e.confirmTitle,dialogClass:"dnnFormPopup",buttons:[{text:e.dialogOk,click:function(){b.resolve(c);d(this).dialog("close")}},{text:e.dialogCancel,click:function(){b.reject();d(this).dialog("close")}}],close:function(){d(this).dialog("destroy").remove()}});return b.promise()}function B(a,c){var b=d.Deferred();d("").dialog({modal:!0,minWidth:350,title:a,dialogClass:"dnnFormPopup",buttons:[{text:e.dialogOk,click:function(){var a=d(this).find("#txtItemName").val().trim();""!=a?b.resolve(a):b.reject();d(this).dialog("close")}},{text:e.dialogCancel,click:function(){b.reject();d(this).dialog("close")}}],close:function(){d(this).dialog("destroy").remove()}});return b.promise()}function R(){var a=[];w&&(a.push("{2}".format("cmfSelectAll","fa-hand-lizard-o",e.itemSelectAll)),
-a.push("{2}".format("cmfCut","fa-scissors",e.itemCut)),a.push("{2}".format("cmfCopy","fa-copy",e.itemCopy)),a.push("{2}".format("cmfPaste","fa-paste",e.itemPaste)),a.push("{2}".format("cmfRename","fa-edit",e.itemRename)),a.push("{2}".format("cmfDelete","fa-trash",e.itemDelete)));a.push("{2}".format("cmfOpen",
-"fa-external-link",e.fileOpen));a.push("{2}".format("cmfDownload","fa-download",e.fileDownload));a.push("{2}".format("cmfClipboard","fa-link",e.fileClipboard));w&&(a.push("{2}".format("cmfPack","fa-compress",e.filePack)),a.push("{2}".format("cmfUnpack","fa-expand",e.fileUnpack)));h.append(a);h.on("click","li a",S);h.puicontextmenu({target:f})}
-function T(a){var c=[];w&&(c.push("{2}".format("cmfdCreate","fa-plus",e.folderCreate)),c.push("{2}".format("cmfdCut","fa-scissors",e.itemCut)),c.push("{2}".format("cmfdPaste","fa-paste",e.itemPaste)),c.push("{2}".format("cmfdRename","fa-edit",e.itemRename)),c.push("{2}".format("cmfdDelete","fa-trash",
-e.itemDelete)));a&&(c.push("{2}".format("cmfdSynch","fa-refresh",e.folderSynchronize)),c.push("{2}".format("cmfdSynchRecurse","fa-refresh",e.folderSynchronizeRecurse)));r.append(c);r.on("click","li a",U);r.puicontextmenu({target:m})}function S(a){var c=n.data;switch(a.currentTarget.id){case "cmfSelectAll":f.puidatatable("selectAllRows");break;case "cmfCut":a=f.puidatatable("getSelection");l=new g(c.path,q(a),!0);break;
-case "cmfCopy":a=f.puidatatable("getSelection");l=new g(c.path,q(a));break;case "cmfPaste":l.path!=c.path?(l.toPath=c.path,p("PasteFiles",l).done(function(a,c,b){l=null;m.puitree("selectNode",n.node)}).fail(function(a,c,b){k(b,a.responseText)})):(D.text(e.cantPaste),A.dialog("open"));break;case "cmfRename":a=f.puidatatable("getContextMenuSelection");var b=new g(c.path,q(a)),u=b.files[0];B(e.renameFileTitle,u).then(function(a){a!=u&&(b.toPath=a,p("Rename",b).done(function(a,c,b){m.puitree("selectNode",
-n.node)}).fail(function(a,c,b){k(b,a.responseText)}))});break;case "cmfDelete":I(e.deleteFilesMessage).then(function(){var a=f.puidatatable("getSelection"),b=q(a),a=new g(c.path,b);p("Delete",a).done(function(a,c,t){a=f.puidatatable("option","datasource");a=d.grep(a,function(a,c){return-1==d.inArray(a.name,b)});f.puidatatable("option","datasource",a)}).fail(function(a,c,b){k(b,a.responseText)})});break;case "cmfOpen":a=f.puidatatable("getContextMenuSelection");b=new g(c.path,q(a));J(b);break;case "cmfDownload":a=
-f.puidatatable("getContextMenuSelection");b=new g(c.path,q(a),!0);z("DownloadURL",b).done(function(a,c,b){dnn.dom.navigate(a)}).fail(function(a,c,b){k(b,a.responseText)});break;case "cmfClipboard":a=f.puidatatable("getContextMenuSelection");b=new g(c.path,q(a));z("DownloadURL",b).done(function(a,c,b){0 #message");A.dialog({autoOpen:!1,modal:!0,closeOnEscape:!0,minWidth:350,dialogClass:"dnnFormPopup",
-title:e.errorTitle,buttons:[{text:e.dialogOk,click:function(){d(this).dialog("close")}}]});f=d("#deFiles");f.puidatatable({paginator:{rows:a.rows},columns:a.columns,draggableColumns:!0,resizableColumns:!0,selectionMode:"multiple",rowSelectContextMenu:Y,datasource:[],emptyMessage:e.noFiles});if(a.openOnDblclick)f.on("dblclick",".ui-datatable-data tr",W);h=d("#cmFiles");R();m=d("#deFolders");m.puitree({animate:!0,lazy:!0,selectionMode:"single",nodeSelect:X,nodes:M,icons:{def:{expanded:"fa-folder-open",
-collapsed:"fa-folder"}}});r=d("#cmFolders");w?T(a.synchronizeFolder):r.remove()}var v={},x=null,e=null,H=null,F=!1,w=!1,C=!1,G=!1,A=null,D=null,m=null,r=null,f=null,h=null,n=null,l=null;K.init=function(a){v=a;x=v.getServiceRoot("TidyModules/DocumentExplorer")+"Services/{0}/";String.prototype.format||(String.prototype.format=function(){var a=arguments;return this.replace(/{(\d+)}/g,function(b,d){return"undefined"!=typeof a[d]?a[d]:b})});d.extend(d.ui.dialog.prototype.options,{create:function(){var a=
-d(this);a.parent().find(".ui-dialog-buttonpane button:first").focus();a.keypress(function(b){if(b.keyCode==d.ui.keyCode.ENTER)return a.parent().find(".ui-dialog-buttonpane button:first").click(),!1})}});d.widget("primeui.puitree",d.primeui.puitree,{refresh:function(){this.rootContainer.empty();this.options.selectionMode&&(this.selection=[]);"array"===d.type(this.options.nodes)?this._renderNodes(this.options.nodes,this.rootContainer):"function"===d.type(this.options.nodes)&&this.options.nodes.call(this,
-{},this._initData)}});d.widget("primeui.puidatatable",d.primeui.puidatatable,{selectAllRows:function(){this.options.selectionMode&&(this.selection=this.data,this.paginate())}});z("Options").done(function(a,b,d){b=a.columns;for(d=0;d"+e.loading+""),b=a.outerHeight();0==b&&a.children().each(function(){var a=d(this).outerHeight();a>b&&(b=a)});
+c.find("i").css("margin-top",b/2-20+"px");c.height(b);c.width(a.width());c.prependTo(a);return c}function C(a,c){var b="",e=r(deFolders);a.data&&null!=a.data.path&&(b=a.data.path);var l=p.format("Folders"),v=new f(b);d.ajax({type:"GET",url:l,dataType:"json",data:v,context:this,beforeSend:m.setModuleHeaders}).done(function(l,d,v){null!=l&&c.call(this,l,a.node);""==b&&(l=this.rootContainer.find(".ui-treenode-parent:first"),this.selectNode(l))}).fail(function(a,c,b){g(b,a.responseText)}).complete(function(){e.remove()})}
+function D(a){var c=r(deFiles),b=p.format("Files");a=new f(a,null,w);d.ajax({type:"GET",url:b,dataType:"json",data:a,context:this,beforeSend:m.setModuleHeaders}).done(function(a,c,b){deFiles.puidatatable("option","datasource",a);hasFilter&&(resetFilters&&deFiles.find(".ui-column-filter").each(function(){d(this).val("")}),deFiles.puidatatable("filter"))}).fail(function(a,c,b){g(b,a.responseText)}).complete(function(){c.remove()})}function t(a,c){return d.ajax({type:"GET",url:p.format(a),dataType:"json",
+data:c,beforeSend:m.setModuleHeaders})}function k(a,c){return d.ajax({type:"POST",url:p.format(a),dataType:"json",data:c,beforeSend:m.setModuleHeaders})}function E(a,c){return"{0} {1}".format(a.icon,a.name)}function F(a,c){var b=a.size;if(0==b)return lr.ZeroByte;var d=parseInt(Math.floor(Math.log(b)/Math.log(1024)));return Math.round(b/Math.pow(1024,d),2)+" "+x[d]}function G(a){a=new Date(a.modified);return a.toLocaleDateString()+" "+a.toLocaleTimeString()}function g(a,c){var b="{0}: {1}".format(a,
+c);dlgMessage.text(b);dlgWindow.dialog("open")}function y(a,c){var b=d.Deferred();d("").html(a).dialog({modal:!0,minWidth:350,title:e.confirmTitle,dialogClass:"dnnFormPopup",buttons:[{text:e.dialogOk,click:function(){b.resolve(c);d(this).dialog("close")}},{text:e.dialogCancel,click:function(){b.reject();d(this).dialog("close")}}],close:function(){d(this).dialog("destroy").remove()}});return b.promise()}function u(a,c){var b=d.Deferred();d("").dialog({modal:!0,minWidth:350,title:a,dialogClass:"dnnFormPopup",buttons:[{text:e.dialogOk,click:function(){var a=d(this).find("#txtItemName").val().trim();""!=a?b.resolve(a):b.reject();d(this).dialog("close")}},{text:e.dialogCancel,click:function(){b.reject();d(this).dialog("close")}}],close:function(){d(this).dialog("destroy").remove()}});return b.promise()}function H(){var a=[];q&&(a.push(itemTmpl.format("cmfSelectAll","fa-hand-lizard-o",e.itemSelectAll)),a.push(itemTmpl.format("cmfCut",
+"fa-scissors",e.itemCut)),a.push(itemTmpl.format("cmfCopy","fa-copy",e.itemCopy)),a.push(itemTmpl.format("cmfPaste","fa-paste",e.itemPaste)),a.push(itemTmpl.format("cmfRename","fa-edit",e.itemRename)),a.push(itemTmpl.format("cmfDelete","fa-trash",e.itemDelete)));imagePreview&&a.push(itemTmpl.format("cmfPreview","fa-eye",e.imagePreview));a.push(itemTmpl.format("cmfOpen","fa-external-link",e.fileOpen));a.push(itemTmpl.format("cmfDownload","fa-download",e.fileDownload));a.push(itemTmpl.format("cmfClipboard",
+"fa-link",e.fileClipboard));q&&(a.push(itemTmpl.format("cmfPack","fa-compress",e.filePack)),a.push(itemTmpl.format("cmfUnpack","fa-expand",e.fileUnpack)));cmFiles.append(a);cmFiles.on("click","li a",I);cmFiles.puicontextmenu({target:deFiles})}function J(a){var c=[];q&&(c.push(itemTmpl.format("cmfdCreate","fa-plus",e.folderCreate)),c.push(itemTmpl.format("cmfdCut","fa-scissors",e.itemCut)),c.push(itemTmpl.format("cmfdPaste","fa-paste",e.itemPaste)),c.push(itemTmpl.format("cmfdRename","fa-edit",e.itemRename)),
+c.push(itemTmpl.format("cmfdDelete","fa-trash",e.itemDelete)));a&&(c.push(itemTmpl.format("cmfdSynch","fa-refresh",e.folderSynchronize)),c.push(itemTmpl.format("cmfdSynchRecurse","fa-refresh",e.folderSynchronizeRecurse)));cmFolders.append(c);cmFolders.on("click","li a",K);cmFolders.puicontextmenu({target:deFolders})}function L(a){return"bmp"==a||"jpg"==a||"png"==a||"gif"==a?!0:!1}function I(a){var c=selectedNode.data;switch(a.currentTarget.id){case "cmfSelectAll":deFiles.puidatatable("selectAllRows");
+break;case "cmfCut":a=deFiles.puidatatable("getSelection");command=new f(c.path,h(a),!0);break;case "cmfCopy":a=deFiles.puidatatable("getSelection");command=new f(c.path,h(a));break;case "cmfPaste":command.path!=c.path?(command.toPath=c.path,k("PasteFiles",command).done(function(a,c,b){command=null;deFolders.puitree("selectNode",selectedNode.node)}).fail(function(a,c,b){g(b,a.responseText)})):(dlgMessage.text(e.cantPaste),dlgWindow.dialog("open"));break;case "cmfRename":a=deFiles.puidatatable("getContextMenuSelection");
+var b=new f(c.path,h(a)),n=b.files[0];u(e.renameFileTitle,n).then(function(a){a!=n&&(b.toPath=a,k("Rename",b).done(function(a,c,b){deFolders.puitree("selectNode",selectedNode.node)}).fail(function(a,c,b){g(b,a.responseText)}))});break;case "cmfDelete":y(e.deleteFilesMessage).then(function(){var a=deFiles.puidatatable("getSelection"),b=h(a),a=new f(c.path,b);k("Delete",a).done(function(a,c,l){a=deFiles.puidatatable("option","datasource");a=d.grep(a,function(a,c){return-1==d.inArray(a.name,b)});deFiles.puidatatable("option",
+"datasource",a)}).fail(function(a,c,b){g(b,a.responseText)})});break;case "cmfPreview":a=deFiles.puidatatable("getContextMenuSelection");b=new f(c.path,h(a));d.ajax({type:"GET",url:p.format("Thumbnail"),data:b,beforeSend:m.setModuleHeaders}).done(function(a,c,b){d("").dialog({modal:!0,width:"auto",title:e.imagePreviewTitle,dialogClass:"dnnFormPopup",buttons:[{text:e.dialogClose,click:function(){d(this).dialog("close")}}],close:function(){d(this).dialog("destroy").remove()}})}).fail(function(a,
+c,b){g(b,a.responseText)});break;case "cmfOpen":a=deFiles.puidatatable("getContextMenuSelection");b=new f(c.path,h(a));z(b);break;case "cmfDownload":a=deFiles.puidatatable("getContextMenuSelection");b=new f(c.path,h(a),!0);t("DownloadURL",b).done(function(a,c,b){dnn.dom.navigate(a)}).fail(function(a,c,b){g(b,a.responseText)});break;case "cmfClipboard":a=deFiles.puidatatable("getContextMenuSelection");b=new f(c.path,h(a));t("DownloadURL",b).done(function(a,c,b){0 #message");
+dlgWindow.dialog({autoOpen:!1,modal:!0,closeOnEscape:!0,minWidth:350,dialogClass:"dnnFormPopup",title:e.errorTitle,buttons:[{text:e.dialogOk,click:function(){d(this).dialog("close")}}]});deFiles=d("#deFiles");deFiles.puidatatable({paginator:{rows:a.rows},columns:a.columns,draggableColumns:!0,resizableColumns:!0,selectionMode:"multiple",rowSelectContextMenu:P,datasource:[],emptyMessage:e.noFiles});if(a.openOnDblclick)deFiles.on("dblclick",".ui-datatable-data tr",N);cmFiles=d("#cmFiles");H();deFolders=
+d("#deFolders");deFolders.puitree({animate:!0,lazy:!0,selectionMode:"single",nodeSelect:O,nodes:C,icons:{def:{expanded:"fa-folder-open",collapsed:"fa-folder"}}});cmFolders=d("#cmFolders");q?J(a.synchronizeFolder):cmFolders.remove()}var m={},p=null,e=null,x=null,w=!1,q=!1;resetFilters=hasFilter=imagePreview=!1;command=selectedNode=cmFiles=deFiles=cmFolders=deFolders=dlgMessage=dlgWindow=null;itemTmpl="{2}";A.init=function(a){m=a;p=m.getServiceRoot("TidyModules/DocumentExplorer")+
+"Services/{0}/";String.prototype.format||(String.prototype.format=function(){var a=arguments;return this.replace(/{(\d+)}/g,function(b,d){return"undefined"!=typeof a[d]?a[d]:b})});d.extend(d.ui.dialog.prototype.options,{create:function(){var a=d(this);a.parent().find(".ui-dialog-buttonpane button:first").focus();a.keypress(function(b){if(b.keyCode==d.ui.keyCode.ENTER)return a.parent().find(".ui-dialog-buttonpane button:first").click(),!1})}});d.widget("primeui.puitree",d.primeui.puitree,{refresh:function(){this.rootContainer.empty();
+this.options.selectionMode&&(this.selection=[]);"array"===d.type(this.options.nodes)?this._renderNodes(this.options.nodes,this.rootContainer):"function"===d.type(this.options.nodes)&&this.options.nodes.call(this,{},this._initData)}});d.widget("primeui.puidatatable",d.primeui.puidatatable,{selectAllRows:function(){this.options.selectionMode&&(this.selection=this.data,this.paginate())}});t("Options").done(function(a,b,d){b=a.columns;for(d=0;d
+
+
+
diff --git a/Settings.ascx.cs b/Settings.ascx.cs
index 173c5c9..0bf0bd1 100644
--- a/Settings.ascx.cs
+++ b/Settings.ascx.cs
@@ -62,6 +62,9 @@ public override void LoadSettings()
chkUserFolder.Checked = settings.UserFolder;
chkFileManagement.Checked = settings.FileManagement;
chkOpenOnDblclick.Checked = settings.OpenOnDblclick;
+ chkImagePreview.Checked = settings.ImagePreview;
+ txtThumbnailWidth.Text = settings.ThumbnailWidth.ToString();
+ txtThumbnailHeight.Text = settings.ThumbnailHeight.ToString();
}
catch (Exception exc)
{
@@ -112,6 +115,9 @@ public override void UpdateSettings()
settings.UserFolder = chkUserFolder.Checked;
settings.FileManagement = chkFileManagement.Checked;
settings.OpenOnDblclick = chkOpenOnDblclick.Checked;
+ settings.ImagePreview = chkImagePreview.Checked;
+ settings.ThumbnailWidth = int.Parse(txtThumbnailWidth.Text);
+ settings.ThumbnailHeight = int.Parse(txtThumbnailHeight.Text);
settings.UpdateSettings();
}
diff --git a/Settings.ascx.designer.cs b/Settings.ascx.designer.cs
index 1a839cd..0a5d35f 100644
--- a/Settings.ascx.designer.cs
+++ b/Settings.ascx.designer.cs
@@ -515,5 +515,59 @@ public partial class Settings {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.CheckBox chkOpenOnDblclick;
+
+ ///
+ /// lblImagePreview control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblImagePreview;
+
+ ///
+ /// chkImagePreview control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox chkImagePreview;
+
+ ///
+ /// lblThumbnailWidth control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblThumbnailWidth;
+
+ ///
+ /// txtThumbnailWidth control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtThumbnailWidth;
+
+ ///
+ /// lblThumbnailHeight control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::DotNetNuke.UI.UserControls.LabelControl lblThumbnailHeight;
+
+ ///
+ /// txtThumbnailHeight control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtThumbnailHeight;
}
}
diff --git a/TidyModules.DocumentExplorer.dnn b/TidyModules.DocumentExplorer.dnn
index 72a1dad..7b03723 100644
--- a/TidyModules.DocumentExplorer.dnn
+++ b/TidyModules.DocumentExplorer.dnn
@@ -1,5 +1,5 @@
-
+
Document Explorer
Lightweight module to manage DNN files.
@@ -10,7 +10,8 @@
contact@tidy-modules.com
Licenced under MIT licence terms. Copyright 2016 Tidy Modules.
- First Beta version DO NOT USE in production!
+ Second Beta version DO NOT USE in production!
+Image preview added.