Beispiel #1
0
        //*********************************************************************
        //
        // UpdateModuleDefinition() Method <a name="UpdateModuleDefinition"></a>
        //
        // The UpdateModuleDefinition method updates the settings for the
        // specified module type definition.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //
        //*********************************************************************
        public void UpdateModuleDefinition(int defId, String name, String desktopSrc, String mobileSrc)
        {
            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Find the appropriate Module in the Module table and update the properties
            SiteConfiguration.ModuleDefinitionRow modDefRow = siteSettings.ModuleDefinition.FindByModuleDefId(defId);

            modDefRow.FriendlyName      = name;
            modDefRow.DesktopSourceFile = desktopSrc;
            modDefRow.MobileSourceFile  = mobileSrc;

            // Save the changes
            SaveSiteSettings();
        }
Beispiel #2
0
        //*******************************************************
        //
        // The Page_Load server event handler on this page is used
        // to populate the role information for the page
        //
        //*******************************************************

        private void Page_Load(object sender, System.EventArgs e)
        {
            // Verify that the current user has access to access this page
            if (PortalSecurity.IsInRoles("Admins") == false)
            {
                Response.Redirect("~/Admin/EditAccessDenied.aspx");
            }

            // Calculate security defId
            if (Request.Params["defid"] != null)
            {
                defId = Int32.Parse(Request.Params["defid"]);
            }
            if (Request.Params["tabid"] != null)
            {
                tabId = Int32.Parse(Request.Params["tabid"]);
            }
            if (Request.Params["tabindex"] != null)
            {
                tabIndex = Int32.Parse(Request.Params["tabindex"]);
            }


            // If this is the first visit to the page, bind the definition data
            if (Page.IsPostBack == false)
            {
                if (defId == -1)
                {
                    // new module definition
                    FriendlyName.Text = "New Definition";
                    DesktopSrc.Text   = "DesktopModules/SomeModule.ascx";
                    MobileSrc.Text    = "MobileModules/SomeModule.ascx";
                }
                else
                {
                    // Obtain the module definition to edit from the database
                    Configuration config = new Configuration();
                    SiteConfiguration.ModuleDefinitionRow modDefRow = config.GetSingleModuleDefinition(defId);

                    // Read in information
                    FriendlyName.Text = modDefRow.FriendlyName;
                    DesktopSrc.Text   = modDefRow.DesktopSourceFile;
                    MobileSrc.Text    = modDefRow.MobileSourceFile;
                }
            }
        }
Beispiel #3
0
        //*********************************************************************
        //
        // AddModuleDefinition() Method <a name="AddModuleDefinition"></a>
        //
        // The AddModuleDefinition add the definition for a new module type
        // to the portal.
        //
        // Other relevant sources:
        //    + <a href="#SaveSiteSettings" style="color:green">SaveSiteSettings() method</a>
        //	  + <a href="PortalCfg.xml" style="color:green">PortalCfg.xml</a>
        //
        //*********************************************************************
        public int AddModuleDefinition(int portalId, String name, String desktopSrc, String mobileSrc)
        {
            // Obtain SiteSettings from Current Context
            SiteConfiguration siteSettings = (SiteConfiguration)HttpContext.Current.Items["SiteSettings"];

            // Create new ModuleDefinitionRow
            SiteConfiguration.ModuleDefinitionRow newModuleDef = siteSettings.ModuleDefinition.NewModuleDefinitionRow();

            // Set the parameter values
            newModuleDef.FriendlyName      = name;
            newModuleDef.DesktopSourceFile = desktopSrc;
            newModuleDef.MobileSourceFile  = mobileSrc;

            // Add the new ModuleDefinitionRow to the ModuleDefinition table
            siteSettings.ModuleDefinition.AddModuleDefinitionRow(newModuleDef);

            // Save the changes
            SaveSiteSettings();

            // Return the new ModuleDefID
            return(newModuleDef.ModuleDefId);
        }
Beispiel #4
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;
        }