コード例 #1
0
ファイル: Settings.ascx.cs プロジェクト: ds-rod/dnnIJT
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    var portalTabs = TabController.GetPortalTabs(PortalId, Null.NullInteger, false, true);

                    //Add host tabs
                    if (UserInfo != null && UserInfo.IsSuperUser)
                    {
                        var hostTabs = new TabController().GetTabsByPortal(Null.NullInteger);
                        portalTabs.AddRange(hostTabs.Values);
                    }
                    ParentTab.Items.Clear();
                    foreach (var t in portalTabs)
                    {
                        if ((TabPermissionController.CanViewPage(t)))
                        {
                            ParentTab.AddItem(t.IndentedTabName, t.TabID.ToString(CultureInfo.InvariantCulture));
                            //ParentTab.Items.Add(new ListItem(t.IndentedTabName, t.TabID.ToString(CultureInfo.InvariantCulture)));
                        }
                    }
                    //ParentTab.Items.Insert(0, "");
                    ParentTab.InsertItem(0, "", "");
                    SelectDropDownListItem(ref ParentTab, "ParentTabID");
                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        //DefaultSize.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                        DefaultSize.AddItem(Localization.GetString(val, LocalResourceFile), val);
                    }
                    SelectDropDownListItem(ref DefaultSize, "DefaultSize");

                    SelectDropDownListItem(ref modeList, "Mode");

                    if (Settings.ContainsKey("AllowSizeChange"))
                    {
                        AllowResize.Checked = Convert.ToBoolean(Settings["AllowSizeChange"]);
                    }
                    foreach (var val in ConsoleController.GetViewValues())
                    {
                        //DefaultView.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                        DefaultView.AddItem(Localization.GetString(val, LocalResourceFile), val);
                    }
                    SelectDropDownListItem(ref DefaultView, "DefaultView");
                    if (Settings.ContainsKey("IncludeParent"))
                    {
                        IncludeParent.Checked = Convert.ToBoolean(Settings["IncludeParent"]);
                    }
                    if (Settings.ContainsKey("AllowViewChange"))
                    {
                        AllowViewChange.Checked = Convert.ToBoolean(Settings["AllowViewChange"]);
                    }
                    if (Settings.ContainsKey("ShowTooltip"))
                    {
                        ShowTooltip.Checked = Convert.ToBoolean(Settings["ShowTooltip"]);
                    }
                    if (Settings.ContainsKey("OrderTabsByHierarchy"))
                    {
                        OrderTabsByHierarchy.Checked = Convert.ToBoolean(Settings["OrderTabsByHierarchy"]);
                    }
                    if (Settings.ContainsKey("ConsoleWidth"))
                    {
                        ConsoleWidth.Text = Convert.ToString(Settings["ConsoleWidth"]);
                    }

                    SwitchMode();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
コード例 #2
0
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    if (Settings.ContainsKey("ParentTabId") && !string.IsNullOrEmpty(Convert.ToString(Settings["ParentTabId"])))
                    {
                        var tabId = Convert.ToInt32(Settings["ParentTabId"]);
                        ParentTab.SelectedPage = TabController.Instance.GetTab(tabId, PortalId);
                    }

                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        //DefaultSize.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                        DefaultSize.AddItem(Localization.GetString(val, LocalResourceFile), val);
                    }
                    SelectDropDownListItem(ref DefaultSize, "DefaultSize");

                    SelectDropDownListItem(ref modeList, "Mode");

                    if (Settings.ContainsKey("AllowSizeChange"))
                    {
                        AllowResize.Checked = Convert.ToBoolean(Settings["AllowSizeChange"]);
                    }
                    foreach (var val in ConsoleController.GetViewValues())
                    {
                        //DefaultView.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                        DefaultView.AddItem(Localization.GetString(val, LocalResourceFile), val);
                    }
                    SelectDropDownListItem(ref DefaultView, "DefaultView");
                    if (Settings.ContainsKey("IncludeParent"))
                    {
                        IncludeParent.Checked = Convert.ToBoolean(Settings["IncludeParent"]);
                    }
                    if (Settings.ContainsKey("AllowViewChange"))
                    {
                        AllowViewChange.Checked = Convert.ToBoolean(Settings["AllowViewChange"]);
                    }
                    if (Settings.ContainsKey("ShowTooltip"))
                    {
                        ShowTooltip.Checked = Convert.ToBoolean(Settings["ShowTooltip"]);
                    }
                    if (Settings.ContainsKey("OrderTabsByHierarchy"))
                    {
                        OrderTabsByHierarchy.Checked = Convert.ToBoolean(Settings["OrderTabsByHierarchy"]);
                    }
                    if (Settings.ContainsKey("IncludeHiddenPages"))
                    {
                        IncludeHiddenPages.Checked = Convert.ToBoolean(Settings["IncludeHiddenPages"]);
                    }
                    if (Settings.ContainsKey("ConsoleWidth"))
                    {
                        ConsoleWidth.Text = Convert.ToString(Settings["ConsoleWidth"]);
                    }

                    SwitchMode();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }