Removes legacy trashcan business logic class along with the legacy trashcan webforms files.

This commit is contained in:
Shannon
2016-03-22 14:46:27 +01:00
parent cdb58d7f8c
commit ed7003110b
11 changed files with 0 additions and 738 deletions

View File

@@ -830,10 +830,8 @@
<Content Include="Umbraco\Developer\Packages\LoadNitros.ascx" />
<Content Include="Umbraco\Developer\Packages\SubmitPackage.aspx" />
<Content Include="Umbraco\Dialogs\about.aspx" />
<Content Include="Umbraco\Dialogs\AssignDomain.aspx" />
<Content Include="Umbraco\Dialogs\create.aspx" />
<Content Include="Umbraco\Dialogs\cruds.aspx" />
<Content Include="Umbraco\Dialogs\emptyTrashcan.aspx" />
<Content Include="Umbraco\Dialogs\exportDocumenttype.aspx" />
<Content Include="Umbraco\Dialogs\importDocumenttype.aspx" />
<Content Include="Umbraco\Dialogs\insertMacro.aspx" />
@@ -1244,7 +1242,6 @@
<SubType>Form</SubType>
</Content>
<Content Include="Umbraco\Webservices\templates.asmx" />
<Content Include="Umbraco\Webservices\trashcan.asmx" />
<Content Include="Umbraco\Webservices\wsdl.xslt" />
<Content Include="Umbraco\Xslt\macroGetCurrent.xsl" />
<Content Include="Umbraco\Xslt\macroGetSubs.xsl" />

View File

@@ -1,47 +0,0 @@
<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="umbraco.dialogs.AssignDomain" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function doSubmit() { document.Form1["ok"].click(); }
var functionsFrame = this;
var tabFrame = this;
var isDialog = true;
var submitOnEnter = true;
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:Feedback ID="FeedBackMessage" runat="server" />
<cc1:Pane runat="server" ID="pane_addnew">
<cc1:PropertyPanel runat="server" ID="prop_domain" Text="Domain">
<asp:TextBox ID="DomainName" runat="server" Width="252px"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator" runat="server" Display="Dynamic" />
<asp:RegularExpressionValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator2" runat="server" Display="Dynamic" />
<br /><small><%= Services.TextService.Localize("assignDomain/domainHelp") %></small>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="prop_lang" runat="server" Text="language">
<asp:DropDownList ID="Languages" runat="server" />
<asp:RequiredFieldValidator ControlToValidate="Languages" ErrorMessage="*" ID="LanguageValidator" runat="server" Display="Dynamic" />
</cc1:PropertyPanel>
<cc1:PropertyPanel runat="server" Text=" ">
<asp:Button ID="ok" runat="server" OnClick="SaveDomain"></asp:Button>
</cc1:PropertyPanel>
</cc1:Pane>
<cc1:Pane ID="pane_edit" runat="server">
<cc1:PropertyPanel runat="server">
<asp:Literal ID="allDomains" runat="server" />
</cc1:PropertyPanel>
</cc1:Pane>
<p>
<a href="#" onclick="UmbClientMgr.closeModalWindow()"><%= Services.TextService.Localize("defaultdialogs/closeThisWindow")%></a>
</p>
</asp:Content>

View File

@@ -1,83 +0,0 @@
<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" Inherits="umbraco.presentation.dialogs.emptyTrashcan" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
var recycleBinType = '<%=BinType.ToString()%>';
var emptyTotal = '<%= umbraco.cms.businesslogic.RecycleBin.Count(BinType).ToString(CultureInfo.InvariantCulture)%>';
function emptyRecycleBin() {
jQuery('#formDiv').hide();
jQuery('#buttons').hide();
jQuery('#animation').show();
jQuery('#anim').attr("src","<%=umbraco.GlobalSettings.ClientPath%>/images/progressBar.gif");
// call the empty trashcan webservice
umbraco.presentation.webservices.trashcan.EmptyTrashcan(recycleBinType);
// wait one second to start the status update
setTimeout('updateStatus();', 1000);
}
function updateStatus() {
umbraco.presentation.webservices.trashcan.GetTrashStatus(updateStatusLabel, failure);
}
function failure(retVal) {
alert('error: ' + retVal);
}
function updateStatusLabel(retVal) {
jQuery('#statusLabel').html("<strong>" + retVal + " <%=Services.TextService.Localize("remaining")%></strong>");
if (retVal != '' && retVal != '0') {
setTimeout('updateStatus();', 500);
} else {
jQuery('#div_form').hide();
jQuery('#notification').show();
jQuery('#notification').html("<p><%=Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")%> </p> <p><a href='#' onclick='UmbClientMgr.closeModalWindow()'><%= Services.TextService.Localize("defaultdialogs/closeThisWindow")%></a></p>");
UmbClientMgr.mainTree().reloadActionNode();
}
}
</script>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="body">
<div class="success" id="notification" style="display: none;"></div>
<div id="div_form">
<cc1:Pane id="pane_form" runat="server">
<cc1:PropertyPanel runat="server">
<div id="animation" align="center" style="display: none;">
<p><%= Services.TextService.Localize("defaultdialogs/recycleBinDeleting")%></p>
<cc1:ProgressBar ID="progbar" runat="server" Title="Please wait..." />
<br />
<span class="guiDialogTiny" id="statusLabel"><%=Services.TextService.Localize("deleting")%></span>
</div>
<div id="formDiv">
<p><%= Services.TextService.Localize("defaultdialogs/recycleBinWarning")%></p>
<input type="checkbox" id="confirmDelete" onclick="$get('ok').disabled = !this.checked;" /> <label for="confirmDelete"><%=Services.TextService.Localize("defaultdialogs/confirmEmptyTrashcan", new[] { umbraco.cms.businesslogic.RecycleBin.Count(BinType).ToString(CultureInfo.InvariantCulture)})%></label>
</div>
</cc1:PropertyPanel>
</cc1:Pane>
<br />
<div id="buttons">
<input type="button" ID="ok" value="<%=Services.TextService.Localize("actions/emptyTrashcan") %>" class="guiInputButton" onclick="if ($get('confirmDelete').checked) {emptyRecycleBin();}" disabled="true" />
<em><%= Services.TextService.Localize("or") %></em>
<a href="#" onclick="UmbClientMgr.closeModalWindow();">
<%=Services.TextService.Localize("cancel")%>
</a>
</div>
</div>
</asp:Content>

View File

@@ -1 +0,0 @@
<%@ WebService Language="C#" CodeBehind="trashcan.asmx.cs" Class="umbraco.presentation.webservices.trashcan" %>

View File

@@ -928,15 +928,9 @@
<Compile Include="umbraco.presentation\umbraco\dialogs\ProtectPage.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\emptyTrashcan.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\create.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\AssignDomain.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\dialogs\AssignDomain2.aspx.cs">
<DependentUpon>AssignDomain2.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1670,10 +1664,6 @@
<DependentUpon>templates.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\webservices\trashcan.asmx.cs">
<DependentUpon>trashcan.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco.presentation\umbraco\Web\UI\ContentPage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@@ -1849,7 +1839,6 @@
<SubType>Form</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\webservices\templates.asmx" />
<Content Include="umbraco.presentation\umbraco\webservices\trashcan.asmx" />
<None Include="umbraco.presentation\umbraco\Trees\Trees.cd" />
<None Include="umbraco.presentation\umbraco\Trees\XmlTree.xsd">
<SubType>

View File

@@ -1,271 +0,0 @@
using System;
using System.Globalization;
using System.Web.UI.WebControls;
using Umbraco.Web;
using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.web;
using Umbraco.Core;
using Umbraco.Web.UI.Pages;
using Umbraco.Core.Services;
namespace umbraco.dialogs
{
/// <summary>
/// Summary description for AssignDomain.
/// </summary>
public partial class AssignDomain : UmbracoEnsuredPage
{
private int _currentId;
private int _editDomain;
public AssignDomain()
{
CurrentApp = Constants.Applications.Content.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
_currentId = Request.GetItemAs<int>("id");
prop_domain.Text = Services.TextService.Localize("assignDomain/domain");
prop_lang.Text = Services.TextService.Localize("general/language");
pane_addnew.Text = Services.TextService.Localize("assignDomain/addNew");
pane_edit.Text = Services.TextService.Localize("assignDomain/orEdit");
if (Request.GetItemAsString("editDomain").Trim() != "")
{
_editDomain = Request.GetItemAs<int>("editDomain");
}
if (Request.GetItemAsString("delDomain").Trim() != "")
{
var d = new Domain(Request.GetItemAs<int>("delDomain"));
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
FeedBackMessage.Text = Services.TextService.Localize("assignDomain/domainDeleted", new[] { d.Name });
d.Delete();
UpdateDomainList();
}
if (!IsPostBack)
{
// Add caption to button
ok.Text = Services.TextService.Localize("assignDomain/addNew");
var selectedLanguage = -1;
// Maybe add editing info - not the best way this is made ;-)
if (_editDomain > 0)
{
var d = new Domain(_editDomain);
selectedLanguage = d.Language.id;
DomainName.Text = d.Name.StartsWith("*") ? "*" : d.Name;
ok.Text = Services.TextService.Localize("general/update");
}
// Add caption to language validator
LanguageValidator.ErrorMessage = Services.TextService.Localize("defaultdialogs/requiredField") + "<br/>";
DomainValidator.ErrorMessage = Services.TextService.Localize("defaultdialogs/requiredField");
DomainValidator2.ErrorMessage = Services.TextService.Localize("assignDomain/invalidDomain");
//DomainValidator2.ValidationExpression = @"^(?i:http[s]?://)?([-\w]+(\.[-\w]+)*)(:\d+)?(/[-\w]*)?$";
DomainValidator2.ValidationExpression = @"^(\*|((?i:http[s]?://)?([-\w]+(\.[-\w]+)*)(:\d+)?(/[-\w]*)?))$";
Languages.Items.Add(new ListItem(Services.TextService.Localize("general/choose"), ""));
foreach (var l in Language.GetAllAsList())
{
var li = new ListItem();
li.Text = l.FriendlyName;
li.Value = l.id.ToString(CultureInfo.InvariantCulture);
if (selectedLanguage == l.id)
li.Selected = true;
Languages.Items.Add(li);
}
}
UpdateDomainList();
}
private void UpdateDomainList()
{
var domainList = Domain.GetDomainsById(_currentId);
if (domainList.Length > 0)
{
allDomains.Text = "<table border=\"0\" cellspacing=\"10\">";
foreach (var d in domainList)
{
var name = d.Name.StartsWith("*") ? "*" : d.Name;
allDomains.Text += "<tr><td>" + name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + _currentId + "&editDomain=" +
d.Id.ToString(CultureInfo.InvariantCulture) + "\">" + Services.TextService.Localize("edit") + "</a></td><td><a href=\"?id=" + _currentId +
"&delDomain=" + d.Id.ToString(CultureInfo.InvariantCulture) + "\" onClick=\"return confirm('" +
Services.TextService.Localize("defaultdialogs/confirmdelete") +
"');\" style=\"color: red\">" + Services.TextService.Localize("delete") + "</a></td></tr>";
}
allDomains.Text += "</table>";
pane_edit.Visible = true;
}
else
{
pane_edit.Visible = false;
}
}
protected void SaveDomain(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (_editDomain > 0)
{
var d = new Domain(_editDomain);
d.Language = new Language(int.Parse(Languages.SelectedValue));
d.Name = DomainName.Text.ToLower();
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
FeedBackMessage.Text = Services.TextService.Localize("assignDomain/domainUpdated", new[] { DomainName.Text });
d.Save();
DomainName.Text = "";
Languages.SelectedIndex = 0;
UpdateDomainList();
//this is probably the worst webform I've ever seen...
Response.Redirect("AssignDomain.aspx?id=" + _currentId.ToString());
}
else
{
// have to handle wildcard
var domainName = DomainName.Text.Trim();
domainName = domainName == "*" ? ("*" + _currentId.ToString(CultureInfo.InvariantCulture)) : domainName;
if (!Domain.Exists(domainName.ToLower()))
{
Domain.MakeNew(domainName, _currentId, int.Parse(Languages.SelectedValue));
FeedBackMessage.Text = Services.TextService.Localize("assignDomain/domainCreated", new[] { domainName });
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.success;
DomainName.Text = "";
Languages.SelectedIndex = 0;
UpdateDomainList();
//this is probably the worst webform I've ever seen...
Response.Redirect("AssignDomain.aspx?id=" + _currentId.ToString());
}
else
{
FeedBackMessage.Text = Services.TextService.Localize("assignDomain/domainExists", new[] { DomainName.Text.Trim() });
FeedBackMessage.type = uicontrols.Feedback.feedbacktype.error;
}
}
}
}
/// <summary>
/// FeedBackMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback FeedBackMessage;
/// <summary>
/// pane_addnew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_addnew;
/// <summary>
/// prop_domain control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel prop_domain;
/// <summary>
/// DomainName 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.TextBox DomainName;
/// <summary>
/// DomainValidator 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.RequiredFieldValidator DomainValidator;
/// <summary>
/// DomainValidator2 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.RegularExpressionValidator DomainValidator2;
/// <summary>
/// prop_lang control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel prop_lang;
/// <summary>
/// Languages 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.DropDownList Languages;
/// <summary>
/// LanguageValidator 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.RequiredFieldValidator LanguageValidator;
/// <summary>
/// ok 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.Button ok;
/// <summary>
/// pane_edit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_edit;
/// <summary>
/// allDomains 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 allDomains;
}
}

View File

@@ -1,66 +0,0 @@
using System;
using System.Web.UI;
using Umbraco.Core;
using Umbraco.Web;
using umbraco.cms.businesslogic;
using Umbraco.Web.UI.Pages;
namespace umbraco.presentation.dialogs
{
public partial class emptyTrashcan : UmbracoEnsuredPage
{
private RecycleBin.RecycleBinType? _binType;
protected RecycleBin.RecycleBinType BinType
{
get
{
if (_binType == null)
{
_binType = Enum<RecycleBin.RecycleBinType>.Parse(Request.GetItemAsString("type"), true);
}
return _binType.Value;
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
var recycleBinType = Request.GetItemAsString("type");
if (Security.ValidateUserApp(recycleBinType) == false)
{
throw new InvalidOperationException("The user does not have access to the requested app");
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/trashcan.asmx"));
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
}
/// <summary>
/// pane_form control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_form;
/// <summary>
/// progbar control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.ProgressBar progbar;
}
}

View File

@@ -1 +0,0 @@
<%@ WebService Language="C#" CodeBehind="trashcan.asmx.cs" Class="umbraco.presentation.webservices.trashcan" %>

View File

@@ -1,72 +0,0 @@
using System;
using System.Web.Script.Services;
using System.Web.Services;
using System.ComponentModel;
using Umbraco.Web.WebServices;
using umbraco.cms.businesslogic;
using Umbraco.Core;
namespace umbraco.presentation.webservices
{
/// <summary>
/// Summary description for trashcan
/// </summary>
[WebService(Namespace = "http://umbraco.org/webservices")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class trashcan : UmbracoAuthorizedWebService
{
[WebMethod]
public void EmptyTrashcan(RecycleBin.RecycleBinType type)
{
//validate against the app type!
switch (type)
{
case RecycleBin.RecycleBinType.Content:
if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return;
break;
case RecycleBin.RecycleBinType.Media:
if (!AuthorizeRequest(Constants.Applications.Media.ToString())) return;
break;
default:
throw new ArgumentOutOfRangeException("type");
}
//TODO: This will never work in LB scenarios
Application["trashcanEmptyLeft"] = RecycleBin.Count(type).ToString();
emptyTrashCanDo(type);
}
[WebMethod]
public string GetTrashStatus()
{
//TODO: This will never work in LB scenarios
if (AuthorizeRequest())
{
return Application["trashcanEmptyLeft"] != null
? Application["trashcanEmptyLeft"].ToString()
: "";
}
return "-";
}
private void emptyTrashCanDo(RecycleBin.RecycleBinType type)
{
var trashCan = new RecycleBin(type);
var callback = new Action<int>(x =>
{
Application.Lock();
Application["trashcanEmptyLeft"] = x.ToString();
Application.UnLock();
});
trashCan.CallTheGarbageMan(callback);
}
}
}

View File

@@ -1,182 +0,0 @@
using System;
using System.Linq;
using Umbraco.Core;
using umbraco.DataLayer;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic.media;
namespace umbraco.cms.businesslogic
{
public class RecycleBin : CMSNode
{
/// <summary>
/// The types of Recycle Bins.
/// </summary>
/// <remarks>
/// Each enum item represents the integer value of the node Id of the recycle bin in the database.
/// </remarks>
public enum RecycleBinType
{
Content = Constants.System.RecycleBinContent,
Media = Constants.System.RecycleBinMedia
}
private const string m_ChildCountSQL = @"select count(id) from umbracoNode where nodeObjectType = @nodeObjectType and path like '%,{0},%'";
private const string m_ChildSQL = @"SELECT id, createDate, trashed, parentId, nodeObjectType, nodeUser, level, path, sortOrder, uniqueID, text FROM umbracoNode where ParentID = @parentId And nodeObjectType = @type order by sortOrder";
private static object m_Locker = new object();
#region Private variables
private Guid _nodeObjectType;
private RecycleBinType m_BinType;
#endregion
#region Constructors
/// <summary>
/// Constructor to create a new recycle bin
/// </summary>
/// <param name="nodeObjectType"></param>
/// <param name="type"></param>
[Obsolete("Use the simple constructor that has the RecycleBinType only parameter")]
public RecycleBin(Guid nodeObjectType, RecycleBinType type)
: base((int)type)
{
_nodeObjectType = nodeObjectType;
m_BinType = type;
}
/// <summary>
/// Constructor to create a new recycle bin based on RecycleBinType
/// Will automatically update internal nodeObjectType based on the RecycleBinType enum
/// </summary>
/// <param name="type"></param>
public RecycleBin(RecycleBinType type)
: base((int)type)
{
switch (type)
{
case RecycleBinType.Content:
_nodeObjectType = Document._objectType;
m_BinType = RecycleBinType.Content;
break;
case RecycleBinType.Media:
_nodeObjectType = Media._objectType;
m_BinType = RecycleBinType.Media;
break;
}
}
/// <summary>
/// Old constructor to create a content recycle bin
/// </summary>
/// <param name="nodeObjectType"></param>
[Obsolete("Use the simple constructor that has the RecycleBinType only parameter")]
public RecycleBin(Guid nodeObjectType)
: this(nodeObjectType, RecycleBinType.Content) { }
#endregion
#region Static methods
/// <summary>
/// Get the number of items in the Recycle Bin
/// </summary>
/// <returns>The number of all items in the Recycle Bin</returns>
[Obsolete("Create a RecycleBin object to get the count per recycle bin type", true)]
public static int Count()
{
return Count(RecycleBinType.Content);
}
public static int Count(RecycleBinType type)
{
Guid objectType = Document._objectType;
switch (type)
{
case RecycleBinType.Content:
objectType = Document._objectType;
break;
case RecycleBinType.Media:
objectType = Media._objectType;
break;
}
string sql = String.Format(RecycleBin.m_ChildCountSQL,
(int) type);
return SqlHelper.ExecuteScalar<int>(sql, SqlHelper.CreateParameter("@nodeObjectType", objectType));
}
#endregion
#region Public methods
/// <summary>
/// If I smell, I'm not empty
/// </summary>
public bool Smells()
{
return RecycleBin.Count(m_BinType) > 0;
}
/// <summary>
/// Empties the trash can
/// </summary>
/// <param name="itemDeletedCallback">a function to call whenever an item is removed from the bin</param>
public void CallTheGarbageMan(Action<int> itemDeletedCallback)
{
lock (m_Locker)
{
var itemsInTheBin = Count(m_BinType);
itemDeletedCallback(itemsInTheBin);
if (m_BinType == RecycleBinType.Media)
{
ApplicationContext.Current.Services.MediaService.EmptyRecycleBin();
var trashedMedia = ApplicationContext.Current.Services.MediaService.GetMediaInRecycleBin();
itemsInTheBin = trashedMedia.Count();
}
else
{
ApplicationContext.Current.Services.ContentService.EmptyRecycleBin();
var trashedContent = ApplicationContext.Current.Services.ContentService.GetContentInRecycleBin();
itemsInTheBin = trashedContent.Count();
}
itemDeletedCallback(itemsInTheBin);
}
}
#endregion
#region Public properties
public override CMSNode[] Children
{
get
{
System.Collections.ArrayList tmp = new System.Collections.ArrayList();
using (IRecordsReader dr = SqlHelper.ExecuteReader(m_ChildSQL,
SqlHelper.CreateParameter("@parentId", this.Id),
SqlHelper.CreateParameter("@type", _nodeObjectType)))
{
while (dr.Read())
{
tmp.Add(new CMSNode(dr));
}
}
CMSNode[] retval = new CMSNode[tmp.Count];
for (int i = 0; i < tmp.Count; i++)
{
retval[i] = (CMSNode)tmp[i];
}
return retval;
}
}
#endregion
}
}

View File

@@ -243,7 +243,6 @@
<Compile Include="businesslogic\propertytype\propertytype.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="businesslogic\RecycleBin.cs" />
<Compile Include="businesslogic\relation\Relation.cs">
<SubType>Code</SubType>
</Compile>