private void HandlePlugin(XmlNode contentNode, string[] args, Process process) { IPlugin provider = GetProvider(contentNode.Attributes["provider"].Value); if (provider != null) { switch (contentNode.Name) { case "load": ControlList control = process.Content.GetSubControl(CommonXml.GetAttributeValue(contentNode, "place")); string action = CommonXml.GetAttributeValue(contentNode, "action"); string value = GetValue(contentNode, process); string pathTrail = JoinPath(Common.RemoveOne(args)); if (provider is IPlugin2) { ((IPlugin2)provider).Load(control, action, value, pathTrail); } else { provider.Load(control, action, pathTrail); } break; case "handle": string mainEvent = process.QueryEvents["main"]; if (mainEvent != "") { provider.Handle(mainEvent); } break; } } }
public string this[string name] { get { return(CommonXml.GetAttributeValue(m_XmlNode, name)); } set { CommonXml.SetAttributeValue(m_XmlNode, name, value); } }
private string GetValue(XmlNode contentNode, Process process) { StringBuilder value = new StringBuilder(CommonXml.GetAttributeValue(contentNode, "value")); if (value.ToString() == string.Empty) { // No value is specified. Maybe a variable was requested? string variable = CommonXml.GetAttributeValue(contentNode, "variable"); if (variable != string.Empty) { value = new StringBuilder(process.Variables[variable]); } } else { // Replace variables ReplaceVariables(process.Variables, value); } return(value.ToString()); }
private void LoopThroughProcess(string[] args, XmlNode xmlNode, Process process) { if (args[0] != string.Empty) { args[0] = CommonXml.RenameIntegerPath(args[0]); xmlNode = xmlNode.SelectSingleNode(args[0]); if (xmlNode != null) { if (process.CheckGroups(CommonXml.GetAttributeValue(xmlNode, "rights"))) { XmlNodeList contentNodes = xmlNode.SelectNodes("*"); foreach (XmlNode contentNode in contentNodes) { // Not very pretty, I know, but it seems to be the // best way to allow for proper debugging if (process.HttpPage.Request.ServerVariables["REMOTE_ADDR"] == "127.0.0.1") { switch (contentNode.Name) { case "load": HandlePlugin(contentNode, args, process); break; case "handle": HandlePlugin(contentNode, args, process); break; case "template": process.mainTemplate = process.Settings["templates/" + contentNode.Attributes["name"].Value]; break; case "redirect": process.HttpPage.Response.Redirect(process.GetUrl(contentNode.Attributes["href"].Value)); break; } } else { try { switch (contentNode.Name) { case "load": HandlePlugin(contentNode, args, process); break; case "handle": HandlePlugin(contentNode, args, process); break; case "template": process.mainTemplate = process.Settings["templates/" + contentNode.Attributes["name"].Value]; break; case "redirect": process.HttpPage.Response.Redirect(process.GetUrl(contentNode.Attributes["href"].Value)); break; } } catch (Exception e) { process.AddMessage(e); } } } args = Common.RemoveOne(args); if (args != null) { LoopThroughProcess(args, xmlNode, process); } } else { string redirectUrl = string.Format("login.aspx?redirect={0}", process.QueryOther["process"]); process.HttpPage.Response.Redirect(redirectUrl); // todo: is this the way to do it } } } }