Added display of supported cultures

This commit is contained in:
Rick Falkvinge
2019-01-24 17:52:40 +01:00
parent 0e6d490b38
commit 2ff3494877
7 changed files with 244 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeBehind="CultureInfo.aspx.cs" CodeFile="CultureInfo.aspx.cs" Inherits="Swarmops.Frontend.Admin.CultureInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" runat="server">
<script type="text/javascript">
function preload(arrayOfImages) {
$(arrayOfImages).each(function () {
(new Image()).src = this;
});
}
preload([
'/Images/Abstract/ajaxloader-medium.gif',
'/Images/Abstract/ajaxloader-48x36px.gif',
'/Images/Icons/iconshock-balloon-yes-128x96px-hot.png',
'/Images/Icons/iconshock-balloon-yes-128x96px-disabled.png',
'/Images/Icons/iconshock-balloon-yes-128x96px-hot-disabled.png',
'/Images/Icons/iconshock-balloon-yes-128x96px-gold.png',
'/Images/Icons/iconshock-balloon-yes-128x96px-hot-gold.png',
'/Images/Icons/iconshock-balloon-no-128x96px-hot.png',
'/Images/Icons/iconshock-green-tick-128x96px.png',
'/Images/Icons/iconshock-red-cross-128x96px.png',
'/Images/Icons/iconshock-red-cross-circled-128x96px.png',
'/Images/Icons/iconshock-balloon-undo-128x96px.png',
'/Images/Icons/iconshock-balloon-undo-128x96px-hot.png'
]);
/* -- commented out -- do we need attestation logic for this page?
loadUninitializedBudgets(); // no need to wait for doc.ready to load operating params
SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetRemainingBudgets", {}, function(data) {
data.forEach(function(accountData, dummy1, dummy2) {
budgetRemainingLookup[accountData.AccountId] = accountData.Remaining;
});
if (budgetRemainingLookup.rowsLoaded == true) {
setAttestability();
}
budgetRemainingLookup.budgetsLoaded = true;
});*/
// Doc.ready:
$(document).ready(function() {
$('#tableSupportedCultures').datagrid(
{
onLoadSuccess: function() {
}
}
);
});
</script>
<style type="text/css">
.datagrid-row-selected,.datagrid-row-over{
background:transparent;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<h2>Supported and Installed Cultures</h2>
<table id="tableCultures" title="" class="easyui-datagrid" style="width:680px"
url="Json-CultureInfo.aspx"
rownumbers="false"
animate="true"
fitColumns="true"
idField="cultureId">
<thead>
<tr>
<th field="cultureId" width="80">ID</th>
<th field="name" width="178">Culture Native</th>
<th field="nameInternational" width="160">International</th>
<th field="language" width="120">Language</th>
<th field="country" width="120">Country</th>
<th field="flag" width="40" align="center">Flag</th>
<th field="supported" width="40" align="center">Sup</th>
</tr>
</thead>
</table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" runat="server">
</asp:Content>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swarmops.Frontend.Admin
{
public partial class CultureInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Swarmops.Frontend.Admin {
public partial class CultureInfo {
}
}
+16
View File
@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Json-CultureInfo.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.Json_CultureInfo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swarmops.Frontend.Pages.v5.Admin
{
public partial class Json_CultureInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "application/json";
string json = AllCulturesAsJson();
Response.Output.WriteLine(json);
Response.End();
}
private static string AllCulturesAsJson()
{
StringBuilder result = new StringBuilder(16384);
result.Append("{\"rows\":[");
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
foreach (CultureInfo culture in cultures)
{
RegionInfo region = null;
try
{
region = new RegionInfo(culture.Name);
result.Append("{");
result.AppendFormat(
"\"culture\":\"{0}\",\"name\":\"{1}\",\"nameInternational\":\"{2}\",\"language\":\"{3}\",\"country\":\"{4}\",\"flag\":\"{5}\",\"supported\":\"{6}\"",
culture.Name,
culture.NativeName,
culture.EnglishName,
"Language",
region.EnglishName,
"Fl",
"Sp"
);
result.Append("},");
}
catch
{
continue;
}
}
result.Remove(result.Length - 1, 1); // remove last comma
result.Append("]}");
return result.ToString();
}
}
}
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Swarmops.Frontend.Pages.v5.Admin
{
public partial class Json_CultureInfo
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
}
}
+16
View File
@@ -682,6 +682,13 @@
<Compile Include="Pages\v5\Admin\CommenceImpersonation.aspx.designer.cs">
<DependentUpon>CommenceImpersonation.aspx</DependentUpon>
</Compile>
<Compile Include="Pages\v5\Admin\CultureInfo.aspx.cs">
<DependentUpon>CultureInfo.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\v5\Admin\CultureInfo.aspx.designer.cs">
<DependentUpon>CultureInfo.aspx</DependentUpon>
</Compile>
<Compile Include="Pages\v5\Admin\Diagnostics.aspx.cs">
<DependentUpon>Diagnostics.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -724,6 +731,13 @@
<Compile Include="Pages\v5\Admin\Hacks\TemporaryHack.aspx.designer.cs">
<DependentUpon>TemporaryHack.aspx</DependentUpon>
</Compile>
<Compile Include="Pages\v5\Admin\Json-CultureInfo.aspx.cs">
<DependentUpon>Json-CultureInfo.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\v5\Admin\Json-CultureInfo.aspx.designer.cs">
<DependentUpon>Json-CultureInfo.aspx</DependentUpon>
</Compile>
<Compile Include="Pages\v5\Admin\OrgSettings.aspx.cs">
<DependentUpon>OrgSettings.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1690,12 +1704,14 @@
<Content Include="Pages\v5\Admin\BitcoinEchoTest.aspx" />
<Content Include="Pages\v5\Admin\CreateOrganization.aspx" />
<Content Include="Pages\v5\Admin\CommenceImpersonation.aspx" />
<Content Include="Pages\v5\Admin\CultureInfo.aspx" />
<Content Include="Pages\v5\Admin\Diagnostics.aspx" />
<Content Include="Pages\v5\Admin\Hacks\PopulateCountry1.aspx" />
<Content Include="Pages\v5\Admin\Hacks\PopulateCountry2.aspx" />
<Content Include="Pages\v5\Admin\Hacks\PopulateFakePeople.aspx" />
<Content Include="Pages\v5\Admin\Hacks\Temp-SetOrganizationAdminAccess.aspx" />
<Content Include="Pages\v5\Admin\Hacks\TemporaryHack.aspx" />
<Content Include="Pages\v5\Admin\Json-CultureInfo.aspx" />
<Content Include="Pages\v5\Admin\OrgSettings.aspx" />
<Content Include="Pages\v5\Admin\OrgStaffing.aspx" />
<Content Include="Pages\v5\Admin\SystemSettings.aspx" />