Refactored how EasyUI is included
This commit is contained in:
@@ -108,4 +108,39 @@ public class CommonV5Base
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public enum EasyUIControl
|
||||
{
|
||||
Unknown = 0,
|
||||
Accordion = 0x0000001,
|
||||
Calendar = 0x0000002,
|
||||
Combo = 0x0000004,
|
||||
ComboBox = 0x0000008,
|
||||
DataGrid = 0x0000010,
|
||||
DateBox = 0x0000020,
|
||||
Dialog = 0x0000040,
|
||||
FileBox = 0x0000080,
|
||||
Layout = 0x0000100,
|
||||
LinkButton = 0x0000200,
|
||||
Menu = 0x0000400,
|
||||
MenuButton = 0x0000800,
|
||||
Messager = 0x0001000,
|
||||
NumberBox = 0x0002000,
|
||||
Pagination = 0x0004000,
|
||||
Panel = 0x0008000,
|
||||
ProgressBar = 0x0010000,
|
||||
PropertyGrid = 0x0020000,
|
||||
SearchBox = 0x0040000,
|
||||
Slider = 0x0080000,
|
||||
Spinner = 0x0100000,
|
||||
SplitButton = 0x0200000,
|
||||
Tabs = 0x0400000,
|
||||
TextBox = 0x0800000,
|
||||
ToolTip = 0x1000000,
|
||||
Tree = 0x2000000,
|
||||
ValidateBox = 0x4000000,
|
||||
Window = 0x8000000
|
||||
};
|
||||
|
||||
@@ -18,10 +18,14 @@ public class MasterV5Base : System.Web.UI.MasterPage
|
||||
|
||||
public string CurrentPageInfoBoxLiteral = string.Empty;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
protected Person _currentUser = null; // These are set in Master-v5.master.cs
|
||||
protected Authority _authority = null;
|
||||
protected Organization _currentOrganization = null;
|
||||
|
||||
public EasyUIControl EasyUIControlsUsed { get; set; } // these are set by each page, and called by Master to render in ExternalScripts control
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
public DateTime PermissionCacheTimestamp
|
||||
{
|
||||
get
|
||||
|
||||
@@ -44,6 +44,13 @@ public class PageV5Base : System.Web.UI.Page
|
||||
set { this.Master.CurrentPageInfoBoxLiteral = value; }
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
protected EasyUIControl EasyUIControlsUsed
|
||||
{
|
||||
get { return this.Master.EasyUIControlsUsed; }
|
||||
set { this.Master.EasyUIControlsUsed = value; }
|
||||
}
|
||||
|
||||
protected Person CurrentUser
|
||||
{
|
||||
get { return this.Master.CurrentUser; }
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ExternalScripts.ascx.cs" Inherits="Swarmops.Frontend.Controls.v5.UI.ExternalScripts" %>
|
||||
|
||||
<asp:Literal ID="LiteralReference1" runat="server" />
|
||||
<asp:Literal ID="LiteralReference2" runat="server" />
|
||||
<asp:Literal ID="LiteralReference3" runat="server" />
|
||||
<asp:Literal ID="LiteralReference4" runat="server" />
|
||||
<asp:Literal ID="LiteralReference5" runat="server" />
|
||||
<asp:Literal ID="LiteralReference" runat="server" />
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NBitcoin;
|
||||
using Swarmops.Logic.Support;
|
||||
|
||||
namespace Swarmops.Frontend.Controls.v5.UI
|
||||
{
|
||||
@@ -14,23 +17,31 @@ namespace Swarmops.Frontend.Controls.v5.UI
|
||||
{
|
||||
externalScriptUrl = "/Scripts/ExternalScripts";
|
||||
}
|
||||
else if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
externalScriptUrl += "/staging"; // use staging area for new script versions on Sandbox
|
||||
}
|
||||
|
||||
if (Package == "easyui")
|
||||
{
|
||||
this.LiteralReference1.Text = "<script src=\"" + externalScriptUrl +
|
||||
"/easyui/jquery.easyui.min.js\" type=\"text/javascript\"></script>";
|
||||
this.LiteralReference2.Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/icon.css\" />";
|
||||
this.LiteralReference3.Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/default/" + this.Control + ".css\" />";
|
||||
this.LiteralReference4.Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/default/datagrid.css\" />";
|
||||
this.LiteralReference5.Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/default/tree.css\" />";
|
||||
StringBuilder scriptRef = new StringBuilder();
|
||||
|
||||
scriptRef.Append("<script src=\"" + externalScriptUrl +
|
||||
"/easyui/jquery.easyui.min.js\" type=\"text/javascript\"></script>\r\n");
|
||||
scriptRef.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/icon.css\" />\r\n");
|
||||
string[] controlNames = Controls.Split(',');
|
||||
foreach (string controlName in controlNames)
|
||||
{
|
||||
scriptRef.AppendFormat("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + externalScriptUrl +
|
||||
"/easyui/themes/default/{0}.css\" />\r\n", controlName.Trim().ToLowerInvariant());
|
||||
}
|
||||
|
||||
this.LiteralReference.Text = scriptRef.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string Package { get; set; }
|
||||
public string Control { get; set; }
|
||||
public string Controls { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" />
|
||||
|
||||
<!-- external packages that are commonly used (on practically all pages) -->
|
||||
<Swarmops5:ExternalScripts ID="ScriptEasyUI" Package="easyui" runat="server" />
|
||||
<Swarmops5:ExternalScripts ID="ExternalScriptEasyUI" Package="easyui" runat="server" />
|
||||
|
||||
<!-- additional scripts etc from individual pages -->
|
||||
<asp:ContentPlaceHolder id="PlaceHolderHead" runat="server" />
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace Swarmops
|
||||
this.LabelPageTitle.Text = this.CurrentPageTitle;
|
||||
this.Page.Title = "Swarmops - " + this.CurrentPageTitle;
|
||||
|
||||
this.ExternalScriptEasyUI.Controls = EasyUIControlsUsed.ToString();
|
||||
|
||||
this.LiteralSidebarInfo.Text = this.CurrentPageInfoBoxLiteral;
|
||||
|
||||
// Set logo image. If custom image is installed, use it instead.
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
PopulateExpenses();
|
||||
// PopulateSalaries();
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
|
||||
this.RepeaterLightboxItems.DataSource = _documentList;
|
||||
this.RepeaterLightboxItems.DataBind();
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace Swarmops.Frontend.Pages.Financial
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
_documentList = new List<RepeatedDocument>();
|
||||
|
||||
PopulateExpenses();
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
|
||||
|
||||
this.RepeaterLightboxItems.DataSource = _documentList;
|
||||
this.RepeaterLightboxItems.DataBind();
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
}
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
|
||||
this.DbVersionRequired = 2; // Account reparenting
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.DropMonths.SelectedValue = today.Month.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ public partial class Pages_v5_Ledgers_ProfitLossStatement : PageV5Base
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -72,6 +72,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid | EasyUIControl.Tree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
}
|
||||
|
||||
}
|
||||
this.EasyUIControlsUsed = EasyUIControl.DataGrid;
|
||||
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Swarmops.Frontend.Pages.Swarm
|
||||
Localize();
|
||||
}
|
||||
|
||||
|
||||
this.EasyUIControlsUsed = EasyUIControl.Tree;
|
||||
}
|
||||
|
||||
private void Localize()
|
||||
|
||||
Reference in New Issue
Block a user