Added WebSocket library (MIT license)

This commit is contained in:
Rick Falkvinge
2015-03-26 03:44:52 +01:00
parent 1f28b8bbfd
commit ee5b6577e8
15 changed files with 148 additions and 25 deletions
+11 -2
View File
@@ -1,3 +1,12 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Tpl.Dataflow" version="4.5.9" targetFramework="net45" />
<package id="vtortola.WebSocketListener" version="2.1.5.0" targetFramework="net45" />
</packages>
+11 -2
View File
@@ -1,3 +1,12 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Tpl.Dataflow" version="4.5.9" targetFramework="net45" />
<package id="vtortola.WebSocketListener" version="2.1.5.0" targetFramework="net45" />
</packages>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Tpl.Dataflow" version="4.5.9" targetFramework="net45" />
<package id="vtortola.WebSocketListener" version="2.1.5.0" targetFramework="net45" />
</packages>
@@ -174,7 +174,7 @@
<comment>When somebody undoes a previous attestation.</comment>
</data>
<data name="AttestCosts_OutOfBudget" xml:space="preserve">
<value>There is not enough funds in the budget to attest this cost.</value>
<value>There are not enough funds remaining in the budget to attest this cost.</value>
</data>
<data name="AttestCosts_PageTitle" xml:space="preserve">
<value>Attest Costs</value>
Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

+11
View File
@@ -17,6 +17,7 @@
preload([
'/Images/Abstract/ajaxloader-medium.gif',
'/Images/Icons/iconshock-balloon-yes-16px-hot.png',
'/Images/Icons/iconshock-balloon-yes-16px-disabled.png',
'/Images/Icons/iconshock-balloon-no-16px-hot.png',
'/Images/Icons/iconshock-greentick-16px.png',
'/Images/Icons/iconshock-redcross-16px.png',
@@ -139,8 +140,18 @@
}
}
);
// we're still in document.ready
SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetRemainingBudgets", {}, function(data) {
data.forEach(function(accountData, dummy1, dummy2) {
budgetRemainingLookup[accountData.AccountId] = accountData.Remaining;
});
});
});
var budgetRemainingLookup = {};
</script>
<style type="text/css">
+28 -3
View File
@@ -48,18 +48,20 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
private Dictionary<int, bool> GetAttestationRights()
static private Dictionary<int, bool> GetAttestationRights()
{
AuthenticationData authData = GetAuthenticationDataAndCulture();
// Right now, this function is quite primitive. At some point in the future, it needs to take into
// account that a budget may have several attesters. Right now, it just loops over all accounts and
// checks the owner.
Dictionary<int, bool> result = new Dictionary<int, bool>();
FinancialAccounts accounts = FinancialAccounts.ForOrganization (CurrentOrganization);
FinancialAccounts accounts = FinancialAccounts.ForOrganization (authData.CurrentOrganization);
foreach (FinancialAccount account in accounts)
{
if (account.OwnerPersonId == CurrentUser.Identity)
if (account.OwnerPersonId == authData.CurrentUser.Identity)
{
result[account.Identity] = true;
}
@@ -82,6 +84,29 @@ namespace Swarmops.Frontend.Pages.v5.Financial
this.LabelGridHeaderRequested.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Requested;
}
[WebMethod]
public static BudgetRemainder[] GetRemainingBudgets()
{
Dictionary<int, bool> accountLookup = GetAttestationRights();
List<BudgetRemainder> result = new List<BudgetRemainder>();
int currentYear = DateTime.UtcNow.Year;
foreach (int accountId in accountLookup.Keys)
{
result.Add (new BudgetRemainder { AccountId = accountId, Remaining = FinancialAccount.FromIdentity (accountId).GetBudgetCents (currentYear)/100.0 });
}
return result.ToArray();
}
public class BudgetRemainder
{
public int AccountId { get; set; }
public double Remaining { get; set; }
}
[WebMethod]
public static string Attest (string identifier)
{
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Tpl.Dataflow" version="4.5.9" targetFramework="net45" />
<package id="vtortola.WebSocketListener" version="2.1.5.0" targetFramework="net45" />
</packages>
+25 -17
View File
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
@@ -14,45 +14,53 @@
</system.Web>
-->
<system.web>
<machineKey configSource="machineKey.config"/>
<compilation debug="true" batch="false" targetFramework="4.5"/>
<customErrors mode="Off"/>
<httpRuntime maxRequestLength="40960" executionTimeout="180" targetFramework="4.5"/>
<machineKey configSource="machineKey.config" />
<compilation debug="true" batch="false" targetFramework="4.5" />
<customErrors mode="Off" />
<httpRuntime maxRequestLength="40960" executionTimeout="180" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Security/Login" name=".ActzAuth" path="/" protection="All" timeout="600" defaultUrl="/" cookieless="UseDeviceProfile"/>
<forms loginUrl="~/Security/Login" name=".ActzAuth" path="/" protection="All" timeout="600" defaultUrl="/" cookieless="UseDeviceProfile" />
</authentication>
<authorization>
<deny users="?"/>
<deny users="?" />
</authorization>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID" />
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
<jsonSerialization maxJsonLength="50000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.2.2.0, Culture=neutral"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.2.2.0, Culture=neutral" />
</DbProviderFactories>
</system.data>
<appSettings>
<add key="aspnet:UseLegacyEncryption" value="true"/>
<add key="aspnet:UseLegacyMachineKeyEncryption" value="true"/>
<add key="aspnet:UseLegacyFormsAuthenticationTicketCompatibility" value="true"/>
<add key="MonoServerDefaultIndexFiles" value="/"/>
<add key="aspnet:UseLegacyEncryption" value="true" />
<add key="aspnet:UseLegacyMachineKeyEncryption" value="true" />
<add key="aspnet:UseLegacyFormsAuthenticationTicketCompatibility" value="true" />
<add key="MonoServerDefaultIndexFiles" value="/" />
</appSettings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ChartImage_axd"/>
<remove name="ChartImage_axd" />
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="41943040"/>
<requestLimits maxAllowedContentLength="41943040" />
</requestFiltering>
</security>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.9.0" newVersion="4.5.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\Backend\packages.config" />
<repository path="..\Interface\packages.config" />
<repository path="..\Logic\packages.config" />
<repository path="..\Site5\packages.config" />
<repository path="..\Tests\packages.config" />
</repositories>