コード例 #1
0
        //*********************************************************************
        //
        // UpdateTabOrder Method <a name="UpdateTabOrder"></a>
        //
        // The UpdateTabOrder method changes the position of the tab with respect
        // to other tabs in the portal.  These settings are stored in the Xml
        // file PortalCfg.xml.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //
        //*********************************************************************
        public void UpdateTabOrder(int tabId, int tabOrder)
        {
            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Find the appropriate tab in the Tab table and set the property
            SiteConfiguration.TabRow tabRow = siteSettings.Tab.FindByTabId(tabId);

            tabRow.TabOrder = tabOrder;

            // Save the changes
            SaveSiteSettings();
        }
コード例 #2
0
        //*********************************************************************
        //
        // DeleteTab Method <a name="DeleteTab"></a>
        //
        // The DeleteTab method deletes the selected tab and its modules from
        // the settings which are stored in the Xml file PortalCfg.xml.  This
        // method also deletes any data from the database associated with all
        // modules within this tab.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //	  + <a href="DeleteModule.htm" style="color:green">DeleteModule stored procedure</a>
        //
        //*********************************************************************
        public void DeleteTab(int tabId)
        {
            //
            // Delete the Tab in the XML file
            //

            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Find the appropriate tab in the Tab table
            SiteConfiguration.TabDataTable tabTable = siteSettings.Tab;
            SiteConfiguration.TabRow       tabRow   = siteSettings.Tab.FindByTabId(tabId);

            //
            // Delete information in the Database relating to each Module being deleted
            //

            // Create Instance of Connection and Command Object
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
            SqlCommand    myCommand    = new SqlCommand("Portal_DeleteModule", myConnection);

            // Mark the Command as a SPROC
            myCommand.CommandType = CommandType.StoredProcedure;

            // Add Parameters to SPROC
            SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4);

            myConnection.Open();

            foreach (SiteConfiguration.ModuleRow moduleRow in tabRow.GetModuleRows())
            {
                myCommand.Parameters.Clear();
                parameterModuleID.Value = moduleRow.ModuleId;
                myCommand.Parameters.Add(parameterModuleID);

                // Open the database connection and execute the command
                myCommand.ExecuteNonQuery();
            }

            // Close the connection
            myConnection.Close();

            // Finish removing the Tab row from the Xml file
            tabTable.RemoveTabRow(tabRow);

            // Save the changes
            SaveSiteSettings();
        }
コード例 #3
0
        //*********************************************************************
        //
        // UpdateTab Method <a name="UpdateTab"></a>
        //
        // The UpdateTab method updates the settings for the specified tab.
        // These settings are stored in the Xml file PortalCfg.xml.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //
        //*********************************************************************
        public void UpdateTab(int portalId, int tabId, String tabName, int tabOrder, String authorizedRoles, String mobileTabName, bool showMobile)
        {
            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Find the appropriate tab in the Tab table and set the properties
            SiteConfiguration.TabRow tabRow = siteSettings.Tab.FindByTabId(tabId);

            tabRow.TabName       = tabName;
            tabRow.TabOrder      = tabOrder;
            tabRow.AccessRoles   = authorizedRoles;
            tabRow.MobileTabName = mobileTabName;
            tabRow.ShowMobile    = showMobile;

            // Save the changes
            SaveSiteSettings();
        }
コード例 #4
0
        //
        // TABS
        //

        //*********************************************************************
        //
        // AddTab Method <a name="AddTab"></a>
        //
        // The AddTab method adds a new tab to the portal.  These settings are
        // stored in the Xml file PortalCfg.xml.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //
        //*********************************************************************
        public int AddTab(int portalId, String tabName, int tabOrder)
        {
            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Create a new TabRow from the Tab table
            SiteConfiguration.TabRow newRow = siteSettings.Tab.NewTabRow();

            // Set the properties on the new row
            newRow.TabName       = tabName;
            newRow.TabOrder      = tabOrder;
            newRow.MobileTabName = String.Empty;
            newRow.ShowMobile    = true;
            newRow.AccessRoles   = "All Users;";

            // Add the new TabRow to the Tab table
            siteSettings.Tab.AddTabRow(newRow);

            // Save the changes
            SaveSiteSettings();

            // Return the new TabID
            return(newRow.TabId);
        }
コード例 #5
0
        //*********************************************************************
        //
        // PortalSettings Constructor
        //
        // The PortalSettings Constructor encapsulates all of the logic
        // necessary to obtain configuration settings necessary to render
        // a Portal Tab view for a given request.
        //
        // These Portal Settings are stored within PortalCFG.xml, and are
        // fetched below by calling config.GetSiteSettings().
        // The method config.GetSiteSettings() fills the SiteConfiguration
        // class, derived from a DataSet, which PortalSettings accesses.
        //
        //*********************************************************************

        public PortalSettings(int tabIndex, int tabId)
        {
            // Get the configuration data
            SiteConfiguration siteSettings = Configuration.GetSiteSettings();

            // Read the Desktop Tab Information, and sort by Tab Order
            foreach (SiteConfiguration.TabRow tRow in siteSettings.Tab.Select("", "TabOrder"))
            {
                TabStripDetails tabDetails = new TabStripDetails();

                tabDetails.TabId           = tRow.TabId;
                tabDetails.TabName         = tRow.TabName;
                tabDetails.TabOrder        = tRow.TabOrder;
                tabDetails.AuthorizedRoles = tRow.AccessRoles;

                this.DesktopTabs.Add(tabDetails);
            }

            // If the PortalSettings.ActiveTab property is set to 0, change it to
            // the TabID of the first tab in the DesktopTabs collection
            if (this.ActiveTab.TabId == 0)
            {
                this.ActiveTab.TabId = ((TabStripDetails)this.DesktopTabs[0]).TabId;
            }


            // Read the Mobile Tab Information, and sort by Tab Order
            foreach (SiteConfiguration.TabRow mRow in siteSettings.Tab.Select("ShowMobile='true'", "TabOrder"))
            {
                TabStripDetails tabDetails = new TabStripDetails();

                tabDetails.TabId           = mRow.TabId;
                tabDetails.TabName         = mRow.MobileTabName;
                tabDetails.AuthorizedRoles = mRow.AccessRoles;

                this.MobileTabs.Add(tabDetails);
            }

            // Read the Module Information for the current (Active) tab
            SiteConfiguration.TabRow activeTab = siteSettings.Tab.FindByTabId(tabId);

            // Get Modules for this Tab based on the Data Relation
            foreach (SiteConfiguration.ModuleRow moduleRow in activeTab.GetModuleRows())
            {
                ModuleSettings moduleSettings = new ModuleSettings();

                moduleSettings.ModuleTitle         = moduleRow.ModuleTitle;
                moduleSettings.ModuleId            = moduleRow.ModuleId;
                moduleSettings.ModuleDefId         = moduleRow.ModuleDefId;
                moduleSettings.ModuleOrder         = moduleRow.ModuleOrder;
                moduleSettings.TabId               = tabId;
                moduleSettings.PaneName            = moduleRow.PaneName;
                moduleSettings.AuthorizedEditRoles = moduleRow.EditRoles;
                moduleSettings.CacheTime           = moduleRow.CacheTimeout;
                moduleSettings.ShowMobile          = moduleRow.ShowMobile;

                // ModuleDefinition data
                SiteConfiguration.ModuleDefinitionRow modDefRow = siteSettings.ModuleDefinition.FindByModuleDefId(moduleSettings.ModuleDefId);

                moduleSettings.DesktopSrc = modDefRow.DesktopSourceFile;
                moduleSettings.MobileSrc  = modDefRow.MobileSourceFile;

                this.ActiveTab.Modules.Add(moduleSettings);
            }

            // Sort the modules in order of ModuleOrder
            this.ActiveTab.Modules.Sort();

            // Get the first row in the Global table
            SiteConfiguration.GlobalRow globalSettings = (SiteConfiguration.GlobalRow)siteSettings.Global.Rows[0];

            // Read Portal global settings
            this.PortalId                  = globalSettings.PortalId;
            this.PortalName                = globalSettings.PortalName;
            this.AlwaysShowEditButton      = globalSettings.AlwaysShowEditButton;
            this.ActiveTab.TabIndex        = tabIndex;
            this.ActiveTab.TabId           = tabId;
            this.ActiveTab.TabOrder        = activeTab.TabOrder;
            this.ActiveTab.MobileTabName   = activeTab.MobileTabName;
            this.ActiveTab.AuthorizedRoles = activeTab.AccessRoles;
            this.ActiveTab.TabName         = activeTab.TabName;
            this.ActiveTab.ShowMobile      = activeTab.ShowMobile;
        }