Compare commits

...

17 Commits

Author SHA1 Message Date
Sebastiaan Janssen 2461924a89 Merge branch 'master-v76' of https://github.com/umbraco/Umbraco-CMS into master-v76 2017-10-02 13:53:41 +02:00
Sebastiaan Janssen 581f15b172 Manually applying change from U4-10478 7.7.1 HtmlStringUtilities Truncate throws an IndexOutOfRange when input word is shorter than "…" and crash the entire site to 7.6.9 too. 2017-10-01 12:05:40 +02:00
Shannon 33d7598d3c Adding key fallback to list view select functions to fix issue when selecting multiple items with an ID of int.MaxValue 2017-09-29 13:16:53 +10:00
Sebastiaan Janssen 476773fce5 Merge pull request #2224 from umbraco/temp-U4-5222
U4-5222 Rollback Feature fails to update the UI to show the rolled ba…
2017-09-28 20:00:13 +02:00
Sebastiaan Janssen 953355cddd Merge pull request #2222 from umbraco/temp-U4-10364-2
U4-10364 SQL error occurs when we attempt to sort media items by "Cre…
2017-09-28 19:39:19 +02:00
Shannon d2d43255aa U4-5222 Rollback Feature fails to update the UI to show the rolled back content - requires refresh 2017-09-28 02:38:53 +10:00
Shannon b39e218d51 U4-10364 SQL error occurs when we attempt to sort media items by "Created by" column 2017-09-27 23:04:53 +10:00
Sebastiaan Janssen 4b581a2182 Merge pull request #2217 from umbraco/temp-U4-10470
U4-10470 Missing transform for the scripts tree when upgrading
2017-09-27 10:06:08 +02:00
Claus 581eac5369 U4-10470 Missing transform for the scripts tree when upgrading 2017-09-27 10:04:07 +02:00
Sebastiaan Janssen 33cf983cae Bump version 2017-09-25 11:19:36 +02:00
Shannon 3ce6eb09aa Ensures HealthCheckController is authorized to user with developer access
(cherry picked from commit 7c4eb71f07)
2017-09-25 10:48:15 +02:00
Stephan 963015cf4a Fix LocalDb detection on 32/64 bits systems
(cherry picked from commit a239e92bc0)
2017-09-25 10:47:38 +02:00
Sebastiaan Janssen cc35af4eab Merge pull request #2209 from umbraco/temp-deploy-401
deploy-401 - fix id reservations
2017-09-25 10:46:05 +02:00
Stephan 349d89e4d7 deploy-401 - fix id reservations 2017-09-22 13:08:05 +02:00
Sebastiaan Janssen 1b3fc9fb21 Oops! Add -docs for all the log file pipes 2017-09-19 18:37:00 +02:00
Sebastiaan Janssen 2e98651d62 Create the out and tmp folders correctly 2017-09-19 18:16:19 +02:00
Sebastiaan Janssen 704e981284 Always do the node/bower/gulp build to get docs, start with node build first 2017-09-19 18:15:31 +02:00
19 changed files with 229 additions and 130 deletions
@@ -7,45 +7,39 @@ function Build-UmbracoDocs
$src = "$($uenv.SolutionRoot)\src"
$out = "$($uenv.SolutionRoot)\build.out"
$tmp = "$($uenv.SolutionRoot)\build.tmp"
$buildTemp = "$PSScriptRoot\temp"
$cache = 2
Prepare-Build -keep $uenv
################ Do the UI docs
# get a temp clean node env (will restore)
Sandbox-Node $uenv
Write-Host "Executing gulp docs"
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
write "node version is:" > $tmp\belle-docs.log
&node -v >> $tmp\belle-docs.log 2>&1
write "npm version is:" >> $tmp\belle-docs.log 2>&1
&npm -v >> $tmp\belle-docs.log 2>&1
write "executing npm install" >> $tmp\belle-docs.log 2>&1
&npm install >> $tmp\belle-docs.log 2>&1
write "executing bower install" >> $tmp\belle-docs.log 2>&1
&npm install -g bower >> $tmp\belle-docs.log 2>&1
write "installing gulp" >> $tmp\belle-docs.log 2>&1
&npm install -g gulp >> $tmp\belle-docs.log 2>&1
write "installing gulp-cli" >> $tmp\belle-docs.log 2>&1
&npm install -g gulp-cli --quiet >> $tmp\belle-docs.log 2>&1
write "building docs using gulp" >> $tmp\belle-docs.log 2>&1
&gulp docs >> $tmp\belle-docs.log 2>&1
pop-location
# No need to build belle again if it exists
$belleAppJs = "$src\Umbraco.Web.UI\Umbraco\js\app.js"
if(-not (Test-Path $belleAppJs))
{
# get a temp clean node env (will restore)
Sandbox-Node $uenv
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
write "node version is:" > $tmp\belle.log
&node -v >> $tmp\belle.log 2>&1
write "npm version is:" >> $tmp\belle.log 2>&1
&npm -v >> $tmp\belle.log 2>&1
write "cleaning npm cache" >> $tmp\belle.log 2>&1
&npm cache clean >> $tmp\belle.log 2>&1
write "installing bower" >> $tmp\belle.log 2>&1
&npm install -g bower >> $tmp\belle.log 2>&1
write "installing gulp" >> $tmp\belle.log 2>&1
&npm install -g gulp >> $tmp\belle.log 2>&1
write "installing gulp-cli" >> $tmp\belle.log 2>&1
&npm install -g gulp-cli --quiet >> $tmp\belle.log 2>&1
write "executing npm install" >> $tmp\belle.log 2>&1
&npm install >> $tmp\belle.log 2>&1
write "building docs using gulp" >> $tmp\belle.log 2>&1
&gulp docs >> $tmp\belle.log 2>&1
pop-location
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle-docs.log | %{ if ($_ -match "build") { write $_}}
} else {
Write-Host "Skipping belle build, $belleAppJs already exists"
}
Write-Host "Completed gulp docs build"
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle-docs.log | %{ if ($_ -match "build") { write $_}}
# change baseUrl
$baseUrl = "https://our.umbraco.org/apidocs/ui/"
+11 -5
View File
@@ -51,13 +51,19 @@ function Prepare-Build
if (-not $keep)
{
Remove-Directory "$tmp"
mkdir "$tmp" > $null
Remove-Directory "$out"
mkdir "$out" > $null
Remove-Directory "$tmp"
Remove-Directory "$out"
}
if (-not (Test-Path "$tmp"))
{
mkdir "$tmp" > $null
}
if (-not (Test-Path "$out"))
{
mkdir "$out" > $null
}
# ensure proper web.config
$webUi = "$src\Umbraco.Web.UI"
Store-WebConfig $webUi
+1 -1
View File
@@ -43,7 +43,7 @@
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
<add application="settings" alias="scripts" title="Scripts" type="umbraco.loadScripts, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
<add application="settings" alias="scripts" title="Scripts" type="Umbraco.Web.Trees.ScriptTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="settings" alias="dictionary" title="Dictionary" type="umbraco.loadDictionary, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="6"
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.6.8")]
[assembly: AssemblyInformationalVersion("7.6.8")]
[assembly: AssemblyFileVersion("7.6.9")]
[assembly: AssemblyInformationalVersion("7.6.9")]
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.6.8");
private static readonly Version Version = new Version("7.6.9");
/// <summary>
/// Gets the current version of Umbraco.
+22 -9
View File
@@ -24,6 +24,7 @@ namespace Umbraco.Core.Persistence
{
private int _version;
private bool _hasVersion;
private string _exe;
#region Availability & Version
@@ -84,16 +85,31 @@ namespace Umbraco.Core.Persistence
{
_hasVersion = true;
_version = -1;
_exe = null;
var programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
if (programFiles == null) return;
// MS SQL Server installs in e.g. "C:\Program Files\Microsoft SQL Server", so
// we want to detect it in "%ProgramFiles%\Microsoft SQL Server" - however, if
// Umbraco runs as a 32bits process (e.g. IISExpress configured as 32bits)
// on a 64bits system, %ProgramFiles% will point to "C:\Program Files (x86)"
// and SQL Server cannot be found. But then, %ProgramW6432% will point to
// the original "C:\Program Files". Using it to fix the path.
// see also: MSDN doc for WOW64 implementation
//
var programW6432 = Environment.GetEnvironmentVariable("ProgramW6432");
if (string.IsNullOrWhiteSpace(programW6432) == false && programW6432 != programFiles)
programFiles = programW6432;
if (string.IsNullOrWhiteSpace(programFiles)) return;
// detect 14, 13, 12, 11
for (var i = 14; i > 10; i--)
{
var path = Path.Combine(programFiles, string.Format(@"Microsoft SQL Server\{0}0\Tools\Binn\SqlLocalDB.exe", i));
if (File.Exists(path) == false) continue;
var exe = Path.Combine(programFiles, string.Format(@"Microsoft SQL Server\{0}0\Tools\Binn\SqlLocalDB.exe", i));
if (File.Exists(exe) == false) continue;
_version = i;
_exe = exe;
break;
}
}
@@ -897,16 +913,13 @@ namespace Umbraco.Core.Persistence
/// </remarks>
private int ExecuteSqlLocalDb(string args, out string output, out string error)
{
var programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
if (programFiles == null)
if (_exe == null) // should never happen - we should not execute if not available
{
output = string.Empty;
error = "SqlLocalDB.exe not found";
return -1;
}
var path = Path.Combine(programFiles, string.Format(@"Microsoft SQL Server\{0}0\Tools\Binn\SqlLocalDB.exe", _version));
var p = new Process
{
StartInfo =
@@ -914,7 +927,7 @@ namespace Umbraco.Core.Persistence
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
FileName = path,
FileName = _exe,
Arguments = args,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
@@ -929,7 +942,7 @@ namespace Umbraco.Core.Persistence
}
/// <summary>
/// Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.
/// Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.
/// </summary>
/// <param name="name">The name to quote.</param>
/// <param name="quote">A quote character.</param>
@@ -705,8 +705,8 @@ ORDER BY contentNodeId, versionId, propertytypeid
case "NAME":
return "umbracoNode.text";
case "PUBLISHED":
case "OWNER":
return "cmsDocument.published";
case "OWNER":
//TODO: This isn't going to work very nicely because it's going to order by ID, not by letter
return "umbracoNode.nodeUser";
// Members only
+6 -6
View File
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Services
{
private readonly IDatabaseUnitOfWorkProvider _uowProvider;
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
private readonly Dictionary<int, TypedId<Guid>> _id2Key = new Dictionary<int, TypedId<Guid>>();
private readonly Dictionary<Guid, TypedId<int>> _key2Id = new Dictionary<Guid, TypedId<int>>();
@@ -39,8 +39,8 @@ namespace Umbraco.Core.Services
int? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND nodeObjectType=@nodeObjectType",
new { id = key, nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType) });
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
uow.Commit();
}
@@ -92,8 +92,8 @@ namespace Umbraco.Core.Services
Guid? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND nodeObjectType=@nodeObjectType",
new { id, nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType) });
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)",
new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservationGuid });
uow.Commit();
}
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Services
{
private readonly T _id;
private readonly UmbracoObjectTypes _umbracoObjectType;
public T Id
{
get { return _id; }
@@ -26,15 +26,15 @@ namespace Umbraco.Tests.Services
public override void TearDown()
{
base.TearDown();
}
}
[Test]
public void EntityService_Can_Get_Paged_Content_Children()
{
var contentType = ServiceContext.ContentTypeService.GetContentType("umbTextpage");
var root = MockedContent.CreateSimpleContent(contentType);
var root = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(root);
for (int i = 0; i < 10; i++)
{
@@ -45,7 +45,7 @@ namespace Umbraco.Tests.Services
var service = ServiceContext.EntityService;
long total;
var entities = service.GetPagedChildren(root.Id, UmbracoObjectTypes.Document, 0, 6, out total).ToArray();
var entities = service.GetPagedChildren(root.Id, UmbracoObjectTypes.Document, 0, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(6));
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(root.Id, UmbracoObjectTypes.Document, 1, 6, out total).ToArray();
@@ -72,7 +72,7 @@ namespace Umbraco.Tests.Services
var c2 = MockedContent.CreateSimpleContent(contentType, Guid.NewGuid().ToString(), c1);
ServiceContext.ContentService.Save(c2);
count++;
}
}
}
var service = ServiceContext.EntityService;
@@ -181,7 +181,7 @@ namespace Umbraco.Tests.Services
var root = MockedContent.CreateSimpleContent(contentType);
ServiceContext.ContentService.Save(root);
for (int i = 0; i < 10; i++)
{
var c1 = MockedContent.CreateSimpleContent(contentType, "ssss" + Guid.NewGuid(), root);
@@ -204,7 +204,7 @@ namespace Umbraco.Tests.Services
Assert.That(entities.Length, Is.EqualTo(50));
Assert.That(total, Is.EqualTo(50));
}
[Test]
public void EntityService_Can_Get_Paged_Media_Children()
{
@@ -227,7 +227,7 @@ namespace Umbraco.Tests.Services
Assert.That(total, Is.EqualTo(10));
entities = service.GetPagedChildren(root.Id, UmbracoObjectTypes.Media, 1, 6, out total).ToArray();
Assert.That(entities.Length, Is.EqualTo(4));
Assert.That(total, Is.EqualTo(10));
Assert.That(total, Is.EqualTo(10));
}
[Test]
@@ -362,7 +362,7 @@ namespace Umbraco.Tests.Services
var root = MockedMedia.CreateMediaFolder(folderType, -1);
ServiceContext.MediaService.Save(root);
for (int i = 0; i < 10; i++)
{
var c1 = MockedMedia.CreateMediaImage(imageMediaType, root.Id);
@@ -519,7 +519,7 @@ namespace Umbraco.Tests.Services
Assert.That(
entities.Any(
x =>
x.AdditionalData.Any(y => y.Value is UmbracoEntity.EntityProperty
x.AdditionalData.Any(y => y.Value is UmbracoEntity.EntityProperty
&& ((UmbracoEntity.EntityProperty)y.Value).PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias)), Is.True);
}
@@ -575,6 +575,30 @@ namespace Umbraco.Tests.Services
Assert.IsFalse(result2.Success);
}
[Test]
public void ReserveId()
{
var service = ServiceContext.EntityService;
var guid = Guid.NewGuid();
// can reserve
var reservedId = service.ReserveId(guid);
Assert.IsTrue(reservedId > 0);
// can get it back
var id = service.GetIdForKey(guid, UmbracoObjectTypes.DocumentType);
Assert.IsTrue(id.Success);
Assert.AreEqual(reservedId, id.Result);
// anything goes
id = service.GetIdForKey(guid, UmbracoObjectTypes.Media);
Assert.IsTrue(id.Success);
Assert.AreEqual(reservedId, id.Result);
// a random guid won't work
Assert.IsFalse(service.GetIdForKey(Guid.NewGuid(), UmbracoObjectTypes.DocumentType).Success);
}
private static bool _isSetup = false;
private int folderId;
@@ -589,7 +613,7 @@ namespace Umbraco.Tests.Services
//Create and Save folder-Media -> 1050
var folderMediaType = ServiceContext.ContentTypeService.GetMediaType(1031);
var folder = MockedMedia.CreateMediaFolder(folderMediaType, -1);
var folder = MockedMedia.CreateMediaFolder(folderMediaType, -1);
ServiceContext.MediaService.Save(folder, 0);
folderId = folder.Id;
@@ -607,9 +631,9 @@ namespace Umbraco.Tests.Services
ServiceContext.MediaService.Save(subfolder, 0);
var subfolder2 = MockedMedia.CreateMediaFolder(folderMediaType, subfolder.Id);
ServiceContext.MediaService.Save(subfolder2, 0);
}
}
}
}
@@ -22,5 +22,38 @@ namespace Umbraco.Tests.Web.Mvc
var expected = "<div><h1>hello world</h1><p>hello world<br />hello world<br />hello world<br />hello world</p></div>";
Assert.AreEqual(expected, output);
}
[Test]
public void TruncateWithElipsis()
{
var output = _htmlStringUtilities.Truncate("hello world", 5, true, false).ToString();
var expected = "hello&hellip;";
Assert.AreEqual(expected, output);
}
[Test]
public void TruncateWithoutElipsis()
{
var output = _htmlStringUtilities.Truncate("hello world", 5, false, false).ToString();
var expected = "hello";
Assert.AreEqual(expected, output);
}
[Test]
public void TruncateShorterWordThanHellip()
{
//http://issues.umbraco.org/issue/U4-10478
var output = _htmlStringUtilities.Truncate("hi", 5, true, false).ToString();
var expected = "hi";
Assert.AreEqual(expected, output);
}
[Test]
public void TruncateAndRemoveSpaceBetweenHellipAndWord()
{
var output = _htmlStringUtilities.Truncate("hello world", 6 /* hello plus space */, true, false).ToString();
var expected = "hello&hellip;";
Assert.AreEqual(expected, output);
}
}
}
@@ -361,11 +361,29 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
rootScope : function(){
return getRootScope();
},
reloadLocation: function() {
var injector = getRootInjector();
var $route = injector.get("$route");
$route.reload();
/**
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 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");
$route.reload();
var $rootScope = injector.get("$rootScope");
$rootScope.$apply();
}
},
closeModalWindow: function(rVal) {
@@ -269,7 +269,8 @@
var isSelected = false;
for (var i = 0; selection.length > i; i++) {
var selectedItem = selection[i];
if (item.id === selectedItem.id || item.key === selectedItem.key) {
// if item.id is 2147483647 (int.MaxValue) use item.key
if ((item.id !== 2147483647 && item.id === selectedItem.id) || item.key === selectedItem.key) {
isSelected = true;
}
}
@@ -294,7 +295,8 @@
function deselectItem(item, selection) {
for (var i = 0; selection.length > i; i++) {
var selectedItem = selection[i];
if (item.id === selectedItem.id) {
// if item.id is 2147483647 (int.MaxValue) use item.key
if ((item.id !== 2147483647 && item.id === selectedItem.id) || item.key === selectedItem.key) {
selection.splice(i, 1);
item.selected = false;
}
@@ -366,7 +368,7 @@
var item = items[i];
if (checkbox.checked) {
selection.push({ id: item.id });
selection.push({ id: item.id, key: item.key });
} else {
clearSelection = true;
}
@@ -405,7 +407,8 @@
for (var selectedIndex = 0; selection.length > selectedIndex; selectedIndex++) {
var selectedItem = selection[selectedIndex];
if (item.id === selectedItem.id) {
// if item.id is 2147483647 (int.MaxValue) use item.key
if ((item.id !== 2147483647 && item.id === selectedItem.id) || item.key === selectedItem.key) {
numberOfSelectedItem++;
}
}
+2 -2
View File
@@ -2379,9 +2379,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7680</DevelopmentServerPort>
<DevelopmentServerPort>7690</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7680</IISUrl>
<IISUrl>http://localhost:7690</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
@@ -172,9 +172,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
},
reloadLocation: function () {
reloadLocation: function (pathToMatch) {
if (this.mainWindow().UmbClientMgr) {
this.mainWindow().UmbClientMgr.reloadLocation();
this.mainWindow().UmbClientMgr.reloadLocation(pathToMatch);
}
},
@@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Umbraco.Web.Editors;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.HealthCheck
{
/// <summary>
/// The API controller used to display the health check info and execute any actions
/// </summary>
[UmbracoApplicationAuthorize(Core.Constants.Applications.Developer)]
public class HealthCheckController : UmbracoAuthorizedJsonController
{
private readonly IHealthCheckResolver _healthCheckResolver;
+6 -2
View File
@@ -92,6 +92,7 @@ namespace Umbraco.Web
using (var outputms = new MemoryStream())
{
bool lengthReached = false;
using (var outputtw = new StreamWriter(outputms))
{
using (var ms = new MemoryStream())
@@ -106,7 +107,6 @@ namespace Umbraco.Web
using (TextReader tr = new StreamReader(ms))
{
bool isInsideElement = false,
lengthReached = false,
insideTagSpaceEncountered = false,
isTagClose = false;
@@ -254,10 +254,14 @@ namespace Umbraco.Web
//Check to see if there is an empty char between the hellip and the output string
//if there is, remove it
if (string.IsNullOrWhiteSpace(firstTrim) == false)
if (addElipsis && lengthReached && string.IsNullOrWhiteSpace(firstTrim) == false)
{
result = firstTrim[firstTrim.Length - hellip.Length - 1] == ' ' ? firstTrim.Remove(firstTrim.Length - hellip.Length - 1, 1) : firstTrim;
}
else
{
result = firstTrim;
}
return new HtmlString(result);
}
}
@@ -3,6 +3,7 @@ using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
@@ -117,36 +118,23 @@ namespace umbraco.presentation.dialogs
if (!IsPostBack) {
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()));
}
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)
{
if (allVersions.SelectedValue.Trim() != "") {
if (allVersions.SelectedValue.Trim() != "")
{
Document d = new Document(int.Parse(helper.Request("nodeId")));
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>";
diffPanel.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) {
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 SyncTree { get { return GetMainTree + ".syncTree('{0}', {1});"; } }
public static string ClearTreeCache { get { return GetMainTree + ".clearTreeCache();"; } }
@@ -277,21 +278,33 @@ namespace umbraco.BasePages
RegisterClientScript(string.Format(Scripts.ReloadActionNode, (!reselect).ToString().ToLower(), (!reloadChildren).ToString().ToLower()));
return this;
}
/// <summary>
/// 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
/// a developer wants to sync a specific tree, they can call this method to set the type to sync.
/// </summary>
/// <remarks>
/// Each branch of a particular tree should theoretically be the same type, however, developers can
/// override the type of each branch in their BaseTree's but this is not standard practice. If there
/// are multiple types of branches in one tree, then only those branches that have the Active tree type
/// will be searched for syncing.
/// </remarks>
/// <param name="treeType"></param>
/// <returns></returns>
public ClientTools SetActiveTreeType(string treeType)
public ClientTools ReloadLocationIfMatched(string routePath)
{
RegisterClientScript(string.Format(Scripts.ReloadLocationIfMatched, routePath));
return this;
}
public ClientTools ReloadLocation()
{
RegisterClientScript(Scripts.ReloadLocation);
return this;
}
/// <summary>
/// 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
/// a developer wants to sync a specific tree, they can call this method to set the type to sync.
/// </summary>
/// <remarks>
/// Each branch of a particular tree should theoretically be the same type, however, developers can
/// override the type of each branch in their BaseTree's but this is not standard practice. If there
/// are multiple types of branches in one tree, then only those branches that have the Active tree type
/// will be searched for syncing.
/// </remarks>
/// <param name="treeType"></param>
/// <returns></returns>
public ClientTools SetActiveTreeType(string treeType)
{
RegisterClientScript(string.Format(Scripts.SetActiveTreeType, treeType));
return this;
+3 -4
View File
@@ -276,13 +276,12 @@ namespace umbraco.cms.businesslogic
{
if (_version == Guid.Empty)
{
string sql = "Select versionId from cmsContentVersion where contentID = " + this.Id +
" order by id desc ";
var sql = string.Format("SELECT versionId FROM cmsDocument where nodeid={0} AND newest = 1 ORDER BY updateDate desc", this.Id);
using (var sqlHelper = Application.SqlHelper)
using (IRecordsReader dr = sqlHelper.ExecuteReader(sql))
{
if (!dr.Read())
if (dr.Read() == false)
_version = Guid.Empty;
else
_version = dr.GetGuid("versionId");