Exemplo n.º 1
0
        private void cmdBuilder_Click(object sender, EventArgs e)
        {
            if (scriptList.SelectedValue.EndsWith("schema.json"))
            {
                var     settings       = ModuleContext.OpenContentSettings();
                FileUri template       = settings.Template.MainTemplateUri();
                string  templateFolder = Path.GetDirectoryName(template.FilePath);
                string  scriptFile     = templateFolder + "/" + scriptList.SelectedValue.Replace("schema.json", "builder.json");
                string  srcFile        = Server.MapPath(scriptFile);

                var schema  = JsonUtils.LoadJsonFromFile(templateFolder + "/" + scriptList.SelectedValue) as JObject;
                var options = JsonUtils.LoadJsonFromFile(templateFolder + "/" + scriptList.SelectedValue.Replace("schema.json", "options.json")) as JObject;

                JObject builder = new JObject();

                if (schema != null && schema["items"] != null)
                {
                    builder["formtype"]   = "array";
                    builder["formfields"] = GetBuilder(schema["items"] as JObject, options != null && options["items"] != null ? options["items"] as JObject : null);
                }
                else
                {
                    builder["formtype"]   = "object";
                    builder["formfields"] = GetBuilder(schema, options);
                }
                if (!File.Exists(srcFile))
                {
                    File.WriteAllText(srcFile, builder.ToString());
                }
                Response.Redirect(Globals.NavigateURL(), true);
            }
        }
Exemplo n.º 2
0
        public override void LoadSettings()
        {
            var template = ModuleContext.OpenContentSettings().Template;

            scriptList.Items.AddRange(OpenContentUtils.GetTemplatesFiles(PortalSettings, ModuleId, template, AppConfig.OPENCONTENT).ToArray());
            base.LoadSettings();
        }
Exemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            var      settings = ModuleContext.OpenContentSettings();
            Manifest manifest = settings.Manifest;

            if (settings.TemplateKey.Extention != ".manifest")
            {
                manifest = ManifestUtils.LoadManifestFileFromCacheOrDisk(settings.TemplateKey.TemplateDir);
            }

            if (manifest != null)
            {
                string addEditControl = manifest.AdditionalEditControl;
                if (!string.IsNullOrEmpty(addEditControl))
                {
                    var contr            = LoadControl(addEditControl);
                    PortalModuleBase mod = contr as PortalModuleBase;
                    if (mod != null)
                    {
                        mod.ModuleConfiguration = this.ModuleConfiguration;
                        mod.ModuleId            = this.ModuleId;
                        mod.LocalResourceFile   = this.LocalResourceFile;
                    }
                    this.Controls.Add(contr);
                }
            }
        }
Exemplo n.º 4
0
        private void scriptList_SelectedIndexChanged(object sender, EventArgs e)
        {
            FileUri template   = ModuleContext.OpenContentSettings().Template.MainTemplateUri();
            var     scriptFile = new FileUri(template.UrlFolder, scriptList.SelectedValue);

            DisplayFile(scriptFile);
        }
Exemplo n.º 5
0
        private void cmdCustom_Click(object sender, EventArgs e)
        {
            var settings = ModuleContext.OpenContentSettings();
            TemplateManifest template       = settings.Template;
            string           templateFolder = template.ManifestFolderUri.UrlFolder;
            string           templateDir    = Server.MapPath(templateFolder);
            string           moduleDir      = Server.MapPath(ModuleTemplateDirectory);

            if (!Directory.Exists(moduleDir))
            {
                Directory.CreateDirectory(moduleDir);
            }
            foreach (var item in Directory.GetFiles(moduleDir))
            {
                File.Delete(item);
            }
            foreach (var item in Directory.GetFiles(templateDir))
            {
                File.Copy(item, moduleDir + Path.GetFileName(item));
            }
            ModuleController mc = new ModuleController();

            var newtemplate = new FileUri(ModuleTemplateDirectory, "schema.json");

            mc.UpdateModuleSetting(ModuleId, "template", newtemplate.FilePath);
            ModuleContext.Settings["template"] = newtemplate.FilePath;
            settings = ModuleContext.OpenContentSettings();
            InitEditor(settings.Template);
        }
Exemplo n.º 6
0
        protected void rblFrom_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddlTemplate.Items.Clear();
            if (rblFrom.SelectedIndex == 0) // site
            {
                var scriptFileSetting = ModuleContext.OpenContentSettings().Template;
                ddlTemplate.Items.AddRange(OpenContentUtils.GetTemplates(ModuleContext.PortalSettings, ModuleContext.ModuleId, scriptFileSetting, App.Config.Opencontent).ToArray());
            }
            else if (rblFrom.SelectedIndex == 1) // web
            {
                FeedParser parser = new FeedParser();
                //var items = parser.Parse("http://www.openextensions.net/templates?agentType=rss&PropertyTypeID=9", FeedType.RSS);
                //foreach (var item in items.OrderBy(t => t.Title))
                //{
                //    ddlTemplate.Items.Add(new ListItem(item.Title, item.ZipEnclosure));
                //}
                //if (ddlTemplate.Items.Count > 0)
                //{
                //    tbTemplateName.Text = Path.GetFileNameWithoutExtension(ddlTemplate.Items[0].Value);
                //}


                foreach (var item in GithubTemplateUtils.GetTemplateList(ModuleContext.PortalId).Where(t => t.Type == Components.Github.TypeEnum.Dir).OrderBy(t => t.Name))
                {
                    ddlTemplate.Items.Add(new ListItem(item.Name, item.Path));
                }
                if (ddlTemplate.Items.Count > 0)
                {
                    tbTemplateName.Text = Path.GetFileNameWithoutExtension(ddlTemplate.Items[0].Value);
                }
            }
            ActivateDetailPage();
        }
Exemplo n.º 7
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            var        settings   = ModuleContext.OpenContentSettings();
            RenderInfo renderinfo = new RenderInfo();

            renderinfo.Template = settings.Template;

            if (settings.TabId > 0 && settings.ModuleId > 0) // other module
            {
                ModuleController mc = new ModuleController();
                renderinfo.SetDataSourceModule(settings.TabId, settings.ModuleId,
                                               mc.GetModule(renderinfo.ModuleId, renderinfo.TabId, false), null, "");
            }
            else // this module
            {
                renderinfo.SetDataSourceModule(settings.TabId, ModuleContext.ModuleId, ModuleContext.Configuration, null, "");
            }

            OpenContent.TemplateInit ti = (TemplateInit)TemplateInitControl;
            ti.ModuleContext        = ModuleContext;
            ti.Settings             = settings;
            ti.Renderinfo           = renderinfo;
            ti.RenderOnlySaveButton = true;
        }
Exemplo n.º 8
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!Page.IsPostBack)
     {
         TemplateManifest template = ModuleContext.OpenContentSettings().Template;
         InitEditor(template);
     }
 }
Exemplo n.º 9
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!Page.IsPostBack)
     {
         TemplateManifest template = ModuleContext.OpenContentSettings().Template;
         InitEditor(template);
     }
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
 }
Exemplo n.º 10
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            var        settings   = ModuleContext.OpenContentSettings();
            RenderInfo renderinfo = new RenderInfo(settings.Template, settings.IsOtherModule);

            OpenContent.TemplateInit ti = (TemplateInit)TemplateInitControl;
            ti.PageRefresh          = true;
            ti.ModuleContext        = ModuleContext;
            ti.Settings             = settings;
            ti.Renderinfo           = renderinfo;
            ti.RenderOnlySaveButton = true;
        }
Exemplo n.º 11
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            hlCancel.NavigateUrl = Globals.NavigateURL();
            cmdSave.NavigateUrl  = Globals.NavigateURL();

            var settings = ModuleContext.OpenContentSettings();

            if (settings.TemplateAvailable)
            {
                AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, settings.TemplateDir.FolderPath, settings.TemplateKey.ShortKey);
                alpaca.RegisterAll();
            }
        }
Exemplo n.º 12
0
        private bool Save()
        {
            lError.Visible = false;
            lError.Text    = "";
            if (scriptList.SelectedValue.EndsWith(".json") && !string.IsNullOrEmpty(txtSource.Text.Trim()))
            {
                try
                {
                    JObject.Parse(txtSource.Text);
                    if (scriptList.SelectedValue != "manifest.json")
                    {
                        System.Web.Helpers.Json.Decode(txtSource.Text);
                    }
                }
                catch (Exception ex)
                {
                    lError.Visible = true;
                    lError.Text    = ex.Message;

                    return(false);
                }
            }

            FileUri template       = ModuleContext.OpenContentSettings().Template.MainTemplateUri();
            string  templateFolder = Path.GetDirectoryName(template.FilePath);
            string  scriptFile     = templateFolder + "/" + scriptList.SelectedValue;
            string  srcFile        = Server.MapPath(scriptFile);

            if (string.IsNullOrWhiteSpace(txtSource.Text))
            {
                if (File.Exists(srcFile))
                {
                    File.Delete(srcFile);
                }
            }
            else
            {
                File.WriteAllText(srcFile, txtSource.Text);
            }

            if (Path.GetExtension(srcFile) == ".css" || Path.GetExtension(srcFile) == ".js")
            {
                HostController.Instance.IncrementCrmVersion(true);
            }

            return(true);
            //DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Save Successful", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess);
        }
Exemplo n.º 13
0
        private void LoadFiles()
        {
            TemplateManifest template = ModuleContext.OpenContentSettings().Template;

            sourceList.Items.Clear();
            sourceList.Items.Add(new ListItem(DATATYPE_DATA, DATATYPE_DATA));
            sourceList.Items.Add(new ListItem(DATATYPE_SETTINGS, DATATYPE_SETTINGS));
            sourceList.Items.Add(new ListItem(DATATYPE_FILTER, DATATYPE_FILTER));
            if (template?.Manifest != null && template.Manifest.AdditionalDataDefined())
            {
                foreach (var addData in template.Manifest.AdditionalDataDefinition)
                {
                    string title = string.IsNullOrEmpty(addData.Value.Title) ? addData.Key : addData.Value.Title;
                    sourceList.Items.Add(new ListItem(title, addData.Key));
                }
            }
        }
Exemplo n.º 14
0
        private void LoadFiles()
        {
            TemplateManifest template = ModuleContext.OpenContentSettings().Template;

            sourceList.Items.Clear();
            sourceList.Items.Add(new ListItem(cData, cData));
            sourceList.Items.Add(new ListItem(cSettings, cSettings));
            sourceList.Items.Add(new ListItem(cFilter, cFilter));
            if (template != null && template.Manifest != null && template.Manifest.AdditionalDataDefined())
            {
                foreach (var addData in template.Manifest.AdditionalDataDefinition)
                {
                    string title = string.IsNullOrEmpty(addData.Value.Title) ? addData.Key : addData.Value.Title;
                    sourceList.Items.Add(new ListItem(title, addData.Key));
                }
            }
        }
Exemplo n.º 15
0
        protected void rblUseTemplate_SelectedIndexChanged(object sender, EventArgs e)
        {
            phFrom.Visible         = rblUseTemplate.SelectedIndex == 1;
            phTemplateName.Visible = rblUseTemplate.SelectedIndex == 1;
            rblFrom.SelectedIndex  = 0;
            var scriptFileSetting = ModuleContext.OpenContentSettings().Template;

            ddlTemplate.Items.Clear();
            if (rblUseTemplate.SelectedIndex == 0) // existing
            {
                ddlTemplate.Items.AddRange(OpenContentUtils.ListOfTemplatesFiles(ModuleContext.PortalSettings, ModuleContext.ModuleId, scriptFileSetting, App.Config.Opencontent).ToArray());
            }
            else if (rblUseTemplate.SelectedIndex == 1) // new
            {
                ddlTemplate.Items.AddRange(OpenContentUtils.GetTemplates(ModuleContext.PortalSettings, ModuleContext.ModuleId, scriptFileSetting, App.Config.Opencontent).ToArray());
            }
            ActivateDetailPage();
        }
Exemplo n.º 16
0
        private void LoadFiles(TemplateManifest template)
        {
            var settings = ModuleContext.OpenContentSettings();

            scriptList.Items.Clear();
            if (template != null)
            {
                //string templateFolder = template.DirectoryName;
                if (template.Main != null)
                {
                    scriptList.Items.Add(new ListItem("Template", template.Main.Template));
                    if (template.Main.PartialTemplates != null)
                    {
                        foreach (var part in template.Main.PartialTemplates)
                        {
                            scriptList.Items.Add(new ListItem("Template - " + Path.GetFileNameWithoutExtension(part.Value.Template), part.Value.Template));
                        }
                    }
                }
                if (template.Detail != null)
                {
                    scriptList.Items.Add(new ListItem("Template - " + Path.GetFileNameWithoutExtension(template.Detail.Template), template.Detail.Template));
                    if (template.Detail.PartialTemplates != null)
                    {
                        foreach (var part in template.Detail.PartialTemplates)
                        {
                            scriptList.Items.Add(new ListItem("Template - " + Path.GetFileNameWithoutExtension(part.Value.Template), part.Value.Template));
                        }
                    }
                }
                scriptList.Items.Add(new ListItem("Stylesheet", template.Key.ShortKey + ".css"));
                scriptList.Items.Add(new ListItem("Javascript", template.Key.ShortKey + ".js"));
                scriptList.Items.Add(new ListItem("Manifest", "manifest.json"));
                if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri))
                {
                    string title = string.IsNullOrEmpty(template.Manifest.Title) ? "Data " : template.Manifest.Title + " ";
                    scriptList.Items.Add(new ListItem(title + "Schema", "schema.json"));
                    scriptList.Items.Add(new ListItem(title + "Options", "options.json"));
                    //scriptList.Items.Add(new ListItem("Edit Layout Options - Template File Overides", "options." + template.FileNameWithoutExtension + ".json"));
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(new ListItem(title + "Options - " + item.Code, "options." + item.Code + ".json"));
                    }
                }
                if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, template.Key.ShortKey))
                {
                    scriptList.Items.Add(new ListItem("Settings Schema", template.Key.ShortKey + "-schema.json"));
                    scriptList.Items.Add(new ListItem("Settings Options", template.Key.ShortKey + "-options.json"));
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(new ListItem("Settings Options - " + item.Code, template.Key.ShortKey + "-options." + item.Code + ".json"));
                    }
                }
                if (template.Manifest.AdditionalDataExists())
                {
                    foreach (var addData in template.Manifest.AdditionalData)
                    {
                        if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, addData.Key))
                        {
                            string title = string.IsNullOrEmpty(addData.Value.Title) ? addData.Key : addData.Value.Title;
                            scriptList.Items.Add(new ListItem(title + " Schema", addData.Key + "-schema.json"));
                            scriptList.Items.Add(new ListItem(title + " Options", addData.Key + "-options.json"));
                            foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                            {
                                scriptList.Items.Add(new ListItem(title + " Options - " + item.Code, addData.Key + "-options." + item.Code + ".json"));
                            }
                        }
                    }
                }
                foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                {
                    scriptList.Items.Add(new ListItem("Localization - " + item.Code, item.Code + ".json"));
                }
            }
        }
Exemplo n.º 17
0
        private void LoadFiles(TemplateManifest template)
        {
            var settings = ModuleContext.OpenContentSettings();

            scriptList.Items.Clear();
            if (template != null)
            {
                if (template.Main != null)
                {
                    scriptList.Items.Add(NewListItem("Template", template.Main.Template, "Template", template));
                    if (template.Main.PartialTemplates != null)
                    {
                        foreach (var part in template.Main.PartialTemplates)
                        {
                            scriptList.Items.Add(NewListItem(Path.GetFileNameWithoutExtension(part.Value.Template), part.Value.Template, "Template", template));
                        }
                    }
                }
                if (template.Detail != null)
                {
                    scriptList.Items.Add(NewListItem("Detail template", template.Detail.Template, "Template", template));
                    if (template.Detail.PartialTemplates != null)
                    {
                        foreach (var part in template.Detail.PartialTemplates)
                        {
                            scriptList.Items.Add(NewListItem(Path.GetFileNameWithoutExtension(part.Value.Template), part.Value.Template, "Template", template));
                        }
                    }
                }
                if (template.Main != null)
                {
                    scriptList.Items.Add(NewListItem("Stylesheet", Path.ChangeExtension(template.Main.Template, "css"), "Template", template));
                }
                if (template.Detail != null)
                {
                    scriptList.Items.Add(NewListItem("Detail Stylesheet", Path.ChangeExtension(template.Detail.Template, "css"), "Template", template));
                }
                if (template.Main != null)
                {
                    scriptList.Items.Add(NewListItem("Javascript", Path.ChangeExtension(template.Main.Template, "js"), "Template", template));
                }

                scriptList.Items.Add(NewListItem("Manifest", "manifest.json", "Template", template));
                if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri))
                {
                    string title = string.IsNullOrEmpty(template.Manifest.Title) ? "Data" : template.Manifest.Title;
                    scriptList.Items.Add(NewListItem("Schema", "schema.json", title, template));
                    scriptList.Items.Add(NewListItem("Options", "options.json", title, template));
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(NewListItem("Options (" + item.Code + ")", "options." + item.Code + ".json", title, template));
                    }
                }

                if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, template.Key.ShortKey))
                {
                    var title = "Settings";
                    scriptList.Items.Add(NewListItem("Schema", template.Key.ShortKey + "-schema.json", title, template));
                    scriptList.Items.Add(NewListItem("Options", template.Key.ShortKey + "-options.json", title, template));
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(NewListItem("Options (" + item.Code + ")", template.Key.ShortKey + "-options." + item.Code + ".json", title, template));
                    }
                }
                if (template.Manifest.AdditionalDataDefined())
                {
                    foreach (var addData in template.Manifest.AdditionalDataDefinition)
                    {
                        if (!OpenContentUtils.BuilderExist(settings.Template.ManifestFolderUri, addData.Key))
                        {
                            string title = string.IsNullOrEmpty(addData.Value.Title) ? addData.Key : addData.Value.Title;
                            scriptList.Items.Add(NewListItem(" Schema", addData.Key + "-schema.json", title, template));
                            scriptList.Items.Add(NewListItem(" Options", addData.Key + "-options.json", title, template));
                            foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                            {
                                scriptList.Items.Add(NewListItem(" Options (" + item.Code + ")", addData.Key + "-options." + item.Code + ".json", title, template));
                            }
                        }
                    }
                }

                // check if old localization file naming is being used
                bool oldNamingSchemeIsUsed = false;
                foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                {
                    oldNamingSchemeIsUsed = oldNamingSchemeIsUsed | LocalizationUtils.LoadLocalizationJsonV1(settings.TemplateDir, item.Code) != null;
                }
                if (oldNamingSchemeIsUsed)
                {
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(NewListItem(item.Code, item.Code + ".json", "Localization", template));
                    }
                }
                else
                {
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(NewListItem(item.Code, $"localization.{item.Code}" + ".json", "Localization", template));
                    }
                }

                //if (OpenContentUtils.FormExist(settings.Template.ManifestFolderUri))
                {
                    string title = "Form ";
                    scriptList.Items.Add(NewListItem("Schema", "form-schema.json", title, template));
                    scriptList.Items.Add(NewListItem("Options", "form-options.json", title, template));
                    //scriptList.Items.Add(new ListItem("Edit Layout Options - Template File Overides", "options." + template.FileNameWithoutExtension + ".json"));
                    foreach (Locale item in LocaleController.Instance.GetLocales(PortalId).Values)
                    {
                        scriptList.Items.Add(NewListItem("Options (" + item.Code + ")", "options." + item.Code + ".json", title, template));
                    }
                }
            }
        }
Exemplo n.º 18
0
        protected void bSave_Click(object sender, EventArgs e)
        {
            try
            {
                ModuleController mc = new ModuleController();
                if (rblDataSource.SelectedIndex == 0) // this module
                {
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "portalid");
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "tabid");
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "moduleid");
                }
                else if (rblDataSource.SelectedIndex == 1) // other module
                {
                    var dsModule = (new ModuleController()).GetTabModule(int.Parse(ddlDataSource.SelectedValue));
                    mc.DeleteModuleSetting(ModuleContext.ModuleId, "portalid");
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "tabid", dsModule.TabID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "moduleid", dsModule.ModuleID.ToString());
                }
                else // other portal
                {
                    var dsModule = (new ModuleController()).GetTabModule(int.Parse(ddlDataSource.SelectedValue));
                    var dsPortal = int.Parse(ddlPortals.SelectedValue);
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "portalid", dsModule.PortalID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "tabid", dsModule.TabID.ToString());
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "moduleid", dsModule.ModuleID.ToString());
                }
                if (rblUseTemplate.SelectedIndex == 0) // existing
                {
                    mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", ddlTemplate.SelectedValue);
                    ModuleContext.Settings["template"] = ddlTemplate.SelectedValue;
                }
                else if (rblUseTemplate.SelectedIndex == 1) // new
                {
                    if (rblFrom.SelectedIndex == 0)         // site
                    {
                        string oldFolder = Server.MapPath(ddlTemplate.SelectedValue);
                        string template  = OpenContentUtils.CopyTemplate(ModuleContext.PortalId, oldFolder, tbTemplateName.Text);
                        mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        ModuleContext.Settings["template"] = template;
                    }
                    else if (rblFrom.SelectedIndex == 1) // web
                    {
                        //string fileName = ddlTemplate.SelectedValue;
                        //string template = OpenContentUtils.ImportFromWeb(ModuleContext.PortalId, fileName, tbTemplateName.Text);
                        //mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        //ModuleContext.Settings["template"] = template;
                        //string fileName = ddlTemplate.SelectedValue;
                        string template = GithubTemplateUtils.ImportFromGithub(ModuleContext.PortalId, ddlTemplate.SelectedItem.Text, ddlTemplate.SelectedValue, tbTemplateName.Text);
                        mc.UpdateModuleSetting(ModuleContext.ModuleId, "template", template);
                        ModuleContext.Settings["template"] = template;
                    }
                }
                mc.UpdateTabModuleSetting(ModuleContext.TabModuleId, "detailtabid", ddlDetailPage.SelectedValue);


                //don't reset settings. Sure they might be invalid, but maybe not. And you can't ever revert.
                //mc.DeleteModuleSetting(ModuleContext.ModuleId, "data");

                Settings = ModuleContext.OpenContentSettings();
                if (PageRefresh || !Settings.Template.DataNeeded())
                {
                    Response.Redirect(Globals.NavigateURL(), true);
                }
                else
                {
                    rblUseTemplate.SelectedIndex = 0;
                    phTemplateName.Visible       = rblUseTemplate.SelectedIndex == 1;
                    phFrom.Visible        = rblUseTemplate.SelectedIndex == 1;
                    rblFrom.SelectedIndex = 0;
                    BindTemplates(Settings.Template, null);
                    Renderinfo.Template = Settings.Template;
                    BindButtons(Settings, Renderinfo);
                    ActivateDetailPage();
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }