Fixes jquery 1.4.2 bugs, tree fully working with persistence between apps and much faster too :)

Also fixes: 26476, 26584 (Individual deletion from recycle bins, context menus for recycle bin items)

[TFS Changeset #65349]
This commit is contained in:
Shandem
2010-04-08 13:27:33 +00:00
parent 5ccde01a54
commit 545fec4cfe
36 changed files with 2060 additions and 1846 deletions

View File

@@ -929,7 +929,8 @@ namespace umbraco.cms.businesslogic.web
{
umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance);
UnPublish();
Move(-20);
Move((int)RecycleBin.RecycleBinType.Content);
FireAfterMoveToTrash(e);
}

View File

@@ -475,6 +475,12 @@
<Compile Include="umbraco\controls\Tree\TreeControl.ascx.designer.cs">
<DependentUpon>TreeControl.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\create\contentItemTasks.cs" />
<Compile Include="umbraco\create\contentItemTypeTasks.cs" />
<Compile Include="umbraco\create\contentTasks.cs" />
<Compile Include="umbraco\create\CreatedPackageTasks.cs" />
<Compile Include="umbraco\create\DataTypeTasks.cs" />
<Compile Include="umbraco\create\dictionaryTasks.cs" />
<Compile Include="umbraco\create\DLRScripting.ascx.cs">
<DependentUpon>DLRScripting.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -482,6 +488,22 @@
<Compile Include="umbraco\create\DLRScripting.ascx.designer.cs">
<DependentUpon>DLRScripting.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\create\DLRScriptingTasks.cs" />
<Compile Include="umbraco\create\macroTasks.cs" />
<Compile Include="umbraco\create\mediaTasks.cs" />
<Compile Include="umbraco\create\MediaTypeTasks.cs" />
<Compile Include="umbraco\create\MemberGroupTasks.cs" />
<Compile Include="umbraco\create\memberTasks.cs" />
<Compile Include="umbraco\create\MemberTypeTasks.cs" />
<Compile Include="umbraco\create\NewMemberUIEventArgs.cs" />
<Compile Include="umbraco\create\nodetypeTasks.cs" />
<Compile Include="umbraco\create\PythonTasks.cs" />
<Compile Include="umbraco\create\ScriptTasks.cs" />
<Compile Include="umbraco\create\stylesheetPropertyTasks.cs" />
<Compile Include="umbraco\create\StylesheetTasks.cs" />
<Compile Include="umbraco\create\templateTasks.cs" />
<Compile Include="umbraco\create\userTasks.cs" />
<Compile Include="umbraco\create\XsltTasks.cs" />
<Compile Include="umbraco\dialogs\Preview.aspx.cs">
<DependentUpon>Preview.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -617,7 +639,7 @@
<Compile Include="umbraco\create\simple.ascx.designer.cs">
<DependentUpon>simple.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\create\standardTasks.cs">
<Compile Include="umbraco\create\languageTasks.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="umbraco\create\xslt.ascx.cs">

View File

@@ -33,23 +33,6 @@ namespace umbraco.cms.presentation.Trees
public ContentRecycleBin(string application) : base(application) { }
private string m_treeAlias;
/// <summary>
/// Change the tree alias so that it is the same as the content tree
/// </summary>
public override string TreeAlias
{
get
{
if (string.IsNullOrEmpty(m_treeAlias))
{
TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree<loadContent>();
m_treeAlias = (treeDef != null ? treeDef.Tree.Alias : "content");
}
return m_treeAlias;
}
}
protected override void CreateRootNodeActions(ref List<IAction> actions)
{
actions.Clear();
@@ -93,7 +76,7 @@ namespace umbraco.cms.presentation.Trees
{
get
{
return -20;
return (int)RecycleBin.RecycleBinType.Content;
}
}
@@ -103,16 +86,6 @@ namespace umbraco.cms.presentation.Trees
/// <param name="Javascript"></param>
public override void RenderJS(ref StringBuilder Javascript) { }
///// <summary>
///// Returns the tree service url to render the tree. Ensures that IsRecycleBin is flagged.
///// </summary>
///// <returns></returns>
//public override string GetTreeInitUrl()
//{
// TreeService treeSvc = new TreeService(true, this.StartNodeID, TreeAlias, null, null, "", "");
// return treeSvc.GetInitUrl();
//}
protected override void OnRenderNode(ref XmlTreeNode xNode, Document doc)
{
xNode.Style.DimNode();

View File

@@ -36,23 +36,6 @@ namespace umbraco.cms.presentation.Trees
}
private string m_treeAlias;
/// <summary>
/// Change the tree alias so that it is the same as the media tree
/// </summary>
public override string TreeAlias
{
get
{
if (string.IsNullOrEmpty(m_treeAlias))
{
TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree<loadMedia>();
m_treeAlias = (treeDef != null ? treeDef.Tree.Alias : "media");
}
return m_treeAlias;
}
}
protected override void CreateRootNodeActions(ref List<IAction> actions)
{
actions.Clear();
@@ -78,7 +61,7 @@ namespace umbraco.cms.presentation.Trees
{
get
{
return -21;
return (int)RecycleBin.RecycleBinType.Media;
}
}

View File

@@ -50,6 +50,13 @@
<delete assembly="umbraco" type="XsltTasks" />
</tasks>
</nodeType>
<nodeType alias="contentRecycleBin">
<header>Page</header>
<usercontrol>/create/content.ascx</usercontrol>
<tasks>
<delete assembly="umbraco" type="contentTasks" />
</tasks>
</nodeType>
<nodeType alias="content">
<header>Page</header>
<usercontrol>/create/content.ascx</usercontrol>
@@ -129,6 +136,13 @@
<delete assembly="umbraco" type="MediaTypeTasks" />
</tasks>
</nodeType>
<nodeType alias="mediaRecycleBin">
<header>Media</header>
<usercontrol>/create/media.ascx</usercontrol>
<tasks>
<delete assembly="umbraco" type="mediaTasks" />
</tasks>
</nodeType>
<nodeType alias="media">
<header>Media</header>
<usercontrol>/create/media.ascx</usercontrol>

View File

@@ -0,0 +1,67 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class CreatedPackageTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
umbraco.BusinessLogic.User myUser = new umbraco.BusinessLogic.User(0);
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Delete, myUser, 0, "Xml save started");
int id = cms.businesslogic.packager.CreatedPackage.MakeNew(Alias).Data.Id;
m_returnUrl = string.Format("developer/packages/editPackage.aspx?id={0}", id);
return true;
}
public bool Delete()
{
cms.businesslogic.packager.CreatedPackage.GetById(ParentID).Delete();
return true;
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,141 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class DLRScriptingTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set
{
_userID = value;
}
}
public int TypeID
{
get
{
return _typeID;
}
set
{
_typeID = value;
}
}
public string Alias
{
get
{
return _alias;
}
set
{
_alias = value;
}
}
public int ParentID
{
get
{
return _parentID;
}
set
{
_parentID = value;
}
}
public bool Save()
{
string template = _alias.Substring(0, _alias.IndexOf("|||")).Trim();
string fileName = _alias.Substring(_alias.IndexOf("|||") + 3, _alias.Length - _alias.IndexOf("|||") - 3).Replace(" ", "");
if (!fileName.Contains("."))
fileName = _alias + ".py";
string scriptContent = "";
if (!string.IsNullOrEmpty(template))
{
System.IO.StreamReader templateFile = System.IO.File.OpenText(IOHelper.MapPath(IO.SystemDirectories.Umbraco + "/scripting/templates/" + template));
scriptContent = templateFile.ReadToEnd();
templateFile.Close();
}
if (fileName.Contains("/")) //if there's a / create the folder structure for it
{
string[] folders = fileName.Split("/".ToCharArray());
string basePath = IOHelper.MapPath(SystemDirectories.Python);
for (int i = 0; i < folders.Length - 1; i++)
{
basePath = System.IO.Path.Combine(basePath, folders[i]);
System.IO.Directory.CreateDirectory(basePath);
}
}
string abFileName = IOHelper.MapPath(SystemDirectories.Python + "/" + fileName);
System.IO.StreamWriter scriptWriter = System.IO.File.CreateText(abFileName);
scriptWriter.Write(scriptContent);
scriptWriter.Flush();
scriptWriter.Close();
if (ParentID == 1)
{
cms.businesslogic.macro.Macro m = cms.businesslogic.macro.Macro.MakeNew(
helper.SpaceCamelCasing(fileName.Substring(0, (fileName.LastIndexOf('.') + 1)).Trim('.')));
m.ScriptingFile = fileName;
}
m_returnUrl = string.Format(SystemDirectories.Umbraco + "/developer/python/editPython.aspx?file={0}", fileName);
return true;
}
public bool Delete()
{
string path = IOHelper.MapPath(SystemDirectories.Python + "/" + Alias.TrimStart('/'));
System.Web.HttpContext.Current.Trace.Warn("", "*" + path + "*");
try
{
System.IO.File.Delete(path);
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, UmbracoEnsuredPage.CurrentUser, -1, "Could not remove XSLT file " + Alias + ". ERROR: " + ex.Message);
}
return true;
}
public DLRScriptingTasks()
{
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,74 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class DataTypeTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int id = cms.businesslogic.datatype.DataTypeDefinition.MakeNew(BusinessLogic.User.GetUser(_userID), Alias).Id;
m_returnUrl = string.Format("developer/datatypes/editDataType.aspx?id={0}", id);
return true;
}
public bool Delete()
{
cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(ParentID).delete();
return true;
}
public DataTypeTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class MediaTypeTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int id = cms.businesslogic.media.MediaType.MakeNew(BusinessLogic.User.GetUser(_userID), Alias.Replace("'", "''")).Id;
m_returnUrl = string.Format("settings/editMediaType.aspx?id={0}", id);
return true;
}
public bool Delete()
{
new cms.businesslogic.media.MediaType(_parentID).delete();
return false;
}
public MediaTypeTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class MemberGroupTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
System.Web.Security.Roles.CreateRole(Alias);
// int id = cms.businesslogic.member.MemberGroup.MakeNew(Alias, BusinessLogic.User.GetUser(_userID)).Id;
m_returnUrl = string.Format("members/EditMemberGroup.aspx?id={0}", System.Web.HttpContext.Current.Server.UrlEncode(Alias));
return true;
}
public bool Delete()
{
// only build-in roles can be deleted
if (cms.businesslogic.member.Member.IsUsingUmbracoRoles())
{
cms.businesslogic.member.MemberGroup.GetByName(Alias).delete();
return true;
}
else
{
return false;
}
//try
//{
// MembershipUser u = Membership.GetUser(_parentID);
// Membership.DeleteUser(u.UserName);
// return true;
//}catch
//{
// Log.Add(LogTypes.Error, _parentID, "Member cannot be deleted.");
// return false;
//}
}
public MemberGroupTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class MemberTypeTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int id = cms.businesslogic.member.MemberType.MakeNew(BusinessLogic.User.GetUser(_userID), Alias).Id;
m_returnUrl = string.Format("members/EditMemberType.aspx?id={0}", id);
return true;
}
public bool Delete()
{
new cms.businesslogic.member.MemberType(_parentID).delete();
return true;
}
public MemberTypeTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class NewMemberUIEventArgs : System.ComponentModel.CancelEventArgs
{
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class PythonTasks : DLRScriptingTasks { }
}

View File

@@ -0,0 +1,90 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class ScriptTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
string[] scriptFileAr = _alias.Split('¤');
string relPath = scriptFileAr[0];
string fileName = scriptFileAr[1];
string fileType = scriptFileAr[2];
int createFolder = ParentID;
string basePath = IOHelper.MapPath(SystemDirectories.Scripts + "/" + relPath + fileName);
if (createFolder == 1)
{
System.IO.Directory.CreateDirectory(basePath);
}
else
{
System.IO.File.Create(basePath + "." + fileType).Close();
m_returnUrl = string.Format("settings/scripts/editScript.aspx?file={0}{1}.{2}", relPath, fileName, fileType);
}
return true;
}
public bool Delete()
{
string path = IOHelper.MapPath(SystemDirectories.Scripts + "/" + _alias.TrimStart('/'));
if (System.IO.File.Exists(path))
System.IO.File.Delete(path);
else if (System.IO.Directory.Exists(path))
System.IO.Directory.Delete(path, true);
BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Delete, umbraco.BasePages.UmbracoEnsuredPage.CurrentUser, -1, _alias + " Deleted");
return true;
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class StylesheetTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int id = cms.businesslogic.web.StyleSheet.MakeNew(BusinessLogic.User.GetUser(_userID), Alias, "", "").Id;
m_returnUrl = string.Format("settings/stylesheet/editStylesheet.aspx?id={0}", id);
return true;
}
public bool Delete()
{
cms.businesslogic.web.StyleSheet s = new cms.businesslogic.web.StyleSheet(ParentID);
s.delete();
return true;
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
/// <summary>
/// Summary description for standardTasks.
/// </summary>
///
public class XsltTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
string template = _alias.Substring(0, _alias.IndexOf("|||"));
string fileName = _alias.Substring(_alias.IndexOf("|||") + 3, _alias.Length - _alias.IndexOf("|||") - 3).Replace(" ", "");
string xsltTemplateSource = IOHelper.MapPath(SystemDirectories.Umbraco + "/xslt/templates/" + template);
string xsltNewFilename = IOHelper.MapPath(SystemDirectories.Xslt + "/" + fileName + ".xslt");
if (fileName.Contains("/")) //if there's a / create the folder structure for it
{
string[] folders = fileName.Split("/".ToCharArray());
string xsltBasePath = IOHelper.MapPath(SystemDirectories.Xslt);
for (int i = 0; i < folders.Length - 1; i++)
{
xsltBasePath = System.IO.Path.Combine(xsltBasePath, folders[i]);
System.IO.Directory.CreateDirectory(xsltBasePath);
}
}
// System.IO.File.Copy(xsltTemplateSource, xsltNewFilename, false);
// update with xslt references
string xslt = "";
System.IO.StreamReader xsltFile = System.IO.File.OpenText(xsltTemplateSource);
xslt = xsltFile.ReadToEnd();
xsltFile.Close();
// prepare support for XSLT extensions
xslt = macro.AddXsltExtensionsToHeader(xslt);
System.IO.StreamWriter xsltWriter = System.IO.File.CreateText(xsltNewFilename);
xsltWriter.Write(xslt);
xsltWriter.Flush();
xsltWriter.Close();
// Create macro?
if (ParentID == 1)
{
cms.businesslogic.macro.Macro m =
cms.businesslogic.macro.Macro.MakeNew(
helper.SpaceCamelCasing(_alias.Substring(_alias.IndexOf("|||") + 3, _alias.Length - _alias.IndexOf("|||") - 3)));
m.Xslt = fileName + ".xslt";
}
m_returnUrl = string.Format(SystemDirectories.Umbraco + "/developer/xslt/editXslt.aspx?file={0}.xslt", fileName);
return true;
}
public bool Delete()
{
string path = IOHelper.MapPath(SystemDirectories.Xslt + "/" + Alias.TrimStart('/'));
System.Web.HttpContext.Current.Trace.Warn("", "*" + path + "*");
try
{
System.IO.File.Delete(path);
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, UmbracoEnsuredPage.CurrentUser, -1, "Could not remove XSLT file " + Alias + ". ERROR: " + ex.Message);
}
return true;
}
public XsltTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,78 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class contentItemTasks : interfaces.ITask
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set
{
_parentID = value;
}
get
{
return _parentID;
}
}
public bool Save()
{
// TODO : fix it!!
return true;
}
public bool Delete()
{
cms.businesslogic.contentitem.ContentItem d = new cms.businesslogic.contentitem.ContentItem(ParentID);
// Version3.0 - moving to recycle bin instead of deletion
//d.delete();
d.Move(-20);
return true;
}
public bool Sort()
{
return false;
}
public contentItemTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class contentItemTypeTasks : interfaces.ITask
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
cms.businesslogic.contentitem.ContentItemType.MakeNew(BusinessLogic.User.GetUser(_userID), Alias);
return true;
}
public bool Delete()
{
new cms.businesslogic.contentitem.ContentItemType(_parentID).delete();
return true;
}
public contentItemTypeTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class contentTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
private string _returnUrl = "";
public int UserId
{
set { _userID = value; }
}
public string ReturnUrl
{
get { return _returnUrl; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set
{
_parentID = value;
}
get
{
return _parentID;
}
}
public bool Save()
{
cms.businesslogic.web.DocumentType dt = new cms.businesslogic.web.DocumentType(TypeID);
cms.businesslogic.web.Document d = cms.businesslogic.web.Document.MakeNew(Alias, dt, BusinessLogic.User.GetUser(_userID), ParentID);
if (d == null)
{
//TODO: Slace - Fix this to use the language files
BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Document Creation", "Document creation was canceled");
return false;
}
else
{
_returnUrl = "editContent.aspx?id=" + d.Id.ToString() + "&isNew=true";
return true;
}
}
public bool Delete()
{
cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(ParentID);
// Log
BasePages.UmbracoEnsuredPage bp = new BasePages.UmbracoEnsuredPage();
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, bp.getUser(), d.Id, "");
library.UnPublishSingleNode(d.Id);
d.delete();
return true;
}
public bool Sort()
{
return false;
}
public contentTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class dictionaryTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set
{
_parentID = value;
// NASTY HACK ON NASTY HACK§!!
// if (_parentID == 1) _parentID = -1;
}
get
{
return _parentID;
}
}
public bool Save()
{
//check to see if key is already there
if (cms.businesslogic.Dictionary.DictionaryItem.hasKey(Alias))
return false;
// Create new dictionary item if name no already exist
if (ParentID > 0)
{
int id = cms.businesslogic.Dictionary.DictionaryItem.addKey(Alias, "", new cms.businesslogic.Dictionary.DictionaryItem(ParentID).key);
m_returnUrl = string.Format("settings/editDictionaryItem.aspx?id={0}", id);
}
else
{
int id = cms.businesslogic.Dictionary.DictionaryItem.addKey(Alias, "");
m_returnUrl = string.Format("settings/editDictionaryItem.aspx?id={0}", id);
}
return true;
}
public bool Delete()
{
BusinessLogic.Log.Add(LogTypes.Debug, ParentID, _typeID.ToString() + " " + _parentID.ToString() + " deleting " + Alias);
new cms.businesslogic.Dictionary.DictionaryItem(ParentID).delete();
return true;
}
public bool Sort()
{
return false;
}
public dictionaryTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class languageTasks : interfaces.ITask
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
cms.businesslogic.language.Language.MakeNew(Alias);
return true;
}
public bool Delete()
{
new cms.businesslogic.language.Language(ParentID).Delete();
return false;
}
public languageTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,88 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class macroTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
protected static ISqlHelper SqlHelper
{
get { return Application.SqlHelper; }
}
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int id = umbraco.cms.businesslogic.macro.Macro.MakeNew(_alias).Id;
m_returnUrl = string.Format("developer/Macros/editMacro.aspx?macroID={0}", id);
return true;
}
public bool Delete()
{
// Release cache
System.Web.Caching.Cache macroCache = System.Web.HttpRuntime.Cache;
if (macroCache["umbMacro" + ParentID.ToString()] != null)
{
macroCache.Remove("umbMacro" + ParentID.ToString());
}
// Clear cache!
macro.ClearAliasCache();
new cms.businesslogic.macro.Macro(ParentID).Delete();
return true;
}
public macroTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,89 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class mediaTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
private string _returnUrl = "";
public int UserId
{
set { _userID = value; }
}
public string ReturnUrl
{
get { return _returnUrl; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set
{
_parentID = value;
}
get
{
return _parentID;
}
}
public bool Save()
{
cms.businesslogic.media.MediaType dt = new cms.businesslogic.media.MediaType(TypeID);
cms.businesslogic.media.Media m = cms.businesslogic.media.Media.MakeNew(Alias, dt, BusinessLogic.User.GetUser(_userID), ParentID);
_returnUrl = "editMedia.aspx?id=" + m.Id.ToString() + "&isNew=true";
return true;
}
public bool Delete()
{
cms.businesslogic.media.Media d = new cms.businesslogic.media.Media(ParentID);
// Log
BasePages.UmbracoEnsuredPage bp = new BasePages.UmbracoEnsuredPage();
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, bp.getUser(), d.Id, "");
d.delete();
return true;
}
public bool Sort()
{
return false;
}
public mediaTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,127 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class memberTasks : interfaces.ITaskReturnUrl
{
/// <summary>
/// The new event handler
/// </summary>
new public delegate void NewUIMemberEventHandler(Member sender, string unencryptedPassword, NewMemberUIEventArgs e);
new public static event NewUIMemberEventHandler NewMember;
new protected virtual void OnNewMember(NewMemberUIEventArgs e, string unencryptedPassword, Member m)
{
if (NewMember != null)
{
NewMember(m, unencryptedPassword, e);
}
}
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
private string _returnUrl = "";
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string ReturnUrl
{
get { return _returnUrl; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set
{
_parentID = value;
if (_parentID == 1) _parentID = -1;
}
get
{
return _parentID;
}
}
public bool Save()
{
string[] nameAndMail = Alias.Split("|".ToCharArray());
string name = nameAndMail[0];
string email = nameAndMail.Length > 0 ? nameAndMail[1] : "";
string password = nameAndMail.Length > 1 ? nameAndMail[2] : "";
if (cms.businesslogic.member.Member.InUmbracoMemberMode() && TypeID != -1)
{
cms.businesslogic.member.MemberType dt = new cms.businesslogic.member.MemberType(TypeID);
cms.businesslogic.member.Member m = cms.businesslogic.member.Member.MakeNew(name, dt, BusinessLogic.User.GetUser(_userID));
m.Password = password;
m.Email = email;
m.LoginName = name.Replace(" ", "").ToLower();
NewMemberUIEventArgs e = new NewMemberUIEventArgs();
this.OnNewMember(e, password, m);
_returnUrl = "members/editMember.aspx?id=" + m.Id.ToString();
}
else
{
MembershipCreateStatus mc = new MembershipCreateStatus();
Membership.CreateUser(name, password, email, "empty", "empty", true, out mc);
if (mc != MembershipCreateStatus.Success)
{
throw new Exception("Error creating Member: " + mc.ToString());
}
_returnUrl = "members/editMember.aspx?id=" + System.Web.HttpContext.Current.Server.UrlEncode(name);
}
return true;
}
public bool Delete()
{
//cms.businesslogic.member.Member d = new cms.businesslogic.member.Member(ParentID);
//d.delete();
//return true;
MembershipUser u = Membership.GetUser(Alias);
Membership.DeleteUser(u.UserName, true);
return true;
}
public bool Sort()
{
return false;
}
public memberTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class nodetypeTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
cms.businesslogic.web.DocumentType dt = cms.businesslogic.web.DocumentType.MakeNew(BusinessLogic.User.GetUser(_userID), Alias.Replace("'", "''"));
dt.IconUrl = "folder.gif";
// Create template?
if (ParentID == 1)
{
cms.businesslogic.template.Template[] t = { cms.businesslogic.template.Template.MakeNew(_alias, BusinessLogic.User.GetUser(_userID)) };
dt.allowedTemplates = t;
dt.DefaultTemplate = t[0].Id;
}
// Master Content Type?
if (TypeID != 0)
{
dt.MasterContentType = TypeID;
}
m_returnUrl = "settings/editNodeTypeNew.aspx?id=" + dt.Id.ToString();
return true;
}
public bool Delete()
{
new cms.businesslogic.web.DocumentType(ParentID).delete();
//after a document type is deleted, we clear the cache, as some content will now have disappeared.
library.RefreshContent();
return false;
}
public nodetypeTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class stylesheetPropertyTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
try
{
cms.businesslogic.web.StyleSheet s = new cms.businesslogic.web.StyleSheet(ParentID);
int id = s.AddProperty(Alias, BusinessLogic.User.GetUser(_userID)).Id;
m_returnUrl = string.Format("settings/stylesheet/property/EditStyleSheetProperty.aspx?id={0}", id);
}
catch
{
throw new ArgumentException("DER ER SKET EN FEJL MED AT OPRETTE NOGET MED ET PARENT ID : " + ParentID);
}
return true;
}
public bool Delete()
{
cms.businesslogic.web.StylesheetProperty sp = new cms.businesslogic.web.StylesheetProperty(ParentID);
cms.businesslogic.web.StyleSheet s = sp.StyleSheet();
s.saveCssToFile();
sp.delete();
return true;
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,83 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class templateTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public bool Save()
{
int masterId = ParentID;
BusinessLogic.Log.Add(LogTypes.Debug, -1, "tp id:" + masterId.ToString());
if (masterId > 0)
{
int id = cms.businesslogic.template.Template.MakeNew(Alias, BusinessLogic.User.GetUser(_userID), new cms.businesslogic.template.Template(masterId)).Id;
m_returnUrl = string.Format("settings/editTemplate.aspx?templateID={0}", id);
}
else
{
int id = cms.businesslogic.template.Template.MakeNew(Alias, BusinessLogic.User.GetUser(_userID)).Id;
m_returnUrl = string.Format("settings/editTemplate.aspx?templateID={0}", id);
}
return true;
}
public bool Delete()
{
new cms.businesslogic.template.Template(_parentID).delete();
return false;
}
public templateTasks()
{
//
// TODO: Add constructor logic here
//
}
#region ITaskReturnUrl Members
private string m_returnUrl = "";
public string ReturnUrl
{
get { return m_returnUrl; }
}
#endregion
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Data;
using System.Web.Security;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using umbraco.BasePages;
using umbraco.IO;
using umbraco.cms.businesslogic.member;
namespace umbraco
{
public class userTasks : interfaces.ITaskReturnUrl
{
private string _alias;
private int _parentID;
private int _typeID;
private int _userID;
private string _returnUrl = "";
public int UserId
{
set { _userID = value; }
}
public int TypeID
{
set { _typeID = value; }
get { return _typeID; }
}
public string Alias
{
set { _alias = value; }
get { return _alias; }
}
public int ParentID
{
set { _parentID = value; }
get { return _parentID; }
}
public string ReturnUrl
{
get { return _returnUrl; }
}
public bool Save()
{
// Hot damn HACK > user is allways UserType with id = 1 = administrator ???
// temp password deleted by NH
//BusinessLogic.User.MakeNew(Alias, Alias, "", BusinessLogic.UserType.GetUserType(1));
//return true;
MembershipCreateStatus status = MembershipCreateStatus.ProviderError;
try
{
// Password is auto-generated. They are they required to change the password by editing the user information.
MembershipUser u = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].CreateUser(Alias,
Membership.GeneratePassword(
Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredPasswordLength,
Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredNonAlphanumericCharacters),
"", "", "", true, null, out status);
_returnUrl = string.Format("users/EditUser.aspx?id={0}", u.ProviderUserKey.ToString());
return status == MembershipCreateStatus.Success;
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, ParentID, String.Format("Failed to create the user. Error from provider: {0}", status.ToString()));
Log.Add(LogTypes.Debug, ParentID, ex.Message);
return false;
}
}
public bool Delete()
{
BusinessLogic.User u = BusinessLogic.User.GetUser(ParentID);
u.disable();
return true;
}
public userTasks()
{
//
// TODO: Add constructor logic here
//
}
}
}

View File

@@ -101,8 +101,6 @@
<div id="umbModalBoxContent"><iframe frameborder="0" id="umbModalBoxIframe" src=""></iframe></div>
</div>
<script type="text/javascript">
//used for deeplinking to specific content whilst still showing the tree
@@ -114,35 +112,31 @@
UmbClientMgr.setUmbracoPath("<%=umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>");
jQuery(window).load(function() { resizePage('load'); });
jQuery(window).wresize(function() { resizePage('resize'); });
//call wresize first for IE/FF resize issues
jQuery(window).wresize(function() { resizePage(); });
resizePage();
//jQuery("#umbracoMainPageBody").css("background", "#fff");
jQuery("#umbracoMainPageBody").css("background", "#fff");
//wire up the history mgr
UmbClientMgr.historyManager().addEventHandler("navigating", function(e, app) {
//show modal wait dialog. TODO: Finish this
//jQuery("<div id='appLoading'>&nbsp;</div>").appendTo("body")
// .ModalWindowShow("", false, 300, 100, 300, 0)
// .closest(".umbModalBox").css("border", "none");
UmbClientMgr.appActions().shiftApp(app, uiKeys['sections_' + app]);
});
if (rightAction != '') {
//if an action is specified, then load it
UmbClientMgr.contentFrame(rightAction + ".aspx?id=" + rightActionId);
}
else {
// load dashboard
UmbClientMgr.contentFrame("dashboard.aspx?app=" + initApp);
}
//wire up the history mgr
UmbClientMgr.historyManager().addEventHandler("navigating", function(e, app) {
//show modal wait dialog. TODO: Finish this
//jQuery("<div id='appLoading'>&nbsp;</div>").appendTo("body")
// .ModalWindowShow("", false, 300, 100, 300, 0)
// .closest(".umbModalBox").css("border", "none");
UmbClientMgr.appActions().shiftApp(app, uiKeys['sections_' + app], true);
});
//add the history
UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp :
UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp :
UmbClientMgr.historyManager().getCurrent() != "" ? UmbClientMgr.historyManager().getCurrent() :
"content", true);
}
jQuery("#right").show();
});

View File

@@ -11,7 +11,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
var obj = {
onNavigate: function(e) {
jQuery(this).trigger("navigating", [$.param.fragment()]); //raise event!
var l = $.param.fragment();
if (l != "") {
jQuery(window.top).trigger("navigating", [$.param.fragment()]); //raise event!
}
},
addHistory: function(name, forceRefresh) {
if ($.param.fragment() == name && forceRefresh) {
@@ -28,11 +33,11 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
addEventHandler: function(fnName, fn) {
/// <summary>Adds an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(this).bind(fnName, fn); //if there's no jQuery, there is no events
if (typeof (jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
},
removeEventHandler: function(fnName, fn) {
/// <summary>Removes an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(this).unbind(fnName, fn); //if there's no jQuery, there is no events
if (typeof (jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
}
};

View File

@@ -24,12 +24,12 @@ Umbraco.Application.Actions = function() {
addEventHandler: function(fnName, fn) {
/// <summary>Adds an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(this).bind(fnName, fn); //if there's no jQuery, there is no events
if (typeof (jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
},
removeEventHandler: function(fnName, fn) {
/// <summary>Removes an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(this).unbind(fnName, fn); //if there's no jQuery, there is no events
if (typeof (jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
},
showSpeachBubble: function(ico, hdr, msg) {
@@ -78,17 +78,17 @@ Umbraco.Application.Actions = function() {
/// <summary>Logs the user out</summary>
if (confirm(UmbClientMgr.uiKeys()["defaultdialogs_confirmlogout"])) {
//raise beforeLogout event
jQuery(this).trigger("beforeLogout", []);
jQuery(window.top).trigger("beforeLogout", []);
document.location.href = 'logout.aspx';
}
return false;
},
shiftApp: function(whichApp, appName, ignoreDashboard) {
shiftApp: function(whichApp, appName) {
/// <summary>Changes the application</summary>
this._debug("shiftApp: " + whichApp + ", " + appName + ", " + ignoreDashboard);
this._debug("shiftApp: " + whichApp + ", " + appName);
UmbClientMgr.mainTree().saveTreeState(this._currApp == "" ? "content" : this._currApp);
@@ -112,18 +112,18 @@ Umbraco.Application.Actions = function() {
}
}
if (!ignoreDashboard) {
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
}
UmbClientMgr.mainTree().rebuildTree(whichApp);
UmbClientMgr.mainTree().rebuildTree(whichApp, function(args) {
//the callback will fire when the tree rebuilding is done, we
//need to check the args to see if the tree was rebuild from cache
//and if it had a previously selected node, if it didn't then load the dashboard.
if (!args) {
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
}
});
jQuery("#treeWindowLabel").html(appName);
UmbClientMgr.mainWindow().document.title = appName + this._windowTitle + window.location.hostname.toLowerCase().replace('www', '');
//TODO: Update this to use microsoft's history manager
//UmbClientMgr.mainWindow().location.hash = whichApp;
},
getCurrApp: function() {
@@ -185,7 +185,7 @@ Umbraco.Application.Actions = function() {
/// <summary></summary>
//raise nodeRefresh event
jQuery(this).trigger("nodeRefresh", []);
jQuery(window.top).trigger("nodeRefresh", []);
},
actionNotify: function() {
@@ -324,12 +324,12 @@ Umbraco.Application.Actions = function() {
if (confirm(uiKeys['defaultdialogs_confirmdelete'] + ' "' + UmbClientMgr.mainTree().getActionNode().nodeName + '"?\n\n')) {
//raise nodeDeleting event
jQuery(this).trigger("nodeDeleting", []);
jQuery(window.top).trigger("nodeDeleting", []);
var _this = this;
umbraco.presentation.webservices.legacyAjaxCalls.Delete(UmbClientMgr.mainTree().getActionNode().nodeId, "", UmbClientMgr.mainTree().getActionNode().nodeType, function() {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(_this).trigger("nodeDeleted", []);
jQuery(window.top).trigger("nodeDeleted", []);
});
}
},

View File

@@ -46,46 +46,39 @@
$.tree.plugins.UmbracoContext.settings = t.settings.plugins.UmbracoContext;
//need to remove the defaults
$.tree.plugins.contextmenu.defaults.items = {};
//add events to auto hide the menu on a delay
var pause = true;
var timer = null;
$("#jstree-contextmenu").bind("mouseenter", function() {
pause = true;
clearTimeout(timer);
});
$("#jstree-contextmenu").bind("mouseleave", function() {
pause = false;
timer = setTimeout(function() {
if (!pause) {
$.tree.plugins.contextmenu.hide();
}
}, 500);
});
//disable right clicking the context menu, this is for IE bug
$("#jstree-contextmenu").bind("contextmenu", function(e) {
e.preventDefault();
return false;
});
},
onrgtclk: function(n, t, e) {
///<summary>Need to set the context menu items for the context menu plugin for the current node</summary>
var _this = $.tree.plugins.UmbracoContext;
var menu = _this.settings.onBeforeContext.call(this, n, t, e);
if (menu != "") {
t.settings.plugins.contextmenu.items = _this._getContextMenu(menu);
}
},
ondestroy: function(t) {
$("#jstree-contextmenu").unbind();
}
}
}
});
$(function() {
//init code here
//add events to auto hide the menu on a delay
var pause = true;
var timer = null;
$("#jstree-contextmenu").bind("mouseenter", function() {
pause = true;
clearTimeout(timer);
});
$("#jstree-contextmenu").bind("mouseleave", function() {
pause = false;
timer = setTimeout(function() {
if (!pause) {
$.tree.plugins.contextmenu.hide();
}
}, 500);
});
//disable right clicking the context menu, this is for IE bug
$("#jstree-contextmenu").bind("contextmenu", function(e) {
e.preventDefault();
return false;
});
});
})(jQuery);

View File

@@ -67,19 +67,24 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
_activeTreeType: "content", //tracks which is the active tree type, this is used in searching and syncing.
_tree: null, //reference to the jsTree object
_isEditMode: false, //not really used YET
_isDebug: true, //set to true to enable alert debugging
_isDebug: false, //set to true to enable alert debugging
_loadedApps: [], //stores the application names that have been loaded to track which JavaScript code has been inserted into the DOM
_treeClass: "umbTree", //used for other libraries to detect which elements are an umbraco tree
_currenAJAXRequest: false, //used to determine if there is currently an ajax request being executed.
addEventHandler: function(fnName, fn) {
/// <summary>Adds an event listener to the event name event</summary>
$(this).bind(fnName, fn);
this._getContainer().bind(fnName, fn);
},
removeEventHandler: function(fnName, fn) {
/// <summary>Removes an event listener to the event name event</summary>
$(this).unbind(fnName, fn);
this._getContainer().unbind(fnName, fn);
},
_raiseEvent: function(evName, args) {
/// <summary>Raises an event and attaches it to the container</summary>
this._getContainer().trigger(evName, args);
},
init: function(jItem, opts) {
@@ -147,7 +152,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._debug("refreshTree");
this._tree.refresh();
},
rebuildTree: function(app) {
rebuildTree: function(app, callback) {
/// <summary>This will rebuild the tree structure for the application specified</summary>
this._debug("rebuildTree");
@@ -163,9 +168,10 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._opts.app = app;
}
//kill the tree
if (this._tree) this._tree.destroy();
if (this._tree) {
this._tree.destroy();
}
this._getContainer().hide();
var _this = this;
//check if we should rebuild from a saved tree
@@ -191,10 +197,9 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
var foundHandler = function(EV, node) {
//remove the event handler from firing again
_this.removeEventHandler("syncFound", foundHandler);
this._debug("rebuildTree: node synced, selecting node...");
_this._debug("rebuildTree: node synced, selecting node...");
//ensure the node is selected, ensure the event is fired and reselect is true since jsTree thinks this node is already selected by id
_this.selectNode(node, false, true);
this._getContainer().show();
};
this._debug("rebuildTree: syncing to last selected: " + lastSelected);
//add the event handler for the tree sync and sync the tree
@@ -202,22 +207,20 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this.setActiveTreeType($(saveData.selected[0]).attr("umb:type"));
this.syncTree(lastSelected);
}
else {
this._getContainer().show();
}
return;
if (typeof callback == "function") callback.apply(this, [lastSelected]);
}
else {
this._debug("rebuildTree: rebuilding from scratch: app = " + app);
this._currentAJAXRequest = true;
_this._tree = $.tree.create();
_this._tree.init(_this._getContainer(), _this._getInitOptions());
if (typeof callback == "function") callback.apply(this, []);
}
this._currentAJAXRequest = true;
_this._tree = $.tree.create();
_this._tree.init(_this._getContainer(), _this._getInitOptions());
},
saveTreeState: function(appAlias) {
@@ -321,7 +324,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
if (found) {
_this._debug("childNodeCreated: selecting new child node: " + found.attr("id"));
_this.selectNode(found, true, true);
$(_this).trigger("newChildNodeFound", [found]);
_this._raiseEvent("newChildNodeFound", [found]);
return;
}
}
@@ -347,7 +350,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
_this.removeEventHandler("syncFound", foundHandler);
//ensure the node is selected, ensure the event is fired and reselect is true since jsTree thinks this node is already selected by id
_this.selectNode(node, false, true);
$(_this).trigger("nodeMoved", [node]);
_this._raiseEvent("nodeMoved", [node]);
};
//add the event handler for the tree sync and sync the tree
this.addEventHandler("syncFound", foundHandler);
@@ -370,7 +373,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
_this._loadChildNodes(node, null);
//reselect the original node since sync will select the one that was copied
if (originalNode) _this.selectNode(originalNode, true);
$(_this).trigger("nodeCopied", [node]);
_this._raiseEvent("nodeCopied", [node]);
};
//add the event handler for the tree sync and sync the to the parent path
this.addEventHandler("syncFound", foundHandler);
@@ -397,9 +400,12 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
/// <param name="supressEvent">If set to true, will select the node but will supress the onSelected event</param>
/// <param name="reselect">If set to true, will call the select_branch method even if the node is already selected</param>
this._debug("selectNode, edit mode? " + this._isEditMode);
//this._debug("selectNode, edit mode? " + this._isEditMode);
var selectedId = this._tree.selected != null ? $(this._tree.selected[0]).attr("id") : null;
this._debug("selectNode (" + node.attr("id") + "). supressEvent? " + supressEvent + ", reselect? " + reselect);
if (reselect || (selectedId == null || selectedId != node.attr("id"))) {
//if we don't wan the event to fire, we'll set the callback to a null method and set it back after we call the select_branch method
if (supressEvent || this._isEditMode) {
@@ -541,7 +547,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
onSelect: function(NODE, TREE_OBJ) {
/// <summary>Fires the JS associated with the node, if the tree is in edit mode, allows for rename instead</summary>
this._debug("onSelect, edit mode? " + this._isEditMode);
//this._debug("onSelect, edit mode? " + this._isEditMode);
this._debug("onSelect");
if (this._isEditMode) {
this._tree.rename(NODE);
return false;
@@ -610,7 +617,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
onChange: function(NODE, TREE_OBJ) {
//bubble an event!
$(this).trigger("nodeClicked", [NODE]);
this._raiseEvent("nodeClicked", [NODE]);
},
onBeforeContext: function(NODE, TREE_OBJ, EV) {
@@ -629,7 +636,6 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._debug("onLoad");
this._getContainer().show();
//ensure the static data is gone
this._tree.settings.data.opts.static = null;
var _this = this;
@@ -647,6 +653,33 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
return $('<div>').append($(obj).clone()).remove().html();
},
onDestroy: function(TREE_OBJ) {
/// <summary>
/// When the tree is destroyed we need to ensure that all of the events both
/// live and bind are gone. For some reason the jstree unbinding doesn't seem to do it's job
/// so instead we need to clear all of the events ourselves
/// </summary>
this._debug("onDestroy: " + TREE_OBJ.container.attr("id"));
TREE_OBJ.container
.unbind("contextmenu")
.unbind("click")
.unbind("dblclick")
.unbind("mouseover")
.unbind("mousedown")
.unbind("mouseup");
$("a", TREE_OBJ.container.get(0))
.die("contextmenu")
.die("click")
.die("dblclick")
.die("mouseover")
.die("mousedown");
$("li", TREE_OBJ.container.get(0))
.die("click");
},
onError: function(ERR, TREE_OBJ) {
this._debug("ERROR!!!!! " + ERR);
},
@@ -779,7 +812,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
//if no node has been found at all in the entire path, then bubble an error event
if (!found) {
this._debug("no node found in path: " + path + " : " + numPaths);
$(this).trigger("syncNotFound", [path]);
this._raiseEvent("syncNotFound", [path]);
return;
}
@@ -794,7 +827,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
}
else {
_this._debug("node not found in children: " + path + " : " + numPaths);
$(this).trigger("syncNotFound", [path]);
_this._raiseEvent("syncNotFound", [path]);
}
});
}
@@ -812,7 +845,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._configureNodes(found, doReload);
}
//bubble event
$(this).trigger("syncFound", [found]);
this._raiseEvent("syncFound", [found]);
}
},
@@ -881,7 +914,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
ondata: function(D, T) { return _this.onJSONData(D, T); },
onload: function(T) { if (initData == null) _this.onLoad(T); },
onparse: function(S, T) { return _this.onParse(S, T); },
error: function(E, T) { _this.onError(E, T); }
error: function(E, T) { _this.onError(E, T); },
ondestroy: function(T) { _this.onDestroy(T); }
},
plugins: {
//UmbracoContext comes before context menu so that the events fire first
@@ -921,51 +955,3 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
})(jQuery);
var test = [
{
"data":
{
"title": "Home",
"icon": "/umbraco/images/umbraco/CWS_house.png",
"attributes": {
"class": "sprTree noSpr",
"href": "javascript:openContent(\u00271095\u0027);",
"umb:nodedata": '{\u0027menu\u0027:\u0027C:,D,MO,SK,UIR,P,Z,T5,L\u0027,\u0027nodeType\u0027:\u0027content\u0027,\u0027source\u0027:\u0027/umbraco/tree.aspx?rnd=ef1e00591d6d41f684c5b81f3324a24d&id=1095&treeType=content&contextMenu=true&isDialog=false\u0027}'
}
},
"state": "closed",
"attributes":
{
"id": "1095",
"class": "",
"rel": "dataNode",
"umb:type": "content"
}
},
{
"data":
{
"title": "Recycle Bin",
"icon": "/umbraco/images/umbraco/bin.png",
"attributes": {
"class": "sprTree noSpr",
"href": "javascript:UmbClientMgr.appActions().openDashboard(\u0027content\u0027);",
"umb:nodedata": '{\u0027menu\u0027:\u0027N,L\u0027,\u0027nodeType\u0027:\u0027content\u0027,\u0027source\u0027:\u0027/umbraco/tree.aspx?rnd=15b517b18af74f8fa53e9b454a14e21e&id=-20&treeType=content&contextMenu=true&isDialog=false\u0027}'
}
},
"state": "closed",
"attributes":
{
"id": "-20",
"class": "",
"rel": "rootNode",
"umb:type": "content"
}
}
];
var test2 = { "d": { "json": "[{\"data\":{\"title\":\"Content\",\"attributes\":{\"class\":\"sprTree sprTreeFolder\",\"href\":\"javascript:UmbClientMgr.appActions().openDashboard(\\u0027content\\u0027);\",\"umb:nodedata\":\u0027{\\u0027menu\\u0027:\\u0027CS,B,L\\u0027,\\u0027nodeType\\u0027:\\u0027content\\u0027,\\u0027source\\u0027:\\u0027/umbraco/tree.aspx?rnd=3fb294c1297046a48b61105b34073826&id=-1&treeType=content&contextMenu=true&isDialog=false\\u0027}\u0027}},\"state\":\"closed\",\"attributes\":{\"id\":\"-1\",\"class\":\"\",\"rel\":\"rootNode\",\"umb:type\":\"content\"}}]", "app": "content", "js": "\r\nfunction openContent(id) {\r\n\tUmbClientMgr.contentFrame(\u0027editContent.aspx?id=\u0027 + id);\r\n}\r\n"} };

View File

@@ -114,8 +114,7 @@
});
$(function() {
$.tree.plugins.contextmenu.object.hide().appendTo("body");
$("#jstree-contextmenu a", $.tree.plugins.contextmenu.object[0])
$("a", $.tree.plugins.contextmenu.object[0])
.live("click", function(event) {
if (!$(this).hasClass("disabled")) {
$.tree.plugins.contextmenu.exec.apply(null, [$(this).attr("rel")]);

View File

@@ -401,7 +401,7 @@
event.stopPropagation();
return false;
});
$("div.tree a", this.container.get(0))
$("a", this.container.get(0))
.live("click", function(event) { // WHEN CLICK IS ON THE TEXT OR ICON
if (event.which && event.which == 3) return true;
if (_this.locked) {