private void OnUpdateClick(object sender, EventArgs e) { try { if (cboFile.SelectedValue == "None") { //No file type selected UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoFileTypeSelected", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } else { var objModuleControl = ModuleControlController.GetModuleControl(ModuleControlId); if (objModuleControl != null) { var srcVirtualPath = objModuleControl.ControlSrc; var srcPhysicalPath = GetSourceFileName(srcVirtualPath); if (File.Exists(srcPhysicalPath)) { File.SetAttributes(srcPhysicalPath, FileAttributes.Normal); var objStream = File.CreateText(srcPhysicalPath); objStream.WriteLine(txtSource.Text); objStream.Close(); } } Response.Redirect(ReturnURL, true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private string getModulePath(int moduleid, int tabid, string controlKey) { string path = String.Empty; try { ModuleController mc = new ModuleController(); ModuleControlController mcc = new ModuleControlController(); ModuleInfo mi = mc.GetModule(moduleid, tabid); if (mi != null) { var mControl = ModuleControlController.GetModuleControlByControlKey(controlKey, mi.ModuleDefID); if (mControl != null) { path = "~/" + mControl.ControlSrc; } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } return(path); }
private void LoadCommandKeys() { dropCommandKeys.Items.Clear(); dropCommandKeys.DataSource = ModuleControlController.GetModuleControlsForCommand(); dropCommandKeys.DataBind(); dropCommandKeys.Items.Insert(0, new ListItem("None", " ")); }
protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls) { InstallerInfo.Log.AddInfo(REGISTER_Controls); ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl; foreach (ModuleControlInfo tempLoopVar_objModuleControl in Controls) { objModuleControl = tempLoopVar_objModuleControl; // Skins Objects have a null ModuleDefID objModuleControl.ModuleDefID = Null.NullInteger; // check if control exists ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, objModuleControl.ControlKey, objModuleControl.ControlSrc); if (objModuleControl2 == null) { // add new control objModuleControls.AddModuleControl(objModuleControl); } else { // update existing control objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID; objModuleControls.UpdateModuleControl(objModuleControl); } } InstallerInfo.Log.EndJob(REGISTER_End); }
private void RemoveModuleControls(IEnumerable <string> controls) { logger.LogStep("08.--.--", "RemoveModuleControlls - Start", false); var desktopModuleNames = new[] { "2sxc", "2sxc-app" }; // Remove settings and settingswrapper control foreach (var d in desktopModuleNames) { var dmi = DesktopModuleController.GetDesktopModuleByModuleName(d, -1); if (dmi != null) { var mdi = dmi.ModuleDefinitions.FirstOrDefault(); if (mdi.Value != null) { foreach (var c in controls) { var settingsControl = ModuleControlController.GetModuleControlByControlKey(c, mdi.Value.ModuleDefID); if (settingsControl != null) { ModuleControlController.DeleteModuleControl(settingsControl.ModuleControlID); } } } } } }
public static bool IsLegacyUI(int moduleId, string key, int portalId) { var request = HttpContext.Current.Request; var isLegacyUi = true; var settings = PortalController.GetCurrentPortalSettings(); if (settings != null) { isLegacyUi = !(settings.EnablePopUps && !request.Browser.Crawler && request.Browser.EcmaScriptVersion >= new Version(1, 0)); if (!isLegacyUi && !String.IsNullOrEmpty(key)) { var slaveModule = GetSlaveModule(moduleId, key, settings.ActiveTab.TabID); if (slaveModule != null) { var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID) ?? ModuleControlController.GetModuleControlByControlKey(key, Null.NullInteger); if (moduleControl != null) { isLegacyUi = !moduleControl.SupportsPopUps; } } } } return(isLegacyUi); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cboFile.SelectedIndexChanged += OnFileIndexChanged; cmdUpdate.Click += OnUpdateClick; if (Page.IsPostBack == false) { cmdCancel.NavigateUrl = ReturnURL; var objModuleControl = ModuleControlController.GetModuleControl(ModuleControlId); if (objModuleControl != null) { BindFiles(objModuleControl.ControlSrc); } if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer); } else { ViewState["UrlReferrer"] = ""; } } cmdUpdate.Visible = CanEditSource; txtSource.Enabled = CanEditSource; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.cboFile.SelectedIndexChanged += this.OnFileIndexChanged; this.cmdUpdate.Click += this.OnUpdateClick; if (this.Page.IsPostBack == false) { this.cmdCancel.NavigateUrl = this.ReturnURL; var objModuleControl = ModuleControlController.GetModuleControl(this.ModuleControlId); if (objModuleControl != null) { this.BindFiles(objModuleControl.ControlSrc); } if (this.Request.UrlReferrer != null) { this.ViewState["UrlReferrer"] = Convert.ToString(this.Request.UrlReferrer); } else { this.ViewState["UrlReferrer"] = string.Empty; } } this.cmdUpdate.Visible = this.CanEditSource; this.txtSource.Enabled = this.CanEditSource; }
public void MustHaveEmptyHelpUrlForHtmlModule() { var control = ModuleControlController.GetModuleControlByControlKey("", 111); control.HelpURL = ""; ModuleControlController.UpdateModuleControl(control); }
private bool ProcessSlaveModule() { var success = true; var key = UIUtilities.GetControlKey(); var moduleId = UIUtilities.GetModuleId(key); var slaveModule = UIUtilities.GetSlaveModule(moduleId, key, this.PortalSettings.ActiveTab.TabID); Pane pane; this.Panes.TryGetValue(Globals.glbDefaultPane.ToLowerInvariant(), out pane); slaveModule.PaneName = Globals.glbDefaultPane; slaveModule.ContainerSrc = this.PortalSettings.ActiveTab.ContainerSrc; if (string.IsNullOrEmpty(slaveModule.ContainerSrc)) { slaveModule.ContainerSrc = this.PortalSettings.DefaultPortalContainer; } slaveModule.ContainerSrc = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, this.PortalSettings); slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc); var moduleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID); if (moduleControl != null) { slaveModule.ModuleControlId = moduleControl.ModuleControlID; slaveModule.IconFile = moduleControl.IconFile; string permissionKey; switch (slaveModule.ModuleControl.ControlSrc) { case "Admin/Modules/ModuleSettings.ascx": permissionKey = "MANAGE"; break; case "Admin/Modules/Import.ascx": permissionKey = "IMPORT"; break; case "Admin/Modules/Export.ascx": permissionKey = "EXPORT"; break; default: permissionKey = "CONTENT"; break; } if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, permissionKey, slaveModule)) { success = this.InjectModule(pane, slaveModule); } else { this.Response.Redirect(Globals.AccessDeniedURL(Localization.GetString("ModuleAccess.Error")), true); } } return(success); }
public void MustHaveHelpUrlFilledOutForHtmlModule() { var moduleDefId = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Text/HTML").ModuleDefID; var control = ModuleControlController.GetModuleControlByControlKey("", moduleDefId); control.HelpURL = "http://hive.dotnetnuke.com/Default.aspx?tabid=283"; ModuleControlController.UpdateModuleControl(control); }
protected override void OnInit(EventArgs e) { base.OnInit(e); jQuery.RequestDnnPluginsRegistration(); var objModules = new ModuleController(); ModuleControlInfo objModuleControlInfo; //get ModuleId if ((Request.QueryString["ModuleId"] != null)) { _moduleId = Int32.Parse(Request.QueryString["ModuleId"]); } if (Module.ContentItemId == Null.NullInteger && Module.ModuleID != Null.NullInteger) { //This tab does not have a valid ContentItem objModules.CreateContentItem(Module); objModules.UpdateModule(Module); } //Verify that the current user has access to edit this module if (!ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Module)) { Response.Redirect(Globals.AccessDeniedURL(), true); } if (Module != null) { //get module TabModuleId = Module.TabModuleID; //get Settings Control objModuleControlInfo = ModuleControlController.GetModuleControlByControlKey("Settings", Module.ModuleDefID); if (objModuleControlInfo != null) { _control = ControlUtilities.LoadControl <Control>(Page, objModuleControlInfo.ControlSrc); var settingsControl = _control as ISettingsControl; if (settingsControl != null) { //Set ID _control.ID = Path.GetFileNameWithoutExtension(objModuleControlInfo.ControlSrc).Replace('.', '-'); //add module settings settingsControl.ModuleContext.Configuration = Module; hlSpecificSettings.Text = Localization.GetString("ControlTitle_settings", settingsControl.LocalResourceFile); if (String.IsNullOrEmpty(hlSpecificSettings.Text)) { hlSpecificSettings.Text = String.Format(Localization.GetString("ControlTitle_settings", LocalResourceFile), Module.DesktopModule.FriendlyName); } pnlSpecific.Controls.Add(_control); } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// SaveModuleDefinition saves the Module Definition to the database /// </summary> /// <param name="moduleDefinition">The Module Definition to save</param> /// <param name="saveChildren">A flag that determines whether the child objects are also saved</param> /// <param name="clearCache">A flag that determines whether to clear the host cache</param> /// <history> /// [cnurse] 01/14/2008 Created /// </history> /// ----------------------------------------------------------------------------- public static int SaveModuleDefinition(ModuleDefinitionInfo moduleDefinition, bool saveChildren, bool clearCache) { int moduleDefinitionID = moduleDefinition.ModuleDefID; if (moduleDefinitionID == Null.NullInteger) { //Add new Module Definition moduleDefinitionID = dataProvider.AddModuleDefinition(moduleDefinition.DesktopModuleID, moduleDefinition.FriendlyName, moduleDefinition.DefinitionName, moduleDefinition.DefaultCacheTime, UserController.GetCurrentUserInfo().UserID); } else { //Upgrade Module Definition dataProvider.UpdateModuleDefinition(moduleDefinition.ModuleDefID, moduleDefinition.FriendlyName, moduleDefinition.DefinitionName, moduleDefinition.DefaultCacheTime, UserController.GetCurrentUserInfo().UserID); } if (saveChildren) { foreach (KeyValuePair <string, PermissionInfo> kvp in moduleDefinition.Permissions) { kvp.Value.ModuleDefID = moduleDefinitionID; //check if permission exists var permissionController = new PermissionController(); ArrayList permissions = permissionController.GetPermissionByCodeAndKey(kvp.Value.PermissionCode, kvp.Value.PermissionKey); if (permissions != null && permissions.Count == 1) { var permission = (PermissionInfo)permissions[0]; kvp.Value.PermissionID = permission.PermissionID; permissionController.UpdatePermission(kvp.Value); } else { permissionController.AddPermission(kvp.Value); } } foreach (KeyValuePair <string, ModuleControlInfo> kvp in moduleDefinition.ModuleControls) { kvp.Value.ModuleDefID = moduleDefinitionID; //check if definition exists ModuleControlInfo moduleControl = ModuleControlController.GetModuleControlByControlKey(kvp.Value.ControlKey, kvp.Value.ModuleDefID); if (moduleControl != null) { kvp.Value.ModuleControlID = moduleControl.ModuleControlID; } ModuleControlController.SaveModuleControl(kvp.Value, clearCache); } } if (clearCache) { DataCache.ClearHostCache(true); } return(moduleDefinitionID); }
private void OnConfigureClick(object sender, EventArgs e) { var objModuleControl = ModuleControlController.GetModuleControl(ModuleControlId); var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(objModuleControl.ModuleDefID); var objDesktopModule = DesktopModuleController.GetDesktopModule(objModuleDefinition.DesktopModuleID, PortalId); ModuleInfo objModule = ModuleController.Instance.GetModuleByDefinition(-1, "Extensions"); Response.Redirect(Globals.NavigateURL(objModule.TabID, "Edit", "mid=" + objModule.ModuleID.ToString(), "PackageID=" + objDesktopModule.PackageID.ToString()) + "?popUp=true", true); }
private void OnPackageClick(object sender, EventArgs e) { var objModuleControl = ModuleControlController.GetModuleControl(this.ModuleControlId); var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(objModuleControl.ModuleDefID); var objDesktopModule = DesktopModuleController.GetDesktopModule(objModuleDefinition.DesktopModuleID, this.PortalId); ModuleInfo objModule = ModuleController.Instance.GetModuleByDefinition(-1, "Extensions"); this.Response.Redirect(this._navigationManager.NavigateURL(objModule.TabID, "PackageWriter", "rtab=" + this.TabId.ToString(), "packageId=" + objDesktopModule.PackageID.ToString(), "mid=" + objModule.ModuleID.ToString()) + "?popUp=true", true); }
/// <Summary>Page_Load runs when the control is loaded.</Summary> protected void Page_Load(object sender, EventArgs e) { string FriendlyName = ""; ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, false); if (objModule != null) { FriendlyName = objModule.FriendlyName; } int ModuleControlId = Null.NullInteger; if (!(Request.QueryString["ctlid"] == null)) { ModuleControlId = int.Parse(Request.QueryString["ctlid"]); } ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl = objModuleControls.GetModuleControl(ModuleControlId); if (objModuleControl != null) { string FileName = Path.GetFileName(objModuleControl.ControlSrc); string localResourceFile = objModuleControl.ControlSrc.Replace(FileName, Localization.LocalResourceDirectory + "/" + FileName); if (Localization.GetString(ModuleActionType.HelpText, localResourceFile) != "") { lblHelp.Text = Localization.GetString(ModuleActionType.HelpText, localResourceFile); } _key = objModuleControl.ControlKey; string helpUrl = Globals.GetOnLineHelp(objModuleControl.HelpURL, ModuleConfiguration); if (!Null.IsNull(helpUrl)) { cmdHelp.NavigateUrl = Globals.FormatHelpUrl(helpUrl, PortalSettings, FriendlyName); cmdHelp.Visible = true; } else { cmdHelp.Visible = false; } } if (Page.IsPostBack == false) { if (Request.UrlReferrer != null) { ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer); } else { ViewState["UrlReferrer"] = ""; } } }
protected void grdControls_DeleteCommand(object source, DataGridCommandEventArgs e) { int controlID = Int32.Parse(e.CommandArgument.ToString()); ModuleControlController.DeleteModuleControl(controlID); //Force Module Definition to refresh _ModuleDefinition = null; BindDefinition(); }
private void OnPackageClick(object sender, EventArgs e) { var objModuleControl = ModuleControlController.GetModuleControl(ModuleControlId); var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(objModuleControl.ModuleDefID); var objDesktopModule = DesktopModuleController.GetDesktopModule(objModuleDefinition.DesktopModuleID, PortalId); ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModuleByDefinition(-1, "Extensions"); Response.Redirect(Globals.NavigateURL(objModule.TabID, "PackageWriter", "rtab=" + TabId.ToString(), "packageId=" + objDesktopModule.PackageID.ToString(), "mid=" + objModule.ModuleID.ToString()) + "?popUp=true", true); }
protected void Page_Load(object sender, EventArgs e) { if (!CurrentUser.IsSuperAdmin) { Response.Redirect(AppEnv.ADMIN_CMD); } controlId = ConvertUtility.ToInt32(Request.QueryString["cid"]); moduleId = ConvertUtility.ToInt32(Request.QueryString["mid"]); ModuleInfo module = ModuleController.GetModule(moduleId); ModuleControlInfo moduleControl = ModuleControlController.GetModuleControl(controlId); if (moduleControl == null) { this.btnDelete.Visible = false; } if (module == null) { module = ModuleController.GetModule(moduleControl.ModuleID); } if (module != null) { lblModuleName.Text = module.ModuleName; txtControlIcon.fpUploadDir = CheckPath(module); } if (!Page.IsPostBack) { if (module != null && module.ModuleFolder.Length > 0) { GetFiles(Server.MapPath("/"), Server.MapPath(module.ModuleFolder)); dropPath.DataSource = lstFile; dropPath.DataBind(); } MiscUtility.FillIndex(dropControlOrder, 30, 1); chkControlType.DataSource = RoleController.GetRoles(); chkControlType.DataBind(); if (moduleControl == null) { return; } lblModuleName.Text = ModuleController.GetModule(moduleControl.ModuleID).ModuleName; txtControlName.Text = moduleControl.ControlName; txtControlDescription.Text = moduleControl.ControlDescription; txtControlKey.Text = moduleControl.ControlKey; MiscUtility.SelectItemFromList(dropPath, moduleControl.ControlPath); txtControlIcon.Text = moduleControl.ControlIcon; txtControlDescription.Text = moduleControl.ControlDescription; chkControlHeader.Checked = moduleControl.ControlHeader; MiscUtility.SelectItemFromList(dropControlOrder, moduleControl.ControlOrder.ToString()); string[] roleList = (moduleControl.ControlRole != null)?moduleControl.ControlRole.Split("|".ToCharArray()):null; MiscUtility.SelectItemFromList(chkControlType, roleList); } }
private void LoadReadMe() { var templatePath = this.Server.MapPath(this.ControlPath) + "Templates\\" + this.optLanguage.SelectedValue + "\\" + this.cboTemplate.SelectedItem.Value; if (File.Exists(templatePath + "\\readme.txt")) { var readMe = Null.NullString; using (TextReader tr = new StreamReader(templatePath + "\\readme.txt")) { readMe = tr.ReadToEnd(); tr.Close(); } this.lblDescription.Text = readMe.Replace("\n", "<br/>"); } else { this.lblDescription.Text = string.Empty; } // Determine if Control Name is required var controlNameRequired = false; var controlName = "<Not Required>"; string[] fileList = Directory.GetFiles(templatePath); foreach (string filePath in fileList) { if (Path.GetFileName(filePath).ToLowerInvariant().IndexOf("template") > -1) { controlNameRequired = true; controlName = "Edit"; } else { if (Path.GetFileName(filePath).EndsWith(".ascx")) { controlName = Path.GetFileNameWithoutExtension(filePath); } } } this.txtControl.Text = controlName; this.txtControl.Enabled = controlNameRequired; if (this.txtControl.Enabled) { if (!this.cboTemplate.SelectedItem.Value.ToLowerInvariant().StartsWith("module")) { var objModuleControl = ModuleControlController.GetModuleControl(this.ModuleControlId); var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(objModuleControl.ModuleDefID); var objDesktopModule = DesktopModuleController.GetDesktopModule(objModuleDefinition.DesktopModuleID, this.PortalId); this.txtControl.Text = objDesktopModule.FriendlyName; } } }
private void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (cboSource.SelectedIndex != 0 || !String.IsNullOrEmpty(txtSource.Text)) { //check whether have a same control key in the module definition var controlKey = !String.IsNullOrEmpty(txtKey.Text) ? txtKey.Text : Null.NullString; var moduleControls = ModuleControlController.GetModuleControlsByModuleDefinitionID(ModuleDefId).Values; var keyExists = moduleControls.Any(c => c.ControlKey.Equals(controlKey, StringComparison.InvariantCultureIgnoreCase) && c.ModuleControlID != ModuleControlId); if (keyExists) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateKey.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } var moduleControl = new ModuleControlInfo { ModuleControlID = ModuleControlId, ModuleDefID = ModuleDefId, ControlKey = controlKey, ControlTitle = !String.IsNullOrEmpty(txtTitle.Text) ? txtTitle.Text : Null.NullString, ControlSrc = !String.IsNullOrEmpty(txtSource.Text) ? txtSource.Text : cboSource.SelectedItem.Text, ControlType = (SecurityAccessLevel)Enum.Parse(typeof(SecurityAccessLevel), cboType.SelectedItem.Value), ViewOrder = !String.IsNullOrEmpty(txtViewOrder.Text) ? int.Parse(txtViewOrder.Text) : Null.NullInteger, IconFile = cboIcon.SelectedIndex > 0 ? cboIcon.SelectedItem.Text : Null.NullString, HelpURL = !String.IsNullOrEmpty(txtHelpURL.Text) ? txtHelpURL.Text : Null.NullString, SupportsPartialRendering = chkSupportsPartialRendering.Checked, SupportsPopUps = supportsModalPopUpsCheckBox.Checked }; try { ModuleControlController.SaveModuleControl(moduleControl, true); } catch { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } Response.Redirect(ReturnURL, true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("MissingSource.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
public void LoadControls() { if (ModuleDefID > Null.NullInteger) { _ModuleControls = ModuleControlController.GetModuleControlsByModuleDefinitionID(ModuleDefID); } else { _ModuleControls = new Dictionary <string, ModuleControlInfo>(); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { ModuleControlController.DeleteModuleControl(controlId); this.lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { Response.Write(ex.Message); } }
private void cmdDelete_Click(object sender, EventArgs e) { try { if (!Null.IsNull(ModuleControlId)) { ModuleControlController.DeleteModuleControl(ModuleControlId); } Response.Redirect(ReturnURL, true); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (module != null) { txtID.Text = module.ModuleID.ToString(); txtModuleName.Text = module.ModuleName; txtModuleTitle.Text = module.ModuleTitle; txtModuleDescription.Text = module.ModuleDescription; txtModuleFolder.Text = module.ModuleFolder; DataTable dtControls = ModuleControlController.GetModuleControls(moduleId); dtgModuleControls.DataSource = dtControls; dtgModuleControls.DataBind(); } }
void LoadControlByKey(string controlKey) { var moduleToLoad = ModuleControlController.GetModuleControlByControlKey(controlKey, ModuleContext.Configuration. ModuleDefID); if (moduleToLoad != null) { var controlSrc = string.Format("~/{0}", moduleToLoad.ControlSrc); var view = (PortalModuleBase)(LoadControl(controlSrc)); view.ID = Path.GetFileNameWithoutExtension(controlSrc); view.ModuleContext.Configuration = ModuleContext.Configuration; PlaceHolderControl.Controls.Add(view); } }
private static void EnsureEditScriptControlIsRegistered(int moduleDefId) { if (ModuleControlController.GetModuleControlByControlKey("EditRazorScript", moduleDefId) != null) { return; } var m = new ModuleControlInfo { ControlKey = "EditRazorScript", ControlSrc = "DesktopModules/RazorModules/RazorHost/EditScript.ascx", ControlTitle = "Edit Script", ControlType = SecurityAccessLevel.Host, ModuleDefID = moduleDefId }; ModuleControlController.UpdateModuleControl(m); }
protected void Page_Init(Object sender, EventArgs e) { ModuleController objModules = new ModuleController(); ModuleControlController objModuleControlController = new ModuleControlController(); // get ModuleId if ((Request.QueryString["ModuleId"] != null)) { moduleId = int.Parse(Request.QueryString["ModuleId"]); } // get module ModuleInfo objModule = objModules.GetModule(moduleId, TabId, false); if (objModule != null) { tabModuleId = objModule.TabModuleID; //get Settings Control(s) ArrayList arrModuleControls = objModuleControlController.GetModuleControlsByKey("Settings", objModule.ModuleDefID); if (arrModuleControls.Count > 0) { ModuleControlInfo objModuleControlInfo = (ModuleControlInfo)arrModuleControls[0]; string src = "~/" + objModuleControlInfo.ControlSrc; ctlSpecific = (ModuleSettingsBase)LoadControl(src); ctlSpecific.ID = src.Substring(src.LastIndexOf("/") + 1); ctlSpecific.ModuleId = moduleId; ctlSpecific.TabModuleId = tabModuleId; dshSpecific.Text = Localization.LocalizeControlTitle(objModuleControlInfo.ControlTitle, objModuleControlInfo.ControlSrc, "settings"); pnlSpecific.Controls.Add(ctlSpecific); if (Localization.GetString(ModuleActionType.HelpText, ctlSpecific.LocalResourceFile) != "") { rowspecifichelp.Visible = true; imgSpecificHelp.AlternateText = Localization.GetString(ModuleActionType.ModuleHelp, Localization.GlobalResourceFile); lnkSpecificHelp.Text = Localization.GetString(ModuleActionType.ModuleHelp, Localization.GlobalResourceFile); lnkSpecificHelp.NavigateUrl = Globals.NavigateURL(TabId, "Help", "ctlid=" + objModuleControlInfo.ModuleControlID, "moduleid=" + moduleId); } else { rowspecifichelp.Visible = false; } } } }
private void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (cboSource.SelectedIndex != 0 || !String.IsNullOrEmpty(txtSource.Text)) { var moduleControl = new ModuleControlInfo { ModuleControlID = ModuleControlId, ModuleDefID = ModuleDefId, ControlKey = !String.IsNullOrEmpty(txtKey.Text) ? txtKey.Text : Null.NullString, ControlTitle = !String.IsNullOrEmpty(txtTitle.Text) ? txtTitle.Text : Null.NullString, ControlSrc = !String.IsNullOrEmpty(txtSource.Text) ? txtSource.Text : cboSource.SelectedItem.Text, ControlType = (SecurityAccessLevel)Enum.Parse(typeof(SecurityAccessLevel), cboType.SelectedItem.Value), ViewOrder = !String.IsNullOrEmpty(txtViewOrder.Text) ? int.Parse(txtViewOrder.Text) : Null.NullInteger, IconFile = cboIcon.SelectedIndex > 0 ? cboIcon.SelectedItem.Text : Null.NullString, HelpURL = !String.IsNullOrEmpty(txtHelpURL.Text) ? txtHelpURL.Text : Null.NullString, SupportsPartialRendering = chkSupportsPartialRendering.Checked, SupportsPopUps = supportsModalPopUpsCheckBox.Checked }; try { ModuleControlController.SaveModuleControl(moduleControl, true); } catch { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddControl.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } Response.Redirect(ReturnURL, true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("MissingSource.ErrorMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); this.cboFile.SelectedIndexChanged += this.OnFileIndexChanged; this.optLanguage.SelectedIndexChanged += this.OnLanguageSelectedIndexChanged; this.cboTemplate.SelectedIndexChanged += this.cboTemplate_SelectedIndexChanged; this.cmdUpdate.Click += this.OnUpdateClick; this.cmdPackage.Click += this.OnPackageClick; this.cmdConfigure.Click += this.OnConfigureClick; this.cmdCreate.Click += this.OnCreateClick; if (this.Page.IsPostBack == false) { this.cmdCancel1.NavigateUrl = this.ReturnURL; this.cmdCancel2.NavigateUrl = this.ReturnURL; var objModuleControl = ModuleControlController.GetModuleControl(this.ModuleControlId); if (objModuleControl != null) { this.BindFiles(objModuleControl.ControlSrc); this.LoadFile(); } if (this.Request.UrlReferrer != null) { this.ViewState["UrlReferrer"] = Convert.ToString(this.Request.UrlReferrer); } else { this.ViewState["UrlReferrer"] = string.Empty; } this.LoadLanguages(); this.LoadModuleTemplates(); if (this.cboTemplate.Items.FindByText("Module - User Control") != null) { this.cboTemplate.Items.FindByText("Module - User Control").Selected = true; } this.LoadReadMe(); } }