More work on bank import UX

This commit is contained in:
Rick Falkvinge
2011-12-31 06:16:46 +00:00
parent d43bbb630d
commit 2acf08a162
2 changed files with 57 additions and 20 deletions
+46 -12
View File
@@ -85,7 +85,37 @@ div.BankUploadInstructionsImage
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional">
<script type="text/javascript">
//<![CDATA[
var uploadInProgress = 0;
function onClientProgressBarUpdating(progressArea, args) {
//alert(JSON.stringify(args._progressData));
//alert(args._progrssData.PrimaryPercent);
$("#ProgressBar").css('width', args._progressData.PrimaryPercent);
progressArea.updateVerticalProgressBar(args.get_progressBarElement(), args.get_progressValue());
if (uploadInProgress == 0) {
uploadInProgress = 1;
$("#DivUploadProgress").css("display", "inline");
$("#DivUploadProgress").fadeTo('slow', 1.0);
$("#DivInstructions").animate({ height: 'toggle' }, 1000);
$("#DivInstructions").fadeTo('fast', 0.0);
$("#<%= this.DropAccounts.ClientID %>").attr('disabled', 'disabled');
}
args.set_cancel(true);
}
//]]>
</script>
<asp:UpdatePanel ID="PanelFileTypeAccount" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<h2><asp:Label ID="LabelSelectBankUploadFilter" Text="Select Bank And Bookkeeping" runat="server"/></h2>
<h3><asp:Label ID="LabelBank" Text="Bank" runat="server" /></h3>
@@ -103,14 +133,17 @@ div.BankUploadInstructionsImage
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="PanelProgress" runat="server" Visible="false">
<ContentTemplate>
<br/><h2><asp:Label ID="LabelProcessing" runat="server" Text="Processing Uploaded File..." /></h2>
<asp:Panel ID="PanelResults" Visible="false" runat="server">
<h2><asp:Label ID="LabelProcessingResults" Text="Imported a Bank File" runat="server" /></h2>
<p>Todo...</p>
</asp:Panel>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
<div style="opacity:0;display:none" id="DivUploadProgress">
<br/><h2><asp:Label ID="LabelProcessing" runat="server" Text="Processing Uploaded File..." /></h2>
<div style="width:100%;border:1px solid #E0E0E0;border-radius:5px;box-shadow:1px 1px 3px 3px #888">
<div id="ProgressBar" style="width:100%;margin:3px;border:1px solid #88F;border-radius:2px;height:2px;background-color:#CCF"></div>
</div>
</div>
<div style="opacity:0;display:none;padding-top:20px" id="DivInstructions">
<asp:UpdatePanel ID="PanelInstructions" UpdateMode="Conditional" runat="server">
@@ -130,15 +163,15 @@ div.BankUploadInstructionsImage
<input type="file" id="file1" runat="server" name="file1" /><br />
<asp:Button ID="Upload" OnClick="Submit_Click" Text="Upload" runat="server" />
<div style="display:none"><!-- placeholders for Telerik to feel important -->
<telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
<telerik:RadProgressArea ID="ProgressIndicator" runat="server" ProgressIndicators="TotalProgressPercent">
<telerik:RadProgressArea ID="ProgressIndicator" runat="server" OnClientProgressBarUpdating="onClientProgressBarUpdating">
<ProgressTemplate>
<ul class="ruProgress">
<li>
<h6>TotalProgressBar:</h6>
<div class="customProgressBar" style="position: relative; height: 168px; width: 168px;">
<div id="SecondaryProgressBarInnerDiv" runat="server" style="background-color: Blue;
height: 0%; width: 168px; vertical-align: bottom; position: absolute; top: 0;
<div id="PrimaryProgressBarInnerDiv" runat="server" style="background-color: Blue;
height: 0%; width: 200px; vertical-align: bottom; position: absolute; top: 0;
left: 0; z-index: 900;">
<!-- / -->
</div>
@@ -157,6 +190,7 @@ div.BankUploadInstructionsImage
</ul>
</ProgressTemplate>
</telerik:RadProgressArea>
</div>
</div>
<div id="ModalDownloadInstructions">
+11 -8
View File
@@ -48,10 +48,10 @@ namespace Activizr.Site.Pages.Ledgers
this.ButtonSebAccountFile.CssClass = "FileTypeImage FileTypeImageSelected";
this.ButtonSebPaymentFile.CssClass = "FileTypeImage UnselectedType";
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "FadeType", "$(\".UnselectedType\").fadeTo('fast',0.2);", true);
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "FadeAccount1",
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "FadeType", "$(\".UnselectedType\").fadeTo('fast',0.2);", true);
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "FadeAccount1",
"$(\"#DivSelectAccount\").fadeTo('slow', 1.0);", true);
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "FadeAccount2",
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "FadeAccount2",
"$(\"#DivSelectAccount\").css('display','inline');", true);
PopulateAccountDropDown();
@@ -91,11 +91,11 @@ namespace Activizr.Site.Pages.Ledgers
if (this.DropAccounts.SelectedIndex > -2)
{
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "FadeDownload2",
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "FadeDownload2",
"$(\"#DivInstructions\").fadeTo('slow',1.0);", true);
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "ShowInstructions",
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "ShowInstructions",
"$(\"#DivInstructions\").css('display','inline');", true);
ScriptManager.RegisterClientScriptBlock(this.Panel1, this.Panel1.GetType(), "ReiterateModality",
ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "ReiterateModality",
"$(function () { $(\"a[rel*=leanModal]\").leanModal();});", true);
@@ -108,8 +108,6 @@ namespace Activizr.Site.Pages.Ledgers
{
foreach (string fileInputID in Request.Files)
{
this.PanelProgress.Visible = true;
UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[fileInputID]);
if (file.ContentLength > 0)
{
@@ -127,9 +125,12 @@ namespace Activizr.Site.Pages.Ledgers
for (int i = 0; i < total; i++)
{
progress["PrimaryPercent"] = i.ToString() + "%";
progress["SecondaryTotal"] = total.ToString();
progress["SecondaryValue"] = i.ToString();
progress["SecondaryPercent"] = i.ToString();
progress["PrimaryProgressBarInnerDiv"] = i.ToString();
progress["CurrentOperationText"] = "File is being processed...";
if (!Response.IsClientConnected)
@@ -142,6 +143,8 @@ namespace Activizr.Site.Pages.Ledgers
System.Threading.Thread.Sleep(100);
}
this.PanelFileTypeAccount.Visible = false;
this.PanelResults.Visible = true;
}
}