public System.Web.UI.Control HandleTag(Page page, HtmlTag tag) { Dictionary <string, string> attributes = tag.Attributes; string modName = attributes[AttributesModuleName]; string name = attributes[AttributesName]; Logger.Log(string.Format("BASETagParserPlugin.HandleTag - Prefix:{0} Name:{1} AttributesAsString:{2}", tag.Prefix, tag.TagName, tag.AttributesAsString) , LogPriority.Debug, "TAGPARSER"); ModuleDefinition def = ModuleManager.Current.ModuleDefinitionsByName[modName]; if (def == null) { throw new BASEGenericException(string.Format("Module '{0}' does not exist", modName)); } BASEControlDefinition cdef = def.GetControlDefByName(name); //Now that we have a def we can use that to create a control. IBASEControl newControl = cdef.CreateControl(page, tag.TagName); if (newControl == null) { return((System.Web.UI.Control)newControl); } newControl.InitializeParameters(attributes); return((System.Web.UI.Control)newControl); }
/// <summary> /// Adds a module definition. /// </summary> /// <param name="module">The module Definition to add</param> public void Add(ModuleDefinition module) { //TODO: Add in error checking everywhere if (module == null) { throw new ArgumentNullException("module"); } _moduleDefinitionsByName.Add(module.Name, module); //Parse Admin Panels? Just from this newly aded module. //loop thru all controls. foreach (KeyValuePair <string, BASEControlDefinition> kvp in module._baseControls) { BASEControlDefinition def = kvp.Value; if (def is AdminPanelDefinition) { AdminPanelDefinition admin = (AdminPanelDefinition)def; if (!string.IsNullOrEmpty(admin.CatagoryId)) { _adminPanels[admin.CatagoryId].Add(admin.Name, admin); } } } //Check if admin type. //if so, add to the admin catagory that it defines. }
//Adds a BASE ControlDefiniton into this modules COntrolDef list protected virtual void AddBaseControlDef(BASEControlDefinition def) { string name = def.Name; if (_baseControls.ContainsKey(name)) { //TODO: LOG THIS Logging.Logger.Log(String.Format("The name '{0}' of type '{1}' already exists in the control collection", name, def.GetType().ToString())); throw new BASE.Xml.XmlDefinitionParsingException(String.Format("The name '{0}' of type '{1}' already exists in the control collection", name, def.GetType().ToString())); return; } _baseControls.Add(name, def); }