示例#1
0
        public EGCVersionsDTO GetVersionInfo()
        {
            try
            {
                return(CacheUtility.GetCachedItem <EGCVersionsDTO>(Cache, CachePolicies.Keys.VersionInfo(), () =>
                {
                    string @base = string.Empty;
                    DirectoryInfo parent;
                    if ((parent = Directory.GetParent(HttpContext.Current.Server.MapPath("~"))) != null)
                    {
                        @base = parent.FullName;
                        if (parent.EnumerateDirectories("EdugameCloud.Web").Any())
                        {
                            @base = Path.Combine(@base, "EdugameCloud.Web");
                        }
                    }

                    var adminPath = @base + @"\Content\swf\admin";
                    var publicPath = @base + @"\Content\swf\pub";
                    var admin = this.ProcessVersion(adminPath, (string)this.Settings.BuildSelector);
                    var @public = this.ProcessVersion(publicPath, (string)this.Settings.PublicBuildSelector);
                    return new EGCVersionsDTO
                    {
                        adminVersion = admin.Return(x => new VersionDTO(admin), null),
                        publicVersion = @public.Return(x => new VersionDTO(@public), null),
                    };
                }));
            }
            catch (Exception ex)
            {
                Logger.Error("Lookup.GetVersionInfo", ex);
                throw;
            }
        }
示例#2
0
 public virtual ActionResult Admin(string view = null, string code = null, string __provider__ = null, string __sid__ = null, string state = null, string providerKey = null)
 {
     if (__provider__ == "canvas" &&
         !string.IsNullOrWhiteSpace(__sid__) &&
         !string.IsNullOrWhiteSpace(code) &&
         !string.IsNullOrWhiteSpace(state))
     {
         //// crazy hack for canvas OAuth callback ??!!
         return(RedirectToAction("callback", "Lti", new { __provider__, __sid__, code, state, providerKey }));
     }
     else
     {
         var filePattern = (string)Settings.BuildSelector;
         var path        = Server.MapPath("~/Content/swf/admin");
         var version     = CacheUtility.GetCachedItem(Cache, CachePolicies.Keys.VersionFileName(filePattern), () =>
                                                      _versionProcessor.ProcessVersion(path, filePattern));
         var versionFileSwf = filePattern.Replace("*", version.ToString());
         return(View(
                    EdugameCloudT4.Home.Views.Admin,
                    new HomeViewModel(this)
         {
             BuildUrl = Links.Content.swf.admin.Url(versionFileSwf)
         }));
     }
 }
示例#3
0
        // TRICK: use from LTI ONLY!!
        public bool IsActive(int companyId)
        {
            var item = CacheUtility.GetCachedItem <CompanyCacheItem>(_cache, CachePolicies.Keys.IsActiveCompany(companyId), CachePolicies.Dependencies.IsActiveCompany(companyId), () =>
            {
                var company         = GetOneById(companyId).Value;
                DateTime?expiryDate = null;
                if (company.CurrentLicense != null)
                {
                    expiryDate = company.CurrentLicense.ExpiryDate.ToUniversalTime();
                }

                var result = new CompanyCacheItem
                {
                    CompanyId = company.Id,
                    IsActive  = company.Status == CompanyStatus.Active,
                    CurrentLicenseExpiryDateUtc = expiryDate,
                };

                return(result);
            });

            return(item.IsActive &&
                   item.CurrentLicenseExpiryDateUtc.HasValue &&
                   item.CurrentLicenseExpiryDateUtc.Value > DateTime.UtcNow);
        }
示例#4
0
 public override IEnumerable <TimeZone> GetAll()
 {
     return(CacheUtility.GetCachedItem <List <TimeZone> >(_cache, CachePolicies.Keys.TimeZones(), () =>
     {
         var query = new DefaultQueryOver <TimeZone, int>().GetQueryOver().OrderBy(x => x.TimeZoneName).Asc;
         return this.Repository.FindAll(query).ToList();
     }));
 }
示例#5
0
 public override IEnumerable <LmsQuestionType> GetAll()
 {
     return(CacheUtility.GetCachedItem(_cache, CachePolicies.Keys.LmsQuestionTypes(), () =>
     {
         var query = new DefaultQueryOver <LmsQuestionType, int>().GetQueryOver();
         return this.Repository.FindAll(query).ToList();
     }));
 }
示例#6
0
 public override IEnumerable <SNMapProvider> GetAll()
 {
     return(CacheUtility.GetCachedItem <List <SNMapProvider> >(_cache, CachePolicies.Keys.SNMapProviders(), () =>
     {
         var query = new DefaultQueryOver <SNMapProvider, int>().GetQueryOver().OrderBy(x => x.MapProvider).Asc;
         return this.Repository.FindAll(query).ToList();
     }));
 }
示例#7
0
 // TRICK: uses cache!
 public override IEnumerable <LmsProvider> GetAll()
 {
     return(CacheUtility.GetCachedItem <List <LmsProvider> >(_cache, CachePolicies.Keys.LmsProviders(), () =>
     {
         var queryOver = new DefaultQueryOver <LmsProvider, int>().GetQueryOver();
         return Repository.FindAll(queryOver).ToList();
     }));
 }
示例#8
0
        public IEnumerable <TemplateDto> GetCachedTemplates(IAdobeConnectProxy api, ICache cache, Func <string> cacheKeyFactory, ScoShortcutType scoShortcut)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            var item = CacheUtility.GetCachedItem <IEnumerable <TemplateDto> >(cache, cacheKeyFactory(),
                                                                               () => GetShortcutContentsFromApi(api, scoShortcut.GetACEnum()));

            return(item);
        }
示例#9
0
        public ACDetailsDTO GetAccountDetails(IAdobeConnectProxy provider, ICache cache)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            var item = CacheUtility.GetCachedItem <ACDetailsDTO>(cache, CachePolicies.Keys.AcDetails(provider.AdobeConnectRoot.ToString()), () =>
            {
                return(IoC.Resolve <Esynctraining.AdobeConnect.IAdobeConnectAccountService>().GetAccountDetails(provider));
            });

            return(item);
        }
示例#10
0
        public static LicenseSettingsDto Build(LmsCompany value, Language lmsLicenseLanguage, ICache cache)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }

            return(CacheUtility.GetCachedItem <LicenseSettingsDto>(cache,
                                                                   CachePolicies.Keys.CompanyLmsSettings(value.Id),
                                                                   CachePolicies.Dependencies.CompanyLmsSettings(value.Id),
                                                                   () =>
            {
                return new LicenseSettingsDto
                {
                    IsSettingsVisible = value.IsSettingsVisible.GetValueOrDefault(),
                    IsLmsHelpVisible = value.ShowLmsHelp.GetValueOrDefault(),
                    IsEgcHelpVisible = value.ShowEGCHelp.GetValueOrDefault(),

                    CanEditMeeting = value.CanEditMeeting.GetValueOrDefault(),
                    CanRemoveMeeting = value.CanRemoveMeeting.GetValueOrDefault(),
                    CanStudentCreateStudyGroup = value.GetSetting <bool>(LmsLicenseSettingNames.CanStudentCreateStudyGroup, true),

                    ACUsesEmailAsLogin = value.ACUsesEmailAsLogin ?? false,
                    UseSynchronizedUsers = value.UseSynchronizedUsers,
                    UseFLV = value.UseFLV,
                    UseMP4 = value.UseMP4,
                    EnableMultipleMeetings = value.EnableMultipleMeetings,
                    UseSakaiEvents = value.GetSetting <bool>(LmsLicenseSettingNames.UseSakaiEvents),
                    EnableMeetingSessions = value.GetSetting <bool>(LmsLicenseSettingNames.EnableMeetingSessions),
                    SupportPageHtml = value.GetSetting <string>(LmsLicenseSettingNames.SupportPageHtml),

                    EnableMeetingReuse = value.EnableMeetingReuse,

                    EnableSeminars = value.GetSetting <bool>(LmsLicenseSettingNames.SeminarsEnable),
                    EnableOfficeHours = value.EnableOfficeHours.GetValueOrDefault(),
                    EnableVirtualClassrooms = value.GetSetting <bool>(LmsLicenseSettingNames.EnableVirtualClassrooms),
                    EnableMyContent = value.GetSetting <bool>(LmsLicenseSettingNames.EnableMyContent),
                    EnableAddGuest = value.GetSetting <bool>(LmsLicenseSettingNames.EnableAddGuest, true),
                    EnableSetUserRole = value.GetSetting <bool>(LmsLicenseSettingNames.EnableSetUserRole, true),
                    EnableRemoveUser = value.GetSetting <bool>(LmsLicenseSettingNames.EnableRemoveUser, true),

                    ShowMeetingSummary = value.GetSetting <bool>(LmsLicenseSettingNames.ShowMeetingSummary),
                    ShowMeetingTime = value.GetSetting <bool>(LmsLicenseSettingNames.ShowMeetingTime),
                    ShowMeetingDuration = value.GetSetting <bool>(LmsLicenseSettingNames.ShowMeetingDuration),

                    CanRemoveRecordings = value.CanRemoveRecordings,
                    AutoPublishRecordings = value.AutoPublishRecordings,
                    Language = lmsLicenseLanguage.TwoLetterCode,

                    HasMp4ServiceLicenseKey = !string.IsNullOrWhiteSpace(value.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceLicenseKey)),
                    HasMp4ServiceWithSubtitlesLicenseKey = !string.IsNullOrWhiteSpace(value.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey)),

                    ShowAudioProfile = value.GetSetting <bool>(LmsLicenseSettingNames.ShowAudioProfile),
                    UseCourseSections = value.GetSetting <bool>(LmsLicenseSettingNames.UseCourseSections),
                    UseCourseMeetingsCustomLayout = value.GetSetting <bool>(LmsLicenseSettingNames.UseCourseMeetingsCustomLayout),
                    EnableOfficeHoursSlots = value.GetSetting <bool>(LmsLicenseSettingNames.EnableOfficeHoursSlots),

                    Labels = new LabelsDto
                    {
                        MeetingLabel = value.GetSetting <string>(LmsLicenseSettingNames.LabelMeeting) ?? "Course Meetings",
                        OfficeHourLabel = value.GetSetting <string>(LmsLicenseSettingNames.LabelOfficeHour) ?? "Office Hours",
                        StudyGroupLabel = value.GetSetting <string>(LmsLicenseSettingNames.LabelStudyGroup) ?? "Study Groups",
                        SeminarLabel = value.GetSetting <string>(LmsLicenseSettingNames.SeminarsLabel) ?? "Seminar Rooms",
                        VirtualClassroom = value.GetSetting <string>(LmsLicenseSettingNames.VirtualClassroomsLabel) ?? "Virtual Classrooms",
                    },

                    Telephony = new TelephonyDto
                    {
                        ActiveProfile = value.GetSetting <string>(LmsLicenseSettingNames.Telephony.ActiveProfile)?.ToUpper(),
                        // See TelephonyProfileOption enum
                        CourseMeetingOption = value.GetSetting <int>(LmsLicenseSettingNames.Telephony.CourseMeetingOption),
                        OfficeHoursOption = value.GetSetting <int>(LmsLicenseSettingNames.Telephony.OfficeHoursOption),
                        StudyGroupOption = value.GetSetting <int>(LmsLicenseSettingNames.Telephony.StudyGroupOption),
                    }
                };
            }));
        }