minor refactoring into custom controls
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#ButtonUploadHidden').fileupload({
|
||||
url: '/Automation/UploadFileHandler.ashx',
|
||||
url: '/Automation/UploadFileHandler.ashx?Guid=<%= Guid.ToString() %>',
|
||||
dataType: 'json',
|
||||
done: function(e, data) {
|
||||
$.each(data.result, function(index, file) {
|
||||
@@ -55,5 +55,5 @@
|
||||
|
||||
</script>
|
||||
|
||||
<div style="height:36px;float:left"><input id="ButtonUploadVisible" type="button" style="width:36px !important; background-image:url('/Images/Icons/iconshock-diskette-upload-32px.png');background-repeat:no-repeat; background-position:top left"/><input id="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="DivUploadCount" style="display:none;overflow:hidden;height:64px"></div><div id="DivProgressUpload" style="width:100%;margin-top:8px;display:none"></div></div> <br/>
|
||||
<div style="height:36px;float:left"><input id="ButtonUploadVisible" class="ButtonSwarmopsUpload" type="button" /><input id="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="DivUploadCount" style="display:none;overflow:hidden;height:64px"></div><div id="DivProgressUpload" style="width:100%;margin-top:8px;display:none"></div></div> <br/>
|
||||
|
||||
|
||||
@@ -12,7 +12,40 @@ namespace Swarmops.Controls.Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Guid = new Guid();
|
||||
|
||||
if (Filter == UploadFilter.Unknown) // if not set in control
|
||||
{
|
||||
Filter = UploadFilter.NoFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Guid Guid;
|
||||
public UploadFilter Filter;
|
||||
|
||||
|
||||
public enum UploadFilter
|
||||
{
|
||||
Unknown = 0,
|
||||
/// <summary>
|
||||
/// Do not apply any upload filter. Accept any file.
|
||||
/// </summary>
|
||||
NoFilter,
|
||||
/// <summary>
|
||||
/// Only accept files that successfully load as images.
|
||||
/// </summary>
|
||||
ImagesOnly,
|
||||
/// <summary>
|
||||
/// Only accept files that successfully load as PDFs.
|
||||
/// </summary>
|
||||
PdfOnly,
|
||||
/// <summary>
|
||||
/// Accept either images or PDFs, but none other.
|
||||
/// </summary>
|
||||
ImagesOrPdf
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboBudgets.ascx.cs" Inherits="Swarmops.Controls.Financial.BudgetCombo" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.ClientID %>_DropBudgets').combotree({
|
||||
animate: true,
|
||||
height: 30
|
||||
});
|
||||
|
||||
$('#<%=this.ClientID %>_SpanBudgets span.combo input.combo-text').click(function () {
|
||||
$('#<%=this.ClientID %>_SpanBudgets span.combo span span.combo-arrow').click();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<span id="<%=this.ClientID %>_SpanBudgets"><select class="easyui-combotree" url="/Automation/Json-ExpensableBudgetsTree.aspx" name="DropBudgets" id="<%=this.ClientID %>_DropBudgets" animate="true" style="width:300px"></select></span>
|
||||
@@ -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.Controls.Financial
|
||||
{
|
||||
public partial class BudgetCombo : ControlV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboIncomeCostType.ascx.cs" Inherits="Controls_v5_Financial_ComboIncomeCostType" %>
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Controls_v5_Financial_ComboIncomeCostType : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="FileExpenseClaim.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.FileExpenseClaim" %>
|
||||
<%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %>
|
||||
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts1" Package="easyui" Control="tree" runat="server" />
|
||||
@@ -13,19 +14,12 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#DropBudgets').combotree({
|
||||
animate: true,
|
||||
height: 30
|
||||
}); // Is this init call even necessary?
|
||||
|
||||
|
||||
$('#DropCostTypes').combotree({
|
||||
animate: true,
|
||||
height: 30
|
||||
});
|
||||
|
||||
$('#SpanBudgets span.combo input.combo-text').click(function () {
|
||||
$('#SpanBudgets span.combo span span.combo-arrow').click();
|
||||
});
|
||||
|
||||
$('#SpanCostTypes span.combo input.combo-text').click(function () {
|
||||
$('#SpanCostTypes span.combo span span.combo-arrow').click();
|
||||
@@ -45,7 +39,7 @@
|
||||
isValid = validateTextField('#<%=this.TextClearing.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorBankClearing" />") && isValid;
|
||||
isValid = validateTextField('#<%=this.TextBank.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorBankName" />") && isValid;
|
||||
|
||||
if ($('#DropBudgets').combotree('tree').tree('getSelected') == null) {
|
||||
if ($('#<%=this.ComboBudgets.ClientID %>_DropBudgets').combotree('tree').tree('getSelected') == null) {
|
||||
isValid = false;
|
||||
alertify.error("<asp:Literal runat="server" ID="LiteralErrorBudget" />");
|
||||
}
|
||||
@@ -89,13 +83,13 @@
|
||||
<div class="entryFields">
|
||||
<asp:TextBox runat="server" ID="TextAmount" CssClass="alignRight" /> <br/>
|
||||
<asp:TextBox runat="server" ID="TextPurpose" /> <br/>
|
||||
<span id="SpanBudgets"><select class="easyui-combotree" url="Json-ExpensableBudgetsTree.aspx" name="DropBudgets" id="DropBudgets" animate="true" style="width:300px"></select></span> <br/>
|
||||
<Swarmops5:ComboBudgets ID="ComboBudgets" runat="server" /> <br/>
|
||||
<span id="SpanCostTypes"><select class="easyui-combotree" url="Json-CostTypesTree.aspx" name="DropCostTypes" id="DropCostTypes" animate="true" style="width:300px"></select></span> <br/>
|
||||
<br/><!-- placeholder for label-side H2 -->
|
||||
|
||||
<!-- file upload begins here -->
|
||||
|
||||
<Swarmops5:FileUpload ID="FileUpload" runat="server" />
|
||||
<Swarmops5:FileUpload ID="FileUpload" runat="server" Filter="ImagesOnly" />
|
||||
|
||||
<!-- file upload ends -->
|
||||
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="RequestCashAdvance.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.RequestCashAdvance" %>
|
||||
<%@ Register src="~/Controls/v5/UI/ExternalScripts.ascx" tagname="ExternalScripts" tagprefix="Swarmops5" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts1" Package="easyui" Control="tree" runat="server" />
|
||||
<link rel="stylesheet" type="text/css" href="/Style/v5-easyui-elements.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#DropBudgets').combotree({
|
||||
animate: true,
|
||||
height: 30
|
||||
}); // Is this init call even necessary?
|
||||
|
||||
$('input.combo-text').click(function () {
|
||||
$('span.combo-arrow').click();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function validateFields() {
|
||||
var isValid = true;
|
||||
@@ -26,7 +15,7 @@
|
||||
isValid = validateTextField('#<%=this.TextClearing.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorBankClearing" />") && isValid;
|
||||
isValid = validateTextField('#<%=this.TextBank.ClientID %>', "<asp:Literal runat="server" ID="LiteralErrorBankName" />") && isValid;
|
||||
|
||||
if ($('#DropBudgets').combotree('tree').tree('getSelected') == null) {
|
||||
if ($('#<%=this.ComboBudgets.ClientID %>_DropBudgets').combotree('tree').tree('getSelected') == null) {
|
||||
isValid = false;
|
||||
alertify.error("<asp:Literal runat="server" ID="LiteralErrorBudget" />");
|
||||
}
|
||||
@@ -70,7 +59,7 @@
|
||||
<div class="entryFields">
|
||||
<asp:TextBox runat="server" ID="TextAmount" CssClass="alignRight" /> <br/>
|
||||
<asp:TextBox runat="server" ID="TextPurpose" /> <br/>
|
||||
<select class="easyui-combotree" url="Json-ExpensableBudgetsTree.aspx" name="DropBudgets" id="DropBudgets" animate="true" style="width:300px"></select> <br/>
|
||||
<Swarmops5:ComboBudgets ID="ComboBudgets" runat="server" /> <br/>
|
||||
<br/><!-- placeholder for label-side H2 -->
|
||||
<asp:TextBox runat="server" ID="TextBank" /> <br/>
|
||||
<asp:TextBox runat="server" ID="TextClearing" /> <br/>
|
||||
|
||||
@@ -622,6 +622,10 @@ span.loginalphabetasign
|
||||
}
|
||||
|
||||
|
||||
input.entryError {
|
||||
outline: red ridge 4px;
|
||||
}
|
||||
|
||||
/* DISPLAY FIELDS */
|
||||
|
||||
.displaylabel
|
||||
@@ -900,6 +904,21 @@ hr
|
||||
}
|
||||
|
||||
|
||||
input.ButtonSwarmopsUpload {
|
||||
width:36px !important;
|
||||
background-image:url('/Images/Icons/iconshock-diskette-upload-32px.png');
|
||||
background-repeat:no-repeat;
|
||||
background-position: top left;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
input.ButtonSwarmopsUpload:hover {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
input.ButtonSwarmopsUpload:active {
|
||||
background-position: 2px 2px;
|
||||
}
|
||||
|
||||
/* TELERIK STYLE OVERRIDES */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user