예제 #1
0
        private List <dtoModuleActionControl> AnalyzeItem(dtoSubActivity item, DisplayActionMode display, StandardActionType actionsToDisplay)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (item != null)
            {
                if (Display(display, DisplayActionMode.text))
                {
                    DisplayTextInfo(item);
                }
                else if (Display(display, DisplayActionMode.defaultAction))
                {
                    DisplayDefaultAction(item);
                }
                actions = GenerateActions(item);
                if (Display(display, DisplayActionMode.actions) && actionsToDisplay != StandardActionType.None)
                {
                    View.DisplayActions(actions.Where(a => ((int)a.ControlType & (int)actionsToDisplay) > 0).ToList());
                }
            }
            return(actions);
        }
예제 #2
0
        private List <dtoModuleActionControl> InitializeControlByLink(Boolean getOnlyActions, Int32 idUser, dtoObjectRenderInitializer dto, StandardActionType actionsToDisplay, DisplayActionMode dAction)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (!getOnlyActions && (dto.Link == null || dto.Link.DestinationItem == null))
            {
                if (getOnlyActions)
                {
                    return(new List <dtoModuleActionControl>());
                }
                else
                {
                    View.DisplayEmptyAction();
                }
            }
            else if (dto.Link.DestinationItem.ServiceCode == CoreModuleRepository.UniqueID)
            {
                View.ItemIdentifier = "link_" + dto.Link.Id.ToString();
                actions             = AnalyzeActions(getOnlyActions, dto, dAction, actionsToDisplay);
            }
            else if (!getOnlyActions)
            {
                View.DisplayEmptyAction();
            }
            return(actions);
        }
예제 #3
0
 public List <dtoModuleActionControl> InitRemoteControlView(Int32 idUser, dtoObjectRenderInitializer dto, StandardActionType actionsToDisplay, DisplayActionMode dAction)
 {
     return(InitializeControlByLink((dAction == DisplayActionMode.none), idUser, dto, actionsToDisplay, dAction));
 }
예제 #4
0
 public void InitView(Int32 idUser, dtoObjectRenderInitializer dto, StandardActionType actionToDisplay, DisplayActionMode dAction)
 {
     InitializeControlByLink(false, idUser, dto, actionToDisplay, dAction);
 }
예제 #5
0
 public void InitView(Int32 idUser, dtoObjectRenderInitializer dto, DisplayActionMode dAction)
 {
     InitView(idUser, dto, (ValidateActionMode(dAction, DisplayActionMode.defaultAction) ? StandardActionType.Play : StandardActionType.None), dAction);
 }
예제 #6
0
        private List <dtoModuleActionControl> GenerateActions(liteRepositorySettings settings, dtoDisplayObjectRepositoryItem obj, dtoObjectRenderInitializer dto, DisplayActionMode dAction)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();
            Int32  idModule   = obj.Link.SourceItem.ServiceID;
            String moduleCode = obj.Link.SourceItem.ServiceCode;

            String      baseUrl     = View.GetIstanceFullUrl();
            Boolean     notSaveStat = (dAction == DisplayActionMode.adminMode);
            DisplayMode mode        = View.OverrideItemDisplayMode;

            if (mode == DisplayMode.none)
            {
                mode = obj.DisplayMode;
            }
            switch (obj.Type)
            {
            case ItemType.Link:
                actions.Add(new dtoModuleActionControl(View.SanitizeLinkUrl(obj.Url), StandardActionType.Play, true));
                actions.Add(new dtoModuleActionControl(View.SanitizeLinkUrl(obj.Url), StandardActionType.DownloadItem, true));
                break;

            case ItemType.File:
                if (obj.Availability == ItemAvailability.available)
                {
                    actions.Add(new dtoModuleActionControl(RootObject.DownloadFromModule(baseUrl, obj.IdItem, obj.IdVersion, obj.DisplayName, mode, UserContext.WorkSessionID.ToString(), ((long)idModule), obj.Link.Id, (!dto.SaveObjectStatistics || notSaveStat)), StandardActionType.Play, true));
                    actions.Add(new dtoModuleActionControl(RootObject.DownloadFromModule(baseUrl, obj.IdItem, obj.IdVersion, obj.DisplayName, mode, UserContext.WorkSessionID.ToString(), ((long)idModule), obj.Link.Id, (!dto.SaveObjectStatistics || notSaveStat)), StandardActionType.DownloadItem, true));
                }
                break;

            case ItemType.Multimedia:
            case ItemType.ScormPackage:
                if (obj.Availability == ItemAvailability.available)
                {
                    Boolean onModalPage = dto.ForceOnModalPage || (mode == DisplayMode.downloadOrPlayOrModal || mode == DisplayMode.inModal);
                    Boolean setPrevious = dto.SetPreviousPage;
                    String  backUrl     = (setPrevious ? View.DestinationUrl : "");
                    setPrevious = setPrevious && !String.IsNullOrEmpty(backUrl);
                    String url = baseUrl + RootObject.PlayFromModule(obj.IdItem, obj.UniqueId, obj.IdVersion, obj.UniqueIdVersion, obj.Type, obj.Link.Id, UserContext.Language.Code, (!dto.SaveObjectStatistics || notSaveStat), dto.RefreshContainerPage, onModalPage, dto.SaveOwnerStatistics, setPrevious, backUrl);

                    actions.Add(new dtoModuleActionControl(url, StandardActionType.Play, !onModalPage)
                    {
                        OnModalPage = onModalPage, RefreshContainerPage = dto.RefreshContainerPage, SaveLinkStatistics = dto.SaveObjectStatistics
                    });
                    if (obj.Type == ItemType.ScormPackage)
                    {
                        actions.Add(new dtoModuleActionControl(baseUrl + RootObject.Statistics(ItemStatisticType.Scorm, obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Link.Id), StandardActionType.ViewAdvancedStatistics, false));
                        actions.Add(new dtoModuleActionControl(baseUrl + RootObject.UserStatistics(ItemStatisticType.Scorm, UserContext.CurrentUserID, obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Link.Id), StandardActionType.ViewUserStatistics, false));
                        actions.Add(new dtoModuleActionControl(baseUrl + RootObject.MyStatistics(ItemStatisticType.Scorm, obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Link.Id), StandardActionType.ViewPersonalStatistics, false));
                    }
                }
                if (obj.Availability == ItemAvailability.available || obj.Availability == ItemAvailability.waitingsettings)
                {
                    switch (obj.Type)
                    {
                    case ItemType.Multimedia:
                        if (obj.Item.IsInternal)
                        {
                            actions.Add(new dtoModuleActionControl(baseUrl + RootObject.EditMultimediaSettings(obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Link.Id), StandardActionType.EditMetadata, false));
                        }
                        else
                        {
                            actions.Add(new dtoModuleActionControl(baseUrl + RootObject.EditMultimediaSettings(obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Item.IdFolder, ""), StandardActionType.EditMetadata, false));
                        }
                        break;

                    default:
                        if (obj.Item.IsInternal)
                        {
                            actions.Add(new dtoModuleActionControl(baseUrl + RootObject.EditScormSettings(obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Link.Id), StandardActionType.EditMetadata, false));
                        }
                        else
                        {
                            actions.Add(new dtoModuleActionControl(baseUrl + RootObject.EditScormSettings(obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.Item.IdFolder, ""), StandardActionType.EditMetadata, false));
                        }
                        break;
                    }
                }
                if (obj.Availability == ItemAvailability.available && obj.IsDownlodable)
                {
                    actions.Add(new dtoModuleActionControl(RootObject.DownloadFromModule(baseUrl, obj.IdItem, obj.Link.DestinationItem.ObjectIdVersion, obj.DisplayName, mode, UserContext.WorkSessionID.ToString(), ((long)idModule), obj.Link.Id, (!dto.SaveObjectStatistics || notSaveStat)), StandardActionType.DownloadItem, true));
                }
                break;

            case ItemType.Folder:
                break;
            }
            return(actions);
        }
예제 #7
0
        private void DisplayDefaultAction(
            liteRepositorySettings settings,
            dtoDisplayObjectRepositoryItem obj,
            dtoObjectRenderInitializer dto,
            DisplayActionMode dAction)
        {
            Int32  idModule   = obj.Link.SourceItem.ServiceID;
            String moduleCode = obj.Link.SourceItem.ServiceCode;

            View.SourceIdModule   = idModule;
            View.SourceModuleCode = moduleCode;
            Int32       idCommunity = obj.Item.IdCommunity;
            Boolean     notSaveStat = (dAction == DisplayActionMode.adminMode);
            DisplayMode mode        = View.OverrideItemDisplayMode;

            if (mode == DisplayMode.none)
            {
                mode = obj.DisplayMode;
            }
            switch (obj.Link.Action)
            {
            case (int)ModuleRepository.ActionType.AddFolder:
            case (int)ModuleRepository.ActionType.AddFile:
            case (int)ModuleRepository.ActionType.AddLink:
            case (int)ModuleRepository.ActionType.AddInternalFile:
                View.DisplayActiveAction(obj.Name, ((ModuleRepository.ActionType)obj.Link.Action));
                break;

            case (int)ModuleRepository.ActionType.DownloadFile:
                switch (obj.Type)
                {
                case ItemType.Link:
                    View.DisplayActiveAction(obj, mode, obj.Url, dto.RefreshContainerPage, false, dto.SaveObjectStatistics, dto.SaveOwnerStatistics);
                    break;

                default:
                    if (obj.Item.IsDownloadable)
                    {
                        View.DisplayActiveAction(
                            obj,
                            mode,
                            RootObject.DownloadFromModule(
                                "",
                                obj.IdItem,
                                obj.IdVersion,
                                obj.DisplayName,
                                mode,
                                UserContext.WorkSessionID.ToString(),
                                ((long)idModule),
                                obj.Link.Id,
                                (!dto.SaveObjectStatistics || notSaveStat)),
                            dto.RefreshContainerPage,
                            false,
                            dto.SaveObjectStatistics,
                            dto.SaveOwnerStatistics);
                    }
                    else
                    {
                        DisplayTextInfo(obj);
                    }
                    break;
                }
                break;

            case (int)ModuleRepository.ActionType.PlayFile:
                String url = "";
                switch (obj.Type)
                {
                case ItemType.Multimedia:
                case ItemType.ScormPackage:
                    Boolean onModalPage = dto.ForceOnModalPage || (mode == DisplayMode.downloadOrPlayOrModal || mode == DisplayMode.inModal);
                    Boolean setPrevious = dto.SetPreviousPage;
                    String  backUrl     = (setPrevious ? View.DestinationUrl : "");
                    setPrevious = setPrevious && !String.IsNullOrEmpty(backUrl);
                    url         = RootObject.PlayFromModule(obj.IdItem, obj.UniqueId, obj.IdVersion, obj.UniqueIdVersion, obj.Type, obj.Link.Id, UserContext.Language.Code, (!dto.SaveObjectStatistics || notSaveStat), dto.RefreshContainerPage, onModalPage, dto.SaveOwnerStatistics, setPrevious, backUrl);

                    View.DisplayActiveAction(obj, mode, url, dto.RefreshContainerPage, onModalPage, dto.SaveObjectStatistics, dto.SaveOwnerStatistics);
                    break;

                case ItemType.Link:
                    View.DisplayActiveAction(obj, mode, obj.Url, dto.RefreshContainerPage, false, dto.SaveObjectStatistics, dto.SaveOwnerStatistics);
                    break;

                default:
                    DisplayTextInfo(obj);
                    break;
                }

                break;
            }
        }
예제 #8
0
        private List <dtoModuleActionControl> AnalyzeModuleLinkItem(liteRepositorySettings settings, dtoDisplayObjectRepositoryItem obj, Boolean getOnlyActions, dtoObjectRenderInitializer dto, DisplayActionMode dAction, StandardActionType actionsToDisplay)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (obj.Link != null)
            {
                View.Availability = obj.Availability;
                Boolean isReadyToPlay = (obj.Availability == ItemAvailability.available || obj.Availability == ItemAvailability.waitingsettings);
                if (!getOnlyActions)
                {
                    if (ValidateActionMode(dAction, DisplayActionMode.text) || ValidateActionMode(dAction, DisplayActionMode.textDefault) || !isReadyToPlay)
                    {
                        View.Display = DisplayActionMode.text;
                        DisplayTextInfo(obj);
                    }
                    else if (ValidateActionMode(dAction, DisplayActionMode.defaultAction) || ValidateActionMode(dAction, DisplayActionMode.adminMode))
                    {
                        DisplayDefaultAction(settings, obj, dto, dAction);
                    }
                }

                if (isReadyToPlay || ValidateActionMode(dAction, DisplayActionMode.adminMode))
                {
                    actions = GenerateActions(settings, obj, dto, dAction);
                }
                if (ValidateActionMode(dAction, DisplayActionMode.actions) && actionsToDisplay != StandardActionType.None)
                {
                    View.DisplayActions(actions.Where(a => ((int)a.ControlType & (int)actionsToDisplay) > 0).ToList());
                }
            }
            return(actions);
        }
예제 #9
0
        private List <dtoModuleActionControl> AnalyzeActions(Boolean getOnlyActions, dtoObjectRenderInitializer dto, DisplayActionMode dAction, StandardActionType actionsToDisplay)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (dto.Link == null || dto.Link.DestinationItem == null)
            {
                if (getOnlyActions)
                {
                    return(new List <dtoModuleActionControl>());
                }
                else
                {
                    View.DisplayEmptyAction();
                }
            }
            else
            {
                if (!getOnlyActions)
                {
                    View.IdRequiredAction = dto.Link.Action;
                    View.Display          = dAction;
                }
                liteRepositoryItem item = (dto.Link.DestinationItem.ObjectLongID == 0 ? null : Service.ItemGet(dto.Link.DestinationItem.ObjectLongID));
                View.ItemType = (item == null ? ItemType.File : item.Type);
                liteRepositoryItemVersion version = null;
                if (dto.Link.DestinationItem.ObjectIdVersion > 0)
                {
                    version = Service.VersionGet(dto.Link.DestinationItem.ObjectIdVersion);
                }
                if (!getOnlyActions && item == null)
                {
                    View.DisplayRemovedObject();
                }
                else if (item != null)
                {
                    liteRepositorySettings         settings = Service.SettingsGetByRepositoryIdentifier(item.Repository);
                    dtoDisplayObjectRepositoryItem obj      = Create(dto.Link, item, version);
                    View.ItemType = obj.Type;
                    if (dto.PlaceHolders.Where(p => !String.IsNullOrEmpty(p.Text)).Any() && (ValidateActionMode(dAction, DisplayActionMode.defaultAction) || ValidateActionMode(dAction, DisplayActionMode.text)))
                    {
                        View.DisplayPlaceHolders(dto.PlaceHolders.Where(p => !String.IsNullOrEmpty(p.Text)).ToList());
                    }
                    actions = AnalyzeModuleLinkItem(settings, obj, getOnlyActions, dto, dAction, actionsToDisplay);
                }
            }
            return(actions);
        }
        public static dtoModuleDisplayActionInitializer Create(dtoExternalModuleInitializer dto, DisplayActionMode display, String containerCSS, lm.Comol.Core.DomainModel.Helpers.IconSize size)
        {
            dtoModuleDisplayActionInitializer item = new dtoModuleDisplayActionInitializer();

            item.ContainerCSS         = containerCSS;
            item.Display              = display;
            item.Link                 = dto.Link;
            item.PlaceHolders         = dto.PlaceHolders;
            item.IconSize             = size;
            item.RefreshContainerPage = dto.RefreshContainerPage;
            item.OpenLinkCssClass     = dto.OpenLinkCssClass;
            item.OnModalPage          = dto.OnModalPage;
            item.SaveLinkStatistics   = dto.SaveLinkStatistics;
            return(item);
        }
예제 #11
0
 private Boolean Display(DisplayActionMode current, DisplayActionMode required)
 {
     return(((long)current & (long)required) > 0);
 }
        private void DisplayDefaultAction(ModuleLink link, liteBaseCommunityFile item, DisplayActionMode display)
        {
            if (typeof(liteCommunityFile) == item.GetType())
            {
                View.ServiceCode = link.DestinationItem.ServiceCode;
                View.ServiceID   = link.DestinationItem.ServiceID;
            }
            else
            {
                View.ServiceCode = link.SourceItem.ServiceCode;
                View.ServiceID   = link.SourceItem.ServiceID;
            }
            int idCommunity = 0;

            if (item.CommunityOwner != null)
            {
                idCommunity = item.CommunityOwner.Id;
            }

            Boolean notSaveStat = (display == DisplayActionMode.adminMode);

            switch (link.Action)
            {
            case (int)CoreModuleRepository.ActionType.CreateFolder:
                View.DisplayCreateFolder(item.Name);
                break;

            case (int)CoreModuleRepository.ActionType.UploadFile:
                View.DisplayUploadFile(item.Name);
                break;

            case (int)CoreModuleRepository.ActionType.DownloadFile:
                View.DisplayItem(item.DisplayName, RootObject.DownloadFileFromModule(item.Id, (long)UserContext.CurrentUserID, UserContext.Language.Code, UserContext.WorkSessionID, View.ServiceID, idCommunity, link.Id, notSaveStat), item.Extension, item.Size, item.RepositoryItemType);
                break;

            case (int)CoreModuleRepository.ActionType.PlayFile:
                View.ServiceCode = link.SourceItem.ServiceCode;
                View.ServiceID   = link.SourceItem.ServiceID;
                String url = "";
                if (typeof(liteModuleInternalFile) == item.GetType())
                {
                    liteModuleInternalFile internalFile = (liteModuleInternalFile)item;
                    url = (internalFile.RepositoryItemType == RepositoryItemType.ScormPackage) ?
                          View.GetUrlForPlayScorm(link.Id, internalFile.Id, internalFile.UniqueID, idCommunity, View.ServiceID, internalFile.ServiceActionAjax, notSaveStat)
                                :
                          View.GetUrlForMultimediaFile() + RootObject.PlayMultimediaFileFromModule(internalFile.Id, internalFile.UniqueID, UserContext.CurrentUserID, UserContext.Language.Code, notSaveStat, View.ServiceID, idCommunity, link.Id, internalFile.ServiceActionAjax, View.PreLoadedContentView);
                }
                else
                {
                    url = (item.RepositoryItemType == RepositoryItemType.ScormPackage) ?
                          View.GetUrlForPlayScorm(link.Id, item.Id, item.UniqueID, idCommunity, link.SourceItem.ServiceID, notSaveStat)
                                :
                          View.GetUrlForMultimediaFile() + RootObject.PlayMultimediaFile(link.Id, item.Id, item.UniqueID, UserContext.CurrentUserID, UserContext.Language.Code, notSaveStat, View.PreLoadedContentView);
                }
                View.DisplayPlayItem(item.Name, url, item.RepositoryItemType);
                break;

            case 0:
                View.DisplayFolder(item.Name);
                break;
            }
        }
        private List <dtoModuleActionControl> AnalyzeModuleLinkItem(ModuleLink link, liteBaseCommunityFile item, DisplayActionMode display, StandardActionType actionsToDisplay)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (item != null)
            {
                Boolean isReadyToPlay = IsReadyToPlay(item);
                View.IsReadyToPlay = isReadyToPlay;
                if (Display(display, DisplayActionMode.text) || Display(display, DisplayActionMode.textDefault) || !isReadyToPlay)
                {
                    View.Display = DisplayActionMode.text;
                    DisplayTextInfo(item, link.Action);
                }
                else if (Display(display, DisplayActionMode.defaultAction) || Display(display, DisplayActionMode.adminMode))
                {
                    DisplayDefaultAction(link, item, display);
                }
                if (isReadyToPlay)
                {
                    actions = GenerateActions(link, item);
                }
                if (Display(display, DisplayActionMode.actions) && actionsToDisplay != StandardActionType.None)
                {
                    View.DisplayActions(actions.Where(a => ((int)a.ControlType & (int)actionsToDisplay) > 0).ToList());
                }
            }
            return(actions);
        }
        private List <dtoModuleActionControl> AnalyzeInternalItem(long idPath, dtoSubActivity item, DisplayActionMode display, StandardActionType actionsToDisplay)
        {
            List <dtoModuleActionControl> actions = new List <dtoModuleActionControl>();

            if (item != null)
            {
                if (Display(display, DisplayActionMode.text))
                {
                    View.DisplayItem(item.Name);
                }
                else if (Display(display, DisplayActionMode.adminMode))
                {
                    View.DisplayItemAdminInfo(item, Service.GetDtoSubactivityActiveLinks(item.Id).Where(sl => sl.Mandatory || sl.Visible).ToList(), Service.GetPath(View.IdPath));
                }
                else if (Display(display, DisplayActionMode.defaultAction))
                {
                    DisplayDefaultAction(idPath, item);
                }
                actions = GenerateActions(item);
                if (Display(display, DisplayActionMode.actions) && actionsToDisplay != StandardActionType.None)
                {
                    View.DisplayActions(actions.Where(a => ((int)a.ControlType & (int)actionsToDisplay) > 0).ToList());
                }
            }
            return(actions);
        }
예제 #15
0
        private void InitializeControl(DisplayActionMode mode, String url, String name = "", DateTime?createdOn = null, Person personCreator = null, litePerson litePersonCreator = null, List <dtoPlaceHolder> placeHolders = null)
        {
            if (String.IsNullOrEmpty(url) && String.IsNullOrEmpty(name))
            {
                View.DisplayEmptyAction();
            }
            else
            {
                if (!String.IsNullOrEmpty(url) && !Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute))
                {
                    if (Uri.IsWellFormedUriString("http://" + url, UriKind.RelativeOrAbsolute))
                    {
                        url = "http://" + url;
                    }
                    else
                    {
                        url = "";
                    }
                }
                else
                {
                    try
                    {
                        var uri = new Uri(url);
                    }
                    catch (Exception ex) {
                        url = "http://" + url;
                    }
                }


                String username = "";
                String surname  = "";
                if (View.DisplayCreateInfo)
                {
                    if (litePersonCreator == null && personCreator == null)
                    {
                        surname = View.GetRemovedUser;
                    }
                    else if (litePersonCreator != null)
                    {
                        if (litePersonCreator != null && litePersonCreator.TypeID != (int)UserTypeStandard.Guest)
                        {
                            username = litePersonCreator.Name;
                            surname  = litePersonCreator.Surname;
                        }
                        else
                        {
                            surname = View.GetUnknownUser;
                        }
                    }
                    else if (personCreator != null && personCreator.TypeID != (int)UserTypeStandard.Guest)
                    {
                        username = personCreator.Name;
                        surname  = personCreator.Surname;
                    }
                    else
                    {
                        surname = View.GetUnknownUser;
                    }
                }
                if (String.IsNullOrEmpty(name))
                {
                    name = url;
                }

                if (String.IsNullOrEmpty(url))
                {
                    mode = DisplayActionMode.text;
                    View.DisplayItem(name, createdOn, username, surname);
                }
                else
                {
                    View.DisplayItem(name, url, createdOn, username, surname);
                }
                if (placeHolders != null && placeHolders.Where(p => !String.IsNullOrEmpty(p.Text)).Any() && (Display(mode, DisplayActionMode.defaultAction) || Display(mode, DisplayActionMode.text)))
                {
                    View.DisplayPlaceHolders(placeHolders.Where(p => !String.IsNullOrEmpty(p.Text)).ToList());
                }
            }
        }
예제 #16
0
 public void InitViewLite(DisplayActionMode mode, String url, String name = "", DateTime?createdOn = null, litePerson createdBy = null, List <dtoPlaceHolder> placeHolders = null)
 {
     InitializeControl(mode, url, name, createdOn, null, createdBy, placeHolders);
 }