Added node path to be able to refresh the tree + refreshing the tree after an upload succeeds
This commit is contained in:
@@ -34,6 +34,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
_el: null,
|
||||
_elId: null,
|
||||
_parentId: null,
|
||||
_nodePath: null,
|
||||
_opts: null,
|
||||
_viewModel: null,
|
||||
|
||||
@@ -239,6 +240,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
switch (data.status) {
|
||||
case 'success':
|
||||
self._viewModel.queued.remove(data.context);
|
||||
UmbClientMgr.mainTree().syncTree(self._nodePath.toString(), true);
|
||||
break;
|
||||
case 'error':
|
||||
data.context.message(data.message);
|
||||
@@ -397,6 +399,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
// Grab parent id from element
|
||||
self._parentId = $(el).data("parentid");
|
||||
|
||||
// Grab node path from element
|
||||
self._nodePath = $(el).data("nodepath");
|
||||
|
||||
// Merge options with default
|
||||
self._opts = $.extend({
|
||||
|
||||
@@ -107,6 +107,9 @@ namespace Umbraco.Web.UI.Controls
|
||||
}
|
||||
sb.Append("</ul>");
|
||||
|
||||
// Path for tree refresh
|
||||
Panel.Attributes.Add("data-nodepath", ParentNode.Path);
|
||||
|
||||
// Create size changer
|
||||
sb.Append("<div class='thumb-sizer'>" +
|
||||
"<input type='radio' name='thumb_size' value='small' data-bind='checked: thumbSize' />" +
|
||||
|
||||
@@ -8,8 +8,10 @@ using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
using umbraco.cms.businesslogic.media;
|
||||
@@ -127,12 +129,12 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check Path
|
||||
var parentNode = new Media(parentNodeId);
|
||||
// Check FilePath
|
||||
if (!string.IsNullOrEmpty(context.Request["path"]))
|
||||
{
|
||||
var pathParts = context.Request["path"].Trim('/').Split('/');
|
||||
|
||||
var parentNode = new Media(parentNodeId);
|
||||
|
||||
foreach (var pathPart in pathParts)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pathPart))
|
||||
@@ -174,6 +176,9 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
}
|
||||
}
|
||||
|
||||
var scripts = new ClientTools(new Page());
|
||||
scripts.SyncTree(parentNode.Path, true);
|
||||
|
||||
// log succes
|
||||
Log.Add(LogTypes.New, parentNodeId, "Succes");
|
||||
}
|
||||
@@ -188,7 +193,9 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
// log error
|
||||
Log.Add(LogTypes.Error, -1, "Parent node id is in incorrect format");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return new UploadResponse();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user