Exemplo n.º 1
0
        private void SetBackUrl(DashboardType type, long idDashboard, WizardDashboardStep step)
        {
            if (idDashboard > 0)
            {
                String name = (step == WizardDashboardStep.None) ? "" : Service.GetSettingsName(idDashboard);
                switch (step)
                {
                case WizardDashboardStep.Settings:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardEdit(idDashboard, type), name);
                    break;

                case WizardDashboardStep.HomepageSettings:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardEditViews(idDashboard, type), name);
                    break;

                case WizardDashboardStep.Modules:
                case WizardDashboardStep.CommunityTypes:
                case WizardDashboardStep.Tiles:
                    View.SetDashboardSettingsBackUrl(RootObject.DashboardTileReorder(step, idDashboard, type), name);
                    break;
                }
            }
        }
Exemplo n.º 2
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);
                    }
                }
            }
        }