Converted much of the old logging to use the new logging. All calls for log types: Login, Logout,
LoginFailure, Debug. There's still a bunch to convert though. #U4-7
This commit is contained in:
@@ -52,10 +52,16 @@ namespace Umbraco.Core.Logging
|
||||
/// <param name="exception"></param>
|
||||
public static void Error<T>(string message, Exception exception)
|
||||
{
|
||||
var logger = LoggerFor<T>();
|
||||
Error(typeof (T), message, exception);
|
||||
}
|
||||
|
||||
public static void Error(Type callingType, string message, Exception exception)
|
||||
{
|
||||
var logger = LogManager.GetLogger(callingType);
|
||||
if (logger != null)
|
||||
logger.Error(PrefixThreadId(message), exception);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Warn
|
||||
|
||||
@@ -1085,7 +1085,7 @@ namespace umbraco
|
||||
|
||||
try
|
||||
{
|
||||
Log.Add(LogTypes.Debug, staticUser, -1, "Republishing starting");
|
||||
LogHelper.Debug<content>("Republishing starting");
|
||||
|
||||
// Lets cache the DTD to save on the DB hit on the subsequent use
|
||||
string dtd = DocumentType.GenerateDtd();
|
||||
@@ -1155,7 +1155,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
|
||||
}
|
||||
}
|
||||
|
||||
Log.Add(LogTypes.Debug, staticUser, -1, "Xml Pages loaded");
|
||||
LogHelper.Debug<content>("Xml Pages loaded");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1170,7 +1170,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
|
||||
// Start building the content tree recursively from the root (-1) node
|
||||
GenerateXmlDocument(hierarchy, nodeIndex, -1, xmlDoc.DocumentElement);
|
||||
|
||||
Log.Add(LogTypes.Debug, staticUser, -1, "Done republishing Xml Index");
|
||||
LogHelper.Debug<content>("Done republishing Xml Index");
|
||||
|
||||
return xmlDoc;
|
||||
}
|
||||
@@ -1294,7 +1294,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
|
||||
Thread.CurrentThread.Name, stopWatch.Elapsed,
|
||||
Thread.CurrentThread.IsThreadPoolThread));
|
||||
|
||||
Log.Add(LogTypes.Debug, staticUser, -1, string.Format("Xml saved in {0}", stopWatch.Elapsed));
|
||||
LogHelper.Debug<content>(string.Format("Xml saved in {0}", stopWatch.Elapsed));
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
@@ -1364,10 +1364,8 @@ order by umbracoNode.level, umbracoNode.sortOrder";
|
||||
{
|
||||
if (xmlDoc == null) return null;
|
||||
|
||||
Log.Add(LogTypes.Debug, -1, "Cloning...");
|
||||
// Save copy of content
|
||||
var xmlCopy = (XmlDocument)xmlDoc.CloneNode(true);
|
||||
Log.Add(LogTypes.Debug, -1, "Cloning ended...");
|
||||
return xmlCopy;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.install.steps.Skinning
|
||||
@@ -60,7 +61,7 @@ namespace umbraco.presentation.install.steps.Skinning
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, -1, ex.ToString());
|
||||
LogHelper.Error<loadStarterKitDesigns>("An error occurred initializing", ex);
|
||||
|
||||
ShowConnectionError();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
@@ -585,21 +586,24 @@ namespace umbraco {
|
||||
}
|
||||
|
||||
public bool Execute(string url) {
|
||||
try {
|
||||
Log.Add(LogTypes.NotFound, User.GetUser(0), -1,
|
||||
url + " (from '" + HttpContext.Current.Request.UrlReferrer + "')");
|
||||
try
|
||||
{
|
||||
Log.Add(LogTypes.NotFound, User.GetUser(0), -1,
|
||||
url + " (from '" + HttpContext.Current.Request.UrlReferrer + "')");
|
||||
|
||||
// Test if the error404 not child elements
|
||||
string error404 = umbraco.library.GetCurrentNotFoundPageId();
|
||||
// Test if the error404 not child elements
|
||||
string error404 = umbraco.library.GetCurrentNotFoundPageId();
|
||||
|
||||
|
||||
_redirectID = int.Parse(error404);
|
||||
HttpContext.Current.Response.StatusCode = 404;
|
||||
return true;
|
||||
} catch (Exception err) {
|
||||
Log.Add(LogTypes.Debug, User.GetUser(0), -1, err.ToString());
|
||||
return false;
|
||||
}
|
||||
_redirectID = int.Parse(error404);
|
||||
HttpContext.Current.Response.StatusCode = 404;
|
||||
return true;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
LogHelper.Error<handle404>("An error occurred", err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int redirectID {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace umbraco.ActionHandlers
|
||||
if (currentName != documentObject.Text)
|
||||
{
|
||||
// add name change to the log
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, umbraco.BusinessLogic.User.GetUser(0), documentObject.Id, "Title changed from '" + documentObject.Text + "' to '" + currentName + "'");
|
||||
|
||||
LogHelper.Debug<umbEnsureUniqueName>("Title changed from '" + documentObject.Text + "' to '" + currentName + "' for document id" + documentObject.Id);
|
||||
|
||||
documentObject.Text = currentName;
|
||||
|
||||
return true;
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, -1, exception.ToString());
|
||||
LogHelper.Error<ModuleSelector>("An error occurred", exception);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.skinning;
|
||||
using System.Xml;
|
||||
using System.Text;
|
||||
@@ -184,7 +185,7 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, -1, exception.ToString());
|
||||
LogHelper.Error<SkinCustomizer>("An error occurred", exception);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BasePages;
|
||||
@@ -70,7 +71,7 @@ namespace umbraco
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
BusinessLogic.Log.Add(LogTypes.Debug, ParentID, _typeID.ToString() + " " + _parentID.ToString() + " deleting " + Alias);
|
||||
LogHelper.Debug<dictionaryTasks>(_typeID.ToString() + " " + _parentID.ToString() + " deleting " + Alias);
|
||||
|
||||
new cms.businesslogic.Dictionary.DictionaryItem(ParentID).delete();
|
||||
return true;
|
||||
|
||||
@@ -55,7 +55,6 @@ namespace umbraco.cms.presentation.create.controls
|
||||
nodeId,
|
||||
rename.Text);
|
||||
|
||||
Log.Add(LogTypes.Debug, -1, "return:" + returnUrl);
|
||||
|
||||
BasePage.Current.ClientTools
|
||||
.ChangeContentFrameUrl(returnUrl)
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace umbraco
|
||||
public bool Save()
|
||||
{
|
||||
int masterId = ParentID;
|
||||
BusinessLogic.Log.Add(LogTypes.Debug, -1, "tp id:" + masterId.ToString());
|
||||
|
||||
var editor = "settings/editTemplate.aspx";
|
||||
if(Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BasePages;
|
||||
@@ -69,8 +70,7 @@ namespace umbraco
|
||||
}
|
||||
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);
|
||||
LogHelper.Error<userTasks>(String.Format("Failed to create the user. Error from provider: {0}", status.ToString()), ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-19
@@ -9,6 +9,7 @@ using System.Collections;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.developer.packages {
|
||||
@@ -159,28 +160,33 @@ namespace umbraco.presentation.developer.packages {
|
||||
fb.Text = "<strong>No connection to repository.</strong> Modules could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'";
|
||||
|
||||
|
||||
if (repo.HasConnection()) {
|
||||
try {
|
||||
if (repo.HasConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if(UmbracoSettings.UseLegacyXmlSchema)
|
||||
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4);
|
||||
else
|
||||
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41);
|
||||
|
||||
rep_nitros.DataBind();
|
||||
} catch (Exception ex) {
|
||||
if (UmbracoSettings.UseLegacyXmlSchema)
|
||||
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4);
|
||||
else
|
||||
rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41);
|
||||
|
||||
Log.Add(LogTypes.Debug, -1, ex.ToString());
|
||||
rep_nitros.DataBind();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<LoadNitros>("An error occurred", ex);
|
||||
|
||||
loadNitros.Controls.Clear();
|
||||
loadNitros.Controls.Add(fb);
|
||||
//nitroList.Visible = false;
|
||||
//lt_status.Text = "<div class='error'><p>Nitros could not be fetched from the repository. Please check your internet connection</p><p>You can always install Nitros later in the packages section</p><p>" + ex.ToString() + "</p></div>";
|
||||
}
|
||||
} else {
|
||||
loadNitros.Controls.Clear();
|
||||
loadNitros.Controls.Add(fb);
|
||||
}
|
||||
loadNitros.Controls.Clear();
|
||||
loadNitros.Controls.Add(fb);
|
||||
//nitroList.Visible = false;
|
||||
//lt_status.Text = "<div class='error'><p>Nitros could not be fetched from the repository. Please check your internet connection</p><p>You can always install Nitros later in the packages section</p><p>" + ex.ToString() + "</p></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadNitros.Controls.Clear();
|
||||
loadNitros.Controls.Add(fb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-17
@@ -10,7 +10,7 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
@@ -523,26 +523,34 @@ namespace umbraco.presentation.developer.packages
|
||||
}
|
||||
else
|
||||
{
|
||||
BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, "executing undo actions");
|
||||
LogHelper.Debug<installedPackage>("executing undo actions");
|
||||
|
||||
// uninstall actions
|
||||
try {
|
||||
System.Xml.XmlDocument actionsXml = new System.Xml.XmlDocument();
|
||||
actionsXml.LoadXml("<Actions>" + pack.Data.Actions + "</Actions>");
|
||||
try
|
||||
{
|
||||
var actionsXml = new System.Xml.XmlDocument();
|
||||
actionsXml.LoadXml("<Actions>" + pack.Data.Actions + "</Actions>");
|
||||
|
||||
BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, actionsXml.OuterXml);
|
||||
foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action")) {
|
||||
try {
|
||||
cms.businesslogic.packager.PackageAction.UndoPackageAction(pack.Data.Name, n.Attributes["alias"].Value, n);
|
||||
} catch (Exception ex) {
|
||||
BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
}
|
||||
LogHelper.Debug<installedPackage>(actionsXml.OuterXml);
|
||||
|
||||
//moved remove of files here so custom package actions can still undo
|
||||
foreach (XmlNode n in actionsXml.DocumentElement.SelectNodes("//Action"))
|
||||
{
|
||||
try
|
||||
{
|
||||
cms.businesslogic.packager.PackageAction.UndoPackageAction(pack.Data.Name, n.Attributes["alias"].Value, n);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred in UndoPackageAction", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<installedPackage>("An error occurred", ex);
|
||||
}
|
||||
|
||||
//moved remove of files here so custom package actions can still undo
|
||||
//Remove files
|
||||
foreach (ListItem li in files.Items)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.cms.businesslogic.skinning;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.cms.businesslogic;
|
||||
@@ -79,7 +80,7 @@ namespace umbraco.presentation.umbraco.dialogs
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
LogHelper.Error<TemplateSkinning>("An error occurred", ex);
|
||||
|
||||
//ShowConnectionError();
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Services;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.presentation.webservices;
|
||||
@@ -81,7 +82,7 @@ namespace umbraco.presentation.umbraco.webservices
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, -1, ex.ToString());
|
||||
LogHelper.Error<TagsAutoCompleteHandler>("An error occurred", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Web.Script.Services;
|
||||
using System.Web.Services;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
@@ -150,7 +151,7 @@ namespace umbraco.presentation.webservices
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BusinessLogic.Log.Add(global::umbraco.BusinessLogic.LogTypes.Debug, ParentId, ex.ToString());
|
||||
LogHelper.Error<nodeSorter>("An error occurred", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ namespace umbraco.BasePages
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Logout, BusinessLogic.User.GetUser(uid), -1, "");
|
||||
var user = BusinessLogic.User.GetUser(uid);
|
||||
LogHelper.Info<BasePage>("User {0} (Id:{1}) logged out", () => user.Name, () => user.Id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -334,7 +334,9 @@ namespace umbraco.BasePages
|
||||
"') ",
|
||||
SqlHelper.CreateParameter("@contextId", retVal));
|
||||
umbracoUserContextID = retVal.ToString();
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Login, u, -1, "");
|
||||
|
||||
LogHelper.Info<BasePage>("User {0} (Id: {1}) logged in", () => u.Name, () => u.Id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
using umbraco.IO;
|
||||
@@ -61,7 +62,8 @@ namespace umbraco.BasePages
|
||||
if (permissions.IndexOf(Action) > -1 && (Path.Contains("-20") || ("," + Path + ",").Contains("," + getUser().StartNodeId.ToString() + ",")))
|
||||
return true;
|
||||
|
||||
Log.Add(LogTypes.LoginFailure, getUser(), -1, "Insufficient permissions in UmbracoEnsuredPage: '" + Path + "', '" + permissions + "', '" + Action + "'");
|
||||
var user = getUser();
|
||||
LogHelper.Info<UmbracoEnsuredPage>("User {0} has insufficient permissions in UmbracoEnsuredPage: '{1}', '{2}', '{3}'", () => user.Name, () => Path, () => permissions, () => Action);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.DataLayer;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -336,7 +337,10 @@ namespace umbraco.BusinessLogic
|
||||
|
||||
// Logging
|
||||
if (tmp == null)
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.LoginFailure, BusinessLogic.User.GetUser(0), -1, "Login: '" + lname + "' failed, from IP: " + System.Web.HttpContext.Current.Request.UserHostAddress);
|
||||
{
|
||||
LogHelper.Info<User>("Login: '" + lname + "' failed, from IP: " + System.Web.HttpContext.Current.Request.UserHostAddress);
|
||||
}
|
||||
|
||||
return (tmp != null);
|
||||
}
|
||||
|
||||
|
||||
@@ -458,7 +458,6 @@ namespace umbraco.cms.businesslogic.packager
|
||||
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true")
|
||||
{
|
||||
insPack.Data.Actions += n.OuterXml;
|
||||
Log.Add(LogTypes.Debug, -1, HttpUtility.HtmlEncode(n.OuterXml));
|
||||
}
|
||||
|
||||
if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// </summary>
|
||||
public class addApplication : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Installs a new application in umbraco.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <example><code>
|
||||
/// <Action runat="install" [undo="false"] alias="addApplication" appName="Application Name" appAlias="myApplication" appIcon="application.gif"/>
|
||||
/// </code></example>
|
||||
/// <returns>true if successfull</returns>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string name = xmlData.Attributes["appName"].Value;
|
||||
string alias = xmlData.Attributes["appAlias"].Value;
|
||||
string icon = xmlData.Attributes["appIcon"].Value;
|
||||
|
||||
BusinessLogic.Application.MakeNew(name, alias, icon);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string alias = xmlData.Attributes["appAlias"].Value;
|
||||
BusinessLogic.Application.getByAlias(alias).Delete();
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Action alias.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "addApplication";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/*Build in standard actions */
|
||||
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// </summary>
|
||||
public class addApplicationTree : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Executes the specified package action.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
/// <example><code>
|
||||
/// <Action runat="install" [undo="false"] alias="addApplicationTree" silent="[true/false]" initialize="[true/false]" sortOrder="1"
|
||||
/// applicationAlias="appAlias" treeAlias="myTree" treeTitle="My Tree" iconOpened="folder_o.gif" iconClosed="folder.gif"
|
||||
/// assemblyName="umbraco" treeHandlerType="treeClass" action="alert('you clicked my tree')"/>
|
||||
/// </code></example>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
bool silent = bool.Parse(xmlData.Attributes["silent"].Value);
|
||||
bool initialize = bool.Parse(xmlData.Attributes["initialize"].Value);
|
||||
byte sortOrder = byte.Parse(xmlData.Attributes["sortOrder"].Value);
|
||||
|
||||
string applicationAlias = xmlData.Attributes["applicationAlias"].Value;
|
||||
string treeAlias = xmlData.Attributes["treeAlias"].Value;
|
||||
string treeTitle = xmlData.Attributes["treeTitle"].Value;
|
||||
string iconOpened = xmlData.Attributes["iconOpened"].Value;
|
||||
string iconClosed = xmlData.Attributes["iconClosed"].Value;
|
||||
|
||||
string assemblyName = xmlData.Attributes["assemblyName"].Value;
|
||||
string type = xmlData.Attributes["treeHandlerType"].Value;
|
||||
string action = xmlData.Attributes["action"].Value;
|
||||
|
||||
|
||||
BusinessLogic.ApplicationTree.MakeNew(silent, initialize, sortOrder, applicationAlias, treeAlias, treeTitle, iconClosed, iconOpened, assemblyName, type, action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Undoes the action
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string treeAlias = xmlData.Attributes["treeAlias"].Value;
|
||||
BusinessLogic.ApplicationTree.getByAlias(treeAlias).Delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action alias.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "addApplicationTree";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
|
||||
string sample = "<Action runat=\"install\" undo=\"true/false\" alias=\"addApplicationTree\" silent=\"true/false\" initialize=\"true/false\" sortOrder=\"1\" applicationAlias=\"appAlias\" treeAlias=\"myTree\" treeTitle=\"My Tree\" iconOpened=\"folder_o.gif\" iconClosed=\"folder.gif\" assemblyName=\"umbraco\" treeHandlerType=\"treeClass\" action=\"alert('you clicked my tree')\"/>";
|
||||
return helper.parseStringToXmlNode(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class addDashboardSection : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Installs a dashboard section. This action reuses the action XML, so it has to be valid dashboard markup.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns>true if successfull</returns>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// <Action runat="install" [undo="false"] alias="addDashboardSection" dashboardAlias="MyDashboardSection">
|
||||
/// <section>
|
||||
/// <areas>
|
||||
/// <area>default</area>
|
||||
/// <area>content</area>
|
||||
/// </areas>
|
||||
/// <tab caption="Last Edits">
|
||||
/// <control>/usercontrols/dashboard/latestEdits.ascx</control>
|
||||
/// <control>/usercontrols/umbracoBlog/dashboardBlogPostCreate.ascx</control>
|
||||
/// </tab>
|
||||
/// <tab caption="Create blog post">
|
||||
/// <control>/usercontrols/umbracoBlog/dashboardBlogPostCreate.ascx</control>
|
||||
/// </tab>
|
||||
/// </section>
|
||||
/// </Action>
|
||||
/// </code>
|
||||
/// </example>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
//this will need a complete section node to work...
|
||||
|
||||
if (xmlData.HasChildNodes)
|
||||
{
|
||||
string sectionAlias = xmlData.Attributes["dashboardAlias"].Value;
|
||||
string dbConfig = SystemFiles.DashboardConfig;
|
||||
|
||||
XmlNode section = xmlData.SelectSingleNode("./section");
|
||||
XmlDocument dashboardFile = xmlHelper.OpenAsXmlDocument(dbConfig);
|
||||
|
||||
XmlNode importedSection = dashboardFile.ImportNode(section, true);
|
||||
|
||||
XmlAttribute alias = xmlHelper.addAttribute(dashboardFile, "alias", sectionAlias);
|
||||
importedSection.Attributes.Append(alias);
|
||||
|
||||
dashboardFile.DocumentElement.AppendChild(importedSection);
|
||||
|
||||
dashboardFile.Save(IOHelper.MapPath(dbConfig));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public string Alias()
|
||||
{
|
||||
return "addDashboardSection";
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
string sectionAlias = xmlData.Attributes["dashboardAlias"].Value;
|
||||
string dbConfig = SystemFiles.DashboardConfig;
|
||||
XmlDocument dashboardFile = xmlHelper.OpenAsXmlDocument(dbConfig);
|
||||
|
||||
XmlNode section = dashboardFile.SelectSingleNode("//section [@alias = '" + sectionAlias + "']");
|
||||
|
||||
if (section != null)
|
||||
{
|
||||
|
||||
dashboardFile.SelectSingleNode("/dashBoard").RemoveChild(section);
|
||||
dashboardFile.Save(IOHelper.MapPath(dbConfig));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
public class addProxyFeedHost : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
var hostname = xmlData.Attributes["host"].Value;
|
||||
if (string.IsNullOrEmpty(hostname))
|
||||
return false;
|
||||
|
||||
var xdoc = xmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig);
|
||||
|
||||
xdoc.PreserveWhitespace = true;
|
||||
|
||||
var xn = xdoc.SelectSingleNode("//feedProxy");
|
||||
if (xn != null)
|
||||
{
|
||||
var insert = true;
|
||||
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode node in xn.SelectNodes("//allow"))
|
||||
{
|
||||
if (node.Attributes["host"] != null && node.Attributes["host"].Value == hostname)
|
||||
insert = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (insert)
|
||||
{
|
||||
var newHostname = xmlHelper.addTextNode(xdoc, "allow", string.Empty);
|
||||
newHostname.Attributes.Append(xmlHelper.addAttribute(xdoc, "host", hostname));
|
||||
xn.AppendChild(newHostname);
|
||||
|
||||
xdoc.Save(IOHelper.MapPath(SystemFiles.FeedProxyConfig));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string Alias()
|
||||
{
|
||||
return "addProxyFeedHost";
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
var hostname = xmlData.Attributes["host"].Value;
|
||||
if (string.IsNullOrEmpty(hostname))
|
||||
return false;
|
||||
|
||||
var xdoc = xmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig);
|
||||
xdoc.PreserveWhitespace = true;
|
||||
|
||||
var xn = xdoc.SelectSingleNode("//feedProxy");
|
||||
if (xn != null)
|
||||
{
|
||||
bool inserted = false;
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode node in xn.SelectNodes("//allow"))
|
||||
{
|
||||
if (node.Attributes["host"] != null && node.Attributes["host"].Value == hostname)
|
||||
{
|
||||
xn.RemoveChild(node);
|
||||
inserted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inserted)
|
||||
{
|
||||
xdoc.Save(IOHelper.MapPath(SystemFiles.FeedProxyConfig));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
string sample = "<Action runat=\"install\" undo=\"true\" alias=\"addProxyFeedHost\" host=\"umbraco.com\"/>";
|
||||
return helper.parseStringToXmlNode(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
public class addRestExtension : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
XmlNodeList _newExts = xmlData.SelectNodes("//ext");
|
||||
|
||||
if (_newExts.Count > 0)
|
||||
{
|
||||
|
||||
string reConfig = SystemFiles.RestextensionsConfig;
|
||||
|
||||
XmlDocument xdoc = new XmlDocument();
|
||||
xdoc.PreserveWhitespace = true;
|
||||
xdoc = xmlHelper.OpenAsXmlDocument(reConfig);
|
||||
|
||||
|
||||
XmlNode xn = xdoc.SelectSingleNode("//RestExtensions");
|
||||
|
||||
if (xn != null)
|
||||
{
|
||||
for (int i = 0; i < _newExts.Count; i++)
|
||||
{
|
||||
XmlNode newExt = _newExts[i];
|
||||
string _alias = newExt.Attributes["alias"].Value;
|
||||
|
||||
bool insertExt = true;
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode ext in xn.SelectNodes("//ext"))
|
||||
{
|
||||
if (ext.Attributes["alias"] != null && ext.Attributes["alias"].Value == _alias)
|
||||
insertExt = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (insertExt)
|
||||
{
|
||||
xn.AppendChild(xdoc.ImportNode(newExt, true));
|
||||
}
|
||||
}
|
||||
|
||||
xdoc.Save(IOHelper.MapPath(reConfig));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string Alias()
|
||||
{
|
||||
return "addRestExtension";
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
XmlNodeList _newExts = xmlData.SelectNodes("//ext");
|
||||
|
||||
if (_newExts.Count > 0)
|
||||
{
|
||||
string reConfig = SystemFiles.RestextensionsConfig;
|
||||
|
||||
XmlDocument xdoc = new XmlDocument();
|
||||
xdoc.PreserveWhitespace = true;
|
||||
xdoc.Load(reConfig);
|
||||
|
||||
XmlNode xn = xdoc.SelectSingleNode("//RestExtensions");
|
||||
|
||||
if (xn != null)
|
||||
{
|
||||
bool inserted = false;
|
||||
|
||||
for (int i = 0; i < _newExts.Count; i++)
|
||||
{
|
||||
XmlNode newExt = _newExts[i];
|
||||
string _alias = newExt.Attributes["alias"].Value;
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode ext in xn.SelectNodes("//ext"))
|
||||
{
|
||||
if (ext.Attributes["alias"] != null && ext.Attributes["alias"].Value == _alias)
|
||||
{
|
||||
xn.RemoveChild(ext);
|
||||
inserted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inserted)
|
||||
{
|
||||
xdoc.Save(IOHelper.MapPath(reConfig));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// addStringToHtmlElement adds a string to specific HTML element in a specific template, and can either append or prepend it.
|
||||
/// It uses the action xml node to do this, exemple action xml node:
|
||||
/// <Action runat="install" alias="addStringToHtmlElement" templateAlias="news" htmlElementId="newsSection" position="end"><![CDATA[hello world!]]></action>
|
||||
/// The above will add the string "hello world!" to the first html element with the id "newsSection" in the template "news"
|
||||
/// </summary>
|
||||
public class addStringToHtmlElement : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Executes the specified package action.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <example><code><code>
|
||||
/// <Action runat="install" alias="addStringToHtmlElement" templateAlias="news" htmlElementId="newsSection" position="[beginning/end"><![CDATA[hello world!]]></action>
|
||||
/// </code></code></example>
|
||||
/// <returns>True if executed successfully</returns>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, BusinessLogic.User.GetUser(0), -1, "executing addStringToHtmlElement");
|
||||
|
||||
string templateAlias = xmlData.Attributes["templateAlias"].Value;
|
||||
string htmlElementId = xmlData.Attributes["htmlElementId"].Value;
|
||||
string position = xmlData.Attributes["position"].Value;
|
||||
string value = xmlHelper.GetNodeValue(xmlData);
|
||||
template.Template tmp = template.Template.GetByAlias(templateAlias);
|
||||
|
||||
if (UmbracoSettings.UseAspNetMasterPages)
|
||||
value = tmp.EnsureMasterPageSyntax(value);
|
||||
|
||||
_addStringToHtmlElement(tmp, value, templateAlias, htmlElementId, position);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Undoes the addStringToHtml Execute() method, by removing the same string from the same template.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string templateAlias = xmlData.Attributes["templateAlias"].Value;
|
||||
string htmlElementId = xmlData.Attributes["htmlElementId"].Value;
|
||||
string value = xmlHelper.GetNodeValue(xmlData);
|
||||
template.Template tmp = template.Template.GetByAlias(templateAlias);
|
||||
|
||||
if (UmbracoSettings.UseAspNetMasterPages)
|
||||
value = tmp.EnsureMasterPageSyntax(value);
|
||||
|
||||
_removeStringFromHtmlElement(tmp, value, templateAlias, htmlElementId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action alias.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "addStringToHtmlElement";
|
||||
}
|
||||
|
||||
private void _addStringToHtmlElement(template.Template tmp, string value, string templateAlias, string htmlElementId, string position)
|
||||
{
|
||||
bool hasAspNetContentBeginning = false;
|
||||
string design = "";
|
||||
string directive = "";
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument templateXml = new XmlDocument();
|
||||
templateXml.PreserveWhitespace = true;
|
||||
|
||||
//Make sure that directive is remove before hacked non html4 compatiple replacement action...
|
||||
design = tmp.Design;
|
||||
|
||||
|
||||
splitDesignAndDirective(ref design, ref directive);
|
||||
|
||||
//making sure that the template xml has a root node...
|
||||
if (tmp.MasterTemplate > 0)
|
||||
templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "<root>" + design + "</root>", true));
|
||||
else
|
||||
templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true));
|
||||
|
||||
XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']");
|
||||
|
||||
if (xmlElement != null)
|
||||
{
|
||||
|
||||
if (position == "beginning")
|
||||
{
|
||||
xmlElement.InnerXml = "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n" + xmlElement.InnerXml;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlElement.InnerXml = xmlElement.InnerXml + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false);
|
||||
tmp.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<addStringToHtmlElement>("An error occurred", ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Debug<addStringToHtmlElement>("template not found");
|
||||
}
|
||||
}
|
||||
|
||||
private void _removeStringFromHtmlElement(template.Template tmp, string value, string templateAlias, string htmlElementId)
|
||||
{
|
||||
bool hasAspNetContentBeginning = false;
|
||||
string design = "";
|
||||
string directive = "";
|
||||
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument templateXml = new XmlDocument();
|
||||
templateXml.PreserveWhitespace = true;
|
||||
|
||||
//Make sure that directive is remove before hacked non html4 compatiple replacement action...
|
||||
design = tmp.Design;
|
||||
splitDesignAndDirective(ref design, ref directive);
|
||||
|
||||
//making sure that the template xml has a root node...
|
||||
if (tmp.MasterTemplate > 0)
|
||||
templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "<root>" + design + "</root>", true));
|
||||
else
|
||||
templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true));
|
||||
|
||||
XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']");
|
||||
|
||||
|
||||
|
||||
if (xmlElement != null)
|
||||
{
|
||||
string repValue = helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true);
|
||||
xmlElement.InnerXml = xmlElement.InnerXml.Replace(repValue, "");
|
||||
}
|
||||
|
||||
tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false);
|
||||
tmp.Save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<addStringToHtmlElement>("An error occurred", ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Debug<addStringToHtmlElement>("template not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void splitDesignAndDirective(ref string design, ref string directive)
|
||||
{
|
||||
if (design.StartsWith("<%@"))
|
||||
{
|
||||
directive = design.Substring(0, design.IndexOf("%>") + 2).Trim(Environment.NewLine.ToCharArray());
|
||||
design = design.Substring(design.IndexOf("%>") + 3).Trim(Environment.NewLine.ToCharArray());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
public class addXsltExtension : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
string _assembly = xmlData.Attributes["assembly"].Value;
|
||||
string _type = xmlData.Attributes["type"].Value;
|
||||
string _alias = xmlData.Attributes["extensionAlias"].Value;
|
||||
string xeConfig = SystemFiles.XsltextensionsConfig;
|
||||
|
||||
XmlDocument xdoc = new XmlDocument();
|
||||
xdoc.PreserveWhitespace = true;
|
||||
xdoc = xmlHelper.OpenAsXmlDocument(xeConfig);
|
||||
|
||||
XmlNode xn = xdoc.SelectSingleNode("//XsltExtensions");
|
||||
|
||||
if (xn != null)
|
||||
{
|
||||
bool insertExt = true;
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode ext in xn.SelectNodes("//ext"))
|
||||
{
|
||||
if (ext.Attributes["alias"] != null && ext.Attributes["alias"].Value == _alias)
|
||||
insertExt = false;
|
||||
}
|
||||
}
|
||||
if (insertExt)
|
||||
{
|
||||
XmlNode newExt = umbraco.xmlHelper.addTextNode(xdoc, "ext", "");
|
||||
newExt.Attributes.Append(umbraco.xmlHelper.addAttribute(xdoc, "assembly", _assembly.Replace("/bin/", "")));
|
||||
newExt.Attributes.Append(umbraco.xmlHelper.addAttribute(xdoc, "type", _type));
|
||||
newExt.Attributes.Append(umbraco.xmlHelper.addAttribute(xdoc, "alias", _alias));
|
||||
xn.AppendChild(newExt);
|
||||
|
||||
|
||||
xdoc.Save(IOHelper.MapPath(xeConfig));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string Alias()
|
||||
{
|
||||
return "addXsltExtension";
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string _assembly = xmlData.Attributes["assembly"].Value;
|
||||
string _type = xmlData.Attributes["type"].Value;
|
||||
string _alias = xmlData.Attributes["extensionAlias"].Value;
|
||||
string xeConfig = SystemFiles.XsltextensionsConfig;
|
||||
|
||||
XmlDocument xdoc = new XmlDocument();
|
||||
xdoc.PreserveWhitespace = true;
|
||||
xdoc = xmlHelper.OpenAsXmlDocument(xeConfig);
|
||||
|
||||
XmlNode xn = xdoc.SelectSingleNode("//XsltExtensions");
|
||||
|
||||
if (xn != null)
|
||||
{
|
||||
bool inserted = false;
|
||||
if (xn.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode ext in xn.SelectNodes("//ext"))
|
||||
{
|
||||
if (ext.Attributes["alias"] != null && ext.Attributes["alias"].Value == _alias)
|
||||
{
|
||||
xn.RemoveChild(ext);
|
||||
inserted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inserted)
|
||||
{
|
||||
xdoc.Save(IOHelper.MapPath(xeConfig));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// </summary>
|
||||
public class allowDoctype : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Allows a documentType to be created below another documentType.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <example><code>
|
||||
/// <Action runat="install" alias="allowDocumenttype" documentTypeAlias="MyNewDocumentType" parentDocumentTypeAlias="HomePage" />
|
||||
/// </code></example>
|
||||
/// <returns>Returns true on success</returns>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
string doctypeName = xmlData.Attributes["documentTypeAlias"].Value;
|
||||
string parentDoctypeName = xmlData.Attributes["parentDocumentTypeAlias"].Value;
|
||||
|
||||
cms.businesslogic.ContentType ct = cms.businesslogic.ContentType.GetByAlias(doctypeName);
|
||||
cms.businesslogic.ContentType parentct = cms.businesslogic.ContentType.GetByAlias(parentDoctypeName);
|
||||
|
||||
if (ct != null && parentct != null)
|
||||
{
|
||||
bool containsId = false;
|
||||
ArrayList tmp = new ArrayList();
|
||||
|
||||
foreach (int i in parentct.AllowedChildContentTypeIDs.ToList())
|
||||
{
|
||||
tmp.Add(i);
|
||||
if (i == ct.Id)
|
||||
containsId = true;
|
||||
}
|
||||
|
||||
if (!containsId)
|
||||
{
|
||||
|
||||
int[] ids = new int[tmp.Count + 1];
|
||||
for (int i = 0; i < tmp.Count; i++) ids[i] = (int)tmp[i];
|
||||
ids[ids.Length - 1] = ct.Id;
|
||||
|
||||
parentct.AllowedChildContentTypeIDs = ids;
|
||||
parentct.Save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//this has no undo.
|
||||
/// <summary>
|
||||
/// This action has no undo.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action Alias.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "allowDocumenttype";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
public class helper
|
||||
{
|
||||
//Helper method to replace umbraco tags that breaks the xml format..
|
||||
public static string parseToValidXml(template.Template templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid)
|
||||
{
|
||||
string retVal = template;
|
||||
if (toValid)
|
||||
{
|
||||
// test for asp:content as the first part of the design
|
||||
if (retVal.StartsWith("<asp:content", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
hasAspNetContentBeginning = true;
|
||||
retVal = retVal.Substring(retVal.IndexOf(">") + 1);
|
||||
retVal = retVal.Substring(0, retVal.Length - 14);
|
||||
}
|
||||
//shorten empty macro tags..
|
||||
retVal = retVal.Replace("></umbraco:macro>", " />");
|
||||
retVal = retVal.Replace("></umbraco:Macro>", " />");
|
||||
|
||||
retVal = retVal.Replace("<umbraco:", "<umbraco__");
|
||||
retVal = retVal.Replace("</umbraco:", "</umbraco__");
|
||||
retVal = retVal.Replace("<asp:", "<asp__");
|
||||
retVal = retVal.Replace("</asp:", "</asp__");
|
||||
|
||||
retVal = retVal.Replace("?UMBRACO_GETITEM", "UMBRACO_GETITEM");
|
||||
retVal = retVal.Replace("?UMBRACO_TEMPLATE_LOAD_CHILD", "UMBRACO_TEMPLATE_LOAD_CHILD");
|
||||
retVal = retVal.Replace("?UMBRACO_MACRO", "UMBRACO_MACRO");
|
||||
retVal = retVal.Replace("?ASPNET_FORM", "ASPNET_FORM");
|
||||
retVal = retVal.Replace("?ASPNET_HEAD", "ASPNET_HEAD");
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = retVal.Replace("<umbraco__", "<umbraco:");
|
||||
retVal = retVal.Replace("</umbraco__", "</umbraco:");
|
||||
retVal = retVal.Replace("<asp__", "<asp:");
|
||||
retVal = retVal.Replace("</asp__", "</asp:");
|
||||
retVal = retVal.Replace("UMBRACO_GETITEM", "?UMBRACO_GETITEM");
|
||||
retVal = retVal.Replace("UMBRACO_TEMPLATE_LOAD_CHILD", "?UMBRACO_TEMPLATE_LOAD_CHILD");
|
||||
retVal = retVal.Replace("UMBRACO_MACRO", "?UMBRACO_MACRO");
|
||||
retVal = retVal.Replace("ASPNET_FORM", "?ASPNET_FORM");
|
||||
retVal = retVal.Replace("ASPNET_HEAD", "?ASPNET_HEAD");
|
||||
retVal = retVal.Replace("<root>", "");
|
||||
retVal = retVal.Replace("<root xmlns:asp=\"http://microsoft.com\">", "");
|
||||
retVal = retVal.Replace("</root>", "");
|
||||
|
||||
// add asp content element
|
||||
if (hasAspNetContentBeginning)
|
||||
{
|
||||
retVal = templateObj.GetMasterContentElement(templateObj.MasterTemplate) + retVal + "</asp:content>";
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static XmlNode parseStringToXmlNode(string value)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode node = xmlHelper.addTextNode(doc, "error", "");
|
||||
|
||||
try
|
||||
{
|
||||
doc.LoadXml(value);
|
||||
return doc.SelectSingleNode(".");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// </summary>
|
||||
public class moveRootDocument : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Executes the specified package action.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <example><code>
|
||||
/// <Action runat="install" alias="moveRootDocument" documentName="News" parentDocumentType="Home" />
|
||||
/// </code></example>
|
||||
/// <returns>True if executed succesfully</returns>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
string documentName = xmlData.Attributes["documentName"].Value;
|
||||
string parentDocumentType = xmlData.Attributes["parentDocumentType"].Value;
|
||||
string parentDocumentName = "";
|
||||
|
||||
if (xmlData.Attributes["parentDocumentName"] != null)
|
||||
parentDocumentName = xmlData.Attributes["parentDocumentName"].Value;
|
||||
|
||||
int parentDocid = 0;
|
||||
|
||||
ContentType ct = ContentType.GetByAlias(parentDocumentType);
|
||||
Content[] docs = web.Document.getContentOfContentType(ct);
|
||||
|
||||
if (docs.Length > 0)
|
||||
{
|
||||
if (String.IsNullOrEmpty(parentDocumentName))
|
||||
parentDocid = docs[0].Id;
|
||||
else
|
||||
{
|
||||
foreach (Content doc in docs)
|
||||
{
|
||||
if (doc.Text == parentDocumentName)
|
||||
parentDocid = doc.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parentDocid > 0)
|
||||
{
|
||||
web.Document[] rootDocs = web.Document.GetRootDocuments();
|
||||
|
||||
foreach (web.Document rootDoc in rootDocs)
|
||||
{
|
||||
if (rootDoc.Text == documentName)
|
||||
{
|
||||
rootDoc.Move(parentDocid);
|
||||
rootDoc.PublishWithSubs(new umbraco.BusinessLogic.User(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//this has no undo.
|
||||
/// <summary>
|
||||
/// This action has no undo.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action alias
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "moveRootDocument";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IPackageAction Interface, used to execute code when packages are installed.
|
||||
/// All IPackageActions only takes a PackageName and a XmlNode as input, and executes based on the data in the xmlnode.
|
||||
/// </summary>
|
||||
public class publishRootDocument : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
/// <summary>
|
||||
/// Executes the specified package action.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <example>
|
||||
/// <Action runat="install" alias="publishRootDocument" documentName="News" />
|
||||
/// </example>
|
||||
/// <returns>True if executed succesfully</returns>
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
|
||||
string documentName = xmlData.Attributes["documentName"].Value;
|
||||
|
||||
int parentDocid = 0;
|
||||
|
||||
web.Document[] rootDocs = web.Document.GetRootDocuments();
|
||||
|
||||
foreach (web.Document rootDoc in rootDocs)
|
||||
{
|
||||
if (rootDoc.Text.Trim() == documentName.Trim() && rootDoc != null && rootDoc.ContentType != null)
|
||||
{
|
||||
|
||||
rootDoc.PublishWithChildrenWithResult(umbraco.BusinessLogic.User.GetUser(0));
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//this has no undo.
|
||||
/// <summary>
|
||||
/// This action has no undo.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Name of the package.</param>
|
||||
/// <param name="xmlData">The XML data.</param>
|
||||
/// <returns></returns>
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action alias
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Alias()
|
||||
{
|
||||
return "publishRootDocument";
|
||||
}
|
||||
#endregion
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.standardPackageActions
|
||||
{
|
||||
public class removeStringFromTemplate : umbraco.interfaces.IPackageAction
|
||||
{
|
||||
#region IPackageAction Members
|
||||
|
||||
public bool Execute(string packageName, XmlNode xmlData)
|
||||
{
|
||||
addStringToHtmlElement ast = new addStringToHtmlElement();
|
||||
return ast.Undo(packageName, xmlData);
|
||||
}
|
||||
|
||||
public string Alias()
|
||||
{
|
||||
return "removeStringFromHtmlElement";
|
||||
}
|
||||
|
||||
public bool Undo(string packageName, XmlNode xmlData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public XmlNode SampleXml()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager.repositories {
|
||||
@@ -71,8 +72,10 @@ namespace umbraco.cms.businesslogic.packager.repositories {
|
||||
byte[] thumb = new byte[0]; //todo upload thumbnail...
|
||||
|
||||
return Webservice.SubmitPackage(m_guid, authorGuid, packageGuid, pack, doc, thumb, packageName, "", "", description);
|
||||
} catch (Exception ex) {
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<Repository>("An error occurred in SubmitPackage", ex);
|
||||
|
||||
return SubmitStatus.Error;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace umbraco.cms.businesslogic.packager
|
||||
{
|
||||
@@ -178,15 +179,19 @@ namespace umbraco.cms.businesslogic.packager
|
||||
|
||||
List<PackageInstance> retVal = new List<PackageInstance>();
|
||||
|
||||
for (int i = 0; i < nList.Count; i++) {
|
||||
try {
|
||||
retVal.Add(ConvertXmlToPackage(nList[i]));
|
||||
} catch (Exception ex) {
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, new BusinessLogic.User(0), -1, ex.ToString());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < nList.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
retVal.Add(ConvertXmlToPackage(nList[i]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<data>("An error occurred in GetAllPackages", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private static PackageInstance ConvertXmlToPackage(XmlNode n) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.interfaces;
|
||||
@@ -155,7 +155,7 @@ namespace umbraco.cms.businesslogic.datatype
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, umbraco.BusinessLogic.User.GetUser(0), -1, "Error updating item: " + e.ToString());
|
||||
LogHelper.Error<DefaultData>("Error updating item", e);
|
||||
if (value == null) value = "";
|
||||
SqlHelper.ExecuteNonQuery("update cmsPropertyData set " + _dataType.DataFieldName + " = @value where id = " + m_PropertyId, SqlHelper.CreateParameter("@value", value));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using umbraco.cms.businesslogic.property;
|
||||
@@ -1161,7 +1162,7 @@ where '" + Path + ",' like " + SqlHelper.Concat("node.path", "'%'"));
|
||||
SqlHelper.ExecuteNonQuery("update cmsDocument set published = 0 where nodeId = " + Id);
|
||||
SqlHelper.ExecuteNonQuery("update cmsDocument set published = 1 where versionId = @versionId", SqlHelper.CreateParameter("@versionId", tempVersion));
|
||||
|
||||
BusinessLogic.Log.Add(LogTypes.Debug, -1, newVersion.ToString() + " - " + Id.ToString());
|
||||
LogHelper.Debug<Document>("PublishWithSubs: " + newVersion.ToString() + " - " + Id.ToString());
|
||||
|
||||
// Update xml in db
|
||||
XmlGenerate(new XmlDocument());
|
||||
|
||||
@@ -242,6 +242,17 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>PackageFiles.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addApplication.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addDashboardSection.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addProxyFeedHost.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addRestExtension.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addStringToHtmlElement.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addXsltExtension.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\allowDoctype.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\helper.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\moveRootDocument.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\publishRootDocument.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\removeStringFromTemplate.cs" />
|
||||
<Compile Include="businesslogic\propertytype\PropertyTypeGroup.cs" />
|
||||
<Compile Include="businesslogic\Property\Properties.cs" />
|
||||
<Compile Include="businesslogic\skinning\controls\ColorPicker.cs" />
|
||||
@@ -339,7 +350,7 @@
|
||||
<Compile Include="businesslogic\Packager\PackageInstance\IPackageInstance.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageInstance\PackageActions.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageInstance\PackageInstance.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\StandardPackageActions.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageActions\addApplicationTree.cs" />
|
||||
<Compile Include="businesslogic\Packager\PackageInstance\utill.cs" />
|
||||
<Compile Include="businesslogic\Packager\Installer.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer;
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace umbraco.editorControls
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, umbraco.BusinessLogic.User.GetUser(0), -1, "Error updating item: " + e.ToString());
|
||||
LogHelper.Error(typeof(DefaultData), "Error updating item: " + e.ToString(), e);
|
||||
|
||||
if (value==null) value ="";
|
||||
SqlHelper.ExecuteNonQuery("update cmsPropertyData set "+ _dataType.DataFieldName +" = @value where id = " + _propertyId, SqlHelper.CreateParameter("@value", value) );
|
||||
_value = value;
|
||||
|
||||
@@ -9,6 +9,8 @@ using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.Services;
|
||||
using System.Web.Services.Protocols;
|
||||
using Umbraco.Core.Logging;
|
||||
using umbraco.BasePages;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.IO;
|
||||
|
||||
@@ -50,13 +52,16 @@ namespace umbraco.webservices
|
||||
|
||||
User u = new User(username);
|
||||
if(!HttpContext.Current.Request.Url.Scheme.Equals("https"))
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, u, -1, "Webservices login attempted without https");
|
||||
{
|
||||
LogHelper.Debug<BaseWebService>("Webservices login attempted without https");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].ValidateUser(username, password))
|
||||
{
|
||||
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Login, u, -1,"Webservices");
|
||||
LogHelper.Info<BaseWebService>("User {0} (Id: {1}) logged in", () => u.Name, () => u.Id);
|
||||
return u;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user