Ejemplo n.º 1
0
        /// <Summary>Page_Load runs when the control is loaded.</Summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            string FriendlyName = "";

            ModuleController objModules = new ModuleController();
            ModuleInfo objModule = objModules.GetModule( ModuleId, TabId, false );
            if( objModule != null )
            {
                FriendlyName = objModule.FriendlyName;
            }

            int ModuleControlId = Null.NullInteger;

            if( !( Request.QueryString["ctlid"] == null ) )
            {
                ModuleControlId = int.Parse( Request.QueryString["ctlid"] );
            }

            ModuleControlController objModuleControls = new ModuleControlController();
            ModuleControlInfo objModuleControl = objModuleControls.GetModuleControl( ModuleControlId );
            if( objModuleControl != null )
            {
                string FileName = Path.GetFileName( objModuleControl.ControlSrc );
                string localResourceFile = objModuleControl.ControlSrc.Replace( FileName, Localization.LocalResourceDirectory + "/" + FileName );
                if( Localization.GetString( ModuleActionType.HelpText, localResourceFile ) != "" )
                {
                    lblHelp.Text = Localization.GetString( ModuleActionType.HelpText, localResourceFile );
                }
                _key = objModuleControl.ControlKey;

                string helpUrl = Globals.GetOnLineHelp( objModuleControl.HelpURL, ModuleConfiguration );
                if( !Null.IsNull( helpUrl ) )
                {
                    cmdHelp.NavigateUrl = Globals.FormatHelpUrl( helpUrl, PortalSettings, FriendlyName );
                    cmdHelp.Visible = true;
                }
                else
                {
                    cmdHelp.Visible = false;
                }
            }

            if( Page.IsPostBack == false )
            {
                if( Request.UrlReferrer != null )
                {
                    ViewState["UrlReferrer"] = Convert.ToString( Request.UrlReferrer );
                }
                else
                {
                    ViewState["UrlReferrer"] = "";
                }
            }
        }
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load( Object sender, EventArgs e )
        {
            try
            {
                if( ( Request.QueryString["desktopmoduleid"] != null ) )
                {
                    DesktopModuleId = int.Parse( Request.QueryString["desktopmoduleid"] );
                    if( DesktopModuleId == - 2 )
                    {
                        DesktopModuleId = Null.NullInteger;
                    }
                }
                else
                {
                    DesktopModuleId = Null.NullInteger;
                }

                if( ( Request.QueryString["moduledefid"] != null ) )
                {
                    ModuleDefId = int.Parse( Request.QueryString["moduledefid"] );
                }
                else
                {
                    ModuleDefId = Null.NullInteger;
                }

                if( ( Request.QueryString["modulecontrolid"] != null ) )
                {
                    ModuleControlId = int.Parse( Request.QueryString["modulecontrolid"] );
                }
                else
                {
                    ModuleControlId = Null.NullInteger;
                }

                if( Page.IsPostBack == false )
                {
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    DesktopModuleInfo objDesktopModule;

                    objDesktopModule = objDesktopModules.GetDesktopModule( DesktopModuleId );
                    if( objDesktopModule != null )
                    {
                        txtModule.Text = objDesktopModule.FriendlyName;
                    }
                    else
                    {
                        txtModule.Text = Localization.GetString( "SkinObjects" );
                        txtTitle.Enabled = false;
                        cboType.Enabled = false;
                        txtViewOrder.Enabled = false;
                        cboIcon.Enabled = false;
                    }

                    ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
                    ModuleDefinitionInfo objModuleDefinition;

                    objModuleDefinition = objModuleDefinitions.GetModuleDefinition( ModuleDefId );
                    if( objModuleDefinition != null )
                    {
                        txtDefinition.Text = objModuleDefinition.FriendlyName;
                    }

                    ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteItem" ) );

                    ModuleControlController objModuleControls = new ModuleControlController();
                    ModuleControlInfo objModuleControl;

                    objModuleControl = objModuleControls.GetModuleControl( ModuleControlId );

                    // Added to populate cboSource with desktop module or skin controls
                    // Issue #586
                    BindControlList( "DesktopModules", true );
                    BindControlList( "Admin/Skins", false );
                    if( objDesktopModule == null ) // Add Container Controls
                    {
                        BindControlList( "Admin/Containers", false );
                    }

                    if( ! Null.IsNull( ModuleControlId ) )
                    {
                        if( objModuleControl != null )
                        {
                            txtKey.Text = objModuleControl.ControlKey;
                            txtTitle.Text = objModuleControl.ControlTitle;
                            if( cboSource.Items.FindByValue( objModuleControl.ControlSrc.ToString().ToLower() ) != null )
                            {
                                cboSource.Items.FindByValue( objModuleControl.ControlSrc.ToString().ToLower() ).Selected = true;
                                LoadIcons();
                            }
                            if( cboType.Items.FindByValue( Convert.ToInt32( objModuleControl.ControlType ).ToString() ) != null )
                            {
                                cboType.Items.FindByValue( Convert.ToInt32( objModuleControl.ControlType ).ToString() ).Selected = true;
                            }
                            if( ! Null.IsNull( objModuleControl.ViewOrder ) )
                            {
                                txtViewOrder.Text = objModuleControl.ViewOrder.ToString();
                            }
                            if( cboIcon.Items.FindByValue( objModuleControl.IconFile.ToLower() ) != null )
                            {
                                cboIcon.Items.FindByValue( objModuleControl.IconFile.ToLower() ).Selected = true;
                            }
                            if( ! Null.IsNull( objModuleControl.HelpURL ) )
                            {
                                txtHelpURL.Text = objModuleControl.HelpURL;
                            }
                        }
                    }
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }