Merge pull request #2224 from umbraco/temp-U4-5222
U4-5222 Rollback Feature fails to update the UI to show the rolled ba…
This commit is contained in:
@@ -362,10 +362,28 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
|
|||||||
return getRootScope();
|
return getRootScope();
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadLocation: function() {
|
/**
|
||||||
|
This will reload the content frame based on it's current route, if pathToMatch is specified it will only reload it if the current
|
||||||
|
location matches the path
|
||||||
|
*/
|
||||||
|
reloadLocation: function(pathToMatch) {
|
||||||
|
|
||||||
var injector = getRootInjector();
|
var injector = getRootInjector();
|
||||||
|
var doChange = true;
|
||||||
|
if (pathToMatch) {
|
||||||
|
var $location = injector.get("$location");
|
||||||
|
var path = $location.path();
|
||||||
|
if (path != pathToMatch) {
|
||||||
|
doChange = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doChange) {
|
||||||
var $route = injector.get("$route");
|
var $route = injector.get("$route");
|
||||||
$route.reload();
|
$route.reload();
|
||||||
|
var $rootScope = injector.get("$rootScope");
|
||||||
|
$rootScope.$apply();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
closeModalWindow: function(rVal) {
|
closeModalWindow: function(rVal) {
|
||||||
|
|||||||
@@ -172,9 +172,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadLocation: function () {
|
reloadLocation: function (pathToMatch) {
|
||||||
if (this.mainWindow().UmbClientMgr) {
|
if (this.mainWindow().UmbClientMgr) {
|
||||||
this.mainWindow().UmbClientMgr.reloadLocation();
|
this.mainWindow().UmbClientMgr.reloadLocation(pathToMatch);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.SessionState;
|
using System.Web.SessionState;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
@@ -117,36 +118,23 @@ namespace umbraco.presentation.dialogs
|
|||||||
|
|
||||||
if (!IsPostBack) {
|
if (!IsPostBack) {
|
||||||
allVersions.Items.Add(new ListItem(ui.Text("rollback", "selectVersion")+ "...", ""));
|
allVersions.Items.Add(new ListItem(ui.Text("rollback", "selectVersion")+ "...", ""));
|
||||||
foreach (DocumentVersionList dl in currentDoc.GetVersions()) {
|
|
||||||
|
foreach (DocumentVersionList dl in currentDoc.GetVersions())
|
||||||
|
{
|
||||||
|
//we don't need to show the current version
|
||||||
|
if (dl.Version == currentDoc.Version)
|
||||||
|
continue;
|
||||||
|
|
||||||
allVersions.Items.Add(new ListItem(dl.Text + " (" + ui.Text("content", "createDate") + ": " + dl.Date.ToShortDateString() + " " + dl.Date.ToShortTimeString() + ")", dl.Version.ToString()));
|
allVersions.Items.Add(new ListItem(dl.Text + " (" + ui.Text("content", "createDate") + ": " + dl.Date.ToShortDateString() + " " + dl.Date.ToShortTimeString() + ")", dl.Version.ToString()));
|
||||||
}
|
}
|
||||||
Button1.Text = ui.Text("actions", "rollback");
|
Button1.Text = ui.Text("actions", "rollback");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Web Form Designer generated code
|
|
||||||
override protected void OnInit(EventArgs e)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
|
||||||
//
|
|
||||||
InitializeComponent();
|
|
||||||
base.OnInit(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected void doRollback_Click(object sender, System.EventArgs e)
|
protected void doRollback_Click(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (allVersions.SelectedValue.Trim() != "") {
|
if (allVersions.SelectedValue.Trim() != "")
|
||||||
|
{
|
||||||
Document d = new Document(int.Parse(helper.Request("nodeId")));
|
Document d = new Document(int.Parse(helper.Request("nodeId")));
|
||||||
d.RollBack(new Guid(allVersions.SelectedValue), base.getUser());
|
d.RollBack(new Guid(allVersions.SelectedValue), base.getUser());
|
||||||
|
|
||||||
@@ -159,6 +147,8 @@ namespace umbraco.presentation.dialogs
|
|||||||
feedBackMsg.Text = ui.Text("rollback", "documentRolledBack", vars, new global::umbraco.BusinessLogic.User(0)) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
feedBackMsg.Text = ui.Text("rollback", "documentRolledBack", vars, new global::umbraco.BusinessLogic.User(0)) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
|
||||||
diffPanel.Visible = false;
|
diffPanel.Visible = false;
|
||||||
pl_buttons.Visible = false;
|
pl_buttons.Visible = false;
|
||||||
|
|
||||||
|
ClientTools.ReloadLocationIfMatched(string.Format("/content/content/edit/{0}", d.Id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ namespace umbraco.BasePages
|
|||||||
public static string ReloadContentFrameUrlIfPathLoaded(string url) {
|
public static string ReloadContentFrameUrlIfPathLoaded(string url) {
|
||||||
return string.Format(ClientMgrScript + ".reloadContentFrameUrlIfPathLoaded('{0}');", url);
|
return string.Format(ClientMgrScript + ".reloadContentFrameUrlIfPathLoaded('{0}');", url);
|
||||||
}
|
}
|
||||||
public static string ReloadLocation { get { return string.Format(ClientMgrScript + ".reloadLocation();"); } }
|
public static string ReloadLocation { get { return ClientMgrScript + ".reloadLocation();"; } }
|
||||||
|
public static string ReloadLocationIfMatched { get { return ClientMgrScript + ".reloadLocation('{0}');"; } }
|
||||||
public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();";
|
public static string ChildNodeCreated = GetMainTree + ".childNodeCreated();";
|
||||||
public static string SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } }
|
public static string SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } }
|
||||||
public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } }
|
public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } }
|
||||||
@@ -278,6 +279,18 @@ namespace umbraco.BasePages
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientTools ReloadLocationIfMatched(string routePath)
|
||||||
|
{
|
||||||
|
RegisterClientScript(string.Format(Scripts.ReloadLocationIfMatched, routePath));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientTools ReloadLocation()
|
||||||
|
{
|
||||||
|
RegisterClientScript(Scripts.ReloadLocation);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When the application searches for a node, it searches for nodes in specific tree types.
|
/// When the application searches for a node, it searches for nodes in specific tree types.
|
||||||
/// If SyncTree is used, it will sync the tree nodes with the active tree type, therefore if
|
/// If SyncTree is used, it will sync the tree nodes with the active tree type, therefore if
|
||||||
|
|||||||
@@ -276,13 +276,12 @@ namespace umbraco.cms.businesslogic
|
|||||||
{
|
{
|
||||||
if (_version == Guid.Empty)
|
if (_version == Guid.Empty)
|
||||||
{
|
{
|
||||||
string sql = "Select versionId from cmsContentVersion where contentID = " + this.Id +
|
var sql = string.Format("SELECT versionId FROM cmsDocument where nodeid={0} AND newest = 1 ORDER BY updateDate desc", this.Id);
|
||||||
" order by id desc ";
|
|
||||||
|
|
||||||
using (var sqlHelper = Application.SqlHelper)
|
using (var sqlHelper = Application.SqlHelper)
|
||||||
using (IRecordsReader dr = sqlHelper.ExecuteReader(sql))
|
using (IRecordsReader dr = sqlHelper.ExecuteReader(sql))
|
||||||
{
|
{
|
||||||
if (!dr.Read())
|
if (dr.Read() == false)
|
||||||
_version = Guid.Empty;
|
_version = Guid.Empty;
|
||||||
else
|
else
|
||||||
_version = dr.GetGuid("versionId");
|
_version = dr.GetGuid("versionId");
|
||||||
|
|||||||
Reference in New Issue
Block a user