コード例 #1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Get portalID from querystring
            if (Request.Params["portalID"] != null)
            {
                currentPortalID = Int32.Parse(Request.Params["portalID"]);
            }

            if (currentPortalID != -1)
            {
                // Remove cache for reload settings
                if (!Page.IsPostBack)
                {
                    CurrentCache.Remove(Key.PortalSettings());
                }

                // Obtain PortalSettings of this Portal
                PortalSettings currentPortalSettings = new PortalSettings(currentPortalID);

                // If this is the first visit to the page, populate the site data
                if (!Page.IsPostBack)
                {
                    PortalIDField.Text = currentPortalID.ToString();
                    TitleField.Text    = currentPortalSettings.PortalName;
                    AliasField.Text    = currentPortalSettings.PortalAlias;
                    PathField.Text     = currentPortalSettings.PortalPath;
                }
                EditTable.DataSource =
                    new SortedList(
                        PortalSettings.GetPortalCustomSettings(currentPortalSettings.PortalID,
                                                               PortalSettings.GetPortalBaseSettings(null)));
                EditTable.DataBind();
                EditTable.ObjectID = currentPortalID;
            }
        }
コード例 #2
0
        /// <summary>
        /// Updates the module setting.
        /// </summary>
        /// <param name="moduleId">
        /// The module id.
        /// </param>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <remarks>
        /// </remarks>
        public static void UpdateModuleSetting(int moduleId, string key, string value)
        {
            using (var connection = Config.SqlConnectionString)
                using (var command = new SqlCommand("rb_UpdateModuleSetting", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    var parameter = new SqlParameter("@ModuleID", SqlDbType.Int, 4)
                    {
                        Value = moduleId
                    };
                    command.Parameters.Add(parameter);
                    var parameter2 = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50)
                    {
                        Value = key
                    };
                    command.Parameters.Add(parameter2);
                    var parameter3 = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 0x5dc)
                    {
                        Value = value
                    };
                    command.Parameters.Add(parameter3);
                    connection.Open();
                    command.ExecuteNonQuery();
                }

            CurrentCache.Remove(Key.ModuleSettings(moduleId));
        }
コード例 #3
0
        /// <summary>
        /// The UpdateModuleSetting Method updates a single module setting
        /// in the ModuleSettings database table.
        /// </summary>
        /// <param name="moduleID">The module ID.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public static void UpdateModuleSetting(int moduleID, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (SqlConnection myConnection = Config.SqlConnectionString)
            {
                using (SqlCommand myCommand = new SqlCommand("rb_UpdateModuleSetting", myConnection))
                {
                    // Mark the Command as a SPROC
                    myCommand.CommandType = CommandType.StoredProcedure;

                    // Add Parameters to SPROC
                    SqlParameter parameterModuleID = new SqlParameter(strATModuleID, SqlDbType.Int, 4);
                    parameterModuleID.Value = moduleID;
                    myCommand.Parameters.Add(parameterModuleID);

                    SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50);
                    parameterKey.Value = key;
                    myCommand.Parameters.Add(parameterKey);

                    SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500);
                    parameterValue.Value = value;
                    myCommand.Parameters.Add(parameterValue);

                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                }
            }
            //Invalidate cache
            CurrentCache.Remove(Key.ModuleSettings(moduleID));
        }
コード例 #4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            string editPortal = Request.Params["selectedTemplate"];

            if (editPortal != null)
            {
                if (Page.IsPostBack == false)
                {
                    List <String> lstPortal = new List <string>();
                    lstPortal.Add(editPortal);
                    ddlXMLTemplates.DataSource = lstPortal;
                    ddlXMLTemplates.DataBind();
                }
            }
            else
            {
                // Verify that the current user has access to access this page
                // Removed by Mario Endara <*****@*****.**> (2004/11/04)
                //            if (PortalSecurity.IsInRoles("Admins") == false)
                //                PortalSecurity.AccessDeniedEdit();
                // If this is the first visit to the page, populate the site data
                if (Page.IsPostBack == false)
                {
                    var templateServices = PortalTemplateFactory.GetPortalTemplateServices(new PortalTemplateRepository());


                    ddlXMLTemplates.DataSource = templateServices.GetTemplates(PortalSettings.PortalAlias, PortalSettings.PortalFullPath);
                    ddlXMLTemplates.DataBind();
                    if (ddlXMLTemplates.Items.Count != 0)
                    {
                        ddlXMLTemplates.SelectedIndex = 0;
                    }
                    else
                    {
                        chkUseXMLTemplate.Enabled = false;
                    }
                }
            }
            var chkbox = Request.Params["chkUseXMLTemplate"];

            if (chkbox != null)
            {
                chkUseXMLTemplate.Checked = bool.Parse(Request.Params["chkUseXMLTemplate"]);
            }
            if (chkUseXMLTemplate.Checked == false)
            {
                // Don't use a template portal, so show the EditTable
                // Remove the cache that can be setted by the new Portal, to get a "clean" PortalBaseSetting
                CurrentCache.Remove(Key.PortalBaseSettings());
                EditTable.DataSource = new SortedList(PortalSettings.GetPortalBaseSettings(null));
                EditTable.DataBind();
                EditTable.Visible       = true;
                ddlXMLTemplates.Enabled = false;
            }
            else
            {
                EditTable.Visible       = false;
                ddlXMLTemplates.Enabled = true;
            }
        }
コード例 #5
0
 /// <summary>
 /// Clears the cache list.
 /// </summary>
 public void ClearCacheList()
 {
     // Clear cache
     lock (this)
     {
         // Jes1111
         // LayoutManager.cachedLayoutsList = null;
         CurrentCache.Remove(Key.LayoutList(Path));
         CurrentCache.Remove(Key.LayoutList(this.PortalLayoutPath));
     }
 }
コード例 #6
0
        /// <summary>
        /// Update Page Custom Settings
        /// </summary>
        /// <param name="pageId">
        /// The page ID.
        /// </param>
        /// <param name="key">
        /// The setting key.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        public static void UpdatePageSettings(int pageId, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
                using (var command = new SqlCommand("rb_UpdateTabCustomSettings", connection))
                {
                    // Mark the Command as a SPROC
                    command.CommandType = CommandType.StoredProcedure;

                    // Add Parameters to SPROC
                    var parameterPageId = new SqlParameter("@TabID", SqlDbType.Int, 4)
                    {
                        Value = pageId
                    };
                    command.Parameters.Add(parameterPageId);
                    var parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50)
                    {
                        Value = key
                    };
                    command.Parameters.Add(parameterKey);
                    if ((key == "CustomLayout" || key == "CustomTheme" || key == "CustomThemeAlt") && (value == General.GetString("PAGESETTINGS_SITEDEFAULT")))
                    {
                        value = string.Empty;
                    }
                    var parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500)
                    {
                        Value = value
                    };
                    command.Parameters.Add(parameterValue);
                    connection.Open();

                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    finally
                    {
                        connection.Close();
                    }
                }

            // Invalidate cache
            if (CurrentCache.Exists(Key.TabSettings(pageId)))
            {
                CurrentCache.Remove(Key.TabSettings(pageId));
            }

            // Clear URL builder elements
            HttpUrlBuilder.Clear(pageId);
        }
コード例 #7
0
 private void PagePropertyPage_Load(object sender, EventArgs e)
 {
     //We reset cache before dispay page to ensure dropdown shows actual data
     //by Pekka Ylenius
     CurrentCache.Remove(Key.ModuleSettings(ModuleID));
     // Using settings grouping tabs or not is set in config file. --Hongwei Shen
     EditTable.UseGroupingTabs = Rainbow.Framework.Settings.Config.UseSettingsGroupingTabs;
     // The width and height will take effect only when using grouping tabs.
     // When not using grouping tabs, width and height should be set in css
     // class -- Hongwei Shen
     EditTable.Width      = Rainbow.Framework.Settings.Config.SettingsGroupingWidth;
     EditTable.Height     = Rainbow.Framework.Settings.Config.SettingsGroupingHeight;
     EditTable.CssClass   = "st_control";
     EditTable.DataSource = new SortedList(moduleSettings);
     EditTable.DataBind();
 }
コード例 #8
0
        /// <summary>
        /// OnUpdate
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            if (Page.IsValid)
            {
                //Update main settings and Tab info in the database
                new PortalsDB().UpdatePortalInfo(currentPortalID, TitleField.Text, PathField.Text, false);

                // Update custom settings in the database
                EditTable.ObjectID = currentPortalID;
                EditTable.UpdateControls();

                // Remove cache for reload settings before redirect
                CurrentCache.Remove(Key.PortalSettings());
                // Redirect back to calling page
                RedirectBackToReferringPage();
            }
        }
コード例 #9
0
        /// <summary>
        /// Update Page Custom Settings
        /// </summary>
        /// <param name="pageID">The page ID.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public static void UpdatePageSettings(int pageID, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (SqlConnection myConnection = Config.SqlConnectionString)
            {
                using (SqlCommand myCommand = new SqlCommand("rb_UpdateTabCustomSettings", myConnection))
                {
                    // Mark the Command as a SPROC
                    myCommand.CommandType = CommandType.StoredProcedure;
                    // Add Parameters to SPROC
                    SqlParameter parameterPageID = new SqlParameter("@TabID", SqlDbType.Int, 4);
                    parameterPageID.Value = pageID;
                    myCommand.Parameters.Add(parameterPageID);
                    SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50);
                    parameterKey.Value = key;
                    myCommand.Parameters.Add(parameterKey);
                    SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500);
                    parameterValue.Value = value;
                    myCommand.Parameters.Add(parameterValue);
                    myConnection.Open();

                    try
                    {
                        myCommand.ExecuteNonQuery();
                    }

                    finally
                    {
                        myConnection.Close();
                    }
                }
            }

            //Invalidate cache
            if (CurrentCache.Exists(Key.TabSettings(pageID)))
            {
                CurrentCache.Remove(Key.TabSettings(pageID));
            }

            // Clear url builder elements
            HttpUrlBuilder.Clear(pageID);
        }
コード例 #10
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Verify that the current user has access to access this page
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
//            if (PortalSecurity.IsInRoles("Admins") == false)
//                PortalSecurity.AccessDeniedEdit();

            // If this is the first visit to the page, populate the site data
            if (Page.IsPostBack == false)
            {
                // Bind the Portals to the SolutionsList
                SolutionsList.DataSource = GetPortals();
                SolutionsList.DataBind();

                //Preselect default Portal
                if (SolutionsList.Items.FindByValue("Default") != null)
                {
                    SolutionsList.Items.FindByValue("Default").Selected = true;
                }
            }

            if (chkUseTemplate.Checked == false)
            {
                // Don't use a template portal, so show the EditTable
                // Remove the cache that can be setted by the new Portal, to get a "clean" PortalBaseSetting
                CurrentCache.Remove(Key.PortalBaseSettings());
                EditTable.DataSource = new SortedList(PortalSettings.GetPortalBaseSettings(null));
                EditTable.DataBind();
                EditTable.Visible     = true;
                SolutionsList.Enabled = false;
            }
            else
            {
                EditTable.Visible     = false;
                SolutionsList.Enabled = true;
            }
        }
コード例 #11
0
        /// <summary>
        /// Toes the show.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns></returns>
        private Control toShow(string text)
        {
            int module = 0;

            if (text.StartsWith(tokenModule))
            {
                module = int.Parse(text.Substring(tokenModule.Length));
            }
            else if (text.StartsWith(tokenPortalModule))
            {
                module = int.Parse(text.Substring(tokenPortalModule.Length));
            }
            else
            {
                return(new LiteralControl(text.ToString()));
            }

            PortalModuleControl portalModule;
            string ControlPath = string.Empty;

            using (SqlDataReader dr = ModuleSettings.GetModuleDefinitionByID(module))
            {
                if (dr.Read())
                {
                    ControlPath = Path.ApplicationRoot + "/" + dr["DesktopSrc"].ToString();
                }
            }
            try
            {
                if (ControlPath == null || ControlPath.Length == 0)
                {
                    return(new LiteralControl("Module '" + module + "' not found! "));
                }
                portalModule = (PortalModuleControl)Page.LoadControl(ControlPath);

                //Sets portal ID
                portalModule.PortalID = PortalID;

                ModuleSettings m = new ModuleSettings();
                m.ModuleID                  = module;
                m.PageID                    = ModuleConfiguration.PageID;
                m.PaneName                  = ModuleConfiguration.PaneName;
                m.ModuleTitle               = ModuleConfiguration.ModuleTitle;
                m.AuthorizedEditRoles       = string.Empty;
                m.AuthorizedViewRoles       = string.Empty;
                m.AuthorizedAddRoles        = string.Empty;
                m.AuthorizedDeleteRoles     = string.Empty;
                m.AuthorizedPropertiesRoles = string.Empty;
                m.CacheTime                 = ModuleConfiguration.CacheTime;
                m.ModuleOrder               = ModuleConfiguration.ModuleOrder;
                m.ShowMobile                = ModuleConfiguration.ShowMobile;
                m.DesktopSrc                = ControlPath;

                portalModule.ModuleConfiguration = m;

                portalModule.Settings["MODULESETTINGS_APPLY_THEME"] = false;
                portalModule.Settings["MODULESETTINGS_SHOW_TITLE"]  = false;
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(LogLevel.Warn, "Shortcut: Unable to load control '" + ControlPath + "'!", ex);
                return
                    (new LiteralControl("<br><span class=NormalRed>" + "Unable to load control '" + ControlPath + "'!" +
                                        "<br>"));
            }

            portalModule.PropertiesUrl    = string.Empty;
            portalModule.AddUrl           = string.Empty; //Readonly
            portalModule.AddText          = string.Empty; //Readonly
            portalModule.EditUrl          = string.Empty; //Readonly
            portalModule.EditText         = string.Empty; //Readonly
            portalModule.OriginalModuleID = ModuleID;

            CurrentCache.Remove(Key.ModuleSettings(module));
            return(portalModule);
        }
コード例 #12
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> object that contains the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void OnLoad(EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                // Invalidate settings cache
                if (CurrentCache.Exists(Key.TabSettings(this.PageID)))
                {
                    CurrentCache.Remove(Key.TabSettings(this.PageID));
                }
            }

            base.OnLoad(e);

            // Confirm delete
            if (!this.ClientScript.IsClientScriptBlockRegistered("confirmDelete"))
            {
                string[] s = { "CONFIRM_DELETE" };
                this.ClientScript.RegisterClientScriptBlock(
                    this.GetType(), "confirmDelete", PortalSettings.GetStringResource("CONFIRM_DELETE_SCRIPT", s));
            }

            //this.TopDeleteBtn.Attributes.Add("00", "return confirmDelete()");
            //this.LeftDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()");
            //this.RightDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()");
            //this.ContentDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()");
            //this.BottomDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()");
            urlToLoadModules = "'" + HttpUrlBuilder.BuildUrl("~/Appleseed.Core/PageLayout/LoadModule") + "'";
            // If first visit to the page, update all entries
            if (!this.Page.IsPostBack)
            {
                this.msgError.Visible = false;

                this.BindData();

                this.SetSecurityAccess();


                // 2/27/2003 Start - Ender Malkoc
                // After up or down button when the page is refreshed, select the previously selected
                // tab from the list.
                if (this.Request.Params["selectedmodid"] != null)
                {
                    try
                    {
                        var modIndex = Int32.Parse(this.Request.Params["selectedmodid"]);
                        //this.SelectModule(this.topPane, this.GetModules("TopPane"), modIndex);
                        //this.SelectModule(this.leftPane, this.GetModules("LeftPane"), modIndex);
                        //this.SelectModule(this.contentPane, this.GetModules("ContentPane"), modIndex);
                        //this.SelectModule(this.rightPane, this.GetModules("RightPane"), modIndex);
                        //this.SelectModule(this.bottomPane, this.GetModules("BottomPane"), modIndex);
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.Publish(
                            LogLevel.Error,
                            "After up or down button when the page is refreshed, select the previously selected tab from the list.",
                            ex);
                    }
                }

                // 2/27/2003 end - Ender Malkoc
            }

            // Binds custom settings to table
            this.EditTable.DataSource = new SortedList(this.PageSettings);
            this.EditTable.DataBind();

            this.ModuleIdField.Value = this.ModuleID.ToString();
            this.PageIdField.Value   = this.PageID.ToString();
        }
コード例 #13
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        /// <remarks></remarks>
        protected override void OnInit(EventArgs e)
        {
            var controlPath = string.Empty;

            // Try to get info on linked control
            var linkedModuleId = Int32.Parse(this.Settings["LinkedModule"].ToString());
            var dr             = ModuleSettings.GetModuleDefinitionByID(linkedModuleId);

            try
            {
                if (dr.Read())
                {
                    controlPath = string.Format("{0}/{1}", Path.ApplicationRoot, dr["DesktopSrc"]);
                }
            }
            finally
            {
                dr.Close();
            }

            // Load control
            PortalModuleControl portalModule = null;

            try
            {
                if (controlPath.Length == 0)
                {
                    this.PlaceHolderModule.Controls.Add(
                        new LiteralControl(
                            string.Format("Module '{0}' not found!  Use Admin panel to add a linked control.", linkedModuleId)));
                    portalModule = new PortalModuleControl();
                }
                else
                {
                    if (controlPath.ToLowerInvariant().Trim().EndsWith(".ascx"))
                    {
                        portalModule = (PortalModuleControl)this.Page.LoadControl(controlPath);
                    }
                    else // MVC
                    {
                        var strArray = controlPath.Split(
                            new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
                        int index = 1;
                        if (!Path.ApplicationRoot.Equals(string.Empty))
                        {
                            index++;
                        }
                        var areaName       = (strArray[index].ToLower() == "views") ? string.Empty : strArray[index];
                        var controllerName = strArray[strArray.Length - 2];
                        var actionName     = strArray[strArray.Length - 1];

                        // var ns = strArray[2];
                        portalModule =

                            (PortalModuleControl)this.Page.LoadControl("~/DesktopModules/CoreModules/MVC/MVCModule.ascx");

                        ((MVCModuleControl)portalModule).ControllerName = controllerName;
                        ((MVCModuleControl)portalModule).ActionName     = actionName;
                        ((MVCModuleControl)portalModule).AreaName       = areaName;
                        ((MVCModuleControl)portalModule).ModID          = linkedModuleId;

                        ((MVCModuleControl)portalModule).Initialize();
                    }


                    // Sets portal ID
                    portalModule.PortalID = this.PortalID;

                    // Update settings
                    var m = new ModuleSettings {
                        ModuleID                  = linkedModuleId,
                        PageID                    = this.ModuleConfiguration.PageID,
                        PaneName                  = this.ModuleConfiguration.PaneName,
                        ModuleTitle               = this.ModuleConfiguration.ModuleTitle,
                        AuthorizedEditRoles       = string.Empty, // read only
                        AuthorizedViewRoles       = string.Empty, // read only
                        AuthorizedAddRoles        = string.Empty, // read only
                        AuthorizedDeleteRoles     = string.Empty, // read only
                        AuthorizedPropertiesRoles = this.ModuleConfiguration.AuthorizedPropertiesRoles,
                        CacheTime                 = this.ModuleConfiguration.CacheTime,
                        ModuleOrder               = this.ModuleConfiguration.ModuleOrder,
                        ShowMobile                = this.ModuleConfiguration.ShowMobile,
                        DesktopSrc                = controlPath,
                        MobileSrc                 = string.Empty, // not supported yet
                        SupportCollapsable        = this.ModuleConfiguration.SupportCollapsable
                    };

                    // added [email protected]
                    portalModule.ModuleConfiguration = m;

                    portalModule.Settings["MODULESETTINGS_APPLY_THEME"] = this.Settings["MODULESETTINGS_APPLY_THEME"];
                    portalModule.Settings["MODULESETTINGS_THEME"]       = this.Settings["MODULESETTINGS_THEME"];

                    // added so ShowTitle is independent of the Linked Module
                    portalModule.Settings["MODULESETTINGS_SHOW_TITLE"] = this.Settings["MODULESETTINGS_SHOW_TITLE"];

                    // added so that shortcut works for module "print this..." feature
                    this.PlaceHolderModule.ID = "Shortcut";

                    // added so AllowCollapsable -- [email protected]
                    if (portalModule.Settings.ContainsKey("AllowCollapsable"))
                    {
                        portalModule.Settings["AllowCollapsable"] = this.Settings["AllowCollapsable"];
                    }

                    // Add control to the page
                    this.PlaceHolderModule.Controls.Add(portalModule);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(LogLevel.Error, string.Format("Shortcut: Unable to load control '{0}'!", controlPath), ex);
                this.PlaceHolderModule.Controls.Add(
                    new LiteralControl(
                        string.Format("<br /><span class=\"NormalRed\">Unable to load control '{0}'!</span><br />", controlPath)));
                this.PlaceHolderModule.Controls.Add(new LiteralControl(ex.Message));
                return; // The controls has failed!
            }

            // Set title
            portalModule.PropertiesUrl = HttpUrlBuilder.BuildUrl(
                "~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", this.PageID, "mID=" + this.ModuleID);
            portalModule.PropertiesText = "PROPERTIES";
            portalModule.AddUrl         = string.Empty; // Readonly
            portalModule.AddText        = string.Empty; // Readonly
            portalModule.EditUrl        = string.Empty; // Readonly
            portalModule.EditText       = string.Empty; // Readonly

            // jes1111
            portalModule.OriginalModuleID = this.ModuleID;
            CurrentCache.Remove(Key.ModuleSettings(linkedModuleId));

            base.OnInit(e);
        }
コード例 #14
0
        /// <summary>
        /// Toes the show.
        /// </summary>
        /// <param name="text">
        /// The text.
        /// </param>
        /// <returns>
        /// </returns>
        /// <remarks>
        /// </remarks>
        private Control ToShow(string text)
        {
            var module = 0;

            if (text.StartsWith(TokenModule))
            {
                module = int.Parse(text.Substring(TokenModule.Length));
            }
            else if (text.StartsWith(TokenPortalModule))
            {
                module = int.Parse(text.Substring(TokenPortalModule.Length));
            }
            else
            {
                return(new LiteralControl(text));
            }

            PortalModuleControl portalModule;
            var controlPath = string.Empty;

            using (var dr = ModuleSettings.GetModuleDefinitionByID(module))
            {
                if (dr.Read())
                {
                    controlPath = string.Format("{0}/{1}", Framework.Settings.Path.ApplicationRoot, dr["DesktopSrc"]);
                }
            }

            try
            {
                if (string.IsNullOrEmpty(controlPath))
                {
                    return(new LiteralControl(string.Format("Module '{0}' not found! ", module)));
                }

                portalModule = (PortalModuleControl)this.Page.LoadControl(controlPath);

                // Sets portal ID
                portalModule.PortalID = this.PortalID;

                var m = new ModuleSettings
                {
                    ModuleID                  = module,
                    PageID                    = this.ModuleConfiguration.PageID,
                    PaneName                  = this.ModuleConfiguration.PaneName,
                    ModuleTitle               = this.ModuleConfiguration.ModuleTitle,
                    AuthorizedEditRoles       = string.Empty,
                    AuthorizedViewRoles       = string.Empty,
                    AuthorizedAddRoles        = string.Empty,
                    AuthorizedDeleteRoles     = string.Empty,
                    AuthorizedPropertiesRoles = string.Empty,
                    CacheTime                 = this.ModuleConfiguration.CacheTime,
                    ModuleOrder               = this.ModuleConfiguration.ModuleOrder,
                    ShowMobile                = this.ModuleConfiguration.ShowMobile,
                    DesktopSrc                = controlPath
                };

                portalModule.ModuleConfiguration = m;

                portalModule.Settings["MODULESETTINGS_APPLY_THEME"].Value = false;
                portalModule.Settings["MODULESETTINGS_SHOW_TITLE"].Value  = false;
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(
                    LogLevel.Warn, string.Format("Shortcut: Unable to load control '{0}'!", controlPath), ex);
                return
                    (new LiteralControl(
                         string.Format("<br><span class=NormalRed>Unable to load control '{0}'!<br>", controlPath)));
            }

            portalModule.PropertiesUrl    = string.Empty;
            portalModule.AddUrl           = string.Empty; // Readonly
            portalModule.AddText          = string.Empty; // Readonly
            portalModule.EditUrl          = string.Empty; // Readonly
            portalModule.EditText         = string.Empty; // Readonly
            portalModule.OriginalModuleID = this.ModuleID;

            CurrentCache.Remove(Key.ModuleSettings(module));
            return(portalModule);
        }
コード例 #15
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            /* Remove the IsPostBack check to allow contained controls to interpret the event
             * to resolve issue #860424
             * Author: Cemil Ayvaz
             * Email : [email protected]
             * Date  : 2004-06-01
             *
             *          if(!IsPostBack)
             *          {
             */
            string ControlPath = string.Empty;

            //Try to get info on linked control
            int           LinkedModuleID = Int32.Parse(Settings["LinkedModule"].ToString());
            SqlDataReader dr             = ModuleSettings.GetModuleDefinitionByID(LinkedModuleID);

            try
            {
                if (dr.Read())
                {
                    ControlPath = Path.ApplicationRoot + "/" + dr["DesktopSrc"].ToString();
                }
            }
            finally
            {
                dr.Close();
            }

            //Load control
            PortalModuleControl portalModule;

            try
            {
                if (ControlPath == null || ControlPath.Length == 0)
                {
                    PlaceHolderModule.Controls.Add(
                        new LiteralControl("Module '" + LinkedModuleID +
                                           "' not found!  Use Admin panel to add a linked control."));
                    return;
                }
                portalModule = (PortalModuleControl)Page.LoadControl(ControlPath);

                //Sets portal ID
                portalModule.PortalID = PortalID;

                //Update settings
                ModuleSettings m = new ModuleSettings();
                m.ModuleID                  = LinkedModuleID;
                m.PageID                    = ModuleConfiguration.PageID;
                m.PaneName                  = ModuleConfiguration.PaneName;
                m.ModuleTitle               = ModuleConfiguration.ModuleTitle;
                m.AuthorizedEditRoles       = string.Empty; //Readonly
                m.AuthorizedViewRoles       = string.Empty; //Readonly
                m.AuthorizedAddRoles        = string.Empty; //Readonly
                m.AuthorizedDeleteRoles     = string.Empty; //Readonly
                m.AuthorizedPropertiesRoles = ModuleConfiguration.AuthorizedPropertiesRoles;
                m.CacheTime                 = ModuleConfiguration.CacheTime;
                m.ModuleOrder               = ModuleConfiguration.ModuleOrder;
                m.ShowMobile                = ModuleConfiguration.ShowMobile;
                m.DesktopSrc                = ControlPath;
                m.MobileSrc                 = string.Empty; //Not supported yet
                // added [email protected]
                m.SupportCollapsable = ModuleConfiguration.SupportCollapsable;

                portalModule.ModuleConfiguration = m;

                portalModule.Settings["MODULESETTINGS_APPLY_THEME"] = Settings["MODULESETTINGS_APPLY_THEME"];
                portalModule.Settings["MODULESETTINGS_THEME"]       = Settings["MODULESETTINGS_THEME"];

                // added so ShowTitle is independent of the Linked Module
                portalModule.Settings["MODULESETTINGS_SHOW_TITLE"] = Settings["MODULESETTINGS_SHOW_TITLE"];
                // added so that shortcut works for module "print this..." feature
                PlaceHolderModule.ID = "Shortcut";

                // added so AllowCollapsable -- [email protected]
                portalModule.Settings["AllowCollapsable"] = Settings["AllowCollapsable"];

                //Add control to the page
                PlaceHolderModule.Controls.Add(portalModule);
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(LogLevel.Error, "Shortcut: Unable to load control '" + ControlPath + "'!", ex);
                PlaceHolderModule.Controls.Add(
                    new LiteralControl("<br><span class=NormalRed>" + "Unable to load control '" + ControlPath + "'!" +
                                       "<br>"));
                PlaceHolderModule.Controls.Add(new LiteralControl(ex.Message));
                return; //The controls has failed!
            }

            //Set title
            portalModule.PropertiesUrl =
                HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", PageID, "mID=" + ModuleID.ToString());
            portalModule.PropertiesText = "PROPERTIES";
            portalModule.AddUrl         = string.Empty; //Readonly
            portalModule.AddText        = string.Empty; //Readonly
            portalModule.EditUrl        = string.Empty; //Readonly
            portalModule.EditText       = string.Empty; //Readonly
            // jes1111
            portalModule.OriginalModuleID = ModuleID;
            CurrentCache.Remove(Key.ModuleSettings(LinkedModuleID));
        }
コード例 #16
0
 protected override void OnUnload(EventArgs e)
 {
     base.OnUnload(e);
     CurrentCache.Remove(Key.PortalSettings());
 }
コード例 #17
0
 /// <summary>
 /// Clears the cache list.
 /// </summary>
 public void ClearCacheList()
 {
     //Clear cache
     CurrentCache.Remove(Key.ThemeList(Path));
     CurrentCache.Remove(Key.ThemeList(PortalThemePath));
 }