Refactor: moved responsibility for including the correct script packages to the controls that use them
This commit is contained in:
@@ -27,6 +27,13 @@ public class MasterV5Base : MasterPage
|
||||
public IncludedControl IncludedControlsUsed { get; set; } // as above with IncludedScripts control
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
|
||||
public MasterV5Base()
|
||||
{
|
||||
IncludedControlsUsed = IncludedControl.JsonParameters; // Include this by default to reduce errors
|
||||
}
|
||||
|
||||
|
||||
public DateTime PermissionCacheTimestamp
|
||||
{
|
||||
get
|
||||
|
||||
@@ -41,13 +41,13 @@ public class PageV5Base : Page
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
protected EasyUIControl EasyUIControlsUsed
|
||||
private EasyUIControl EasyUIControlsUsed
|
||||
{
|
||||
get { return Master.EasyUIControlsUsed; }
|
||||
set { Master.EasyUIControlsUsed = value; }
|
||||
}
|
||||
|
||||
public IncludedControl IncludedControlsUsed
|
||||
private IncludedControl IncludedControlsUsed
|
||||
{
|
||||
get { return Master.IncludedControlsUsed; }
|
||||
set { Master.IncludedControlsUsed = value; }
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace Swarmops.Controls.Base
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Init (object sender, EventArgs e)
|
||||
{
|
||||
((PageV5Base) this.Page).RegisterControl (EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
RootGeography = Geography.Root; // set to "world" unless manually set to something else
|
||||
|
||||
@@ -36,6 +36,12 @@ namespace Swarmops.Controls.Base
|
||||
public string ClientUploadCompleteCallback { get; set; }
|
||||
public string ClientUploadStartedCallback { get; set; }
|
||||
|
||||
protected void Page_Init (object sender, EventArgs e)
|
||||
{
|
||||
// cause master to include necessary script
|
||||
((PageV5Base)Page).RegisterControl(IncludedControl.FileUpload);
|
||||
}
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
@@ -64,9 +70,6 @@ namespace Swarmops.Controls.Base
|
||||
{
|
||||
this.GuidString = this.HiddenGuid.Value;
|
||||
}
|
||||
|
||||
((PageV5Base) Page).IncludedControlsUsed |= IncludedControl.FileUpload;
|
||||
// causes master to include necessary script
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ namespace Swarmops.Controls.Financial
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Init (object sender, EventArgs e)
|
||||
{
|
||||
((PageV5Base) this.Page).RegisterControl (EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
protected void Page_Load (object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,10 +23,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tabs;
|
||||
IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.SwitchButton |
|
||||
IncludedControl.JsonParameters;
|
||||
RegisterControl (EasyUIControl.Tabs);
|
||||
RegisterControl (IncludedControl.SwitchButton);
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
{
|
||||
// HACK: The organization part must be removed once proper access control is in place
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.System, AccessType.Write);
|
||||
this.IncludedControlsUsed = IncludedControl.JsonParameters | IncludedControl.SwitchButton;
|
||||
this.PageTitle = Resources.Pages.Admin.SystemSettings_PageTitle;
|
||||
this.InfoBoxLiteral = Resources.Pages.Admin.SystemSettings_Info;
|
||||
|
||||
@@ -39,6 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
}
|
||||
|
||||
RegisterControl (EasyUIControl.Tabs);
|
||||
RegisterControl (IncludedControl.JsonParameters | IncludedControl.SwitchButton);
|
||||
}
|
||||
|
||||
private static string FormatSmtpAccessString (string user, string pass, string host, int port)
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace Swarmops.Frontend.Pages.Comms
|
||||
|
||||
this.TextMessage.Style[HtmlTextWriterStyle.Width] = "674px";
|
||||
this.TextMessage.Style["resize"] = "none";
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tree;
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
PopulateExpenses();
|
||||
// PopulateSalaries();
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
RegisterControl(EasyUIControl.DataGrid);
|
||||
|
||||
this.RepeaterLightboxItems.DataSource = this._documentList;
|
||||
this.RepeaterLightboxItems.DataBind();
|
||||
|
||||
@@ -102,10 +102,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tree;
|
||||
IncludedControlsUsed = IncludedControl.JsonParameters;
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -109,9 +109,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tree;
|
||||
IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.JsonParameters;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Swarmops.Frontend.Pages.Financial
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
RegisterControl (EasyUIControl.DataGrid);
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -31,9 +31,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tree;
|
||||
IncludedControlsUsed = IncludedControl.JsonParameters;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
this._documentList = new List<RepeatedDocument>();
|
||||
|
||||
PopulateExpenses();
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
RegisterControl (EasyUIControl.DataGrid);
|
||||
|
||||
|
||||
this.RepeaterLightboxItems.DataSource = this._documentList;
|
||||
|
||||
@@ -97,8 +97,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
|
||||
DbVersionRequired = 2; // Account reparenting
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
IncludedControlsUsed |= IncludedControl.SwitchButton | IncludedControl.JsonParameters;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
RegisterControl (IncludedControl.SwitchButton);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.DropMonths.SelectedValue = today.Month.ToString (CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers.TaxForms
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
RegisterControl (EasyUIControl.DataGrid | EasyUIControl.Tree);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
Localize();
|
||||
}
|
||||
}
|
||||
EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
RegisterControl (EasyUIControl.DataGrid);
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -38,8 +38,6 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
|
||||
|
||||
this.TextName.Focus();
|
||||
}
|
||||
|
||||
IncludedControlsUsed = IncludedControl.JsonParameters;
|
||||
}
|
||||
|
||||
private void Populate()
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Swarmops.Frontend.Pages.Swarm
|
||||
Localize();
|
||||
}
|
||||
|
||||
EasyUIControlsUsed = EasyUIControl.Tree | EasyUIControl.DataGrid;
|
||||
RegisterControl (EasyUIControl.Tree | EasyUIControl.DataGrid);
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
Reference in New Issue
Block a user