Converted Umbraco.aspx, TreeInit.aspx to have proper web forms classes and obsoletes old ones.

Obsoletes umbWindow class as its not used in the codebase whatsoever.
This commit is contained in:
Shannon Deminick
2013-02-05 05:43:38 +06:00
parent db79b95d22
commit f726ec740a
11 changed files with 518 additions and 15 deletions

View File

@@ -419,7 +419,7 @@
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Umbraco\Umbraco.aspx.designer.cs">
<DependentUpon>Umbraco.aspx</DependentUpon>
<DependentUpon>umbraco.aspx</DependentUpon>
</Compile>
<Content Include="Config\Splashes\booting.aspx" />
<Content Include="Config\Splashes\noNodes.aspx" />

View File

@@ -2,10 +2,20 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.presentation.Trees;
namespace Umbraco.Web.UI.Umbraco
{
public partial class TreeInit : global::umbraco.cms.presentation.TreeInit
[Obsolete("Used the TreeControl control instead. This does however get used by the TreeService when requesting the tree init url.")]
public partial class TreeInit : Pages.UmbracoEnsuredPage
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService();
DataBind();
}
protected TreeService TreeParams { get; private set; }
}
}

View File

@@ -11,5 +11,59 @@ namespace Umbraco.Web.UI.Umbraco {
public partial class TreeInit {
/// <summary>
/// Head1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
/// <summary>
/// ClientLoader control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader;
/// <summary>
/// CssInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// ScriptManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.ScriptManager ScriptManager1;
/// <summary>
/// JTree control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.controls.Tree.TreeControl JTree;
}
}

View File

@@ -1,11 +1,185 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using Umbraco.Core.IO;
using umbraco;
namespace Umbraco.Web.UI.Umbraco
{
public partial class Umbraco : global::umbraco.cms.presentation._umbraco
{
public partial class UmbracoMainPage : Pages.UmbracoEnsuredPage
{
public string DefaultApp { get; private set; }
protected void Page_Load(object sender, System.EventArgs e)
{
var apps = GetUser().Applications.ToList();
bool userHasAccesstodefaultApp = apps.Any(x => x.alias == "content");
// Load user module icons ..
if (apps.Count() > 1)
{
var jsEvents = new StringBuilder();
PlaceHolderAppIcons.Text = ui.Text("main", "sections", GetUser());
plcIcons.Text = "";
foreach (global::umbraco.BusinessLogic.Application a in apps.OrderBy(x => x.sortOrder))
{
string appClass = a.icon.StartsWith(".") ? a.icon.Substring(1, a.icon.Length - 1) : a.alias;
//adds client side event handlers to the icon buttons
jsEvents.Append(@"jQuery('." + appClass + "').click(function() { appClick.call(this, '" + a.alias + "'); } );");
jsEvents.Append(@"jQuery('." + appClass + "').dblclick(function() { appDblClick.call(this, '" + a.alias + "'); } );");
string iconElement = String.Format("<li><a class=\"{0}\" title=\"" + ui.Text("sections", a.alias, GetUser()) + "\" href=\"javascript:void(0);\">", appClass);
if (a.icon.StartsWith("."))
iconElement +=
"<img src=\"images/nada.gif\" class=\"trayHolder\" alt=\"\" /></a></li>";
else
iconElement += "<img src=\"images/tray/" + a.icon + "\" class=\"trayIcon\" alt=\"" + ui.Text("sections", a.alias, GetUser()) + "\"></a></li>";
plcIcons.Text += iconElement;
}
//registers the jquery event handlers.
Page.ClientScript.RegisterStartupScript(this.GetType(), "AppIcons", "jQuery(document).ready(function() { " + jsEvents.ToString() + " } );", true);
}
else
PlaceHolderAppIcons.Visible = false;
//if user does not have access to content (ie, he's probably a translator)...
//then change the default tree app
if (!userHasAccesstodefaultApp)
{
JTree.App = apps[0].alias;
DefaultApp = apps[0].alias;
}
else
{
DefaultApp = "content";
}
// Load globalized labels
treeWindow.Text = ui.Text("main", "tree", GetUser());
RenderActionJs();
// Version check goes here!
// zb-00004 #29956 : refactor cookies names & handling
var updChkCookie = new global::umbraco.BusinessLogic.StateHelper.Cookies.Cookie("UMB_UPDCHK", GlobalSettings.VersionCheckPeriod); // was "updateCheck"
string updateCheckCookie = updChkCookie.HasValue ? updChkCookie.GetValue() : "";
if (GlobalSettings.VersionCheckPeriod > 0 && String.IsNullOrEmpty(updateCheckCookie) && GetUser().UserType.Alias == "admin")
{
// Add scriptmanager version check
ScriptManager sm = ScriptManager.GetCurrent(Page);
sm.Scripts.Add(new ScriptReference(SystemDirectories.Umbraco + "/js/umbracoUpgradeChecker.js"));
sm.Services.Add(new ServiceReference(SystemDirectories.WebServices + "/CheckForUpgrade.asmx"));
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "upgradeChecker", "jQuery(document).ready(function() {umbraco.presentation.webservices.CheckForUpgrade.CallUpgradeService(umbracoCheckUpgrade);});", true);
updChkCookie.SetValue("1");
}
DataBind();
AddIe9Meta();
}
private void AddIe9Meta()
{
if (Request.Browser.Browser == "IE" && Request.Browser.MajorVersion == 9)
{
var metadata = new StringBuilder();
metadata.AppendFormat(
@"<link rel='icon' href='{0}' type='image/x-icon'>
<link rel='shortcut icon' href='{0}' type='image/x-icon'>
<meta name='application-name' content='Umbraco CMS - {1}' />
<meta name='msapplication-tooltip' content='Umbraco CMS - {1}' />
<meta name='msapplication-navbutton-color' content='#f36f21' />
<meta name='msapplication-starturl' content='./umbraco.aspx' />",
IOHelper.ResolveUrl(SystemDirectories.Umbraco + "/images/pinnedIcons/umb.ico"),
HttpContext.Current.Request.Url.Host.ToLower().Replace("www.", ""));
var user = GetUser();
if (user != null && user.Applications != null && user.Applications.Length > 0)
{
foreach (var app in user.Applications)
{
metadata.AppendFormat(
@"<meta name='msapplication-task' content='name={0}; action-uri={1}; icon-uri={2}' />",
ui.Text("sections", app.alias, user),
IOHelper.ResolveUrl(string.Format("{0}/umbraco.aspx#{1}", SystemDirectories.Umbraco, app.alias)),
File.Exists(
IOHelper.MapPath(
IOHelper.ResolveUrl(
string.Format("{0}/images/pinnedIcons/task_{1}.ico", SystemDirectories.Umbraco, app.alias))))
? "/umbraco/images/pinnedIcons/task_" + app.alias + ".ico"
: "/umbraco/images/pinnedIcons/task_default.ico");
}
}
this.Header.Controls.Add(new LiteralControl(metadata.ToString()));
}
}
/// <summary>
/// Renders out all JavaScript references that have bee declared in IActions
/// </summary>
private void RenderActionJs()
{
var item = 0;
foreach (var jsFile in global::umbraco.BusinessLogic.Actions.Action.GetJavaScriptFileReferences())
{
//validate that this is a url, if it is not, we'll assume that it is a text block and render it as a text
//block instead.
var isValid = true;
try
{
var jsUrl = new Uri(jsFile, UriKind.RelativeOrAbsolute);
//ok it validates, but so does alert('hello'); ! so we need to do more checks
//here are the valid chars in a url without escaping
if (Regex.IsMatch(jsFile, @"[^a-zA-Z0-9-._~:/?#\[\]@!$&'\(\)*\+,%;=]"))
isValid = false;
//we'll have to be smarter and just check for certain js patterns now too!
var jsPatterns = new string[] { @"\+\s*\=", @"\);", @"function\s*\(", @"!=", @"==" };
if (jsPatterns.Any(p => Regex.IsMatch(jsFile, p)))
{
isValid = false;
}
if (isValid)
{
//add to page
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), item.ToString(), jsFile);
}
}
catch (UriFormatException)
{
isValid = false;
}
if (!isValid)
{
//it is invalid, let's render it as a script block instead as devs may have written real Javascript instead
//of a JS path
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), item.ToString(), jsFile, true);
}
item++;
}
}
}
}

View File

@@ -8,9 +8,46 @@
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco {
public partial class Umbraco {
public partial class UmbracoMainPage
{
/// <summary>
/// ClientLoader control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader;
/// <summary>
/// CssInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
/// <summary>
/// CssInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude2;
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
/// <summary>
/// JSON2 control.
@@ -20,5 +57,230 @@ namespace Umbraco.Web.UI.Umbraco {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JSON2;
/// <summary>
/// JsInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude2;
/// <summary>
/// JsInclude3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude3;
/// <summary>
/// JsInclude14 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude14;
/// <summary>
/// JsInclude5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude5;
/// <summary>
/// JsInclude6 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude6;
/// <summary>
/// JsInclude13 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude13;
/// <summary>
/// JsInclude7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude7;
/// <summary>
/// JsInclude8 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude8;
/// <summary>
/// JsInclude9 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude9;
/// <summary>
/// JsInclude10 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude10;
/// <summary>
/// JsInclude11 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude11;
/// <summary>
/// JsInclude4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude4;
/// <summary>
/// JsInclude17 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude17;
/// <summary>
/// JsInclude12 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude12;
/// <summary>
/// JsInclude15 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude15;
/// <summary>
/// JsInclude16 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude16;
/// <summary>
/// Form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm Form1;
/// <summary>
/// umbracoScriptManager control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.ScriptManager umbracoScriptManager;
/// <summary>
/// FindDocuments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel FindDocuments;
/// <summary>
/// Search control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Umbraco.Web.UI.Umbraco.Search.QuickSearch Search;
/// <summary>
/// treeWindow control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel treeWindow;
/// <summary>
/// JTree control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.controls.Tree.TreeControl JTree;
/// <summary>
/// PlaceHolderAppIcons control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel PlaceHolderAppIcons;
/// <summary>
/// plcIcons control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal plcIcons;
/// <summary>
/// bubbleText control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder bubbleText;
}
}

View File

@@ -1,5 +1,5 @@
<%@ Page Trace="false" Language="c#" CodeBehind="umbraco.aspx.cs" AutoEventWireup="True"
Inherits="Umbraco.Web.UI.Umbraco.Umbraco" %>
Inherits="Umbraco.Web.UI.Umbraco.UmbracoMainPage" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
@@ -90,12 +90,12 @@
<div class="topBarButtons">
<button onclick="UmbClientMgr.appActions().launchAbout();" class="topBarButton">
<img src="images/aboutNew.png" alt="about" /><span><%=umbraco.ui.Text("general", "about")%></span></button>
<button onclick="UmbClientMgr.appActions().launchHelp('<%=this.getUser().Language%>', '<%=this.getUser().UserType.Name%>');"
<button onclick="UmbClientMgr.appActions().launchHelp('<%=GetUser().Language%>', '<%=GetUser().UserType.Name%>');"
class="topBarButton">
<img src="images/help.png" alt="Help" /><span><%=umbraco.ui.Text("general", "help")%></span></button>
<button onclick="UmbClientMgr.appActions().logout();" class="topBarButton">
<img src="images/logout.png" alt="Log out" /><span><%=umbraco.ui.Text("general", "logout")%>:
<%=this.getUser().Name%></span></button>
<%=GetUser().Name%></span></button>
</div>
</div>
</div>
@@ -299,13 +299,13 @@
if (password != "") {
var data = {
username: <%= new JavaScriptSerializer().Serialize(this.getUser().LoginName) %>,
username: <%= new JavaScriptSerializer().Serialize(GetUser().LoginName) %>,
password: password
};
jQuery.ajax({
type: "POST",
url: "<%=umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>/webservices/legacyAjaxCalls.asmx/ValidateUser",
url: "<%=Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) %>/webservices/legacyAjaxCalls.asmx/ValidateUser",
data: JSON.stringify(data),
processData: false,
success: function (result) {

View File

@@ -20,6 +20,7 @@ namespace umbraco.cms.presentation
/// </summary>
public partial class Create : BasePages.UmbracoEnsuredPage
{
[Obsolete("This property is no longer used")]
protected umbWindow createWindow;
protected System.Web.UI.WebControls.Label helpText;
protected System.Web.UI.WebControls.TextBox rename;

View File

@@ -24,6 +24,7 @@ namespace umbraco.cms.presentation
/// </summary>
public partial class login : BasePages.BasePage
{
[Obsolete("This property is no longer used")]
protected umbWindow treeWindow;
protected override void OnLoad(EventArgs e)

View File

@@ -16,7 +16,7 @@ using System.Web.Services;
namespace umbraco.cms.presentation
{
[Obsolete("Used the TreeControl control instead. This does however get used by the TreeService when requesting the tree init url.")]
[Obsolete("This class is no longer used and will be removed in future versions. The page that supercedes this is Umbraco.Web.UI.Umbraco.TreeInit")]
public partial class TreeInit : UmbracoEnsuredPage
{

View File

@@ -8,8 +8,8 @@ namespace umbraco
/// <summary>
/// Summary description for umbWindow.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:umbWindow runat=server></{0}:umbWindow>")]
[DefaultProperty("Text"), ToolboxData("<{0}:umbWindow runat=server></{0}:umbWindow>")]
[Obsolete("This class is no longer used and will be removed from the codebase in future versions")]
public class umbWindow : System.Web.UI.WebControls.PlaceHolder
{
private string content;

View File

@@ -27,6 +27,7 @@ namespace umbraco.cms.presentation
/// </summary>
public class _umbraco : UmbracoEnsuredPage
{
[Obsolete("This property is no longer used")]
protected umbWindow UmbWindow1;
protected System.Web.UI.WebControls.PlaceHolder bubbleText;