This commit is contained in:
135
source/WBI/App_Code/BaseEditPage.cs
Normal file
135
source/WBI/App_Code/BaseEditPage.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using GZTW.AyaNova.BLL;
|
||||
|
||||
/// <summary>
|
||||
/// Base page for all edit pages
|
||||
/// Handles rights, localization and all other
|
||||
/// common methods
|
||||
/// </summary>
|
||||
public class BaseEditPage : System.Web.UI.Page
|
||||
{
|
||||
public BaseEditPage()
|
||||
{
|
||||
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPreInit(EventArgs e)
|
||||
{
|
||||
Util.SetUserLocale();
|
||||
base.OnPreInit(e);
|
||||
|
||||
//if (Request.Cookies["Theme"] == null)
|
||||
//{
|
||||
// Response.Cookies["Theme"].Value = "Default";
|
||||
// Response.Cookies["Theme"].Expires = DateTime.Now.AddYears(30);
|
||||
// Page.Theme = "Default";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Page.Theme = ((string)Request.Cookies["Theme"].Value);
|
||||
//}
|
||||
|
||||
////Test built in themes in new ajax controls
|
||||
//Page.Theme = "Inox";
|
||||
|
||||
//if (Session["MyTheme"] == null)
|
||||
//{
|
||||
// Session.Add("MyTheme", "Default");
|
||||
// Page.Theme = ((string)Session["MyTheme"]);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Page.Theme = ((string)Session["MyTheme"]);
|
||||
//}
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
|
||||
//Place code here that should be called before the inheriting page's onload is executed
|
||||
|
||||
|
||||
//case 1651
|
||||
string sIE9ForceCompatibility = System.Configuration.ConfigurationManager.AppSettings["IE9ForceCompatbilityMode"];
|
||||
if (!string.IsNullOrWhiteSpace(sIE9ForceCompatibility))
|
||||
{
|
||||
if (sIE9ForceCompatibility.ToLower() == "true")
|
||||
{
|
||||
HtmlMeta meta = new HtmlMeta();
|
||||
meta.HttpEquiv = "X-UA-Compatible";
|
||||
meta.Content = "IE=8";
|
||||
this.Header.Controls.Add(meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
base.OnLoad(e);
|
||||
|
||||
//Place code here that should be called *after* the inheriting pages onload is executed
|
||||
if (!IsAjaxCallback)
|
||||
{
|
||||
if (this.Context.Session != null)
|
||||
Util.SessionAddKeepAlive(this.Page);
|
||||
}
|
||||
|
||||
Literal l = new Literal();
|
||||
l.Text = "<link rel=\"stylesheet\" href=\"aya.css\" type=\"text/css\" />";
|
||||
l.ID = "aya";
|
||||
if (Page.Header.FindControl(l.ID) == null)
|
||||
Page.Header.Controls.Add(l);
|
||||
|
||||
//case 1111
|
||||
Util.PageAddCustomContent(this.Page);
|
||||
|
||||
}
|
||||
|
||||
protected void CloseMe()
|
||||
{
|
||||
//this causes the original window to refresh, useful if record has changed
|
||||
//Response.Write("<script language=\"JavaScript\">window.opener.location.reload();</script>");
|
||||
// Response.Write("<script language=\"JavaScript\">window.setTimeout('window.close()',10);</script>");
|
||||
|
||||
|
||||
//Response.Write("<script language=\"JavaScript\">window.close();</script>");
|
||||
//This version works around the IE7 tab close warning, that the above one generates
|
||||
Response.Write("<script type=\"text/javascript\"> window.open('','_parent',''); window.close(); </script> ");
|
||||
|
||||
}
|
||||
|
||||
private bool checkedforcallback=false;
|
||||
private bool iscallback = false;
|
||||
public bool IsAjaxCallback
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!checkedforcallback)
|
||||
{
|
||||
iscallback = Page.IsCallback;
|
||||
//HttpContext ctx = HttpContext.Current;
|
||||
|
||||
//iscallback = (
|
||||
// ctx != null &&
|
||||
// ctx.Request != null &&
|
||||
// (ctx.Request.QueryString["rcbID"] != null ||
|
||||
// ctx.Request.Form["RadAJAXControlID"]!=null));
|
||||
checkedforcallback = true;
|
||||
}
|
||||
return iscallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user