OOPS! didn't mean to delete this a couple days ago :P

This commit is contained in:
Shannon
2013-10-02 15:56:53 +10:00
parent 36cb078073
commit 7eee954d4d
6 changed files with 165 additions and 0 deletions

View File

@@ -422,6 +422,12 @@
<Compile Include="Umbraco\controls\Images\ImageViewer.ascx.designer.cs">
<DependentUpon>ImageViewer.ascx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Create.aspx.cs">
<DependentUpon>create.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Create.aspx.designer.cs">
<DependentUpon>create.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Create\PartialView.ascx.cs">
<DependentUpon>PartialView.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -581,6 +587,7 @@
<Compile Include="Umbraco\TreeInit.aspx.designer.cs">
<DependentUpon>treeInit.aspx</DependentUpon>
</Compile>
<Content Include="Umbraco\create.aspx" />
<Content Include="Umbraco_Client\IconPicker\iconpicker.js" />
<Content Include="App_Plugins\MyPackage\Common\Js\MyPackage.js" />
<Content Include="App_Plugins\MyPackage\PropertyEditors\Js\CsvEditor.js" />

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using Umbraco.Core;
using Umbraco.Core.IO;
using umbraco.cms.presentation.Trees;
namespace Umbraco.Web.UI.Umbraco
{
public partial class CreateDialog : global::umbraco.cms.presentation.Create
{
protected override void OnLoad(EventArgs e)
{
if (SecurityCheck(Request.QueryString["nodeType"]))
{
//if we're allowed, then continue
base.OnLoad(e);
}
else
{
//otherwise show an error
UI.Visible = false;
AccessError.Visible = true;
}
}
private bool SecurityCheck(string nodeTypeAlias)
{
return LegacyDialogHandler.UserHasCreateAccess(
new HttpContextWrapper(Context),
getUser(),
nodeTypeAlias);
}
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Web.UI.Umbraco {
public partial class CreateDialog
{
/// <summary>
/// AccessError 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 AccessError;
}
}

View File

@@ -0,0 +1,43 @@
<%@ Page Language="c#" MasterPageFile="masterpages/umbracoDialog.Master" Codebehind="CreateDialog.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.CreateDialog" %>
<%@ Register Namespace="umbraco" TagPrefix="umb" Assembly="umbraco" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
var preExecute;
function doSubmit() { document.forms[0].submit(); }
var functionsFrame = this;
var tabFrame = this;
var isDialog = true;
var submitOnEnter = true;
</script>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="body">
<asp:PlaceHolder ID="UI" runat="server"></asp:PlaceHolder>
<asp:PlaceHolder runat="server" Visible="False" ID="AccessError">
<div class="error">
<p>
The current user does not have access to create this type of object
</p>
</div>
</asp:PlaceHolder>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="footer">
<script type="text/javascript">
function setFocusOnText() {
for (var i = 0; i < document.forms[0].length; i++) {
if (document.forms[0][i].type == 'text') {
document.forms[0][i].focus();
break;
}
}
}
<%if (!IsPostBack) { %>
setTimeout("setFocusOnText()", 100);
<%} %>
</script>
</asp:Content>