Example #1
0
        public void InitView(long idDashboard, DashboardType dashboardType, Int32 idContainerCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            View.IdDashboard = idDashboard;
            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard);
                Int32 idDashboardCommunity     = (settings == null) ? ((dashboardType == DashboardType.Community) ? idContainerCommunity : 0) : settings.IdCommunity;
                List <lm.Comol.Core.Wizard.dtoNavigableWizardItem <dtoDashboardStep> > steps = Service.GetAvailableSteps(WizardDashboardStep.HomepageSettings, idDashboard, (settings == null) ? dashboardType :settings.Type, idDashboardCommunity);
                View.LoadWizardSteps(steps);

                if (settings == null)
                {
                    View.DisplayUnknownDashboard();
                    if (dashboardType == DashboardType.Community)
                    {
                        if (idContainerCommunity < 0)
                        {
                            idDashboardCommunity = UserContext.CurrentCommunityID;
                        }
                    }
                    else
                    {
                        idDashboardCommunity = 0;
                    }
                    View.IdContainerCommunity = idDashboardCommunity;
                }
                else
                {
                    View.IdContainerCommunity = idDashboardCommunity;
                    ModuleDashboard permissions = (dashboardType == DashboardType.Community) ? Service.GetPermission(idDashboardCommunity) : ModuleDashboard.CreatePortalmodule(p.TypeID);
                    if (permissions.Edit || permissions.Administration)
                    {
                        View.SetBackUrl(RootObject.DashboardList(dashboardType, false, idContainerCommunity));
                    }
                    if (settings.Deleted != BaseStatusDeleted.None)
                    {
                        View.DisplayDeletedDashboard();
                    }
                    else if (permissions.Edit || permissions.Administration)
                    {
                        View.AllowSave = (settings.Deleted == BaseStatusDeleted.None);
                        View.SetPreviewUrl(RootObject.DashboardPreview(settings.Id, settings.Type, settings.IdCommunity));
                        View.LoadSettings(new dtoViewSettings(settings));
                        View.SendUserAction(idContainerCommunity, Service.ServiceModuleID(), settings.Id, ModuleDashboard.ActionType.DashboardSettingsViewsStartEditing);
                    }
                    else
                    {
                        View.DisplayNoPermission(idContainerCommunity, CurrentIdModule);
                    }
                }
            }
        }
        public void InitView(DashboardType type, Boolean loadFromRecycleBin, Int32 idCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard permissions = ModuleDashboard.CreatePortalmodule(p.TypeID);
                if (type == DashboardType.Community)
                {
                    idCommunity = UserContext.CurrentCommunityID;
                    if (idCommunity < 0)
                    {
                        idCommunity = UserContext.CurrentCommunityID;
                    }
                    if (idCommunity > 0 && (!permissions.Administration && !permissions.ManageTiles))
                    {
                        permissions = Service.GetPermission(idCommunity);
                    }
                }
                else
                {
                    idCommunity = 0;
                }
                View.IdContainerCommunity = idCommunity;
                View.SetTitle(type, (idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
                if (permissions.Administration || permissions.List || permissions.Edit)
                {
                    if (loadFromRecycleBin)
                    {
                        View.SetBackUrl(RootObject.DashboardList(type, false, idCommunity));
                    }
                    else
                    {
                        View.SetRecycleUrl(RootObject.DashboardList(type, true, idCommunity));
                        View.SetAddUrl(RootObject.DashboardAdd(type, idCommunity));
                    }
                    View.InitializeListControl(permissions, type, idCommunity, loadFromRecycleBin);
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, CurrentIdModule);
                }
            }
        }
Example #3
0
        public void InitView(Boolean add, long idDashboard, DashboardType dashboardType, Int32 idContainerCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Int32                 idDashboardCommunity = (dashboardType == DashboardType.Community) ? idContainerCommunity : 0;
                ModuleDashboard       permissions          = ModuleDashboard.CreatePortalmodule(p.TypeID);
                liteDashboardSettings settings             = null;
                if (add)
                {
                    settings             = new liteDashboardSettings();
                    settings.Type        = dashboardType;
                    settings.Status      = AvailableStatus.Draft;
                    settings.Name        = View.GetNewSettingsName();
                    settings.IdCommunity = (dashboardType == DashboardType.Community ? idDashboardCommunity : (dashboardType == DashboardType.AllCommunities ? -1 : 0));
                }
                else
                {
                    settings = CurrentManager.Get <liteDashboardSettings>(idDashboard);
                    if (View.PreloadFromAdd)
                    {
                        View.DisplaySettingsAdded();
                    }

                    idDashboardCommunity = (settings == null) ? ((dashboardType == DashboardType.Community) ? idContainerCommunity : 0) : settings.IdCommunity;
                }

                if (dashboardType == DashboardType.Community)
                {
                    View.IdContainerCommunity = idContainerCommunity;
                    if (idContainerCommunity < 0)
                    {
                        idContainerCommunity = UserContext.CurrentCommunityID;
                    }
                    if (idContainerCommunity > 0 && (!permissions.Administration && !permissions.ManageTiles))
                    {
                        permissions = Service.GetPermission(idContainerCommunity);
                    }
                }
                else
                {
                    idContainerCommunity      = 0;
                    View.IdContainerCommunity = 0;
                }

                List <lm.Comol.Core.Wizard.dtoNavigableWizardItem <dtoDashboardStep> > steps = Service.GetAvailableSteps(WizardDashboardStep.Settings, idDashboard, dashboardType, idContainerCommunity);
                View.LoadWizardSteps(steps);

                if ((settings == null && (idDashboard > 0 || !add)) || (settings != null && settings.Deleted != BaseStatusDeleted.None && settings.Deleted != BaseStatusDeleted.Manual))
                {
                    View.DisplayUnknownDashboard();
                    if ((add && !permissions.Add) || (!add && (!permissions.Administration || !permissions.Edit)))
                    {
                        View.DisplayNoPermission(idContainerCommunity, CurrentIdModule);
                    }
                    else
                    {
                        View.SetBackUrl(RootObject.DashboardList(dashboardType, false, idContainerCommunity));
                    }
                }
                else if ((add && permissions.Add) || permissions.Administration || (!add && permissions.Edit))
                {
                    View.AllowSave = true;
                    if (settings.Id > 0)
                    {
                        View.SetPreviewUrl(RootObject.DashboardPreview(settings.Id, settings.Type, settings.IdCommunity));
                        View.SendUserAction(idContainerCommunity, Service.ServiceModuleID(), settings.Id, ModuleDashboard.ActionType.DashboardSettingsStartEditing);
                    }
                    else
                    {
                        View.SendUserAction(idContainerCommunity, Service.ServiceModuleID(), ModuleDashboard.ActionType.DashboardSettingsStartAdding);
                    }

                    View.AllowSave = (settings.Deleted == BaseStatusDeleted.None);
                    View.SetBackUrl(RootObject.DashboardList(dashboardType, false, idContainerCommunity));
                    switch (settings.Type)
                    {
                    case DashboardType.Portal:
                        View.LoadSettings(settings, Service.GetDashboardAvailableProfileTypes(settings), settings.GetAssignments(DashboardAssignmentType.ProfileType).Select(a => a.IdProfileType).ToList());
                        break;

                    case DashboardType.Community:
                        View.LoadSettings(settings, Service.GetDashboardAvailableRoles(settings), settings.GetAssignments(DashboardAssignmentType.RoleType).Select(a => a.IdRole).ToList());
                        break;

                    case DashboardType.AllCommunities:
                        View.LoadSettings(settings);
                        break;
                    }
                }
                else
                {
                    View.DisplayNoPermission(idContainerCommunity, CurrentIdModule);
                }
            }
        }
Example #4
0
        public void InitView(WizardDashboardStep step, long idDashboard, DashboardType dashboardType, Int32 idContainerCommunity)
        {
            View.IdDashboard = idDashboard;
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else if (step == WizardDashboardStep.None)
            {
                switch (dashboardType)
                {
                case DashboardType.Portal:
                    View.RedirectToUrl(RootObject.DashboardTileReorder(WizardDashboardStep.Tiles, idDashboard, dashboardType, idContainerCommunity));
                    break;

                default:
                    View.RedirectToUrl(RootObject.DashboardTileReorder(WizardDashboardStep.Modules, idDashboard, dashboardType, idContainerCommunity));
                    break;
                }
            }
            else
            {
                View.CurrentStep = step;

                liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard);
                Int32 idDashboardCommunity     = (settings == null) ? ((dashboardType == DashboardType.Community) ? idContainerCommunity : 0) : settings.IdCommunity;
                List <lm.Comol.Core.Wizard.dtoNavigableWizardItem <dtoDashboardStep> > steps = Service.GetAvailableSteps(step, idDashboard, (settings == null) ? dashboardType : settings.Type, idDashboardCommunity);
                View.LoadWizardSteps(steps);


                ModuleDashboard permissions   = (dashboardType == DashboardType.Community) ? Service.GetPermission(idDashboardCommunity) : ModuleDashboard.CreatePortalmodule(p.TypeID);
                String          url           = lm.Comol.Core.Dashboard.Domain.RootObject.TileList(settings.Type, false, idDashboardCommunity, 0, idDashboard, step);
                Boolean         generateTiles = false;

                switch (step)
                {
                case WizardDashboardStep.CommunityTypes:
                    generateTiles = permissions.ManageTiles && permissions.Administration && (ServiceTiles.GetCommunityTypesWithoutTilesCount() > 0);
                    break;

                case WizardDashboardStep.Modules:
                case WizardDashboardStep.Tiles:
                    break;
                }
                View.InitializeView(step, url, generateTiles);
                View.DashboardType = dashboardType;
                if (settings == null)
                {
                    View.DisplayUnknownDashboard();
                    if (dashboardType == DashboardType.Community)
                    {
                        if (idContainerCommunity < 0)
                        {
                            idDashboardCommunity = UserContext.CurrentCommunityID;
                        }
                    }
                    else
                    {
                        idDashboardCommunity = 0;
                    }
                    View.IdContainerCommunity = idDashboardCommunity;
                }
                else
                {
                    View.DashboardType        = settings.Type;
                    View.IdContainerCommunity = idDashboardCommunity;

                    if (permissions.Edit || permissions.Administration)
                    {
                        View.SetBackUrl(RootObject.DashboardList(dashboardType, false, idContainerCommunity));
                    }
                    if (settings.Deleted != BaseStatusDeleted.None)
                    {
                        View.DisplayDeletedDashboard();
                    }
                    else if (permissions.Edit || permissions.Administration)
                    {
                        View.AllowSave = (settings.Deleted == BaseStatusDeleted.None);
                        View.SetPreviewUrl(RootObject.DashboardPreview(settings.Id, settings.Type, settings.IdCommunity, step));
                        LoadTiles(step, idDashboard, idDashboardCommunity);
                    }
                    else
                    {
                        View.DisplayNoPermission(idDashboardCommunity, CurrentIdModule);
                    }
                }
            }
        }