Merge branch 'master' of https://github.com/Swarmops/Swarmops
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
/// <summary>
|
||||
/// Value Added Tax (inbound) that hasn't been declared yet and put on overall tax balance
|
||||
/// </summary>
|
||||
AssetsVat,
|
||||
AssetsVatInbound,
|
||||
/// <summary>
|
||||
/// If virtual banking is enabled, this is where the virtual assets go
|
||||
/// </summary>
|
||||
@@ -61,7 +61,7 @@
|
||||
/// <summary>
|
||||
/// Undeclared Value Added Tax (outbound) before putting it on tax balance
|
||||
/// </summary>
|
||||
DebtsVat,
|
||||
DebtsVatOutbound,
|
||||
/// <summary>
|
||||
/// If virtual banking is enabled, this is the central debt to local assets
|
||||
/// </summary>
|
||||
|
||||
+2
-2
@@ -534,7 +534,7 @@ namespace Swarmops
|
||||
|
||||
//PirateWeb.Utility.Special.Sweden.SupportDatabase.CloseDelayWarnings();
|
||||
|
||||
NewsletterChecker.Run();
|
||||
// NewsletterChecker.Run();
|
||||
}
|
||||
|
||||
|
||||
@@ -1155,7 +1155,7 @@ namespace Swarmops
|
||||
|
||||
private static void RunForumCheck()
|
||||
{
|
||||
SwedishForumMemberCheck.Run();
|
||||
// SwedishForumMemberCheck.Run();
|
||||
}
|
||||
|
||||
private static void RunRepaidTest()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
@@ -59,7 +59,6 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
|
||||
@@ -5,7 +5,7 @@ git submodule update
|
||||
git submodule foreach git checkout master
|
||||
git submodule foreach git pull
|
||||
|
||||
msbuild /p:Configuration=Release;TargetFrameworkVersion=v4.5 /t:Clean;Build NBitcoin\NBitcoin\NBitcoin.csproj
|
||||
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild /p:Configuration=Release;TargetFrameworkVersion=v4.5 /t:Clean;Build NBitcoin\NBitcoin\NBitcoin.csproj
|
||||
|
||||
if exist bin erase /s /q bin > nul
|
||||
if not exist bin mkdir bin
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Swarmops.Basic.Types;
|
||||
using Swarmops.Database;
|
||||
|
||||
@@ -37,5 +38,18 @@ namespace Swarmops.Logic.Financial
|
||||
return FromIdentityAggressive(
|
||||
SwarmDb.GetDatabaseForWriting().CreateCurrency(code, name, sign));
|
||||
}
|
||||
|
||||
public string DisplayCode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.Code == "BTC")
|
||||
{
|
||||
return "µBTC";
|
||||
}
|
||||
|
||||
return base.Code;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,13 @@ namespace Swarmops.Logic.Financial
|
||||
SwarmDb.GetDatabaseForWriting().SetFinancialAccountBudgetMonthly(this.Identity, year, month, amountCents);
|
||||
}
|
||||
|
||||
public static FinancialAccount Create (int organizationId, string name, FinancialAccountType accountType, int parentFinancialAccountId)
|
||||
public static FinancialAccount Create(Organization organization, string newAccountName,
|
||||
FinancialAccountType accountType, FinancialAccount parentAccount)
|
||||
{
|
||||
return Create(organization.Identity, newAccountName, accountType, parentAccount == null? 0: parentAccount.Identity);
|
||||
}
|
||||
|
||||
protected static FinancialAccount Create (int organizationId, string name, FinancialAccountType accountType, int parentFinancialAccountId)
|
||||
{
|
||||
int accountId = SwarmDb.GetDatabaseForWriting().CreateFinancialAccount(organizationId, name, accountType, parentFinancialAccountId);
|
||||
return FromIdentityAggressive(accountId);
|
||||
|
||||
@@ -97,6 +97,18 @@ namespace Swarmops.Logic.Financial
|
||||
get { return this[OrganizationFinancialAccountType.AssetsBankAccountMain]; }
|
||||
}
|
||||
|
||||
public FinancialAccount AssetsBitcoinCold
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.AssetsBitcoinCold]; }
|
||||
set { this[OrganizationFinancialAccountType.AssetsBitcoinCold] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount AssetsBitcoinHot
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.AssetsBitcoinHot]; }
|
||||
set { this[OrganizationFinancialAccountType.AssetsBitcoinHot] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount AssetsOutboundInvoices
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.AssetsOutboundInvoices]; }
|
||||
@@ -110,11 +122,13 @@ namespace Swarmops.Logic.Financial
|
||||
public FinancialAccount AssetsPaypal
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.AssetsPaypal]; }
|
||||
set { this[OrganizationFinancialAccountType.AssetsPaypal] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount AssetsVat
|
||||
public FinancialAccount AssetsVatInbound
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.AssetsVat]; }
|
||||
get { return this[OrganizationFinancialAccountType.AssetsVatInbound]; }
|
||||
set { this[OrganizationFinancialAccountType.AssetsVatInbound] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount CostsBankFees
|
||||
@@ -127,6 +141,12 @@ namespace Swarmops.Logic.Financial
|
||||
get { return this[OrganizationFinancialAccountType.CostsAllocatedFunds]; }
|
||||
}
|
||||
|
||||
public FinancialAccount CostsCurrencyFluctuations
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.CostsCurrencyFluctuations]; }
|
||||
set { this[OrganizationFinancialAccountType.CostsCurrencyFluctuations] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount CostsInfrastructure
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.CostsInfrastructure]; }
|
||||
@@ -167,9 +187,10 @@ namespace Swarmops.Logic.Financial
|
||||
get { return this[OrganizationFinancialAccountType.DebtsTax]; }
|
||||
}
|
||||
|
||||
public FinancialAccount DebtsVat
|
||||
public FinancialAccount DebtsVatOutbound
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.DebtsVat]; }
|
||||
get { return this[OrganizationFinancialAccountType.DebtsVatOutbound]; }
|
||||
set { this[OrganizationFinancialAccountType.DebtsVatOutbound] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount DebtsEarmarkedVirtualBanking
|
||||
@@ -187,6 +208,12 @@ namespace Swarmops.Logic.Financial
|
||||
get { return this[OrganizationFinancialAccountType.DebtsSalary]; }
|
||||
}
|
||||
|
||||
public FinancialAccount IncomeCurrencyFluctuations
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.IncomeCurrencyFluctuations]; }
|
||||
set { this[OrganizationFinancialAccountType.IncomeCurrencyFluctuations] = value; }
|
||||
}
|
||||
|
||||
public FinancialAccount IncomeDonations
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.IncomeDonations]; }
|
||||
@@ -197,7 +224,7 @@ namespace Swarmops.Logic.Financial
|
||||
get { return this[OrganizationFinancialAccountType.IncomeSales]; }
|
||||
}
|
||||
|
||||
public FinancialAccount ConstsMiscalculations
|
||||
public FinancialAccount CostsMiscalculations
|
||||
{
|
||||
get { return this[OrganizationFinancialAccountType.CostsMiscalculations]; }
|
||||
}
|
||||
|
||||
@@ -214,60 +214,60 @@ namespace Swarmops.Logic.Structure
|
||||
// TODO: Set names according to org default culture
|
||||
|
||||
FinancialAccounts[OrganizationFinancialAccountType.AssetsBankAccountMain] =
|
||||
FinancialAccount.Create(this.Identity, "Bank Account", FinancialAccountType.Asset, 0);
|
||||
FinancialAccount.Create(this, "Bank Account", FinancialAccountType.Asset, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.AssetsOutboundInvoices] =
|
||||
FinancialAccount.Create(this.Identity, "Outbound Invoices", FinancialAccountType.Asset, 0);
|
||||
FinancialAccount.Create(this, "Outbound Invoices", FinancialAccountType.Asset, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.AssetsOutstandingCashAdvances] =
|
||||
FinancialAccount.Create(this.Identity, "Cash Advances", FinancialAccountType.Asset, 0);
|
||||
FinancialAccount.Create(this, "Cash Advances", FinancialAccountType.Asset, null);
|
||||
//FinancialAccounts[OrganizationFinancialAccountType.AssetsPaypal] =
|
||||
// FinancialAccount.Create(this.Identity, "Paypal Account", FinancialAccountType.Asset, 0);
|
||||
// FinancialAccount.Create(this, "Paypal Account", FinancialAccountType.Asset, null);
|
||||
//FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinHot] =
|
||||
// FinancialAccount.Create(this.Identity, "Bitcoin Holdings (Hot)", FinancialAccountType.Asset, 0);
|
||||
// FinancialAccount.Create(this, "Bitcoin Holdings (Hot)", FinancialAccountType.Asset, null);
|
||||
//FinancialAccounts[OrganizationFinancialAccountType.AssetsBitcoinCold] =
|
||||
// FinancialAccount.Create(this.Identity, "Bitcoin Cold Storage", FinancialAccountType.Asset, 0);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.AssetsVat] =
|
||||
FinancialAccount.Create(this.Identity, "Inbound Value Added Tax", FinancialAccountType.Asset, 0);
|
||||
// FinancialAccount.Create(this, "Bitcoin Cold Storage", FinancialAccountType.Asset, null);
|
||||
//FinancialAccounts[OrganizationFinancialAccountType.AssetsVatInbound] =
|
||||
// FinancialAccount.Create(this, "Inbound Value Added Tax", FinancialAccountType.Asset, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.CostsAllocatedFunds] =
|
||||
FinancialAccount.Create(this.Identity, "Allocated funds", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this, "Allocated funds", FinancialAccountType.Cost, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.CostsBankFees] =
|
||||
FinancialAccount.Create(this.Identity, "Bank Fees", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this, "Bank Fees", FinancialAccountType.Cost, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.CostsInfrastructure] =
|
||||
FinancialAccount.Create(this.Identity, "ICT and Infrastructure", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this, "ICT and Infrastructure", FinancialAccountType.Cost, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.CostsYearlyResult] =
|
||||
FinancialAccount.Create(this.Identity, "Yearly result", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this, "Yearly result", FinancialAccountType.Cost, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsEquity] =
|
||||
FinancialAccount.Create(this.Identity, "Equity", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "Equity", FinancialAccountType.Debt, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsExpenseClaims] =
|
||||
FinancialAccount.Create(this.Identity, "Expense Claims", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "Expense Claims", FinancialAccountType.Debt, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsInboundInvoices] =
|
||||
FinancialAccount.Create(this.Identity, "Inbound Invoices", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "Inbound Invoices", FinancialAccountType.Debt, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsOther] =
|
||||
FinancialAccount.Create(this.Identity, "General Debt", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "General Debt", FinancialAccountType.Debt, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsSalary] =
|
||||
FinancialAccount.Create(this.Identity, "Salaries Due", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "Salaries Due", FinancialAccountType.Debt, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsTax] =
|
||||
FinancialAccount.Create(this.Identity, "Taxes Due", FinancialAccountType.Debt, 0);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.DebtsVat] =
|
||||
FinancialAccount.Create(this.Identity, "Outbound Value Added Tax", FinancialAccountType.Debt, 0);
|
||||
FinancialAccount.Create(this, "Taxes Due", FinancialAccountType.Debt, null);
|
||||
//FinancialAccounts[OrganizationFinancialAccountType.DebtsVatOutbound] =
|
||||
// FinancialAccount.Create(this, "Outbound Value Added Tax", FinancialAccountType.Debt, null);
|
||||
|
||||
FinancialAccounts[OrganizationFinancialAccountType.IncomeDonations] =
|
||||
FinancialAccount.Create(this.Identity, "Donations", FinancialAccountType.Income, 0);
|
||||
FinancialAccount.Create(this, "Donations", FinancialAccountType.Income, null);
|
||||
FinancialAccounts[OrganizationFinancialAccountType.IncomeSales] =
|
||||
FinancialAccount.Create(this.Identity, "Sales", FinancialAccountType.Income, 0);
|
||||
FinancialAccount.Create(this, "Sales", FinancialAccountType.Income, null);
|
||||
|
||||
|
||||
// Then, create various cost accounts that are probably needed, or that could be used as a starting point
|
||||
|
||||
FinancialAccount.Create(this.Identity, "Offices", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this.Identity, "Unforeseen", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this.Identity, "Staff", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this.Identity, "Marketing and Campaigns", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this.Identity, "Research and Development", FinancialAccountType.Cost, 0);
|
||||
FinancialAccount.Create(this, "Offices", FinancialAccountType.Cost, null);
|
||||
FinancialAccount.Create(this, "Unforeseen", FinancialAccountType.Cost, null);
|
||||
FinancialAccount.Create(this, "Staff", FinancialAccountType.Cost, null);
|
||||
FinancialAccount.Create(this, "Marketing and Campaigns", FinancialAccountType.Cost, null);
|
||||
FinancialAccount.Create(this, "Research and Development", FinancialAccountType.Cost, null);
|
||||
|
||||
// Finally, create the first conference parent
|
||||
|
||||
FinancialAccount conferenceBase = FinancialAccount.Create(this.Identity, "Conferences",
|
||||
FinancialAccountType.Cost, 0);
|
||||
FinancialAccount conferenceBase = FinancialAccount.Create(this, "Conferences",
|
||||
FinancialAccountType.Cost, null);
|
||||
conferenceBase.IsConferenceParent = true;
|
||||
|
||||
// Set the currency
|
||||
|
||||
@@ -139,10 +139,10 @@ namespace Swarmops.Logic.Swarm
|
||||
|
||||
if (base.BudgetId < 0) // no account created yet
|
||||
{
|
||||
ourBudget = FinancialAccount.Create(this.Budget.OrganizationId,
|
||||
ourBudget = FinancialAccount.Create(this.Budget.Organization,
|
||||
"Conf: " + this.Name,
|
||||
FinancialAccountType.Cost,
|
||||
this.BudgetId);
|
||||
this.Budget);
|
||||
|
||||
parentBudget = this.Budget;
|
||||
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for CommonV5
|
||||
/// </summary>
|
||||
public class CommonV5
|
||||
{
|
||||
public CommonV5()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public static void CulturePreInit(HttpRequest request)
|
||||
{
|
||||
// Localization
|
||||
// Set default culture (English, United States)
|
||||
|
||||
string preferredCulture = "en-US";
|
||||
|
||||
// ----------- SET CULTURE ------------
|
||||
|
||||
// Does the user have a culture preference?
|
||||
|
||||
if (request.Cookies["PreferredCulture"] != null)
|
||||
{
|
||||
// Yes, set it
|
||||
preferredCulture = request.Cookies["PreferredCulture"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, determine from browser
|
||||
string browserPreference = "en-US";
|
||||
if (request.UserLanguages != null && request.UserLanguages.Length > 0)
|
||||
{
|
||||
browserPreference = request.UserLanguages[0];
|
||||
preferredCulture = browserPreference;
|
||||
}
|
||||
|
||||
/*
|
||||
string[] languages = (string[])Application["Cultures"];
|
||||
for (int index = 0; index < languages.Length; index++)
|
||||
{
|
||||
if (languages[index].StartsWith(browserPreference))
|
||||
{
|
||||
preferredCulture = languages[index];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(preferredCulture);
|
||||
}
|
||||
catch (Exception) // if we can't set the culture, what do we do? ("We send the Marines.")
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
// throw new Exception("Could not set culture \"" + preferredCulture + "\"", exception);
|
||||
// Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
}
|
||||
|
||||
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
|
||||
}
|
||||
|
||||
public static AuthenticationData GetAuthenticationDataAndCulture(HttpContext suppliedContext)
|
||||
{
|
||||
// This function is called from static page methods in AJAX calls to get
|
||||
// the current set of authentication data. Static page methods cannot access
|
||||
// the instance data of PageV5Base.
|
||||
|
||||
AuthenticationData result = new AuthenticationData();
|
||||
|
||||
// Find various credentials
|
||||
|
||||
string identity = suppliedContext.User.Identity.Name;
|
||||
|
||||
// TODO: If identity is null or empty, set null user + org
|
||||
|
||||
string[] identityTokens = identity.Split(',');
|
||||
|
||||
string userIdentityString = identityTokens[0];
|
||||
string organizationIdentityString = identityTokens[1];
|
||||
|
||||
int currentUserId = Convert.ToInt32(userIdentityString);
|
||||
int currentOrganizationId = Convert.ToInt32(organizationIdentityString);
|
||||
|
||||
result.CurrentUser = Person.FromIdentity(currentUserId);
|
||||
try
|
||||
{
|
||||
result.CurrentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
// It's possible this organization was deleted. Log on to Sandbox instead.
|
||||
result.CurrentOrganization = Organization.Sandbox;
|
||||
}
|
||||
}
|
||||
|
||||
CommonV5.CulturePreInit(HttpContext.Current.Request);
|
||||
// OnPreInit() isn't called in the static methods calling this fn
|
||||
|
||||
/*
|
||||
string userCultureString = result.CurrentUser.PreferredCulture;
|
||||
|
||||
if (!string.IsNullOrEmpty(userCultureString))
|
||||
{
|
||||
CultureInfo userCulture = new CultureInfo(userCultureString); // may throw on invalid database data
|
||||
Thread.CurrentThread.CurrentCulture = userCulture;
|
||||
Thread.CurrentThread.CurrentUICulture = userCulture;
|
||||
}*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* COLOR SCHEME
|
||||
|
||||
#A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF -- blue (hue 240)
|
||||
#FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8 -- orange (hue 60)
|
||||
|
||||
base dark xdark light xlight
|
||||
|
||||
S36L100 S64-L78 S78-L49 S22B100 S11L100 -- blue (hue 222)
|
||||
S78L100 S89-L78 S100L50 S50L100 S22L100 -- orange (hue 40)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
public static string GetColor(ColorType type, ColorVariant variant, ColorShift shift = ColorShift.None)
|
||||
{
|
||||
int hue = (type == ColorType.Base ? 222 : 40);
|
||||
int saturation = 0;
|
||||
int luminosity = 0;
|
||||
|
||||
switch (variant)
|
||||
{
|
||||
case ColorVariant.Base:
|
||||
saturation = 100;
|
||||
luminosity = 80;
|
||||
break;
|
||||
case ColorVariant.Dark:
|
||||
saturation = 50;
|
||||
luminosity = 50;
|
||||
break;
|
||||
case ColorVariant.XDark:
|
||||
saturation = 65;
|
||||
luminosity = 30;
|
||||
break;
|
||||
case ColorVariant.Light:
|
||||
saturation = 100;
|
||||
luminosity = 90;
|
||||
break;
|
||||
case ColorVariant.XLight:
|
||||
saturation = 100;
|
||||
luminosity = 95;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
if (type == ColorType.Accent)
|
||||
{
|
||||
saturation *= 2;
|
||||
if (saturation > 100)
|
||||
{
|
||||
saturation = 100;
|
||||
}
|
||||
}
|
||||
|
||||
switch (shift)
|
||||
{
|
||||
case ColorShift.SlightlyDarker:
|
||||
luminosity -= 2;
|
||||
break;
|
||||
case ColorShift.SlightlyLighter:
|
||||
luminosity += 2;
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
Color color = ColorFromAhsb(100, hue, saturation / 100.0, luminosity / 100.0);
|
||||
return String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
|
||||
}
|
||||
|
||||
|
||||
public static Color ColorFromAhsb(int a, double h, double s, double b)
|
||||
{
|
||||
if (s < 0.001)
|
||||
{
|
||||
return Color.FromArgb(a, Convert.ToInt32(b * 255),
|
||||
Convert.ToInt32(b * 255), Convert.ToInt32(b * 255));
|
||||
}
|
||||
|
||||
double fMax, fMid, fMin;
|
||||
int iSextant, iMax, iMid, iMin;
|
||||
|
||||
if (0.5 < b)
|
||||
{
|
||||
fMax = b - (b * s) + s;
|
||||
fMin = b + (b * s) - s;
|
||||
}
|
||||
else
|
||||
{
|
||||
fMax = b + (b * s);
|
||||
fMin = b - (b * s);
|
||||
}
|
||||
|
||||
iSextant = (int)Math.Floor(h / 60f);
|
||||
if (300f <= h)
|
||||
{
|
||||
h -= 360f;
|
||||
}
|
||||
h /= 60f;
|
||||
h -= 2f * (float)Math.Floor(((iSextant + 1f) % 6f) / 2f);
|
||||
if (0 == iSextant % 2)
|
||||
{
|
||||
fMid = h * (fMax - fMin) + fMin;
|
||||
}
|
||||
else
|
||||
{
|
||||
fMid = fMin - h * (fMax - fMin);
|
||||
}
|
||||
|
||||
iMax = Convert.ToInt32(fMax * 255);
|
||||
iMid = Convert.ToInt32(fMid * 255);
|
||||
iMin = Convert.ToInt32(fMin * 255);
|
||||
|
||||
switch (iSextant)
|
||||
{
|
||||
case 1:
|
||||
return Color.FromArgb(a, iMid, iMax, iMin);
|
||||
case 2:
|
||||
return Color.FromArgb(a, iMin, iMax, iMid);
|
||||
case 3:
|
||||
return Color.FromArgb(a, iMin, iMid, iMax);
|
||||
case 4:
|
||||
return Color.FromArgb(a, iMid, iMin, iMax);
|
||||
case 5:
|
||||
return Color.FromArgb(a, iMax, iMin, iMid);
|
||||
default:
|
||||
return Color.FromArgb(a, iMax, iMid, iMin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected static string HslToWebColor(int hue, int saturation, int luminosity) // 0-359, 0-100, 0-100
|
||||
{
|
||||
// This code is adapted from Wikipedia. Believed to be in the public domain or at the very least
|
||||
// completely unencumbered.
|
||||
|
||||
double h = hue/360.0;
|
||||
double s = saturation/100.0;
|
||||
double l = luminosity/100.0;
|
||||
|
||||
double r, g, b;
|
||||
|
||||
if (s < 0.0001) // zero
|
||||
{
|
||||
r = g = b = l; // achromatic
|
||||
}
|
||||
else
|
||||
{
|
||||
double q = l < 0.5 ? l*(1 + s) : l + s - l*s;
|
||||
double p = 2*l - q;
|
||||
r = Hue2Rgb(p, q, h + 1/3);
|
||||
g = Hue2Rgb(p, q, h);
|
||||
b = Hue2Rgb(p, q, h - 1/3);
|
||||
}
|
||||
|
||||
return String.Format("#{0:x2}{1:x2}{2:x2}", (int) (r*255), (int) (g*255), (int) (b*255));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static double Hue2Rgb(double p, double q, double t)
|
||||
{
|
||||
if (t < 0) t += 1;
|
||||
if (t > 1) t -= 1;
|
||||
if (t < 1/6) return p + (q - p)*6*t;
|
||||
if (t < 1/2) return q;
|
||||
if (t < 2/3) return p + (q - p)*(2/3 - t)*6;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum ColorType
|
||||
{
|
||||
Unkown = 0,
|
||||
Base,
|
||||
Accent
|
||||
}
|
||||
|
||||
public enum ColorVariant
|
||||
{
|
||||
Unknown = 0,
|
||||
Base,
|
||||
Light,
|
||||
XLight,
|
||||
Dark,
|
||||
XDark
|
||||
}
|
||||
|
||||
public enum ColorShift
|
||||
{
|
||||
Unknown = 0,
|
||||
None,
|
||||
SlightlyLighter,
|
||||
SlightlyDarker
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Flags]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public enum EasyUIControl
|
||||
{
|
||||
Unknown = 0,
|
||||
Accordion = 0x0000001,
|
||||
Calendar = 0x0000002,
|
||||
Combo = 0x0000004,
|
||||
ComboBox = 0x0000008,
|
||||
DataGrid = 0x0000010,
|
||||
DateBox = 0x0000020,
|
||||
Dialog = 0x0000040,
|
||||
FileBox = 0x0000080,
|
||||
Layout = 0x0000100,
|
||||
LinkButton = 0x0000200,
|
||||
Menu = 0x0000400,
|
||||
MenuButton = 0x0000800,
|
||||
Messager = 0x0001000,
|
||||
NumberBox = 0x0002000,
|
||||
Pagination = 0x0004000,
|
||||
Panel = 0x0008000,
|
||||
ProgressBar = 0x0010000,
|
||||
PropertyGrid = 0x0020000,
|
||||
SearchBox = 0x0040000,
|
||||
Slider = 0x0080000,
|
||||
Spinner = 0x0100000,
|
||||
SplitButton = 0x0200000,
|
||||
Tabs = 0x0400000,
|
||||
TextBox = 0x0800000,
|
||||
ToolTip = 0x1000000,
|
||||
Tree = 0x2000000,
|
||||
ValidateBox = 0x4000000,
|
||||
Window = 0x8000000
|
||||
};
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum IncludedControl
|
||||
{
|
||||
Unknown = 0,
|
||||
FileUpload = 0x00000001,
|
||||
SwitchButton = 0x00000002,
|
||||
JsonParameters = 0x00000004
|
||||
};
|
||||
@@ -1,146 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for CommonV5Base
|
||||
/// </summary>
|
||||
public class CommonV5Base
|
||||
{
|
||||
public CommonV5Base()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
static public void CulturePreInit (HttpRequest request)
|
||||
{
|
||||
// Localization
|
||||
// Set default culture (English, United States)
|
||||
|
||||
string preferredCulture = "en-US";
|
||||
|
||||
// ----------- SET CULTURE ------------
|
||||
|
||||
// Does the user have a culture preference?
|
||||
|
||||
if (request.Cookies["PreferredCulture"] != null)
|
||||
{
|
||||
// Yes, set it
|
||||
preferredCulture = request.Cookies["PreferredCulture"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, determine from browser
|
||||
string browserPreference = "en-US";
|
||||
if (request.UserLanguages != null && request.UserLanguages.Length > 0)
|
||||
{
|
||||
browserPreference = request.UserLanguages[0];
|
||||
preferredCulture = browserPreference;
|
||||
}
|
||||
|
||||
/*
|
||||
string[] languages = (string[])Application["Cultures"];
|
||||
for (int index = 0; index < languages.Length; index++)
|
||||
{
|
||||
if (languages[index].StartsWith(browserPreference))
|
||||
{
|
||||
preferredCulture = languages[index];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(preferredCulture);
|
||||
}
|
||||
catch (Exception) // if we can't set the culture, what do we do? ("We send the Marines.")
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
// throw new Exception("Could not set culture \"" + preferredCulture + "\"", exception);
|
||||
// Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
}
|
||||
|
||||
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
|
||||
}
|
||||
|
||||
public static AuthenticationData GetAuthenticationDataAndCulture(HttpContext suppliedContext)
|
||||
{
|
||||
// This function is called from static page methods in AJAX calls to get
|
||||
// the current set of authentication data. Static page methods cannot access
|
||||
// the instance data of PageV5Base.
|
||||
|
||||
AuthenticationData result = new AuthenticationData();
|
||||
|
||||
// Find various credentials
|
||||
|
||||
string identity = suppliedContext.User.Identity.Name;
|
||||
|
||||
// TODO: If identity is null or empty, set null user + org
|
||||
|
||||
string[] identityTokens = identity.Split(',');
|
||||
|
||||
string userIdentityString = identityTokens[0];
|
||||
string organizationIdentityString = identityTokens[1];
|
||||
|
||||
int currentUserId = Convert.ToInt32(userIdentityString);
|
||||
int currentOrganizationId = Convert.ToInt32(organizationIdentityString);
|
||||
|
||||
result.CurrentUser = Person.FromIdentity(currentUserId);
|
||||
result.CurrentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
|
||||
CommonV5Base.CulturePreInit(HttpContext.Current.Request); // OnPreInit() isn't called in the static methods calling this fn
|
||||
|
||||
/*
|
||||
string userCultureString = result.CurrentUser.PreferredCulture;
|
||||
|
||||
if (!string.IsNullOrEmpty(userCultureString))
|
||||
{
|
||||
CultureInfo userCulture = new CultureInfo(userCultureString); // may throw on invalid database data
|
||||
Thread.CurrentThread.CurrentCulture = userCulture;
|
||||
Thread.CurrentThread.CurrentUICulture = userCulture;
|
||||
}*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Flags]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public enum EasyUIControl
|
||||
{
|
||||
Unknown = 0,
|
||||
Accordion = 0x0000001,
|
||||
Calendar = 0x0000002,
|
||||
Combo = 0x0000004,
|
||||
ComboBox = 0x0000008,
|
||||
DataGrid = 0x0000010,
|
||||
DateBox = 0x0000020,
|
||||
Dialog = 0x0000040,
|
||||
FileBox = 0x0000080,
|
||||
Layout = 0x0000100,
|
||||
LinkButton = 0x0000200,
|
||||
Menu = 0x0000400,
|
||||
MenuButton = 0x0000800,
|
||||
Messager = 0x0001000,
|
||||
NumberBox = 0x0002000,
|
||||
Pagination = 0x0004000,
|
||||
Panel = 0x0008000,
|
||||
ProgressBar = 0x0010000,
|
||||
PropertyGrid = 0x0020000,
|
||||
SearchBox = 0x0040000,
|
||||
Slider = 0x0080000,
|
||||
Spinner = 0x0100000,
|
||||
SplitButton = 0x0200000,
|
||||
Tabs = 0x0400000,
|
||||
TextBox = 0x0800000,
|
||||
ToolTip = 0x1000000,
|
||||
Tree = 0x2000000,
|
||||
ValidateBox = 0x4000000,
|
||||
Window = 0x8000000
|
||||
};
|
||||
@@ -4,6 +4,7 @@ using System.Web;
|
||||
using Swarmops.Logic.Cache;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
/// <summary>
|
||||
@@ -33,8 +34,19 @@ public class ControlV5Base : System.Web.UI.UserControl
|
||||
currentUserId = Convert.ToInt32(userIdentityString);
|
||||
currentOrganizationId = Convert.ToInt32(organizationIdentityString);
|
||||
_currentUser = Person.FromIdentity(currentUserId);
|
||||
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
_authority = _currentUser.GetAuthority();
|
||||
try
|
||||
{
|
||||
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
// It's possible this organization was deleted. Log on to Sandbox instead.
|
||||
_currentOrganization = Organization.Sandbox;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Web;
|
||||
using Swarmops.Basic.Enums;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
/// <summary>
|
||||
@@ -31,7 +32,18 @@ public class DataV5Base : System.Web.UI.Page
|
||||
string organizationIdentityString = identityTokens[1];
|
||||
|
||||
this.CurrentUser = Person.FromIdentity(Int32.Parse(userIdentityString));
|
||||
this.CurrentOrganization = Organization.FromIdentity(Int32.Parse(organizationIdentityString));
|
||||
try
|
||||
{
|
||||
this.CurrentOrganization = Organization.FromIdentity(Int32.Parse(organizationIdentityString));
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
// It's possible this organization was deleted. Log on to Sandbox instead.
|
||||
this.CurrentOrganization = Organization.Sandbox;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -46,7 +58,7 @@ public class DataV5Base : System.Web.UI.Page
|
||||
|
||||
protected override void OnPreInit(EventArgs e)
|
||||
{
|
||||
CommonV5Base.CulturePreInit(Request);
|
||||
CommonV5.CulturePreInit(Request);
|
||||
|
||||
base.OnPreInit(e);
|
||||
}
|
||||
@@ -139,7 +151,7 @@ public class DataV5Base : System.Web.UI.Page
|
||||
|
||||
protected static AuthenticationData GetAuthenticationDataAndCulture()
|
||||
{
|
||||
return CommonV5Base.GetAuthenticationDataAndCulture(HttpContext.Current);
|
||||
return CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current);
|
||||
}
|
||||
|
||||
protected static string JsonSanitize (string input)
|
||||
|
||||
@@ -24,6 +24,7 @@ public class MasterV5Base : System.Web.UI.MasterPage
|
||||
protected Organization _currentOrganization = null;
|
||||
|
||||
public EasyUIControl EasyUIControlsUsed { get; set; } // these are set by each page, and called by Master to render in ExternalScripts control
|
||||
public IncludedControl IncludedControlsUsed { get; set; } // as above with IncludedScripts control
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
public DateTime PermissionCacheTimestamp
|
||||
|
||||
@@ -51,6 +51,12 @@ public class PageV5Base : System.Web.UI.Page
|
||||
set { this.Master.EasyUIControlsUsed = value; }
|
||||
}
|
||||
|
||||
public IncludedControl IncludedControlsUsed
|
||||
{
|
||||
get { return this.Master.IncludedControlsUsed; }
|
||||
set { this.Master.IncludedControlsUsed = value; }
|
||||
}
|
||||
|
||||
protected Person CurrentUser
|
||||
{
|
||||
get { return this.Master.CurrentUser; }
|
||||
@@ -68,7 +74,7 @@ public class PageV5Base : System.Web.UI.Page
|
||||
|
||||
protected override void OnPreInit(EventArgs e)
|
||||
{
|
||||
CommonV5Base.CulturePreInit(Request);
|
||||
CommonV5.CulturePreInit(Request);
|
||||
|
||||
base.OnPreInit(e);
|
||||
}
|
||||
@@ -130,7 +136,7 @@ public class PageV5Base : System.Web.UI.Page
|
||||
// the current set of authentication data. Static page methods cannot access
|
||||
// the instance data of PageV5Base.
|
||||
|
||||
return CommonV5Base.GetAuthenticationDataAndCulture(HttpContext.Current);
|
||||
return CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -124,7 +124,10 @@
|
||||
<value>Access Control Lists</value>
|
||||
</data>
|
||||
<data name="Menu5_Administration_CreateOrganization" xml:space="preserve">
|
||||
<value>Create Organization</value>
|
||||
<value>Create New Organization</value>
|
||||
</data>
|
||||
<data name="Menu5_Administration_EditOrganization" xml:space="preserve">
|
||||
<value>Edit Organization</value>
|
||||
</data>
|
||||
<data name="Menu5_Administration_GeographyTree" xml:space="preserve">
|
||||
<value>Geography Tree</value>
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
<value>Create new organization as...</value>
|
||||
</data>
|
||||
<data name="CreateOrganization_Info" xml:space="preserve">
|
||||
<value>You can create a new organization either as a new standalone organization, or as a child organization of the current one. (In a child organization, everybody with responsibility in the parent organization automatically has corresponding rights and privileges.)</value>
|
||||
<value>You can create a new organization either as a new standalone organization, or as a child organization of the current one. (Everybody with responsibilities in a parent organization automatically has corresponding rights and privileges in all its children.)</value>
|
||||
</data>
|
||||
<data name="CreateOrganization_NewOrgCurrency" xml:space="preserve">
|
||||
<value>Operating currency</value>
|
||||
@@ -156,4 +156,38 @@
|
||||
<data name="EditOrganization_PageTitle" xml:space="preserve">
|
||||
<value>Edit Organization</value>
|
||||
</data>
|
||||
<data name="EditOrganization_ParticipationBeginsOrg" xml:space="preserve">
|
||||
<value>People become {0} of</value>
|
||||
<comment>The {0} is member, ambassador, etc. in the gender neutral plural.</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_ParticipationBeginsWhen" xml:space="preserve">
|
||||
<value>People become {0} when</value>
|
||||
<comment>The {0} is member, ambassador, etc. in the gender neutral plural.</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_ParticipationChurn" xml:space="preserve">
|
||||
<value>{0} ends when</value>
|
||||
<comment>The {0} is membership, ambassadorship, etc.</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_ParticipationCost" xml:space="preserve">
|
||||
<value>Initial {0} cost (in {1})</value>
|
||||
<comment>The {0} is membership, etc. The {1} is the operating currency.</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_ParticipationDuration" xml:space="preserve">
|
||||
<value>One {0} lasts</value>
|
||||
<comment>The {0} is membership, ambassadorship, etc.</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_RenewalDateEffect" xml:space="preserve">
|
||||
<value>Renewed period counts from</value>
|
||||
</data>
|
||||
<data name="EditOrganization_RenewalReminders" xml:space="preserve">
|
||||
<value>Remind to renew</value>
|
||||
</data>
|
||||
<data name="EditOrganization_RenewalsAffect" xml:space="preserve">
|
||||
<value>Renewals affect</value>
|
||||
<comment>(options: all organizations, one org at a time)</comment>
|
||||
</data>
|
||||
<data name="EditOrganization_RenewalsCost" xml:space="preserve">
|
||||
<value>Renewal cost (in {0})</value>
|
||||
<comment>The {0} is the operating currency (USD etc).</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -550,4 +550,12 @@
|
||||
<value><br/><p>The payments file was <strong>successfully imported.</strong> {1:N0} payment(s) in {0:N0} group(s), totalling {3} {2:N2}, were imported.</p><p>(There were also {5:N0} duplicate payment(s) in {4:N0} group(s).)</p></value>
|
||||
<comment>Arguments 0-5 in order: 0 PaymentGroupCount, 1 PaymentCount, 2 PaymentAmountTotal, 3 Currency, 4 DuplicatePaymentGroupCount, 5 DuplicatePaymentCount</comment>
|
||||
</data>
|
||||
<data name="AccountPlan_AddAccount" xml:space="preserve">
|
||||
<value>add account</value>
|
||||
<comment>Displayed as link in parens after account group name</comment>
|
||||
</data>
|
||||
<data name="AccountPlan_NewAccount" xml:space="preserve">
|
||||
<value>New Account</value>
|
||||
<comment>the name of newly-created accounts, before rename</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -139,7 +139,7 @@
|
||||
<value>New organization</value>
|
||||
</data>
|
||||
<data name="ChangeOrganizations_NothingToChange" xml:space="preserve">
|
||||
<value>You're not part of any other organizations on this Swarmops installation, so you can't switch to something else. Therefore, we're going back to Dashboard instead.</value>
|
||||
<value>You're not participating in any other organization on this Swarmops installation, so you can't switch to something else. Therefore, we're going back to Dashboard instead.</value>
|
||||
</data>
|
||||
<data name="ChangeOrganizations_PageTitle" xml:space="preserve">
|
||||
<value>Change Organizations</value>
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Swarmops.Frontend.Automation
|
||||
HttpPostedFile file = context.Request.Files[i];
|
||||
string fullName = Path.GetFileName (file.FileName);
|
||||
|
||||
AuthenticationData authData = CommonV5Base.GetAuthenticationDataAndCulture (context);
|
||||
AuthenticationData authData = CommonV5.GetAuthenticationDataAndCulture (context);
|
||||
|
||||
Person uploadingPerson = authData.CurrentUser;
|
||||
Organization currentOrg = authData.CurrentOrganization;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DropDown.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.Base.DropDown" %>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.DropControl.ClientID %>').combobox({
|
||||
editable: false,
|
||||
height: 30,
|
||||
width: 300
|
||||
});
|
||||
$('#<%=this.DropControl.ClientID %>').combobox('setValue', '<%=this.DropControl.SelectedValue%>');
|
||||
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > input.combo-text').click(function () {
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > span > span.combo-arrow').click();
|
||||
});
|
||||
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
var panel = $('#<%=this.DropControl.ClientID %>').combo('panel');
|
||||
if (!panel.is(':visible')) {
|
||||
$('#<%=this.DropControl.ClientID %> + span.combo > span > span.combo-arrow').click();
|
||||
panel.focus();
|
||||
}
|
||||
break;
|
||||
|
||||
default: return; // exit this handler for other keys
|
||||
}
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<asp:DropDownList ID="DropControl" runat="server" />
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace Swarmops.Frontend.Controls.v5.Base
|
||||
{
|
||||
public partial class DropDown : ControlV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ListItemCollection Items
|
||||
{
|
||||
get { return this.DropControl.Items; }
|
||||
}
|
||||
|
||||
public string SelectedValue
|
||||
{
|
||||
get { return this.DropControl.SelectedValue; }
|
||||
set { this.DropControl.SelectedValue = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,5 +64,5 @@
|
||||
</script>
|
||||
<asp:HiddenField runat="server" ID="HiddenGuid"/>
|
||||
|
||||
<div style="height:36px;float:left"><input id="<%=this.ClientID %>_ButtonUploadVisible" class="ButtonSwarmopsUpload NoInputFocus" type="button" <%= this.HideTrigger? "style='display:none'" : string.Empty %> /><input id="<%=this.ClientID %>_ButtonUploadHidden" type="file" name="files[]" multiple style="display:none" /></div><div style="height:36px;width:270px;margin-right:10px;float:right;border:none"><div id="<%=this.ClientID %>_DivUploadCount" style='display:none;overflow:hidden;height:'<%=this.DisplayCount < 9? 32: 64%>px'></div><div id="<%=this.ClientID %>_DivProgressUpload" style="width:100%;margin-top:8px;display:none"></div></div>​<br/>
|
||||
<div style="height:36px;padding-top:4px;float:left"><input id="<%=this.ClientID %>_ButtonUploadVisible" class="ButtonSwarmopsUpload NoInputFocus" type="button" <%= this.HideTrigger? "style='display:none'" : string.Empty %> /><input id="<%=this.ClientID %>_ButtonUploadHidden" type="file" name="files[]" multiple style="display:none" /></div><div style="height:36px;padding-top:4px;width:270px;margin-right:10px;float:right;border:none"><div id="<%=this.ClientID %>_DivUploadCount" style='display:none;overflow:hidden;height:'<%=this.DisplayCount < 9? 32: 64%>px'></div><div id="<%=this.ClientID %>_DivProgressUpload" style="width:100%;margin-top:8px;display:none"></div></div>​<br/>
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace Swarmops.Controls.Base
|
||||
{
|
||||
GuidString = this.HiddenGuid.Value;
|
||||
}
|
||||
|
||||
((PageV5Base) this.Page).IncludedControlsUsed |= IncludedControl.FileUpload; // causes master to include necessary script
|
||||
}
|
||||
|
||||
public string GuidString;
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
$('#<%=this.ClientID %>_SpanBudgets span.combo input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
$('#<%=this.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
var panel = $('#<%=this.ClientID %>_DropBudgets').combotree('panel');
|
||||
if (!panel.is(':visible')) {
|
||||
$('#<%=this.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
panel.focus();
|
||||
}
|
||||
break;
|
||||
|
||||
default: return; // exit this handler for other keys
|
||||
@@ -32,6 +36,67 @@
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
|
||||
// below code from http://doc.javake.cn/jeasyui/www.jeasyui.com/forum/index.php-topic=1972.0.htm, understood to be in public domain
|
||||
|
||||
(function () {
|
||||
$.extend($.fn.combotree.methods, {
|
||||
nav: function (jq, dir) {
|
||||
return jq.each(function () {
|
||||
var opts = $(this).combotree('options');
|
||||
var t = $(this).combotree('tree');
|
||||
var nodes = t.tree('getChildren');
|
||||
if (!nodes.length) { return }
|
||||
var node = t.tree('getSelected');
|
||||
if (!node) {
|
||||
t.tree('select', dir > 0 ? nodes[0].target : nodes[nodes.length - 1].target);
|
||||
} else {
|
||||
var index = 0;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].target == node.target) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir > 0) {
|
||||
while (index < nodes.length - 1) {
|
||||
index++;
|
||||
if ($(nodes[index].target).is(':visible')) { break }
|
||||
}
|
||||
} else {
|
||||
while (index > 0) {
|
||||
index--;
|
||||
if ($(nodes[index].target).is(':visible')) { break }
|
||||
}
|
||||
}
|
||||
t.tree('select', nodes[index].target);
|
||||
}
|
||||
if (opts.selectOnNavigation) {
|
||||
var node = t.tree('getSelected');
|
||||
$(node.target).trigger('click');
|
||||
$(this).combotree('showPanel');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$.extend($.fn.combotree.defaults.keyHandler, {
|
||||
up: function () {
|
||||
$(this).combotree('nav', -1);
|
||||
},
|
||||
down: function () {
|
||||
$(this).combotree('nav', 1);
|
||||
},
|
||||
enter: function () {
|
||||
var t = $(this).combotree('tree');
|
||||
var node = t.tree('getSelected');
|
||||
if (node) {
|
||||
$(node.target).trigger('click');
|
||||
}
|
||||
$(this).combotree('hidePanel');
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
|
||||
<span id="<%=this.ClientID %>_SpanBudgets"><select class="easyui-combotree" url="<%=this.DataUrl %>" name="DropBudgets" id="<%=this.ClientID %>_DropBudgets" animate="true" style="width:300px"></select></span>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="IncludedScripts.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.UI.IncludedScripts" %>
|
||||
|
||||
<asp:Literal ID="LiteralReference" runat="server" />
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NBitcoin;
|
||||
using Swarmops.Logic.Support;
|
||||
|
||||
namespace Swarmops.Frontend.Controls.v5.UI
|
||||
{
|
||||
public partial class IncludedScripts : ControlV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
StringBuilder scriptRef = new StringBuilder();
|
||||
|
||||
string[] controlNames = Controls.Split(',');
|
||||
foreach (string controlName in controlNames)
|
||||
{
|
||||
switch (controlName.Trim().ToLowerInvariant())
|
||||
{
|
||||
case "fileupload":
|
||||
scriptRef.Append(
|
||||
"<script src=\"/Scripts/jquery.fileupload/jquery.iframe-transport.js\" type=\"text/javascript\" language=\"javascript\"></script>\r\n" +
|
||||
"<script src=\"/Scripts/jquery.fileupload/jquery.fileupload.js\" type=\"text/javascript\" language=\"javascript\"></script>\r\n");
|
||||
break;
|
||||
|
||||
case "switchbutton":
|
||||
scriptRef.Append(
|
||||
"<script src=\"/Scripts/jquery.switchButton.js\" language=\"javascript\" type=\"text/javascript\"></script>\r\n" +
|
||||
"<link rel=\"stylesheet\" type=\"text/css\" href=\"/Style/jquery.switchButton.css\" />\r\n");
|
||||
break;
|
||||
case "jsonparameters":
|
||||
scriptRef.Append(
|
||||
"<script language=\"javascript\" type=\"text/javascript\" src=\"/Scripts/jquery.json.min.js\"></script>");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.LiteralReference.Text = scriptRef.ToString();
|
||||
}
|
||||
|
||||
public new string Controls { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
<p>What you see here is the new interface being rewritten on top of the already-running engine. It runs on Debian/Ubuntu servers for frontend and backend.</p>
|
||||
<p>This notice will be replaced with a proper Dashboard when all the basic functions are in place. You can see functions appear as they are implemented in the menu.</p>
|
||||
<p>A <a href="http://tinyurl.com/swarmops-plans-2014">rough roadmap</a> says that basic financials are implemented first, then member registry functions, then communications, then responsibilities, then governance. For more on the specific roadmap, go to the <a href="http://scrum.pirateacademy.eu/p/SWARMOPS#project">SCRUM planning</a> for Swarmops.</p>
|
||||
<p>Look at the Swarmops code on <a href="https://github.com/Swarmops/Swarmops">Github</a> (and feel free to contribute)! Current line count: 156,454.</p>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -1,5 +1,6 @@
|
||||
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Master-v5.master.cs" Inherits="Swarmops.MasterV5" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="IncludedScripts" Src="~/Controls/v5/UI/IncludedScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="MainMenu" Src="~/Controls/v5/Base/MainMenu.ascx" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
@@ -39,6 +40,8 @@
|
||||
<link href="/Style/v5-easyui-elements.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- additional scripts etc from individual pages -->
|
||||
<Swarmops5:IncludedScripts ID="IncludedScripts" runat="server" />
|
||||
|
||||
<asp:ContentPlaceHolder id="PlaceHolderHead" runat="server" />
|
||||
<asp:Literal ID="LiteralCrowdinScript" runat="server" Text="" />
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
using Membership = Swarmops.Logic.Swarm.Membership;
|
||||
|
||||
@@ -32,7 +33,18 @@ namespace Swarmops
|
||||
|
||||
_currentUser = Person.FromIdentity(currentUserId);
|
||||
_authority = _currentUser.GetAuthority();
|
||||
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
try
|
||||
{
|
||||
_currentOrganization = Organization.FromIdentity(currentOrganizationId);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
// It's possible this organization was deleted. Log on to Sandbox instead.
|
||||
_currentOrganization = Organization.Sandbox;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
@@ -48,6 +60,7 @@ namespace Swarmops
|
||||
this.Page.Title = "Swarmops - " + this.CurrentPageTitle;
|
||||
|
||||
this.ExternalScriptEasyUI.Controls = EasyUIControlsUsed.ToString();
|
||||
this.IncludedScripts.Controls = IncludedControlsUsed.ToString();
|
||||
|
||||
this.LiteralSidebarInfo.Text = this.CurrentPageInfoBoxLiteral;
|
||||
|
||||
|
||||
@@ -1,35 +1,11 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="CreateOrganization.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.CreateOrganization" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="DropDown" Src="~/Controls/v5/Base/DropDown.ascx" %>
|
||||
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.TextOrganizationName.ClientID %>').focus();
|
||||
|
||||
$('#<%=this.DropCreateChild.ClientID %>').combobox({
|
||||
editable: false,
|
||||
height: 30,
|
||||
width: 300
|
||||
});
|
||||
|
||||
$('#<%=this.DropCurrencies.ClientID%>').combobox({
|
||||
editable: false,
|
||||
height: 30,
|
||||
width: 300
|
||||
});
|
||||
|
||||
$('#<%=this.DropPersonLabel.ClientID%>').combobox({
|
||||
editable: false,
|
||||
height: 30,
|
||||
width: 300
|
||||
});
|
||||
|
||||
$('#<%=this.DropActivistLabel.ClientID%>').combobox({
|
||||
editable: false,
|
||||
height: 30,
|
||||
width: 300
|
||||
});
|
||||
});
|
||||
|
||||
function validateFields() {
|
||||
@@ -43,10 +19,10 @@
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<div class="entryFields">
|
||||
<asp:TextBox runat="server" ID="TextOrganizationName" />​<br/>
|
||||
<asp:DropDownList runat="server" ID="DropCreateChild" />​<br/>
|
||||
<asp:DropDownList runat="server" ID="DropCurrencies"/>​<br/>
|
||||
<asp:DropDownList runat="server" ID="DropPersonLabel" />​<br/>
|
||||
<asp:DropDownList runat="server" ID="DropActivistLabel" />​<br/>
|
||||
<Swarmops5:DropDown runat="server" ID="DropCreateChild" />​<br/>
|
||||
<Swarmops5:DropDown runat="server" ID="DropCurrencies"/>​<br/>
|
||||
<Swarmops5:DropDown runat="server" ID="DropPersonLabel" />​<br/>
|
||||
<Swarmops5:DropDown runat="server" ID="DropActivistLabel" />​<br/>
|
||||
<asp:Button ID="ButtonCreate" runat="server" CssClass="buttonAccentColor NoInputFocus" OnClientClick="return validateFields();" OnClick="ButtonCreate_Click" Text="CreateXYZ"/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
|
||||
@@ -1,21 +1,90 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="EditOrganization.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Admin.EditOrganization" %>
|
||||
<%@ Register tagPrefix="Swarmops5" tagName="FileUpload" src="~/Controls/v5/Base/FileUpload.ascx" %>
|
||||
<%@ Register tagPrefix="Swarmops5" tagName="DropDown" src="~/Controls/v5/Base/DropDown.ascx" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<script src="/Scripts/jquery.switchButton.js" language="javascript" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/Style/jquery.switchButton.css" />
|
||||
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
$('#divTabs').tabs();
|
||||
$('.EditCheck').switchbutton({
|
||||
checkedLabel: '<%=Resources.Global.Global_On.ToUpperInvariant() %>',
|
||||
uncheckedLabel: '<%=Resources.Global.Global_Off.ToUpperInvariant() %>',
|
||||
}).change(function () {
|
||||
|
||||
if (suppressSwitchResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#divUseAccountPlan').slideDown().fadeIn();
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.switchName = $(this).attr("rel");
|
||||
jsonData.switchValue = $(this).prop('checked');
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "EditOrganization.aspx/SwitchToggled",
|
||||
data: $.toJSON(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
if (msg.d.Success) {
|
||||
alertify.log(msg.d.DisplayMessage);
|
||||
if (msg.d.RequireForex && !($('#CheckEnableForex').prop("checked"))) {
|
||||
$("#CheckEnableForex").prop("checked", true).change();
|
||||
}
|
||||
} else {
|
||||
alertify.error(msg.d.DisplayMessage);
|
||||
if (msg.d.RequireForex && !($('#CheckEnableForex').prop("checked"))) {
|
||||
$("#CheckEnableForex").prop("checked", true).change();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (msg) {
|
||||
// TODO: Reset switch, protest server unreachable
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Ask for initial data
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "EditOrganization.aspx/GetInitialData",
|
||||
data: "{}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
initializeSettings(msg.d);
|
||||
},
|
||||
error: function (msg) {
|
||||
// TODO: try again? bail out?
|
||||
alert("The server did not respond with the organization's current settings.");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function initializeSettings(orgSettings) {
|
||||
console.log(orgSettings);
|
||||
suppressSwitchResponse = true;
|
||||
$("#CheckEnableBitcoinCold").prop("checked", orgSettings.AccountBitcoinCold).change();
|
||||
$("#CheckEnableBitcoinHot").prop("checked", orgSettings.AccountBitcoinHot).change();
|
||||
$("#CheckEnablePaypal").prop("checked", orgSettings.AccountPaypal).change();
|
||||
$("#CheckEnableForex").prop("checked", orgSettings.AccountsForex).change();
|
||||
$("#CheckEnableVat").prop("checked", orgSettings.AccountsVat).change();
|
||||
suppressSwitchResponse = false;
|
||||
}
|
||||
|
||||
var suppressSwitchResponse = false;
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style type="text/css">
|
||||
.IconEdit {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -35,11 +104,12 @@
|
||||
<div title="<img src='/Images/Icons/iconshock-switch-red-64px.png' />">
|
||||
<h2>Accounting Features</h2>
|
||||
<div class="entryFields">
|
||||
<label for="CheckAccountBitcoinCold"><asp:Literal ID="LiteralLabelBitcoinColdShort" runat="server" Text="Bitcoin Cold"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckEnableBitcoinCold"/></div><br/>
|
||||
<label for="CheckAccountBitcoinHot"><asp:Literal ID="LiteralLabelBitcoinHotShort" runat="server" Text="Bitcoin Hot"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckboxEnableBitcoinHot"/></div><br/>
|
||||
<asp:TextBox runat="server" ID="TextDaysCashReserves" />​<br/>
|
||||
<label for="CheckAccountPaypal"><asp:Literal ID="Literal1" runat="server" Text="Paypal"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckboxEnablePaypal"/></div><br/>
|
||||
<label for="CheckAccountForeign"><asp:Literal ID="Literal2" runat="server" Text="Forex Profit/Loss"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Active" class="EditCheck" id="CheckboxEnableForeignProfitLoss"/></div><br/>
|
||||
<label for="CheckEnableBitcoinCold"><asp:Literal ID="LiteralLabelBitcoinColdShort" runat="server" Text="Bitcoin Cold"/></label><div class="CheckboxContainer"><input type="checkbox" rel="BitcoinCold" class="EditCheck" id="CheckEnableBitcoinCold"/></div><br/>
|
||||
<label for="CheckEnableBitcoinHot"><asp:Literal ID="LiteralLabelBitcoinHotShort" runat="server" Text="Bitcoin Hot"/></label><div class="CheckboxContainer"><input type="checkbox" rel="BitcoinHot" class="EditCheck" id="CheckEnableBitcoinHot"/></div><br/>
|
||||
<asp:TextBox runat="server" ID="TextDaysCashReserves" CssClass="alignRight" Text="60-90" />​<br/>
|
||||
<label for="CheckEnablePaypal"><asp:Literal ID="Literal1" runat="server" Text="Paypal"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Paypal" class="EditCheck" id="CheckEnablePaypal"/></div><br/>
|
||||
<label for="CheckEnableForex"><asp:Literal ID="Literal2" runat="server" Text="Forex Profit/Loss"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Forex" class="EditCheck" id="CheckEnableForex"/></div><br/>
|
||||
<label for="CheckEnableVat"><asp:Literal ID="Literal3" runat="server" Text="VAT In/Out"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Vat" class="EditCheck" id="CheckEnableVat"/></div><br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
Enable bitcoin coldwallet tracking?<br/>
|
||||
@@ -47,23 +117,69 @@
|
||||
Days of coin reserves to keep hot<br/>
|
||||
Enable Paypal tracking and IPN?<br/>
|
||||
Enable foreign currency accounts?<br/>
|
||||
Enable Value Added Tax (VAT)?<br/>
|
||||
</div>
|
||||
<div id="divUseAccountPlan" style="display: none; width:100%; text-align:center; margin-top:20px; margin-bottom: 20px; border-top: 1px solid <%=CommonV5.GetColor(ColorType.Base, ColorVariant.Light)%>; border-bottom: 1px solid <%=CommonV5.GetColor(ColorType.Base, ColorVariant.Light)%>; background-color: <%=CommonV5.GetColor(ColorType.Base, ColorVariant.XLight)%>">
|
||||
Use the <a href="/Pages/v5/Ledgers/AccountPlan.aspx">Account Plan</a> page to set detailed parameters for these accounts, once enabled.
|
||||
</div>
|
||||
</div>
|
||||
<div title="<img src='/Images/Icons/iconshock-group-diversified-64px.png' />">
|
||||
<h2>Members policy</h2>
|
||||
work in progress
|
||||
<h2>Participant policy</h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:DropDown ID="DropMembersWhen" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropMembersWhere" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropMembershipDuration" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropMembersChurn" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<asp:TextBox ID="TextMembershipCost" runat="server" CssClass="alignRight" Text="0" />​<br/>
|
||||
<asp:TextBox ID="TextRenewalCost" runat="server" CssClass="alignRight" Text="0" />​<br/>
|
||||
<Swarmops5:DropDown ID="DropRenewalDateEffect" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropRenewalsAffect" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropRenewalReminder" CssClass="DropTemp" runat="server"/>​<br/>
|
||||
<Swarmops5:DropDown ID="DropMemberNumber" runat="server" />​<br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label ID="LabelParticipationEntry" runat="server" /><br/>
|
||||
<asp:Label ID="LabelParticipationOrg" runat="server" /><br/>
|
||||
<asp:Label ID="LabelParticipationDuration" runat="server" /><br/>
|
||||
<asp:Label ID="LabelParticipationChurn" runat="server" /><br/>
|
||||
<asp:Label ID="LabelParticipationCost" runat="server" /><br/>
|
||||
<asp:Label ID="LabelRenewalCost" runat="server" /><br/>
|
||||
<asp:Label ID="LabelRenewalDateEffect" runat="server" /><br/>
|
||||
<asp:Label ID="LabelRenewalsAffect" runat="server" /><br/>
|
||||
<asp:Label ID="LabelRenewalReminder" runat="server" /><br/>
|
||||
<asp:Label ID="LabelMemberNumber" runat="server" /><br />
|
||||
</div>
|
||||
</div>
|
||||
<div title="<img src='/Images/Icons/iconshock-colorswatch-64px.png' />">
|
||||
<h2>Communications profile and branding</h2>
|
||||
work in progress
|
||||
<div class="entryFields">
|
||||
<Swarmops5:FileUpload ID="UploadLogoLandscape" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadLogoSquare" DisplayCount="1" runat="server" />
|
||||
<br/>
|
||||
<Swarmops5:FileUpload ID="UploadInvoiceTemplate" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadInvoiceCover" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadParticipantMailTemplate" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadOfficerMailTemplate" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadRenewalMailTemplate" DisplayCount="1" runat="server" />
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
Logo, landscape version [PNG]<br/>
|
||||
Logo, square version [PNG]<br/>
|
||||
<h2>MAIL TEMPLATES</h2>
|
||||
Outbound invoice [SVG]<br/>
|
||||
Invoice cover letter [TXT]<br/>
|
||||
Mail to participants [HTML]<br/>
|
||||
Mail to officers [HTML]<br/>
|
||||
Renewal letter [HTML]<br/>
|
||||
</div>
|
||||
</div>
|
||||
<div title="<img src='/Images/Icons/iconshock-mail-open-64px.png' />">
|
||||
<h2>Mail transmission settings</h2>
|
||||
<div class="entryFields">
|
||||
<asp:TextBox runat="server" ID="TextMailDomain" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailAccounting" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailHR" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailOfficers" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailDomain" Text="example.com" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailAccounting" Text="Accounting" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailHR" Text="Human Resources" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextMailOfficers" Text="Swarmops Notification" />​<br/>
|
||||
<asp:TextBox runat="server" ID="TextSmtpServer" />​<br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Basic.Enums;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
{
|
||||
@@ -18,10 +23,365 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
this.InfoBoxLiteral = Resources.Pages.Admin.EditOrganization_Info;
|
||||
this.PageAccessRequired = new Access(CurrentOrganization, AccessAspect.Administration, AccessType.Write);
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.Tabs;
|
||||
this.IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.SwitchButton | IncludedControl.JsonParameters;
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
{
|
||||
string participants =
|
||||
Resources.Global.ResourceManager.GetString("Title_" + CurrentOrganization.RegularLabel + "_Plural");
|
||||
string participantship =
|
||||
Resources.Global.ResourceManager.GetString("Title_" + CurrentOrganization.RegularLabel + "_Ship");
|
||||
|
||||
this.LabelParticipationEntry.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationBeginsWhen, participants);
|
||||
this.LabelParticipationOrg.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationBeginsOrg, participants);
|
||||
this.LabelParticipationDuration.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationDuration, participantship);
|
||||
this.LabelParticipationChurn.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationChurn, participantship);
|
||||
this.LabelRenewalCost.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_RenewalsCost,
|
||||
CurrentOrganization.Currency.DisplayCode);
|
||||
this.LabelParticipationCost.Text =
|
||||
String.Format(Resources.Pages.Admin.EditOrganization_ParticipationCost,
|
||||
participantship, CurrentOrganization.Currency.DisplayCode);
|
||||
|
||||
this.LabelRenewalsAffect.Text = Resources.Pages.Admin.EditOrganization_RenewalsAffect;
|
||||
this.LabelRenewalDateEffect.Text = Resources.Pages.Admin.EditOrganization_RenewalDateEffect;
|
||||
this.LabelRenewalReminder.Text = Resources.Pages.Admin.EditOrganization_RenewalReminders;
|
||||
this.LabelMemberNumber.Text = Resources.Pages.Admin.EditOrganization_MemberNumberStyle;
|
||||
|
||||
this.DropMembersWhen.Items.Clear();
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Application submitted", "Application"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Application approved", "ApplicationApproval"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Application submitted + paid", "ApplicationPayment"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Application paid + approved", "ApplicationPaymentApproval"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Invited and accepted", "InvitationAcceptance"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Invited and paid", "InvitationPayment"));
|
||||
this.DropMembersWhen.Items.Add(new ListItem("Manual add only", "Manual"));
|
||||
|
||||
this.DropMembersWhere.Items.Clear();
|
||||
this.DropMembersWhere.Items.Add(new ListItem("Root organization only", "Root"));
|
||||
this.DropMembersWhere.Items.Add(new ListItem("Most local org only", "Local"));
|
||||
this.DropMembersWhere.Items.Add(new ListItem("Root and most local org", "RootLocal"));
|
||||
this.DropMembersWhere.Items.Add(new ListItem("All applicable organizations", "All"));
|
||||
|
||||
this.DropMembershipDuration.Items.Clear();
|
||||
this.DropMembershipDuration.Items.Add(new ListItem("One month", "Month"));
|
||||
this.DropMembershipDuration.Items.Add(new ListItem("One year", "Year"));
|
||||
this.DropMembershipDuration.Items.Add(new ListItem("Two years", "TwoYears"));
|
||||
this.DropMembershipDuration.Items.Add(new ListItem("Five years", "FiveYears"));
|
||||
this.DropMembershipDuration.Items.Add(new ListItem("Forever", "Forever"));
|
||||
this.DropMembershipDuration.SelectedValue = "Year";
|
||||
|
||||
this.DropMembersChurn.Items.Clear();
|
||||
this.DropMembersChurn.Items.Add(new ListItem("Expiry date reached", "Expiry"));
|
||||
this.DropMembersChurn.Items.Add(new ListItem("Not paid final reminder", "NotPaid"));
|
||||
this.DropMembersChurn.Items.Add(new ListItem("Never", "Never"));
|
||||
|
||||
this.DropRenewalDateEffect.Items.Clear();
|
||||
this.DropRenewalDateEffect.Items.Add(new ListItem("Date of renewal", "RenewalDate"));
|
||||
this.DropRenewalDateEffect.Items.Add(new ListItem("Previous expiry", "FromExpiry"));
|
||||
|
||||
this.DropRenewalsAffect.Items.Clear();
|
||||
this.DropRenewalsAffect.Items.Add(new ListItem("All related organizations", "All"));
|
||||
this.DropRenewalsAffect.Items.Add(new ListItem("One organization at a time", "One"));
|
||||
|
||||
this.DropRenewalReminder.Items.Clear();
|
||||
this.DropRenewalReminder.Items.Add(new ListItem("30, 14, 7, 1 days before", "Standard"));
|
||||
this.DropRenewalReminder.Items.Add(new ListItem("Never", "Never"));
|
||||
|
||||
this.DropMemberNumber.Items.Clear();
|
||||
this.DropMemberNumber.Items.Add(new ListItem("Global for installation", "Global"));
|
||||
this.DropMemberNumber.Items.Add(new ListItem("Local for each organzation", "Local"));
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static InitialOrgData GetInitialData()
|
||||
{
|
||||
InitialOrgData result = new InitialOrgData();
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
Organization org = authData.CurrentOrganization;
|
||||
|
||||
if (org == null || authData.CurrentUser == null)
|
||||
{
|
||||
return result; // just... don't
|
||||
}
|
||||
|
||||
result.AccountBitcoinCold = (org.FinancialAccounts.AssetsBitcoinCold != null && org.FinancialAccounts.AssetsBitcoinCold.Active);
|
||||
result.AccountBitcoinHot = (org.FinancialAccounts.AssetsBitcoinHot != null && org.FinancialAccounts.AssetsBitcoinHot.Active);
|
||||
result.AccountPaypal = (org.FinancialAccounts.AssetsPaypal != null && org.FinancialAccounts.AssetsPaypal.Active);
|
||||
result.AccountsForex = (org.FinancialAccounts.IncomeCurrencyFluctuations != null && org.FinancialAccounts.IncomeCurrencyFluctuations.Active);
|
||||
result.AccountsVat = (org.FinancialAccounts.AssetsVatInbound != null && org.FinancialAccounts.AssetsVatInbound.Active);
|
||||
|
||||
// TODO: Add all the other fields
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static CallResult SwitchToggled(string switchName, bool switchValue)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (authData.CurrentOrganization == null || authData.CurrentUser == null)
|
||||
{
|
||||
return null; // just don't... don't anything, actually
|
||||
}
|
||||
|
||||
CallResult result = new CallResult();
|
||||
result.Success = true;
|
||||
|
||||
bool bitcoinNative = (authData.CurrentOrganization.Currency.Code == "BTC");
|
||||
|
||||
FinancialAccounts workAccounts = new FinancialAccounts();
|
||||
|
||||
switch (switchName)
|
||||
{
|
||||
case "BitcoinCold":
|
||||
|
||||
if (switchValue && !bitcoinNative)
|
||||
{
|
||||
result.RequireForex = true;
|
||||
}
|
||||
|
||||
FinancialAccount coldAccount = authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinCold;
|
||||
if (coldAccount == null)
|
||||
{
|
||||
coldAccount = FinancialAccount.Create(authData.CurrentOrganization, "Bitcoin Assets Cold",
|
||||
FinancialAccountType.Asset, null);
|
||||
FinancialAccount.Create(authData.CurrentOrganization, "Cold Address 1",
|
||||
FinancialAccountType.Asset, coldAccount);
|
||||
FinancialAccount.Create(authData.CurrentOrganization, "Cold Address 2 (rename these)",
|
||||
FinancialAccountType.Asset, coldAccount);
|
||||
FinancialAccount.Create(authData.CurrentOrganization, "Cold Address... etc",
|
||||
FinancialAccountType.Asset, coldAccount);
|
||||
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinCold = coldAccount;
|
||||
|
||||
result.DisplayMessage =
|
||||
"Bitcoin cold accounts were created. Edit names and addresses in Account Plan."; // LOC
|
||||
}
|
||||
else
|
||||
{
|
||||
workAccounts.Add(coldAccount);
|
||||
}
|
||||
break;
|
||||
case "BitcoinHot":
|
||||
if (switchValue && !bitcoinNative)
|
||||
{
|
||||
result.RequireForex = true;
|
||||
}
|
||||
|
||||
FinancialAccount hotAccount = authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot;
|
||||
if (hotAccount == null)
|
||||
{
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot =
|
||||
FinancialAccount.Create(authData.CurrentOrganization, "Bitcoin Wallet Hot",
|
||||
FinancialAccountType.Asset, null);
|
||||
|
||||
result.DisplayMessage =
|
||||
"Bitcoin hotwallet account was created. Upload its wallet file in Account Plan.";
|
||||
}
|
||||
else
|
||||
{
|
||||
workAccounts.Add(hotAccount);
|
||||
}
|
||||
break;
|
||||
case "Forex":
|
||||
FinancialAccount forexGain =
|
||||
authData.CurrentOrganization.FinancialAccounts.IncomeCurrencyFluctuations;
|
||||
FinancialAccount forexLoss =
|
||||
authData.CurrentOrganization.FinancialAccounts.CostsCurrencyFluctuations;
|
||||
|
||||
if (forexGain == null)
|
||||
{
|
||||
if (forexLoss != null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
authData.CurrentOrganization.FinancialAccounts.IncomeCurrencyFluctuations = FinancialAccount.Create(authData.CurrentOrganization, "Forex holding gains",
|
||||
FinancialAccountType.Income, null);
|
||||
authData.CurrentOrganization.FinancialAccounts.CostsCurrencyFluctuations = FinancialAccount.Create(authData.CurrentOrganization, "Forex holding losses",
|
||||
FinancialAccountType.Cost, null);
|
||||
|
||||
result.DisplayMessage =
|
||||
"Forex gain/loss accounts were created and will be used to account for currency fluctuations.";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (forexLoss == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
if (!bitcoinNative && switchValue == false &&
|
||||
((authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinCold != null &&
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinCold.Active) ||
|
||||
(authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot != null &&
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsBitcoinHot.Active)))
|
||||
{
|
||||
// bitcoin is active, and we're not bitcoin native, so we're not turning off forex
|
||||
|
||||
result.Success = false;
|
||||
result.DisplayMessage =
|
||||
"Cannot disable forex: bitcoin accounts are active in a non-bitcoin-native organization.";
|
||||
result.RequireForex = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
workAccounts.Add(forexGain);
|
||||
workAccounts.Add(forexLoss);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Vat":
|
||||
FinancialAccount vatInbound = authData.CurrentOrganization.FinancialAccounts.AssetsVatInbound;
|
||||
FinancialAccount vatOutbound = authData.CurrentOrganization.FinancialAccounts.DebtsVatOutbound;
|
||||
|
||||
if (vatInbound == null)
|
||||
{
|
||||
if (vatOutbound != null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsVatInbound = FinancialAccount.Create(authData.CurrentOrganization, "Inbound VAT",
|
||||
FinancialAccountType.Asset, null);
|
||||
authData.CurrentOrganization.FinancialAccounts.DebtsVatOutbound = FinancialAccount.Create(authData.CurrentOrganization, "Outbound VAT",
|
||||
FinancialAccountType.Debt, null);
|
||||
|
||||
result.DisplayMessage = "Inbound and outbound VAT accounts were created.";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vatOutbound == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
workAccounts.Add(vatInbound);
|
||||
workAccounts.Add(vatOutbound);
|
||||
}
|
||||
break;
|
||||
case "Paypal":
|
||||
FinancialAccount assetsPaypal = authData.CurrentOrganization.FinancialAccounts.AssetsPaypal;
|
||||
if (assetsPaypal == null)
|
||||
{
|
||||
authData.CurrentOrganization.FinancialAccounts.AssetsPaypal =
|
||||
FinancialAccount.Create(authData.CurrentOrganization, "Paypal account",
|
||||
FinancialAccountType.Asset, null);
|
||||
|
||||
result.DisplayMessage = "An account was created for Paypal account tracking.";
|
||||
}
|
||||
else
|
||||
{
|
||||
workAccounts.Add(assetsPaypal);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (workAccounts.Count > 0 && String.IsNullOrEmpty(result.DisplayMessage))
|
||||
{
|
||||
if (switchValue) // switch has been turned on
|
||||
{
|
||||
// accounts can always be re-enabled. This is not a create, it is a re-enable.
|
||||
|
||||
foreach (FinancialAccount account in workAccounts)
|
||||
{
|
||||
account.Active = true;
|
||||
}
|
||||
|
||||
if (workAccounts.Count > 1)
|
||||
{
|
||||
result.DisplayMessage = "The accounts were re-enabled.";
|
||||
}
|
||||
else
|
||||
{
|
||||
result.DisplayMessage = "The account was re-enabled.";
|
||||
}
|
||||
}
|
||||
else // switch is being set to off position
|
||||
{
|
||||
// if the accounts are currently enabled, we must first check there aren't
|
||||
// any transactions in them before disabling
|
||||
bool transactionsOnAccount = false;
|
||||
|
||||
foreach (FinancialAccount account in workAccounts)
|
||||
{
|
||||
if (account.GetLastRows(5).Count > 0)
|
||||
{
|
||||
transactionsOnAccount = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (transactionsOnAccount)
|
||||
{
|
||||
if (workAccounts.Count > 1)
|
||||
{
|
||||
result.DisplayMessage = "Can't disable these accounts: there are transactions";
|
||||
}
|
||||
else
|
||||
{
|
||||
result.DisplayMessage = "Can't disable this account: there are transactions";
|
||||
}
|
||||
|
||||
result.Success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable accounts
|
||||
|
||||
foreach (FinancialAccount account in workAccounts)
|
||||
{
|
||||
account.Active = false;
|
||||
}
|
||||
|
||||
if (workAccounts.Count > 1)
|
||||
{
|
||||
result.DisplayMessage = "The accounts were disabled.";
|
||||
}
|
||||
else
|
||||
{
|
||||
result.DisplayMessage = "The account was disabled.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public class CallResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string OpResult { get; set; }
|
||||
public string DisplayMessage { get; set; }
|
||||
public bool RequireForex { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class InitialOrgData
|
||||
{
|
||||
public bool AccountsVat;
|
||||
public bool AccountPaypal;
|
||||
public bool AccountBitcoinCold;
|
||||
public bool AccountsForex;
|
||||
public bool AccountBitcoinHot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %>
|
||||
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||||
<script src="/Scripts/jquery.fileupload/jquery.iframe-transport.js" type="text/javascript" language="javascript"></script>
|
||||
<!-- The basic File Upload plugin -->
|
||||
<script src="/Scripts/jquery.fileupload/jquery.fileupload.js" type="text/javascript" language="javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -109,13 +109,15 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
IncludedControlsUsed = IncludedControl.FileUpload;
|
||||
}
|
||||
|
||||
|
||||
private void Localize()
|
||||
{
|
||||
this.LabelAmount.Text = string.Format(Resources.Pages.Financial.FileExpenseClaim_Amount,
|
||||
CurrentOrganization.Currency.Code);
|
||||
CurrentOrganization.Currency.DisplayCode);
|
||||
this.LabelPurpose.Text = Resources.Pages.Financial.FileExpenseClaim_Description;
|
||||
this.LabelBudget.Text = Resources.Pages.Financial.FileExpenseClaim_Budget;
|
||||
this.LabelHeaderBankDetails.Text = Resources.Pages.Financial.FileExpenseClaim_HeaderBankDetails;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
private void Localize()
|
||||
{
|
||||
this.LabelAmount.Text = string.Format(Resources.Pages.Financial.RequestCashAdvance_Amount,
|
||||
CurrentOrganization.Currency.Code);
|
||||
CurrentOrganization.Currency.DisplayCode);
|
||||
this.LabelPurpose.Text = Resources.Pages.Financial.RequestCashAdvance_Purpose;
|
||||
this.LabelBudget.Text = Resources.Pages.Financial.RequestCashAdvance_Budget;
|
||||
this.LabelHeaderBankDetails.Text = Resources.Pages.Financial.RequestCashAdvance_HeaderBankDetails;
|
||||
|
||||
@@ -4,205 +4,48 @@
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<script src="/Scripts/jquery.switchButton.js" language="javascript" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/Style/jquery.switchButton.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$('#tableAccountPlan').treegrid(
|
||||
{
|
||||
onBeforeExpand: function (foo) {
|
||||
$('span.accountplandata-collapsed-' + foo.id).fadeOut('fast', function () {
|
||||
onBeforeExpand: function(foo) {
|
||||
$('span.accountplandata-collapsed-' + foo.id).fadeOut('fast', function() {
|
||||
$('span.accountplandata-expanded-' + foo.id).fadeIn('slow');
|
||||
});
|
||||
},
|
||||
|
||||
onBeforeCollapse: function (foo) {
|
||||
$('span.accountplandata-expanded-' + foo.id).fadeOut('fast', function () {
|
||||
onBeforeCollapse: function(foo) {
|
||||
$('span.accountplandata-expanded-' + foo.id).fadeOut('fast', function() {
|
||||
$('span.accountplandata-collapsed-' + foo.id).fadeIn('slow');
|
||||
});
|
||||
},
|
||||
|
||||
onLoadSuccess: function () {
|
||||
|
||||
onLoadSuccess: function() {
|
||||
$('div.datagrid').css('opacity', 1);
|
||||
|
||||
$(".IconEdit").mouseover(function() {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-wrench-16px-hot.png");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-wrench-16px-hot.png");
|
||||
});
|
||||
|
||||
$(".IconEdit").mouseout(function() {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-wrench-16px.png");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-wrench-16px.png");
|
||||
});
|
||||
|
||||
$(".IconAdd, .LinkAdd").click(function() {
|
||||
accountType = $(this).attr("accountType");
|
||||
addAccount();
|
||||
});
|
||||
|
||||
$(".IconEdit").click(function() {
|
||||
accountId = $(this).attr("accountId");
|
||||
accountType = accountId.substring(0,1); // A, D, I, C
|
||||
accountType = accountId.substring(0, 1); // A, D, I, C
|
||||
accountId = accountId.substring(1);
|
||||
|
||||
var accountTree = $('#<%=DropParents.ClientID %>_DropBudgets');
|
||||
accountTreeLoaded = false;
|
||||
accountTree.combotree('setText', '');
|
||||
|
||||
|
||||
if (accountType == 'A') {
|
||||
$('#DivEditAssetLabels').show();
|
||||
$('#DivEditAssetControls').show();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Asset&ExcludeId=' + accountId);
|
||||
} else if (accountType == 'D') { // Debt, aka Liability
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Debt&ExcludeId=' + accountId);
|
||||
} else { // P&L account
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').show();
|
||||
$('#DivEditProfitLossControls').show();
|
||||
|
||||
if (accountType == 'I') {
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Income&ExcludeId=' + accountId);
|
||||
} else { // C for Costs aka Expenses
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Cost&ExcludeId=' + accountId);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear out data in modal form, gray out to indicate being loaded
|
||||
|
||||
$('span#<%= DropParents.ClientID %>_SpanBudgets span input.combo-text').css('background-color', '#DDD');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-color', '#DDD');
|
||||
$('#TextAccountBudget').val('...').css('background-color', '#DDD');
|
||||
$('#TextAccountName').val('...').css('background-color', '#DDD');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').attr('placeholder', '...');
|
||||
accountTree.combotree('setText', '...');
|
||||
parentAccountName = '';
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
$('body').css('overflow-y', 'hidden');
|
||||
$('#divModalCover').fadeIn();
|
||||
|
||||
setTimeout(function() {
|
||||
$('#divModalBox').animate({ "height": ($('#DivModalFields').outerHeight() + $('#HeaderModal').outerHeight()) + 40 + "px" }, 50);
|
||||
}, 50); // set timeout to after checkboxes initialized, if this is the first show of modal
|
||||
|
||||
if (!checkboxesInitialized && (accountType == 'I' || accountType == 'C')) {
|
||||
// This is a weird construct, but comes from the switchbuttons needing to be visible when initialized.
|
||||
// Hence, it can't be done in document.Ready but need to be done on first show.
|
||||
setTimeout(function() {
|
||||
$('.EditCheck')
|
||||
.switchbutton({
|
||||
checkedLabel: '<%=Resources.Global.Global_On.ToUpperInvariant() %>',
|
||||
uncheckedLabel: '<%=Resources.Global.Global_Off.ToUpperInvariant() %>',
|
||||
})
|
||||
.change(function() {
|
||||
if (!suppressSwitchChangeAction) {
|
||||
$(this).parent().css('box-shadow', '0 0 1px 0 #FFFFC0');
|
||||
var callParameters = "{'accountId': '" + escape(accountId) + "', 'switchName':'" + $(this).attr("rel") + "','switchValue':'" + $(this).prop('checked') + "'}";
|
||||
|
||||
// If changing Active, set Expensable.Enabled to Active.Checked. If false, set Expensable.Checked to false, too
|
||||
|
||||
if ($(this).attr("rel") == "Active") {
|
||||
if (!$(this).prop('checked') && $("#CheckAccountExpensable").prop("checked")) {
|
||||
$("#CheckAccountExpensable").prop("checked", false).change();
|
||||
}
|
||||
}
|
||||
|
||||
// If changing Expensable to true, make sure that Active is true, too
|
||||
|
||||
if ($(this).attr("rel") == "Expensable") {
|
||||
if ($(this).prop('checked') && !$("#CheckAccountActive").prop("checked")) {
|
||||
$("#CheckAccountActive").prop("checked", true).change();
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/SetAccountSwitch",
|
||||
data: callParameters,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function(msg) {
|
||||
if (msg.d) { // saved ok
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(96,255,96,0.5)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 10px 2px rgba(0,255,0,0)'
|
||||
}, 250);
|
||||
accountDirty = true;
|
||||
} else {
|
||||
suppressSwitchChangeAction = true;
|
||||
$(this).click();
|
||||
suppressSwitchChangeAction = false;
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(255,96,96,0.8)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 15px 3px rgba(0,255,0,0)'
|
||||
}, 750);
|
||||
alertify.error("The server refused setting the switch as requested."); // TODO: Localize
|
||||
}
|
||||
$('#TextAccountName').animate({ backgroundColor: "#FFFFFF" }, 250);
|
||||
}, this),
|
||||
error: $.proxy(function() {
|
||||
alertify.error("There was an error calling the server to set the switch. Is the server reachable?"); // TODO: Localize
|
||||
suppressSwitchChangeAction = true;
|
||||
$(this).click();
|
||||
suppressSwitchChangeAction = false;
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(255,96,96,0.8)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 15px 3px rgba(0,255,0,0)'
|
||||
}, 750);
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
checkboxesInitialized = true;
|
||||
}
|
||||
|
||||
if (!parentDropInitialized) {
|
||||
parentDropInitialized = true;
|
||||
// Another weird construct for same reason. Show and hide the box once, and it'll init properly next.
|
||||
setTimeout(function() {
|
||||
$('#<%=this.DropParents.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
$('#<%=this.DropParents.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/GetAccountData",
|
||||
data: "{'accountId': '" + escape(accountId) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
|
||||
suppressSwitchChangeAction = true;
|
||||
$("#CheckAccountActive").prop("checked", msg.d.Active).change();
|
||||
$("#CheckAccountExpensable").prop("checked", msg.d.Expensable).change();
|
||||
$("#CheckAccountAdministrative").prop("checked", msg.d.Administrative).change();
|
||||
suppressSwitchChangeAction = false;
|
||||
|
||||
modalAccountName = msg.d.AccountName;
|
||||
$('#TextAccountName').val(msg.d.AccountName).css('background-color', '#FFF');
|
||||
|
||||
modalAccountBudget = msg.d.Budget;
|
||||
$('#TextAccountBudget').val(msg.d.Budget).css('background-color', '#FFF');
|
||||
|
||||
$('#SpanTextCurrency').text(msg.d.CurrencyCode);
|
||||
$('#SpanEditBalance').text(msg.d.Balance);
|
||||
parentAccountName = msg.d.ParentAccountName;
|
||||
setAccountTreeText(parentAccountName);
|
||||
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-color', '#FFF');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-image', "url('" + msg.d.AccountOwnerAvatarUrl + "')");
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').attr('placeholder', msg.d.AccountOwnerName);
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').val('');
|
||||
}
|
||||
});
|
||||
|
||||
beginEditAccount();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -306,6 +149,198 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
function addAccount() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/CreateAccount",
|
||||
data: "{'accountType': '" + accountType + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
async: false, // ugly but necessary to prevent races
|
||||
success: function(msg) {
|
||||
accountId = msg.d;
|
||||
accountType = accountType.substring(0, 1);
|
||||
accountDirty = true; // just created, so update needed
|
||||
beginEditAccount();
|
||||
},
|
||||
error: function() {
|
||||
alertify.error("There was an error calling the server to create the account. Is the server reachable?"); // TODO: Localize
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function beginEditAccount() {
|
||||
var accountTree = $('#<%=DropParents.ClientID %>_DropBudgets');
|
||||
accountTreeLoaded = false;
|
||||
accountTree.combotree('setText', '');
|
||||
|
||||
if (accountType == 'A') {
|
||||
$('#DivEditAssetLabels').show();
|
||||
$('#DivEditAssetControls').show();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Asset&ExcludeId=' + accountId);
|
||||
} else if (accountType == 'D') { // Debt, aka Liability
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Debt&ExcludeId=' + accountId);
|
||||
} else { // P&L account
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').show();
|
||||
$('#DivEditProfitLossControls').show();
|
||||
|
||||
if (accountType == 'I') {
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Income&ExcludeId=' + accountId);
|
||||
} else { // C for Costs aka Expenses
|
||||
accountTree.combotree('reload', '/Automation/Json-FinancialAccountsTree.aspx?AccountType=Cost&ExcludeId=' + accountId);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear out data in modal form, gray out to indicate being loaded
|
||||
|
||||
$('span#<%= DropParents.ClientID %>_SpanBudgets span input.combo-text').css('background-color', '#DDD');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-color', '#DDD');
|
||||
$('#TextAccountBudget').val('...').css('background-color', '#DDD');
|
||||
$('#TextAccountName').val('...').css('background-color', '#DDD');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').attr('placeholder', '...');
|
||||
|
||||
accountTree.combotree('setText', '...');
|
||||
parentAccountName = '';
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
$('body').css('overflow-y', 'hidden');
|
||||
$('#divModalCover').fadeIn();
|
||||
|
||||
setTimeout(function() {
|
||||
$('#divModalBox').animate({ "height": ($('#DivModalFields').outerHeight() + $('#HeaderModal').outerHeight()) + 40 + "px" }, 50);
|
||||
}, 50); // set timeout to after checkboxes initialized, if this is the first show of modal
|
||||
|
||||
if (!checkboxesInitialized && (accountType == 'I' || accountType == 'C')) {
|
||||
// This is a weird construct, but comes from the switchbuttons needing to be visible when initialized.
|
||||
// Hence, it can't be done in document.Ready but need to be done on first show.
|
||||
setTimeout(function() {
|
||||
$('.EditCheck')
|
||||
.switchbutton({
|
||||
checkedLabel: '<%=Resources.Global.Global_On.ToUpperInvariant() %>',
|
||||
uncheckedLabel: '<%=Resources.Global.Global_Off.ToUpperInvariant() %>',
|
||||
})
|
||||
.change(function() {
|
||||
if (!suppressSwitchChangeAction) {
|
||||
$(this).parent().css('box-shadow', '0 0 1px 0 #FFFFC0');
|
||||
|
||||
var jsonData = {};
|
||||
jsonData.accountId = escape(accountId);
|
||||
jsonData.switchName = $(this).attr("rel");
|
||||
jsonData.switchValue = $(this).prop('checked');
|
||||
|
||||
var callParameters = $.toJSON(jsonData);
|
||||
|
||||
// If changing Active, set Expensable.Enabled to Active.Checked. If false, set Expensable.Checked to false, too
|
||||
|
||||
if ($(this).attr("rel") == "Active") {
|
||||
if (!$(this).prop('checked') && $("#CheckAccountExpensable").prop("checked")) {
|
||||
$("#CheckAccountExpensable").prop("checked", false).change();
|
||||
}
|
||||
}
|
||||
|
||||
// If changing Expensable to true, make sure that Active is true, too
|
||||
|
||||
if ($(this).attr("rel") == "Expensable") {
|
||||
if ($(this).prop('checked') && !$("#CheckAccountActive").prop("checked")) {
|
||||
$("#CheckAccountActive").prop("checked", true).change();
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/SetAccountSwitch",
|
||||
data: callParameters,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: $.proxy(function(msg) {
|
||||
if (msg.d) { // saved ok
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(96,255,96,0.5)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 10px 2px rgba(0,255,0,0)'
|
||||
}, 250);
|
||||
accountDirty = true;
|
||||
} else {
|
||||
suppressSwitchChangeAction = true;
|
||||
$(this).click();
|
||||
suppressSwitchChangeAction = false;
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(255,96,96,0.8)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 15px 3px rgba(0,255,0,0)'
|
||||
}, 750);
|
||||
alertify.error("The server refused setting the switch as requested."); // TODO: Localize
|
||||
}
|
||||
$('#TextAccountName').animate({ backgroundColor: "#FFFFFF" }, 250);
|
||||
}, this),
|
||||
error: $.proxy(function() {
|
||||
alertify.error("There was an error calling the server to set the switch. Is the server reachable?"); // TODO: Localize
|
||||
suppressSwitchChangeAction = true;
|
||||
$(this).click();
|
||||
suppressSwitchChangeAction = false;
|
||||
$(this).parent().css('box-shadow', '0 0 1px 2px rgba(255,96,96,0.8)');
|
||||
$(this).parent().animate({
|
||||
boxShadow: '0 0 15px 3px rgba(0,255,0,0)'
|
||||
}, 750);
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
checkboxesInitialized = true;
|
||||
}
|
||||
|
||||
if (!parentDropInitialized) {
|
||||
parentDropInitialized = true;
|
||||
// Another weird construct for same reason. Show and hide the box once, and it'll init properly next.
|
||||
setTimeout(function() {
|
||||
$('#<%=this.DropParents.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
$('#<%=this.DropParents.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/GetAccountData",
|
||||
data: "{'accountId': '" + escape(accountId) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function(msg) {
|
||||
|
||||
suppressSwitchChangeAction = true;
|
||||
$("#CheckAccountActive").prop("checked", msg.d.Active).change();
|
||||
$("#CheckAccountExpensable").prop("checked", msg.d.Expensable).change();
|
||||
$("#CheckAccountAdministrative").prop("checked", msg.d.Administrative).change();
|
||||
suppressSwitchChangeAction = false;
|
||||
|
||||
modalAccountName = msg.d.AccountName;
|
||||
$('#TextAccountName').val(msg.d.AccountName).css('background-color', '#FFF');
|
||||
|
||||
modalAccountBudget = msg.d.Budget;
|
||||
$('#TextAccountBudget').val(msg.d.Budget).css('background-color', '#FFF');
|
||||
|
||||
$('#SpanTextCurrency').text(msg.d.CurrencyCode);
|
||||
$('#SpanEditBalance').text(msg.d.Balance);
|
||||
parentAccountName = msg.d.ParentAccountName;
|
||||
setAccountTreeText(parentAccountName);
|
||||
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-color', '#FFF');
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').css('background-image', "url('" + msg.d.AccountOwnerAvatarUrl + "')");
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').attr('placeholder', msg.d.AccountOwnerName);
|
||||
$('span#<%= DropOwner.ClientID %>_SpanPeople span input.combo-text').val('');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function modalShow() {
|
||||
$('#divModalCover').fadeIn();
|
||||
}
|
||||
@@ -413,13 +448,16 @@
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.IconEdit {
|
||||
.IconEdit, .IconAdd {
|
||||
cursor: pointer;
|
||||
}
|
||||
#IconCloseEdit {
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
.SpanGroupName {
|
||||
font-weight: 700;
|
||||
}
|
||||
.CheckboxContainer {
|
||||
float: right; padding-top: 4px;padding-right: 8px;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.DbVersionRequired = 2; // Account reparenting
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
|
||||
this.IncludedControlsUsed |= IncludedControl.SwitchButton | IncludedControl.JsonParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,20 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static int CreateAccount(string accountType)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
FinancialAccountType accountTypeEnum = (FinancialAccountType) Enum.Parse(typeof (FinancialAccountType), accountType);
|
||||
|
||||
FinancialAccount account = FinancialAccount.Create(authData.CurrentOrganization,
|
||||
Resources.Pages.Ledgers.AccountPlan_NewAccount, accountTypeEnum, null);
|
||||
|
||||
return account.Identity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static bool SetAccountName(int accountId, string name)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,8 +46,10 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
{
|
||||
string childrenString = GetAccountsRecurse(type, 0);
|
||||
|
||||
return "{\"id\":\"" + -((int) type) + "\",\"accountName\":\"" + JsonSanitize(localizedGroupName) +
|
||||
"\",\"state\":\"open\",\"children\":[" + childrenString + "]}";
|
||||
string addString = String.Format("<img class=\\\"IconAdd\\\" accountType=\\\"{0}\\\" src=\\\"/Images/Icons/iconshock-add-16px.png\\\" />", type.ToString());
|
||||
|
||||
return "{\"id\":\"" + -((int) type) + "\",\"accountName\":\"<span class=\\\"SpanGroupName\\\">" + JsonSanitize(localizedGroupName) + "</span> (<a class=\\\"LinkAdd\\\" accountType=\\\"" + type.ToString() + "\\\" href=\\\"#\\\">" + JsonSanitize(Resources.Pages.Ledgers.AccountPlan_AddAccount) +
|
||||
"</a>)\",\"state\":\"open\",\"children\":[" + childrenString + "],\"action\":\"" + addString + "\"}";
|
||||
}
|
||||
|
||||
private string GetAccountsRecurse (FinancialAccountType accountType, int rootNodeId)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
foreach (YearlyReportLine line in reportLines)
|
||||
{
|
||||
string element = string.Format("\"id\":{0},\"name\":\"{1}\"", line.AccountId,
|
||||
string element = string.Format("\"id\":\"{0}\",\"name\":\"{1}\"", line.AccountId,
|
||||
JsonSanitize(line.AccountName));
|
||||
|
||||
if (line.Children.Count > 0)
|
||||
|
||||
@@ -80,7 +80,7 @@ public partial class Pages_v5_Ledgers_Json_ProfitLossData : DataV5Base
|
||||
|
||||
foreach (YearlyReportLine line in reportLines)
|
||||
{
|
||||
string element = string.Format("\"id\":{0},\"name\":\"{1}\"", line.AccountId,
|
||||
string element = string.Format("\"id\":\"{0}\",\"name\":\"{1}\"", line.AccountId,
|
||||
JsonSanitize(line.AccountName));
|
||||
|
||||
if (line.Children.Count > 0)
|
||||
|
||||
@@ -29,7 +29,7 @@ public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeF="AddPerson.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Swarm.AddPerson" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
<div class="entryFields">
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
Name<br />
|
||||
Mail<br />
|
||||
Phone<br />
|
||||
Street 1<br />
|
||||
Street 2<br />
|
||||
Postal Code, City<br />
|
||||
Country<br />
|
||||
Date of Birth<br />
|
||||
Legal gender<br />
|
||||
Geography detected<br />
|
||||
[Regular] until<br />
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
|
||||
</asp:Content>
|
||||
@@ -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.Pages.v5.Swarm
|
||||
{
|
||||
public partial class AddPerson : PageV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ input.ButtonSwarmopsUpload {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
input.ButtonSwarmopsUpload:hover {
|
||||
input.ButtonSwarmopsUpload:hover {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,23 +67,45 @@
|
||||
list-style-type: none;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0px 1px 4px 1px #1C397E inset;
|
||||
box-shadow: 0px 1px 4px 1px #1C397E inset, 0 1px 4px 1px #1c397e;
|
||||
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
.combo-panel > .combobox-item {
|
||||
font-size: 20px;
|
||||
padding: 0 8px;
|
||||
border-top: 1px solid transparent;
|
||||
border-bottom: 1px solid transparent;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
.combo-panel > .combobox-item-selected {
|
||||
font-weight: 400;
|
||||
border-top: 1px solid #c8d9ff;
|
||||
border-bottom: 1px solid #c8d9ff;
|
||||
background: #e4ecff;
|
||||
}
|
||||
|
||||
.combo-panel > .treenode-item-selected {
|
||||
background: #e4ecff;
|
||||
}
|
||||
|
||||
.combo-panel > ul.tree > li > div.tree-node:first-child {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
div.combobox-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
/* TREE */
|
||||
|
||||
.tree
|
||||
{
|
||||
}
|
||||
|
||||
.tree-node-hover{
|
||||
.tree-node-hover, .tree-node-selected{
|
||||
background: #E4ECFF;
|
||||
box-shadow: 0px 0px 4px 1px #C8D9FF inset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user