|
1 | 1 | @inherits LanguagePackManagerWebPage |
2 | | -@using Connect.LanguagePackManager.Presentation.Common |
| 2 | +@using Connect.LanguagePackManager.Core.Common; |
| 3 | +@using Connect.LanguagePackManager.Core.Repositories; |
| 4 | +@using Connect.LanguagePackManager.Presentation.Common; |
| 5 | +@using System.Linq; |
3 | 6 | @{ |
| 7 | + LanguagePackManagerModuleContext.AddModuleScript(); |
| 8 | + var knownGenericLocales = LocaleRepository.Instance.GetLocales().Where(l => l.Code.Length == 2).Select(l => l.Code).ToList(); |
| 9 | + var locales = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.SpecificCultures) |
| 10 | + .Where(l => knownGenericLocales.Contains(l.TwoLetterISOLanguageName)) |
| 11 | + .Select(l => new { Key = l.Name, Value = l.ParseRegion() }); |
| 12 | + var genlocales = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures) |
| 13 | + .Where(l => knownGenericLocales.Contains(l.TwoLetterISOLanguageName)) |
| 14 | + .Select(l => new { Key = l.Name, Value = l.EnglishName }); |
| 15 | + var packageList = PackageVersionRepository.Instance.GetPackageVersions(Dnn.ModuleContext.ModuleId) |
| 16 | + .Where(p => p.ContainedInPackageVersionId == null) |
| 17 | + .Select(p => new { Key = p.PackageId, Value = p.FriendlyName }) |
| 18 | + .Distinct() |
| 19 | + .OrderBy(p => p.Value); |
4 | 20 | } |
5 | 21 |
|
6 | | -<h1>LanguagePack Manager</h1> |
| 22 | +<h1>@Dnn.LocalizeString("LanguagePacks")</h1> |
| 23 | + |
| 24 | +<div class="connectlpm packs" |
| 25 | + data-locale="@System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName" |
| 26 | + data-moduleid="@Dnn.ActiveModule.ModuleID" |
| 27 | + data-tabid="@Dnn.ActiveModule.TabID" |
| 28 | + data-portalid="@Dnn.PortalSettings.PortalId" |
| 29 | + data-resources="@SerializedResources()" |
| 30 | + data-security="@(Newtonsoft.Json.JsonConvert.SerializeObject(LanguagePackManagerModuleContext.Security))" |
| 31 | + data-genlocales="@(Newtonsoft.Json.JsonConvert.SerializeObject(genlocales))" |
| 32 | + data-locales="@(Newtonsoft.Json.JsonConvert.SerializeObject(locales))" |
| 33 | + data-packages="@(Newtonsoft.Json.JsonConvert.SerializeObject(packageList))"> |
| 34 | +</div> |
7 | 35 |
|
8 | 36 | <div> |
9 | | - <a href="@Url.Action("Index", "Links")" class="dnnSecondaryAction">@Dnn.LocalizeString("Links")</a> |
10 | | - <a href="@Url.Action("Upload", "Packs")" class="dnnSecondaryAction">@Dnn.LocalizeString("Upload")</a> |
11 | | - <a href="@Url.Action("Index", "Packs")" class="dnnSecondaryAction">@Dnn.LocalizeString("Packs")</a> |
| 37 | + @if (LanguagePackManagerModuleContext.Security.CanEdit) |
| 38 | + { |
| 39 | + <a href="@Url.Action("Index", "Links")" class="dnnSecondaryAction">@Dnn.LocalizeString("Links")</a> |
| 40 | + } |
| 41 | + @if (LanguagePackManagerModuleContext.Security.IsTranslator) |
| 42 | + { |
| 43 | + <a href="@Url.Action("Upload", "Packs")" class="dnnSecondaryAction">@Dnn.LocalizeString("Upload")</a> |
| 44 | + } |
12 | 45 | </div> |
0 commit comments