- 2. Connection details: Please fill out the connection information for your database.
+ 2. Connection details: Please fill out the connection information for your database.
diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
index 15a3f1d3e2..8c808b3956 100644
--- a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
@@ -324,7 +324,7 @@
- /Create/PartialView.ascx
+ /Create/PartialView.ascx
@@ -334,8 +334,8 @@
/Create/PartialViewMacro.ascx
-
-
+
+
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
index f042148b92..ade3988213 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
@@ -77,13 +77,13 @@
Om siden
- Alternativ link
+ Alias
(hvordan ville du f.eks. beskrive billedet via telefonen?)
Alternative links
Klik på musen for at redigere dette punkt
Oprettet af
Oprettet den
- Dokumenttype
+ Dokumenttype
Redigerer
Nedtagningsdato
Dette punkt er ændret siden udgivelsen
@@ -168,7 +168,7 @@
Vælg et placeholder id Ved at sætte et id på en placeholder kan du indskyde indhold fra undertemplates ved at referere til dette ID vha. et <asp:content /> element.]]>
Vælg et placeholder id fra listen herunder. Du kan kun vælge id'er fra den nuværende masterskabelon.]]>
Klik på billedet for at se den fulde størrelse
- Vælg punkt
+ Vælg
Se Cache Item
@@ -751,4 +751,4 @@ Mange hilsner fra umbraco robotten
Bruger typer
Forfatter
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs
index 077d60c87f..8ed79da349 100644
--- a/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs
+++ b/src/Umbraco.Web.UI/umbraco/create/PartialViewMacro.ascx.cs
@@ -21,18 +21,19 @@ namespace Umbraco.Web.UI.Umbraco.Create
private static void LoadTemplates(ListControl list)
{
- var path = IOHelper.MapPath(SystemDirectories.Umbraco + "/partialviewmacros/templates/");
+ var path = IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViewMacros/Templates/");
list.Items.Clear();
- // always add the option of an empty one
- list.Items.Add(new ListItem("Empty template", "EmptyTemplate.cshtml"));
+ // always add the options of empty templates
+ list.Items.Add(new ListItem("Empty Template", "EmptyTemplate.cshtml"));
+ list.Items.Add(new ListItem("Empty Template (For Use With Custom Views)", "EmptyTemplate (ForUseWithCustomViews).cshtml"));
if (System.IO.Directory.Exists(path))
{
const string extension = ".cshtml";
//Already adding Empty Template as the first item, so don't add it again
- foreach (var fileInfo in new System.IO.DirectoryInfo(path).GetFiles("*" + extension).Where(f => f.Name != "EmptyTemplate.cshtml"))
+ foreach (var fileInfo in new System.IO.DirectoryInfo(path).GetFiles("*" + extension).Where(f => f.Name.StartsWith("EmptyTemplate") == false))
{
var filename = System.IO.Path.GetFileName(fileInfo.FullName);
@@ -52,8 +53,7 @@ namespace Umbraco.Web.UI.Umbraco.Create
var createMacroVal = 0;
if (CreateMacroCheckBox.Checked)
createMacroVal = 1;
-
-
+
string returnUrl = dialogHandler_temp.Create(Request.GetItemAsString("nodeType"),
createMacroVal, //apparently we need to pass this value to 'ParentID'... of course! :P then we'll extract it in PartialViewTasks to create it.
PartialViewTemplate.SelectedValue + "|||" + FileName.Text);
@@ -63,7 +63,6 @@ namespace Umbraco.Web.UI.Umbraco.Create
.ChildNodeCreated()
.CloseModalWindow();
}
-
}
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js b/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js
index ba1cda9a3a..0b3a8e8387 100644
--- a/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js
+++ b/src/Umbraco.Web.UI/umbraco/js/umbracoCheckKeys.js
@@ -32,7 +32,7 @@ function umbracoCheckKeys(e) {
}
function shortcutCheckKeysPressFirefox(e) {
- if (ctrlDown && keycode == 83 && !e.altKey)
+ if (ctrlDown && keycode == 83)
e.preventDefault();
}
@@ -71,22 +71,20 @@ function runShortCuts() {
}
}
if (ctrlDown) {
- try {
- if (keycode == 83)
- doSubmit();
- else if (keycode == 85)
- document.getElementById('TabView1_tab01layer_publish').click();
- else if (!shiftDown && keycode == 9) {
- functionsFrame.tabSwitch(1);
- return false;
- }
- else
- if (shiftDown && keycode == 9) {
- functionsFrame.tabSwitch(-1);
- return false;
- }
- } catch(e) {
- }
+ if (keycode == 83)
+ doSubmit();
+ else if (keycode == 85)
+ document.getElementById('TabView1_tab01layer_publish').click();
+ else if (!shiftDown && keycode == 9) {
+ functionsFrame.tabSwitch(1);
+ return false;
+ }
+ else
+ if (shiftDown && keycode == 9) {
+ functionsFrame.tabSwitch(-1);
+ return false;
+ }
+
}
}
diff --git a/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml b/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml
deleted file mode 100644
index 86cbe66514..0000000000
--- a/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/TwitterFeed.cshtml
+++ /dev/null
@@ -1,217 +0,0 @@
-@inherits umbraco.MacroEngines.DynamicNodeContext
-
-
-@{
- @*
- Macro Parameters To Create
- Show:True Alias:twitterUsername Name:Twitter Username Type:Textstring Defaults to: umbraco
- Show:True Alias:includeRTs Name:Include Retweets Type:Textstring Defaults to: false
- Show:True Alias:excludeReplies Name:Exclude Replies Type:Textstring Defaults to: false
- Show:True Alias:noTweets Name:Number of Tweets Type:Integer Defaults to: 1
- *@
-
- var twitterUsername = String.IsNullOrEmpty(Parameter.twitterUsername) ? "umbraco" : Parameter.twitterUsername;
- var includeRTs = String.IsNullOrEmpty(Parameter.includeRTs) ? false : Parameter.includeRTs;
- var excludeReplies = String.IsNullOrEmpty(Parameter.excludeReplies) ? false : Parameter.excludeReplies;
- var noTweets = String.IsNullOrEmpty(Parameter.noTweets) ? 1 : Parameter.noTweets;
-
-
- @* Twitter JSON URL *@
- var twitterURL = string.Format(
- "https://api.twitter.com/1/statuses/user_timeline.json?screen_name={0}&include_rts={1}&exclude_replies={2}&include_entities=1&count={3}",
- twitterUsername,
- includeRTs,
- excludeReplies,
- noTweets);
-}
-
-
-@* Fetch the JSON from Twitters API *@
-@using (var client = new System.Net.WebClient())
-{
- @* Fetch the JSON from Twitter *@
- var response = client.DownloadString(new Uri(twitterURL));
-
- @* Decode the JSON so we can interate over it *@
- var tweets = Json.Decode(response);
-
-
- @foreach (var tweet in tweets)
- {
- -
- @* Tweet with formatted links *@
-
@formatLinks(tweet.text, tweet.entities)
-
-
- @* Format Tweet Date and ouput as 24/03/12 @14:05 *@
- @formatDate(tweet.created_at).ToString("dd/MM/yy @ HH:mm")
-
-
-
- @* Profile Image *@
-
-
- @* Your real name (not profile name) *@
- @tweet.user.name
-
-
- @* Google Map (if tweet has geo info) *@
- @if (tweet.geo != null)
- {
- @Html.Raw(displayMap(tweet.geo));
- }
-
- @* Dislay Image (if tweet has image attached *@
- @if (tweet.entities.media != null)
- {
-
-
-
- }
-
- }
-
-}
-
-@functions
-{
- DateTime formatDate(string twitterDate)
- {
- //Example tweet date
- //Fri Mar 02 16:09:35 +0000 2012
- //ddd MMM dd HH:mm:ss zz00 yyyy
- DateTime tweetDate = DateTime.ParseExact(twitterDate, "ddd MMM dd HH:mm:ss zz00 yyyy", null);
-
- return tweetDate;
- }
-
- String displayMap(dynamic geo)
- {
- //Get the lat & long values
- var tweetLat = geo.coordinates[0];
- var tweetLong = geo.coordinates[1];
-
- //Format the string to return the image
- var googleMap = string.Format("http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom=14&size=250x250&maptype=roadmap&sensor=false&markers={0}, {1}", tweetLat, tweetLong);
- var mapImage = string.Format("
", googleMap);
-
- return mapImage;
- }
-
- IHtmlString formatLinks(string tweet, dynamic entities)
- {
- //A List of tweet entities so we can sort all of them
- IList tweetEntities = new List();
-
- //Get URLs
- var links = entities.urls;
-
- //Check we have links to loop over
- if (links != null)
- {
- //For each link in the collection of links
- foreach (var link in links)
- {
- var startPosition = link.indices[0];
- var endPosition = link.indices[1];
- var length = endPosition - startPosition;
-
- var url = link.url; //The short t.co link
- var displayURL = link.display_url; //A friendly version of the full link (may be truncated)
-
- var newText = string.Format("{1}", url, displayURL);
- var oldText = tweet.Substring(startPosition, length);
-
-
- //Create a new entity
- tweetEntity entity = new tweetEntity();
- entity.startPosition = startPosition;
- entity.endPosition = endPosition;
- entity.newText = newText;
- entity.oldText = oldText;
-
- //Add it to the collection
- tweetEntities.Add(entity);
- }
- }
-
-
- //Get user mentions (@umbraco)
- var mentions = entities.user_mentions;
-
- //Check we have mentions to loop over
- if (mentions != null)
- {
- //For each mention in the collection of mentions
- foreach (var mention in mentions)
- {
- var startPosition = mention.indices[0];
- var endPosition = mention.indices[1];
- var length = endPosition - startPosition;
-
- var username = mention.screen_name;
-
- var newText = string.Format("@{0}", username);
- var oldText = tweet.Substring(startPosition, length);
-
- //Create a new entity
- tweetEntity entity = new tweetEntity();
- entity.startPosition = startPosition;
- entity.endPosition = endPosition;
- entity.newText = newText;
- entity.oldText = oldText;
-
- //Add to collection
- tweetEntities.Add(entity);
- }
- }
-
- //Get hashtags
- var hashtags = entities.hashtags;
-
- //Check we have hash to loop over
- if (hashtags != null)
- {
- foreach (var hash in hashtags)
- {
- var startPosition = hash.indices[0];
- var endPosition = hash.indices[1];
- var length = endPosition - startPosition;
- var hashtag = hash.text;
-
- var newText = string.Format("#{0}", hashtag);
- var oldText = tweet.Substring(startPosition, length);
-
- //Create a new entity
- tweetEntity entity = new tweetEntity();
- entity.startPosition = startPosition;
- entity.endPosition = endPosition;
- entity.newText = newText;
- entity.oldText = oldText;
-
- //Add to collection
- tweetEntities.Add(entity);
- }
- }
-
- //For each item in the tweet entities in reverse order
- //If we update the string in reverse order the remaining start/end indexs will still be correct
- foreach (var item in tweetEntities.OrderByDescending(x => x.startPosition))
- {
- //Lets update the tweet text
- tweet = tweet.Replace(item.oldText, item.newText);
- }
-
-
- //Return the new tweet with all the links added in
- return Html.Raw(tweet);
- }
-
- public class tweetEntity
- {
- public int startPosition { get; set; }
- public int endPosition { get; set; }
- public string oldText { get; set; }
- public string newText { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js
index 9c9d508bbb..8f0faf2a28 100644
--- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js
+++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js
@@ -36,7 +36,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor");
}
else {
//this is a wrapper for CodeMirror
+ this._editor.focus();
this._editor.setValue(code);
+ this._editor.focus();
}
},
GetSelection: function(code) {
@@ -150,4 +152,3 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor");
return obj;
};
})(jQuery);
-
diff --git a/src/Umbraco.Web/Mvc/RouteDefinition.cs b/src/Umbraco.Web/Mvc/RouteDefinition.cs
index 49ba64fac5..f0334202dd 100644
--- a/src/Umbraco.Web/Mvc/RouteDefinition.cs
+++ b/src/Umbraco.Web/Mvc/RouteDefinition.cs
@@ -11,12 +11,7 @@ namespace Umbraco.Web.Mvc
{
public string ControllerName { get; set; }
public string ActionName { get; set; }
-
- ///
- /// The Controller instance found for routing to
- ///
- public ControllerBase Controller { get; set; }
-
+
///
/// The Controller type found for routing to
///
diff --git a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs
index 649ac54f27..6e7a92ea10 100644
--- a/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoMvcHandler.cs
@@ -1,23 +1,18 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Web;
-using System.Web.Mvc;
+using System.Web.Mvc;
using System.Web.Routing;
namespace Umbraco.Web.Mvc
{
///
- /// Mvc handler class to intercept creation of controller and store it for later use.
- /// This means we create two instances of the same controller to support some features later on.
+ /// MVC handler to facilitate the TemplateRenderer. This handler can execute an MVC request and return it as a string.
///
- /// The alternate option for this is to completely rewrite all MvcHandler methods.
+ /// Original:
///
- /// This is currently needed for the 'return CurrentUmbracoPage()' surface controller functionality
+ /// This handler also used to intercept creation of controllers and store it for later use.
+ /// This was needed for the 'return CurrentUmbracoPage()' surface controller functionality
/// because it needs to send data back to the page controller.
+ ///
+ /// The creation of this controller has been moved to the UmbracoPageResult class which will create a controller when needed.
///
internal class UmbracoMvcHandler : MvcHandler
{
@@ -25,46 +20,13 @@ namespace Umbraco.Web.Mvc
: base(requestContext)
{
}
-
- private void StoreControllerInRouteDefinition()
- {
- var routeDef = (RouteDefinition)RequestContext.RouteData.DataTokens["umbraco-route-def"];
-
- if (routeDef == null) return;
-
- // Get the factory and controller and create a new instance of the controller
- var factory = ControllerBuilder.Current.GetControllerFactory();
- var controller = factory.CreateController(RequestContext, routeDef.ControllerName) as ControllerBase;
-
- // Store the controller
- routeDef.Controller = controller;
- }
-
+
///
/// This is used internally purely to render an Umbraco MVC template to string and shouldn't be used for anything else.
///
internal void ExecuteUmbracoRequest()
{
- StoreControllerInRouteDefinition();
base.ProcessRequest(RequestContext.HttpContext);
}
-
- protected override void ProcessRequest(HttpContextBase httpContext)
- {
- StoreControllerInRouteDefinition();
-
- // Let MVC do its magic and continue the request
- base.ProcessRequest(httpContext);
- }
-
- protected override IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback,
- object state)
- {
- StoreControllerInRouteDefinition();
-
- return base.BeginProcessRequest(httpContext, callback, state);
- }
}
-
-
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs
index 9ae5006d48..f0904c64a4 100644
--- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs
@@ -1,5 +1,6 @@
using System;
using System.Web.Mvc;
+using System.Web.Routing;
using Umbraco.Core;
namespace Umbraco.Web.Mvc
@@ -11,54 +12,113 @@ namespace Umbraco.Web.Mvc
{
public override void ExecuteResult(ControllerContext context)
{
+ ResetRouteData(context.RouteData);
- //since we could be returning the current page from a surface controller posted values in which the routing values are changed, we
- //need to revert these values back to nothing in order for the normal page to render again.
- context.RouteData.DataTokens["area"] = null;
- context.RouteData.DataTokens["Namespaces"] = null;
-
- //validate that the current page execution is not being handled by the normal umbraco routing system
- if (!context.RouteData.DataTokens.ContainsKey("umbraco-route-def"))
- {
- throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name + " in the context of an Http POST when using a SurfaceController form");
- }
+ ValidateRouteData(context.RouteData);
var routeDef = (RouteDefinition)context.RouteData.DataTokens["umbraco-route-def"];
+ var factory = ControllerBuilder.Current.GetControllerFactory();
- var targetController = ((Controller)routeDef.Controller);
- var sourceController = ((Controller) context.Controller);
-
- //ensure the original template is reset
context.RouteData.Values["action"] = routeDef.ActionName;
- //ensure ModelState is copied across
- routeDef.Controller.ViewData.ModelState.Merge(sourceController.ViewData.ModelState);
+ ControllerBase controller = null;
- //ensure TempData and ViewData is copied across
- foreach (var d in sourceController.ViewData)
- routeDef.Controller.ViewData[d.Key] = d.Value;
+ try
+ {
+ controller = CreateController(context, factory, routeDef);
+
+ CopyControllerData(context, controller);
+ ExecuteControllerAction(context, controller);
+ }
+ finally
+ {
+ CleanupController(controller, factory);
+ }
+ }
+
+ ///
+ /// Executes the controller action
+ ///
+ private static void ExecuteControllerAction(ControllerContext context, IController controller)
+ {
+ using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished"))
+ {
+ controller.Execute(context.RequestContext);
+ }
+ }
+
+ ///
+ /// Since we could be returning the current page from a surface controller posted values in which the routing values are changed, we
+ /// need to revert these values back to nothing in order for the normal page to render again.
+ ///
+ private static void ResetRouteData(RouteData routeData)
+ {
+ routeData.DataTokens["area"] = null;
+ routeData.DataTokens["Namespaces"] = null;
+ }
+
+ ///
+ /// Validate that the current page execution is not being handled by the normal umbraco routing system
+ ///
+ private static void ValidateRouteData(RouteData routeData)
+ {
+ if (!routeData.DataTokens.ContainsKey("umbraco-route-def"))
+ {
+ throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name +
+ " in the context of an Http POST when using a SurfaceController form");
+ }
+ }
+
+ ///
+ /// Ensure ModelState, ViewData and TempData is copied across
+ ///
+ private static void CopyControllerData(ControllerContext context, ControllerBase controller)
+ {
+ controller.ViewData.ModelState.Merge(context.Controller.ViewData.ModelState);
+
+ foreach (var d in context.Controller.ViewData)
+ controller.ViewData[d.Key] = d.Value;
//We cannot simply merge the temp data because during controller execution it will attempt to 'load' temp data
// but since it has not been saved, there will be nothing to load and it will revert to nothing, so the trick is
// to Save the state of the temp data first then it will automatically be picked up.
// http://issues.umbraco.org/issue/U4-1339
- targetController.TempDataProvider = sourceController.TempDataProvider;
- targetController.TempData = sourceController.TempData;
- targetController.TempData.Save(sourceController.ControllerContext, sourceController.TempDataProvider);
- using (DisposableTimer.TraceDuration("Executing Umbraco RouteDefinition controller", "Finished"))
- {
- try
- {
- ((IController)targetController).Execute(context.RequestContext);
- }
- finally
- {
- routeDef.Controller.DisposeIfDisposable();
- }
- }
+ var targetController = controller as Controller;
+ var sourceController = context.Controller as Controller;
+ if (targetController != null && sourceController != null)
+ {
+ targetController.TempDataProvider = sourceController.TempDataProvider;
+ targetController.TempData = sourceController.TempData;
+ targetController.TempData.Save(sourceController.ControllerContext, sourceController.TempDataProvider);
+ }
+
+ }
- }
+ ///
+ /// Creates a controller using the controller factory
+ ///
+ private static ControllerBase CreateController(ControllerContext context, IControllerFactory factory, RouteDefinition routeDef)
+ {
+ var controller = factory.CreateController(context.RequestContext, routeDef.ControllerName) as ControllerBase;
+
+ if (controller == null)
+ throw new InvalidOperationException("Could not create controller with name " + routeDef.ControllerName + ".");
+
+ return controller;
+ }
+
+ ///
+ /// Cleans up the controller by releasing it using the controller factory, and by disposing it.
+ ///
+ private static void CleanupController(IController controller, IControllerFactory factory)
+ {
+ if (controller != null)
+ factory.ReleaseController(controller);
+
+ if (controller != null)
+ controller.DisposeIfDisposable();
+ }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs
index 618e656182..3ebf57473e 100644
--- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs
+++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs
@@ -1,5 +1,6 @@
using System;
using System.Text;
+using System.Web;
using System.Web.Mvc;
using System.Web.WebPages;
using Umbraco.Core;
@@ -178,5 +179,10 @@ namespace Umbraco.Web.Mvc
{
return WebViewPageExtensions.RenderSection(this, name, defaultContents);
}
+
+ public HelperResult RenderSection(string name, IHtmlString defaultContents)
+ {
+ return WebViewPageExtensions.RenderSection(this, name, defaultContents);
+ }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 1988830f85..c4b9118b8e 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -584,6 +584,7 @@
ASPXCodeBehind
+
@@ -747,7 +748,7 @@
ASPXCodeBehind
-
+
ASPXCodeBehind
@@ -1826,9 +1827,7 @@
-
- ASPXCodeBehind
-
+
@@ -1916,24 +1915,16 @@
-
- ASPXCodeBehind
-
+
ASPXCodeBehind
-
- ASPXCodeBehind
+
+
-
- ASPXCodeBehind
-
-
- ASPXCodeBehind
-
-
- ASPXCodeBehind
+
+
ASPXCodeBehind
diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs
index bf4ccc3cd2..2c0856893a 100644
--- a/src/Umbraco.Web/UmbracoHelper.cs
+++ b/src/Umbraco.Web/UmbracoHelper.cs
@@ -227,7 +227,7 @@ namespace Umbraco.Web
var contentType = _umbracoContext.HttpContext.Response.ContentType;
var traceIsEnabled = containerPage.Trace.IsEnabled;
containerPage.Trace.IsEnabled = false;
- _umbracoContext.HttpContext.Server.Execute(containerPage, output, false);
+ _umbracoContext.HttpContext.Server.Execute(containerPage, output, true);
containerPage.Trace.IsEnabled = traceIsEnabled;
//reset the content type
_umbracoContext.HttpContext.Response.ContentType = contentType;
diff --git a/src/Umbraco.Web/WebViewPageExtensions.cs b/src/Umbraco.Web/WebViewPageExtensions.cs
index 7d54a01b39..51f811061c 100644
--- a/src/Umbraco.Web/WebViewPageExtensions.cs
+++ b/src/Umbraco.Web/WebViewPageExtensions.cs
@@ -1,4 +1,6 @@
using System;
+using System.Web;
+using System.Web.Mvc;
using System.Web.WebPages;
namespace Umbraco.Web
@@ -19,5 +21,10 @@ namespace Umbraco.Web
{
return webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : new HelperResult(text => text.Write(defaultContents));
}
+
+ public static HelperResult RenderSection(this WebPageBase webPage, string name, IHtmlString defaultContents)
+ {
+ return webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : new HelperResult(text => text.Write(defaultContents));
+ }
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs
new file mode 100644
index 0000000000..ff0a268a44
--- /dev/null
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TranslateTreeNames.cs
@@ -0,0 +1,26 @@
+using System.Linq;
+using umbraco.cms.businesslogic.language;
+
+namespace Umbraco.Web.umbraco.presentation.umbraco.Trees
+{
+ internal class TranslateTreeNames
+ {
+ public static string GetTranslatedName(string originalName)
+ {
+
+ if (originalName.StartsWith("#") == false)
+ return originalName;
+
+ var lang = Language.GetByCultureCode(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
+
+ if (lang != null && global::umbraco.cms.businesslogic.Dictionary.DictionaryItem.hasKey(originalName.Substring(1, originalName.Length - 1)))
+ {
+ var dictionaryItem = new global::umbraco.cms.businesslogic.Dictionary.DictionaryItem(originalName.Substring(1, originalName.Length - 1));
+ if (dictionaryItem != null)
+ return dictionaryItem.Value(lang.id);
+ }
+
+ return "[" + originalName + "]";
+ }
+ }
+}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs
index da2d9a40ba..c955b34320 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMediaTypes.cs
@@ -8,6 +8,7 @@ using umbraco.businesslogic;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
using Umbraco.Core;
+using Umbraco.Web.umbraco.presentation.umbraco.Trees;
namespace umbraco
{
@@ -50,7 +51,7 @@ function openMediaType(id) {
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = mediaType.Id.ToString(CultureInfo.InvariantCulture);
- xNode.Text = mediaType.Name;
+ xNode.Text = TranslateTreeNames.GetTranslatedName(mediaType.Name);
xNode.Action = string.Format("javascript:openMediaType({0});", mediaType.Id);
xNode.Icon = "icon-item-arrangement";
xNode.OpenIcon = "icon-item-arrangement";
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs
index 72b4546f1c..19ad1d945c 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadNodeTypes.cs
@@ -9,6 +9,7 @@ using umbraco.interfaces;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
+using Umbraco.Web.umbraco.presentation.umbraco.Trees;
namespace umbraco
@@ -21,8 +22,8 @@ namespace umbraco
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
- rootNode.NodeType = "init" + TreeAlias;
- rootNode.NodeID = "init";
+ rootNode.NodeType = "init" + TreeAlias;
+ rootNode.NodeID = "init";
}
protected override void CreateRootNodeActions(ref List actions)
@@ -67,7 +68,7 @@ function openNodeType(id) {
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = docType.Id.ToString(CultureInfo.InvariantCulture);
- xNode.Text = docType.Name;
+ xNode.Text = TranslateTreeNames.GetTranslatedName(docType.Name);
xNode.Action = "javascript:openNodeType(" + docType.Id + ");";
xNode.Icon = "icon-item-arrangement";
xNode.OpenIcon = "icon-item-arrangement";
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs
deleted file mode 100644
index 515abb59d5..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MacroPartialViewTasks.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.IO;
-using Umbraco.Core.CodeAnnotations;
-using Umbraco.Web.Macros;
-
-namespace umbraco
-{
- [UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")]
- public class MacroPartialViewTasks : PartialViewTasks
- {
- protected override string ParentFolderName
- {
- get { return "MacroPartials"; }
- }
-
- protected override void WriteTemplateHeader(StreamWriter sw)
- {
- //write out the template header
- sw.Write("@inherits ");
- sw.Write(typeof(PartialViewMacroPage).FullName);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs
new file mode 100644
index 0000000000..f939ba51a9
--- /dev/null
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs
@@ -0,0 +1,123 @@
+using System.IO;
+using System.Web;
+using Umbraco.Core.CodeAnnotations;
+using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
+using Umbraco.Web.Mvc;
+using umbraco.BasePages;
+using Umbraco.Core;
+
+namespace umbraco
+{
+ ///
+ /// The UI 'tasks' for the create dialog and delete processes
+ ///
+ [UmbracoWillObsolete("http://issues.umbraco.org/issue/U4-1373", "This will one day be removed when we overhaul the create process")]
+ public class PartialViewMacroTasks : interfaces.ITaskReturnUrl
+ {
+ private string _alias;
+ private int _parentId;
+ private int _typeId;
+ private int _userId;
+
+ protected virtual string EditViewFile
+ {
+ get { return "Settings/Views/EditView.aspx"; }
+ }
+
+ protected string BasePath
+ {
+ get { return SystemDirectories.MvcViews + "/" + ParentFolderName.EnsureEndsWith('/'); }
+ }
+
+ protected virtual string ParentFolderName
+ {
+ get { return "MacroPartials"; }
+ }
+
+ public int UserId
+ {
+ set { _userId = value; }
+ }
+ public int TypeID
+ {
+ set { _typeId = value; }
+ get { return _typeId; }
+ }
+
+
+ public string Alias
+ {
+ set { _alias = value; }
+ get { return _alias; }
+ }
+
+ public int ParentID
+ {
+ set { _parentId = value; }
+ get { return _parentId; }
+ }
+
+ public bool Save()
+ {
+ var pipesIndex = _alias.IndexOf("|||", System.StringComparison.Ordinal);
+ var template = _alias.Substring(0, pipesIndex).Trim();
+ var fileName = _alias.Substring(pipesIndex + 3, _alias.Length - pipesIndex - 3) + ".cshtml";
+
+ var fullFilePath = IOHelper.MapPath(BasePath + fileName);
+
+ //return the link to edit the file if it already exists
+ if (File.Exists(fullFilePath))
+ {
+ _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName));
+ return true;
+ }
+
+ //create the file
+ using (var sw = File.CreateText(fullFilePath))
+ {
+ using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViewMacros/Templates/" + template)))
+ {
+ var templateContent = templateFile.ReadToEnd();
+ sw.Write(templateContent);
+ }
+ }
+
+ // Create macro?
+ if (ParentID == 1)
+ {
+ var name = fileName
+ .Substring(0, (fileName.LastIndexOf('.') + 1)).Trim('.')
+ .SplitPascalCasing().ToFirstUpperInvariant();
+ var m = cms.businesslogic.macro.Macro.MakeNew(name);
+ m.ScriptingFile = BasePath + fileName;
+ }
+
+ _returnUrl = string.Format(EditViewFile + "?file={0}", HttpUtility.UrlEncode(ParentFolderName.EnsureEndsWith('/') + fileName));
+ return true;
+ }
+
+ public bool Delete()
+ {
+ var path = IOHelper.MapPath(BasePath + _alias.TrimStart('/'));
+
+ if (File.Exists(path))
+ File.Delete(path);
+ else if (Directory.Exists(path))
+ Directory.Delete(path, true);
+
+ LogHelper.Info(string.Format("{0} Deleted by user {1}", _alias, UmbracoEnsuredPage.CurrentUser.Id));
+
+ return true;
+ }
+
+ #region ITaskReturnUrl Members
+ private string _returnUrl = "";
+ public string ReturnUrl
+ {
+ get { return _returnUrl; }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs
index fd3218a758..e410183344 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs
@@ -52,7 +52,7 @@ namespace umbraco
//create the file
using (var sw = File.CreateText(fullFilePath))
{
- using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/partialviews/templates/" + template)))
+ using (var templateFile = File.OpenText(IOHelper.MapPath(SystemDirectories.Umbraco + "/PartialViews/Templates/" + template)))
{
var templateContent = templateFile.ReadToEnd();
sw.Write(templateContent);
@@ -73,13 +73,6 @@ namespace umbraco
return true;
}
- protected virtual void WriteTemplateHeader(StreamWriter sw)
- {
- //write out the template header
- sw.Write("@inherits ");
- sw.Write(typeof(UmbracoTemplatePage).FullName.TrimEnd("`1"));
- }
-
public override bool PerformDelete()
{
var path = IOHelper.MapPath(BasePath + Alias.TrimStart('/'));
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs
index cba44bc41e..0b8137434e 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs
@@ -71,16 +71,19 @@ namespace umbraco.presentation.dialogs
}
else
{
- var operation = criteria.Field("__nodeName", txt.MultipleCharacterWildcard());
+ var words = txt.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.ToLower().MultipleCharacterWildcard()).ToList();
+ var operation = criteria.GroupedOr(new[] { "__nodeName" }, new[] { words[0] });
+ words.RemoveAt(0);
+ foreach (var word in words)
+ operation = operation.And().GroupedOr(new[] { "__nodeName" }, new[] { word });
// ensure the user can only find nodes they are allowed to see
- if (CurrentUser.StartNodeId > 0)
+ if (UmbracoContext.Current.UmbracoUser.StartNodeId > 0)
{
- operation = operation.And().Id(CurrentUser.StartNodeId);
+ operation = operation.And().Id(UmbracoContext.Current.UmbracoUser.StartNodeId);
}
results = internalSearcher.Search(operation.Compile());
-
}
nothingFound.Visible = !results.Any();
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs
index fe3fb9b0f7..94413d2fd2 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs
@@ -64,7 +64,7 @@ namespace umbraco.cms.presentation.members
}
handled = true;
}
- setupExtraEditorControls();
+
return handled;
}
private void setupExtraEditorControls(){
diff --git a/src/umbraco.sln b/src/umbraco.sln
index d601679578..52550c6365 100644
--- a/src/umbraco.sln
+++ b/src/umbraco.sln
@@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+# Visual Studio 2013
+VisualStudioVersion = 12.0.20827.3
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}"
ProjectSection(SolutionItems) = preProject
..\build\Build.bat = ..\build\Build.bat
@@ -14,6 +16,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-1
..\docs\README.txt = ..\docs\README.txt
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B5BD12C1-A454-435E-8A46-FF4A364C0382}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{66AB0414-D4F2-435C-9868-E25B6865D9A9}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UmbracoExamine Libraries", "UmbracoExamine Libraries", "{DD32977B-EF54-475B-9A1B-B97A502C6E58}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}"
+ ProjectSection(SolutionItems) = preProject
+ ..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec
+ ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec
+ EndProjectSection
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.Web.UI\Umbraco.Web.UI.csproj", "{4C4C194C-B5E4-4991-8F87-4373E24CC19F}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Umbraco.Web.UI.Client", "http://localhost:3961", "{3819A550-DCEC-4153-91B4-8BA9F7F0B9B4}"
@@ -58,35 +77,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlCE4Umbraco", "SQLCE4Umbr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "umbraco.MacroEngines", "umbraco.MacroEngines\umbraco.MacroEngines.csproj", "{89C09045-1064-466B-B94A-DB3AFE2A5853}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B5BD12C1-A454-435E-8A46-FF4A364C0382}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Core", "Umbraco.Core\Umbraco.Core.csproj", "{31785BC3-256C-4613-B2F5-A1B0BDDED8C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests", "Umbraco.Tests\Umbraco.Tests.csproj", "{5D3B8245-ADA6-453F-A008-50ED04BFE770}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{66AB0414-D4F2-435C-9868-E25B6865D9A9}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.Config = .nuget\NuGet.Config
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine", "UmbracoExamine\UmbracoExamine.csproj", "{07FBC26B-2927-4A22-8D96-D644C667FECC}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UmbracoExamine Libraries", "UmbracoExamine Libraries", "{DD32977B-EF54-475B-9A1B-B97A502C6E58}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.PDF", "UmbracoExamine.PDF\UmbracoExamine.PDF.csproj", "{F30DDDB8-3994-4673-82AE-057123C6E1A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.Azure", "UmbracoExamine.Azure\UmbracoExamine.Azure.csproj", "{73529637-28F5-419C-A6BB-D094E39DE614}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UmbracoExamine.PDF.Azure", "UmbracoExamine.PDF.Azure\UmbracoExamine.PDF.Azure.csproj", "{B555AAE6-0F56-442F-AC9F-EF497DB38DE7}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}"
- ProjectSection(SolutionItems) = preProject
- ..\build\NuSpecs\UmbracoCms.Core.nuspec = ..\build\NuSpecs\UmbracoCms.Core.nuspec
- ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU