protected void ddlTypeCopy_SelectedIndexChanged(object sender, EventArgs e) { TemplateEditorUtils.TemplateDataBind(ddlModule, ddlTypeCopy, ddlTemplate, PortalId, LocalResourceFile, Server); if (rblMode.SelectedValue == "1") { //lblMode.Text = Localization.GetString("lblModeCopy", LocalResourceFile); //lblMode.HelpText = Localization.GetString("lblModeCopy.Help", LocalResourceFile); } }
public override void LoadSettings(Hashtable settings) { try { ddlDataSource.SelectedValue = (string)settings["Widget_DataSourceProvider"]; SelectProvider(ddlDataSource.SelectedValue, settings); TemplateEditorUtils.TemplateDataBind("Widgets", ddlTemplate, PortalId, LocalResourceFile, Server); ddlTemplate.SelectedValue = (string)settings["Widget_Template"]; TemplateEditorUtils.FileDataBind("Widgets", ddlTemplate, ddlFile, PortalId, LocalResourceFile, Server); ddlFile.SelectedValue = (string)settings["Widget_File"]; } catch (Exception exc) // Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void lkbDelete_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxEdit.Text)) { tbxEdit.Text = ""; } tbxEdit.Visible = true; //string path = Server.MapPath(TemplateEditorUtils.GenerateDirectory(ddlModule, ddlType, ddlTemplate, PortalId, Server)); string path = ddlTemplate.SelectedValue; TemplateEditorUtils.DeleteDirectory(Server.MapPath(path)); lblMsg.Visible = true; lblMsg.Text = Localization.GetString("msgSuccessDelete", LocalResourceFile); ddlTemplate.Items.Clear(); ddlTemplate.Items.Add(new ListItem(Localization.GetString("selectTemplate", LocalResourceFile), "")); TemplateEditorUtils.TemplateDataBind(ddlModule.SelectedValue, ddlTemplate, PortalId, LocalResourceFile, Server); ClearTreeView(); RefreshControls(); }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { foreach (var item in DataSourceProvider.GetProviderList()) { ddlDataSource.Items.Add(new ListItem(item.FriendlyName)); } foreach (DataSourceConfigurator conf in phConfigurator.Controls) { conf.Visible = ddlDataSource.SelectedValue == conf.ID; } TemplateEditorUtils.TemplateDataBind("Widgets", ddlTemplate, PortalId, LocalResourceFile, Server); TemplateEditorUtils.FileDataBind("Widgets", ddlTemplate, ddlFile, PortalId, LocalResourceFile, Server); } } catch (Exception exc) // Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void Page_Load(object sender, EventArgs e) { ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); lkbDelete.Attributes.Add("onClick", " return confirm('" + Localization.GetString("msgConfirm", LocalResourceFile) + "')"); lbCreate.NavigateUrl = EditUrl(); PreviewUrl = ModuleContext.NavigateUrl(TabId, "Preview", true, "mid=" + ModuleId); DataSourceUrl = ModuleContext.NavigateUrl(TabId, "DataSource", true, "mid=" + ModuleId); hlSettings.NavigateUrl = EditUrl("Config"); hlHome.NavigateUrl = Globals.NavigateURL(PortalSettings.HomeTabId); /* * string SaveDataSource = Page.ClientScript.GetPostBackEventReference(Page, "SaveDataSource"); * Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "SaveDataSource", string.Format("function SaveDataSource(){{ {0} }}\n", SaveDataSource), true); * string LoadDataSource = Page.ClientScript.GetPostBackEventReference(Page, "SaveDataSource"); * Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "LoadDataSource", string.Format("function LoadDataSource(){{ {0} }}\n", LoadDataSource), true); * if (Page.IsPostBack) * { * string eventArg = Request["__EVENTARGUMENT"]; * if (eventArg == "SaveDataSource") * { * string ds = ""; * foreach (DataSourceConfigurator conf in phConfigurator.Controls) * { * if (conf.Visible) * { * ds += conf.getToken(); * } * } * File.WriteAllText(Server.MapPath(dfeTree.TreeView.SelectedValue), ds); * } * else if (eventArg == "LoadDataSource") * { * string ds = File.ReadAllText(Server.MapPath(dfeTree.TreeView.SelectedValue)); * var dic = DataSourceConfigurator.ParseToken(ds); * foreach (DataSourceConfigurator conf in phConfigurator.Controls) * { * conf.Visible = conf.ID == dic["dataprovider"]; * if (conf.Visible) * { * conf.setToken(ds); * } * } * } * } */ if (!Page.IsPostBack) { //hlNoSkin.NavigateUrl = Request.RawUrl + "?SkinSrc=%5BG%5DSkins/_default/No%20Skin"; TemplateEditorUtils.ModuleDataBind(ddlModule, PortalId, LocalResourceFile, Server); if (Request.Cookies["ddlModule"] != null) { string module_value = Request.Cookies["ddlModule"].Value.ToString(); var module_item = ddlModule.Items.FindByValue(module_value); if (module_item != null) { ddlModule.SelectedValue = module_value; if (ddlModule.SelectedIndex > 0) { TemplateEditorUtils.TemplateDataBind(ddlModule.SelectedValue, ddlTemplate, PortalId, LocalResourceFile, Server); if (!string.IsNullOrEmpty(ddlTemplate.SelectedValue)) { //ddlTemplate_SelectedIndexChanged(null, null); } else if (Request.Cookies["ddlTemplate"] != null) { string template_value = Request.Cookies["ddlTemplate"].Value.ToString(); var template_item = ddlTemplate.Items.FindByValue(template_value); if (template_item != null) { ddlTemplate.SelectedValue = Request.Cookies["ddlTemplate"].Value.ToString(); } } if (!string.IsNullOrEmpty(ddlTemplate.SelectedValue)) { if (Request.Cookies["lkbRefresh"] != null) { showFile(Request.Cookies["lkbRefresh"].Value.ToString()); } } } } } if (Request.Cookies["cbFullScreen"] != null) { cbFullScreen.Checked = Boolean.Parse(Request.Cookies["cbFullScreen"].Value.ToString()); //cbFullScreen_CheckedChanged(null, null); ScopeWrapper.CssClass = cbFullScreen.Checked ? "overlay" : ""; } } else { string ctrlname = Page.Request.Params["__EVENTTARGET"]; if (!string.IsNullOrEmpty(ctrlname)) { var targetControl = this.Page.FindControl(ctrlname); if (targetControl == ddlModule) { TemplateEditorUtils.TemplateDataBind(ddlModule.SelectedValue, ddlTemplate, PortalId, LocalResourceFile, Server); } } } if (!string.IsNullOrEmpty(ddlTemplate.SelectedValue)) { //string path = TemplateEditorUtils.GenerateDirectory(ddlModule, ddlType, ddlTemplate, PortalId, Server); string path = ddlTemplate.SelectedValue; if (dfeTree.Configuration.ViewPaths.Length == 0 || path != dfeTree.Configuration.ViewPaths[0]) { dfeTree.TreeView.Nodes.Clear(); dfeTree.Configuration.ViewPaths = new string[] { path }; dfeTree.Configuration.DeletePaths = dfeTree.Configuration.ViewPaths; dfeTree.Configuration.UploadPaths = dfeTree.Configuration.ViewPaths; } } else { ClearTreeView(); } customMenuOption.Value = "newfile"; dfeTree.TreeView.ContextMenus[0].Items.Add(customMenuOption); dfeTree.TreeView.OnClientContextMenuItemClicked = "OnTreeContextMenuItemClicked"; RefreshControls(); DotNetNuke.Framework.AJAX.RegisterPostBackControl(ddlModule); //DotNetNuke.Framework.AJAX.RegisterPostBackControl(ddlType); DotNetNuke.Framework.AJAX.RegisterPostBackControl(ddlTemplate); //DotNetNuke.Framework.AJAX.RegisterPostBackControl(lkbRefresh); //DotNetNuke.Framework.AJAX.RegisterPostBackControl(btnValid); DotNetNuke.Framework.AJAX.RegisterPostBackControl(lkbDelete); //DotNetNuke.Framework.AJAX.RegisterPostBackControl(lkbRun); lkbData.Visible = hlDataSource.Visible = hlPreview.Visible = hlWidget.Visible = (ddlModule.SelectedValue == "widgets" || ddlModule.SelectedValue == "RazorModules/RazorHost"); }