From 1d6c3f655d1deccb8dcdd1f32fcc47fbf7251d09 Mon Sep 17 00:00:00 2001 From: PerPloug Date: Thu, 4 Mar 2010 15:04:19 +0000 Subject: [PATCH] WORK IN PROGRESS, GET THE STABLE SOURCE FROM THE DOWNLOADS TAB 4.0.3 release merged into 4.1.0 branch, css tweaks to tree and context menu [TFS Changeset #64446] --- default.build | 4 +- umbraco/cms/Actions/Action.cs | 6 ++- umbraco/cms/Actions/IActionHandler.cs | 30 ++++++------- umbraco/cms/businesslogic/web/Document.cs | 32 ++++++++++++++ umbraco/presentation/library.cs | 34 ++++++++++++++- .../umbraco/cache/CacheRefresher.cs | 1 + .../umbraco/create/standardTasks.cs | 22 ++++++++++ umbraco/presentation/umbraco/login.aspx | 21 +++++++-- umbraco/presentation/umbraco/login.aspx.cs | 3 ++ .../umbraco/login.aspx.designer.cs | 20 ++++++++- .../umbraco/masterpages/umbracoDialog.Master | 3 +- .../masterpages/umbracoDialog.Master.cs | 20 ++++++++- .../umbracoDialog.Master.designer.cs | 4 +- .../umbraco/masterpages/umbracoPage.Master.cs | 32 +++++++++++++- .../umbracoPage.Master.designer.cs | 2 +- .../Tree/Themes/umbraco/style.css | 28 ++++++++---- umbraco/presentation/web.STANDARD.config | 4 +- umbraco/providers/members/Helper.cs | 43 +++++++++++++++++++ umbraco/providers/umbraco.providers.csproj | 3 +- 19 files changed, 270 insertions(+), 42 deletions(-) create mode 100644 umbraco/providers/members/Helper.cs diff --git a/default.build b/default.build index 087c0ca1dc..e3835c93fa 100644 --- a/default.build +++ b/default.build @@ -93,6 +93,8 @@ + + @@ -107,7 +109,7 @@ - + diff --git a/umbraco/cms/Actions/Action.cs b/umbraco/cms/Actions/Action.cs index 8e558159ca..ef984f7f2c 100644 --- a/umbraco/cms/Actions/Action.cs +++ b/umbraco/cms/Actions/Action.cs @@ -45,7 +45,7 @@ namespace umbraco.BusinessLogic.Actions if (_actionHandlers.Count > 0) return; - List foundIActionHandlers = TypeFinder.FindClassesOfType(); + List foundIActionHandlers = TypeFinder.FindClassesOfType(true); foreach (Type type in foundIActionHandlers) { IActionHandler typeInstance; @@ -63,7 +63,7 @@ namespace umbraco.BusinessLogic.Actions if (_actions.Count > 0) return; - List foundIActions = TypeFinder.FindClassesOfType(); + List foundIActions = TypeFinder.FindClassesOfType(true); foreach (Type type in foundIActions) { IAction typeInstance; @@ -250,4 +250,6 @@ namespace umbraco.BusinessLogic.Actions ); } } + + } diff --git a/umbraco/cms/Actions/IActionHandler.cs b/umbraco/cms/Actions/IActionHandler.cs index 418dc9e4ed..7e28b7bd78 100644 --- a/umbraco/cms/Actions/IActionHandler.cs +++ b/umbraco/cms/Actions/IActionHandler.cs @@ -11,19 +11,19 @@ using umbraco.interfaces; namespace umbraco.BusinessLogic.Actions { - /// - /// Implement the IActionHandler interface in order to automatically get code - /// run whenever a document, member or media changed, deleted, created etc. - /// The Clases implementing IActionHandler are loaded at runtime which means - /// that there are no other setup when creating a custom actionhandler. - /// - /// - /// - /// - public interface IActionHandler - { - bool Execute(Document documentObject, IAction action); - IAction[] ReturnActions(); - string HandlerName(); - } + /// + /// Implement the IActionHandler interface in order to automatically get code + /// run whenever a document, member or media changed, deleted, created etc. + /// The Clases implementing IActionHandler are loaded at runtime which means + /// that there are no other setup when creating a custom actionhandler. + /// + /// + /// + /// + public interface IActionHandler + { + bool Execute(Document documentObject, IAction action); + IAction[] ReturnActions(); + string HandlerName(); + } } diff --git a/umbraco/cms/businesslogic/web/Document.cs b/umbraco/cms/businesslogic/web/Document.cs index eb95bb4c6c..aaa2ae29fa 100644 --- a/umbraco/cms/businesslogic/web/Document.cs +++ b/umbraco/cms/businesslogic/web/Document.cs @@ -1479,6 +1479,11 @@ namespace umbraco.cms.businesslogic.web public delegate void MoveToTrashEventHandler(Document sender, MoveToTrashEventArgs e); + /// + /// The index event handlers + /// + public delegate void IndexEventHandler(Document sender, AddToIndexEventArgs e); + /// /// Occurs when [before save]. /// @@ -1734,6 +1739,33 @@ namespace umbraco.cms.businesslogic.web AfterRollBack(this, e); } + /// + /// Occurs when [before add to index]. + /// + public static event IndexEventHandler BeforeAddToIndex; + /// + /// Raises the event. + /// + /// The instance containing the event data. + protected virtual void FireBeforeAddToIndex(AddToIndexEventArgs e) { + if (BeforeAddToIndex != null) + BeforeAddToIndex(this, e); + } + + /// + /// Occurs when [after add to index]. + /// + public static event IndexEventHandler AfterAddToIndex; + /// + /// Raises the event. + /// + /// The instance containing the event data. + protected virtual void FireAfterAddToIndex(AddToIndexEventArgs e) + { + if (AfterAddToIndex != null) + AfterAddToIndex(this, e); + } + private Dictionary _knownProperties; private Func, string, bool> propertyTypeByAlias = (pt, alias) => pt.Key.PropertyType.Alias == alias; public object this[string alias] diff --git a/umbraco/presentation/library.cs b/umbraco/presentation/library.cs index d81258a7e7..e434e43785 100644 --- a/umbraco/presentation/library.cs +++ b/umbraco/presentation/library.cs @@ -26,6 +26,8 @@ using System.Web.Security; using umbraco.cms.businesslogic.language; using umbraco.IO; using umbraco.presentation; +using System.Collections; +using System.Collections.Generic; namespace umbraco { @@ -176,7 +178,7 @@ namespace umbraco new Guid("27ab3022-3dfa-47b6-9119-5945bc88fd66"), DocumentId); else - content.Instance.UnPublishNode(DocumentId); + content.Instance.ClearDocumentCache(DocumentId); } /// @@ -863,7 +865,7 @@ namespace umbraco /// A string with the DayOfWeek matching the current contexts culture settings public static string GetWeekDay(string Date) { - return DateTime.Parse(Date).DayOfWeek.ToString(); + return DateTime.Parse(Date).ToString("dddd"); } /// @@ -1149,6 +1151,8 @@ namespace umbraco { if (UmbracoSettings.UseAspNetMasterPages) { + System.Collections.Generic.Dictionary items = getCurrentContextItems(); + if (!umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled) { HttpContext Context = HttpContext.Current; @@ -1165,6 +1169,10 @@ namespace umbraco Context.Server.Execute( string.Format("/default.aspx?umbPageID={0}&alttemplate={1}{2}", PageId, new template(TemplateId).TemplateAlias, queryString), sw); + + // update the local page items again + updateLocalContextItems(items, Context); + return sw.ToString(); } else @@ -1190,6 +1198,28 @@ namespace umbraco } } + private static System.Collections.Generic.Dictionary getCurrentContextItems() + { + IDictionary items = HttpContext.Current.Items; + System.Collections.Generic.Dictionary currentItems = new Dictionary(); + IDictionaryEnumerator ide = items.GetEnumerator(); + while (ide.MoveNext()) + { + currentItems.Add(ide.Key, ide.Value); + } + return currentItems; + } + + private static void updateLocalContextItems(IDictionary items, HttpContext Context) + { + Context.Items.Clear(); + IDictionaryEnumerator ide = items.GetEnumerator(); + while (ide.MoveNext()) + { + Context.Items.Add(ide.Key, ide.Value); + } + } + /// /// Renders the default template for a specific page. /// diff --git a/umbraco/presentation/umbraco/cache/CacheRefresher.cs b/umbraco/presentation/umbraco/cache/CacheRefresher.cs index ba216728ae..dcbc5ddc69 100644 --- a/umbraco/presentation/umbraco/cache/CacheRefresher.cs +++ b/umbraco/presentation/umbraco/cache/CacheRefresher.cs @@ -31,6 +31,7 @@ namespace umbraco.presentation.cache { /// public CacheRefresher() { this.Url = "http://" + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + IOHelper.ResolveUrl(SystemDirectories.Webservices) + "/cacheRefresher.asmx"; + } /// diff --git a/umbraco/presentation/umbraco/create/standardTasks.cs b/umbraco/presentation/umbraco/create/standardTasks.cs index a6017cad9c..b27dd8ec08 100644 --- a/umbraco/presentation/umbraco/create/standardTasks.cs +++ b/umbraco/presentation/umbraco/create/standardTasks.cs @@ -6,6 +6,7 @@ using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; using umbraco.IO; +using umbraco.cms.businesslogic.member; namespace umbraco { @@ -1316,9 +1317,26 @@ namespace umbraco #endregion } + public class NewMemberUIEventArgs : System.ComponentModel.CancelEventArgs + { + } public class memberTasks : interfaces.ITaskReturnUrl { + /// + /// The new event handler + /// + 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; @@ -1374,6 +1392,10 @@ namespace umbraco 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 diff --git a/umbraco/presentation/umbraco/login.aspx b/umbraco/presentation/umbraco/login.aspx index c4f4bc72e0..ed69ed7a27 100644 --- a/umbraco/presentation/umbraco/login.aspx +++ b/umbraco/presentation/umbraco/login.aspx @@ -29,6 +29,7 @@ +
@@ -88,11 +89,23 @@
+ jQuery("#ctl00_body_lname").focus(); + jQuery('#<%= hf_height.ClientID %>').value = getViewportHeight(); + jQuery('#<%= hf_width.ClientID %>').value = getViewportWidth(); + + + + + + + diff --git a/umbraco/presentation/umbraco/login.aspx.cs b/umbraco/presentation/umbraco/login.aspx.cs index 21f042655e..6271e7a28e 100644 --- a/umbraco/presentation/umbraco/login.aspx.cs +++ b/umbraco/presentation/umbraco/login.aspx.cs @@ -109,6 +109,9 @@ namespace umbraco.cms.presentation else Response.Redirect(Request["redir"]); } + else { + loginError.Visible = true; + } } /// diff --git a/umbraco/presentation/umbraco/login.aspx.designer.cs b/umbraco/presentation/umbraco/login.aspx.designer.cs index 382c997524..3268ae31b6 100644 --- a/umbraco/presentation/umbraco/login.aspx.designer.cs +++ b/umbraco/presentation/umbraco/login.aspx.designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4927 +// Runtime Version:2.0.50727.3603 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -40,6 +40,15 @@ namespace umbraco.cms.presentation { /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; + /// + /// JsInclude2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude2; + /// /// Form1 control. /// @@ -138,5 +147,14 @@ namespace umbraco.cms.presentation { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hf_width; + + /// + /// loginError control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder loginError; } } diff --git a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master index df5fa03dd7..cb0a9a3e99 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master +++ b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master @@ -1,4 +1,4 @@ -<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="umbracoDialog.master.cs" Inherits="umbraco.presentation.umbraco.masterpages.umbracoDialog" %> +<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="umbracoDialog.master.cs" Inherits="umbraco.presentation.masterpages.umbracoDialog" %> <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> @@ -7,6 +7,7 @@ + diff --git a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.cs b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.cs index 5a3cab5f88..a99be9d431 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.cs @@ -4,15 +4,33 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace umbraco.presentation.umbraco.masterpages { +namespace umbraco.presentation.masterpages { public partial class umbracoDialog : System.Web.UI.MasterPage { public bool reportModalSize { get; set; } + public static event MasterPageLoadHandler Load; + public static event MasterPageLoadHandler Init; protected void Page_Load(object sender, EventArgs e) { ClientLoader.DataBind(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "setRoot", "UmbClientMgr.setUmbracoPath(\"" + IO.IOHelper.ResolveUrl( IO.SystemDirectories.Umbraco ) + "\");", true); + FireOnLoad(e); } + + protected override void OnInit(EventArgs e) { + base.OnInit(e); + + if (Init != null) { + Init(this, e); + } + } + + + protected virtual void FireOnLoad(EventArgs e) { + if (Load != null) { + Load(this, e); + } + } } } diff --git a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs index 4f6f85db44..4988bdccb8 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs @@ -1,14 +1,14 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4200 +// Runtime Version:2.0.50727.3603 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ -namespace umbraco.presentation.umbraco.masterpages { +namespace umbraco.presentation.masterpages { public partial class umbracoDialog { diff --git a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs index 18ca34034c..e200a44940 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.cs @@ -4,13 +4,43 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -namespace umbraco.presentation.umbraco.masterpages +//This is only in case an upgrade goes wrong and the the /masterpages/ files are not copied over +//which would result in an error. so we have kept the old namespaces intact with references to new ones +using mp = umbraco.presentation.masterpages; +namespace umbraco.presentation.umbraco.masterpages { + public class umbracoPage : mp.umbracoPage { } + public class umbracoDialog : mp.umbracoDialog { } +} + +namespace umbraco.presentation.masterpages { + public delegate void MasterPageLoadHandler(object sender, System.EventArgs e); + public partial class umbracoPage : System.Web.UI.MasterPage { + + public static event MasterPageLoadHandler Load; + public static event MasterPageLoadHandler Init; + protected void Page_Load(object sender, EventArgs e) { ClientLoader.DataBind(); + FireOnLoad(e); } + + protected override void OnInit(EventArgs e) { + base.OnInit(e); + + if (Init != null) { + Init(this, e); + } + } + + + protected virtual void FireOnLoad(EventArgs e) { + if (Load != null) { + Load(this, e); + } + } } } diff --git a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs index eac20e90a5..36d5aef6a8 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoPage.Master.designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace umbraco.presentation.umbraco.masterpages { +namespace umbraco.presentation.masterpages { public partial class umbracoPage { diff --git a/umbraco/presentation/umbraco_client/Tree/Themes/umbraco/style.css b/umbraco/presentation/umbraco_client/Tree/Themes/umbraco/style.css index de846e32c4..b324c77bb3 100644 --- a/umbraco/presentation/umbraco_client/Tree/Themes/umbraco/style.css +++ b/umbraco/presentation/umbraco_client/Tree/Themes/umbraco/style.css @@ -5,6 +5,8 @@ min-height: 20px; font: icon; position:relative; + font-family: Arial,Lucida Grande; + font-size: 12px; } .tree-umbraco li a { @@ -95,32 +97,41 @@ background: #f0f0f0 url(contextMenuBg.gif) repeat-y left; border: 1px solid #979797; padding: 3px; + padding-top: 2px; + padding-bottom: 0px; width: 180px; font-family: Arial,Lucida Grande; font-size: 11px; z-index: 1000; + margin: 0px; + display: block; } + + #jstree-contextmenu.tree-umbraco-context li { border-left:none; background:transparent; - margin:0; + height: 26px; } + #jstree-contextmenu.tree-umbraco-context li a { border:0px; - padding: 1px; - margin: 1px; + padding: 2px; height: 20px; line-height:20px; color: #1a1818; text-decoration: none; text-indent: 0px; + margin-top: 1px !Important; + margin-bottom: 3px !Important; } + #jstree-contextmenu.tree-umbraco-context li a:hover { border: 1px solid #a8d8eb; - padding: 0px; + padding: 1px; background: #dcecf3; text-indent: 0px; } @@ -131,7 +142,7 @@ font-size: 1px; height: 1px; line-height: 1px; - margin: 0 2px 0 24px; + margin: 0 2px 4px 29px; min-height: 1px; display: block; } @@ -140,11 +151,12 @@ { height: 16px; width: 16px; - margin: 1px 10px 0 2px; + margin: 1px 10px 0 4px; } -#jstree-contextmenu.tree-umbraco-context li a ins {display:none;} -#jstree-contextmenu.tree-umbraco-context li a span {margin:0;padding-left:0px;background:none;} +#jstree-contextmenu.tree-umbraco-context li a ins {display:none;} +#jstree-contextmenu.tree-umbraco-context li a span {margin:0;padding-left:1px;background:none;} +#jstree-contextmenu.tree-umbraco-context li a span div.menuLabel{padding-left: 37px;} /* Tree icons sprites */ diff --git a/umbraco/presentation/web.STANDARD.config b/umbraco/presentation/web.STANDARD.config index 5e59d66405..645dbb5a38 100644 --- a/umbraco/presentation/web.STANDARD.config +++ b/umbraco/presentation/web.STANDARD.config @@ -28,8 +28,8 @@ - - + + diff --git a/umbraco/providers/members/Helper.cs b/umbraco/providers/members/Helper.cs new file mode 100644 index 0000000000..0218b74985 --- /dev/null +++ b/umbraco/providers/members/Helper.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; +using umbraco.cms.businesslogic.member; + +namespace umbraco.providers.members +{ + public class Helper + { + public static bool GuidPseudoTryParse(string guidToTest) + { + Guid memberUniqueId; + try + { + memberUniqueId = new Guid(guidToTest); + } + catch (FormatException) + { + memberUniqueId = Guid.Empty; + return false; + } + + return true; + } + + public static Member GetMemberByUsernameOrGuid(string userNameOrGuid) + { + Member m = null; + + // test if username is a GUID (then it comes from member core login) + if (GuidPseudoTryParse(userNameOrGuid)) + { + m = new Member(new Guid(userNameOrGuid)); + } + else + { + m = Member.GetMemberFromLoginName(userNameOrGuid); + } + + return m; + } + } +} diff --git a/umbraco/providers/umbraco.providers.csproj b/umbraco/providers/umbraco.providers.csproj index ce96722fac..c9e8817326 100644 --- a/umbraco/providers/umbraco.providers.csproj +++ b/umbraco/providers/umbraco.providers.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {D7636876-0756-43CB-A192-138C6F0D5E42} Library @@ -51,6 +51,7 @@ +