コード例 #1
0
        public void InitView(dtoDisplayItemRepository item, String currentUrl, int IdModule, int IdCommunity, int idAction, ItemDisplayView view, ItemDisplayMode mode, ItemDescriptionDisplayMode descriptionDisplay, ItemAvailableCommand commands)
        {
            View.DisplayView            = view;
            View.DisplayMode            = mode;
            View.DescriptionDisplayMode = descriptionDisplay;
            View.AvailableCommands      = commands;
            if (item == null || item.File == null)
            {
                View.DisplayUnknownItem();
            }
            // codice file cancellato
            //else if (={}
            else if (UserContext.isAnonymous)
            {
                View.DisplayItemName(item);
            }
            else
            {
                switch (item.File.RepositoryItemType)
                {
                case RepositoryItemType.ScormPackage:
                case RepositoryItemType.FileStandard:
                case RepositoryItemType.None:
                    View.DisplayItem(item, currentUrl, IdModule, IdCommunity, idAction);
                    break;

                case RepositoryItemType.Folder:
                    View.DisplayFolder(item, View.FolderNavigationUrl, IdModule, IdCommunity, idAction);
                    break;

                case RepositoryItemType.VideoStreaming:
                    View.DisplayItem(item, currentUrl, IdModule, IdCommunity, idAction);
                    break;

                case RepositoryItemType.Multimedia:
                    MultimediaFileTransfer fileTransfer = Service.GetMultimediaFileTransfer(item.File);
                    String url = "";
                    if (fileTransfer == null || fileTransfer.DefaultDocument == null)
                    {
                        item.Permission.Play = false;
                    }
                    else
                    {
                        url = fileTransfer.DefaultDocument.Fullname;
                    }
                    View.DisplayMultimediaItem(item, currentUrl, url, IdModule, IdCommunity, idAction);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #2
0
        public void InitView()
        {
            int  IdUser      = UserContext.CurrentUserID;
            int  idCommunity = UserContext.CurrentCommunityID;
            long IdLink      = View.PreloadedIdLink;
            long IdFile      = View.PreloadedIdFile;

            View.BackUrl = View.PreloadedBackUrl;
            View.IdFile  = IdFile;
            View.IdLink  = IdLink;
            View.AllowSetDefaultDocument = false;
            BaseCommunityFile item = Service.GetItem(IdFile);

            if (item != null && item.CommunityOwner != null)
            {
                idCommunity = item.CommunityOwner.Id;
            }
            if (UserContext.isAnonymous)
            {
                View.SendToSessionExpiredPage(idCommunity, UserContext.Language.Code);
            }
            else if (item == null)
            {
                View.LoadFileNotExist();
            }
            else if (item.RepositoryItemType == RepositoryItemType.Multimedia)
            {
                RepositoryItemPermission permissions = new RepositoryItemPermission();
                if (IdLink == 0 || item.GetType() == typeof(CommunityFile))
                {
                    CoreModuleRepository module = null;
                    if (item.CommunityOwner == null)
                    {
                        module = CoreModuleRepository.CreatePortalmodule(UserContext.UserTypeID);
                    }
                    else if (!item.IsInternal)
                    {
                        module = new CoreModuleRepository(CurrentManager.GetModulePermission(IdUser, item.CommunityOwner.Id, ModuleID));
                    }
                    else
                    {
                        module = new CoreModuleRepository();
                    }
                    if (Service.HasPermissionToSeeRepositoryItem(item.Id, module.Administration, module.Administration, IdUser))
                    {
                        permissions = new dtoDisplayItemRepository(item, module, IdUser, module.Administration).Permission;
                    }
                }
                else
                {
                    ModuleLink link = Service.GetModuleLink(IdLink);
                    permissions = View.GetModuleLinkPermission(link.SourceItem.CommunityID, IdUser, link);
                }
                if (permissions.EditSettings)
                {
                    MultimediaFileTransfer multimedia = Service.GetMultimediaFileTransfer(item);
                    if (multimedia == null)
                    {
                        View.LoadFileNotExist();
                    }
                    else if (multimedia.MultimediaIndexes.Count == 0)
                    {
                        View.LoadFileWithoutIndex(item);
                    }
                    else
                    {
                        View.AllowSetDefaultDocument = permissions.EditSettings;
                        View.LoadTree(item, (from m in multimedia.MultimediaIndexes select m.Fullname.Replace(item.UniqueID.ToString() + "\\", "")).ToList(), (multimedia.DefaultDocument == null) ? "" : multimedia.DefaultDocument.Fullname.Replace(item.UniqueID.ToString() + "\\", ""));
                    }
                }
                else
                {
                    View.LoadFileNoPermission();
                }
            }
            else
            {
                View.LoadInvalidFileType(item);
            }
        }
コード例 #3
0
        public void InitView(dtoDisplayItemRepository item, String currentUrl, int IdModule, int IdCommunity, int idAction)
        {
            ItemAvailableCommand commands = (ItemAvailableCommand.Download | ItemAvailableCommand.Play | ItemAvailableCommand.Settings | ItemAvailableCommand.Statistics);

            this.InitView(item, currentUrl, IdModule, IdCommunity, idAction, ItemDisplayView.multilineFull, ItemDisplayMode.inline, ItemDescriptionDisplayMode.AsTooltip, commands);
        }