New WebApp with net5. Only compiles.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,6 +6,6 @@
|
||||
Dotfuscated/*
|
||||
Published/*
|
||||
|
||||
VAR.Focus.Web/priv/*.json
|
||||
VAR.Focus.WebApp/priv/*.json
|
||||
.vs
|
||||
packages/*
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
|
||||
namespace VAR.Focus.Web.Code
|
||||
{
|
||||
public class WebSessions
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private static WebSessions _currentInstance = null;
|
||||
|
||||
private string _cookieName = "FocusSID";
|
||||
private int _cookieExpirationDays = 30;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
public static WebSessions Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_currentInstance == null)
|
||||
{
|
||||
_currentInstance = new WebSessions();
|
||||
}
|
||||
return _currentInstance;
|
||||
}
|
||||
set { _currentInstance = value; }
|
||||
}
|
||||
|
||||
public string CookieName
|
||||
{
|
||||
get { return _cookieName; }
|
||||
set { _cookieName = value; }
|
||||
}
|
||||
|
||||
public int CookieExpirationDays
|
||||
{
|
||||
get { return _cookieExpirationDays; }
|
||||
set { _cookieExpirationDays = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Public methods
|
||||
|
||||
public void Session_SetCookie(HttpContext context, Session session)
|
||||
{
|
||||
HttpCookie cookie = new HttpCookie(_cookieName, session.SessionToken);
|
||||
cookie.Expires = DateTime.Now.AddDays(_cookieExpirationDays);
|
||||
context.Response.Cookies.Add(cookie);
|
||||
}
|
||||
|
||||
public void Session_Init(HttpContext context, string userName)
|
||||
{
|
||||
Session session = Sessions.Current.Session_Create(userName);
|
||||
Session_SetCookie(context, session);
|
||||
}
|
||||
|
||||
public Session Session_GetCurrent(HttpContext context)
|
||||
{
|
||||
HttpCookie cookie = context.Request.Cookies[_cookieName];
|
||||
if (cookie == null) { return null; }
|
||||
|
||||
string sessionToken = cookie.Value;
|
||||
if (string.IsNullOrEmpty(sessionToken)) { return null; }
|
||||
|
||||
Session session = Sessions.Current.Session_GetByToken(sessionToken);
|
||||
return session;
|
||||
}
|
||||
|
||||
public bool Session_FinalizeCurrent(HttpContext context)
|
||||
{
|
||||
Session session = Session_GetCurrent(context);
|
||||
if (Sessions.Current.Session_Delete(session) == false) { return false; }
|
||||
|
||||
HttpCookie cookie = new HttpCookie(_cookieName);
|
||||
cookie.Expires = DateTime.Now.AddDays(-1d);
|
||||
context.Response.Cookies.Add(cookie);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Session_IsUserAuthenticated(HttpContext context)
|
||||
{
|
||||
Session session = Session_GetCurrent(context);
|
||||
if (session == null) { return false; }
|
||||
User user = Users.Current.User_GetByName(session.UserName);
|
||||
if (user == null) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
public User Session_GetCurrentUser(HttpContext context)
|
||||
{
|
||||
Session session = Session_GetCurrent(context);
|
||||
if (session == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
User user = Users.Current.User_GetByName(session.UserName);
|
||||
return user;
|
||||
}
|
||||
|
||||
#endregion Public methods
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Focus.Web.Pages;
|
||||
using VAR.Json;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.Focus.Web.Controls
|
||||
{
|
||||
public class CtrCardBoard : Control, INamingContainer
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private string _serviceUrl = nameof(HndCardBoard);
|
||||
|
||||
private int _idBoard = 0;
|
||||
|
||||
private string _userName = string.Empty;
|
||||
|
||||
private int _timePoolData = 10000;
|
||||
|
||||
private int _timeRefresh = 20;
|
||||
|
||||
private int _timeRefreshDisconnected = 5000;
|
||||
|
||||
private int _timeMoveAnimation = 500;
|
||||
|
||||
private int _defaultCardWidth = 200;
|
||||
|
||||
private int _defaultCardHeight = 150;
|
||||
|
||||
private int _defaultRegionWidth = 300;
|
||||
|
||||
private int _defaultRegionHeight = 500;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
public string ServiceUrl
|
||||
{
|
||||
get { return _serviceUrl; }
|
||||
set { _serviceUrl = value; }
|
||||
}
|
||||
|
||||
public int IDBoard
|
||||
{
|
||||
get { return _idBoard; }
|
||||
set { _idBoard = value; }
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get { return _userName; }
|
||||
set { _userName = value; }
|
||||
}
|
||||
|
||||
public int TimePoolData
|
||||
{
|
||||
get { return _timePoolData; }
|
||||
set { _timePoolData = value; }
|
||||
}
|
||||
|
||||
public int TimeRefresh
|
||||
{
|
||||
get { return _timeRefresh; }
|
||||
set { _timeRefresh = value; }
|
||||
}
|
||||
|
||||
public int TimeRefreshDisconnected
|
||||
{
|
||||
get { return _timeRefreshDisconnected; }
|
||||
set { _timeRefreshDisconnected = value; }
|
||||
}
|
||||
|
||||
public int TimeMoveAnimation
|
||||
{
|
||||
get { return _timeMoveAnimation; }
|
||||
set { _timeMoveAnimation = value; }
|
||||
}
|
||||
|
||||
private int DefaultCardWidth
|
||||
{
|
||||
get { return _defaultCardWidth; }
|
||||
set { _defaultCardWidth = value; }
|
||||
}
|
||||
|
||||
private int DefaultCardHeight
|
||||
{
|
||||
get { return _defaultCardHeight; }
|
||||
set { _defaultCardHeight = value; }
|
||||
}
|
||||
|
||||
private int DefaultRegionWidth
|
||||
{
|
||||
get { return _defaultRegionWidth; }
|
||||
set { _defaultRegionWidth = value; }
|
||||
}
|
||||
|
||||
private int DefaultRegionHeight
|
||||
{
|
||||
get { return _defaultRegionHeight; }
|
||||
set { _defaultRegionHeight = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Control Life cycle
|
||||
|
||||
public CtrCardBoard()
|
||||
{
|
||||
Init += ChatControl_Init;
|
||||
}
|
||||
|
||||
private void ChatControl_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitializeControls();
|
||||
}
|
||||
|
||||
#endregion Control Life cycle
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void InitializeControls()
|
||||
{
|
||||
Panel divBoard = new Panel { ID = "divBoard", CssClass = "divBoard" };
|
||||
Controls.Add(divBoard);
|
||||
|
||||
string strCfgName = string.Format("{0}_cfg", ClientID);
|
||||
Dictionary<string, object> cfg = new Dictionary<string, object>
|
||||
{
|
||||
{"divBoard", divBoard.ClientID},
|
||||
{"IDBoard", _idBoard},
|
||||
{"UserName", _userName},
|
||||
{"EditBoardUrl", FrmBoardEdit.GetUrl(_idBoard)},
|
||||
{"IDCardEvent", string.Empty},
|
||||
{"ServiceUrl", _serviceUrl},
|
||||
{"TimePoolData", _timePoolData},
|
||||
{"TimeRefresh", _timeRefresh},
|
||||
{"TimeRefreshDisconnected", _timeRefreshDisconnected},
|
||||
{"TimeMoveAnimation", _timeMoveAnimation},
|
||||
{"DefaultCardWidth", _defaultCardWidth},
|
||||
{"DefaultCardHeight", _defaultCardHeight},
|
||||
{"DefaultRegionWidth", _defaultRegionWidth},
|
||||
{"DefaultRegionHeight", _defaultRegionHeight},
|
||||
{"Texts", new Dictionary<string, object> {
|
||||
{"Toolbox", MultiLang.GetLiteral( "Toolbox")},
|
||||
{"AddCard", MultiLang.GetLiteral("AddCard")},
|
||||
{"AddRegion", MultiLang.GetLiteral("AddRegion")},
|
||||
{"EditBoard", MultiLang.GetLiteral("Config")},
|
||||
{"Accept", MultiLang.GetLiteral("Accept")},
|
||||
{"Cancel", MultiLang.GetLiteral("Cancel")},
|
||||
{"ConfirmDelete", MultiLang.GetLiteral("ConfirmDelete")},
|
||||
} },
|
||||
};
|
||||
StringBuilder sbCfg = new StringBuilder();
|
||||
sbCfg.AppendFormat("<script>\n");
|
||||
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, JsonWriter.WriteObject(cfg));
|
||||
sbCfg.AppendFormat("RunCardBoard({0});\n", strCfgName);
|
||||
sbCfg.AppendFormat("</script>\n");
|
||||
LiteralControl liScript = new LiteralControl(sbCfg.ToString());
|
||||
Controls.Add(liScript);
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Json;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.Focus.Web.Controls
|
||||
{
|
||||
public class CtrChat : Control, INamingContainer
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private string _serviceUrl = nameof(HndChat);
|
||||
|
||||
private string _idMessageBoard = null;
|
||||
|
||||
private string _userName = string.Empty;
|
||||
|
||||
private int _timePoolData = 10000;
|
||||
|
||||
private Unit _width = new Unit(500, UnitType.Pixel);
|
||||
private Unit _height = new Unit(300, UnitType.Pixel);
|
||||
|
||||
private Panel _divChatWindow = null;
|
||||
private Panel _divChatContainer = null;
|
||||
private Panel _divChatTitleBar = null;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
public string ServiceUrl
|
||||
{
|
||||
get { return _serviceUrl; }
|
||||
set { _serviceUrl = value; }
|
||||
}
|
||||
|
||||
public string IDMessageBoard
|
||||
{
|
||||
get { return _idMessageBoard; }
|
||||
set { _idMessageBoard = value; }
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get { return _userName; }
|
||||
set { _userName = value; }
|
||||
}
|
||||
|
||||
public int TimePoolData
|
||||
{
|
||||
get { return _timePoolData; }
|
||||
set { _timePoolData = value; }
|
||||
}
|
||||
|
||||
public Unit Width
|
||||
{
|
||||
get { return _width; }
|
||||
set
|
||||
{
|
||||
_width = value;
|
||||
if (_divChatContainer != null)
|
||||
{
|
||||
_divChatContainer.Width = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Unit Height
|
||||
{
|
||||
get { return _height; }
|
||||
set
|
||||
{
|
||||
_height = value;
|
||||
if (_divChatContainer != null)
|
||||
{
|
||||
_divChatContainer.Height = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Control Life cycle
|
||||
|
||||
public CtrChat()
|
||||
{
|
||||
Init += ChatControl_Init;
|
||||
}
|
||||
|
||||
private void ChatControl_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitializeControls();
|
||||
}
|
||||
|
||||
#endregion Control Life cycle
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void InitializeControls()
|
||||
{
|
||||
string strCfgName = string.Format("{0}_cfg", ClientID);
|
||||
|
||||
_divChatWindow = new Panel { ID = "divChatWindow", CssClass = "divChatWindow" };
|
||||
Controls.Add(_divChatWindow);
|
||||
|
||||
_divChatTitleBar = new Panel { ID = "divChatTitleBar", CssClass = "divChatTitleBar" };
|
||||
_divChatWindow.Controls.Add(_divChatTitleBar);
|
||||
|
||||
CLabel lblTitle = new CLabel();
|
||||
lblTitle.ID = "lblTitle";
|
||||
_divChatTitleBar.Controls.Add(lblTitle);
|
||||
|
||||
_divChatContainer = new Panel { ID = "divChatContainer", CssClass = "divChatContainer" };
|
||||
_divChatWindow.Controls.Add(_divChatContainer);
|
||||
_divChatContainer.Width = 0;
|
||||
_divChatContainer.Height = 0;
|
||||
|
||||
var divChat = new Panel { ID = "divChat", CssClass = "divChat" };
|
||||
_divChatContainer.Controls.Add(divChat);
|
||||
|
||||
var divChatControls = new Panel { ID = "divChatControls", CssClass = "divChatControls" };
|
||||
_divChatContainer.Controls.Add(divChatControls);
|
||||
|
||||
var txtText = new TextBox { ID = "txtText", CssClass = "chatTextBox" };
|
||||
txtText.Attributes.Add("autocomplete", "off");
|
||||
txtText.Attributes.Add("onkeydown", string.Format("if(event.keyCode==13){{SendChat({0}); return false;}}", strCfgName));
|
||||
divChatControls.Controls.Add(txtText);
|
||||
|
||||
var btnSend = new Button { ID = "btnSend", Text = MultiLang.GetLiteral("ChatSend"), CssClass = "chatButton" };
|
||||
divChatControls.Controls.Add(btnSend);
|
||||
btnSend.Attributes.Add("onclick", string.Format("SendChat({0}); return false;", strCfgName));
|
||||
|
||||
Dictionary<string, object> cfg = new Dictionary<string, object>
|
||||
{
|
||||
{"divChatWindow", _divChatWindow.ClientID},
|
||||
{"divChatTitleBar", _divChatTitleBar.ClientID},
|
||||
{"lblTitle", lblTitle.ClientID},
|
||||
{"divChatContainer", _divChatContainer.ClientID},
|
||||
{"divChatContainerWidth", _width.ToString()},
|
||||
{"divChatContainerHeight", _height.ToString()},
|
||||
{"divChat", divChat.ClientID},
|
||||
{"txtText", txtText.ClientID},
|
||||
{"btnSend", btnSend.ClientID},
|
||||
{"IDMessageBoard", _idMessageBoard},
|
||||
{"UserName", _userName},
|
||||
{"IDMessage", 0},
|
||||
{"ServiceUrl", _serviceUrl},
|
||||
{"TimePoolData", _timePoolData},
|
||||
{"Texts", new Dictionary<string, object> {
|
||||
{"Chat", MultiLang.GetLiteral("Chat")},
|
||||
{"Close", MultiLang.GetLiteral("ChatClose")},
|
||||
{"NewMessages", MultiLang.GetLiteral("ChatNewMessages")},
|
||||
{"Disconnected", MultiLang.GetLiteral("Disconnected")},
|
||||
} },
|
||||
};
|
||||
StringBuilder sbCfg = new StringBuilder();
|
||||
sbCfg.AppendFormat("<script>\n");
|
||||
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, JsonWriter.WriteObject(cfg));
|
||||
sbCfg.AppendFormat("RunChat({0});\n", strCfgName);
|
||||
sbCfg.AppendFormat("</script>\n");
|
||||
LiteralControl liScript = new LiteralControl(sbCfg.ToString());
|
||||
Controls.Add(liScript);
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
using VAR.Focus.BusinessLogic.Persistence;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.Focus.Web.Controls
|
||||
{
|
||||
public class HndCardBoard : IHttpHandler
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private const int MaxWaitLoops = 5;
|
||||
|
||||
private static object _monitor = new object();
|
||||
private static Dictionary<int, CardBoard> _cardBoards = new Dictionary<int, CardBoard>();
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (context.Request.RequestType == "GET")
|
||||
{
|
||||
if (string.IsNullOrEmpty(context.GetRequestParm("IDCardEvent")))
|
||||
{
|
||||
ProcessInitializationReciver(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessEventReciver(context);
|
||||
}
|
||||
}
|
||||
if (context.Request.RequestType == "POST")
|
||||
{
|
||||
ProcessEventSender(context);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
context.ResponseObject(new OperationStatus { IsOK = false, Message = ex.Message, });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void ProcessInitializationReciver(HttpContext context)
|
||||
{
|
||||
int idBoard = Convert.ToInt32(context.GetRequestParm("IDBoard"));
|
||||
CardBoard cardBoard;
|
||||
if (_cardBoards.ContainsKey(idBoard) == false)
|
||||
{
|
||||
lock (_cardBoards)
|
||||
{
|
||||
if (_cardBoards.ContainsKey(idBoard) == false)
|
||||
{
|
||||
cardBoard = new CardBoard(idBoard, new JsonFilePersistence());
|
||||
_cardBoards[idBoard] = cardBoard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_cardBoards.ContainsKey(idBoard))
|
||||
{
|
||||
cardBoard = _cardBoards[idBoard];
|
||||
List<Card> listCards = cardBoard.Cards_Status();
|
||||
List<Region> listRegions = cardBoard.Regions_Status();
|
||||
List<IBoardEvent> listEvents = new List<IBoardEvent>();
|
||||
int lastIDCardEvent = cardBoard.GetLastIDCardEvent();
|
||||
int lastIDCard = cardBoard.GetLastIDCard();
|
||||
listEvents = new List<IBoardEvent>();
|
||||
if (listRegions.Count > 0)
|
||||
{
|
||||
listEvents.AddRange(CardBoard.ConvertRegionsToEvents(listRegions, lastIDCardEvent));
|
||||
}
|
||||
if (listCards.Count > 0)
|
||||
{
|
||||
listEvents.AddRange(CardBoard.ConvertCardsToEvents(listCards, lastIDCardEvent));
|
||||
}
|
||||
context.ResponseObject(listEvents);
|
||||
}
|
||||
}
|
||||
|
||||
private CardBoard GetCardBoard(int idBoard)
|
||||
{
|
||||
CardBoard cardBoard = null;
|
||||
if (_cardBoards.ContainsKey(idBoard) == false)
|
||||
{
|
||||
lock (_cardBoards)
|
||||
{
|
||||
if (_cardBoards.ContainsKey(idBoard) == false)
|
||||
{
|
||||
cardBoard = new CardBoard(idBoard, new JsonFilePersistence());
|
||||
_cardBoards[idBoard] = cardBoard;
|
||||
}
|
||||
}
|
||||
}
|
||||
cardBoard = _cardBoards[idBoard];
|
||||
return cardBoard;
|
||||
}
|
||||
|
||||
private void ProcessEventReciver(HttpContext context)
|
||||
{
|
||||
int idBoard = Convert.ToInt32(context.GetRequestParm("IDBoard"));
|
||||
int idCardEvent = Convert.ToInt32(context.GetRequestParm("IDCardEvent"));
|
||||
string strTimePoolData = context.GetRequestParm("TimePoolData");
|
||||
int timePoolData = Convert.ToInt32(string.IsNullOrEmpty(strTimePoolData) ? "0" : strTimePoolData);
|
||||
|
||||
CardBoard cardBoard = GetCardBoard(idBoard);
|
||||
int waitCount = (timePoolData > 0) ? MaxWaitLoops : 0;
|
||||
do
|
||||
{
|
||||
List<IBoardEvent> listMessages = cardBoard.Cards_GetEventList(idCardEvent);
|
||||
if (listMessages.Count > 0)
|
||||
{
|
||||
waitCount = 0;
|
||||
context.ResponseObject(listMessages);
|
||||
return;
|
||||
}
|
||||
|
||||
if (waitCount > 0)
|
||||
{
|
||||
lock (_monitor) { Monitor.Wait(_monitor, timePoolData); }
|
||||
waitCount--;
|
||||
}
|
||||
} while (waitCount > 0);
|
||||
context.ResponseObject(new List<Message>());
|
||||
}
|
||||
|
||||
private void ProcessEventSender(HttpContext context)
|
||||
{
|
||||
Session session = WebSessions.Current.Session_GetCurrent(context);
|
||||
string currentUserName = session.UserName;
|
||||
string strIDBoard = context.GetRequestParm("IDBoard");
|
||||
int idBoard = Convert.ToInt32(string.IsNullOrEmpty(strIDBoard) ? "0" : strIDBoard);
|
||||
string command = context.GetRequestParm("Command");
|
||||
int idCard = 0;
|
||||
int idRegion = 0;
|
||||
bool done = false;
|
||||
CardBoard cardBoard = GetCardBoard(idBoard);
|
||||
lock (cardBoard)
|
||||
{
|
||||
if (command == "CardCreate")
|
||||
{
|
||||
string title = context.GetRequestParm("Title");
|
||||
string body = context.GetRequestParm("Body");
|
||||
int x = Convert.ToInt32(context.GetRequestParm("X"));
|
||||
int y = Convert.ToInt32(context.GetRequestParm("Y"));
|
||||
int width = Convert.ToInt32(context.GetRequestParm("Width"));
|
||||
int height = Convert.ToInt32(context.GetRequestParm("Height"));
|
||||
int locked = Convert.ToInt32(context.GetRequestParm("Locked"));
|
||||
idCard = cardBoard.Card_Create(title, body, x, y, width, height, locked != 0, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "CardMove")
|
||||
{
|
||||
idCard = Convert.ToInt32(context.GetRequestParm("IDCard"));
|
||||
int x = Convert.ToInt32(context.GetRequestParm("X"));
|
||||
int y = Convert.ToInt32(context.GetRequestParm("Y"));
|
||||
cardBoard.Card_Move(idCard, x, y, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "CardResize")
|
||||
{
|
||||
idCard = Convert.ToInt32(context.GetRequestParm("IDCard"));
|
||||
int width = Convert.ToInt32(context.GetRequestParm("Width"));
|
||||
int height = Convert.ToInt32(context.GetRequestParm("Height"));
|
||||
cardBoard.Card_Resize(idCard, width, height, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "CardEdit")
|
||||
{
|
||||
idCard = Convert.ToInt32(context.GetRequestParm("IDCard"));
|
||||
string title = context.GetRequestParm("Title");
|
||||
string body = context.GetRequestParm("Body");
|
||||
cardBoard.Card_Edit(idCard, title, body, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "CardLock")
|
||||
{
|
||||
idCard = Convert.ToInt32(context.GetRequestParm("IDCard"));
|
||||
int locked = Convert.ToInt32(context.GetRequestParm("Locked"));
|
||||
cardBoard.Card_Lock(idCard, locked != 0, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "CardDelete")
|
||||
{
|
||||
idCard = Convert.ToInt32(context.GetRequestParm("IDCard"));
|
||||
cardBoard.Card_Delete(idCard, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionCreate")
|
||||
{
|
||||
string title = context.GetRequestParm("Title");
|
||||
int x = Convert.ToInt32(context.GetRequestParm("X"));
|
||||
int y = Convert.ToInt32(context.GetRequestParm("Y"));
|
||||
int width = Convert.ToInt32(context.GetRequestParm("Width"));
|
||||
int height = Convert.ToInt32(context.GetRequestParm("Height"));
|
||||
int locked = Convert.ToInt32(context.GetRequestParm("Locked"));
|
||||
idRegion = cardBoard.Region_Create(title, x, y, width, height, locked != 0, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionMove")
|
||||
{
|
||||
idRegion = Convert.ToInt32(context.GetRequestParm("IDRegion"));
|
||||
int x = Convert.ToInt32(context.GetRequestParm("X"));
|
||||
int y = Convert.ToInt32(context.GetRequestParm("Y"));
|
||||
cardBoard.Region_Move(idRegion, x, y, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionResize")
|
||||
{
|
||||
idRegion = Convert.ToInt32(context.GetRequestParm("IDRegion"));
|
||||
int width = Convert.ToInt32(context.GetRequestParm("Width"));
|
||||
int height = Convert.ToInt32(context.GetRequestParm("Height"));
|
||||
cardBoard.Region_Resize(idRegion, width, height, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionEdit")
|
||||
{
|
||||
idRegion = Convert.ToInt32(context.GetRequestParm("IDRegion"));
|
||||
string title = context.GetRequestParm("Title");
|
||||
cardBoard.Region_Edit(idRegion, title, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionLock")
|
||||
{
|
||||
idRegion = Convert.ToInt32(context.GetRequestParm("IDRegion"));
|
||||
int locked = Convert.ToInt32(context.GetRequestParm("Locked"));
|
||||
cardBoard.Region_Lock(idRegion, locked != 0, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
if (command == "RegionDelete")
|
||||
{
|
||||
idRegion = Convert.ToInt32(context.GetRequestParm("IDRegion"));
|
||||
cardBoard.Region_Delete(idRegion, currentUserName);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
if (done)
|
||||
{
|
||||
NotifyAll();
|
||||
context.ResponseObject(new OperationStatus
|
||||
{
|
||||
IsOK = true,
|
||||
Message = "Update successfully",
|
||||
ReturnValue = Convert.ToString(idCard)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifyAll()
|
||||
{
|
||||
lock (_monitor) { Monitor.PulseAll(_monitor); }
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
using VAR.Focus.BusinessLogic.Persistence;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.Focus.Web.Controls
|
||||
{
|
||||
public class HndChat : IHttpHandler
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private const int MaxWaitLoops = 5;
|
||||
|
||||
private static object _monitor = new object();
|
||||
private static Dictionary<string, MessageBoard> _chatBoards = new Dictionary<string, MessageBoard>();
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (context.Request.RequestType == "GET")
|
||||
{
|
||||
ProcessReciver(context);
|
||||
}
|
||||
if (context.Request.RequestType == "POST")
|
||||
{
|
||||
ProcessSender(context);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
context.ResponseObject(new OperationStatus { IsOK = false, Message = ex.Message, });
|
||||
}
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void ProcessReciver(HttpContext context)
|
||||
{
|
||||
string idMessageBoard = context.GetRequestParm("IDMessageBoard");
|
||||
int idMessage = Convert.ToInt32(context.GetRequestParm("IDMessage"));
|
||||
string strTimePoolData = context.GetRequestParm("TimePoolData");
|
||||
int timePoolData = Convert.ToInt32(string.IsNullOrEmpty(strTimePoolData) ? "0" : strTimePoolData);
|
||||
|
||||
MessageBoard messageBoard;
|
||||
int waitCount = (timePoolData > 0) ? MaxWaitLoops : 0;
|
||||
do
|
||||
{
|
||||
if (_chatBoards.ContainsKey(idMessageBoard) == false)
|
||||
{
|
||||
lock (_chatBoards)
|
||||
{
|
||||
if (_chatBoards.ContainsKey(idMessageBoard) == false)
|
||||
{
|
||||
messageBoard = new MessageBoard(idMessageBoard, new JsonFilePersistence());
|
||||
_chatBoards[idMessageBoard] = messageBoard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_chatBoards.ContainsKey(idMessageBoard))
|
||||
{
|
||||
messageBoard = _chatBoards[idMessageBoard];
|
||||
List<Message> listMessages = messageBoard.Messages_GetList(idMessage);
|
||||
if (listMessages.Count > 0)
|
||||
{
|
||||
waitCount = 0;
|
||||
context.ResponseObject(listMessages);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (waitCount > 0)
|
||||
{
|
||||
lock (_monitor) { Monitor.Wait(_monitor, timePoolData); }
|
||||
waitCount--;
|
||||
}
|
||||
} while (waitCount > 0);
|
||||
context.ResponseObject(new List<Message>());
|
||||
}
|
||||
|
||||
private void ProcessSender(HttpContext context)
|
||||
{
|
||||
string text = Convert.ToString(context.GetRequestParm("Text"));
|
||||
string idMessageBoard = context.GetRequestParm("IDMessageBoard");
|
||||
if (string.IsNullOrEmpty(idMessageBoard)) { idMessageBoard = "root"; }
|
||||
string userName = Convert.ToString(context.GetRequestParm("UserName"));
|
||||
Session session = WebSessions.Current.Session_GetCurrent(context);
|
||||
if (session.UserName.ToLower() != userName.ToLower())
|
||||
{
|
||||
context.ResponseObject(new OperationStatus { IsOK = false, Message = "User mismatch" });
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_chatBoards)
|
||||
{
|
||||
MessageBoard messageBoard;
|
||||
if (_chatBoards.ContainsKey(idMessageBoard))
|
||||
{
|
||||
messageBoard = _chatBoards[idMessageBoard];
|
||||
}
|
||||
else
|
||||
{
|
||||
messageBoard = new MessageBoard(idMessageBoard, new JsonFilePersistence());
|
||||
_chatBoards[idMessageBoard] = messageBoard;
|
||||
}
|
||||
messageBoard.Message_Add(userName, text);
|
||||
lock (_monitor) { Monitor.PulseAll(_monitor); }
|
||||
}
|
||||
context.ResponseObject(new OperationStatus { IsOK = true, Message = "Message sent" });
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.Focus.Web.Pages;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.Focus.Web
|
||||
{
|
||||
public class FocusGlobalConfig : IGlobalConfig
|
||||
{
|
||||
public string Title { get; } = "Focus";
|
||||
public string TitleSeparator { get; } = " :: ";
|
||||
public string Author { get; } = "Valeriano Alfonso Rodriguez";
|
||||
public string Copyright { get; } = "Copyright (c) 2015-2020 by Valeriano Alfonso, All Right Reserved";
|
||||
public string DefaultHandler { get; } = nameof(FrmBoard);
|
||||
public string LoginHandler { get; } = nameof(FrmLogin);
|
||||
public List<string> AllowedExtensions { get; } = new List<string> { ".png", ".jpg", ".jpeg", ".gif", ".ico", ".wav", ".mp3", ".ogg", ".mp4", ".webm", ".webp", ".mkv", ".avi" };
|
||||
|
||||
public bool IsUserAuthenticated(HttpContext context)
|
||||
{
|
||||
return WebSessions.Current.Session_IsUserAuthenticated(context);
|
||||
}
|
||||
|
||||
public void UserUnauthenticate(HttpContext context)
|
||||
{
|
||||
WebSessions.Current.Session_FinalizeCurrent(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 458 KiB |
@@ -1,213 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.Focus.Web.Controls;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.Focus.Web.Pages
|
||||
{
|
||||
public class FrmBoard : PageCommon
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private int _idBoard = 0;
|
||||
|
||||
private CTextBox _txtTitle = new CTextBox { ID = "txtTitle", CssClassExtra = "width100pc", AllowEmpty = false, };
|
||||
private CTextBox _txtDescription = new CTextBox { ID = "txtDescription", CssClassExtra = "width100pc", TextMode = TextBoxMode.MultiLine, KeepSize = true, };
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Life cycle
|
||||
|
||||
public FrmBoard()
|
||||
{
|
||||
Init += FrmBoard_Init;
|
||||
}
|
||||
|
||||
private void FrmBoard_Init(object sender, EventArgs e)
|
||||
{
|
||||
string strIDBoard = Context.GetRequestParm("idBoard");
|
||||
if (string.IsNullOrEmpty(strIDBoard) == false)
|
||||
{
|
||||
_idBoard = Convert.ToInt32(strIDBoard);
|
||||
}
|
||||
if (_idBoard == 0)
|
||||
{
|
||||
FrmBoard_InitIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
FrmBoard_InitBoard();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Life cycle
|
||||
|
||||
#region UI Events
|
||||
|
||||
private void btnAddBoard_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormUtils.Controls_AreValid(Controls) == false) { return; }
|
||||
|
||||
User user = WebSessions.Current.Session_GetCurrentUser(Context);
|
||||
Board board = Boards.Current.Boards_SetBoard(0, _txtTitle.Text, _txtDescription.Text, null, user.Name);
|
||||
_idBoard = board.IDBoard;
|
||||
|
||||
Response.Redirect(GetUrl(_idBoard));
|
||||
}
|
||||
|
||||
private void BtnView_Click(object sender, EventArgs e)
|
||||
{
|
||||
CButton btnView = (CButton)sender;
|
||||
int idBoard = Convert.ToInt32(btnView.CommandArgument);
|
||||
Response.Redirect(GetUrl(idBoard));
|
||||
}
|
||||
|
||||
private void BtnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
CButton btnEdit = (CButton)sender;
|
||||
int idBoard = Convert.ToInt32(btnEdit.CommandArgument);
|
||||
Response.Redirect(FrmBoardEdit.GetUrl(idBoard, nameof(FrmBoard)));
|
||||
}
|
||||
|
||||
private void BtnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
CButton btnEdit = (CButton)sender;
|
||||
int idBoard = Convert.ToInt32(btnEdit.CommandArgument);
|
||||
|
||||
User user = WebSessions.Current.Session_GetCurrentUser(Context);
|
||||
if (Boards.Current.Boards_DelBoard(idBoard, user.Name))
|
||||
{
|
||||
Controls.Clear();
|
||||
FrmBoard_InitIndex();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion UI Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private Panel BoardSelector_Create(Board board)
|
||||
{
|
||||
var pnlBoardSelector = new Panel { CssClass = "boardBanner" };
|
||||
|
||||
var lnkTitle = new HyperLink
|
||||
{
|
||||
NavigateUrl = GetUrl(board.IDBoard),
|
||||
};
|
||||
var lblTitle = new CLabel
|
||||
{
|
||||
Text = board.Title,
|
||||
CssClass = "title",
|
||||
};
|
||||
lnkTitle.Controls.Add(lblTitle);
|
||||
pnlBoardSelector.Controls.Add(lnkTitle);
|
||||
|
||||
var lblDescription = new CLabel
|
||||
{
|
||||
Text = board.Description.Replace(" ", " ").Replace("\n", "<br>"),
|
||||
CssClass = "description",
|
||||
};
|
||||
pnlBoardSelector.Controls.Add(FormUtils.CreatePanel("", lblDescription));
|
||||
|
||||
Panel pnlButtons = (Panel)FormUtils.CreatePanel("formRow");
|
||||
var btnView = new CButton
|
||||
{
|
||||
ID = string.Format("btnView{0}", board.IDBoard),
|
||||
Text = MultiLang.GetLiteral("View"),
|
||||
};
|
||||
btnView.CommandArgument = Convert.ToString(board.IDBoard);
|
||||
btnView.Click += BtnView_Click;
|
||||
pnlButtons.Controls.Add(btnView);
|
||||
var btnEdit = new CButton
|
||||
{
|
||||
ID = string.Format("btnEdit{0}", board.IDBoard),
|
||||
Text = MultiLang.GetLiteral("Edit"),
|
||||
};
|
||||
btnEdit.CommandArgument = Convert.ToString(board.IDBoard);
|
||||
btnEdit.Click += BtnEdit_Click;
|
||||
pnlButtons.Controls.Add(btnEdit);
|
||||
var btnDelete = new CButton
|
||||
{
|
||||
ID = string.Format("btnDelete{0}", board.IDBoard),
|
||||
Text = MultiLang.GetLiteral("Delete"),
|
||||
};
|
||||
btnDelete.CommandArgument = Convert.ToString(board.IDBoard);
|
||||
btnDelete.Click += BtnDelete_Click;
|
||||
btnDelete.Attributes.Add("onclick", string.Format("return confirm('{0}');", MultiLang.GetLiteral("ConfirmDelete")));
|
||||
pnlButtons.Controls.Add(btnDelete);
|
||||
pnlBoardSelector.Controls.Add(pnlButtons);
|
||||
|
||||
return pnlBoardSelector;
|
||||
}
|
||||
|
||||
private void FrmBoard_InitIndex()
|
||||
{
|
||||
Title = "Boards";
|
||||
|
||||
User user = WebSessions.Current.Session_GetCurrentUser(Context);
|
||||
List<Board> boards = Boards.Current.Boards_GetListForUser(user?.Name);
|
||||
foreach (Board board in boards)
|
||||
{
|
||||
Panel pnlBoardSelector = BoardSelector_Create(board);
|
||||
Controls.Add(pnlBoardSelector);
|
||||
}
|
||||
|
||||
// Board creator
|
||||
var pnlBoardAdd = new Panel { CssClass = "boardBanner" };
|
||||
var btnAddBoard = new CButton { ID = "btnAddBoard", Text = MultiLang.GetLiteral("AddBoard") };
|
||||
btnAddBoard.Click += btnAddBoard_Click;
|
||||
pnlBoardAdd.Controls.Add(FormUtils.CreatePanel("formRow", _txtTitle));
|
||||
_txtTitle.PlaceHolder = MultiLang.GetLiteral("Title");
|
||||
pnlBoardAdd.Controls.Add(FormUtils.CreatePanel("formRow", _txtDescription));
|
||||
_txtDescription.PlaceHolder = MultiLang.GetLiteral("Description");
|
||||
pnlBoardAdd.Controls.Add(FormUtils.CreatePanel("formRow", btnAddBoard));
|
||||
Controls.Add(pnlBoardAdd);
|
||||
}
|
||||
|
||||
private void FrmBoard_InitBoard()
|
||||
{
|
||||
User user = WebSessions.Current.Session_GetCurrentUser(Context);
|
||||
Board board = Boards.Current.Board_GetByIDBoard(_idBoard);
|
||||
|
||||
Title = board.Title;
|
||||
|
||||
CtrCardBoard cardBoardControl = new CtrCardBoard
|
||||
{
|
||||
ID = "ctrCardBoard",
|
||||
IDBoard = board.IDBoard,
|
||||
UserName = user.Name,
|
||||
};
|
||||
Controls.Add(cardBoardControl);
|
||||
|
||||
CtrChat chatControl = new CtrChat
|
||||
{
|
||||
ID = "ctrChat",
|
||||
IDMessageBoard = string.Format("CardBoard_{0}", board.IDBoard),
|
||||
UserName = user.Name,
|
||||
};
|
||||
Controls.Add(chatControl);
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
|
||||
#region Public methods
|
||||
|
||||
public static string GetUrl(int idBoard, string returnUrl = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(returnUrl))
|
||||
{
|
||||
return string.Format("{0}?idBoard={1}", nameof(FrmBoard), idBoard);
|
||||
}
|
||||
return string.Format("{0}?idBoard={1}&returnUrl={2}", nameof(FrmBoard), idBoard, HttpUtility.UrlEncode(returnUrl));
|
||||
}
|
||||
|
||||
#endregion Public methods
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.Focus.Web.Pages
|
||||
{
|
||||
public class FrmBoardEdit : PageCommon
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private int _idBoard = 0;
|
||||
|
||||
private CTextBox _txtTitle = new CTextBox { ID = "txtTitle", CssClassExtra = "width100pc", AllowEmpty = false };
|
||||
private CTextBox _txtDescription = new CTextBox { ID = "txtDescription", CssClassExtra = "width100pc", TextMode = TextBoxMode.MultiLine, KeepSize = true, };
|
||||
private CButton _btnSave = new CButton { ID = "btnSave" };
|
||||
private CButton _btnExit = new CButton { ID = "btnExit" };
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Page life cycle
|
||||
|
||||
public FrmBoardEdit()
|
||||
{
|
||||
Init += FrmBoardEdit_Init;
|
||||
Load += FrmBoardEdit_Load;
|
||||
}
|
||||
|
||||
private void FrmBoardEdit_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (IsPostBack == false)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void FrmBoardEdit_Init(object sender, EventArgs e)
|
||||
{
|
||||
string strIDBoard = Context.GetRequestParm("idBoard");
|
||||
if (string.IsNullOrEmpty(strIDBoard) == false)
|
||||
{
|
||||
_idBoard = Convert.ToInt32(strIDBoard);
|
||||
}
|
||||
if (_idBoard == 0)
|
||||
{
|
||||
Response.Redirect(nameof(FrmBoard));
|
||||
}
|
||||
InitializeComponents();
|
||||
}
|
||||
|
||||
#endregion Page life cycle
|
||||
|
||||
#region UI Events
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormUtils.Controls_AreValid(Controls) == false) { return; }
|
||||
|
||||
User user = WebSessions.Current.Session_GetCurrentUser(Context);
|
||||
Board board = Boards.Current.Boards_SetBoard(
|
||||
_idBoard,
|
||||
_txtTitle.Text,
|
||||
_txtDescription.Text,
|
||||
_txtDescription.GetClientsideHeight(),
|
||||
user.Name);
|
||||
|
||||
// FIXME: Notify User of "Save Succesfully"
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
string returnUrl = Context.GetRequestParm("returnUrl");
|
||||
if (string.IsNullOrEmpty(returnUrl))
|
||||
{
|
||||
Response.Redirect(FrmBoard.GetUrl(_idBoard));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(returnUrl);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion UI Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void InitializeComponents()
|
||||
{
|
||||
Title = MultiLang.GetLiteral("EditBoard");
|
||||
var lblTitle = new CLabel { Text = Title, Tag = "h2" };
|
||||
Controls.Add(lblTitle);
|
||||
|
||||
Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Title"), _txtTitle));
|
||||
_txtTitle.NextFocusOnEnter = _txtTitle;
|
||||
_txtTitle.PlaceHolder = MultiLang.GetLiteral("Title");
|
||||
|
||||
Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Description"), _txtDescription));
|
||||
_txtDescription.PlaceHolder = MultiLang.GetLiteral("Description");
|
||||
|
||||
_btnSave.Text = MultiLang.GetLiteral("Save");
|
||||
_btnSave.Click += btnSave_Click;
|
||||
|
||||
_btnExit.Text = MultiLang.GetLiteral("Exit");
|
||||
_btnExit.Click += btnExit_Click;
|
||||
|
||||
Panel pnlButtons = new Panel();
|
||||
pnlButtons.Controls.Add(_btnSave);
|
||||
pnlButtons.Controls.Add(_btnExit);
|
||||
Controls.Add(FormUtils.CreateField(string.Empty, pnlButtons));
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
Board board = Boards.Current.Board_GetByIDBoard(_idBoard);
|
||||
|
||||
_txtTitle.Text = board.Title;
|
||||
_txtDescription.Text = board.Description;
|
||||
_txtDescription.SetClientsideHeight(board.DescriptionHeight);
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
|
||||
#region Public methods
|
||||
|
||||
public static string GetUrl(int idBoard, string returnUrl = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(returnUrl))
|
||||
{
|
||||
return string.Format("{0}?idBoard={1}", nameof(FrmBoardEdit), idBoard);
|
||||
}
|
||||
return string.Format("{0}?idBoard={1}&returnUrl={2}", nameof(FrmBoardEdit), idBoard, HttpUtility.UrlEncode(returnUrl));
|
||||
}
|
||||
|
||||
#endregion Public methods
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.Web.Code;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.Focus.Web.Pages
|
||||
{
|
||||
public class FrmLogin : PageCommon
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private CTextBox _txtNameEmail = new CTextBox { ID = "txtNameEmail", CssClassExtra = "width150px", AllowEmpty = false };
|
||||
private CTextBox _txtPassword = new CTextBox { ID = "txtPassword", CssClassExtra = "width150px", AllowEmpty = false, TextMode = TextBoxMode.Password };
|
||||
private CButton _btnLogin = new CButton { ID = "btnLogin" };
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Page life cycle
|
||||
|
||||
public FrmLogin()
|
||||
{
|
||||
MustBeAutenticated = false;
|
||||
Init += FrmLogin_Init;
|
||||
}
|
||||
|
||||
private void FrmLogin_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitializeControls();
|
||||
}
|
||||
|
||||
#endregion Page life cycle
|
||||
|
||||
#region UI Events
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormUtils.Controls_AreValid(Controls) == false) { return; }
|
||||
|
||||
if (Users.Current.User_Authenticate(_txtNameEmail.Text, _txtPassword.Text) == false)
|
||||
{
|
||||
_txtPassword.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
WebSessions.Current.Session_Init(Context, _txtNameEmail.Text);
|
||||
Response.Redirect(GlobalConfig.Get().DefaultHandler);
|
||||
}
|
||||
|
||||
#endregion UI Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void InitializeControls()
|
||||
{
|
||||
Title = MultiLang.GetLiteral("Login");
|
||||
var lblTitle = new CLabel { Text = Title, Tag = "h2" };
|
||||
Controls.Add(lblTitle);
|
||||
|
||||
Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("NameOrMail"), _txtNameEmail));
|
||||
_txtNameEmail.NextFocusOnEnter = _txtPassword;
|
||||
_txtNameEmail.PlaceHolder = MultiLang.GetLiteral("NameOrMail");
|
||||
|
||||
Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Password"), _txtPassword));
|
||||
_txtPassword.NextFocusOnEnter = _btnLogin;
|
||||
_txtPassword.PlaceHolder = MultiLang.GetLiteral("Password");
|
||||
|
||||
Controls.Add(FormUtils.CreateField(string.Empty, _btnLogin));
|
||||
_btnLogin.Text = MultiLang.GetLiteral("Login");
|
||||
_btnLogin.Click += btnLogin_Click;
|
||||
|
||||
Controls.Add(FormUtils.CreateField(string.Empty, new HyperLink { Text = MultiLang.GetLiteral("RegisterUser"), NavigateUrl = "FrmRegister" }));
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Focus.BusinessLogic;
|
||||
using VAR.Focus.BusinessLogic.Entities;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.Focus.Web.Pages
|
||||
{
|
||||
public class FrmRegister : PageCommon
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private Panel _pnlRegister = new Panel { ID = "pnlRegister" };
|
||||
private CTextBox _txtName = new CTextBox { ID = "txtName", CssClassExtra = "width150px", AllowEmpty = false };
|
||||
private CTextBox _txtEmail = new CTextBox { ID = "txtEmail", CssClassExtra = "width150px", AllowEmpty = false };
|
||||
private CTextBox _txtPassword1 = new CTextBox { ID = "txtPassword1", CssClassExtra = "width150px", AllowEmpty = false, TextMode = TextBoxMode.Password };
|
||||
private CTextBox _txtPassword2 = new CTextBox { ID = "txtPassword2", CssClassExtra = "width150px", AllowEmpty = false, TextMode = TextBoxMode.Password };
|
||||
private CButton _btnRegister = new CButton { ID = "btnRegister" };
|
||||
private CButton _btnExit = new CButton { ID = "btnExit" };
|
||||
private Panel _pnlSuccess = new Panel { ID = "pnlSuccess" };
|
||||
private CLabel _lblSuccess = new CLabel { ID = "lblSuccess" };
|
||||
private CButton _btnExitSuccess = new CButton { ID = "btnExitSuccess" };
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Page life cycle
|
||||
|
||||
public FrmRegister()
|
||||
{
|
||||
MustBeAutenticated = false;
|
||||
Init += FrmRegister_Init;
|
||||
}
|
||||
|
||||
private void FrmRegister_Init(object sender, EventArgs e)
|
||||
{
|
||||
InitializeComponents();
|
||||
}
|
||||
|
||||
#endregion Page life cycle
|
||||
|
||||
#region UI Events
|
||||
|
||||
private void btnRegister_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormUtils.Controls_AreValid(Controls) == false) { return; }
|
||||
|
||||
// FIXME: Check Email
|
||||
|
||||
// Check password
|
||||
if (_txtPassword1.Text != _txtPassword2.Text)
|
||||
{
|
||||
_txtPassword1.MarkedInvalid = true;
|
||||
_txtPassword2.MarkedInvalid = true;
|
||||
_txtPassword1.Text = string.Empty;
|
||||
_txtPassword2.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
User user = Users.Current.User_Set(_txtName.Text, _txtEmail.Text, _txtPassword1.Text);
|
||||
|
||||
_pnlRegister.Visible = false;
|
||||
_pnlSuccess.Visible = true;
|
||||
_lblSuccess.Text = string.Format("User {0} created sucessfully", user.Name);
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.Redirect(GlobalConfig.Get().DefaultHandler);
|
||||
}
|
||||
|
||||
#endregion UI Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void InitializeComponents()
|
||||
{
|
||||
Title = MultiLang.GetLiteral("RegisterUser");
|
||||
var lblTitle = new CLabel { Text = Title, Tag = "h2" };
|
||||
Controls.Add(lblTitle);
|
||||
|
||||
Controls.Add(_pnlRegister);
|
||||
|
||||
_pnlRegister.Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Name"), _txtName));
|
||||
_txtName.NextFocusOnEnter = _txtEmail;
|
||||
_txtName.PlaceHolder = MultiLang.GetLiteral("Name");
|
||||
|
||||
_pnlRegister.Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Email"), _txtEmail));
|
||||
_txtEmail.NextFocusOnEnter = _txtPassword1;
|
||||
_txtEmail.PlaceHolder = MultiLang.GetLiteral("Email");
|
||||
|
||||
_pnlRegister.Controls.Add(FormUtils.CreateField(MultiLang.GetLiteral("Password"), _txtPassword1));
|
||||
_txtPassword1.NextFocusOnEnter = _txtPassword2;
|
||||
_txtPassword1.PlaceHolder = MultiLang.GetLiteral("Password");
|
||||
|
||||
_pnlRegister.Controls.Add(FormUtils.CreateField(string.Empty, _txtPassword2));
|
||||
_txtPassword2.NextFocusOnEnter = _btnRegister;
|
||||
_txtPassword2.PlaceHolder = MultiLang.GetLiteral("Password");
|
||||
|
||||
_btnRegister.Text = MultiLang.GetLiteral("Register");
|
||||
_btnRegister.Click += btnRegister_Click;
|
||||
|
||||
_btnExit.Text = MultiLang.GetLiteral("Exit");
|
||||
_btnExit.Click += btnExit_Click;
|
||||
|
||||
Panel pnlButtons = new Panel();
|
||||
pnlButtons.Controls.Add(_btnRegister);
|
||||
pnlButtons.Controls.Add(_btnExit);
|
||||
_pnlRegister.Controls.Add(FormUtils.CreateField(string.Empty, pnlButtons));
|
||||
|
||||
Controls.Add(_pnlSuccess);
|
||||
_pnlSuccess.Visible = false;
|
||||
|
||||
_pnlSuccess.Controls.Add(_lblSuccess);
|
||||
|
||||
_btnExitSuccess.Text = MultiLang.GetLiteral("Exit");
|
||||
_btnExitSuccess.Click += btnExit_Click;
|
||||
_pnlSuccess.Controls.Add(FormUtils.CreateField(string.Empty, _btnExitSuccess));
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("VAR.Focus")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("VAR")]
|
||||
[assembly: AssemblyProduct("VAR.Focus")]
|
||||
[assembly: AssemblyCopyright("Copyright © VAR 2015-2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("4cd25e9d-237f-4a9f-89ac-35e537cf265e")]
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
|
||||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<publishUrl>Z:\www\VAR.Focus</publishUrl>
|
||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"AddBoard": "Add board",
|
||||
"EditBoard": "Edit board",
|
||||
"Title": "Title",
|
||||
"Description": "Description",
|
||||
"Save": "Save",
|
||||
"Exit": "Exit",
|
||||
"Toolbox": "Toolbox",
|
||||
"AddCard": "+ Card",
|
||||
"AddRegion": "+ Region",
|
||||
"Accept": "Accept",
|
||||
"Cancel": "Cancel",
|
||||
"ConfirmDelete": "Are you sure to delete?",
|
||||
"ConfirmExit": "Are you sure to exit?",
|
||||
"Config": "Config",
|
||||
"Login": "Login",
|
||||
"Logout": "Logout",
|
||||
"NameOrMail": "Name/Mail",
|
||||
"Password": "Password",
|
||||
"RegisterUser": "RegisterUser",
|
||||
"Name": "Name",
|
||||
"Email": "Email",
|
||||
"Register": "Register",
|
||||
"View": "View",
|
||||
"Edit": "Edit",
|
||||
"Delete": "Delete",
|
||||
"Chat": "Chat",
|
||||
"ChatClose": "Close X",
|
||||
"ChatNewMessages": "New messages",
|
||||
"ChatDisconnected": "Disconnected",
|
||||
"ChatSend": "Send"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"AddBoard": "Añadir panel",
|
||||
"EditBoard": "Editar panel",
|
||||
"Title": "Titulo",
|
||||
"Description": "Descripción",
|
||||
"Save": "Guardar",
|
||||
"Exit": "Salir",
|
||||
"Toolbox": "Herramientas",
|
||||
"AddCard": "+ Tarejeta",
|
||||
"AddRegion": "+ Region",
|
||||
"Accept": "Aceptar",
|
||||
"Cancel": "Cancelar",
|
||||
"ConfirmDelete": "¿Estas seguro de eliminar?",
|
||||
"ConfirmExit": "¿Estas seguro de salir?",
|
||||
"Config": "Config.",
|
||||
"Login": "Login",
|
||||
"Logout": "Cerrar sesion",
|
||||
"NameOrMail": "Nombre/Mail",
|
||||
"Password": "Password",
|
||||
"RegisterUser": "Registrar usuario",
|
||||
"Name": "Nombre",
|
||||
"Email": "Email",
|
||||
"Register": "Registrar",
|
||||
"View": "Ver",
|
||||
"Edit": "Editar",
|
||||
"Delete": "Eliminar",
|
||||
"Chat": "Chat",
|
||||
"ChatClose": "Cerrar X",
|
||||
"ChatNewMessages": "Nuevos mensages",
|
||||
"ChatDisconnected": "Desconectado",
|
||||
"ChatSend": "Envia"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,184 +0,0 @@
|
||||
function RunChat(cfg) {
|
||||
cfg.divChat = GetElement(cfg.divChat);
|
||||
cfg.divChatContainer = GetElement(cfg.divChatContainer);
|
||||
cfg.lblTitle = GetElement(cfg.lblTitle);
|
||||
cfg.txtText = GetElement(cfg.txtText);
|
||||
cfg.btnSend = GetElement(cfg.btnSend);
|
||||
|
||||
cfg.LastUser = null;
|
||||
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Chat;
|
||||
cfg.lblTitle.className = "titleChatNormal";
|
||||
cfg.divChatContainer.style.width = 0;
|
||||
cfg.divChatContainer.style.height = 0;
|
||||
cfg.divChatContainer.style.opacity = 0;
|
||||
|
||||
cfg.Minimized = true;
|
||||
cfg.Connected = null;
|
||||
cfg.FirstMessages = true;
|
||||
cfg.ScrollOnRestore = true;
|
||||
cfg.ScrollPosition = 0;
|
||||
|
||||
cfg.lblTitle.onclick = function () {
|
||||
if (cfg.Minimized) {
|
||||
cfg.divChatContainer.style.width = cfg.divChatContainerWidth;
|
||||
cfg.divChatContainer.style.height = cfg.divChatContainerHeight;
|
||||
cfg.divChatContainer.style.opacity = 1;
|
||||
if (cfg.Connected) {
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Close;
|
||||
cfg.lblTitle.className = "titleChatNormal";
|
||||
}
|
||||
if (cfg.ScrollOnRestore) {
|
||||
cfg.divChat.scrollTop = cfg.divChat.scrollHeight;
|
||||
} else {
|
||||
cfg.divChat.scrollTop = cfg.ScrollPosition;
|
||||
}
|
||||
cfg.Minimized = false;
|
||||
} else {
|
||||
cfg.ScrollPosition = cfg.divChat.scrollTop;
|
||||
var scrollVisible = cfg.divChat.scrollHeight - cfg.divChat.offsetHeight;
|
||||
cfg.ScrollOnRestore = cfg.divChat.scrollTop > scrollVisible;
|
||||
cfg.divChatContainer.style.width = 0;
|
||||
cfg.divChatContainer.style.height = 0;
|
||||
cfg.divChatContainer.style.opacity = 0;
|
||||
if (cfg.Connected) {
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Chat;
|
||||
cfg.lblTitle.className = "titleChatNormal";
|
||||
}
|
||||
cfg.Minimized = true;
|
||||
}
|
||||
};
|
||||
|
||||
var CreateMessageDOM = function (message, selfMessage, showUserName) {
|
||||
var divMessageRow = document.createElement("DIV");
|
||||
if (selfMessage) {
|
||||
divMessageRow.className = "selfMessageRow";
|
||||
} else {
|
||||
divMessageRow.className = "messageRow";
|
||||
}
|
||||
|
||||
var divMessage = document.createElement("DIV");
|
||||
divMessage.className = "message";
|
||||
divMessageRow.appendChild(divMessage);
|
||||
|
||||
if (showUserName) {
|
||||
var divUser = document.createElement("DIV");
|
||||
divUser.className = "user";
|
||||
divUser.innerHTML = escapeHTML(message.UserName);
|
||||
divMessage.appendChild(divUser);
|
||||
}
|
||||
|
||||
var text = message.Text;
|
||||
|
||||
var divText = document.createElement("DIV");
|
||||
divText.className = "text";
|
||||
divText.innerHTML = escapeHTML(text);
|
||||
divMessage.appendChild(divText);
|
||||
|
||||
divMessage.title = new Date(message.Date);
|
||||
|
||||
return divMessageRow;
|
||||
};
|
||||
|
||||
var RequestChatData = function () {
|
||||
var ReciveChatData = function (responseText) {
|
||||
// Mark as connected
|
||||
if (cfg.Connected === false) {
|
||||
if (cfg.Minimized) {
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Chat;
|
||||
} else {
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Close;
|
||||
}
|
||||
cfg.lblTitle.className = "titleChatNormal";
|
||||
cfg.txtText.disabled = false;
|
||||
cfg.btnSend.disabled = false;
|
||||
}
|
||||
cfg.Connected = true;
|
||||
|
||||
recvMsgs = JSON.parse(responseText);
|
||||
if (recvMsgs) {
|
||||
var msgCount = 0;
|
||||
var scrollChat = false;
|
||||
var scrollVisible = cfg.divChat.scrollHeight - cfg.divChat.offsetHeight;
|
||||
if (cfg.Minimized === false && cfg.divChat.scrollTop > scrollVisible) {
|
||||
scrollChat = true;
|
||||
}
|
||||
|
||||
var frag = document.createDocumentFragment();
|
||||
for (var i = 0, n = recvMsgs.length; i < n; i++) {
|
||||
var msg = recvMsgs[i];
|
||||
if (cfg.IDMessage < msg.IDMessage) {
|
||||
cfg.IDMessage = msg.IDMessage;
|
||||
var elemMessage = CreateMessageDOM(msg,
|
||||
msg.UserName === cfg.UserName,
|
||||
cfg.LastUser !== msg.UserName);
|
||||
cfg.LastUser = msg.UserName;
|
||||
frag.appendChild(elemMessage);
|
||||
msgCount++;
|
||||
}
|
||||
}
|
||||
cfg.divChat.appendChild(frag);
|
||||
if (scrollChat) {
|
||||
cfg.divChat.scrollTop = cfg.divChat.scrollHeight;
|
||||
}
|
||||
if (cfg.Minimized && cfg.FirstMessages === false && msgCount > 0) {
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.NewMessages;
|
||||
cfg.lblTitle.className = "titleChatAlert";
|
||||
}
|
||||
}
|
||||
|
||||
cfg.FirstMessages = false;
|
||||
|
||||
// Reset pool
|
||||
window.setTimeout(function () {
|
||||
RequestChatData();
|
||||
}, 20);
|
||||
};
|
||||
var ErrorChatData = function () {
|
||||
// Mark as disconnected
|
||||
cfg.lblTitle.innerHTML = cfg.Texts.Disconnected;
|
||||
cfg.lblTitle.className = "titleChatDisconnected";
|
||||
cfg.txtText.disabled = true;
|
||||
cfg.btnSend.disabled = true;
|
||||
cfg.Connected = false;
|
||||
|
||||
cfg.FirstMessages = false;
|
||||
|
||||
// Retry
|
||||
window.setTimeout(function () {
|
||||
RequestChatData();
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
// Pool data
|
||||
var isImmediate = cfg.FirstMessages || cfg.Connected === false;
|
||||
var data = {
|
||||
"IDMessageBoard": cfg.IDMessageBoard,
|
||||
"IDMessage": cfg.IDMessage,
|
||||
"TimePoolData": isImmediate ? "0" : String(cfg.TimePoolData),
|
||||
"TimeStamp": new Date().getTime()
|
||||
};
|
||||
SendRequest(cfg.ServiceUrl, data, ReciveChatData, ErrorChatData);
|
||||
};
|
||||
RequestChatData();
|
||||
}
|
||||
|
||||
function SendChat(cfg) {
|
||||
cfg.txtText = GetElement(cfg.txtText);
|
||||
|
||||
if (cfg.txtText.value.trim() === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send data
|
||||
var data = {
|
||||
"Text": cfg.txtText.value,
|
||||
"IDMessageBoard": cfg.IDMessageBoard,
|
||||
"UserName": cfg.UserName,
|
||||
"TimeStamp": new Date().getTime()
|
||||
};
|
||||
SendData(cfg.ServiceUrl, data, null, null);
|
||||
|
||||
cfg.txtText.value = "";
|
||||
cfg.txtText.focus();
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
.boardBanner {
|
||||
border: solid 1px rgb(32, 32, 32);
|
||||
border-radius: 5px;
|
||||
display: inline-block;
|
||||
width: 300px;
|
||||
margin: 15px;
|
||||
padding: 10px;
|
||||
vertical-align: top;
|
||||
background-color: rgb(250,250,200);
|
||||
box-shadow: 0 3px 10px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.boardBanner a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
display: block;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.boardBanner .title {
|
||||
font-size: 20px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.boardBanner .description {
|
||||
font-size: 14px;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.boardBanner .formRow {
|
||||
margin: 0;
|
||||
margin-top: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.boardBanner .formRow:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
.divBoard {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background-image: url(Images/BGCork.png);
|
||||
box-shadow: 0 0 10px black inset;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.divToolbox {
|
||||
position: absolute;
|
||||
background-color: rgb(127,127,255);
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.5);
|
||||
width: 200px;
|
||||
padding: 5px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.divToolbox .divTitle {
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
display: block;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
background-color: rgb(0,0,128);
|
||||
color: rgb(128,128,255);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.divToolbox .divOverlay {
|
||||
opacity: 0;
|
||||
background-color: rgb(127,127,255);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 30px;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.divToolbox .btnToolbox {
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 -2px 4px rgba(0,0,0,0.4) inset, 0 2px 3px rgba(255,255,255,1) inset;
|
||||
color: rgb(0,0,128);
|
||||
background-color: transparent;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 2px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.divToolbox .btnToolbox:hover {
|
||||
color: rgb(127,127,255);
|
||||
background-color: rgb(0,0,128);
|
||||
}
|
||||
|
||||
.divToolbox .btnToolbox:active {
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.4) inset, 0 -2px 3px rgba(255,255,255,1) inset;
|
||||
}
|
||||
|
||||
.divCard {
|
||||
position: absolute;
|
||||
background-color: rgb(255,255,127);
|
||||
box-shadow: 0 3px 10px rgba(0,0,0,0.5);
|
||||
padding: 5px;
|
||||
border-radius: 2px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.divCard .divTitle {
|
||||
padding-bottom: 5px;
|
||||
padding-right: 17px;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
height: 17px;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.divCard .txtTitle {
|
||||
width: 100%;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.divCard .divBody {
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
height: calc(100% - 17px);
|
||||
}
|
||||
|
||||
.divCard .txtBody {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.divCard .divOverlay {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,255,0);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.divCard .divOverlayTouchable {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,255,0);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.divCard .divResize {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,0,255);
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
.divCard .btnCard {
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 -2px 4px rgba(0,0,0,0.4) inset, 0 2px 3px rgba(255,255,255,1) inset;
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.divCard .btnCard:hover {
|
||||
color: yellow;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.divCard .btnCard:active {
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.4) inset, 0 -2px 3px rgba(255,255,255,1) inset;
|
||||
}
|
||||
|
||||
.divCard .btnEdit {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 24px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divCard .btnDelete {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divCard .btnLock {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 44px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divCard .btnUnlock {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divRegion {
|
||||
position: absolute;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
box-shadow: 0 0 0 5px rgba(0,0,0,0.5);
|
||||
padding: 5px;
|
||||
border-radius: 10px;
|
||||
border: dashed 5px rgba(255, 255, 255, 0.5);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.divRegion .divTitle {
|
||||
padding-bottom: 5px;
|
||||
padding-right: 17px;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
height: 17px;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.divRegion .txtTitle {
|
||||
width: 100%;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 30px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.divRegion .divOverlay {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,255,0);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.divRegion .divOverlayTouchable {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,255,0);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.divRegion .divResize {
|
||||
opacity: 0;
|
||||
background-color: rgb(255,0,255);
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
.divRegion .btnRegion {
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 -2px 4px rgba(0,0,0,0.4) inset, 0 2px 3px rgba(255,255,255,1) inset;
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
font-family: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.divRegion .btnRegion:hover {
|
||||
color: yellow;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.divRegion .btnRegion:active {
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.4) inset, 0 -2px 3px rgba(255,255,255,1) inset;
|
||||
}
|
||||
|
||||
.divRegion .btnEdit {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 24px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divRegion .btnDelete {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divRegion .btnLock {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 44px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divRegion .btnUnlock {
|
||||
margin: 0;
|
||||
top: 4px;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
right: 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.divEditBackground {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
.divChatWindow {
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
border: solid 1px rgba(0,0,0,0.5);
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
background-color: rgb(64,64,64);
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.5);
|
||||
position: fixed;
|
||||
bottom: 15px;
|
||||
right: 15px;
|
||||
}
|
||||
|
||||
.divChatTitleBar {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.titleChatNormal {
|
||||
color: white;
|
||||
background-color: rgb(64,64,64);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
@keyframes alert {
|
||||
0% {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
50% {
|
||||
background-color: rgb(64,64,64);
|
||||
}
|
||||
|
||||
100% {
|
||||
background-color: red;
|
||||
}
|
||||
}
|
||||
|
||||
.titleChatAlert {
|
||||
color: white;
|
||||
background-color: red;
|
||||
animation-name: alert;
|
||||
animation-duration: 1s;
|
||||
animation-iteration-count: infinite;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.titleChatDisconnected {
|
||||
color: rgb(192,192,192);
|
||||
background-color: rgb(64,64,64);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.divChatContainer {
|
||||
transition-property: width, height, opacity;
|
||||
transition-duration: 0.3s;
|
||||
overflow: hidden;
|
||||
max-width: calc(100vw - 30px);
|
||||
max-height: calc(100vh - 55px);
|
||||
}
|
||||
|
||||
.divChat {
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
height: calc(100% - 29px);
|
||||
margin-bottom: 5px;
|
||||
border-radius: 5px;
|
||||
border: solid 1px rgba(0,0,0,0.5);
|
||||
box-shadow: inset 0 1px 5px rgba(0,0,0,0.5);
|
||||
background-color: rgb(128,128,128);
|
||||
}
|
||||
|
||||
.messageRow,
|
||||
.selfMessageRow {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.messageRow {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.selfMessageRow {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.message {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
border: solid 1px rgba(32, 32, 32, 0.5);
|
||||
background-color: rgb(220,220,220);
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.3), inset 0 2px 5px rgba(255,255,255,0.5), inset 0 -2px 5px rgba(128,128,128,0.5);
|
||||
margin: 2px;
|
||||
padding: 5px;
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.messageRow .message {
|
||||
background-color: rgb(220,255,220);
|
||||
}
|
||||
|
||||
.selfMessageRow .message {
|
||||
background-color: rgb(255,255,220);
|
||||
}
|
||||
|
||||
.message .user {
|
||||
box-sizing: border-box;
|
||||
color: rgb(64,64,64);
|
||||
text-shadow: 0 0 1px rgba(0,0,0,0.3);
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.message .text {
|
||||
box-sizing: border-box;
|
||||
color: rgb(32,32,32);
|
||||
text-shadow: 0 0 1px rgba(0,0,0,0.3);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.divChatControls {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.chatTextBox {
|
||||
box-sizing: border-box;
|
||||
padding-top: 2px;
|
||||
padding-left: 5px;
|
||||
padding-bottom: 2px;
|
||||
padding-right: 5px;
|
||||
box-shadow: inset 0 1px 5px rgba(0,0,0,0.5);
|
||||
width: calc(100% - 52px);
|
||||
border-radius: 5px;
|
||||
border: solid 1px rgba(0,0,0,0.5);
|
||||
margin: 0 2px 0 0;
|
||||
vertical-align: top;
|
||||
height: 24px;
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.chatButton {
|
||||
box-sizing: border-box;
|
||||
padding-top: 2px;
|
||||
padding-left: 5px;
|
||||
padding-bottom: 2px;
|
||||
padding-right: 5px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.5), inset 0 0px 6px rgba(0,0,0,0.5), inset 0 5px 10px rgba(255,255,255,0.4);
|
||||
width: 50px;
|
||||
vertical-align: top;
|
||||
border-radius: 5px;
|
||||
border: solid 1px rgba(0,0,0,0.5);
|
||||
height: 24px;
|
||||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: rgb(64,64,64);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.chatButton:hover {
|
||||
background-color: rgb(92,92,92);
|
||||
}
|
||||
|
||||
.chatButton:active {
|
||||
background-color: rgb(64,64,64);
|
||||
box-shadow: inset 0 0px 6px rgba(0,0,0,0.9), inset 0 5px 10px rgba(255,255,255,0.2);
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7596FD6B-DAF0-4B22-B356-5CF4629F0436}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VAR.Focus.Web</RootNamespace>
|
||||
<AssemblyName>VAR.Focus.Web</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<TargetFrameworkProfile />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<Use64BitIISExpress />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="VAR.Json, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VAR.Json.1.2.2\lib\netstandard2.0\VAR.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\BGCork.png" />
|
||||
<Content Include="priv\keep.txt" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||
<Content Include="Resources\Literals.en.json" />
|
||||
<Content Include="Resources\Literals.es.json" />
|
||||
<None Include="web.Debug.config">
|
||||
<DependentUpon>web.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="web.Release.config">
|
||||
<DependentUpon>web.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\05. Cards.js" />
|
||||
<Content Include="Scripts\10. Chat.js" />
|
||||
<Content Include="Styles\02. Boards.css" />
|
||||
<Content Include="Styles\05. Cards.css" />
|
||||
<Content Include="Styles\10. Chat.css" />
|
||||
<Content Include="web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Code\WebSessions.cs" />
|
||||
<Compile Include="Controls\CtrCardBoard.cs" />
|
||||
<Compile Include="Controls\HndCardBoard.cs" />
|
||||
<Compile Include="Controls\CtrChat.cs" />
|
||||
<Compile Include="Controls\HndChat.cs" />
|
||||
<Compile Include="Pages\FrmBoard.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Pages\FrmBoardEdit.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Pages\FrmLogin.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Pages\FrmRegister.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FocusGlobalConfig.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VAR.Focus.BusinessLogic\VAR.Focus.BusinessLogic.csproj">
|
||||
<Project>{d88af21d-1c60-4b27-abff-a133d6afc51c}</Project>
|
||||
<Name>VAR.Focus.BusinessLogic</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VAR.WebForms.Common\VAR.WebForms.Common.csproj">
|
||||
<Project>{328bb4e2-58f2-4beb-a619-ce3fa842ef43}</Project>
|
||||
<Name>VAR.WebForms.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>31337</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:31337/VAR.Focus/</IISUrl>
|
||||
<OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>
|
||||
<IISAppRootUrl>http://localhost:31337/</IISAppRootUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="VAR.Json" version="1.2.2" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.6.1" />
|
||||
<httpModules>
|
||||
<remove name="GlobalModule" />
|
||||
<add name="GlobalModule" type="VAR.WebForms.Common.GlobalModule" />
|
||||
</httpModules>
|
||||
<httpHandlers>
|
||||
<clear />
|
||||
<add path="*" verb="*" type="VAR.WebForms.Common.GlobalRouter" />
|
||||
</httpHandlers>
|
||||
<pages clientIDMode="AutoID" enableViewState="false" enableSessionState="false" enableViewStateMac="false" />
|
||||
<httpRuntime enableVersionHeader="false" />
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<modules>
|
||||
<remove name="GlobalModule" />
|
||||
<add name="GlobalModule" type="VAR.WebForms.Common.GlobalModule" />
|
||||
</modules>
|
||||
<handlers>
|
||||
<clear />
|
||||
<add name="GlobalRouter" path="*" verb="*" type="VAR.WebForms.Common.GlobalRouter" />
|
||||
</handlers>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<remove name="X-Powered-By" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using VAR.Json;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
#region HttpContext
|
||||
|
||||
public static string GetRequestParm(this HttpContext context, string parm)
|
||||
{
|
||||
foreach (string key in context.Request.Params.AllKeys)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key) == false && key.EndsWith(parm))
|
||||
{
|
||||
return context.Request.Params[key];
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static void ResponseObject(this HttpContext context, object obj)
|
||||
{
|
||||
context.Response.ContentType = "text/json";
|
||||
string strObject = JsonWriter.WriteObject(obj);
|
||||
context.Response.Write(strObject);
|
||||
}
|
||||
|
||||
public static void PrepareCacheableResponse(this HttpResponse response)
|
||||
{
|
||||
const int secondsInDay = 86400;
|
||||
response.ExpiresAbsolute = DateTime.Now.AddSeconds(secondsInDay);
|
||||
response.Expires = secondsInDay;
|
||||
response.Cache.SetCacheability(HttpCacheability.Public);
|
||||
response.Cache.SetMaxAge(new TimeSpan(0, 0, secondsInDay));
|
||||
}
|
||||
|
||||
public static void PrepareUncacheableResponse(this HttpResponse response)
|
||||
{
|
||||
response.ExpiresAbsolute = DateTime.Now.AddDays(-2d);
|
||||
response.Expires = -1500;
|
||||
response.AddHeader("Cache-Control", "max-age=0, no-cache, no-store");
|
||||
response.BufferOutput = true;
|
||||
}
|
||||
|
||||
#endregion HttpContext
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public class ScriptsBundler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable { get { return false; } }
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
Bundler bundler = new Bundler(
|
||||
assembly: Assembly.GetExecutingAssembly(),
|
||||
assemblyNamespace: "Scripts",
|
||||
absolutePath: context.Server.MapPath("~/Scripts/"));
|
||||
context.Response.PrepareCacheableResponse();
|
||||
bundler.WriteResponse(context.Response, "text/javascript");
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public class StylesBundler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable { get { return false; } }
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
Bundler bundler = new Bundler(
|
||||
assembly: Assembly.GetExecutingAssembly(),
|
||||
assemblyNamespace: "Styles",
|
||||
absolutePath: context.Server.MapPath("~/Styles/"));
|
||||
context.Response.PrepareCacheableResponse();
|
||||
bundler.WriteResponse(context.Response, "text/css");
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
public class CButton : Button
|
||||
{
|
||||
public CButton()
|
||||
{
|
||||
CssClass = "button";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
public class CLabel : Label
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private string _tagName = "span";
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
public string Tag
|
||||
{
|
||||
get { return _tagName; }
|
||||
set { _tagName = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Life cycle
|
||||
|
||||
public override void RenderBeginTag(HtmlTextWriter writer)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_tagName) == false)
|
||||
{
|
||||
this.AddAttributesToRender(writer);
|
||||
writer.RenderBeginTag(_tagName);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.RenderBeginTag(writer);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Life cycle
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace VAR.WebForms.Common
|
||||
{
|
||||
public class GlobalModule : IHttpModule
|
||||
{
|
||||
public void Dispose() { }
|
||||
|
||||
public void Init(HttpApplication context)
|
||||
{
|
||||
context.PreSendRequestHeaders += Context_PreSendRequestHeaders;
|
||||
}
|
||||
|
||||
private void Context_PreSendRequestHeaders(object sender, EventArgs e)
|
||||
{
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
if (ctx == null) { return; }
|
||||
|
||||
ctx.Response.Headers.Remove("Server");
|
||||
ctx.Response.Headers.Remove("X-Powered-By");
|
||||
ctx.Response.Headers.Add("X-Content-Type-Options", "nosniff");
|
||||
ctx.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
||||
ctx.Response.Headers.Add("X-XSS-Protection", "1; mode=block");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("VAR.WebForms.Common")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("VAR.WebForms.Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © VAR 2015-2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("328bb4e2-58f2-4beb-a619-ce3fa842ef43")]
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{328BB4E2-58F2-4BEB-A619-CE3FA842EF43}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VAR.WebForms.Common</RootNamespace>
|
||||
<AssemblyName>VAR.WebForms.Common</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VAR.Json, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VAR.Json.1.2.2\lib\netstandard2.0\VAR.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Code\Bundler.cs" />
|
||||
<Compile Include="Code\ExtensionMethods.cs" />
|
||||
<Compile Include="Code\GlobalErrorHandler.cs" />
|
||||
<Compile Include="Code\IGlobalConfig.cs" />
|
||||
<Compile Include="Code\MultiLang.cs" />
|
||||
<Compile Include="Code\ObjectActivator.cs" />
|
||||
<Compile Include="Code\ScriptsBundler.cs" />
|
||||
<Compile Include="Code\StaticFileHelper.cs" />
|
||||
<Compile Include="Code\StylesBundler.cs" />
|
||||
<Compile Include="Controls\CButton.cs" />
|
||||
<Compile Include="Controls\CLabel.cs" />
|
||||
<Compile Include="Controls\CTextBox.cs" />
|
||||
<Compile Include="Controls\IValidableControl.cs" />
|
||||
<Compile Include="Code\GlobalConfig.cs" />
|
||||
<Compile Include="GlobalModule.cs" />
|
||||
<Compile Include="GlobalRouter.cs" />
|
||||
<Compile Include="Pages\FormUtils.cs" />
|
||||
<Compile Include="Pages\FrmEcho.cs" />
|
||||
<Compile Include="Pages\FrmError.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Pages\PageCommon.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\01. Base.js" />
|
||||
<EmbeddedResource Include="Scripts\02. Ajax.js" />
|
||||
<EmbeddedResource Include="Scripts\03. Controls.js" />
|
||||
<EmbeddedResource Include="Styles\00. Reset.css" />
|
||||
<EmbeddedResource Include="Styles\01. base.css" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="VAR.Json" version="1.2.2" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
@@ -80,10 +80,10 @@ namespace VAR.WebForms.Common.Code
|
||||
byte[] byteArray = Encoding.UTF8.GetBytes(fileContent);
|
||||
if (byteArray.Length > 0)
|
||||
{
|
||||
response.OutputStream.Write(byteArray, 0, byteArray.Length);
|
||||
response.Body.Write(byteArray, 0, byteArray.Length);
|
||||
|
||||
byteArray = Encoding.UTF8.GetBytes("\n\n");
|
||||
response.OutputStream.Write(byteArray, 0, byteArray.Length);
|
||||
response.Body.Write(byteArray, 0, byteArray.Length);
|
||||
}
|
||||
}
|
||||
foreach (string fileName in AbsoluteFiles)
|
||||
@@ -92,10 +92,10 @@ namespace VAR.WebForms.Common.Code
|
||||
byte[] byteArray = Encoding.UTF8.GetBytes(fileContent);
|
||||
if (byteArray.Length > 0)
|
||||
{
|
||||
response.OutputStream.Write(byteArray, 0, byteArray.Length);
|
||||
response.Body.Write(byteArray, 0, byteArray.Length);
|
||||
|
||||
byteArray = Encoding.UTF8.GetBytes("\n\n");
|
||||
response.OutputStream.Write(byteArray, 0, byteArray.Length);
|
||||
response.Body.Write(byteArray, 0, byteArray.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
57
VAR.WebFormsCore/Code/ExtensionMethods.cs
Normal file
57
VAR.WebFormsCore/Code/ExtensionMethods.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using VAR.Json;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
#region HttpContext
|
||||
|
||||
public static string GetRequestParm(this HttpContext context, string parm)
|
||||
{
|
||||
foreach (string key in context.Request.Form.Keys)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key) == false && key.EndsWith(parm))
|
||||
{
|
||||
return context.Request.Form[key];
|
||||
}
|
||||
}
|
||||
foreach (string key in context.Request.Query.Keys)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key) == false && key.EndsWith(parm))
|
||||
{
|
||||
return context.Request.Query[key];
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static void ResponseObject(this HttpContext context, object obj)
|
||||
{
|
||||
context.Response.ContentType = "text/json";
|
||||
string strObject = JsonWriter.WriteObject(obj);
|
||||
context.Response.WriteAsync(strObject);
|
||||
}
|
||||
|
||||
public static void PrepareCacheableResponse(this HttpResponse response)
|
||||
{
|
||||
// TODO: Implement on asp.net core
|
||||
//const int secondsInDay = 86400;
|
||||
//response.ExpiresAbsolute = DateTime.Now.AddSeconds(secondsInDay);
|
||||
//response.Expires = secondsInDay;
|
||||
//response.Cache.SetCacheability(HttpCacheability.Public);
|
||||
//response.Cache.SetMaxAge(new TimeSpan(0, 0, secondsInDay));
|
||||
}
|
||||
|
||||
public static void PrepareUncacheableResponse(this HttpResponse response)
|
||||
{
|
||||
// TODO: Implement on asp.net core
|
||||
//response.ExpiresAbsolute = DateTime.Now.AddDays(-2d);
|
||||
//response.Expires = -1500;
|
||||
//response.Headers.Add("Cache-Control", "max-age=0, no-cache, no-store");
|
||||
//response.BufferOutput = true;
|
||||
}
|
||||
|
||||
#endregion HttpContext
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
@@ -12,12 +12,12 @@ namespace VAR.WebForms.Common.Code
|
||||
private static void ShowInternalError(HttpContext context, Exception ex)
|
||||
{
|
||||
context.Response.StatusCode = 500;
|
||||
context.Response.Clear();
|
||||
//context.Response.Clear();
|
||||
|
||||
StringBuilder sbOutput = new StringBuilder();
|
||||
sbOutput.Append("<h2>Internal error</h2>");
|
||||
Exception exAux = ex;
|
||||
if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
|
||||
//if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
|
||||
while (exAux != null)
|
||||
{
|
||||
sbOutput.AppendFormat("<p><b>Message:</b> {0}</p>", exAux.Message);
|
||||
@@ -37,7 +37,7 @@ namespace VAR.WebForms.Common.Code
|
||||
sbOutput.Append("-->");
|
||||
}
|
||||
|
||||
context.Response.Write(sbOutput.ToString());
|
||||
context.Response.WriteAsync(sbOutput.ToString());
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
@@ -49,8 +49,8 @@ namespace VAR.WebForms.Common.Code
|
||||
try
|
||||
{
|
||||
IHttpHandler frmError = new FrmError(ex);
|
||||
context.Response.Clear();
|
||||
context.Handler = frmError;
|
||||
//context.Response.Clear();
|
||||
//context.Handler = frmError;
|
||||
frmError.ProcessRequest(context);
|
||||
}
|
||||
catch
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
9
VAR.WebFormsCore/Code/IHttpHandler.cs
Normal file
9
VAR.WebFormsCore/Code/IHttpHandler.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public interface IHttpHandler
|
||||
{
|
||||
void ProcessRequest(HttpContext context);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using VAR.Json;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
@@ -11,8 +8,10 @@ namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
private static string GetLocalPath(string path)
|
||||
{
|
||||
string currentDir = Path.GetDirectoryName((new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath);
|
||||
return string.Format("{0}/{1}", Directory.GetParent(currentDir), path);
|
||||
// TODO: Needs replacement for Assembly.GetExecutingAssembly().CodeBase
|
||||
//string currentDir = Path.GetDirectoryName((new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath);
|
||||
//return string.Format("{0}/{1}", Directory.GetParent(currentDir), path);
|
||||
return path;
|
||||
}
|
||||
|
||||
private static Dictionary<string, Dictionary<string, object>> _literals = null;
|
||||
@@ -37,33 +36,34 @@ namespace VAR.WebForms.Common.Code
|
||||
|
||||
private static string GetUserLanguage()
|
||||
{
|
||||
HttpContext ctx = HttpContext.Current;
|
||||
if (ctx != null)
|
||||
{
|
||||
if (ctx.Items["UserLang"] != null)
|
||||
{
|
||||
return (string)ctx.Items["UserLang"];
|
||||
}
|
||||
// TODO: Needs replacement for ctx.Request.UserLanguages
|
||||
//HttpContext ctx = HttpContext.Current;
|
||||
//if (ctx != null)
|
||||
//{
|
||||
// if (ctx.Items["UserLang"] != null)
|
||||
// {
|
||||
// return (string)ctx.Items["UserLang"];
|
||||
// }
|
||||
|
||||
IEnumerable<string> userLanguages = ctx.Request.UserLanguages
|
||||
.Select(lang =>
|
||||
{
|
||||
if (lang.Contains(";"))
|
||||
{
|
||||
lang = lang.Split(';')[0];
|
||||
}
|
||||
if (lang.Contains("-"))
|
||||
{
|
||||
lang = lang.Split('-')[0];
|
||||
}
|
||||
return lang.ToLower();
|
||||
})
|
||||
.Where(lang => _literals.ContainsKey(lang));
|
||||
string userLang = userLanguages.FirstOrDefault() ?? _defaultLanguage;
|
||||
// IEnumerable<string> userLanguages = ctx.Request.UserLanguages
|
||||
// .Select(lang =>
|
||||
// {
|
||||
// if (lang.Contains(";"))
|
||||
// {
|
||||
// lang = lang.Split(';')[0];
|
||||
// }
|
||||
// if (lang.Contains("-"))
|
||||
// {
|
||||
// lang = lang.Split('-')[0];
|
||||
// }
|
||||
// return lang.ToLower();
|
||||
// })
|
||||
// .Where(lang => _literals.ContainsKey(lang));
|
||||
// string userLang = userLanguages.FirstOrDefault() ?? _defaultLanguage;
|
||||
|
||||
ctx.Items["UserLang"] = userLang;
|
||||
return userLang;
|
||||
}
|
||||
// ctx.Items["UserLang"] = userLang;
|
||||
// return userLang;
|
||||
//}
|
||||
return _defaultLanguage;
|
||||
}
|
||||
|
||||
24
VAR.WebFormsCore/Code/ScriptsBundler.cs
Normal file
24
VAR.WebFormsCore/Code/ScriptsBundler.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public class ScriptsBundler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable { get { return false; } }
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
// TODO: Needs replacement for context.Server.MapPath
|
||||
//Bundler bundler = new Bundler(
|
||||
// assembly: Assembly.GetExecutingAssembly(),
|
||||
// assemblyNamespace: "Scripts",
|
||||
// absolutePath: context.Server.MapPath("~/Scripts/"));
|
||||
//context.Response.PrepareCacheableResponse();
|
||||
//bundler.WriteResponse(context.Response, "text/javascript");
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace VAR.WebForms.Common.Code
|
||||
contentType = _mimeTypeByExtension[extension];
|
||||
}
|
||||
|
||||
context.Response.Clear();
|
||||
//context.Response.Clear();
|
||||
|
||||
if (string.IsNullOrEmpty(contentType) == false)
|
||||
{
|
||||
@@ -83,11 +83,13 @@ namespace VAR.WebForms.Common.Code
|
||||
}
|
||||
context.Response.PrepareCacheableResponse();
|
||||
|
||||
context.Response.Buffer = true;
|
||||
context.Response.WriteFile(filePath);
|
||||
context.Response.Flush();
|
||||
context.Response.Close();
|
||||
context.Response.End();
|
||||
//context.Response.Buffer = true;
|
||||
//context.Response.WriteFile(filePath);
|
||||
//context.Response.Flush();
|
||||
//context.Response.Close();
|
||||
//context.Response.End();
|
||||
byte[] fileData = File.ReadAllBytes(filePath);
|
||||
context.Response.Body.Write(fileData);
|
||||
}
|
||||
|
||||
}
|
||||
24
VAR.WebFormsCore/Code/StylesBundler.cs
Normal file
24
VAR.WebFormsCore/Code/StylesBundler.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace VAR.WebForms.Common.Code
|
||||
{
|
||||
public class StylesBundler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable { get { return false; } }
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
// TODO: Needs replacement for context.Server.MapPath
|
||||
//Bundler bundler = new Bundler(
|
||||
// assembly: Assembly.GetExecutingAssembly(),
|
||||
// assemblyNamespace: "Styles",
|
||||
// absolutePath: context.Server.MapPath("~/Styles/"));
|
||||
//context.Response.PrepareCacheableResponse();
|
||||
//bundler.WriteResponse(context.Response, "text/css");
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
}
|
||||
}
|
||||
20
VAR.WebFormsCore/Code/Unit.cs
Normal file
20
VAR.WebFormsCore/Code/Unit.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace VAR.WebFormsCore.Code
|
||||
{
|
||||
public class Unit
|
||||
{
|
||||
private int _value;
|
||||
private UnitType _unitType;
|
||||
|
||||
public Unit(int value, UnitType type)
|
||||
{
|
||||
_value = value;
|
||||
_unitType = type;
|
||||
}
|
||||
}
|
||||
|
||||
public enum UnitType
|
||||
{
|
||||
Pixel,
|
||||
Percentaje,
|
||||
}
|
||||
}
|
||||
18
VAR.WebFormsCore/Controls/CButton.cs
Normal file
18
VAR.WebFormsCore/Controls/CButton.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class CButton : Control
|
||||
{
|
||||
public CButton()
|
||||
{
|
||||
CssClass = "button";
|
||||
}
|
||||
|
||||
public string Text { get; set; }
|
||||
public string CommandArgument { get; set; }
|
||||
|
||||
public event EventHandler Click;
|
||||
}
|
||||
}
|
||||
41
VAR.WebFormsCore/Controls/CLabel.cs
Normal file
41
VAR.WebFormsCore/Controls/CLabel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class CLabel : Control
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private string _tagName = "span";
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
public string Tag
|
||||
{
|
||||
get { return _tagName; }
|
||||
set { _tagName = value; }
|
||||
}
|
||||
|
||||
public string Text { get; set; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Life cycle
|
||||
|
||||
//public override void RenderBeginTag(HtmlTextWriter writer)
|
||||
//{
|
||||
// if (string.IsNullOrEmpty(_tagName) == false)
|
||||
// {
|
||||
// this.AddAttributesToRender(writer);
|
||||
// writer.RenderBeginTag(_tagName);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// base.RenderBeginTag(writer);
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion Life cycle
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.Json;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class CTextBox : Control, INamingContainer, IValidableControl
|
||||
{
|
||||
#region Declarations
|
||||
30
VAR.WebFormsCore/Controls/Control.cs
Normal file
30
VAR.WebFormsCore/Controls/Control.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VAR.WebForms.Common.Pages;
|
||||
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class Control
|
||||
{
|
||||
public event EventHandler PreInit;
|
||||
public event EventHandler Init;
|
||||
public event EventHandler Load;
|
||||
public event EventHandler PreRender;
|
||||
|
||||
public string CssClass { get; set; }
|
||||
public List<Control> Controls { get; set; }
|
||||
|
||||
public bool Visible { get; set; }
|
||||
|
||||
public string ID { get; set; }
|
||||
|
||||
public string ClientID { get; set; }
|
||||
|
||||
public Dictionary<string, string> Style { get; set; }
|
||||
|
||||
public Dictionary<string, string> Attributes { get; set; }
|
||||
|
||||
public Page Page { get; set; }
|
||||
}
|
||||
}
|
||||
8
VAR.WebFormsCore/Controls/HiddenField.cs
Normal file
8
VAR.WebFormsCore/Controls/HiddenField.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class HiddenField : Control
|
||||
{
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
8
VAR.WebFormsCore/Controls/HtmlBody.cs
Normal file
8
VAR.WebFormsCore/Controls/HtmlBody.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HtmlBody : Control
|
||||
{
|
||||
}
|
||||
}
|
||||
8
VAR.WebFormsCore/Controls/HtmlForm.cs
Normal file
8
VAR.WebFormsCore/Controls/HtmlForm.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HtmlForm : Control
|
||||
{
|
||||
}
|
||||
}
|
||||
14
VAR.WebFormsCore/Controls/HtmlGenericControl.cs
Normal file
14
VAR.WebFormsCore/Controls/HtmlGenericControl.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HtmlGenericControl : Control
|
||||
{
|
||||
private string _tag;
|
||||
|
||||
public HtmlGenericControl(string tag)
|
||||
{
|
||||
this._tag = tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
VAR.WebFormsCore/Controls/HtmlHead.cs
Normal file
9
VAR.WebFormsCore/Controls/HtmlHead.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HtmlHead : Control
|
||||
{
|
||||
public string Title { get; internal set; }
|
||||
}
|
||||
}
|
||||
11
VAR.WebFormsCore/Controls/HtmlMeta.cs
Normal file
11
VAR.WebFormsCore/Controls/HtmlMeta.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HtmlMeta : Control
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string HttpEquiv { get; internal set; }
|
||||
}
|
||||
}
|
||||
11
VAR.WebFormsCore/Controls/HyperLink.cs
Normal file
11
VAR.WebFormsCore/Controls/HyperLink.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class HyperLink : Control
|
||||
{
|
||||
|
||||
public string NavigateUrl { get; set; }
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
6
VAR.WebFormsCore/Controls/INamingContainer.cs
Normal file
6
VAR.WebFormsCore/Controls/INamingContainer.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
public interface INamingContainer
|
||||
{
|
||||
}
|
||||
}
|
||||
13
VAR.WebFormsCore/Controls/LiteralControl.cs
Normal file
13
VAR.WebFormsCore/Controls/LiteralControl.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
public class LiteralControl : Control
|
||||
{
|
||||
public string Content { get; set; }
|
||||
|
||||
public LiteralControl() { }
|
||||
public LiteralControl(string content) { Content = content; }
|
||||
|
||||
}
|
||||
}
|
||||
12
VAR.WebFormsCore/Controls/Panel.cs
Normal file
12
VAR.WebFormsCore/Controls/Panel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using VAR.WebForms.Common.Controls;
|
||||
using VAR.WebFormsCore.Code;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class Panel : Control
|
||||
{
|
||||
public Unit Width { get; set; }
|
||||
public Unit Height { get; set; }
|
||||
}
|
||||
}
|
||||
17
VAR.WebFormsCore/Controls/TextBox.cs
Normal file
17
VAR.WebFormsCore/Controls/TextBox.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace VAR.WebForms.Common.Controls
|
||||
{
|
||||
// TODO: Implememnt control
|
||||
public class TextBox : Control
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
||||
public TextBoxMode TextMode { get; set; } = TextBoxMode.Normal;
|
||||
}
|
||||
|
||||
public enum TextBoxMode
|
||||
{
|
||||
Normal,
|
||||
Password,
|
||||
MultiLine,
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,89 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.WebForms.Common
|
||||
namespace VAR.Focus.WebApp
|
||||
{
|
||||
public class GlobalRouter : IHttpHandler
|
||||
// You may need to install the Microsoft.AspNetCore.Http.Abstractions package into your project
|
||||
public class GlobalRouterMiddleware
|
||||
{
|
||||
#region Handlers
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public GlobalRouterMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public Task Invoke(HttpContext httpContext)
|
||||
{
|
||||
|
||||
|
||||
httpContext.Response.Headers.Remove("Server");
|
||||
httpContext.Response.Headers.Remove("X-Powered-By");
|
||||
httpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff");
|
||||
httpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
||||
httpContext.Response.Headers.Add("X-XSS-Protection", "1; mode=block");
|
||||
|
||||
try
|
||||
{
|
||||
RouteRequest(httpContext);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is ThreadAbortException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
GlobalErrorHandler.HandleError(httpContext, ex);
|
||||
}
|
||||
|
||||
//httpContext.Response.WriteAsync("Hello World!");
|
||||
|
||||
//return _next(httpContext);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void RouteRequest(HttpContext context)
|
||||
{
|
||||
// TODO: need a replacement for context.Request.FilePath, using context.Request.Path for now
|
||||
string path = context.Request.Path;
|
||||
string file = Path.GetFileName(path);
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
file = GlobalConfig.Get().DefaultHandler;
|
||||
}
|
||||
|
||||
// Pass allowed extensions requests
|
||||
string extension = Path.GetExtension(path).ToLower();
|
||||
if (GlobalConfig.Get().AllowedExtensions.Contains(extension))
|
||||
{
|
||||
// TODO: need a replacement for context.Request.PhysicalPath, using context.Request.Path for now
|
||||
string filePath = context.Request.Path;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
StaticFileHelper.ResponseStaticFile(context, filePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IHttpHandler handler = GetHandler(file);
|
||||
if (handler == null)
|
||||
{
|
||||
// TODO: FrmNotFound
|
||||
throw new Exception("NotFound");
|
||||
}
|
||||
|
||||
// Use handler
|
||||
//context.Response.Clear();
|
||||
//context.Handler = handler;
|
||||
handler.ProcessRequest(context);
|
||||
}
|
||||
|
||||
private static Dictionary<string, Type> _handlers = new Dictionary<string, Type>();
|
||||
|
||||
@@ -77,68 +152,14 @@ namespace VAR.WebForms.Common
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion Handlers
|
||||
|
||||
#region IHttpHandler
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
RouteRequest(context);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is ThreadAbortException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GlobalErrorHandler.HandleError(context, ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void RouteRequest(HttpContext context)
|
||||
{
|
||||
string file = Path.GetFileName(context.Request.FilePath);
|
||||
if (string.IsNullOrEmpty(file))
|
||||
{
|
||||
file = GlobalConfig.Get().DefaultHandler;
|
||||
}
|
||||
|
||||
// Pass allowed extensions requests
|
||||
string extension = Path.GetExtension(context.Request.FilePath).ToLower();
|
||||
if (GlobalConfig.Get().AllowedExtensions.Contains(extension))
|
||||
{
|
||||
string filePath = context.Request.PhysicalPath;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
StaticFileHelper.ResponseStaticFile(context, filePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IHttpHandler handler = GetHandler(file);
|
||||
if (handler == null)
|
||||
{
|
||||
// TODO: FrmNotFound
|
||||
throw new Exception("NotFound");
|
||||
}
|
||||
|
||||
// Use handler
|
||||
context.Response.Clear();
|
||||
context.Handler = handler;
|
||||
handler.ProcessRequest(context);
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
|
||||
// Extension method used to add the middleware to the HTTP request pipeline.
|
||||
public static class GlobalRouterMiddlewareExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseGlobalRouterMiddleware(this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseMiddleware<GlobalRouterMiddleware>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Collections.Generic;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
@@ -62,7 +61,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Controls_AreValid(ControlCollection controls)
|
||||
public static bool Controls_AreValid(List<Control> controls)
|
||||
{
|
||||
bool valid = true;
|
||||
foreach (Control control in controls)
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Web;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using VAR.Json;
|
||||
using VAR.WebForms.Common.Code;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
@@ -14,9 +15,9 @@ namespace VAR.WebForms.Common.Pages
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
context.Response.Write("<pre><code>");
|
||||
context.Response.Write(JsonWriter.WriteObject(context.Request, indent: true));
|
||||
context.Response.Write("</code></pre>");
|
||||
context.Response.WriteAsync("<pre><code>");
|
||||
context.Response.WriteAsync(JsonWriter.WriteObject(context.Request, indent: true));
|
||||
context.Response.WriteAsync("</code></pre>");
|
||||
}
|
||||
|
||||
#endregion IHttpHandler
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
@@ -39,7 +37,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
Controls.Add(lblErrorTitle);
|
||||
|
||||
Exception exAux = _ex;
|
||||
if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
|
||||
//if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; }
|
||||
while (exAux != null)
|
||||
{
|
||||
CLabel lblMessage = new CLabel { Tag = "P" };
|
||||
22
VAR.WebFormsCore/Pages/Page.cs
Normal file
22
VAR.WebFormsCore/Pages/Page.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
namespace VAR.WebForms.Common.Pages
|
||||
{
|
||||
// TODO: Implement Page
|
||||
public class Page : Control, IHttpHandler
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public HttpContext Context { get; set; }
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
Context = context;
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsPostBack { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using VAR.WebForms.Common.Code;
|
||||
using VAR.WebForms.Common.Controls;
|
||||
|
||||
@@ -14,7 +11,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
#region Declarations
|
||||
|
||||
private HtmlHead _head;
|
||||
private HtmlGenericControl _body;
|
||||
private HtmlBody _body;
|
||||
private HtmlForm _form;
|
||||
private Panel _pnlContainer = new Panel();
|
||||
private CButton _btnPostback = new CButton();
|
||||
@@ -27,7 +24,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
|
||||
#region Properties
|
||||
|
||||
public new ControlCollection Controls
|
||||
public new List<Control> Controls
|
||||
{
|
||||
get { return _pnlContainer.Controls; }
|
||||
}
|
||||
@@ -56,7 +53,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
_isAuthenticated = GlobalConfig.Get().IsUserAuthenticated(Context);
|
||||
if (_mustBeAutenticated && _isAuthenticated == false)
|
||||
{
|
||||
Response.Redirect(GlobalConfig.Get().LoginHandler);
|
||||
Context.Response.Redirect(GlobalConfig.Get().LoginHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +77,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
GlobalConfig.Get().UserUnauthenticate(Context);
|
||||
if (_mustBeAutenticated)
|
||||
{
|
||||
Response.Redirect(GlobalConfig.Get().LoginHandler);
|
||||
Context.Response.Redirect(GlobalConfig.Get().LoginHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +87,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
|
||||
private void CreateControls()
|
||||
{
|
||||
Context.Response.Charset = Encoding.UTF8.WebName;
|
||||
//Context.Response.Charset = Encoding.UTF8.WebName;
|
||||
|
||||
var doctype = new LiteralControl("<!DOCTYPE html>\n");
|
||||
base.Controls.Add(doctype);
|
||||
@@ -111,7 +108,7 @@ namespace VAR.WebForms.Common.Pages
|
||||
_head.Controls.Add(new LiteralControl(string.Format("<script type=\"text/javascript\" src=\"ScriptsBundler?v={0}\"></script>\n", version)));
|
||||
_head.Controls.Add(new LiteralControl(string.Format("<link href=\"StylesBundler?v={0}\" type=\"text/css\" rel=\"stylesheet\"/>\n", version)));
|
||||
|
||||
_body = new HtmlGenericControl("body");
|
||||
_body = new HtmlBody();
|
||||
html.Controls.Add(_body);
|
||||
_form = new HtmlForm { ID = "formMain" };
|
||||
_body.Controls.Add(_form);
|
||||
29
VAR.WebFormsCore/VAR.WebFormsCore.csproj
Normal file
29
VAR.WebFormsCore/VAR.WebFormsCore.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Scripts\01. Base.js" />
|
||||
<None Remove="Scripts\02. Ajax.js" />
|
||||
<None Remove="Scripts\03. Controls.js" />
|
||||
<None Remove="Styles\00. Reset.css" />
|
||||
<None Remove="Styles\01. base.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\01. Base.js" />
|
||||
<EmbeddedResource Include="Scripts\02. Ajax.js" />
|
||||
<EmbeddedResource Include="Scripts\03. Controls.js" />
|
||||
<EmbeddedResource Include="Styles\00. Reset.css" />
|
||||
<EmbeddedResource Include="Styles\01. base.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="VAR.Json" Version="1.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user