Removes more unused code

This commit is contained in:
Shannon
2014-11-14 17:57:44 +11:00
parent c08db70e82
commit bdcf8f8fc0
9 changed files with 7 additions and 198 deletions

View File

@@ -208,13 +208,7 @@ namespace Umbraco.Core
}
}
private void AssertIsReady()
{
if (!this.IsReady)
throw new Exception("ApplicationContext is not ready yet.");
}
private void AssertIsNotReady()
private void AssertIsNotReady()
{
if (this.IsReady)
throw new Exception("ApplicationContext has already been initialized.");

View File

@@ -192,8 +192,7 @@ namespace Umbraco.Tests.UmbracoExamine
#region Private methods and properties
private readonly TestContentService _contentService = new TestContentService();
private readonly TestMediaService _mediaService = new TestMediaService();
private readonly TestMediaService _mediaService = new TestMediaService();
private static UmbracoExamineSearcher _searcher;
private static UmbracoContentIndexer _indexer;

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Web.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -281,14 +278,5 @@ namespace Umbraco.Web.Install.Controllers
}
}
}
private HttpResponseMessage Json(object jsonObject, HttpStatusCode status)
{
var response = Request.CreateResponse(status);
var json = JObject.FromObject(jsonObject);
response.Content = new StringContent(json.ToString(), Encoding.UTF8, "application/json");
return response;
}
}
}

View File

@@ -280,7 +280,7 @@ namespace umbraco
macro tempMacro;
String macroID = helper.FindAttribute(attributes, "macroid");
if (macroID != String.Empty)
tempMacro = getMacro(macroID);
tempMacro = GetMacro(macroID);
else
tempMacro = macro.GetMacro(helper.FindAttribute(attributes, "macroalias"));
@@ -409,7 +409,7 @@ namespace umbraco
String macroID = helper.FindAttribute(attributes, "macroid");
if (macroID != "")
{
macro tempMacro = getMacro(macroID);
macro tempMacro = GetMacro(macroID);
_templateOutput.Replace(tag.Value.ToString(), tempMacro.MacroContent.ToString());
}
}
@@ -427,7 +427,7 @@ namespace umbraco
String macroID = helper.FindAttribute(tempAttributes, "macroid");
if (Convert.ToInt32(macroID) > 0)
{
macro tempContentMacro = getMacro(macroID);
macro tempContentMacro = GetMacro(macroID);
_templateOutput.Replace(tag.Value.ToString(), tempContentMacro.MacroContent.ToString());
}
@@ -452,21 +452,12 @@ namespace umbraco
#region private methods
private macro getMacro(String macroID)
private static macro GetMacro(String macroID)
{
System.Web.HttpContext.Current.Trace.Write("umbracoTemplate", "Starting macro (" + macroID.ToString() + ")");
return macro.GetMacro(Convert.ToInt16(macroID));
}
private String FindAttribute(Hashtable attributes, String key)
{
if (attributes[key] != null)
return attributes[key].ToString();
else
return "";
}
#endregion
protected static ISqlHelper SqlHelper

View File

@@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -24,7 +23,6 @@ using umbraco.BusinessLogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.propertytype;
using umbraco.cms.businesslogic.web;
using umbraco.cms.helpers;
using umbraco.controls.GenericProperties;
using umbraco.presentation;
using umbraco.BasePages;
@@ -476,114 +474,8 @@ namespace umbraco.controls
else
lt_icon.Text = _contentType.IconUrl.TrimStart('.');
/*
var dirInfo = new DirectoryInfo(Server.MapPath(SystemDirectories.Umbraco + "/images/umbraco"));
var fileInfo = dirInfo.GetFiles();
var spriteFileNames = CMSNode.DefaultIconClasses.Select(IconClassToIconFileName).ToList();
var diskFileNames = fileInfo.Select(FileNameToIconFileName).ToList();
var listOfIcons = new List<ListItem>();
// .sprNew was never intended to be in the document type editor
foreach (var iconClass in CMSNode.DefaultIconClasses.Where(iconClass => iconClass.Equals(".sprNew", StringComparison.InvariantCultureIgnoreCase) == false))
{
// Still shows the selected even if we tell it to hide sprite duplicates so as not to break an existing selection
if (_contentType.IconUrl.Equals(iconClass, StringComparison.InvariantCultureIgnoreCase) == false
&& UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour == IconPickerBehaviour.HideSpriteDuplicates
&& diskFileNames.Contains(IconClassToIconFileName(iconClass)))
continue;
AddSpriteListItem(iconClass, listOfIcons);
}
foreach (var file in fileInfo)
{
// NH: don't show the sprite file
if (file.Name.ToLowerInvariant() == "sprites.png".ToLowerInvariant() || file.Name.ToLowerInvariant() == "sprites_ie6.gif".ToLowerInvariant())
continue;
// Still shows the selected even if we tell it to hide file duplicates so as not to break an existing selection
if (_contentType.IconUrl.Equals(file.Name, StringComparison.InvariantCultureIgnoreCase) == false
&& UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates
&& spriteFileNames.Contains(FileNameToIconFileName(file)))
continue;
var listItemValue = ResolveClientUrl(SystemDirectories.Umbraco + "/images/umbraco/" + file.Name);
AddFileListItem(file.Name, listItemValue, listOfIcons);
}
ddlIcons.Items.AddRange(listOfIcons.OrderBy(o => o.Text).ToArray());
// Get thumbnails
dirInfo = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Umbraco + "/images/thumbnails"));
fileInfo = dirInfo.GetFiles();
foreach (var file in fileInfo)
{
var li = new ListItem(file.Name);
li.Attributes.Add("title", this.ResolveClientUrl(SystemDirectories.Umbraco + "/images/thumbnails/" + file.Name));
if (this.Page.IsPostBack == false && li.Value == _contentType.Thumbnail)
li.Selected = true;
// ddlThumbnails.Items.Add(li);
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "thumbnailsDropDown", string.Format(@"
function refreshDropDowns() {{
jQuery('#{1}').msDropDown({{ showIcon: true, style: 'width:250px;' }});
jQuery('#{3}').msDropDown({{ showIcon: false, rowHeight: '130', visibleRows: '2', style: 'width:250px;' }});
}}
jQuery(document).ready(function() {{ refreshDropDowns(); }});
", ddlIcons.ClientID, ddlIcons.ClientID, ddlIcons.ClientID, ddlThumbnails.ClientID, 500), true);
txtName.Text = _contentType.GetRawText();
txtAlias.Text = _contentType.Alias;
description.Text = _contentType.GetRawDescription();
*/
}
private void AddSpriteListItem(string iconClass, ICollection<ListItem> listOfIcons)
{
var li = new ListItem(
helper.SpaceCamelCasing((iconClass.Substring(1, iconClass.Length - 1)))
.Replace("Spr Tree", "")
.Trim(), iconClass);
li.Attributes.Add("class", "spriteBackground sprTree " + iconClass.Trim('.'));
li.Attributes.Add("style", "padding-left:24px !important; background-repeat:no-repeat; width:auto; height:auto;");
AddListItem(listOfIcons, li);
}
private void AddFileListItem(string fileName, string listItemValue, ICollection<ListItem> listOfIcons)
{
var li = new ListItem(fileName, fileName);
li.Attributes.Add("title", listItemValue);
AddListItem(listOfIcons, li);
}
private void AddListItem(ICollection<ListItem> listOfIcons, ListItem li)
{
if (this.Page.IsPostBack == false && li.Value == _contentType.IconUrl)
li.Selected = true;
listOfIcons.Add(li);
}
private static string IconClassToIconFileName(string iconClass)
{
return iconClass.Substring(1, iconClass.Length - 1).ToLowerInvariant().Replace("sprTree".ToLowerInvariant(), "");
}
private static string FileNameToIconFileName(FileInfo file)
{
return file.Name.Substring(0, file.Name.LastIndexOf(".", StringComparison.Ordinal)).ToLowerInvariant();
}
#endregion
#region "Structure" Pane
@@ -1070,18 +962,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
}
}
private bool DoesPropertyTypeAliasExist(GenericProperty gpData)
{
bool hasAlias = _contentType.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null;
ContentType ct = _contentType;
while (ct.MasterContentType > 0)
{
ct = new ContentType(ct.MasterContentType);
hasAlias = ct.getPropertyType(Casing.SafeAliasWithForcingCheck(gpData.Alias.Trim())) != null;
}
return !hasAlias;
}
/// <summary>
/// Called asynchronously in order to delete a content type property
/// </summary>

View File

@@ -336,14 +336,6 @@ namespace umbraco.presentation.developer.packages
PerformPostInstallCleanup(packageId, dir);
}
/// <summary>
/// Runs Post refresh actions such reloading the correct tree nodes, etc...
/// </summary>
private void PerformPostRefreshAction()
{
BasePage.Current.ClientTools.ReloadActionNode(true, true);
}
/// <summary>
/// Runs Post install actions such as clearning any necessary cache, reloading the correct tree nodes, etc...
/// </summary>

View File

@@ -504,17 +504,6 @@ namespace umbraco
return default(T);
}
/// <summary>
/// Get a string value for the supplied property alias
/// </summary>
/// <param name="node">an umbraco.presentation.nodeFactory.Node object</param>
/// <param name="propertyAlias">alias of propety to get</param>
/// <returns>empty string, or property value as string</returns>
private static string GetPropertyAsString(this Node node, string propertyAlias)
{
return GetPropertyAsString((INode)node, propertyAlias);
}
/// <summary>
/// Get a string value for the supplied property alias
/// </summary>
@@ -534,17 +523,6 @@ namespace umbraco
return propertyValue;
}
/// <summary>
/// Get a boolean value for the supplied property alias (works with built in Yes/No dataype)
/// </summary>
/// <param name="node">an umbraco.presentation.nodeFactory.Node object</param>
/// <param name="propertyAlias">alias of propety to get</param>
/// <returns>true if can cast value, else false for all other circumstances</returns>
private static bool GetPropertyAsBoolean(this Node node, string propertyAlias)
{
return GetPropertyAsBoolean((INode)node, propertyAlias);
}
/// <summary>
/// Get a boolean value for the supplied property alias (works with built in Yes/No dataype)
/// </summary>

View File

@@ -192,12 +192,5 @@ namespace UmbracoExamine
e.Fields.Add("_searchEmail", e.Node.Attribute("email").Value.Replace(".", " ").Replace("@", " "));
}
}
private static XElement GetMemberItem(int nodeId)
{
//TODO: Change this so that it is not using the LegacyLibrary, just serialize manually!
var nodes = LegacyLibrary.GetMember(nodeId);
return XElement.Parse(nodes.Current.OuterXml);
}
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using umbraco.BasePages;
using System.Web.UI;
using Umbraco.Core.IO;
@@ -326,12 +325,7 @@ namespace umbraco.BasePages
return this;
}
private Page GetCurrentPage()
{
return HttpContext.Current.CurrentHandler as Page;
}
/// <summary>
/// <summary>
/// This will use the ScriptManager to register the script if one is available, otherwise will default to the ClientScript
/// class of the page.
/// </summary>