Example #1
0
 private Containers.Container LoadContainerByPath(string ContainerPath)
 {
     if (ContainerPath.ToLower().IndexOf("/skins/") != -1 || ContainerPath.ToLower().IndexOf("/skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins/") != -1)
     {
         throw new System.Exception();
     }
     Containers.Container ctlContainer = null;
     try
     {
         string ContainerSrc = ContainerPath;
         if (ContainerPath.IndexOf(Common.Globals.ApplicationPath, StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             ContainerPath = ContainerPath.Remove(0, Common.Globals.ApplicationPath.Length);
         }
         ctlContainer = ControlUtilities.LoadControl<Containers.Container>(PaneControl.Page, ContainerPath);
         ctlContainer.ContainerSrc = ContainerSrc;
         ctlContainer.DataBind();
     }
     catch (Exception exc)
     {
         ModuleLoadException lex = new ModuleLoadException(Skin.MODULELOAD_ERROR, exc);
         if (TabPermissionController.CanAdminPage())
         {
             PaneControl.Controls.Add(new ErrorContainer(PortalSettings, string.Format(Skin.CONTAINERLOAD_ERROR, ContainerPath), lex).Container);
         }
         Exceptions.LogException(lex);
     }
     return ctlContainer;
 }
Example #2
0
        public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc, bool DisplayErrorMessage)
        {
            if (ThreadAbortCheck(exc))
            {
                return;
            }
            PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();

            try
            {
                if (!Host.UseCustomErrorMessages)
                {
                    throw new ModuleLoadException(FriendlyMessage, exc);
                }
                else
                {
                    IModuleControl      ctrlModule = ctrl as IModuleControl;
                    ModuleLoadException lex        = null;
                    if (ctrlModule == null)
                    {
                        lex = new ModuleLoadException(exc.Message.ToString(), exc);
                    }
                    else
                    {
                        lex = new ModuleLoadException(exc.Message.ToString(), exc, ctrlModule.ModuleContext.Configuration);
                    }
                    CommonLibrary.Services.Log.EventLog.EventLogController objExceptionLog = new CommonLibrary.Services.Log.EventLog.EventLogController();
                    objExceptionLog.AddLog(lex);
                    if (DisplayErrorMessage)
                    {
                        PlaceHolder ErrorPlaceholder = null;
                        if (ctrl.Parent != null)
                        {
                            ErrorPlaceholder = (PlaceHolder)ctrl.Parent.FindControl("MessagePlaceHolder");
                        }
                        if (ErrorPlaceholder != null)
                        {
                            ctrl.Visible             = false;
                            ErrorPlaceholder.Visible = true;
                            ErrorPlaceholder.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                        else
                        {
                            ctrl.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                        }
                    }
                }
            }
            catch (Exception exc2)
            {
                ProcessPageLoadException(exc2);
            }
        }
Example #3
0
 public void InjectModule(ModuleInfo objModule)
 {
     bool bSuccess = true;
     try
     {
         if (!Common.Globals.IsAdminControl())
         {
             PaneControl.Controls.Add(new LiteralControl("<a name=\"" + objModule.ModuleID.ToString() + "\"></a>"));
         }
         Containers.Container ctlContainer = LoadModuleContainer(objModule);
         Containers.Add(ctlContainer.ID, ctlContainer);
         if (Common.Globals.IsLayoutMode() && Common.Globals.IsAdminControl() == false)
         {
             Panel ctlDragDropContainer = new Panel();
             System.Web.UI.Control ctlTitle = ctlContainer.FindControl("dnnTitle");
             ctlDragDropContainer.ID = ctlContainer.ID + "_DD";
             PaneControl.Controls.Add(ctlDragDropContainer);
             ctlDragDropContainer.Controls.Add(ctlContainer);
             if (ctlTitle != null)
             {
                 if (ctlTitle.Controls.Count > 0)
                 {
                     ctlTitle = ctlTitle.Controls[0];
                 }
             }
             //if (ctlDragDropContainer != null && ctlTitle != null)
             //{
             //    ClientAPI.EnableContainerDragAndDrop(ctlTitle, ctlDragDropContainer, objModule.ModuleID);
             //    ClientAPI.RegisterPostBackEventHandler(PaneControl, "MoveToPane", ModuleMoveToPanePostBack, false);
             //}
         }
         else
         {
             PaneControl.Controls.Add(ctlContainer);
         }
         ctlContainer.SetModuleConfiguration(objModule);
         if (PaneControl.Visible == false)
         {
             PaneControl.Visible = true;
         }
     }
     catch (Exception exc)
     {
         ModuleLoadException lex;
         lex = new ModuleLoadException(string.Format(Skin.MODULEADD_ERROR, PaneControl.ID.ToString()), exc);
         if (TabPermissionController.CanAdminPage())
         {
             PaneControl.Controls.Add(new ErrorContainer(PortalSettings, Skin.MODULELOAD_ERROR, lex).Container);
         }
         Exceptions.LogException(exc);
         bSuccess = false;
         throw lex;
     }
     if (!bSuccess)
     {
         throw new ModuleLoadException();
     }
 }
Example #4
0
 public static void LogException(ModuleLoadException exc)
 {
     CommonLibrary.Services.Log.EventLog.EventLogController objExceptionLog = new CommonLibrary.Services.Log.EventLog.EventLogController();
     objExceptionLog.AddLog(exc, CommonLibrary.Services.Log.EventLog.EventLogController.ExceptionLogType.MODULE_LOAD_EXCEPTION);
 }
Example #5
0
 private bool ProcessMasterModules()
 {
     bool bSuccess = true;
     if (TabPermissionController.CanViewPage())
     {
         if (!CheckExpired())
         {
             if ((PortalSettings.ActiveTab.StartDate < DateTime.Now && PortalSettings.ActiveTab.EndDate > DateTime.Now) || Globals.IsLayoutMode())
             {
                 if (PortalSettings.ActiveTab.Modules.Count > 0)
                 {
                     foreach (ModuleInfo objModule in PortalSettings.ActiveTab.Modules)
                     {
                         if (ModulePermissionController.CanViewModule(objModule) && objModule.IsDeleted == false)
                         {
                             if ((objModule.StartDate < DateTime.Now && objModule.EndDate > DateTime.Now) || Common.Globals.IsLayoutMode() || Common.Globals.IsEditMode())
                             {
                                 Pane pane = null;
                                 bool bFound = Panes.TryGetValue(objModule.PaneName.ToLowerInvariant(), out pane);
                                 if (!bFound)
                                 {
                                     bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
                                 }
                                 if (bFound)
                                 {
                                     bSuccess = InjectModule(pane, objModule);
                                 }
                                 else
                                 {
                                     ModuleLoadException lex;
                                     lex = new ModuleLoadException(PANE_LOAD_ERROR);
                                     Controls.Add(new ErrorContainer(PortalSettings, MODULELOAD_ERROR, lex).Container);
                                     Exceptions.LogException(lex);
                                 }
                             }
                         }
                     }
                 }
             }
             else
             {
                 AddPageMessage(this, "", TABACCESS_ERROR, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
             }
         }
         else
         {
             AddPageMessage(this, "", string.Format(CONTRACTEXPIRED_ERROR, PortalSettings.PortalName, Common.Globals.GetMediumDate(PortalSettings.ExpiryDate.ToString()), PortalSettings.Email), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
         }
     }
     else
     {
         Response.Redirect(Common.Globals.AccessDeniedURL(TABACCESS_ERROR), true);
     }
     return bSuccess;
 }
 public static void LogException(ModuleLoadException exc)
 {
     CommonLibrary.Services.Log.EventLog.EventLogController objExceptionLog = new CommonLibrary.Services.Log.EventLog.EventLogController();
     objExceptionLog.AddLog(exc, CommonLibrary.Services.Log.EventLog.EventLogController.ExceptionLogType.MODULE_LOAD_EXCEPTION);
 }
 public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc, bool DisplayErrorMessage)
 {
     if (ThreadAbortCheck(exc))
         return;
     PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
     try
     {
         if (!Host.UseCustomErrorMessages)
         {
             throw new ModuleLoadException(FriendlyMessage, exc);
         }
         else
         {
             IModuleControl ctrlModule = ctrl as IModuleControl;
             ModuleLoadException lex = null;
             if (ctrlModule == null)
             {
                 lex = new ModuleLoadException(exc.Message.ToString(), exc);
             }
             else
             {
                 lex = new ModuleLoadException(exc.Message.ToString(), exc, ctrlModule.ModuleContext.Configuration);
             }
             CommonLibrary.Services.Log.EventLog.EventLogController objExceptionLog = new CommonLibrary.Services.Log.EventLog.EventLogController();
             objExceptionLog.AddLog(lex);
             if (DisplayErrorMessage)
             {
                 PlaceHolder ErrorPlaceholder = null;
                 if (ctrl.Parent != null)
                 {
                     ErrorPlaceholder = (PlaceHolder)ctrl.Parent.FindControl("MessagePlaceHolder");
                 }
                 if (ErrorPlaceholder != null)
                 {
                     ctrl.Visible = false;
                     ErrorPlaceholder.Visible = true;
                     ErrorPlaceholder.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                 }
                 else
                 {
                     ctrl.Controls.Add(new ErrorContainer(_portalSettings, FriendlyMessage, lex).Container);
                 }
             }
         }
     }
     catch (Exception exc2)
     {
         ProcessPageLoadException(exc2);
     }
 }