protected void SetRootNode() { if (String.IsNullOrEmpty(ElementName)) { // Get the root UI element root = UIElementInfoProvider.GetRootUIElementInfo(ModuleName); } else { // Get the specified element root = UIElementInfoProvider.GetUIElementInfo(ModuleName, ElementName); } string codeName = root.ElementName.Replace(".", String.Empty).ToLowerCSafe(); string caption = UIElementInfoProvider.GetElementCaption(root); string rootUrl = !String.IsNullOrEmpty(RootTargetURL) ? GetUrl(RootTargetURL) : GetUrl(root.ElementTargetURL); string rootText = caption + DevIcon; if (EnableRootSelect) { rootText = String.Format("<a href=\"{0}\" target=\"{1}\"><span id=\"node_{2}\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\"><span class=\"Name\">{3}</span></span></a>", rootUrl, TargetFrame, codeName, caption); treeElem.SetRoot(rootText, root.ElementID.ToString(), null, rootUrl, TargetFrame); treeElem.EnableRootAction = true; } else { treeElem.SetRoot(rootText, root.ElementID.ToString(), null); } treeElem.ExpandPath = root.ElementIDPath; }
protected void Page_Load(object sender, EventArgs e) { treeElem.OnNodeCreated += new CMSAdminControls_UI_UIProfiles_UIMenu.NodeCreatedEventHandler(menuElem_OnNodeCreated); // Get NOT custom conversions from UI elements UIElementInfo root = UIElementInfoProvider.GetRootUIElementInfo("CMS.WebAnalytics"); if (root != null) { // Get all UI elements to filter custom reports DataSet dsElems = UIElementInfoProvider.GetUIElements("ElementIDPath LIKE '" + DataHelper.EscapeLikeQueryPatterns(root.ElementIDPath, true, true, true) + "/%'", String.Empty, 0, "ElementName,ElementTargetUrl"); if (!DataHelper.DataSourceIsEmpty(dsElems) && (dsElems.Tables.Count > 0)) { // Condition for custom reports customWhereCondition = "StatisticsCode NOT IN ("; foreach (DataRow dr in dsElems.Tables[0].Rows) { string codeName = ValidationHelper.GetString(dr["ElementName"], String.Empty); customWhereCondition += "N'" + SqlHelperClass.GetSafeQueryString(codeName, false) + "',"; } // Add special cases - dont want to show them in UI or Custom report section customWhereCondition += additionalConversions.Replace(';', ','); customWhereCondition = customWhereCondition.TrimEnd(new char[] { ',' }); customWhereCondition += ")"; // Filter AB Testing customWhereCondition += " AND (StatisticsCode NOT LIKE 'abconversion;%') AND (StatisticsCode NOT LIKE 'mvtconversion;%') AND (StatisticsCode NOT LIKE 'campconversion;%') "; } } }
public override void OnInit() { Control.OnNodeCreated += Control_OnNodeCreated; // Get NOT custom conversions from UI elements UIElementInfo root = UIElementInfoProvider.GetRootUIElementInfo("CMS.WebAnalytics"); if (root != null) { // Get all UI elements to filter custom reports DataSet data = UIElementInfoProvider.GetUIElements("ElementIDPath LIKE '" + SqlHelper.EscapeLikeQueryPatterns(root.ElementIDPath) + "/%'", String.Empty, 0, "ElementName,ElementTargetUrl"); if (!DataHelper.DataSourceIsEmpty(data) && (data.Tables.Count > 0)) { // Condition for custom reports customWhereCondition = "StatisticsCode NOT IN ("; foreach (DataRow dr in data.Tables[0].Rows) { string codeName = ValidationHelper.GetString(dr["ElementName"], String.Empty); customWhereCondition += "N'" + SqlHelper.GetSafeQueryString(codeName, false) + "',"; } // Add special cases - don't want to show them in UI or Custom report section customWhereCondition += additionalConversions.Replace(';', ','); customWhereCondition = customWhereCondition.TrimEnd(new[] { ',' }); customWhereCondition += ")"; // Filter AB Testing customWhereCondition += " AND (StatisticsCode NOT LIKE 'abconversion;%') AND (StatisticsCode NOT LIKE 'mvtconversion;%') AND (StatisticsCode NOT LIKE 'campconversion;%') " + "AND (StatisticsCode NOT LIKE 'absessionconversionfirst;%') AND (StatisticsCode NOT LIKE 'absessionconversionrecurring;%') " + "AND (StatisticsCode NOT LIKE 'abvisitfirst;%') AND (StatisticsCode NOT LIKE 'abvisitreturn;%') AND (StatisticsCode <> N'campaign') and (StatisticsCode <> N'conversion') "; } } }
protected void SetRootNode() { if (String.IsNullOrEmpty(ElementName)) { // Get the root UI element root = UIElementInfoProvider.GetRootUIElementInfo(ModuleName); } else { // Get the specified element root = UIElementInfoProvider.GetUIElementInfo(ModuleName, ElementName); } string codeName = root.ElementName.Replace(".", String.Empty).ToLowerCSafe(); string caption = ResHelper.LocalizeString(!String.IsNullOrEmpty(root.ElementCaption) ? root.ElementCaption : root.ElementDisplayName); string rootIcon = DisplayRootIcon ? GetImageUrl(root.ElementIconPath) : ""; string rootUrl = !String.IsNullOrEmpty(RootTargetURL) ? GetUrl(RootTargetURL) : GetUrl(root.ElementTargetURL); string rootText = devIcon + caption; if (EnableRootSelect) { rootText = String.Format("{0}<a href=\"{1}\" target=\"{2}\"><span id=\"node_{3}\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\"><span class=\"Name\">{4}</span></span></a>", devIcon, rootUrl, TargetFrame, codeName, caption); treeElem.SetRoot(rootText, root.ElementID.ToString(), rootIcon, rootUrl, TargetFrame); treeElem.EnableRootAction = true; } else { treeElem.SetRoot(rootText, root.ElementID.ToString(), rootIcon); } treeElem.ExpandPath = root.ElementIDPath; }
/// <summary> /// Handles btnOK's OnClick event - Update resource info. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Finds whether required fields are not empty string result = new Validator().NotEmpty(tbModuleDisplayName.Text.Trim(), GetString("Administration-Module_New.ErrorEmptyModuleDisplayName")).NotEmpty(tbModuleCodeName.Text, GetString("Administration-Module_New.ErrorEmptyModuleCodeName")) .IsCodeName(tbModuleCodeName.Text, GetString("general.invalidcodename")) .Result; if (result == "") { // Check unique name ResourceInfo ri = ResourceInfoProvider.GetResourceInfo(tbModuleCodeName.Text); if ((ri == null) || (ri.ResourceId == moduleId)) { // Get object if (ri == null) { ri = ResourceInfoProvider.GetResourceInfo(moduleId); if (ri == null) { ri = new ResourceInfo(); } } // Update resource info ri.ResourceId = moduleId; ri.ResourceName = tbModuleCodeName.Text; ri.ResourceDescription = txtModuleDescription.Text.Trim(); ri.ResourceDisplayName = tbModuleDisplayName.Text.Trim(); ResourceInfoProvider.SetResourceInfo(ri); // Update root UIElementInfo of the module UIElementInfo elemInfo = UIElementInfoProvider.GetRootUIElementInfo(ri.ResourceId); if (elemInfo == null) { elemInfo = new UIElementInfo(); } elemInfo.ElementResourceID = ri.ResourceId; elemInfo.ElementDisplayName = ri.ResourceDisplayName; elemInfo.ElementName = ri.ResourceName.ToLowerCSafe().Replace(".", ""); elemInfo.ElementIsCustom = false; UIElementInfoProvider.SetUIElementInfo(elemInfo); // Show message ShowChangesSaved(); } else { // Show error message ShowError(GetString("Administration-Module_New.UniqueCodeName")); } } else { // Show error message ShowError(result); } }
protected void Page_Load(object sender, EventArgs e) { this.menuElem.OnNodeCreated += new CMSAdminControls_UI_UIProfiles_UIMenu.NodeCreatedEventHandler(menuElem_OnNodeCreated); ScriptHelper.RegisterClientScriptBlock(this.Page, typeof(string), "AdministrationLoadItem", ScriptHelper.GetScript( "function LoadItem(elementName, elementUrl) \n" + "{ \n" + " parent.frames['analyticsDefault'].location.href = elementUrl; \n" + "} \n")); this.menuElem.EnableRootSelect = false; // If node preselection is happening, expand the navigation tree if (!String.IsNullOrEmpty(this.selectedNode)) { this.menuElem.ExpandLevel = 1; } else { this.menuElem.ExpandLevel = 0; } // Get NOT custom conversions from UI elements UIElementInfo root = UIElementInfoProvider.GetRootUIElementInfo("CMS.WebAnalytics"); if (root != null) { // Get all UI elements to filter custom reports DataSet dsElems = UIElementInfoProvider.GetUIElements("ElementIDPath LIKE '" + DataHelper.EscapeLikeQueryPatterns(root.ElementIDPath, true, true, true) + "/%'", String.Empty, 0, "ElementName,ElementTargetUrl"); if (!SqlHelperClass.DataSourceIsEmpty(dsElems) && (dsElems.Tables.Count > 0)) { // Condition for custom reports customWhereCondition = "StatisticsCode NOT IN ("; foreach (DataRow dr in dsElems.Tables[0].Rows) { string codeName = ValidationHelper.GetString(dr["ElementName"], String.Empty); customWhereCondition += "N'" + SqlHelperClass.GetSafeQueryString(codeName, false) + "',"; } // Add special cases - dont want to show them in UI or Custom report section customWhereCondition += additionalConversions.Replace(';', ','); customWhereCondition = customWhereCondition.TrimEnd(new char[] { ',' }); customWhereCondition += ")"; // Filter AB Testing customWhereCondition += " AND (StatisticsCode NOT LIKE 'abconversion;%') AND (StatisticsCode NOT LIKE 'mvtconversion;%') AND (StatisticsCode NOT LIKE 'campconversion;%') "; } } }
/// <summary> /// Reloads the tree data. /// </summary> public void ReloadData() { ResourceInfo ri = ResourceInfoProvider.GetResourceInfo(this.ModuleID); if (ri != null) { // Get the info root = UIElementInfoProvider.GetRootUIElementInfo(ri.ResourceName); if (root != null) { // Prepare the parameters QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@ModuleID", this.ModuleID); parameters.Add("@RoleID", this.RoleID); // Create and set category provider UniTreeProvider provider = new UniTreeProvider(); provider.QueryName = "cms.uielement.selecttree"; provider.DisplayNameColumn = "ElementName"; provider.IDColumn = "ElementID"; provider.LevelColumn = "ElementLevel"; provider.OrderColumn = "ElementOrder"; provider.ParentIDColumn = "ElementParentID"; provider.PathColumn = "ElementIDPath"; provider.ValueColumn = "ElementID"; provider.ChildCountColumn = "ElementChildCount"; provider.Parameters = parameters; this.treeElem.ExpandTooltip = GetString("general.expand"); this.treeElem.CollapseTooltip = GetString("general.collapse"); this.treeElem.UsePostBack = false; this.treeElem.EnableRootAction = false; this.treeElem.ProviderObject = provider; this.treeElem.ExpandPath = root.ElementIDPath; string rootText = HTMLHelper.HTMLEncode(ri.ResourceDisplayName) + " <span class=\"UITreeSelectButton\">(<span onclick=\"" + (Enabled ? "SelectAllSubelements($j(this), " + root.ElementID + ", false); " + CallbackRef + ";" : "return false;") + "\" >" + GetString("uiprofile.selectall") + "</span>, <span onclick=\"" + (Enabled ? "DeselectAllSubelements($j(this), " + root.ElementID + ", false); " + CallbackRef + ";" : "return false;") + "\" >" + GetString("uiprofile.deselectall") + "</span>)</span>"; this.treeElem.SetRoot(rootText, root.ElementID.ToString(), ResolveUrl(root.ElementIconPath)); this.treeElem.ReloadData(); } } }
/// <summary> /// Creates UI element. Called when the "Create element" button is pressed. /// Expects the CreateModule method to be run first. /// </summary> private bool CreateUIElement() { // Get the module ResourceInfo module = ResourceInfoProvider.GetResourceInfo("MyNewModule"); if (module != null) { // Get the parent UI element UIElementInfo rootElement = UIElementInfoProvider.GetRootUIElementInfo(module.ResourceId); if (rootElement == null) { // Create root UI element rootElement = new UIElementInfo(); rootElement.ElementResourceID = module.ResourceId; rootElement.ElementDisplayName = module.ResourceDisplayName; rootElement.ElementName = module.ResourceName.ToLower().Replace(".", ""); rootElement.ElementIsCustom = false; // Save root UI element UIElementInfoProvider.SetUIElementInfo(rootElement); } // Create new UI element object UIElementInfo newElement = new UIElementInfo(); // Set the properties newElement.ElementDisplayName = "My new element"; newElement.ElementName = "MyNewElement"; newElement.ElementResourceID = module.ResourceId; newElement.ElementIsCustom = true; newElement.ElementParentID = rootElement.ElementID; // Save the UI element UIElementInfoProvider.SetUIElementInfo(newElement); return(true); } return(false); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); ModuleId = QueryHelper.GetInteger("moduleid", 0); if (!RequestHelper.IsPostBack()) { ElementId = QueryHelper.GetInteger("elementId", 0); if (ElementId > 0) { ElementInfo = UIElementInfoProvider.GetUIElementInfo(ElementId); } // If null get root element if (ElementInfo == null) { ElementInfo = UIElementInfoProvider.GetRootUIElementInfo("cms"); } } ContentUrl = UIContextHelper.GetElementUrl(ModuleName.CMS, "Modules.UserInterface.Edit", false); }
protected void Page_Load(object sender, EventArgs e) { // Handle the preselection preselectedItem = QueryHelper.GetString(this.QueryParameterName, ""); if (preselectedItem.StartsWith("cms.", StringComparison.InvariantCultureIgnoreCase)) { preselectedItem = preselectedItem.Substring(4); } this.treeElem.SelectedItem = preselectedItem; // Use images according to culture if (CultureHelper.IsUICultureRTL()) { this.treeElem.LineImagesFolder = GetImageUrl("RTL/Design/Controls/Tree", false, false); } else { this.treeElem.LineImagesFolder = GetImageUrl("Design/Controls/Tree", false, false); } // Register JQuery ScriptHelper.RegisterJQuery(this.Page); // Get the info if (String.IsNullOrEmpty(this.ElementName)) { // Get the root UI element root = UIElementInfoProvider.GetRootUIElementInfo(this.ModuleName); } else { // Get the specified element root = UIElementInfoProvider.GetUIElementInfo(this.ModuleName, this.ElementName); } if (root != null) { string levelWhere = (this.MaxRelativeLevel <= 0 ? "" : " AND (ElementLevel <= " + (root.ElementLevel + this.MaxRelativeLevel) + ")"); string levelColumn = "CASE ElementLevel WHEN " + (root.ElementLevel + this.MaxRelativeLevel) + " THEN 0 ELSE ElementChildCount END AS ElementChildCount"; // Create and set category provider UniTreeProvider provider = new UniTreeProvider(); provider.RootLevelOffset = root.ElementLevel; provider.ObjectType = "cms.uielement"; provider.DisplayNameColumn = "ElementDisplayName"; provider.IDColumn = "ElementID"; provider.LevelColumn = "ElementLevel"; provider.OrderColumn = "ElementOrder"; provider.ParentIDColumn = "ElementParentID"; provider.PathColumn = "ElementIDPath"; provider.ValueColumn = "ElementName"; provider.ChildCountColumn = "ElementChildCount"; provider.WhereCondition = "((ElementLevel = 0) OR ((ElementCaption IS NOT NULL) AND NOT (ElementCaption = '')))" + levelWhere; provider.Columns = "ElementID, ElementName, ElementDisplayName, ElementLevel, ElementOrder, ElementParentID, ElementIDPath, ElementCaption, ElementIconPath, ElementTargetURL, ElementResourceID, " + levelColumn; string redirectScript = ScriptHelper.GetScript("function redirectUrl(node,url,nodeCodeName) {SelectNode(nodeCodeName);if (" + this.JavaScriptHandler + ") { " + this.JavaScriptHandler + "(node, url); } return false;}"); ScriptHelper.RegisterClientScriptBlock(this.Page, typeof(string), "redirect", redirectScript); if (String.IsNullOrEmpty(this.JavaScriptHandler)) { if (EnableRootSelect) { this.treeElem.SelectedNodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\" onclick=\"SelectNode('##NODECODENAME##'); return false;\">##ICON##<span class=\"Name\">##NODECUSTOMNAME##</span></span>"; } else { this.treeElem.SelectedNodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\">##ICON##<span class=\"Name\">##NODECUSTOMNAME##</span></span>"; } this.treeElem.NodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem\" onclick=\"SelectNode('##NODECODENAME##'); return false;\">##ICON##<span class=\"Name\">##NODECUSTOMNAME##</span></span>"; } else { if (EnableRootSelect) { this.treeElem.SelectedNodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\" onclick=\"return redirectUrl(##NODEJAVA##, '##NODETARGETURL##','##NODECODENAME##'); \">##ICON##<a class=\"Name\" href=\"##NODETARGETURL##\">##NODECUSTOMNAME##</a></span>"; } else { this.treeElem.SelectedNodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\">##ICON##<span class=\"Name\">##NODECUSTOMNAME##</span></span>"; } this.treeElem.NodeTemplate = "<span id=\"node_##NODECODENAME##\" name=\"treeNode\" class=\"ContentTreeItem\" onclick=\"return redirectUrl(##NODEJAVA##, '##NODETARGETURL##','##NODECODENAME##'); \">##ICON##<a class=\"Name\" href=\"##NODETARGETURL##\">##NODECUSTOMNAME##</a></span>"; } this.treeElem.UsePostBack = false; this.treeElem.ProviderObject = provider; this.treeElem.ExpandPath = root.ElementIDPath; this.treeElem.OnGetImage += new CMSAdminControls_UI_Trees_UniTree.GetImageEventHandler(treeElem_OnGetImage); this.treeElem.OnNodeCreated += new CMSAdminControls_UI_Trees_UniTree.NodeCreatedEventHandler(treeElem_OnNodeCreated); // Create root node string rootName = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(String.IsNullOrEmpty(root.ElementCaption) ? root.ElementDisplayName : root.ElementCaption)); string rootIcon = "<img src=\"" + URLHelper.ResolveUrl(GetImageUrl("/General/DefaultRoot.png")) + "\" style=\"border:none;height:10px;width:1px;\" />"; string rootText = this.treeElem.ReplaceMacros(this.treeElem.SelectedNodeTemplate, root.ElementID, root.ElementChildCount, rootName, rootIcon, root.ElementParentID, null, null); rootText = rootText.Replace("##NODETARGETURL##", ScriptHelper.GetString(this.RootTargetURL, false)); rootText = rootText.Replace("##NODECUSTOMNAME##", rootName); rootText = rootText.Replace("##NODECODENAME##", root.ElementName); this.treeElem.SetRoot(rootText, root.ElementID.ToString(), (this.DisplayRootIcon ? UIHelper.GetImageUrl(this.Page, root.ElementIconPath) : ""), URLHelper.Url + "#", null); if (EnableRootSelect) { this.treeElem.CustomRootNode.SelectAction = TreeNodeSelectAction.None; } currentUser = CMSContext.CurrentUser; } // Reserve log item DataRow sdr = SecurityHelper.ReserveSecurityLogItem("LoadUIMenu"); this.treeElem.ReloadData(); // Log the security if (sdr != null) { SecurityHelper.SetLogItemData(sdr, currentUser.UserName, this.ModuleName, this.ElementName, totalNodes, CMSContext.CurrentSiteName); } }
protected void Page_Load(object sender, EventArgs e) { int moduleId = QueryHelper.GetInteger("moduleid", 0); int parentId = QueryHelper.GetInteger("parentId", 0); ScriptHelper.RegisterJQuery(this.Page); // Use images according to culture if (CultureHelper.IsUICultureRTL()) { this.uniTree.LineImagesFolder = GetImageUrl("RTL/Design/Controls/Tree", false, false); } else { this.uniTree.LineImagesFolder = GetImageUrl("Design/Controls/Tree", false, false); } if (!RequestHelper.IsPostBack()) { // Get module root element UIElementInfo elemInfo = UIElementInfoProvider.GetRootUIElementInfo(moduleId); if (elemInfo != null) { this.uniTree.SelectPath = elemInfo.ElementIDPath; this.uniTree.ExpandPath = elemInfo.ElementIDPath + "/"; this.menuElem.Value = elemInfo.ElementID + "|" + elemInfo.ElementParentID; } else { // Get current resource ResourceInfo resInfo = ResourceInfoProvider.GetResourceInfo(moduleId); if (resInfo != null) { // Create new UI element elemInfo = new UIElementInfo(); elemInfo.ElementResourceID = moduleId; elemInfo.ElementDisplayName = resInfo.ResourceDisplayName; elemInfo.ElementName = resInfo.ResourceName.ToLower().Replace(".", ""); elemInfo.ElementIsCustom = false; UIElementInfoProvider.SetUIElementInfo(elemInfo); this.uniTree.SelectPath = elemInfo.ElementIDPath; this.uniTree.ExpandPath = elemInfo.ElementIDPath; this.menuElem.Value = elemInfo.ElementID + "|0"; } } } this.menuElem.ResourceID = moduleId; this.menuElem.AfterAction += new OnActionEventHandler(menuElem_AfterAction); // Create and set UIElements provider UniTreeProvider elementProvider = new UniTreeProvider(); elementProvider.ObjectType = "CMS.UIElement"; elementProvider.DisplayNameColumn = "ElementDisplayName"; elementProvider.IDColumn = "ElementID"; elementProvider.LevelColumn = "ElementLevel"; elementProvider.OrderColumn = "ElementOrder"; elementProvider.ParentIDColumn = "ElementParentID"; elementProvider.PathColumn = "ElementIDPath"; elementProvider.ValueColumn = "ElementID"; elementProvider.ChildCountColumn = "ElementChildCount"; elementProvider.WhereCondition = "ElementResourceID = " + moduleId; elementProvider.Columns = "ElementID,ElementLevel,ElementOrder,ElementParentID,ElementIDPath,ElementChildCount,ElementDisplayName"; this.uniTree.UsePostBack = false; this.uniTree.ProviderObject = elementProvider; this.uniTree.ExpandTooltip = GetString("general.expand"); this.uniTree.CollapseTooltip = GetString("general.collapse"); this.uniTree.NodeTemplate = "<span id=\"node_##NODEID##\" onclick=\"SelectNode(##NODEID##,##PARENTNODEID##," + moduleId + "); return false;\" name=\"treeNode\" class=\"ContentTreeItem\"><span class=\"Name\">##NODENAME##</span></span>"; this.uniTree.SelectedNodeTemplate = "<span id=\"node_##NODEID##\" onclick=\"SelectNode(##NODEID##,##PARENTNODEID##," + moduleId + "); return false;\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\"><span class=\"Name\">##NODENAME##</span></span>"; if (!RequestHelper.IsPostBack()) { string selectedPath = QueryHelper.GetString("path", String.Empty); int elementId = QueryHelper.GetInteger("elementId", 0); if (!string.IsNullOrEmpty(selectedPath)) { this.uniTree.SelectPath = selectedPath; } if (elementId > 0) { this.menuElem.ElementID = elementId; this.menuElem.ParentID = parentId; this.menuElem.Value = elementId + "|" + parentId; } } // Load data this.uniTree.ReloadData(); string script = "var frameURL = '" + ResolveUrl("~/CMSModules/Modules/Pages/Development/Module_UI_EditFrameset.aspx") + "';"; script += "var newURL = '" + ResolveUrl("~/CMSModules/Modules/Pages/Development/Module_UI_New.aspx") + "';"; script += "var postParentId = " + parentId + ";"; this.ltlScript.Text = ScriptHelper.GetScript(script); }
/// <summary> /// Handles btnOK's OnClick event - Update resource info. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // finds whether required fields are not empty string result = new Validator().NotEmpty(tbModuleDisplayName.Text.Trim(), GetString("Administration-Module_New.ErrorEmptyModuleDisplayName")).NotEmpty(tbModuleCodeName.Text, GetString("Administration-Module_New.ErrorEmptyModuleCodeName")) .IsCodeName(tbModuleCodeName.Text, GetString("general.invalidcodename")) .Result; if (this.chkShowInDevelopment.Checked && String.IsNullOrEmpty(this.txtResourceUrl.Text.Trim())) { result = GetString("module_edit.emptyurl"); } if (result == "") { // Check unique name ResourceInfo ri = ResourceInfoProvider.GetResourceInfo(tbModuleCodeName.Text); if ((ri == null) || (ri.ResourceId == moduleId)) { // Get object if (ri == null) { ri = ResourceInfoProvider.GetResourceInfo(moduleId); if (ri == null) { ri = new ResourceInfo(); } } //Update resource info ri.ResourceId = moduleId; ri.ResourceName = tbModuleCodeName.Text; ri.ResourceDescription = txtModuleDescription.Text.Trim(); ri.ResourceDisplayName = tbModuleDisplayName.Text.Trim(); ri.ShowInDevelopment = chkShowInDevelopment.Checked; ri.ResourceUrl = (ri.ShowInDevelopment ? txtResourceUrl.Text : ""); pnlResourceUrl.Style.Add("display", (ri.ShowInDevelopment ? "block" : "none")); ResourceInfoProvider.SetResourceInfo(ri); // Update root UIElementInfo of the module UIElementInfo elemInfo = UIElementInfoProvider.GetRootUIElementInfo(ri.ResourceId); if (elemInfo == null) { elemInfo = new UIElementInfo(); } elemInfo.ElementResourceID = ri.ResourceId; elemInfo.ElementDisplayName = ri.ResourceDisplayName; elemInfo.ElementName = ri.ResourceName.ToLower().Replace(".", ""); elemInfo.ElementIsCustom = false; UIElementInfoProvider.SetUIElementInfo(elemInfo); lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); } else { lblInfo.Visible = false; lblError.Visible = true; lblError.Text = GetString("Administration-Module_New.UniqueCodeName"); } } else { lblInfo.Visible = false; lblError.Visible = true; lblError.Text = result; } }