public override TaskExecutionDetails Execute(string Value) { TaskExecutionDetails d = new TaskExecutionDetails(); if (HttpContext.Current != null && HttpContext.Current.Items["pageID"] != null) { string id = HttpContext.Current.Items["pageID"].ToString(); Document doc = new Document(Convert.ToInt32(id)); if (doc.getProperty(PropertyAlias) != null) { d.OriginalValue = doc.getProperty(PropertyAlias).Value.ToString(); doc.getProperty(PropertyAlias).Value = Value; doc.Publish(new BusinessLogic.User(0)); d.NewValue = Value; d.TaskExecutionStatus = TaskExecutionStatus.Completed; } else d.TaskExecutionStatus = TaskExecutionStatus.Cancelled; } else d.TaskExecutionStatus = TaskExecutionStatus.Cancelled; return d; }
public override TaskExecutionDetails Execute(string Value) { TaskExecutionDetails d = new TaskExecutionDetails(); //currently just appending it to the end of the css file StreamWriter sw = File.AppendText(IO.IOHelper.MapPath(SystemDirectories.Css) + "/" + TargetFile); sw.WriteLine(string.Format("{0}{{ {1}:{2};}}", TargetRule, TargetParameter, Value)); sw.Close(); d.TaskExecutionStatus = TaskExecutionStatus.Completed; d.OriginalValue = ""; d.NewValue = Value; return d; }
public override TaskExecutionDetails Execute(string Value) { TaskExecutionDetails d = new TaskExecutionDetails(); HtmlDocument doc = new HtmlDocument(); doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile); //if (doc.DocumentNode.SelectSingleNode(string.Format("//link [@href = '{0}']", Value)) == null) //{ HtmlNode target = doc.DocumentNode.SelectSingleNode(string.IsNullOrEmpty(TargetSelector) ? "//head" : TargetSelector.ToLower()); if (target != null) { HtmlNode s = doc.CreateElement("link"); //s.Name = "link"; s.Attributes.Append("rel", "stylesheet"); s.Attributes.Append("type", "text/css"); s.Attributes.Append("href", Value); if (!string.IsNullOrEmpty(Media)) s.Attributes.Append("media", Media); target.AppendChild(s); doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile); d.TaskExecutionStatus = TaskExecutionStatus.Completed; d.NewValue = Value; } else d.TaskExecutionStatus = TaskExecutionStatus.Cancelled; //} //else // d.TaskExecutionStatus = TaskExecutionStatus.Cancelled; return d; }
public override TaskExecutionDetails Execute(string Value) { TaskExecutionDetails d = new TaskExecutionDetails(); //open template HtmlDocument doc = new HtmlDocument(); doc.Load(IOHelper.MapPath(SystemDirectories.Masterpages) + "/" +TargetFile); if (doc.DocumentNode.SelectNodes(string.Format("//*[@id = '{0}']", TargetID)) != null) { foreach (HtmlNode target in doc.DocumentNode.SelectNodes(string.Format("//*[@id = '{0}']", TargetID))) { if (string.IsNullOrEmpty(TargetAttribute)) { d.OriginalValue = target.InnerHtml; target.InnerHtml = Value; } else { if (target.Attributes[TargetAttribute] == null) { target.Attributes.Append(TargetAttribute, Value); } else { d.OriginalValue = target.Attributes[TargetAttribute].Value; target.Attributes[TargetAttribute].Value = Value; } } } } doc.Save(IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile); d.TaskExecutionStatus = TaskExecutionStatus.Completed; d.NewValue = Value; //save return d; }