Exemple #1
0
        private void LoadTags(DashboardViewType tileRedirectOn, DisplayNoticeboard noticeboard, long idDashboard, List <dtoLiteTile> tiles, Int32 tileDisplayItems, GroupItemsBy groupBy)
        {
            OrderItemsBy orderby            = View.CurrentOrderItemsBy;
            Boolean      displayLessCommand = View.DisplayLessCommand;
            Language     l = CurrentManager.GetDefaultLanguage();

            displayLessCommand = displayLessCommand = (displayLessCommand) && tiles.Count() + ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1) > tileDisplayItems;
            List <dtoTileDisplay> items = null;

            if (View.IsPreview)
            {
                items = tiles.Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, true)
                {
                    CommandUrl = RootObject.DashboardPreview(idDashboard, tileRedirectOn, groupBy, orderby, t.Tile.Id, t.Tile.GetAvailableIdTags().FirstOrDefault())
                }).ToList();
            }
            else
            {
                items = tiles.Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id)
                {
                    CommandUrl = RootObject.LoadPortalView(UserContext.CurrentUserID, tileRedirectOn, groupBy, orderby, noticeboard, t.Tile.Id, t.Tile.GetAvailableIdTags().FirstOrDefault(), true, displayLessCommand)
                }).ToList();
            }
            if (displayLessCommand)
            {
                View.LoadTiles(noticeboard, items);
                View.DisplayMoreCommand = false;
                View.DisplayLessCommand = true;
            }
            {
                View.LoadTiles(noticeboard, items.Skip(0).Take(tileDisplayItems - ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1)).ToList());
                View.DisplayMoreCommand = tiles.Count() + ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1) > tileDisplayItems;
            }
        }
Exemple #2
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);
                    }
                }
            }
        }
Exemple #3
0
        private void LoadMiniTiles(long idDashboard, List <dtoLiteTile> tiles, Int32 miniTileDisplayItems, GroupItemsBy groupBy, OrderItemsBy orderBy, long preloadIdTile, out dtoTileDisplay selectedTile)
        {
            Boolean displayLessCommand = View.DisplayLessCommand;

            if (!tiles.Where(t => t.Tile.Id == preloadIdTile).Any())
            {
                preloadIdTile = tiles.Select(t => t.Tile.Id).FirstOrDefault();
            }
            View.IdCurrentTile = preloadIdTile;
            Language l = CurrentManager.GetDefaultLanguage();

            displayLessCommand = (displayLessCommand) && tiles.Where(t => t.Tile.Id != preloadIdTile).Count() > miniTileDisplayItems;
            List <dtoTileDisplay> items = null;
            Boolean forPreview          = View.IsPreview;

            if (forPreview)
            {
                items = tiles.Where(t => t.Tile.Id != preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, forPreview)
                {
                    CommandUrl = RootObject.DashboardPreview(idDashboard, DashboardViewType.Combined, groupBy, orderBy, t.Tile.Id)
                }).ToList();
            }
            else
            {
                items = tiles.Where(t => t.Tile.Id != preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id)
                {
                    CommandUrl = RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Combined, groupBy, orderBy, DisplayNoticeboard.OnRight, t.Tile.Id, -1, true, displayLessCommand, false)
                }).ToList();
            }

            if (displayLessCommand)
            {
                View.LoadMiniTiles(items);
                View.DisplayMoreCommand = false;
                View.DisplayLessCommand = true;
            }
            else
            {
                View.LoadMiniTiles(items.Skip(0).Take(miniTileDisplayItems).ToList());
                View.DisplayMoreCommand = (tiles.Where(t => t.Tile.Id != preloadIdTile).Count() > miniTileDisplayItems);
            }
            selectedTile = tiles.Where(t => t.Tile.Id == preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, forPreview)).FirstOrDefault();
        }
Exemple #4
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);
                }
            }
        }
Exemple #5
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);
                    }
                }
            }
        }