Testing if upload trigger works

This commit is contained in:
Rick Falkvinge
2018-12-12 19:42:18 +01:00
parent 5ae15b1097
commit 547c0256b0
4 changed files with 53 additions and 18 deletions
+4
View File
@@ -102,6 +102,10 @@
}
function <%=this.ClientID%>_triggerUpload() {
$('#<%=this.ClientID %>_ButtonUploadHidden').click();
}
function <%=this.ClientID%>_clear() {
// Note that this only clears the UI -- the uploaded docs must be disassociated elsewhere
$('#<%=this.ClientID%>_DivUploadCount').empty();
+33 -17
View File
@@ -134,25 +134,34 @@
$('img.action-icon[data-item="' + itemId + '"]').hide();
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').show();
SwarmopsJS.ajaxCall(
"/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction,
{},
$.proxy(function() {
var groupId = $(this).attr('data-group');
var itemId = $(this).attr('data-item');
if ($(this).hasClass('is-upload')) {
// Trigger upload, then trigger ajax call on complete
$('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-completed');
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
<%=this.UploadControl.ClientID%>_triggerUpload();
var selector = ".action-list-item:not(.action-list-item-completed):not(.action-list-item-disabled)[data-group='" + groupId + "']";
if ($(selector).length == 0) // no further actions in this group enabled
{
// mark the group as completed
$(".group-status-icon[data-group='" + groupId + "']").fadeIn();
}
}, this)
);
} else {
// Ajax call right away
SwarmopsJS.ajaxCall(
"/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction,
{},
$.proxy(function() {
var groupId = $(this).attr('data-group');
var itemId = $(this).attr('data-item');
$('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-completed');
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
var selector = ".action-list-item:not(.action-list-item-completed):not(.action-list-item-disabled)[data-group='" + groupId + "']";
if ($(selector).length == 0) // no further actions in this group enabled
{
// mark the group as completed
$(".group-status-icon[data-group='" + groupId + "']").fadeIn();
}
}, this)
);
}
});
@@ -170,6 +179,12 @@
});
function clientPostUpload(callbackFunction, cookie) {
}
var uploadGuid = '<%=this.UploadControl.GuidString%>';
// Function: Match all mismatched transactions
// Function: Upload bank statement PDF for accountId x
@@ -255,6 +270,7 @@
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<h2><asp:Label runat="server" ID="LabelHeader"></asp:Label></h2>
<div style="display: none"><Swarmops5:FileUpload ID="UploadControl" runat="server"/></div>
<table id="TableEomItems" class="easyui-datagrid" style="width:680px;height:500px"
data-options="rownumbers:false,singleSelect:false,nowrap:false,fit:false,loading:false,selectOnCheck:false,checkOnSelect:false"
+7 -1
View File
@@ -180,6 +180,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
string itemName = Server.HtmlEncode(item.Name);
string itemDisabledClass = string.Empty;
string iconDisabledClass = string.Empty;
string iconIsUploadClass = string.Empty;
if (item.DependsOn.Length > 0)
{
@@ -194,10 +195,15 @@ namespace Swarmops.Frontend.Pages.Ledgers
Server.HtmlEncode(Resources.Global.Global_SkipThis) + "</a>)</span>";
}
if (item.Icon == "upload")
{
iconIsUploadClass = " is-upload";
}
builder.Append(@"
$('#TableEomItems').datagrid('appendRow', {
itemName: ""<span class='action-list-item" + itemDisabledClass + @"' data-item='" + item.Id + @"' data-dependson='" + item.DependsOn + @"' data-group='" + group.Id + @"'>" + itemName + @"</span>"",
action: ""<img src='/Images/Icons/transparency-16px.png' data-item='" + item.Id + @"' data-group='" + group.Id + @"' class='action action-icon eomitem-" + item.Icon + iconDisabledClass + @"' data-callback='" + item.Callback + @"' data-dependson='" + item.DependsOn + @"' /><img src='/Images/Abstract/ajaxloader-48x36px.gif' data-group='" + group.Id + @"' class='status-icon status-icon-pleasewait' data-item='" + item.Id + @"' style='display:none' /><img src='/Images/Icons/iconshock-green-tick-128x96px.png' data-group='" + group.Id + @"' class='status-icon status-icon-completed' data-item='" + item.Id + @"' style='display:none' />""
action: ""<img src='/Images/Icons/transparency-16px.png' data-item='" + item.Id + @"' data-group='" + group.Id + @"' class='action action-icon eomitem-" + item.Icon + iconIsUploadClass + iconDisabledClass + @"' data-callback='" + item.Callback + @"' data-dependson='" + item.DependsOn + @"' /><img src='/Images/Abstract/ajaxloader-48x36px.gif' data-group='" + group.Id + @"' class='status-icon status-icon-pleasewait' data-item='" + item.Id + @"' style='display:none' /><img src='/Images/Icons/iconshock-green-tick-128x96px.png' data-group='" + group.Id + @"' class='status-icon status-icon-completed' data-item='" + item.Id + @"' style='display:none' />""
});
");
}
+9
View File
@@ -20,5 +20,14 @@ namespace Swarmops.Frontend.Pages.Ledgers {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelHeader;
/// <summary>
/// UploadControl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Controls.Base.FileUpload UploadControl;
}
}