private List <dtoModuleActionControl> AnalyzeActions(dtoModuleDisplayActionInitializer dto, StandardActionType actionsToDisplay) { List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>(); View.ContainerCSS = dto.ContainerCSS; View.IconSize = dto.IconSize; if (dto.Link == null || dto.Link.DestinationItem == null) { View.DisplayEmptyAction(); } else { View.Display = dto.Display; liteBaseCommunityFile item = CurrentManager.Get <liteBaseCommunityFile>(dto.Link.DestinationItem.ObjectLongID); View.ItemType = RepositoryItemType.None; if (item == null || (dto.Link.DestinationItem.ObjectLongID == 0 && (dto.Link.Action == (int)CoreModuleRepository.ActionType.CreateFolder || dto.Link.Action == (int)CoreModuleRepository.ActionType.CreateFolder))) { View.DisplayRemovedObject(); } else { View.ItemType = item.RepositoryItemType; if (dto.PlaceHolders.Where(p => !String.IsNullOrEmpty(p.Text)).Any() && (Display(dto.Display, DisplayActionMode.defaultAction) || Display(dto.Display, DisplayActionMode.text))) { View.DisplayPlaceHolders(dto.PlaceHolders.Where(p => !String.IsNullOrEmpty(p.Text)).ToList()); } actions = AnalyzeModuleLinkItem(dto.Link, item, dto.Display, actionsToDisplay); } } return(actions); }
public void ChangeGroupBy(long idDashboard, DashboardViewType view, GroupItemsBy groupBy, UserCurrentSettings userSettings) { liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard); if (settings == null) { View.DisplayUnknownDashboard(); } else { View.InitializeSettingsInfo(settings); View.SelectedGroupBy = groupBy; userSettings.View = view; if (userSettings.GroupBy != groupBy) { switch (userSettings.GroupBy) { case GroupItemsBy.CommunityType: case GroupItemsBy.Tile: userSettings.IdSelectedTile = -1; break; case GroupItemsBy.Tag: userSettings.IdSelectedTag = -1; break; } } userSettings.GroupBy = groupBy; userSettings.OrderBy = (groupBy == settings.Container.Default.GroupBy) ? settings.Container.Default.OrderBy : OrderItemsBy.LastAccess; View.CurrentSettings = userSettings; ChangeView(userSettings.View, settings, userSettings, View.CurrentOrderItems); } }
public void InitView(WizardDashboardStep step, long idDashboard, Int32 idCommunity, DashboardType dashboardType) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { View.IdDashboard = idDashboard; View.CurrentStep = step; liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard); Int32 idDashboardCommunity = (settings == null) ? ((dashboardType == DashboardType.Community) ? idCommunity : 0) : settings.IdCommunity; View.DashboardIdCommunity = idDashboardCommunity; if (settings == null) { View.DisplayUnknownDashboard(); } else { View.InitializeSettingsInfo(settings); UserCurrentSettings userSettings = GetUserSettings(step, settings); View.CurrentSettings = userSettings; View.EnableFullWidth((settings == null) ? false : settings.FullWidth); InitalizeTopBar(settings, userSettings); if (userSettings.View != DashboardViewType.Search) { LoadGroupBy(settings, userSettings); } InitializeView(settings, userSettings); View.IsInitialized = true; } } }
public void SelectMessage(long idRecipientMessage) { if (UserContext.isAnonymous) { SessionTimeout(View.CurrentIdCommunity, View.PreloadSelectedTab); } else { MailRecipient recipient = CurrentManager.Get <MailRecipient>(idRecipientMessage); lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation translation = new lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation(); if (recipient != null) { if (recipient.Item != null) { translation.Body = recipient.Item.Body; translation.Subject = recipient.Item.Subject; } View.DisplayMessagePreview(false, recipient.LanguageCode, translation, new List <String>(), recipient.Message.MailSettings, View.SelectedFilter.IdCommunity, View.CurrentModuleObject); } else { switch (View.CurrentDisplayBy) { case DisplayItems.ByRecipient: LoadRecipients(View.SelectedFilter, View.Pager.PageIndex, View.PageSize, false); break; case DisplayItems.ByMessage: break; } } } }
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 SaveSettings(dtoBaseDashboardSettings dto) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { String url = ""; ModuleDashboard.ActionType action = (dto.Id == 0) ? ModuleDashboard.ActionType.DashboardSettingsUnableToAdd : ModuleDashboard.ActionType.DashboardSettingsUnableToSave; DashboardSettings settings = (dto.Id > 0) ? CurrentManager.Get <DashboardSettings>(dto.Id) : null; if (dto.Id > 0 && settings == null) { View.DisplayDeletedDashboard(); View.SendUserAction(dto.IdCommunity, CurrentIdModule, dto.Id, action); lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(CacheKeys.AllDashboard); return; } else if (settings != null && settings.Active && !dto.ForAll && dto.Assignments.Count == 0) { View.DisplayMessage(DashboardErrorType.NoAssignmentsForActiveSettings); } else { try { DashboardSettings item = Service.SaveBaseSettings(dto); if (item != null) { action = (dto.Id > 0) ? ModuleDashboard.ActionType.DashboardSettingsSaved : ModuleDashboard.ActionType.DashboardSettingsAdded; if (action == ModuleDashboard.ActionType.DashboardSettingsAdded) { url = RootObject.DashboardEdit(item.Id, item.Type, dto.IdCommunity, true); } else { View.EnableSelector(!item.ForAll); } } View.DisplayMessage(action); lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(CacheKeys.AllDashboard); } catch (DashboardException ex) { View.DisplayMessage(ex.ErrorType); } } View.SendUserAction(dto.IdCommunity, CurrentIdModule, dto.Id, action); if (!String.IsNullOrEmpty(url)) { View.RedirectToUrl(url); } else if (action == ModuleDashboard.ActionType.DashboardSettingsSaved) { View.LoadWizardSteps(Service.GetAvailableSteps(WizardDashboardStep.Settings, settings.Id, settings.Type, View.IdContainerCommunity)); } } }
public void SaveViews(long idDashboard, dtoViewSettings dto) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { ModuleDashboard.ActionType action = ModuleDashboard.ActionType.DashboardSettingsViewsUnableToSave; if (dto.Pages.Count > 0 && dto.Pages.Where(p => p.Type != DashboardViewType.Combined && p.Type != DashboardViewType.Tile && !p.Range.IsValid(p.MaxItems)).Any()) { View.DisplayRangeError(dto, dto.Pages.Where(p => p.Type != DashboardViewType.Combined && p.Type != DashboardViewType.Tile && !p.Range.IsValid(p.MaxItems)).Select(p => p).ToList()); } else if (!dto.Pages.Where(p => p.Type != DashboardViewType.Search && p.Type != DashboardViewType.Subscribe).Any()) { View.DisplayNoPageError(); } else if (dto.Pages.Where(p => p.Type == DashboardViewType.Tile).Any() && dto.Pages.Where(p => p.Type == DashboardViewType.Tile && !dto.Pages.Where(d => d.Type == p.TileRedirectOn).Any()).Any()) { View.DisplayTileUnableToRedirectOn(); } else { DashboardSettings settings = CurrentManager.Get <DashboardSettings>(idDashboard); if (settings == null) { View.DisplayDeletedDashboard(); View.SendUserAction(View.IdContainerCommunity, CurrentIdModule, idDashboard, action); return; } else { try { DashboardSettings item = Service.SaveViewSettings(settings, dto); if (item != null) { action = ModuleDashboard.ActionType.DashboardSettingsViewsSaved; View.LoadWizardSteps(Service.GetAvailableSteps(WizardDashboardStep.HomepageSettings, idDashboard, item.Type, View.IdContainerCommunity)); } //Per aggiornare gli switch... InitView(View.PreloadIdDashboard, View.DashboardType, View.IdContainerCommunity, false); View.DisplayMessage(action); } catch (DashboardException ex) { View.DisplayMessage(ex.ErrorType); } } } View.SendUserAction(View.IdContainerCommunity, CurrentIdModule, idDashboard, action); } }
public void InitView() { int idCommunity = View.PreloadIdCommunity; long idProject = View.PreloadIdProject; View.ProjectIdCommunity = idCommunity; View.IdProject = idProject; View.isPersonal = View.PreloadIsPersonal; View.forPortal = View.PreloadForPortal; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { Project project = CurrentManager.Get <Project>(idProject); if (project == null) { View.DisplayUnknownProject(); View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown); } else { View.isPersonal = project.isPersonal; View.forPortal = project.isPortal; View.ProjectIdCommunity = (!project.isPortal && project.Community != null) ? project.Community.Id : 0; SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project); Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); ModuleProjectManagement permission = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule)); PmActivityPermission taskpermission = Service.GetProjectPermission(idProject, UserContext.CurrentUserID); //// calcolo permessi if ((permission.Administration && !project.isPersonal) || (taskpermission & PmActivityPermission.ManageResources) == PmActivityPermission.ManageResources) { View.AllowAddExternalUser = true; //se il progetto e la sua comunità tornano, allora vado avanti View.AllowAddCommunityUser = (!project.isPortal && project.Community != null); View.AllowSave = true; View.LoadWizardSteps(idProject, idCommunity, project.isPersonal, project.isPortal, Service.GetAvailableSteps(WizardProjectStep.ProjectUsers, idProject)); LoadProjectResources(idProject, true, View.UnknownUser, true, project.isPersonal); } else { ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID); if (resource != null && resource.Visibility == ProjectVisibility.Full) { LoadProjectResources(idProject, false, View.UnknownUser, false, project.isPersonal); } else { View.DisplayNoPermission(idCommunity, currentIdModule); } } } } }
public void AddFilesToItem(long idProject, long idActivity) { if (UserContext.isAnonymous) { View.DisplayWorkingSessionExpired(); } else { List <lm.Comol.Core.FileRepository.Domain.dtoModuleUploadedItem> files = null; PmActivity activity = (idActivity > 0) ? CurrentManager.Get <PmActivity>(idActivity) : null; Project project = (idProject > 0) ? CurrentManager.Get <Project>(idProject) : ((activity != null) ? activity.Project : null); if (idActivity > 0) { if (activity == null) { View.DisplayActivityNotFound(); View.SendUserAction(View.IdProjectCommunity, CurrentIdModule, idProject, idActivity, ModuleProjectManagement.ActionType.AttachmentsActivityNotFound); return; } else { files = View.UploadFiles(activity, false); } } else if (idProject > 0 && project != null) { files = View.UploadFiles(project, false); } else { View.DisplayProjectNotFound(); View.SendUserAction(View.IdProjectCommunity, CurrentIdModule, idProject, idActivity, ModuleProjectManagement.ActionType.AttachmentsProjectNotFound); return; } if (files != null && files.Any(f => f.IsAdded)) { List <ProjectAttachment> attachments = Service.AttachmentsAddFiles(project, activity, files.Where(f => f.IsAdded).ToList()); if (attachments == null) { View.DisplayItemsNotAdded(); } else { View.DisplayItemsAdded(); } View.SendUserAction(View.IdProjectCommunity, CurrentIdModule, idProject, idActivity, (attachments == null) ? ModuleProjectManagement.ActionType.AttachmentsNotAddedFiles : ModuleProjectManagement.ActionType.AttachmentsAddedFiles); } else { View.DisplayNoFilesToAdd(); } } }
public void InitView() { Boolean accessAvailable = !(View.isSystemOutOfOrder); Int32 idProfile = View.PreloadedIdProfile; long idProvider = View.PreloadedIdProvider; View.IdProfile = idProfile; View.IdProvider = idProvider; if (idProfile == 0) { View.GotoAuthenticationSelctorPage(); } else { AuthenticationProvider provider = CurrentManager.Get <AuthenticationProvider>(idProvider); Person person = CurrentManager.GetPerson(idProfile); if (person == null) { View.GotoAuthenticationSelctorPage(); } else { switch (provider.ProviderType) { case AuthenticationProviderType.Internal: View.AllowInternalAuthentication = true && accessAvailable; break; case AuthenticationProviderType.Url: UrlAuthenticationProvider urlProvider = (UrlAuthenticationProvider)provider; if (!string.IsNullOrEmpty(urlProvider.RemoteLoginUrl)) { View.AllowExternalWebAuthentication(urlProvider.RemoteLoginUrl); } else if (!string.IsNullOrEmpty(urlProvider.SenderUrl)) { View.AllowExternalWebAuthentication(urlProvider.SenderUrl); } break; } if (Service.IsProfileWaitingForActivation(person)) { View.DisplayNotActivatedAccount(person.Name); } else { View.DisplayDisabledAccount(person.Name); } } } }
public void InitView(Int32 idCommunity, MenuBarType menubarType, String baseUrl, String defaultModuleToolTip, String defaultModuleUrl, String defaultModuleText) { if (idCommunity == -1) { idCommunity = UserContext.CurrentCommunityID; } Int32 idOrganization = 0; if (idCommunity > 0) { liteCommunity community = CurrentManager.Get <liteCommunity>(idCommunity); if (community == null) { idCommunity = 0; } else { idOrganization = community.IdOrganization; } } if (idOrganization == 0) { idOrganization = CurrentManager.GetUserDefaultIdOrganization(UserContext.CurrentUserID); } if (idCommunity == 0 && (menubarType != MenuBarType.Portal && menubarType != MenuBarType.PortalAdministration)) { menubarType = MenuBarType.Portal; idCommunity = 0; } else if (idCommunity > 0 && menubarType == MenuBarType.None) { menubarType = MenuBarType.GenericCommunity; } if (idCommunity == 0) { View.DisplayName((menubarType == MenuBarType.Portal) ? View.GetPortalName : View.GetAdministrationName); } else { View.DisplayName(CurrentManager.GetCommunityName(idCommunity)); } //Language language = CurrentManager.GetLanguageByIdOrDefault(UserContext.cu) View.BindLogo(idCommunity, idOrganization, UserContext.Language.Code); View.LoadMenuBar(Service.RenderCachedMenubar(idCommunity, menubarType, baseUrl, defaultModuleToolTip, defaultModuleUrl, defaultModuleText)); View.MenubarType = menubarType; }
public void InitView(Int32 idCommunity) { litePerson p = CurrentManager.Get <litePerson>(UserContext.CurrentUserID); if (UserContext.isAnonymous && p != null) { View.DisplaySessionTimeout(); } else { NoticeBoard.Domain.ModuleNoticeboard permissions = ServiceNoticeboard.GetPermissions((idCommunity > 0) ? idCommunity : 0); lm.Comol.Core.BaseModules.NoticeBoard.Domain.liteHistoryItem message = ServiceNoticeboard.GetLastHistoryItem(idCommunity); if (permissions.Administration || permissions.ViewCurrentMessage) { if (message == null) { View.LoadNoMessage(); } else { if (idCommunity == 0) { View.LoadMessage(message, p); } else { liteSubscriptionInfo s = Service.GetSubscriptionInfo(p.Id, idCommunity); if (s == null) { View.LoadNoPermissionsToSeeMessage(); } else { View.LoadMessage(message, idCommunity, s); } } } } else { View.LoadNoPermissionsToSeeMessage(); } } }
public String GetDescriptionByLink(ModuleLink link) { String result = ""; if (link == null || link.DestinationItem == null) { result = ""; } else { liteBaseCommunityFile item = CurrentManager.Get <liteBaseCommunityFile>(link.DestinationItem.ObjectLongID); if (item == null) { result = ""; } else { if (item.isFile) { result = View.GetDisplayItemDescription(item.DisplayName, item.Extension, item.Size, item.RepositoryItemType); } else { switch (link.Action) { case (int)CoreModuleRepository.ActionType.CreateFolder: result = View.CreateFolderDescription(item.Name); break; case (int)CoreModuleRepository.ActionType.UploadFile: result = View.UploadFileDescription(item.Name); break; case 0: result = View.FolderDescription(item.Name); break; } } } } return(result); }
public void AddUserFromPortal() { long idVersion = View.IdVersion; if (UserContext.isAnonymous) { Logout(View.CurrentType, View.IdTemplate, idVersion); } else { List <Int32> idCommunities = new List <Int32>(); TemplateDefinition t = CurrentManager.Get <TemplateDefinition>(View.IdTemplate); if (t != null && t.OwnerInfo.Community != null) { idCommunities.Add(t.OwnerInfo.Community.Id); } View.SelectedIdUsers = GetUpdatedUsersSelection(); View.DisplayAddUsersFromPortal(Service.GetIdUserAssignments(idVersion)); } }
public void ChangeView(DashboardViewType view, long idDashboard, UserCurrentSettings userSettings, Dictionary <DashboardViewType, List <dtoItemFilter <OrderItemsBy> > > order, String searchBy = "") { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard); if (settings == null) { View.DisplayUnknownDashboard(); } else { View.InitializeSettingsInfo(settings); ChangeView(view, settings, userSettings, order, searchBy, true); } } }
public void EditUserProviderInfo(long idLoginInfo) { BaseLoginInfo loginInfo = CurrentManager.Get <BaseLoginInfo>(idLoginInfo); if (loginInfo != null) { View.CurrentIdProvider = 0; if (typeof(InternalLoginInfo) == loginInfo.GetType()) { View.EditInternalUserInfo(idLoginInfo, ((InternalLoginInfo)loginInfo).Login); } else { View.CurrentIdProvider = ((ExternalLoginInfo)loginInfo).Provider.Id; View.EditExternalUserInfo(idLoginInfo, Service.GetProfileProvider(View.idProfile, ((ExternalLoginInfo)loginInfo).Provider.Id, UserContext.Language.Id), new dtoExternalCredentials() { IdentifierLong = ((ExternalLoginInfo)loginInfo).IdExternalLong, IdentifierString = ((ExternalLoginInfo)loginInfo).IdExternalString }); } } }
public void ApplyFilters(long idDashboard, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { liteDashboardSettings settings = CurrentManager.Get <liteDashboardSettings>(idDashboard); if (settings == null) { View.DisplayUnknownDashboard(); } else { View.InitializeSettingsInfo(settings); litePageSettings page = (settings != null) ? settings.Pages.Where(p => p.Type == DashboardViewType.Search).FirstOrDefault() : new litePageSettings() { Type = DashboardViewType.Search, MaxItems = 25, More = DisplayMoreItems.Hide, Noticeboard = DisplayNoticeboard.Hide, PlainLayout = PlainLayout.full }; liteTile tile = null; long idTile = View.PreloadIdTile; if (idTile > 0) { tile = Service.GetTile(idTile); } else if (filters.IdcommunityType > -1) { tile = Service.GetTileForCommunityType(filters.IdcommunityType); } List <long> tags = View.TagsToLoad; if (tags != null && tags.Any() && idTile > 0) { filters.IdTags = tags; } Int32 idUserLanguage = ((UserContext != null && UserContext.Language != null) ? UserContext.Language.Id : -2); View.ApplyFilters(page, filters, tile, idUserLanguage, CurrentManager.GetDefaultIdLanguage()); } } }
public void SetPassword(long idLoginInfo) { if (UserContext.isAnonymous) { View.DisplayWorkinkSessionTimeout(); } else { InternalLoginInfo loginInfo = CurrentManager.Get <InternalLoginInfo>(idLoginInfo); if (loginInfo != null && loginInfo.Person != null) { View.CurrentIdProvider = 0; if (typeof(InternalLoginInfo) == loginInfo.GetType()) { View.EditInternalUserPassword(idLoginInfo, loginInfo.Login, loginInfo.Person.SurnameAndName, loginInfo.Person.Mail); } } else { LoadAuthenticationItems(); } } }
public void InitView(int idPerson, long idProvider, UrlProviderResult message) { Person person = CurrentManager.GetPerson(idPerson); InitializeLanguage(person); UrlAuthenticationProvider provider = CurrentManager.Get <UrlAuthenticationProvider>(idProvider); if (person != null) { View.DisplayMessage(person.SurnameAndName, message); } else { View.DisplayMessage(message); } String defaultUrl = (provider != null) ? provider.RemoteLoginUrl : ""; if (message != UrlProviderResult.ValidToken) { View.SetAutoLogonUrl(defaultUrl); } }
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); } } }
public void Initialize(long idCall, long submissionTypeId, long idRevision, long idSubmission) { if (idCall <= 0) { return; } View.IdCall = idCall; if (!CanPrint) { return; } BaseForPaper call = CurrentManager.Get <BaseForPaper>(idCall); if (call == null) { return; } int comId = call.Community.Id; int usrId = UserContext.CurrentUserID; //Manager Bando //Individuo eventuale sottomissione, revisione, bando, tipo di bando... View.CallName = call.Name; View.CallType = call.Type; View.IdSubmission = idSubmission; View.IdRevision = idRevision; SubmitterType type = null; if (idSubmission > 0 && idRevision > 0) { dtoSubmissionRevision subRev = CallService.GetSubmissionWithRevisions(idSubmission, true); if (subRev != null && subRev.Type != null && subRev.Revisions != null && subRev.Revisions.Any()) { dtoRevision rev = subRev.Revisions.FirstOrDefault(r => r.Id == idRevision); if (rev != null) { View.IdRevision = idRevision; } else { View.IdRevision = 0; } View.IdSubmission = subRev.Id; type = CurrentManager.Get <SubmitterType>(subRev.Type.Id); } else { View.IdSubmission = 0; View.IdRevision = 0; } } if (type == null) { type = call.SubmittersType.FirstOrDefault(st => st.Id == submissionTypeId); if (type == null) { type = call.SubmittersType.OrderBy(st => st.DisplayOrder).FirstOrDefault(); } } View.SubmissionType = type; }
public Boolean EditProfileType(Int32 IdNewType) { Boolean result = false; Int32 IdProfile = View.IdProfile; ProfileTypeChanger person = CurrentManager.Get <ProfileTypeChanger>(IdProfile); Int32 oldIdType = person.TypeID; if (IdProfile > 0 && person != null) { if (person.TypeID == (int)UserTypeStandard.Company && IdNewType != (int)UserTypeStandard.Company) { person = Service.EditProfileType(person, IdNewType); } else if (IdNewType == (int)UserTypeStandard.Company) { person = Service.EditProfileType(person, IdNewType); } else if (person.TypeID == (int)UserTypeStandard.Employee && IdNewType != (int)UserTypeStandard.Employee) { person = Service.EditProfileType(person, IdNewType); } else if (IdNewType == (int)UserTypeStandard.Employee) { person = Service.EditProfileType(person, IdNewType); } if (oldIdType != IdNewType) { if (IdNewType == (int)UserTypeStandard.Company) { dtoCompany company = (dtoCompany)View.CurrentProfile; if (oldIdType == (int)UserTypeStandard.Employee || View.DeletePreviousProfileType(IdProfile, oldIdType, IdNewType)) { result = (Service.SaveCompanyUser(company, null) != null); } } else if (IdNewType == (int)UserTypeStandard.Employee) { dtoEmployee employee = (dtoEmployee)View.CurrentProfile; if (oldIdType == (int)UserTypeStandard.Company || View.DeletePreviousProfileType(IdProfile, oldIdType, IdNewType)) { Employee savedEmployee = Service.SaveEmployee(employee, null); if (savedEmployee != null) { long idAgency = employee.CurrentAgency.Key; if (idAgency < 1) { idAgency = Service.GetEmptyAgency(0).Key; } SaveAgencyAffiliation(employee.CurrentAgency.Key, IdProfile); } result = (savedEmployee != null); } } else { result = View.EditProfileType(View.CurrentProfile, oldIdType, IdNewType); if (result == true) { Service.UpdateFirstLetter(IdProfile); } } if (result && oldIdType == (int)UserTypeStandard.Employee) { Service.CloseEmployeeAffiliations(IdProfile); } } } return(result); }
public void UploadSign(Boolean forPublicCall, List <dtoSubmissionValueField> fields, lm.Comol.Core.MailCommons.Domain.Configurations.SmtpServiceConfig smtpConfig, String websiteUrl, Dictionary <SubmissionTranslations, string> translations, DateTime clickDt ) { //Lo tengo da parte, per evitare che lo scadere della sessione dia problemi. Int32 idUser = UserContext.CurrentUserID; long idSubmission = View.IdSubmission; long idRevision = View.IdRevision; //System.Guid uniqueID = View.PreloadedUniqueID; long idCall = View.PreloadIdCall; DateTime initDt = clickDt; //Aggiugnere blocco se call scaduta! if (!ServiceCall.SignSubmissionIsNotExpired(idSubmission, idRevision, initDt, clickDt)) { View.DisplayOutOfTime("Expired", true, false); return; } UserSubmission submission = CurrentManager.Get <UserSubmission>(idSubmission); Revision revision = ServiceCall.GetRevision(idRevision); ModuleActionLink aLink = View.AddInternalFile( revision, ModuleCallForPaper.UniqueCode, ServiceCall.ServiceModuleID(), (int)ModuleCallForPaper.ActionType.DownloadSubmittedFile, (int)ModuleCallForPaper.ObjectType.UserSubmission ); if (aLink == null || aLink.Link == null) { //ToDo: error } else { //Manager.SaveOrUpdate(mLink); ServiceCall.SetSignLink( idCall, revision.Id, aLink); bool success = ServiceCall.UserCompleteSubmissionSign( idSubmission, idRevision, DateTime.Now, idUser, fields, smtpConfig, websiteUrl, translations, clickDt ); if (!success) { View.DisplayOutOfTime("Expired", true, true); return; } } View.SendSuccessTrap(); View.SendUserAction( UserContext.CurrentCommunityID, ServiceCall.ServiceModuleID(), idCall, ModuleCallForPaper.ActionType.SignUploaded); InitView(forPublicCall); }
private Boolean EditProfileType(Int32 idProfile, Int32 idNewType, Int32 idOrganization, MacUrlAuthenticationProvider provider, List <UserProfileAttribute> pAttributes, List <dtoMacUrlUserAttribute> attributes) { Boolean result = false; ProfileTypeChanger person = CurrentManager.Get <ProfileTypeChanger>(idProfile); Int32 idOldType = person.TypeID; dtoBaseProfile profile = GetCurrentProfileData(idProfile, idOldType, provider.ProviderType); if (idProfile > 0 && person != null) { Person people = CurrentManager.GetPerson(idProfile); if (people != null) { CurrentManager.Detach(people); } if (person.TypeID == (int)UserTypeStandard.Company && idNewType != (int)UserTypeStandard.Company) { person = ProfileService.EditProfileType(person, idNewType); } else if (idNewType == (int)UserTypeStandard.Company) { person = ProfileService.EditProfileType(person, idNewType); } else if (person.TypeID == (int)UserTypeStandard.Employee && idNewType != (int)UserTypeStandard.Employee) { person = ProfileService.EditProfileType(person, idNewType); } else if (idNewType == (int)UserTypeStandard.Employee) { person = ProfileService.EditProfileType(person, idNewType); } if (idOldType != idNewType && person != null) { if (idNewType == (int)UserTypeStandard.Company) { dtoCompany company = (dtoCompany)Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType); if (idOldType == (int)UserTypeStandard.Employee || View.DeletePreviousProfileType(idProfile, idOldType, idNewType)) { result = (ProfileService.SaveCompanyUser(company, null) != null); } } else if (idNewType == (int)UserTypeStandard.Employee) { dtoEmployee employee = (dtoEmployee)Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType); if (idOldType == (int)UserTypeStandard.Company || View.DeletePreviousProfileType(idProfile, idOldType, idNewType)) { Employee savedEmployee = ProfileService.SaveEmployee(employee, null); if (savedEmployee != null) { //long idAgency = employee.CurrentAgency.Key; //if (idAgency < 1) // idAgency = ProfileService.GetEmptyAgency(0).Key; //SaveAgencyAffiliation(employee.CurrentAgency.Key, IdProfile); UpdateAgencyAssocation(idProfile, idOrganization, provider, attributes); } result = (savedEmployee != null); } } else { result = View.EditProfileType(idProfile, Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType), idOldType, idNewType); } if (result && idOldType == (int)UserTypeStandard.Employee) { ProfileService.CloseEmployeeAffiliations(idProfile); } } } return(result); }
private void LoadData(DisplayEvaluations display, Int32 idCommunity, dtoCall call, dtoSubmissionRevision submission, long idEvaluation, long idEvaluator) { View.CurrentDisplay = display; List <dtoCommitteeEvaluationInfo> committees = null; String owner = (submission.IsAnonymous || submission.Owner == null) ? View.AnonymousDisplayName : submission.Owner.SurnameAndName; litePerson submitter = CurrentManager.GetLitePerson(submission.IdSubmittedBy); String submittedBy = (submission.IdPerson == submission.IdSubmittedBy) ? "" : (submitter == null || submitter.TypeID == (int)UserTypeStandard.Guest) ? View.AnonymousDisplayName : submitter.SurnameAndName; View.LoadSubmissionInfo(owner, call.Name, submission.SubmittedOn, submittedBy); View.AllowPrint = true; if (call.AdvacedEvaluation) { View.SetViewEvaluationUrl(""); } else { View.SetViewEvaluationUrl(RootObject.ViewSubmissionTableEvaluations(submission.Id, call.Id, idCommunity)); } View.CommitteeIsFuzzy = Service.GetCommitteeDssMethodIsFuzzy(call.Id); switch (display) { case DisplayEvaluations.ForSubmission: committees = (call.AdvacedEvaluation) ? ServiceCall.GetCommitteesInfoForSubmission(submission.Id, call.Id, View.AdvCommId) : Service.GetCommitteesInfoForSubmission(submission.Id, call.Id); View.LoadCommitteesStatus(committees, display); View.LoadEvaluations( (call.AdvacedEvaluation) ? ServiceCall.GetSubmissionEvaluationsDispItem(call.Id, submission.Id, View.AdvCommId, View.UnknonwUserName) : Service.GetSubmissionEvaluations(submission.Id, call.Id, View.UnknonwUserName) ); break; case DisplayEvaluations.ForUser: committees = (call.AdvacedEvaluation) ? ServiceCall.GetCommitteesInfoForEvaluator(idEvaluator, View.AdvCommId) : Service.GetCommitteesInfoForEvaluator(idEvaluator); CallEvaluator evaluator = CurrentManager.Get <CallEvaluator>(idEvaluator); if (committees != null) { View.LoadEvaluatorInfo((evaluator == null || evaluator.Person == null) ? View.AnonymousDisplayName : evaluator.Person.SurnameAndName, committees.Count); } else { View.LoadEvaluatorInfo((evaluator == null || evaluator.Person == null) ? View.AnonymousDisplayName : evaluator.Person.SurnameAndName, 0); } View.LoadEvaluations(Service.GetEvaluationsInfo(idEvaluator, submission.Id, View.AnonymousDisplayName, View.UnknonwUserName)); View.LoadCommitteesStatus(committees, display); break; case DisplayEvaluations.Single: lm.Comol.Modules.CallForPapers.Domain.Evaluation.dtoEvaluation evaluation = (call.AdvacedEvaluation) ? ServiceCall.GetFullEvaluation(idEvaluation, View.AnonymousDisplayName, View.UnknonwUserName): Service.GetFullEvaluation(idEvaluation, View.AnonymousDisplayName, View.UnknonwUserName); if (evaluation == null) { View.DisplayUnknownEvaluation(View.IdCallCommunity, View.IdCallModule, idEvaluation); } else { dtoCommitteeEvaluation result = new dtoCommitteeEvaluation() { Evaluation = evaluation, IdCommittee = evaluation.IdCommittee }; committees = (call.AdvacedEvaluation) ? ServiceCall.GetCommitteesInfoForEvaluator(evaluation.IdEvaluator): Service.GetCommitteesInfoForEvaluator(evaluation.IdEvaluator); if (committees.Where(c => c.IdCommittee == evaluation.IdCommittee).Any()) { committees.Where(c => c.IdCommittee == evaluation.IdCommittee).FirstOrDefault().Status = evaluation.Status; result.Status = evaluation.Status; result.Name = committees.Where(c => c.IdCommittee == evaluation.IdCommittee).FirstOrDefault().Name; } View.LoadCommitteesStatus(committees.Where(c => c.IdCommittee == evaluation.IdCommittee).ToList(), display); if (committees != null) { View.LoadEvaluatorInfo(evaluation.EvaluatorName, committees.Count); } else { View.LoadEvaluatorInfo(evaluation.EvaluatorName, 0); } View.LoadEvaluation(result); } break; } }
public void InitView(long idLink, long idItem, long idVersion, long idFolder, String path, Boolean setBackUrl, String backUrl) { RepositoryIdentifier rIdentifier = Service.ItemGetRepositoryIdentifier(idItem); Int32 idCommunity = UserContext.CurrentCommunityID; View.IdItem = idItem; View.IdVersion = idVersion; View.IdLink = idLink; View.IdCurrentFolder = idFolder; View.CurrentFolderIdentifierPath = path; if (setBackUrl && String.IsNullOrEmpty(backUrl)) { backUrl = View.GetPreviousRelativeUrl(); if (!IsValidPreviousUrl(backUrl)) { backUrl = ""; setBackUrl = false; } if (backUrl.StartsWith(RootObject.BaseRepositoryUrl(), StringComparison.InvariantCultureIgnoreCase) && rIdentifier != null) { cookieRepository cookie = View.GetRepositoryCookie(rIdentifier); if (cookie != null) { backUrl = RootObject.RepositoryItems(rIdentifier.Type, rIdentifier.IdCommunity, 0, cookie.IdFolder, cookie.Type, cookie.ItemsOrderBy, cookie.Ascending, cookie.IdentifierPath); } } SetLogoutUrl(View.GetCurrentUrl(), setBackUrl, backUrl); } else { View.DefaultLogoutUrl = View.GetCurrentUrl(); } View.BackUrl = (setBackUrl ? backUrl : ""); View.SetPageBackUrl(backUrl); View.PageIdentifier = Guid.NewGuid(); if (SessionTimeout()) { return; } View.IsInitialized = true; ModuleRepository.ActionType uAction = ModuleRepository.ActionType.None; if (rIdentifier == null) { uAction = ModuleRepository.ActionType.MultimedaSettingsTryToLoad; View.DisplayUnknownItem(); } else { Int32 idCurrentUser = UserContext.CurrentUserID; liteRepositoryItem item = Service.ItemGet(idItem); liteRepositoryItemVersion version = Service.ItemGetVersion(idItem, idVersion); if (version == null) { uAction = ModuleRepository.ActionType.MultimedaSettingsTryToLoad; View.DisplayUnknownItem(); } else if (version.Type != ItemType.Multimedia) { idCommunity = version.IdCommunity; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsInvalidType); uAction = ModuleRepository.ActionType.MultimedaSettingsInvalidType; } else { idVersion = version.Id; View.IdVersion = idVersion; idCommunity = version.IdCommunity; if (version.Availability == ItemAvailability.available || version.Availability == ItemAvailability.waitingsettings) { ItemPermission permissions = null; if (idLink == 0) { dtoDisplayRepositoryItem dto = Service.GetItemWithPermissions(idItem, idCurrentUser, item.Repository, View.GetUnknownUserName()); if (dto != null) { permissions = dto.Permissions; } } else { liteModuleLink link = CurrentManager.Get <liteModuleLink>(idLink); if (link == null) { View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsNoPermission); } else { permissions = View.GetLinkPermissions(link, idCurrentUser); idCommunity = link.SourceItem.CommunityID; } } if (permissions != null) { if (permissions.EditSettings) { if (version.Availability == ItemAvailability.waitingsettings) { View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsNoDefaultDocument); } List <dtoMultimediaFileObject> items = Service.MultimediaGetItems(idItem, idVersion); View.AllowSave = (items != null && items.Any()); View.LoadItems(item.UniqueIdVersion.ToString(), item.DisplayName, items, (items == null ? null : items.Where(i => i.IsDefaultDocument).FirstOrDefault())); } else { uAction = ModuleRepository.ActionType.MultimedaSettingsNoPermissions; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsNoPermission); } } else { uAction = ModuleRepository.ActionType.MultimedaSettingsStatusError; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsInvalidStatus, version.Availability); } } else { uAction = ModuleRepository.ActionType.MultimedaSettingsStatusError; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.multimediaSettingsInvalidStatus, version.Availability); } } View.RepositoryIdentifier = CacheKeys.RepositoryIdentifierKey(rIdentifier.Type, rIdentifier.IdCommunity); View.RepositoryIdCommunity = rIdentifier.IdCommunity; View.RepositoryType = rIdentifier.Type; View.IsInitialized = true; } View.SendUserAction(idCommunity, Service.GetIdModule(), uAction); }
public void InitView() { int IdCommunity = UserContext.CurrentCommunityID; long idFile = View.PreloadedFileId; BaseCommunityFile file = Service.GetItem(idFile); if (file != null && file.CommunityOwner != null) { IdCommunity = file.CommunityOwner.Id; } if (UserContext.isAnonymous) { View.SendToSessionExpiredPage(IdCommunity, UserContext.Language.Code); } else { View.BackUrl = View.PreloadedBackUrl; long moduleLinkId = View.PreloadedLinkId; View.ModuleLinkId = moduleLinkId; View.FileId = idFile; if (idFile == 0 && moduleLinkId == 0) { View.ShowUnkownFile(IdCommunity, ModuleID, CoreModuleRepository.UniqueID); } else { Person person = CurrentManager.GetPerson(UserContext.CurrentUserID); ModuleLink link = CurrentManager.Get <ModuleLink>(moduleLinkId); ScormMetadataPermission permission = ScormMetadataPermission.none; if (link == null && file == null) { View.ShowUnkownFile(IdCommunity, ModuleID, CoreModuleRepository.UniqueID); } else if (!file.isSCORM) { View.ShowNoScormFile(file.DisplayName); } else if ((link == null && file != null) || file.GetType() == typeof(CommunityFile)) { IdCommunity = (file.CommunityOwner == null ? 0 : file.CommunityOwner.Id); CoreModuleRepository module = Service.ServicePermission(UserContext.CurrentUserID, IdCommunity); if (Service.HasPermissionToSeeRepositoryItem(idFile, module.Administration, module.Administration, UserContext.CurrentUserID)) { permission = (module.Administration || (module.Edit && file.Owner == person)) ? ScormMetadataPermission.edit : ScormMetadataPermission.view; View.InitializeMetadataControl(file.UniqueID, file.DisplayName, permission); } else { View.ShowNoPermissionToEditMetadata(IdCommunity, ModuleID, CoreModuleRepository.UniqueID, file.DisplayName); } } else { IdCommunity = link.SourceItem.CommunityID; ModuleObject linkedObject = ModuleObject.CreateLongObject(file.Id, file, (int)CoreModuleRepository.ObjectType.ScormPackage, IdCommunity, CoreModuleRepository.UniqueID); permission = View.GetModuleLinkPermission(link.SourceItem.CommunityID, moduleLinkId, link.SourceItem, linkedObject, UserContext.CurrentUserID); if (permission == ScormMetadataPermission.none) { View.ShowNoPermissionToEditMetadata(IdCommunity, link.SourceItem.ServiceID, link.SourceItem.ServiceCode, file.DisplayName); } else { View.InitializeMetadataControl(file.UniqueID, file.DisplayName, permission); } } } } }
public void InitView(long idLink, iCoreFilePermission permission) { InitView(CurrentManager.Get <ModuleLink>(idLink), permission); }
public void InitView(String plattformId, long idItem, Guid uniqueId, long idVersion, Guid uniqueIdVersion, ItemType type, long idLink, String language, Boolean saveCompleteness, Boolean isOnModal, Boolean refreshContainer, Boolean saveStatistics) { Guid playUniqueSessionId = Guid.NewGuid(); Guid workingSessionId = UserContext.WorkSessionID; String playSessionId = plattformId + "_" + playUniqueSessionId.ToString(); Int32 idUser = UserContext.CurrentUserID; View.IdItem = idItem; View.IdLink = idLink; View.IdVersion = idVersion; View.ItemType = type; View.SaveStatistics = saveStatistics; View.PlayUniqueSessionId = playUniqueSessionId; View.WorkingSessionId = workingSessionId; View.PlaySessionId = playSessionId; if (SessionTimeout()) { if (isOnModal) { View.DisplaySessionExpired(); } else { View.DisplaySessionTimeout(); } } else if (uniqueId == Guid.Empty || uniqueIdVersion == Guid.Empty) { InitViewForRedirect(idItem, uniqueId, idVersion, uniqueIdVersion, type, idLink, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { if (String.IsNullOrWhiteSpace(language)) { language = ""; } liteRepositoryItem item = Service.ItemGet(idItem); liteRepositoryItemVersion version = Service.ItemGetVersion(idItem, idVersion); if (version != null && version.Id != idVersion) { View.IdVersion = version.Id; } if (item == null) { View.DisplayUnknownItem(); } else { liteFileTransfer fileTransfer = null; type = item.Type; View.ItemType = type; switch (type) { case ItemType.File: case ItemType.Folder: case ItemType.Link: case ItemType.SharedDocument: case ItemType.VideoStreaming: View.DisplayMessage(item.DisplayName, item.Extension, type, Domain.PlayerErrors.InvalidType); break; case ItemType.ScormPackage: case ItemType.Multimedia: liteModuleLink link = null; Boolean hasPermissions = false; View.ItemIdCommunity = item.IdCommunity; fileTransfer = Service.FileTransferGet(idItem, version.Id); if (idLink == 0) { hasPermissions = Service.HasPermissionToSeeItem(idUser, item, version, ModuleRepository.ActionType.PlayFile); } else { link = CurrentManager.Get <liteModuleLink>(idLink); if (link == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); return; } else { if (link.DestinationItem.ObjectIdVersion > 0 && version != null && version.Id != link.DestinationItem.ObjectIdVersion) { version = Service.ItemGetVersion(idItem, link.DestinationItem.ObjectIdVersion); } ModuleObject obj = ModuleObject.CloneObject(link.DestinationItem); obj.ObjectIdVersion = (version != null ? version.Id : obj.ObjectIdVersion); saveCompleteness = link.AutoEvaluable && saveCompleteness; hasPermissions = View.HasPermissionForLink(UserContext.CurrentUserID, idLink, obj, item.Type, link.SourceItem.ServiceID, link.SourceItem.ServiceCode); View.ItemIdCommunity = link.SourceItem.CommunityID; } } Boolean playerLoaded = false; if (version == null) { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0), ItemAvailability.notavailable, item.Status); } else if (type == ItemType.Multimedia && fileTransfer != null && String.IsNullOrEmpty(fileTransfer.DefaultDocumentPath)) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidSettings); } else if ((type == ItemType.Multimedia || type == ItemType.ScormPackage) && fileTransfer == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidTransfer); } else if (version.Availability == ItemAvailability.available) { playerLoaded = hasPermissions; if (hasPermissions) { LoadPlayer(idUser, playSessionId, workingSessionId, item, version, fileTransfer, link, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); } } else { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0 && item.HasVersions), item.Availability, item.Status); } if (!playerLoaded && !View.PreloadIsOnModal) { Boolean setBackUrl = View.PreloadSetBackUrl; String backUrl = View.PreloadBackUrl; View.BackUrl = (setBackUrl ? backUrl : ""); View.SetPageBackUrl(backUrl); } break; } } } }
public void InitView(long idSettings, long idLink, long idItem, long idVersion) { RepositoryIdentifier rIdentifier = Service.ItemGetRepositoryIdentifier(idItem); Int32 idCommunity = UserContext.CurrentCommunityID; View.IdItem = idItem; View.IdVersion = idVersion; View.IdLink = idLink; View.PageIdentifier = Guid.NewGuid(); if (SessionTimeout()) { return; } View.IsInitialized = true; ModuleRepository.ActionType uAction = ModuleRepository.ActionType.None; if (rIdentifier == null) { uAction = ModuleRepository.ActionType.ScormSettingsTryToLoad; View.DisplayUnknownItem(); } else { Int32 idCurrentUser = UserContext.CurrentUserID; liteRepositoryItem item = Service.ItemGet(idItem); liteRepositoryItemVersion version = Service.ItemGetVersion(idItem, idVersion); if (version == null) { uAction = ModuleRepository.ActionType.ScormSettingsTryToLoad; View.DisplayUnknownItem(); } else if (version.Type != ItemType.ScormPackage) { idCommunity = version.IdCommunity; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsInvalidType); uAction = ModuleRepository.ActionType.ScormSettingsInvalidType; } else { idVersion = version.Id; View.IdVersion = idVersion; idCommunity = version.IdCommunity; if (version.Availability == ItemAvailability.available || version.Availability == ItemAvailability.waitingsettings) { ItemPermission permissions = null; if (idLink == 0) { dtoDisplayRepositoryItem dto = Service.GetItemWithPermissions(idItem, idCurrentUser, item.Repository, View.GetUnknownUserName()); if (dto != null) { permissions = dto.Permissions; } } else { liteModuleLink link = CurrentManager.Get <liteModuleLink>(idLink); if (link == null) { View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsNoPermission); } else { permissions = View.GetLinkPermissions(link, idCurrentUser); idCommunity = link.SourceItem.CommunityID; } } if (permissions != null && (permissions.Edit || permissions.EditSettings || permissions.ViewMyStatistics || permissions.ViewOtherStatistics)) { uAction = ModuleRepository.ActionType.ScormSettingsView; if (version.Availability == ItemAvailability.waitingsettings) { View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsWaitingToSet); } dtoScormPackageSettings settings = Service.ScormPackageGetDtoCompletionSettings(idItem, idVersion, idSettings); if (settings == null) { View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsNotFound); } else { View.IdSettings = settings.Id; View.LoadSettings(item.UniqueIdVersion.ToString(), item.DisplayName, settings, true, true); } } else { uAction = ModuleRepository.ActionType.ScormSettingsNoPermissions; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsNoPermission); } } else { uAction = ModuleRepository.ActionType.ScormSettingsStatusError; View.DisplayMessage(version.DisplayName, version.Extension, version.Type, Domain.UserMessageType.scormSettingsInvalidStatus, version.Availability); } } View.RepositoryIdentifier = CacheKeys.RepositoryIdentifierKey(rIdentifier.Type, rIdentifier.IdCommunity); View.RepositoryIdCommunity = rIdentifier.IdCommunity; View.RepositoryType = rIdentifier.Type; View.IsInitialized = true; } View.SendUserAction(idCommunity, Service.GetIdModule(), uAction); }