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.Items.Add(new ListItem(t.IndentedTabName, t.TabID.ToString()));
                        }
                    }
                    ParentTab.Items.Insert(0, "");
                    SelectDropDownListItem(ref ParentTab, "ParentTabID");
                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        DefaultSize.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                    }
                    SelectDropDownListItem(ref DefaultSize, "DefaultSize");
                    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));
                    }
                    SelectDropDownListItem(ref DefaultView, "DefaultView");
                    if (Settings.ContainsKey("AllowViewChange"))
                    {
                        AllowViewChange.Checked = Convert.ToBoolean(Settings["AllowViewChange"]);
                    }
                    if (Settings.ContainsKey("ShowTooltip"))
                    {
                        ShowTooltip.Checked = Convert.ToBoolean(Settings["ShowTooltip"]);
                    }
                    if (Settings.ContainsKey("ConsoleWidth"))
                    {
                        ConsoleWidth.Text = Convert.ToString(Settings["ConsoleWidth"]);
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 2
0
        private void SavePersonalizedSettings()
        {
            if (this.UserId > -1)
            {
                int consoleModuleID = -1;
                try
                {
                    if (this.Request.QueryString["CTMID"] != null)
                    {
                        consoleModuleID = Convert.ToInt32(this.Request.QueryString["CTMID"]);
                    }
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);

                    consoleModuleID = -1;
                }

                if (consoleModuleID == this.TabModuleId)
                {
                    string consoleSize = string.Empty;
                    if (this.Request.QueryString["CS"] != null)
                    {
                        consoleSize = this.Request.QueryString["CS"];
                    }

                    string consoleView = string.Empty;
                    if (this.Request.QueryString["CV"] != null)
                    {
                        consoleView = this.Request.QueryString["CV"];
                    }

                    if (consoleSize != string.Empty && ConsoleController.GetSizeValues().Contains(consoleSize))
                    {
                        this.SaveUserSetting("DefaultSize", consoleSize);
                    }

                    if (consoleView != string.Empty && ConsoleController.GetViewValues().Contains(consoleView))
                    {
                        this.SaveUserSetting("DefaultView", consoleView);
                    }
                }
            }
        }
        protected void SavePersonalizedSettings()
        {
            if ((UserId > -1))
            {
                int consoleModuleID = -1;
                try
                {
                    if (Request.QueryString["CTMID"] != null)
                    {
                        consoleModuleID = Convert.ToInt32(Request.QueryString["CTMID"]);
                    }
                }
                catch (Exception exc)
                {
                    DnnLog.Error(exc);

                    consoleModuleID = -1;
                }
                if ((consoleModuleID == TabModuleId))
                {
                    string consoleSize = string.Empty;
                    if (Request.QueryString["CS"] != null)
                    {
                        consoleSize = Request.QueryString["CS"];
                    }
                    string consoleView = string.Empty;
                    if (Request.QueryString["CV"] != null)
                    {
                        consoleView = Request.QueryString["CV"];
                    }
                    if ((consoleSize != string.Empty && ConsoleController.GetSizeValues().Contains(consoleSize)))
                    {
                        SaveUserSetting("DefaultSize", consoleSize);
                    }
                    if ((consoleView != string.Empty && ConsoleController.GetViewValues().Contains(consoleView)))
                    {
                        SaveUserSetting("DefaultView", consoleView);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public override void LoadSettings()
        {
            try
            {
                if (this.Page.IsPostBack == false)
                {
                    if (this.Settings.ContainsKey("ParentTabId") && !string.IsNullOrEmpty(Convert.ToString(this.Settings["ParentTabId"])))
                    {
                        var tabId = Convert.ToInt32(this.Settings["ParentTabId"]);
                        this.ParentTab.SelectedPage = TabController.Instance.GetTab(tabId, this.PortalId);
                    }

                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        this.DefaultSize.AddItem(Localization.GetString(val, this.LocalResourceFile), val);
                    }

                    this.SelectDropDownListItem(ref this.DefaultSize, "DefaultSize");

                    this.SelectDropDownListItem(ref this.modeList, "Mode");

                    if (this.Settings.ContainsKey("AllowSizeChange"))
                    {
                        this.AllowResize.Checked = Convert.ToBoolean(this.Settings["AllowSizeChange"]);
                    }

                    foreach (var val in ConsoleController.GetViewValues())
                    {
                        this.DefaultView.AddItem(Localization.GetString(val, this.LocalResourceFile), val);
                    }

                    this.SelectDropDownListItem(ref this.DefaultView, "DefaultView");
                    if (this.Settings.ContainsKey("IncludeParent"))
                    {
                        this.IncludeParent.Checked = Convert.ToBoolean(this.Settings["IncludeParent"]);
                    }

                    if (this.Settings.ContainsKey("AllowViewChange"))
                    {
                        this.AllowViewChange.Checked = Convert.ToBoolean(this.Settings["AllowViewChange"]);
                    }

                    if (this.Settings.ContainsKey("ShowTooltip"))
                    {
                        this.ShowTooltip.Checked = Convert.ToBoolean(this.Settings["ShowTooltip"]);
                    }

                    if (this.Settings.ContainsKey("OrderTabsByHierarchy"))
                    {
                        this.OrderTabsByHierarchy.Checked = Convert.ToBoolean(this.Settings["OrderTabsByHierarchy"]);
                    }

                    if (this.Settings.ContainsKey("IncludeHiddenPages"))
                    {
                        this.IncludeHiddenPages.Checked = Convert.ToBoolean(this.Settings["IncludeHiddenPages"]);
                    }

                    if (this.Settings.ContainsKey("ConsoleWidth"))
                    {
                        this.ConsoleWidth.Text = Convert.ToString(this.Settings["ConsoleWidth"]);
                    }

                    this.SwitchMode();
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                if ((!IsPostBack))
                {
                    IconSize.Visible = AllowSizeChange;
                    View.Visible     = AllowViewChange;

                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        IconSize.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val));
                        //IconSize.AddItem(Localization.GetString(val + ".Text", LocalResourceFile), val);
                    }
                    foreach (string val in ConsoleController.GetViewValues())
                    {
                        View.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val));
                        //View.AddItem(Localization.GetString(val + ".Text", LocalResourceFile), val);
                    }
                    IconSize.SelectedValue = DefaultSize;
                    View.SelectedValue     = DefaultView;

                    SettingsBreak.Visible = (IconSize.Visible && View.Visible);

                    List <TabInfo> tempTabs = (IsHostTab())
                                                                                ? TabController.GetTabsBySortOrder(Null.NullInteger).OrderBy(t => t.Level).ThenBy(t => t.HasChildren).ThenBy(t => t.LocalizedTabName).ToList()
                                                                                : TabController.GetTabsBySortOrder(PortalId).OrderBy(t => t.Level).ThenBy(t => t.HasChildren).ThenBy(t => t.LocalizedTabName).ToList();

                    IList <TabInfo> tabs = new List <TabInfo>();

                    IList <int> tabIdList = new List <int>();
                    tabIdList.Add(ConsoleTabID);

                    if (IncludeParent)
                    {
                        TabInfo consoleTab = TestableTabController.Instance.GetTab(ConsoleTabID, PortalId);
                        if (consoleTab != null)
                        {
                            tabs.Add(consoleTab);
                        }
                    }

                    foreach (TabInfo tab in tempTabs)
                    {
                        if ((!CanShowTab(tab)))
                        {
                            continue;
                        }
                        if ((tabIdList.Contains(tab.ParentId)))
                        {
                            if ((!tabIdList.Contains(tab.TabID)))
                            {
                                tabIdList.Add(tab.TabID);
                            }
                            tabs.Add(tab);
                        }
                    }

                    DetailView.DataSource = tabs;
                    DetailView.DataBind();
                }
                if ((ConsoleWidth != string.Empty))
                {
                    Console.Attributes.Add("style", "width:" + ConsoleWidth);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                this.IconSize.Visible = this.AllowSizeChange;
                this.View.Visible     = this.AllowViewChange;

                foreach (string val in ConsoleController.GetSizeValues())
                {
                    this.IconSize.Items.Add(new ListItem(Localization.GetString(val + ".Text", this.LocalResourceFile), val));
                }

                foreach (string val in ConsoleController.GetViewValues())
                {
                    this.View.Items.Add(new ListItem(Localization.GetString(val + ".Text", this.LocalResourceFile), val));
                }

                this.IconSize.SelectedValue = this.DefaultSize;
                this.View.SelectedValue     = this.DefaultView;

                if (!this.IsPostBack)
                {
                    this.Console.Attributes["class"] = this.Console.Attributes["class"] + " " + this.Mode.ToLower(CultureInfo.InvariantCulture);

                    this.SettingsBreak.Visible = this.AllowSizeChange && this.AllowViewChange;

                    List <TabInfo> tempTabs = this.IsHostTab()
                                        ? TabController.GetTabsBySortOrder(Null.NullInteger).OrderBy(t => t.Level).ThenBy(t => t.LocalizedTabName).ToList()
                                        : TabController.GetTabsBySortOrder(this.PortalId).OrderBy(t => t.Level).ThenBy(t => t.LocalizedTabName).ToList();

                    this._tabs = new List <TabInfo>();

                    IList <int> tabIdList = new List <int>();
                    tabIdList.Add(this.ConsoleTabID);

                    if (this.IncludeParent)
                    {
                        TabInfo consoleTab = TabController.Instance.GetTab(this.ConsoleTabID, this.PortalId);
                        if (consoleTab != null)
                        {
                            this._tabs.Add(consoleTab);
                        }
                    }

                    foreach (TabInfo tab in tempTabs)
                    {
                        if (!this.CanShowTab(tab))
                        {
                            continue;
                        }

                        if (tabIdList.Contains(tab.ParentId))
                        {
                            if (!tabIdList.Contains(tab.TabID))
                            {
                                tabIdList.Add(tab.TabID);
                            }

                            this._tabs.Add(tab);
                        }
                    }

                    // if OrderTabsByHierarchy set to true, we need reorder the tab list to move tabs which have child tabs to the end of list.
                    // so that the list display in UI can show tabs in same level in same area, and not break by child tabs.
                    if (this.OrderTabsByHierarchy)
                    {
                        this._tabs = this._tabs.OrderBy(t => t.HasChildren).ToList();
                    }

                    int minLevel = -1;
                    if (this._tabs.Count > 0)
                    {
                        minLevel = this._tabs.Min(t => t.Level);
                    }

                    this.DetailView.DataSource = (minLevel > -1) ? this._tabs.Where(t => t.Level == minLevel) : this._tabs;
                    this.DetailView.DataBind();
                }

                if (this.ConsoleWidth != string.Empty)
                {
                    this.Console.Attributes.Add("style", "width:" + this.ConsoleWidth);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }