Added logo-upload capability (probably notworking yet)
This commit is contained in:
@@ -47,6 +47,16 @@ namespace Swarmops.Common.Enums
|
||||
/// <summary>
|
||||
/// Photo documenting an external activity
|
||||
/// </summary>
|
||||
ExternalActivityPhoto
|
||||
ExternalActivityPhoto,
|
||||
|
||||
/// <summary>
|
||||
/// Organization logotype (public)
|
||||
/// </summary>
|
||||
Logo,
|
||||
|
||||
/// <summary>
|
||||
/// Other artwork (public)
|
||||
/// </summary>
|
||||
Artwork
|
||||
}
|
||||
}
|
||||
@@ -406,6 +406,16 @@ namespace Swarmops.Common.Enums
|
||||
/// <summary>
|
||||
/// If nonpresentation currency, which currency was used (Int64 cents).
|
||||
/// </summary>
|
||||
NativeCurrencyAmountCents
|
||||
NativeCurrencyAmountCents,
|
||||
|
||||
/// <summary>
|
||||
/// Document identity of an organization's 16x9 landscape logo.
|
||||
/// </summary>
|
||||
OrgLogoLandscape,
|
||||
|
||||
/// <summary>
|
||||
/// Document identity of an organization's square logo - also usable for circle-type avatars
|
||||
/// </summary>
|
||||
OrgLogoSquare
|
||||
}
|
||||
}
|
||||
@@ -1060,5 +1060,23 @@ namespace Swarmops.Logic.Structure
|
||||
this.FinancialAccounts.AssetsVatInbound.Active);
|
||||
}
|
||||
}
|
||||
|
||||
public Document LogoLandscape
|
||||
{
|
||||
get
|
||||
{
|
||||
int docId = OptionalData.GetOptionalDataInt(ObjectOptionalDataType.OrgLogoLandscape);
|
||||
if (docId > 0)
|
||||
{
|
||||
return Document.FromIdentity(docId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
OptionalData.SetOptionalDataInt(ObjectOptionalDataType.OrgLogoLandscape, value.Identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,14 @@ namespace Swarmops.Logic.Support
|
||||
.SetDocumentForeignObject (Identity, GetDocumentTypeForObject (foreignObject), foreignObject.Identity);
|
||||
}
|
||||
|
||||
public void SetDocumentTypeDirect(DocumentType docType, IHasIdentity foreignObject)
|
||||
{
|
||||
// Overrides the standard checks -- used for organization-level documents of many types
|
||||
SwarmDb.GetDatabaseForWriting()
|
||||
.SetDocumentForeignObject(this.Identity, docType, foreignObject.Identity);
|
||||
}
|
||||
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
// Unlink, actually
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrgFunctions.aspx.cs" Inherits="Swarmops.Frontend.Automation.OrgFunctions" %>
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Logic.Support;
|
||||
|
||||
namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
public partial class OrgFunctions : DataV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
static AjaxInputCallResult AdminUploads(string guid, string cookie)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
Documents newDocuments = Documents.RecentFromDescription(guid);
|
||||
if (newDocuments.Count < 1)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"No docs found in /Automation/OrgFunctions.aspx/AdminUploads using supplied GUID (" + guid + ")");
|
||||
|
||||
}
|
||||
|
||||
switch (cookie)
|
||||
{
|
||||
case "LogoLandscape":
|
||||
if (newDocuments.Count > 1)
|
||||
{
|
||||
throw new ArgumentException("More than one doc matches");
|
||||
}
|
||||
|
||||
newDocuments[0].SetDocumentTypeDirect(DocumentType.Logo, authData.CurrentOrganization);
|
||||
authData.CurrentOrganization.LogoLandscape = newDocuments[0];
|
||||
|
||||
return new AjaxInputCallResult { Success = true, ObjectIdentity = newDocuments[0].Identity };
|
||||
|
||||
default:
|
||||
throw new ArgumentException("Unimplemented cookie -- '" + cookie +
|
||||
"' -- in /Automation/OrgFunctions.aspx/AdminUploads");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Swarmops.Frontend.Automation {
|
||||
|
||||
|
||||
public partial class OrgFunctions {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="FileUpload.ascx.cs" Inherits="Swarmops.Controls.Base.FileUpload" %>
|
||||
<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="FileUpload.ascx.cs" CodeFile="FileUpload.ascx.cs" Inherits="Swarmops.Controls.Base.FileUpload" %>
|
||||
<%@ Import Namespace="System.Net" %>
|
||||
|
||||
<asp:HiddenField runat="server" ID="HiddenGuid"/>
|
||||
|
||||
@@ -97,6 +97,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onFileUploaded(guid, cookie) {
|
||||
var jsonData = {};
|
||||
jsonData.guid = guid;
|
||||
jsonData.cookie = cookie;
|
||||
|
||||
alertify.success("onFileUploaded");
|
||||
|
||||
SwarmopsJS.ajaxCall(
|
||||
'/Automation/OrgFunctions.aspx/AdminUploads',
|
||||
jsonData,
|
||||
function(data) {
|
||||
if (data.Success) {
|
||||
// Some special cases
|
||||
if (cookie == "LogoLandscape") {
|
||||
// Replace the main sidebar logo
|
||||
$('img#ctl00_ImageLogo').attr("src", "/Pages/v5/Support/StreamUpload.aspx?DocId=" + data.DocumentId);
|
||||
}
|
||||
} else {
|
||||
alertify.error("The server says the file was not accepted. Try again?");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -179,7 +203,7 @@
|
||||
<div title="<img src='/Images/Icons/iconshock-colorswatch-64px.png' />">
|
||||
<h2>Communications profile and branding</h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:FileUpload ID="UploadLogoLandscape" DisplayCount="1" runat="server" />
|
||||
<Swarmops5:FileUpload ID="UploadLogoLandscape" DisplayCount="1" runat="server" ClientUploadCompleteCallback="onFileUploaded" Cookie="LogoLandscape" />
|
||||
<Swarmops5:FileUpload ID="UploadLogoSquare" DisplayCount="1" runat="server" />
|
||||
<br/>
|
||||
<Swarmops5:FileUpload ID="UploadInvoiceTemplate" DisplayCount="1" runat="server" />
|
||||
|
||||
@@ -205,6 +205,8 @@
|
||||
<asp:Label runat="server" ID="LabelDescribePayoutForeign" Text="Match to payout XYZ" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="radioOptionPayment" class="radioOption"></div>
|
||||
<div id="radioOptionPaymentForeign" class="radioOption"></div>
|
||||
<div id="divHiddenTodoFutureSprint" style="display:none">
|
||||
<p><input type="radio" id="RadioExistingPayment" name="TxOptions" value="ExistingPayment" /><label for="RadioExistingPayment"><asp:Label runat="server" ID="LabelRadioExistingPayment" Text="Match this balance to a recorded payment, uploaded in a payments file? XYZ" /></label></p>
|
||||
<div id="radioOptionExistingPayment" class="radioOption">
|
||||
|
||||
@@ -139,6 +139,8 @@ namespace Swarmops.Pages.v5.Support
|
||||
}
|
||||
break;
|
||||
case DocumentType.PersonPhoto:
|
||||
case DocumentType.Logo:
|
||||
case DocumentType.Artwork:
|
||||
{
|
||||
// These are public
|
||||
|
||||
|
||||
@@ -96,6 +96,13 @@
|
||||
<Compile Include="Automation\Json-MasterPersonEditPaymentHistory.aspx.designer.cs">
|
||||
<DependentUpon>Json-MasterPersonEditPaymentHistory.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Automation\OrgFunctions.aspx.cs">
|
||||
<DependentUpon>OrgFunctions.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Automation\OrgFunctions.aspx.designer.cs">
|
||||
<DependentUpon>OrgFunctions.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\v5\Base\AjaxToggleSlider.ascx.cs">
|
||||
<DependentUpon>AjaxToggleSlider.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -669,6 +676,7 @@
|
||||
<Content Include="Automation\Json-PositionsTree.aspx" />
|
||||
<Content Include="Automation\Json-SearchPeoplePattern.aspx" />
|
||||
<Content Include="Automation\Json-TransactionTagsTree.aspx" />
|
||||
<Content Include="Automation\OrgFunctions.aspx" />
|
||||
<Content Include="Automation\SwarmFunctions.aspx" />
|
||||
<Content Include="Controls\v5\Base\AjaxTextBox.ascx" />
|
||||
<Content Include="Controls\v5\Base\AjaxToggleSlider.ascx" />
|
||||
|
||||
Reference in New Issue
Block a user