Updated references to the new constants for Application and MediaType aliases.

This commit is contained in:
leekelleher
2013-03-22 13:13:05 +00:00
parent 6b07ee83eb
commit b6ec364156
74 changed files with 190 additions and 143 deletions

View File

@@ -2,13 +2,14 @@
using Umbraco.Core.IO;
using umbraco.businesslogic;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace Umbraco.Web.Trees
{
/// <summary>
/// Tree for displaying partial view macros in the developer app
/// </summary>
[Tree("developer", "partialViewMacros", "Partial View Macro Files", sortOrder: 6)]
[Tree(Constants.Applications.Developer, "partialViewMacros", "Partial View Macro Files", sortOrder: 6)]
public class PartialViewMacrosTree : PartialViewsTree
{
public PartialViewMacrosTree(string application) : base(application)

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees
/// <summary>
/// Tree for displaying partial views in the settings app
/// </summary>
[Tree("settings", "partialViews", "Partial Views", sortOrder: 2)]
[Tree(Constants.Applications.Settings, "partialViews", "Partial Views", sortOrder: 2)]
public class PartialViewsTree : FileSystemTree
{
public PartialViewsTree(string application) : base(application) { }

View File

@@ -97,7 +97,7 @@ namespace umbraco.presentation.LiveEditing.Controls
{
// SKINNING
// verify access to settings area
if (User.GetCurrent().GetApplications().Find(t => t.alias.ToLower() == "settings") != null)
if (User.GetCurrent().GetApplications().Find(t => string.Equals(t.alias, Umbraco.Core.Constants.Applications.Settings, StringComparison.OrdinalIgnoreCase)) != null)
{
//only add if there is a skin
NodeFactory.Node n = NodeFactory.Node.GetCurrent();

View File

@@ -7,6 +7,7 @@ using System.Web.UI.WebControls;
using Umbraco.Core.Logging;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.packager;
using Umbraco.Core;
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
{
@@ -23,7 +24,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
protected void Page_Load(object sender, EventArgs e)
{
if (User.GetCurrent().GetApplications().Find(t => t.alias.ToLower() == "settings") == null)
if (User.GetCurrent().GetApplications().Find(t => string.Equals(t.alias, Constants.Applications.Settings, StringComparison.OrdinalIgnoreCase)) == null)
{
throw new Exception("The current user can't edit skins as the user doesn't have access to the Settings section!");
}

View File

@@ -15,6 +15,7 @@ using umbraco.BusinessLogic;
using umbraco.NodeFactory;
using umbraco.cms.businesslogic.packager;
using System.IO;
using Umbraco.Core;
namespace umbraco.presentation.LiveEditing.Modules.SkinModule
{
@@ -227,7 +228,7 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule
protected void Page_Load(object sender, EventArgs e)
{
if (User.GetCurrent().GetApplications().Find(t => t.alias.ToLower() == "settings") == null)
if (User.GetCurrent().GetApplications().Find(t => string.Equals(t.alias, Constants.Applications.Settings, StringComparison.OrdinalIgnoreCase)) == null)
{
throw new Exception("The current user can't edit skins as the user doesn't have access to the Settings section!");
}

View File

@@ -11,6 +11,7 @@ using UmbracoExamine;
using System.Web.Script.Serialization;
using Examine;
using Examine.LuceneEngine.SearchCriteria;
using Umbraco.Core;
namespace umbraco.presentation.umbraco.Search
{
@@ -44,7 +45,7 @@ namespace umbraco.presentation.umbraco.Search
}
//if it doesn't start with "*", then search only nodeName and nodeId
var internalSearcher = (app == "member")
var internalSearcher = (app == Constants.Applications.Members)
? UmbracoContext.Current.InternalMemberSearchProvider
: UmbracoContext.Current.InternalSearchProvider;

View File

@@ -7,6 +7,7 @@ using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.property;
using umbraco.interfaces;
using Umbraco.Core;
namespace umbraco.cms.presentation.Trees
{
@@ -87,7 +88,7 @@ function openMedia(id) {
}
else
{
if (dd.ContentType.Alias.ToLower() == "folder")
if (string.Equals(dd.ContentType.Alias, Constants.Conventions.MediaTypes.Folder, StringComparison.OrdinalIgnoreCase))
{
xNode.Action = "javascript:jQuery('.umbTree #" + dd.Id.ToString() + "').click();";
}

View File

@@ -22,6 +22,7 @@ using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco.cms.presentation.Trees
@@ -29,7 +30,7 @@ namespace umbraco.cms.presentation.Trees
/// <summary>
/// Handles loading the content tree into umbraco's application tree
/// </summary>
[Tree("content", "contentRecycleBin", "Recycle Bin", "folder.gif", "folder_o.gif", initialize: false)]
[Tree(Constants.Applications.Content, "contentRecycleBin", "Recycle Bin", "folder.gif", "folder_o.gif", initialize: false)]
public class ContentRecycleBin : BaseContentTree
{

View File

@@ -25,11 +25,12 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Actions;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco.cms.presentation.Trees
{
[Tree("media", "mediaRecycleBin", "Recycle Bin", "folder.gif", "folder_o.gif", initialize : false)]
[Tree(Constants.Applications.Media, "mediaRecycleBin", "Recycle Bin", "folder.gif", "folder_o.gif", initialize : false)]
public class MediaRecycleBin : BaseMediaTree
{
public MediaRecycleBin(string application) : base(application) { }

View File

@@ -13,10 +13,11 @@ using System.Xml;
using System.Collections.Generic;
using System.Text;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco.cms.presentation.Trees
{
[Tree("users", "userPermissions", "User Permissions", sortOrder: 2)]
[Tree(Constants.Applications.Users, "userPermissions", "User Permissions", sortOrder: 2)]
public class UserPermissions : BaseTree
{

View File

@@ -10,10 +10,11 @@ using System.Web.UI.HtmlControls;
using umbraco.BusinessLogic;
using System.Collections.Generic;
using umbraco.businesslogic;
using Umbraco.Core;
namespace umbraco.cms.presentation.Trees
{
[Tree("users", "userTypes", "User Types", sortOrder: 1)]
[Tree(Constants.Applications.Users, "userTypes", "User Types", sortOrder: 1)]
public class UserTypes : BaseTree
{

View File

@@ -4,13 +4,14 @@ using umbraco.businesslogic;
using umbraco.cms.businesslogic.web;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
using Umbraco.Core;
namespace umbraco
{
/// <summary>
/// Handles loading the content tree into umbraco's application tree
/// </summary>
[Tree("content", "content", "Content", silent: true)]
[Tree(Constants.Applications.Content, "content", "Content", silent: true)]
public class loadContent : BaseContentTree
{

View File

@@ -24,6 +24,7 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco
@@ -31,7 +32,7 @@ namespace umbraco
/// <summary>
/// Handles loading of all datatypes into the developer application tree
/// </summary>
[Tree("developer", "datatype", "Data Types", sortOrder: 1)]
[Tree(Constants.Applications.Developer, "datatype", "Data Types", sortOrder: 1)]
public class loadDataTypes : BaseTree
{
public loadDataTypes(string application) : base(application) { }

View File

@@ -24,11 +24,12 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "dictionary", "Dictionary", action: "openDictionary()", sortOrder: 3)]
[Tree(Constants.Applications.Settings, "dictionary", "Dictionary", action: "openDictionary()", sortOrder: 3)]
public class loadDictionary : BaseTree
{
public loadDictionary(string application) : base(application) { }

View File

@@ -24,11 +24,12 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "languages", "Languages", sortOrder: 4)]
[Tree(Constants.Applications.Settings, "languages", "Languages", sortOrder: 4)]
public class loadLanguages : BaseTree
{
public loadLanguages(string application) : base(application) { }

View File

@@ -24,6 +24,7 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Actions;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
@@ -31,7 +32,7 @@ namespace umbraco
/// <summary>
/// Handles loading of the cache application into the developer application tree
/// </summary>
[Tree("developer", "macros", "Macros", sortOrder: 2)]
[Tree(Constants.Applications.Developer, "macros", "Macros", sortOrder: 2)]
public class loadMacros : BaseTree
{

View File

@@ -29,7 +29,7 @@ using Umbraco.Core;
namespace umbraco
{
[Tree("media", "media", "Media")]
[Tree(Constants.Applications.Media, "media", "Media")]
public class loadMedia : BaseMediaTree
{

View File

@@ -7,10 +7,11 @@ using umbraco.BusinessLogic.Actions;
using umbraco.businesslogic;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "mediaTypes", "Media Types", sortOrder: 5)]
[Tree(Constants.Applications.Settings, "mediaTypes", "Media Types", sortOrder: 5)]
public class loadMediaTypes : BaseTree
{
public loadMediaTypes(string application) : base(application) { }

View File

@@ -24,13 +24,14 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using System.Web.Security;
using Umbraco.Core;
namespace umbraco
{
/// <summary>
/// Handles loading of the member groups into the application tree
/// </summary>
[Tree("member", "memberGroup", "Member Groups", sortOrder: 1)]
[Tree(Constants.Applications.Members, "memberGroup", "Member Groups", sortOrder: 1)]
public class loadMemberGroups : BaseTree
{
public loadMemberGroups(string application) : base(application) { }

View File

@@ -23,6 +23,7 @@ using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
@@ -30,7 +31,7 @@ namespace umbraco
/// <summary>
/// Handles loading of the member types into the application tree
/// </summary>
[Tree("member", "memberType", "Member Types", sortOrder: 2)]
[Tree(Constants.Applications.Members, "memberType", "Member Types", sortOrder: 2)]
public class loadMemberTypes : BaseTree
{
public loadMemberTypes(string application) : base(application) { }

View File

@@ -23,6 +23,7 @@ using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
@@ -30,7 +31,7 @@ namespace umbraco
/// <summary>
/// Handles loading of the member application into the application tree
/// </summary>
[Tree("member", "member", "Members")]
[Tree(Constants.Applications.Members, "member", "Members")]
public class loadMembers : BaseTree
{
public loadMembers(string application) : base(application) { }

View File

@@ -8,11 +8,12 @@ using umbraco.businesslogic;
using umbraco.interfaces;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "nodeTypes", "Document Types", sortOrder: 6)]
[Tree(Constants.Applications.Settings, "nodeTypes", "Document Types", sortOrder: 6)]
public class loadNodeTypes : BaseTree
{

View File

@@ -22,13 +22,14 @@ using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using Umbraco.Core;
namespace umbraco
{
/// <summary>
/// Handles loading of the packager application into the developer application tree
/// </summary>
[Tree("developer", "packager", "Packages", sortOrder: 3)]
[Tree(Constants.Applications.Developer, "packager", "Packages", sortOrder: 3)]
public class loadPackager : ITree
{
#region TreeI Members

View File

@@ -23,10 +23,11 @@ using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
{
[Tree("developer", "packagerPackages", "Packager Packages", initialize: false, sortOrder: 1)]
[Tree(Constants.Applications.Developer, "packagerPackages", "Packager Packages", initialize: false, sortOrder: 1)]
public class loadPackages : BaseTree
{

View File

@@ -24,6 +24,7 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using Umbraco.Core;
namespace umbraco
@@ -31,7 +32,7 @@ namespace umbraco
/// <summary>
/// Handles loading of python items into the developer application tree
/// </summary>
[Tree("developer", "python", "Python Files", sortOrder: 4)]
[Tree(Constants.Applications.Developer, "python", "Python Files", sortOrder: 4)]
public class loadPython : loadDLRScripts
{
public loadPython(string application) : base(application) { }

View File

@@ -10,13 +10,14 @@ using umbraco.DataLayer;
using umbraco.interfaces;
using umbraco.cms.presentation.developer.RelationTypes.TreeMenu;
using umbraco.businesslogic;
using Umbraco.Core;
namespace umbraco
{
/// <summary>
/// RelationTypes tree for developer section
/// </summary>
[Tree("developer", "relationTypes", "Relation Types", sortOrder: 4)]
[Tree(Constants.Applications.Developer, "relationTypes", "Relation Types", sortOrder: 4)]
public class loadRelationTypes : BaseTree
{
/// <summary>

View File

@@ -25,11 +25,12 @@ using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using umbraco.IO;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "scripts", "Scripts", "folder.gif", "folder_o.gif", sortOrder: 2)]
[Tree(Constants.Applications.Settings, "scripts", "Scripts", "folder.gif", "folder_o.gif", sortOrder: 2)]
public class loadScripts : FileSystemTree
{
public loadScripts(string application) : base(application) { }

View File

@@ -23,11 +23,12 @@ using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "stylesheetProperty", "Stylesheet Property", "", "", initialize: false)]
[Tree(Constants.Applications.Settings, "stylesheetProperty", "Stylesheet Property", "", "", initialize: false)]
public class loadStylesheetProperty : BaseTree
{
public loadStylesheetProperty(string application) : base(application) { }

View File

@@ -24,11 +24,12 @@ using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
namespace umbraco
{
[Tree("settings", "stylesheets", "Stylesheets")]
[Tree(Constants.Applications.Settings, "stylesheets", "Stylesheets")]
public class loadStylesheets : BaseTree
{
public loadStylesheets(string application) : base(application) { }

View File

@@ -30,7 +30,7 @@ using umbraco.cms.businesslogic.skinning;
namespace umbraco
{
[Tree("settings", "templates", "Templates", sortOrder: 1)]
[Tree(Constants.Applications.Settings, "templates", "Templates", sortOrder: 1)]
public class loadTemplates : BaseTree
{
public loadTemplates(string application) : base(application) {}

View File

@@ -25,6 +25,7 @@ using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using System.Linq;
using Umbraco.Core;
namespace umbraco
@@ -32,7 +33,7 @@ namespace umbraco
/// <summary>
/// Handles loading of all umbraco users into the users application tree
/// </summary>
[Tree("users", "users", "Users")]
[Tree(Constants.Applications.Users, "users", "Users")]
public class loadUsers : BaseTree
{
public loadUsers(string application) : base(application) { }

View File

@@ -25,13 +25,14 @@ using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Utils;
using umbraco.BusinessLogic.Actions;
using umbraco.IO;
using Umbraco.Core;
namespace umbraco
{
/// <summary>
/// Handles loading of the xslt files into the application tree
/// </summary>
[Tree("developer", "xslt", "XSLT Files", sortOrder: 5)]
[Tree(Constants.Applications.Developer, "xslt", "XSLT Files", sortOrder: 5)]
public class loadXslt : FileSystemTree
{

View File

@@ -9,6 +9,7 @@ using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
namespace umbraco.presentation.actions
{
@@ -20,7 +21,7 @@ namespace umbraco.presentation.actions
{
d = new Document(int.Parse(helper.Request("id")));
if (!base.ValidateUserApp("content"))
if (!base.ValidateUserApp(Constants.Applications.Content))
throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");
if (!base.ValidateUserNodeTreePermissions(d.Path, "D"))
throw new ArgumentException("The current user doesn't have permissions to delete this document. Please contact the system administrator.");

View File

@@ -9,6 +9,7 @@ using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
namespace umbraco.presentation.actions
{
@@ -20,7 +21,7 @@ namespace umbraco.presentation.actions
{
d = new Document(int.Parse(helper.Request("id")));
if (!base.ValidateUserApp("content"))
if (!base.ValidateUserApp(Constants.Applications.Content))
throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");
if (!base.ValidateUserNodeTreePermissions(d.Path, "U"))

View File

@@ -10,6 +10,7 @@ using System.Web.UI.HtmlControls;
using umbraco.cms.presentation.Trees;
using umbraco.presentation;
using umbraco.uicontrols.TreePicker;
using Umbraco.Core;
namespace umbraco.controls
{
@@ -19,7 +20,7 @@ namespace umbraco.controls
public ContentPicker()
{
AppAlias = "content";
AppAlias = Constants.Applications.Content;
TreeAlias = "content";
}

View File

@@ -60,7 +60,7 @@ namespace umbraco.controls.Images
protected void SubmitButton_Click(object sender, EventArgs e)
{
var media = Media.MakeNew(TextBoxTitle.Text, cms.businesslogic.media.MediaType.GetByAlias("image"), BasePage.Current.getUser(), int.Parse(MediaPickerControl.Value));
var media = Media.MakeNew(TextBoxTitle.Text, cms.businesslogic.media.MediaType.GetByAlias(Constants.Conventions.MediaTypes.Image), BasePage.Current.getUser(), int.Parse(MediaPickerControl.Value));
foreach (var property in media.GenericProperties)
{

View File

@@ -16,6 +16,7 @@ using System.Web.Services;
using System.Drawing;
using umbraco.BusinessLogic;
using System.Linq;
using Umbraco.Core;
namespace umbraco.controls.Tree
{
@@ -53,7 +54,7 @@ namespace umbraco.controls.Tree
/// <summary>
/// If there is not application or tree specified in a query string then this is the application to load.
/// </summary>
private const string DEFAULT_APP = "content";
private const string DEFAULT_APP = Constants.Applications.Content;
private List<BaseTree> m_ActiveTrees = new List<BaseTree>();
private List<BaseTree> m_AllAppTrees = new List<BaseTree>();

View File

@@ -15,6 +15,7 @@ using umbraco.presentation;
using umbraco.BusinessLogic.Actions;
using umbraco.BasePages;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
namespace umbraco.dialogs
{
@@ -40,7 +41,7 @@ namespace umbraco.dialogs
{
int nodeId = int.Parse(helper.Request("nodeId"));
//ensure they have access to create under this node!!
if (helper.Request("app") == "media" || CheckCreatePermissions(nodeId))
if (helper.Request("app") == Constants.Applications.Media || CheckCreatePermissions(nodeId))
{
//pane_chooseName.Text = ui.Text("create", "updateData", this.getUser());
cms.businesslogic.CMSNode c = new cms.businesslogic.CMSNode(nodeId);

View File

@@ -13,6 +13,7 @@ using umbraco.cms.businesslogic;
using umbraco.cms.presentation.user;
using umbraco.interfaces;
using Umbraco.Web;
using Umbraco.Core;
namespace umbraco.dialogs
{
@@ -34,7 +35,7 @@ namespace umbraco.dialogs
//Document Type copy Hack...
var app = Request.GetItemAsString("app");
if (app == "settings")
if (app == Constants.Applications.Settings)
{
pane_form.Visible = false;
pane_form_notice.Visible = false;
@@ -72,7 +73,7 @@ namespace umbraco.dialogs
var cmsNode = new CMSNode(int.Parse(Request.GetItemAsString("id")));
var validAction = true;
if (app == "content" && cmsNode.HasChildren)
if (app == Constants.Applications.Content && cmsNode.HasChildren)
validAction = ValidAction(Request.GetItemAsString("mode") == "cut" ? 'M' : 'O');
@@ -177,7 +178,7 @@ namespace umbraco.dialogs
public void HandleMoveOrCopy(object sender, EventArgs e)
{
if (Request["app"] == "settings")
if (Request["app"] == Constants.Applications.Settings)
HandleDocumentTypeCopy();
else
HandleDocumentMoveOrCopy();
@@ -243,7 +244,7 @@ namespace umbraco.dialogs
if (Request["mode"] == "cut")
{
if (Request["app"] == "content")
if (Request["app"] == Constants.Applications.Content)
{
//PPH changed this to document instead of cmsNode to handle republishing.
var documentId = int.Parse(Request.GetItemAsString("id"));

View File

@@ -8,6 +8,7 @@ using System.Xml;
using Examine;
using Examine.LuceneEngine.SearchCriteria;
using System.Linq;
using Umbraco.Core;
namespace umbraco.presentation.dialogs
@@ -52,7 +53,7 @@ namespace umbraco.presentation.dialogs
}
//if it doesn't start with "*", then search only nodeName and nodeId
var internalSearcher = (app == "member")
var internalSearcher = (app == Constants.Applications.Members)
? UmbracoContext.Current.InternalMemberSearchProvider
: UmbracoContext.Current.InternalSearchProvider;

View File

@@ -41,7 +41,7 @@ namespace umbraco.cms.presentation
int parentId;
if (int.TryParse(Request.GetItemAsString("ID"), out parentId))
{
if (app == "media")
if (app == Constants.Applications.Media)
{
icon = "../images/umbraco/mediaPhoto.gif";
var mediaService = ApplicationContext.Current.Services.MediaService;
@@ -59,7 +59,7 @@ namespace umbraco.cms.presentation
}
}
if (app == "content")
if (app == Constants.Applications.Content)
{
var contentService = ApplicationContext.Current.Services.ContentService;
@@ -78,7 +78,7 @@ namespace umbraco.cms.presentation
// "hack for stylesheet"
// TODO: I can't see where this is being used at all..?
if (app == "settings")
if (app == Constants.Applications.Settings)
{
icon = "../images/umbraco/settingCss.gif";
var ss = new StyleSheet(parentId);

View File

@@ -502,7 +502,7 @@ namespace umbraco.cms.presentation
private bool CheckUserValidation()
{
// Validate permissions
if (!base.ValidateUserApp("content"))
if (!base.ValidateUserApp(Constants.Applications.Content))
{
ShowUserValidationError("<h3>The current user doesn't have access to this application</h3><p>Please contact the system administrator if you think that you should have access.</p>");
return false;

View File

@@ -16,6 +16,7 @@ using umbraco.businesslogic.Exceptions;
using umbraco.IO;
using umbraco.cms.businesslogic.web;
using System.Linq;
using Umbraco.Core;
namespace umbraco.cms.presentation
{
@@ -168,7 +169,7 @@ namespace umbraco.cms.presentation
{
BusinessLogic.User.MakeNew(loginName, loginName, string.Empty, email, BusinessLogic.UserType.GetUserType(2));
BusinessLogic.User u = new BusinessLogic.User(loginName);
u.addApplication("content");
u.addApplication(Constants.Applications.Content);
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Core;
namespace umbraco.presentation.plugins.tinymce3
{
@@ -23,7 +24,7 @@ namespace umbraco.presentation.plugins.tinymce3
tp.Controls.Add(pane_content);
if (CurrentUser.GetApplications().Find(t => t.alias == "media") != null)
if (CurrentUser.GetApplications().Find(t => t.alias == Constants.Applications.Media) != null)
{
uicontrols.TabPage tp2 = tv_options.NewTabPage(ui.Text("media"));
tp2.HasMenu = false;

View File

@@ -191,7 +191,7 @@ namespace umbraco
/// <returns></returns>
public static string GetImageUrl(this Media media)
{
if (media.ContentType.Alias.Equals("Image"))
if (media.ContentType.Alias.Equals(Constants.Conventions.MediaTypes.Image))
{
var url = media.GetProperty<string>(Constants.Conventions.Media.File);
if (!string.IsNullOrEmpty(url))
@@ -210,7 +210,7 @@ namespace umbraco
/// <returns></returns>
public static string GetImageThumbnailUrl(this Media media)
{
if (media.ContentType.Alias.Equals("Image"))
if (media.ContentType.Alias.Equals(Constants.Conventions.MediaTypes.Image))
{
var url = media.GetProperty<string>(Constants.Conventions.Media.File);
if (!string.IsNullOrEmpty(url))

View File

@@ -88,7 +88,7 @@ namespace umbraco
/// <summary>
/// Recycle Bin
/// </summary>
[Guid(Constants.ObjectTypes.RecycleBin)]
[Guid(Constants.ObjectTypes.ContentRecycleBin)]
[FriendlyName("Recycle Bin")]
RecycleBin,

View File

@@ -36,7 +36,7 @@ namespace umbraco.cms.presentation
protected void Page_Load(object sender, System.EventArgs e)
{
var apps = this.getUser().Applications.ToList();
bool userHasAccesstodefaultApp = apps.Where(x => x.alias == "content").Count() > 0;
bool userHasAccesstodefaultApp = apps.Where(x => x.alias == Umbraco.Core.Constants.Applications.Content).Count() > 0;
// Load user module icons ..
if (apps.Count() > 1)
@@ -82,7 +82,7 @@ namespace umbraco.cms.presentation
}
else
{
DefaultApp = "content";
DefaultApp = Umbraco.Core.Constants.Applications.Content;
}

View File

@@ -117,7 +117,7 @@ namespace umbraco.cms.presentation.user
DefaultToLiveEditing.Checked = u.DefaultToLiveEditing;
PlaceHolder medias = new PlaceHolder();
mediaPicker.AppAlias = "media";
mediaPicker.AppAlias = Constants.Applications.Media;
mediaPicker.TreeAlias = "media";
if (u.StartMediaId > 0)
@@ -128,7 +128,7 @@ namespace umbraco.cms.presentation.user
medias.Controls.Add(mediaPicker);
PlaceHolder content = new PlaceHolder();
contentPicker.AppAlias = "content";
contentPicker.AppAlias = Constants.Applications.Content;
contentPicker.TreeAlias = "content";
if (u.StartNodeId > 0)
@@ -246,7 +246,7 @@ namespace umbraco.cms.presentation.user
// Handle content and media pickers
PlaceHolder medias = new PlaceHolder();
cMediaPicker.AppAlias = "media";
cMediaPicker.AppAlias = Constants.Applications.Media;
cMediaPicker.TreeAlias = "media";
if (userChannel.MediaFolder > 0)
@@ -257,7 +257,7 @@ namespace umbraco.cms.presentation.user
medias.Controls.Add(cMediaPicker);
PlaceHolder content = new PlaceHolder();
cContentPicker.AppAlias = "content";
cContentPicker.AppAlias = Constants.Applications.Content;
cContentPicker.TreeAlias = "content";
if (userChannel.StartNode > 0)
@@ -494,7 +494,7 @@ namespace umbraco.cms.presentation.user
c.DocumentTypeAlias = cDocumentType.SelectedValue;
//
c.MediaTypeAlias = "image";
c.MediaTypeAlias = Constants.Conventions.MediaTypes.Image; // [LK:2013-03-22] This was previously lowercase; unsure if using const will cause an issue.
c.MediaTypeFileProperty = Constants.Conventions.Media.File;
c.ImageSupport = true;

View File

@@ -14,6 +14,7 @@ using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.businesslogic.Exceptions;
using umbraco.cms.businesslogic.media;
using Umbraco.Core;
namespace umbraco.presentation.umbraco.webservices
{
@@ -222,7 +223,7 @@ namespace umbraco.presentation.umbraco.webservices
if (mp != null && mp.ValidateUser(username, password))
{
var user = new User(username);
isValid = user.Applications.Any(app => app.alias == "media");
isValid = user.Applications.Any(app => app.alias == Constants.Applications.Media);
if (isValid)
AuthenticatedUser = user;
@@ -234,7 +235,7 @@ namespace umbraco.presentation.umbraco.webservices
var user = new User(username);
if (t != null)
isValid = user.LoginName.ToLower() == t.Name.ToLower() && user.Applications.Any(app => app.alias == "media");
isValid = user.LoginName.ToLower() == t.Name.ToLower() && user.Applications.Any(app => app.alias == Constants.Applications.Media);
if (isValid)
AuthenticatedUser = user;
@@ -250,7 +251,7 @@ namespace umbraco.presentation.umbraco.webservices
private void CreateMediaTree(IEnumerable<Media> nodes, FolderListItem folder)
{
foreach (var media in nodes.Where(media => media != null && media.ContentType != null && media.ContentType.Alias == "Folder"))
foreach (var media in nodes.Where(media => media != null && media.ContentType != null && media.ContentType.Alias == Constants.Conventions.MediaTypes.Folder))
{
var subFolder = new FolderListItem
{
@@ -303,7 +304,7 @@ namespace umbraco.presentation.umbraco.webservices
}
}
var media = Media.MakeNew(name, MediaType.GetByAlias("Folder"), User.GetUser(0), parent.Id);
var media = Media.MakeNew(name, MediaType.GetByAlias(Constants.Conventions.MediaTypes.Folder), User.GetUser(0), parent.Id);
media.sortOrder = 0;
media.Save();

View File

@@ -11,6 +11,7 @@ using Umbraco.Web.Security;
using umbraco.BasePages;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
namespace umbraco.presentation.webservices
{
@@ -36,7 +37,7 @@ namespace umbraco.presentation.webservices
// Root nodes?
if (ParentId == -1)
{
if (App == "media")
if (App == Constants.Applications.Media)
{
foreach (cms.businesslogic.media.Media child in cms.businesslogic.media.Media.GetRootMedias())
nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
@@ -48,7 +49,7 @@ namespace umbraco.presentation.webservices
else
{
// "hack for stylesheet"
if (App == "settings")
if (App == Constants.Applications.Settings)
{
var styleSheet = new StyleSheet(cmsNode.Id);
foreach (var child in styleSheet.Properties)
@@ -83,8 +84,8 @@ namespace umbraco.presentation.webservices
{
var tmp = SortOrder.Split(',');
var isContent = Context.Request.GetItemAsString("app") == "content" | helper.Request("app") == "";
var isMedia = Context.Request.GetItemAsString("app") == "media";
var isContent = Context.Request.GetItemAsString("app") == Constants.Applications.Content | helper.Request("app") == "";
var isMedia = Context.Request.GetItemAsString("app") == Constants.Applications.Media;
for (var i = 0; i < tmp.Length; i++)
{
@@ -136,7 +137,7 @@ namespace umbraco.presentation.webservices
}
// fire actionhandler, check for content
if ((helper.Request("app") == "content" | helper.Request("app") == "") && ParentId > 0)
if ((helper.Request("app") == Constants.Applications.Content | helper.Request("app") == "") && ParentId > 0)
global::umbraco.BusinessLogic.Actions.Action.RunActionHandlers(new Document(ParentId), ActionSort.Instance);
}
}