commit 2e35bd8c60f880d07c63631b0738315036aeace1 Author: bobwang <8205347@qq.com> Date: Sun Feb 18 23:33:54 2024 +0800 add diff --git a/App_Code/.svn/entries b/App_Code/.svn/entries new file mode 100644 index 0000000..c0dedaf --- /dev/null +++ b/App_Code/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/App_Code +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +PagePublic.cs +file + + + + +2011-04-01T02:51:10.289868Z +88adefccb355a757a198d9d5710b8905 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +637 + +ExcelExp.cs +file + + + + +2011-04-01T02:51:10.305493Z +622cd19125108d2405c68fbaa5dd594a +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1888 + +SessionEndModule.cs +file + + + + +2011-04-01T02:51:10.305493Z +afc00bfe8b5a4c00a5defa6a1221b0fb +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5243 + +PageBase.cs +file + + + + +2011-04-01T02:51:10.321118Z +ada92b7d54cfb24aba200636f6b94af8 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +2850 + diff --git a/App_Code/.svn/text-base/ExcelExp.cs.svn-base b/App_Code/.svn/text-base/ExcelExp.cs.svn-base new file mode 100644 index 0000000..118e6ca --- /dev/null +++ b/App_Code/.svn/text-base/ExcelExp.cs.svn-base @@ -0,0 +1,55 @@ +using System; +using System.Data; +using System.Configuration; +using System.IO; +using System.Text; +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; + +namespace view.App_Code +{ + /// + /// utils 的摘要说明 + /// + public class ExcelExp + { + public ExcelExp() + { + // + // TODO: 在此处添加构造函数逻辑 + // + } + + + public static void Export(GridView GridView1, DataView dv ,ScriptManager sm,Control Button1,string fileName, Page page ) + { + sm.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + GridView1.DataSource = dv; + GridView1.DataBind(); + + + HttpContext.Current.Response.Charset = "GB2312"; + HttpContext.Current.Response.ContentEncoding = Encoding.UTF7; + HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8).ToString()); + HttpContext.Current.Response.ContentType = "application/ms-excel"; + page.EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + HttpContext.Current.Response.Write(tw.ToString()); + HttpContext.Current.Response.End(); + + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + GridView1.DataSource = dv; + GridView1.DataBind(); + } + + } +} \ No newline at end of file diff --git a/App_Code/.svn/text-base/PageBase.cs.svn-base b/App_Code/.svn/text-base/PageBase.cs.svn-base new file mode 100644 index 0000000..8245cc0 --- /dev/null +++ b/App_Code/.svn/text-base/PageBase.cs.svn-base @@ -0,0 +1,94 @@ +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 ZhangPu.Gov.Logical; + +/// +/// utils 的摘要说明 +/// +public class PageBase : PagePublic +{ + public PageBase() + { + + } + + + + // protected LEmployee lem; + // const string DefaultPage = "~/index.aspx"; + // const string HomePage = "~/Desktop.aspx"; + + public void CheckAuthority() + { + if (checkCloseIE()) return; + + string requestPage = Request.AppRelativeCurrentExecutionFilePath + Request.Url.Query; + requestPage = requestPage.ToUpper(); + // if (DefaultPage.Equals(requestPage)) return; //起始页不做判断 + if (DefaultPage.ToUpper() == requestPage) return; //起始页不做判断 + + if (lem == null) + { + logobj.LoginLog(string.Empty,"lem is null"); + Response.Redirect(DefaultPage); + } + if (HomePage.ToUpper() == requestPage) return; + if (lem.GetEmployee.em_account == "Root") //内建管理员 + { + + return; + } + + if (lem.AuthList.Contains(requestPage)) return; + if (!new LRoleAuthority().GetPublicAuthorityList().Contains(requestPage)) + { + logobj.RequestPageLog(); + + logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!"); + + Response.Redirect(DefaultPage); + } + + } + + protected override void OnPreInit(EventArgs e) + { + + base.OnPreInit(e); + + CheckAuthority(); + + } + bool checkCloseIE() + { + if (!string.IsNullOrEmpty(Request.QueryString["___command"])) + { + string cmd = Request.QueryString["___command"]; + if (cmd == "ClearSession") + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + myLog.RequestLog logobj = new myLog.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session. + return true; + } + } + return false; + } + +} diff --git a/App_Code/.svn/text-base/PagePublic.cs.svn-base b/App_Code/.svn/text-base/PagePublic.cs.svn-base new file mode 100644 index 0000000..f64f45c --- /dev/null +++ b/App_Code/.svn/text-base/PagePublic.cs.svn-base @@ -0,0 +1,26 @@ +using System; +using System.Web.UI; +using ZhangPu.Gov.Logical; + +/// +/// PagePublic 的摘要说明 +/// +public class PagePublic : Page +{ + protected LEmployee lem; + protected const string DefaultPage = "~/index.aspx"; + protected const string HomePage = "~/Desktop.aspx"; + protected myLog.RequestLog logobj; + public PagePublic() + { +   + } + protected override void OnPreInit(EventArgs e) + { +   lem = (LEmployee)Session["CurrentUser"]; +   + base.OnPreInit(e); + logobj = new myLog.RequestLog(); + logobj.RequestPageLog(); + } +} diff --git a/App_Code/.svn/text-base/SessionEndModule.cs.svn-base b/App_Code/.svn/text-base/SessionEndModule.cs.svn-base new file mode 100644 index 0000000..328a35b --- /dev/null +++ b/App_Code/.svn/text-base/SessionEndModule.cs.svn-base @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; + +using System.Web; +using System.Web.Caching; +using System.Web.SessionState; +using System.Web.UI; + +namespace view.App_Code +{ + /// + /// When an ASP.NET State Server other than InProc, the Session_End event + /// does not get fired. This is an HttpModule which uses some workarounds + /// and fires a static event when a session ends, with the value of a single + /// configurable session variable in the event arguments. + /// + public class SessionEndModule : IHttpModule + { + #region Private Variables + + private HttpApplication m_HttpApplication; + private static string m_SessionObjectKey; + + #endregion + + #region Accessors + + /// + /// This is the key of the item in the session which should be returned + /// in the SessionEnd event (as the SessionObject). + /// + /// + /// If you're storing the user ID in the session, under a key called 'UserId' + /// and need to do something with it in the SessionEnd event, you would set + /// this to 'UserId', which would cause the value of the session key called + /// 'UserId' to be returned. + /// + public static string SessionObjectKey + { + get + { + return m_SessionObjectKey; + } + set + { + m_SessionObjectKey = value; + } + } + + #endregion + + #region IHttpModule Implementation + + public void Init(HttpApplication context) + { + m_HttpApplication = context; + m_HttpApplication.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute); + } + + public void Dispose() + { + // Do Nothing + } + + #endregion + + #region Events + + /// + /// Event raised when the session ends + /// + public static event SessionEndEventHandler SessionEnd; + + #endregion + + private void OnPreRequestHandlerExecute(object sender, EventArgs e) + { + // We only want to update the session when an ASPX page is being viewed + // We're also doing this in the PreRequestHandler, as doing it elsewhere + // (like the PostRequestHandler) can cause some strange behaviour. + + if (Path.GetExtension(m_HttpApplication.Context.Request.Path).ToLower() == ".aspx") + { + // Ensure we have a HttpContext + if (HttpContext.Current == null) + { + Debug.WriteLine("No current http context"); + return; + } + + // Get the current session + HttpSessionState currentSession = HttpContext.Current.Session; + + // Ensure we have a current session + if (currentSession == null) + { + Debug.WriteLine("No current session"); + return; + } + + // Get the session timeout + TimeSpan sessionTimeout = new TimeSpan(0, 0, currentSession.Timeout, 0, 0); + + // Get the object in the session we want to retrieve when the session times out + object sessionObject = currentSession[SessionObjectKey]; + + // Add the object to the cache with the current session id, and set a cache removal callback method + HttpContext.Current.Cache.Insert(currentSession.SessionID, sessionObject, null, DateTime.MaxValue, sessionTimeout, CacheItemPriority.NotRemovable, CacheItemRemovedCallbackMethod); + } + } + + /// + /// This method is fired when an item is removed from the cache. It is used to detect when a cache item + /// expires, indicating that the session has expired, and fires the SessionEnd event. + /// + private void CacheItemRemovedCallbackMethod(string key, object value, CacheItemRemovedReason reason) + { + if (reason == CacheItemRemovedReason.Expired) + { + if (SessionEnd != null) + { + SessionEndedEventArgs e = new SessionEndedEventArgs(key, value); + SessionEnd(this, e); + + } + } + } + } + + /// + /// Event handler for handling the SessionEnd event + /// + public delegate void SessionEndEventHandler(object sender, SessionEndedEventArgs e); + + /// + /// SessionEndedEventArgs for use in the SessionEnd event + /// + public class SessionEndedEventArgs : EventArgs + { + public readonly string SessionId; + public readonly object SessionObject; + + public SessionEndedEventArgs(string sessionId, object sessionObject) + { + SessionId = sessionId; + SessionObject = sessionObject; + } + } +} \ No newline at end of file diff --git a/App_Code/ExcelExp.cs b/App_Code/ExcelExp.cs new file mode 100644 index 0000000..118e6ca --- /dev/null +++ b/App_Code/ExcelExp.cs @@ -0,0 +1,55 @@ +using System; +using System.Data; +using System.Configuration; +using System.IO; +using System.Text; +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; + +namespace view.App_Code +{ + /// + /// utils 的摘要说明 + /// + public class ExcelExp + { + public ExcelExp() + { + // + // TODO: 在此处添加构造函数逻辑 + // + } + + + public static void Export(GridView GridView1, DataView dv ,ScriptManager sm,Control Button1,string fileName, Page page ) + { + sm.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + GridView1.DataSource = dv; + GridView1.DataBind(); + + + HttpContext.Current.Response.Charset = "GB2312"; + HttpContext.Current.Response.ContentEncoding = Encoding.UTF7; + HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8).ToString()); + HttpContext.Current.Response.ContentType = "application/ms-excel"; + page.EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + HttpContext.Current.Response.Write(tw.ToString()); + HttpContext.Current.Response.End(); + + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + GridView1.DataSource = dv; + GridView1.DataBind(); + } + + } +} \ No newline at end of file diff --git a/App_Code/PageBase.cs b/App_Code/PageBase.cs new file mode 100644 index 0000000..3cdb3ee --- /dev/null +++ b/App_Code/PageBase.cs @@ -0,0 +1,94 @@ +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 DeiNiu.wms.Logical; + +/// +/// utils 的摘要说明 +/// +public class PageBase : PagePublic +{ + public PageBase() + { + + } + + + + // protected LEmployee lem; + // const string DefaultPage = "~/index.aspx"; + // const string HomePage = "~/Desktop.aspx"; + + public void CheckAuthority() + { + if (checkCloseIE()) return; + + string requestPage = Request.AppRelativeCurrentExecutionFilePath + Request.Url.Query; + requestPage = requestPage.ToUpper(); + // if (DefaultPage.Equals(requestPage)) return; //起始页不做判断 + if (DefaultPage.ToUpper() == requestPage) return; //起始页不做判断 + + if (lem == null) + { + //logobj.LoginLog(string.Empty,"lem is null"); + Response.Redirect(DefaultPage); + } + if (HomePage.ToUpper() == requestPage) return; + if (lem.GetEmployee.em_account == "Root") //内建管理员 + { + + return; + } + + if (lem.AuthList.Contains(requestPage)) return; + if (!new LRoleAuthority().GetPublicAuthorityList().Contains(requestPage)) + { + // logobj.RequestPageLog(); + + // logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!"); + + Response.Redirect(DefaultPage); + } + + } + + protected override void OnPreInit(EventArgs e) + { + + base.OnPreInit(e); + + CheckAuthority(); + + } + bool checkCloseIE() + { + if (!string.IsNullOrEmpty(Request.QueryString["___command"])) + { + string cmd = Request.QueryString["___command"]; + if (cmd == "ClearSession") + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + // logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session. + return true; + } + } + return false; + } + +} diff --git a/App_Code/PagePublic.cs b/App_Code/PagePublic.cs new file mode 100644 index 0000000..5fee555 --- /dev/null +++ b/App_Code/PagePublic.cs @@ -0,0 +1,26 @@ +using System; +using System.Web.UI; +using DeiNiu.wms.Logical; + +/// +/// PagePublic 的摘要说明 +/// +public class PagePublic : Page +{ + protected LEmployee lem; + protected const string DefaultPage = "~/index.aspx"; + protected const string HomePage = "~/Desktop.aspx"; + protected DeiNiu.RequestLog logobj; + public PagePublic() + { +   + } + protected override void OnPreInit(EventArgs e) + { +   lem = (LEmployee)Session["CurrentUser"]; +   + base.OnPreInit(e); + logobj = new DeiNiu.RequestLog(); + logobj.RequestPageLog(); + } +} diff --git a/App_Code/SessionEndModule.cs b/App_Code/SessionEndModule.cs new file mode 100644 index 0000000..328a35b --- /dev/null +++ b/App_Code/SessionEndModule.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; + +using System.Web; +using System.Web.Caching; +using System.Web.SessionState; +using System.Web.UI; + +namespace view.App_Code +{ + /// + /// When an ASP.NET State Server other than InProc, the Session_End event + /// does not get fired. This is an HttpModule which uses some workarounds + /// and fires a static event when a session ends, with the value of a single + /// configurable session variable in the event arguments. + /// + public class SessionEndModule : IHttpModule + { + #region Private Variables + + private HttpApplication m_HttpApplication; + private static string m_SessionObjectKey; + + #endregion + + #region Accessors + + /// + /// This is the key of the item in the session which should be returned + /// in the SessionEnd event (as the SessionObject). + /// + /// + /// If you're storing the user ID in the session, under a key called 'UserId' + /// and need to do something with it in the SessionEnd event, you would set + /// this to 'UserId', which would cause the value of the session key called + /// 'UserId' to be returned. + /// + public static string SessionObjectKey + { + get + { + return m_SessionObjectKey; + } + set + { + m_SessionObjectKey = value; + } + } + + #endregion + + #region IHttpModule Implementation + + public void Init(HttpApplication context) + { + m_HttpApplication = context; + m_HttpApplication.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute); + } + + public void Dispose() + { + // Do Nothing + } + + #endregion + + #region Events + + /// + /// Event raised when the session ends + /// + public static event SessionEndEventHandler SessionEnd; + + #endregion + + private void OnPreRequestHandlerExecute(object sender, EventArgs e) + { + // We only want to update the session when an ASPX page is being viewed + // We're also doing this in the PreRequestHandler, as doing it elsewhere + // (like the PostRequestHandler) can cause some strange behaviour. + + if (Path.GetExtension(m_HttpApplication.Context.Request.Path).ToLower() == ".aspx") + { + // Ensure we have a HttpContext + if (HttpContext.Current == null) + { + Debug.WriteLine("No current http context"); + return; + } + + // Get the current session + HttpSessionState currentSession = HttpContext.Current.Session; + + // Ensure we have a current session + if (currentSession == null) + { + Debug.WriteLine("No current session"); + return; + } + + // Get the session timeout + TimeSpan sessionTimeout = new TimeSpan(0, 0, currentSession.Timeout, 0, 0); + + // Get the object in the session we want to retrieve when the session times out + object sessionObject = currentSession[SessionObjectKey]; + + // Add the object to the cache with the current session id, and set a cache removal callback method + HttpContext.Current.Cache.Insert(currentSession.SessionID, sessionObject, null, DateTime.MaxValue, sessionTimeout, CacheItemPriority.NotRemovable, CacheItemRemovedCallbackMethod); + } + } + + /// + /// This method is fired when an item is removed from the cache. It is used to detect when a cache item + /// expires, indicating that the session has expired, and fires the SessionEnd event. + /// + private void CacheItemRemovedCallbackMethod(string key, object value, CacheItemRemovedReason reason) + { + if (reason == CacheItemRemovedReason.Expired) + { + if (SessionEnd != null) + { + SessionEndedEventArgs e = new SessionEndedEventArgs(key, value); + SessionEnd(this, e); + + } + } + } + } + + /// + /// Event handler for handling the SessionEnd event + /// + public delegate void SessionEndEventHandler(object sender, SessionEndedEventArgs e); + + /// + /// SessionEndedEventArgs for use in the SessionEnd event + /// + public class SessionEndedEventArgs : EventArgs + { + public readonly string SessionId; + public readonly object SessionObject; + + public SessionEndedEventArgs(string sessionId, object sessionObject) + { + SessionId = sessionId; + SessionObject = sessionObject; + } + } +} \ No newline at end of file diff --git a/Bin/AjaxControlToolkit.dll b/Bin/AjaxControlToolkit.dll new file mode 100644 index 0000000..4fbcfc9 Binary files /dev/null and b/Bin/AjaxControlToolkit.dll differ diff --git a/Bin/AjaxControlToolkit.dll.refresh b/Bin/AjaxControlToolkit.dll.refresh new file mode 100644 index 0000000..3c4c615 Binary files /dev/null and b/Bin/AjaxControlToolkit.dll.refresh differ diff --git a/Bin/App_Code/.svn/entries b/Bin/App_Code/.svn/entries new file mode 100644 index 0000000..c0dedaf --- /dev/null +++ b/Bin/App_Code/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/App_Code +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +PagePublic.cs +file + + + + +2011-04-01T02:51:10.289868Z +88adefccb355a757a198d9d5710b8905 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +637 + +ExcelExp.cs +file + + + + +2011-04-01T02:51:10.305493Z +622cd19125108d2405c68fbaa5dd594a +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1888 + +SessionEndModule.cs +file + + + + +2011-04-01T02:51:10.305493Z +afc00bfe8b5a4c00a5defa6a1221b0fb +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5243 + +PageBase.cs +file + + + + +2011-04-01T02:51:10.321118Z +ada92b7d54cfb24aba200636f6b94af8 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +2850 + diff --git a/Bin/App_Code/.svn/text-base/ExcelExp.cs.svn-base b/Bin/App_Code/.svn/text-base/ExcelExp.cs.svn-base new file mode 100644 index 0000000..118e6ca --- /dev/null +++ b/Bin/App_Code/.svn/text-base/ExcelExp.cs.svn-base @@ -0,0 +1,55 @@ +using System; +using System.Data; +using System.Configuration; +using System.IO; +using System.Text; +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; + +namespace view.App_Code +{ + /// + /// utils 的摘要说明 + /// + public class ExcelExp + { + public ExcelExp() + { + // + // TODO: 在此处添加构造函数逻辑 + // + } + + + public static void Export(GridView GridView1, DataView dv ,ScriptManager sm,Control Button1,string fileName, Page page ) + { + sm.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + GridView1.DataSource = dv; + GridView1.DataBind(); + + + HttpContext.Current.Response.Charset = "GB2312"; + HttpContext.Current.Response.ContentEncoding = Encoding.UTF7; + HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8).ToString()); + HttpContext.Current.Response.ContentType = "application/ms-excel"; + page.EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + HttpContext.Current.Response.Write(tw.ToString()); + HttpContext.Current.Response.End(); + + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + GridView1.DataSource = dv; + GridView1.DataBind(); + } + + } +} \ No newline at end of file diff --git a/Bin/App_Code/.svn/text-base/PageBase.cs.svn-base b/Bin/App_Code/.svn/text-base/PageBase.cs.svn-base new file mode 100644 index 0000000..8245cc0 --- /dev/null +++ b/Bin/App_Code/.svn/text-base/PageBase.cs.svn-base @@ -0,0 +1,94 @@ +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 ZhangPu.Gov.Logical; + +/// +/// utils 的摘要说明 +/// +public class PageBase : PagePublic +{ + public PageBase() + { + + } + + + + // protected LEmployee lem; + // const string DefaultPage = "~/index.aspx"; + // const string HomePage = "~/Desktop.aspx"; + + public void CheckAuthority() + { + if (checkCloseIE()) return; + + string requestPage = Request.AppRelativeCurrentExecutionFilePath + Request.Url.Query; + requestPage = requestPage.ToUpper(); + // if (DefaultPage.Equals(requestPage)) return; //起始页不做判断 + if (DefaultPage.ToUpper() == requestPage) return; //起始页不做判断 + + if (lem == null) + { + logobj.LoginLog(string.Empty,"lem is null"); + Response.Redirect(DefaultPage); + } + if (HomePage.ToUpper() == requestPage) return; + if (lem.GetEmployee.em_account == "Root") //内建管理员 + { + + return; + } + + if (lem.AuthList.Contains(requestPage)) return; + if (!new LRoleAuthority().GetPublicAuthorityList().Contains(requestPage)) + { + logobj.RequestPageLog(); + + logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!"); + + Response.Redirect(DefaultPage); + } + + } + + protected override void OnPreInit(EventArgs e) + { + + base.OnPreInit(e); + + CheckAuthority(); + + } + bool checkCloseIE() + { + if (!string.IsNullOrEmpty(Request.QueryString["___command"])) + { + string cmd = Request.QueryString["___command"]; + if (cmd == "ClearSession") + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + myLog.RequestLog logobj = new myLog.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session. + return true; + } + } + return false; + } + +} diff --git a/Bin/App_Code/.svn/text-base/PagePublic.cs.svn-base b/Bin/App_Code/.svn/text-base/PagePublic.cs.svn-base new file mode 100644 index 0000000..f64f45c --- /dev/null +++ b/Bin/App_Code/.svn/text-base/PagePublic.cs.svn-base @@ -0,0 +1,26 @@ +using System; +using System.Web.UI; +using ZhangPu.Gov.Logical; + +/// +/// PagePublic 的摘要说明 +/// +public class PagePublic : Page +{ + protected LEmployee lem; + protected const string DefaultPage = "~/index.aspx"; + protected const string HomePage = "~/Desktop.aspx"; + protected myLog.RequestLog logobj; + public PagePublic() + { +   + } + protected override void OnPreInit(EventArgs e) + { +   lem = (LEmployee)Session["CurrentUser"]; +   + base.OnPreInit(e); + logobj = new myLog.RequestLog(); + logobj.RequestPageLog(); + } +} diff --git a/Bin/App_Code/.svn/text-base/SessionEndModule.cs.svn-base b/Bin/App_Code/.svn/text-base/SessionEndModule.cs.svn-base new file mode 100644 index 0000000..328a35b --- /dev/null +++ b/Bin/App_Code/.svn/text-base/SessionEndModule.cs.svn-base @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; + +using System.Web; +using System.Web.Caching; +using System.Web.SessionState; +using System.Web.UI; + +namespace view.App_Code +{ + /// + /// When an ASP.NET State Server other than InProc, the Session_End event + /// does not get fired. This is an HttpModule which uses some workarounds + /// and fires a static event when a session ends, with the value of a single + /// configurable session variable in the event arguments. + /// + public class SessionEndModule : IHttpModule + { + #region Private Variables + + private HttpApplication m_HttpApplication; + private static string m_SessionObjectKey; + + #endregion + + #region Accessors + + /// + /// This is the key of the item in the session which should be returned + /// in the SessionEnd event (as the SessionObject). + /// + /// + /// If you're storing the user ID in the session, under a key called 'UserId' + /// and need to do something with it in the SessionEnd event, you would set + /// this to 'UserId', which would cause the value of the session key called + /// 'UserId' to be returned. + /// + public static string SessionObjectKey + { + get + { + return m_SessionObjectKey; + } + set + { + m_SessionObjectKey = value; + } + } + + #endregion + + #region IHttpModule Implementation + + public void Init(HttpApplication context) + { + m_HttpApplication = context; + m_HttpApplication.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute); + } + + public void Dispose() + { + // Do Nothing + } + + #endregion + + #region Events + + /// + /// Event raised when the session ends + /// + public static event SessionEndEventHandler SessionEnd; + + #endregion + + private void OnPreRequestHandlerExecute(object sender, EventArgs e) + { + // We only want to update the session when an ASPX page is being viewed + // We're also doing this in the PreRequestHandler, as doing it elsewhere + // (like the PostRequestHandler) can cause some strange behaviour. + + if (Path.GetExtension(m_HttpApplication.Context.Request.Path).ToLower() == ".aspx") + { + // Ensure we have a HttpContext + if (HttpContext.Current == null) + { + Debug.WriteLine("No current http context"); + return; + } + + // Get the current session + HttpSessionState currentSession = HttpContext.Current.Session; + + // Ensure we have a current session + if (currentSession == null) + { + Debug.WriteLine("No current session"); + return; + } + + // Get the session timeout + TimeSpan sessionTimeout = new TimeSpan(0, 0, currentSession.Timeout, 0, 0); + + // Get the object in the session we want to retrieve when the session times out + object sessionObject = currentSession[SessionObjectKey]; + + // Add the object to the cache with the current session id, and set a cache removal callback method + HttpContext.Current.Cache.Insert(currentSession.SessionID, sessionObject, null, DateTime.MaxValue, sessionTimeout, CacheItemPriority.NotRemovable, CacheItemRemovedCallbackMethod); + } + } + + /// + /// This method is fired when an item is removed from the cache. It is used to detect when a cache item + /// expires, indicating that the session has expired, and fires the SessionEnd event. + /// + private void CacheItemRemovedCallbackMethod(string key, object value, CacheItemRemovedReason reason) + { + if (reason == CacheItemRemovedReason.Expired) + { + if (SessionEnd != null) + { + SessionEndedEventArgs e = new SessionEndedEventArgs(key, value); + SessionEnd(this, e); + + } + } + } + } + + /// + /// Event handler for handling the SessionEnd event + /// + public delegate void SessionEndEventHandler(object sender, SessionEndedEventArgs e); + + /// + /// SessionEndedEventArgs for use in the SessionEnd event + /// + public class SessionEndedEventArgs : EventArgs + { + public readonly string SessionId; + public readonly object SessionObject; + + public SessionEndedEventArgs(string sessionId, object sessionObject) + { + SessionId = sessionId; + SessionObject = sessionObject; + } + } +} \ No newline at end of file diff --git a/Bin/App_Code/ExcelExp.cs b/Bin/App_Code/ExcelExp.cs new file mode 100644 index 0000000..118e6ca --- /dev/null +++ b/Bin/App_Code/ExcelExp.cs @@ -0,0 +1,55 @@ +using System; +using System.Data; +using System.Configuration; +using System.IO; +using System.Text; +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; + +namespace view.App_Code +{ + /// + /// utils 的摘要说明 + /// + public class ExcelExp + { + public ExcelExp() + { + // + // TODO: 在此处添加构造函数逻辑 + // + } + + + public static void Export(GridView GridView1, DataView dv ,ScriptManager sm,Control Button1,string fileName, Page page ) + { + sm.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + GridView1.DataSource = dv; + GridView1.DataBind(); + + + HttpContext.Current.Response.Charset = "GB2312"; + HttpContext.Current.Response.ContentEncoding = Encoding.UTF7; + HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8).ToString()); + HttpContext.Current.Response.ContentType = "application/ms-excel"; + page.EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + HttpContext.Current.Response.Write(tw.ToString()); + HttpContext.Current.Response.End(); + + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + GridView1.DataSource = dv; + GridView1.DataBind(); + } + + } +} \ No newline at end of file diff --git a/Bin/App_Code/PageBase.cs b/Bin/App_Code/PageBase.cs new file mode 100644 index 0000000..dd223b1 --- /dev/null +++ b/Bin/App_Code/PageBase.cs @@ -0,0 +1,94 @@ +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 DeiNiu.wms.Logical; + +/// +/// utils 的摘要说明 +/// +public class PageBase : PagePublic +{ + public PageBase() + { + + } + + + + // protected LEmployee lem; + // const string DefaultPage = "~/index.aspx"; + // const string HomePage = "~/Desktop.aspx"; + + public void CheckAuthority() + { + if (checkCloseIE()) return; + + string requestPage = Request.AppRelativeCurrentExecutionFilePath + Request.Url.Query; + requestPage = requestPage.ToUpper(); + // if (DefaultPage.Equals(requestPage)) return; //起始页不做判断 + if (DefaultPage.ToUpper() == requestPage) return; //起始页不做判断 + + if (lem == null) + { + logobj.LoginLog(string.Empty,"lem is null"); + Response.Redirect(DefaultPage); + } + if (HomePage.ToUpper() == requestPage) return; + if (lem.GetEmployee.em_account == "Root") //内建管理员 + { + + return; + } + + if (lem.AuthList.Contains(requestPage)) return; + if (!new LRoleAuthority().GetPublicAuthorityList().Contains(requestPage)) + { + logobj.RequestPageLog(); + + logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!"); + + Response.Redirect(DefaultPage); + } + + } + + protected override void OnPreInit(EventArgs e) + { + + base.OnPreInit(e); + + CheckAuthority(); + + } + bool checkCloseIE() + { + if (!string.IsNullOrEmpty(Request.QueryString["___command"])) + { + string cmd = Request.QueryString["___command"]; + if (cmd == "ClearSession") + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session. + return true; + } + } + return false; + } + +} diff --git a/Bin/App_Code/PagePublic.cs b/Bin/App_Code/PagePublic.cs new file mode 100644 index 0000000..5fee555 --- /dev/null +++ b/Bin/App_Code/PagePublic.cs @@ -0,0 +1,26 @@ +using System; +using System.Web.UI; +using DeiNiu.wms.Logical; + +/// +/// PagePublic 的摘要说明 +/// +public class PagePublic : Page +{ + protected LEmployee lem; + protected const string DefaultPage = "~/index.aspx"; + protected const string HomePage = "~/Desktop.aspx"; + protected DeiNiu.RequestLog logobj; + public PagePublic() + { +   + } + protected override void OnPreInit(EventArgs e) + { +   lem = (LEmployee)Session["CurrentUser"]; +   + base.OnPreInit(e); + logobj = new DeiNiu.RequestLog(); + logobj.RequestPageLog(); + } +} diff --git a/Bin/App_Code/SessionEndModule.cs b/Bin/App_Code/SessionEndModule.cs new file mode 100644 index 0000000..328a35b --- /dev/null +++ b/Bin/App_Code/SessionEndModule.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; + +using System.Web; +using System.Web.Caching; +using System.Web.SessionState; +using System.Web.UI; + +namespace view.App_Code +{ + /// + /// When an ASP.NET State Server other than InProc, the Session_End event + /// does not get fired. This is an HttpModule which uses some workarounds + /// and fires a static event when a session ends, with the value of a single + /// configurable session variable in the event arguments. + /// + public class SessionEndModule : IHttpModule + { + #region Private Variables + + private HttpApplication m_HttpApplication; + private static string m_SessionObjectKey; + + #endregion + + #region Accessors + + /// + /// This is the key of the item in the session which should be returned + /// in the SessionEnd event (as the SessionObject). + /// + /// + /// If you're storing the user ID in the session, under a key called 'UserId' + /// and need to do something with it in the SessionEnd event, you would set + /// this to 'UserId', which would cause the value of the session key called + /// 'UserId' to be returned. + /// + public static string SessionObjectKey + { + get + { + return m_SessionObjectKey; + } + set + { + m_SessionObjectKey = value; + } + } + + #endregion + + #region IHttpModule Implementation + + public void Init(HttpApplication context) + { + m_HttpApplication = context; + m_HttpApplication.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute); + } + + public void Dispose() + { + // Do Nothing + } + + #endregion + + #region Events + + /// + /// Event raised when the session ends + /// + public static event SessionEndEventHandler SessionEnd; + + #endregion + + private void OnPreRequestHandlerExecute(object sender, EventArgs e) + { + // We only want to update the session when an ASPX page is being viewed + // We're also doing this in the PreRequestHandler, as doing it elsewhere + // (like the PostRequestHandler) can cause some strange behaviour. + + if (Path.GetExtension(m_HttpApplication.Context.Request.Path).ToLower() == ".aspx") + { + // Ensure we have a HttpContext + if (HttpContext.Current == null) + { + Debug.WriteLine("No current http context"); + return; + } + + // Get the current session + HttpSessionState currentSession = HttpContext.Current.Session; + + // Ensure we have a current session + if (currentSession == null) + { + Debug.WriteLine("No current session"); + return; + } + + // Get the session timeout + TimeSpan sessionTimeout = new TimeSpan(0, 0, currentSession.Timeout, 0, 0); + + // Get the object in the session we want to retrieve when the session times out + object sessionObject = currentSession[SessionObjectKey]; + + // Add the object to the cache with the current session id, and set a cache removal callback method + HttpContext.Current.Cache.Insert(currentSession.SessionID, sessionObject, null, DateTime.MaxValue, sessionTimeout, CacheItemPriority.NotRemovable, CacheItemRemovedCallbackMethod); + } + } + + /// + /// This method is fired when an item is removed from the cache. It is used to detect when a cache item + /// expires, indicating that the session has expired, and fires the SessionEnd event. + /// + private void CacheItemRemovedCallbackMethod(string key, object value, CacheItemRemovedReason reason) + { + if (reason == CacheItemRemovedReason.Expired) + { + if (SessionEnd != null) + { + SessionEndedEventArgs e = new SessionEndedEventArgs(key, value); + SessionEnd(this, e); + + } + } + } + } + + /// + /// Event handler for handling the SessionEnd event + /// + public delegate void SessionEndEventHandler(object sender, SessionEndedEventArgs e); + + /// + /// SessionEndedEventArgs for use in the SessionEnd event + /// + public class SessionEndedEventArgs : EventArgs + { + public readonly string SessionId; + public readonly object SessionObject; + + public SessionEndedEventArgs(string sessionId, object sessionObject) + { + SessionId = sessionId; + SessionObject = sessionObject; + } + } +} \ No newline at end of file diff --git a/Bin/App_Licenses.dll b/Bin/App_Licenses.dll new file mode 100644 index 0000000..24e0393 Binary files /dev/null and b/Bin/App_Licenses.dll differ diff --git a/Bin/BaseObject.dll b/Bin/BaseObject.dll new file mode 100644 index 0000000..cf707a2 Binary files /dev/null and b/Bin/BaseObject.dll differ diff --git a/Bin/BaseObject.pdb b/Bin/BaseObject.pdb new file mode 100644 index 0000000..d25c6ec Binary files /dev/null and b/Bin/BaseObject.pdb differ diff --git a/Bin/DevExpress.Charts.v16.2.Core.dll b/Bin/DevExpress.Charts.v16.2.Core.dll new file mode 100644 index 0000000..cda848a Binary files /dev/null and b/Bin/DevExpress.Charts.v16.2.Core.dll differ diff --git a/Bin/DevExpress.Data.v16.2.dll b/Bin/DevExpress.Data.v16.2.dll new file mode 100644 index 0000000..f84bb55 Binary files /dev/null and b/Bin/DevExpress.Data.v16.2.dll differ diff --git a/Bin/DevExpress.Printing.v16.2.Core.dll b/Bin/DevExpress.Printing.v16.2.Core.dll new file mode 100644 index 0000000..ac66d44 Binary files /dev/null and b/Bin/DevExpress.Printing.v16.2.Core.dll differ diff --git a/Bin/DevExpress.Web.v16.2.dll b/Bin/DevExpress.Web.v16.2.dll new file mode 100644 index 0000000..5d8359d Binary files /dev/null and b/Bin/DevExpress.Web.v16.2.dll differ diff --git a/Bin/DevExpress.XtraCharts.v16.2.Web.dll b/Bin/DevExpress.XtraCharts.v16.2.Web.dll new file mode 100644 index 0000000..4c60a2b Binary files /dev/null and b/Bin/DevExpress.XtraCharts.v16.2.Web.dll differ diff --git a/Bin/DevExpress.XtraCharts.v16.2.dll b/Bin/DevExpress.XtraCharts.v16.2.dll new file mode 100644 index 0000000..6e3d0af Binary files /dev/null and b/Bin/DevExpress.XtraCharts.v16.2.dll differ diff --git a/Bin/LitJSON.dll b/Bin/LitJSON.dll new file mode 100644 index 0000000..9cc439d Binary files /dev/null and b/Bin/LitJSON.dll differ diff --git a/Bin/LitJSON.dll.refresh b/Bin/LitJSON.dll.refresh new file mode 100644 index 0000000..53793ef Binary files /dev/null and b/Bin/LitJSON.dll.refresh differ diff --git a/Bin/Logical.dll b/Bin/Logical.dll new file mode 100644 index 0000000..b1f2277 Binary files /dev/null and b/Bin/Logical.dll differ diff --git a/Bin/Logical.pdb b/Bin/Logical.pdb new file mode 100644 index 0000000..36c1593 Binary files /dev/null and b/Bin/Logical.pdb differ diff --git a/Bin/Model.dll b/Bin/Model.dll new file mode 100644 index 0000000..2f14946 Binary files /dev/null and b/Bin/Model.dll differ diff --git a/Bin/Model.pdb b/Bin/Model.pdb new file mode 100644 index 0000000..d1284d6 Binary files /dev/null and b/Bin/Model.pdb differ diff --git a/Bin/Utils.dll b/Bin/Utils.dll new file mode 100644 index 0000000..b1b97aa Binary files /dev/null and b/Bin/Utils.dll differ diff --git a/Bin/Utils.pdb b/Bin/Utils.pdb new file mode 100644 index 0000000..179022f Binary files /dev/null and b/Bin/Utils.pdb differ diff --git a/Bin/log4net.dll b/Bin/log4net.dll new file mode 100644 index 0000000..a4af9d6 Binary files /dev/null and b/Bin/log4net.dll differ diff --git a/Bin/log4net.pdb b/Bin/log4net.pdb new file mode 100644 index 0000000..4ec3e46 Binary files /dev/null and b/Bin/log4net.pdb differ diff --git a/Bin/log4net.xml b/Bin/log4net.xml new file mode 100644 index 0000000..df56743 --- /dev/null +++ b/Bin/log4net.xml @@ -0,0 +1,32464 @@ + + + + log4net + + + + + Appender that logs to a database. + + + + appends logging events to a table within a + database. The appender can be configured to specify the connection + string by setting the property. + The connection type (provider) can be specified by setting the + property. For more information on database connection strings for + your specific database see http://www.connectionstrings.com/. + + + Records are written into the database either using a prepared + statement or a stored procedure. The property + is set to (System.Data.CommandType.Text) to specify a prepared statement + or to (System.Data.CommandType.StoredProcedure) to specify a stored + procedure. + + + The prepared statement text or the name of the stored procedure + must be set in the property. + + + The prepared statement or stored procedure can take a number + of parameters. Parameters are added using the + method. This adds a single to the + ordered list of parameters. The + type may be subclassed if required to provide database specific + functionality. The specifies + the parameter name, database type, size, and how the value should + be generated using a . + + + + An example of a SQL Server table that could be logged to: + + CREATE TABLE [dbo].[Log] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [Date] [datetime] NOT NULL , + [Thread] [varchar] (255) NOT NULL , + [Level] [varchar] (20) NOT NULL , + [Logger] [varchar] (255) NOT NULL , + [Message] [varchar] (4000) NOT NULL + ) ON [PRIMARY] + + + + An example configuration to log to the above table: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Julian Biddle + Nicko Cadell + Gert Driesen + Lance Nehring + + + + Abstract base class implementation of that + buffers events in a fixed size buffer. + + + + This base class should be used by appenders that need to buffer a + number of events before logging them. For example the + buffers events and then submits the entire contents of the buffer to + the underlying database in one go. + + + Subclasses should override the + method to deliver the buffered events. + + The BufferingAppenderSkeleton maintains a fixed size cyclic + buffer of events. The size of the buffer is set using + the property. + + A is used to inspect + each event as it arrives in the appender. If the + triggers, then the current buffer is sent immediately + (see ). Otherwise the event + is stored in the buffer. For example, an evaluator can be used to + deliver the events immediately when an ERROR event arrives. + + + The buffering appender can be configured in a mode. + By default the appender is NOT lossy. When the buffer is full all + the buffered events are sent with . + If the property is set to true then the + buffer will not be sent when it is full, and new events arriving + in the appender will overwrite the oldest event in the buffer. + In lossy mode the buffer will only be sent when the + triggers. This can be useful behavior when you need to know about + ERROR events but not about events with a lower level, configure an + evaluator that will trigger when an ERROR event arrives, the whole + buffer will be sent which gives a history of events leading up to + the ERROR event. + + + Nicko Cadell + Gert Driesen + + + + Abstract base class implementation of . + + + + This class provides the code for common functionality, such + as support for threshold filtering and support for general filters. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface for your own strategies for printing log statements. + + + + Implementors should consider extending the + class which provides a default implementation of this interface. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Log the logging event in Appender specific way. + + The event to log + + + This method is called to log a message into this appender. + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + The name uniquely identifies the appender. + + + + + Interface for appenders that support bulk logging. + + + + This interface extends the interface to + support bulk logging of objects. Appenders + should only implement this interface if they can bulk log efficiently. + + + Nicko Cadell + + + + Log the array of logging events in Appender specific way. + + The events to log + + + This method is called to log an array of events into this appender. + + + + + + Interface used to delay activate a configured object. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then the method + must be called by the container after its all the configured properties have been set + and before the component can be used. + + + Nicko Cadell + + + + Activate the options that were previously set with calls to properties. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then this method must be called + after its properties have been set before the component can be used. + + + + + + Interface that can be implemented by Appenders that buffer logging data and expose a method. + + + + + Flushes any buffered log data. + + + Appenders that implement the method must do so in a thread-safe manner: it can be called concurrently with + the method. + + Typically this is done by locking on the Appender instance, e.g.: + + + + + + The parameter is only relevant for appenders that process logging events asynchronously, + such as . + + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Default constructor + + + Empty default constructor + + + + + Finalizes this appender by calling the implementation's + method. + + + + If this appender has not been closed then the Finalize method + will call . + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Closes the appender and release resources. + + + + Release any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + This method cannot be overridden by subclasses. This method + delegates the closing of the appender to the + method which must be overridden in the subclass. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The event to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the abstract method. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The array of events to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the method. + + + + + + Test if the logging event should we output by this appender + + the event to test + true if the event should be output, false if the event should be ignored + + + This method checks the logging event against the threshold level set + on this appender and also against the filters specified on this + appender. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + + + + + Adds a filter to the end of the filter chain. + + the filter to add to this appender + + + The Filters are organized in a linked list. + + + Setting this property causes the new filter to be pushed onto the + back of the filter chain. + + + + + + Clears the filter list for this appender. + + + + Clears the filter list for this appender. + + + + + + Checks if the message level is below this appender's threshold. + + to test against. + + + If there is no threshold set, then the return value is always true. + + + + true if the meets the + requirements of this appender. + + + + + Is called when the appender is closed. Derived classes should override + this method if resources need to be released. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Subclasses of should implement this method + to perform actual logging. + + The event to append. + + + A subclass must implement this method to perform + logging of the . + + This method will be called by + if all the conditions listed for that method are met. + + + To restrict the logging of events in the appender + override the method. + + + + + + Append a bulk array of logging events. + + the array of logging events + + + This base class implementation calls the + method for each element in the bulk array. + + + A sub class that can better process a bulk array of events should + override this method in addition to . + + + + + + Called before as a precondition. + + + + This method is called by + before the call to the abstract method. + + + This method can be overridden in a subclass to extend the checks + made before the event is passed to the method. + + + A subclass should ensure that they delegate this call to + this base class if it is overridden. + + + true if the call to should proceed. + + + + Renders the to a string. + + The event to render. + The event rendered as a string. + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Where possible use the alternative version of this method + . + That method streams the rendering onto an existing Writer + which can give better performance if the caller already has + a open and ready for writing. + + + + + + Renders the to a string. + + The event to render. + The TextWriter to write the formatted event to + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Use this method in preference to + where possible. If, however, the caller needs to render the event + to a string then does + provide an efficient mechanism for doing so. + + + + + + Flushes any buffered log data. + + + This implementation doesn't flush anything and always returns true + + True if all logging events were flushed successfully, else false. + + + + The layout of this appender. + + + See for more information. + + + + + The name of this appender. + + + See for more information. + + + + + The level threshold of this appender. + + + + There is no level threshold filtering by default. + + + See for more information. + + + + + + It is assumed and enforced that errorHandler is never null. + + + + It is assumed and enforced that errorHandler is never null. + + + See for more information. + + + + + + The first filter in the filter chain. + + + + Set to null initially. + + + See for more information. + + + + + + The last filter in the filter chain. + + + See for more information. + + + + + Flag indicating if this appender is closed. + + + See for more information. + + + + + The guard prevents an appender from repeatedly calling its own DoAppend method + + + + + StringWriter used to render events + + + + + The fully qualified type of the AppenderSkeleton class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the threshold of this appender. + + + The threshold of the appender. + + + + All log events with lower level than the threshold level are ignored + by the appender. + + + In configuration files this option is specified by setting the + value of the option to a level + string, such as "DEBUG", "INFO" and so on. + + + + + + Gets or sets the for this appender. + + The of the appender + + + The provides a default + implementation for the property. + + + + + + The filter chain. + + The head of the filter chain filter chain. + + + Returns the head Filter. The Filters are organized in a linked list + and so all Filters on this Appender are available through the result. + + + + + + Gets or sets the for this appender. + + The layout of the appender. + + + See for more information. + + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + + The name uniquely identifies the appender. + + + + + + Tests if this appender requires a to be set. + + + + In the rather exceptional case, where the appender + implementation admits a layout but can also work without it, + then the appender should return true. + + + This default implementation always returns false. + + + + true if the appender requires a layout object, otherwise false. + + + + + The default buffer size. + + + The default size of the cyclic buffer used to store events. + This is set to 512 by default. + + + + + Initializes a new instance of the class. + + + + Protected default constructor to allow subclassing. + + + + + + Initializes a new instance of the class. + + the events passed through this appender must be + fixed by the time that they arrive in the derived class' SendBuffer method. + + + Protected constructor to allow subclassing. + + + The should be set if the subclass + expects the events delivered to be fixed even if the + is set to zero, i.e. when no buffering occurs. + + + + + + Flushes any buffered log data. + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + Flush the currently buffered events + + + + Flushes any events that have been buffered. + + + If the appender is buffering in mode then the contents + of the buffer will NOT be flushed to the appender. + + + + + + Flush the currently buffered events + + set to true to flush the buffer of lossy events + + + Flushes events that have been buffered. If is + false then events will only be flushed if this buffer is non-lossy mode. + + + If the appender is buffering in mode then the contents + of the buffer will only be flushed if is true. + In this case the contents of the buffer will be tested against the + and if triggering will be output. All other buffered + events will be discarded. + + + If is true then the buffer will always + be emptied by calling this method. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Close this appender instance. + + + + Close this appender instance. If this appender is marked + as not then the remaining events in + the buffer must be sent when the appender is closed. + + + + + + This method is called by the method. + + the event to log + + + Stores the in the cyclic buffer. + + + The buffer will be sent (i.e. passed to the + method) if one of the following conditions is met: + + + + The cyclic buffer is full and this appender is + marked as not lossy (see ) + + + An is set and + it is triggered for the + specified. + + + + Before the event is stored in the buffer it is fixed + (see ) to ensure that + any data referenced by the event will be valid when the buffer + is processed. + + + + + + Sends the contents of the buffer. + + The first logging event. + The buffer containing the events that need to be send. + + + The subclass must override . + + + + + + Sends the events. + + The events that need to be send. + + + The subclass must override this method to process the buffered events. + + + + + + The size of the cyclic buffer used to hold the logging events. + + + Set to by default. + + + + + The cyclic buffer used to store the logging events. + + + + + The triggering event evaluator that causes the buffer to be sent immediately. + + + The object that is used to determine if an event causes the entire + buffer to be sent immediately. This field can be null, which + indicates that event triggering is not to be done. The evaluator + can be set using the property. If this appender + has the ( property) set to + true then an must be set. + + + + + Indicates if the appender should overwrite events in the cyclic buffer + when it becomes full, or if the buffer should be flushed when the + buffer is full. + + + If this field is set to true then an must + be set. + + + + + The triggering event evaluator filters discarded events. + + + The object that is used to determine if an event that is discarded should + really be discarded or if it should be sent to the appenders. + This field can be null, which indicates that all discarded events will + be discarded. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + The events delivered to the subclass must be fixed. + + + + + Gets or sets a value that indicates whether the appender is lossy. + + + true if the appender is lossy, otherwise false. The default is false. + + + + This appender uses a buffer to store logging events before + delivering them. A triggering event causes the whole buffer + to be send to the remote sink. If the buffer overruns before + a triggering event then logging events could be lost. Set + to false to prevent logging events + from being lost. + + If is set to true then an + must be specified. + + + + + Gets or sets the size of the cyclic buffer used to hold the + logging events. + + + The size of the cyclic buffer used to hold the logging events. + + + + The option takes a positive integer + representing the maximum number of logging events to collect in + a cyclic buffer. When the is reached, + oldest events are deleted as new events are added to the + buffer. By default the size of the cyclic buffer is 512 events. + + + If the is set to a value less than + or equal to 1 then no buffering will occur. The logging event + will be delivered synchronously (depending on the + and properties). Otherwise the event will + be buffered. + + + + + + Gets or sets the that causes the + buffer to be sent immediately. + + + The that causes the buffer to be + sent immediately. + + + + The evaluator will be called for each event that is appended to this + appender. If the evaluator triggers then the current buffer will + immediately be sent (see ). + + If is set to true then an + must be specified. + + + + + Gets or sets the value of the to use. + + + The value of the to use. + + + + The evaluator will be called for each event that is discarded from this + appender. If the evaluator triggers then the current buffer will immediately + be sent (see ). + + + + + + Gets or sets a value indicating if only part of the logging event data + should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the + event data to be fixed and serialized. This will improve performance. + + + See for more information. + + + + + + Gets or sets a the fields that will be fixed in the event + + + The event fields that will be fixed before the event is buffered + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + + Initializes a new instance of the class. + + + Public default constructor to initialize a new instance of this class. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Override the parent method to close the database + + + + Closes the database command and database connection. + + + + + + Inserts the events into the database. + + The events to insert into the database. + + + Insert all the events specified in the + array into the database. + + + + + + Adds a parameter to the command. + + The parameter to add to the command. + + + Adds a parameter to the ordered list of command parameters. + + + + + + Writes the events to the database using the transaction specified. + + The transaction that the events will be executed under. + The array of events to insert into the database. + + + The transaction argument can be null if the appender has been + configured not to use transactions. See + property for more information. + + + + + + Formats the log message into database statement text. + + The event being logged. + + This method can be overridden by subclasses to provide + more control over the format of the database statement. + + + Text that can be passed to a . + + + + + Creates an instance used to connect to the database. + + + This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary). + + The of the object. + The connectionString output from the ResolveConnectionString method. + An instance with a valid connection string. + + + + Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey + property. + + + ConnectiongStringName is only supported on .NET 2.0 and higher. + + Additional information describing the connection string. + A connection string used to connect to the database. + + + + Retrieves the class type of the ADO.NET provider. + + + + Gets the Type of the ADO.NET provider to use to connect to the + database. This method resolves the type specified in the + property. + + + Subclasses can override this method to return a different type + if necessary. + + + The of the ADO.NET provider + + + + Connects to the database. + + + + + Cleanup the existing connection. + + + Calls the IDbConnection's method. + + + + + The list of objects. + + + + The list of objects. + + + + + + The security context to use for privileged calls + + + + + The that will be used + to insert logging events into a database. + + + + + Database connection string. + + + + + The appSettings key from App.Config that contains the connection string. + + + + + The connectionStrings key from App.Config that contains the connection string. + + + + + String type name of the type name. + + + + + The text of the command. + + + + + The command type. + + + + + Indicates whether to use transactions when writing to the database. + + + + + Indicates whether to reconnect when a connection is lost. + + + + + The fully qualified type of the AdoNetAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the database connection string that is used to connect to + the database. + + + The database connection string used to connect to the database. + + + + The connections string is specific to the connection type. + See for more information. + + + Connection string for MS Access via ODBC: + "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb" + + Another connection string for MS Access via ODBC: + "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" + + Connection string for MS Access via OLE DB: + "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" + + + + + The appSettings key from App.Config that contains the connection string. + + + + + The connectionStrings key from App.Config that contains the connection string. + + + This property requires at least .NET 2.0. + + + + + Gets or sets the type name of the connection + that should be created. + + + The type name of the connection. + + + + The type name of the ADO.NET provider to use. + + + The default is to use the OLE DB provider. + + + Use the OLE DB Provider. This is the default value. + System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the MS SQL Server Provider. + System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the ODBC Provider. + Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for ODBC .NET Data Provider. + + Use the Oracle Provider. + System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for .NET Managed Provider for Oracle. + + + + + Gets or sets the command text that is used to insert logging events + into the database. + + + The command text used to insert logging events into the database. + + + + Either the text of the prepared statement or the + name of the stored procedure to execute to write into + the database. + + + The property determines if + this text is a prepared statement or a stored procedure. + + + If this property is not set, the command text is retrieved by invoking + . + + + + + + Gets or sets the command type to execute. + + + The command type to execute. + + + + This value may be either (System.Data.CommandType.Text) to specify + that the is a prepared statement to execute, + or (System.Data.CommandType.StoredProcedure) to specify that the + property is the name of a stored procedure + to execute. + + + The default value is (System.Data.CommandType.Text). + + + + + + Should transactions be used to insert logging events in the database. + + + true if transactions should be used to insert logging events in + the database, otherwise false. The default value is true. + + + + Gets or sets a value that indicates whether transactions should be used + to insert logging events in the database. + + + When set a single transaction will be used to insert the buffered events + into the database. Otherwise each event will be inserted without using + an explicit transaction. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Should this appender try to reconnect to the database on error. + + + true if the appender should try to reconnect to the database after an + error has occurred, otherwise false. The default value is false, + i.e. not to try to reconnect. + + + + The default behaviour is for the appender not to try to reconnect to the + database if an error occurs. Subsequent logging events are discarded. + + + To force the appender to attempt to reconnect to the database set this + property to true. + + + When the appender attempts to connect to the database there may be a + delay of up to the connection timeout specified in the connection string. + This delay will block the calling application's thread. + Until the connection can be reestablished this potential delay may occur multiple times. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to insert + logging events into a database. Classes deriving from + can use this property to get or set this . Use the + underlying returned from if + you require access beyond that which provides. + + + + + Parameter type used by the . + + + + This class provides the basic database parameter properties + as defined by the interface. + + This type can be subclassed to provide database specific + functionality. The two methods that are called externally are + and . + + + + + + Initializes a new instance of the class. + + + Default constructor for the AdoNetAppenderParameter class. + + + + + Prepare the specified database command object. + + The command to prepare. + + + Prepares the database command object by adding + this parameter to its collection of parameters. + + + + + + Renders the logging event and set the parameter value in the command. + + The command containing the parameter. + The event to be rendered. + + + Renders the logging event using this parameters layout + object. Sets the value of the parameter on the command object. + + + + + + The name of this parameter. + + + + + The database type for this parameter. + + + + + Flag to infer type rather than use the DbType + + + + + The precision for this parameter. + + + + + The scale for this parameter. + + + + + The size for this parameter. + + + + + The to use to render the + logging event into an object for this parameter. + + + + + Gets or sets the name of this parameter. + + + The name of this parameter. + + + + The name of this parameter. The parameter name + must match up to a named parameter to the SQL stored procedure + or prepared statement. + + + + + + Gets or sets the database type for this parameter. + + + The database type for this parameter. + + + + The database type for this parameter. This property should + be set to the database type from the + enumeration. See . + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the type from the value. + + + + + + + Gets or sets the precision for this parameter. + + + The precision for this parameter. + + + + The maximum number of digits used to represent the Value. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the precision from the value. + + + + + + + Gets or sets the scale for this parameter. + + + The scale for this parameter. + + + + The number of decimal places to which Value is resolved. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the scale from the value. + + + + + + + Gets or sets the size for this parameter. + + + The size for this parameter. + + + + The maximum size, in bytes, of the data within the column. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the size from the value. + + + For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case. + + + + + + + Gets or sets the to use to + render the logging event into an object for this + parameter. + + + The used to render the + logging event into an object for this parameter. + + + + The that renders the value for this + parameter. + + + The can be used to adapt + any into a + for use in the property. + + + + + + Appends logging events to the terminal using ANSI color escape sequences. + + + + AnsiColorTerminalAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific level of message to be set. + + + This appender expects the terminal to understand the VT100 control set + in order to interpret the color codes. If the terminal or console does not + understand the control codes the behavior is not defined. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + When configuring the ANSI colored terminal appender, a mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + + These color values cannot be combined together to make new colors. + + + The attributes can be any combination of the following: + + Brightforeground is brighter + Dimforeground is dimmer + Underscoremessage is underlined + Blinkforeground is blinking (does not work on all terminals) + Reverseforeground and background are reversed + Hiddenoutput is hidden + Strikethroughmessage has a line through it + + While any of these attributes may be combined together not all combinations + work well together, for example setting both Bright and Dim attributes makes + no sense. + + + Patrick Wagstrom + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Ansi code to reset terminal + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Add a mapping of level to color + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colours + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + Target is the value of the console output stream. + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible display attributes + + + + The following flags can be combined together to + form the ANSI color attributes. + + + + + + + text is bright + + + + + text is dim + + + + + text is underlined + + + + + text is blinking + + + Not all terminals support this attribute + + + + + text and background colors are reversed + + + + + text is hidden + + + + + text is displayed with a strikethrough + + + + + text color is light + + + + + The enum of possible foreground or background color values for + use with the color mapping method + + + + The output can be in one for the following ANSI colors. + + + + + + + color is black + + + + + color is red + + + + + color is green + + + + + color is yellow + + + + + color is blue + + + + + color is magenta + + + + + color is cyan + + + + + color is white + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + An entry in the + + + + This is an abstract base class for types that are stored in the + object. + + + Nicko Cadell + + + + Default protected constructor + + + + Default protected constructor + + + + + + Initialize any options defined on this entry + + + + Should be overridden by any classes that need to initialise based on their options + + + + + + The level that is the key for this mapping + + + The that is the key for this mapping + + + + Get or set the that is the key for this + mapping subclass. + + + + + + Initialize the options for the object + + + + Combine the and together + and append the attributes. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level + + + + + + The color attributes for the specified level + + + + Required property. + The color attributes for the specified level + + + + + + The combined , and + suitable for setting the ansi terminal color. + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a AppenderCollection instance. + + list to create a readonly wrapper arround + + An AppenderCollection wrapper that is read-only. + + + + + An empty readonly static AppenderCollection + + + + + Initializes a new instance of the AppenderCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the AppenderCollection class + that has the specified initial capacity. + + + The number of elements that the new AppenderCollection is initially capable of storing. + + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified AppenderCollection. + + The AppenderCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire AppenderCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire AppenderCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the AppenderCollection. + + The to be added to the end of the AppenderCollection. + The index at which the value has been added. + + + + Removes all elements from the AppenderCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the AppenderCollection. + + The to check for. + true if is found in the AppenderCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the AppenderCollection. + + The to locate in the AppenderCollection. + + The zero-based index of the first occurrence of + in the entire AppenderCollection, if found; otherwise, -1. + + + + + Inserts an element into the AppenderCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the AppenderCollection. + + The to remove from the AppenderCollection. + + The specified was not found in the AppenderCollection. + + + + + Removes the element at the specified index of the AppenderCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the AppenderCollection. + + An for the entire AppenderCollection. + + + + Adds the elements of another AppenderCollection to the current AppenderCollection. + + The AppenderCollection whose elements should be added to the end of the current AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a array to the current AppenderCollection. + + The array whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a collection to the current AppenderCollection. + + The collection whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Sets the capacity to the actual number of elements. + + + + + Return the collection elements as an array + + the array + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the AppenderCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + false, because the backing type is an array, which is never thread-safe. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the AppenderCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + + + + + Appends log events to the ASP.NET system. + + + + + Diagnostic information and tracing messages that you specify are appended to the output + of the page that is sent to the requesting browser. Optionally, you can view this information + from a separate trace viewer (Trace.axd) that displays trace information for every page in a + given application. + + + Trace statements are processed and displayed only when tracing is enabled. You can control + whether tracing is displayed to a page, to the trace viewer, or both. + + + The logging event is passed to the or + method depending on the level of the logging event. + The event's logger name is the default value for the category parameter of the Write/Warn method. + + + Nicko Cadell + Gert Driesen + Ron Grabowski + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the ASP.NET trace + + the event to log + + + Write the logging event to the ASP.NET trace + HttpContext.Current.Trace + (). + + + + + + Defaults to %logger + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The category parameter sent to the Trace method. + + + + Defaults to %logger which will use the logger name of the current + as the category parameter. + + + + + + + + Buffers events and then forwards them to attached appenders. + + + + The events are buffered in this appender until conditions are + met to allow the appender to deliver the events to the attached + appenders. See for the + conditions that cause the buffer to be sent. + + The forwarding appender can be used to specify different + thresholds and filters for the same appender at different locations + within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Interface for attaching appenders to objects. + + + + Interface for attaching, removing and retrieving appenders. + + + Nicko Cadell + Gert Driesen + + + + Attaches an appender. + + The appender to add. + + + Add the specified appender. The implementation may + choose to allow or deny duplicate appenders. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Returns an attached appender with the specified. + If no appender with the specified name is found null will be + returned. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Gets all attached appenders. + + + A collection of attached appenders. + + + + Gets a collection of attached appenders. + If there are no attached appenders the + implementation should return an empty + collection rather than null. + + + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Send the events. + + The events that need to be send. + + + Forwards the events to the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this buffering appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Appends logging events to the console. + + + + ColoredConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific type of message to be set. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes directly to the application's attached console + not to the System.Console.Out or System.Console.Error TextWriter. + The System.Console.Out and System.Console.Error streams can be + programmatically redirected (for example NUnit does this to capture program output). + This appender will ignore these redirections because it needs to use Win32 + API calls to colorize the output. To respect these redirections the + must be used. + + + When configuring the colored console appender, mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + combination of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + HighIntensity + + + + Rick Hobbs + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + Add a mapping of level to color - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colors + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + The console output stream writer to write to + + + + This writer is not thread safe. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible color values for use with the color mapping method + + + + The following flags can be combined together to + form the colors. + + + + + + + color is blue + + + + + color is green + + + + + color is red + + + + + color is white + + + + + color is yellow + + + + + color is purple + + + + + color is cyan + + + + + color is intensified + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + Initialize the options for the object + + + + Combine the and together. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level. + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level. + + + + + + The combined and suitable for + setting the console color. + + + + + Appends logging events to the console. + + + + ConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + Nicko Cadell + Gert Driesen + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + debug system. + + + Events are written using the + method. The event's logger name is passed as the value for the category name to the Write method. + + + Nicko Cadell + + + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Flushes any buffered log data. + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + If is true then the + is called. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Defaults to a with %logger as the pattern. + + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + Formats the category parameter sent to the Debug method. + + + + Defaults to a with %logger as the pattern which will use the logger name of the current + as the category parameter. + + + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Writes events to the system event log. + + + + The appender will fail if you try to write using an event source that doesn't exist unless it is running with local administrator privileges. + See also http://logging.apache.org/log4net/release/faq.html#trouble-EventLog + + + The EventID of the event log entry can be + set using the EventID property () + on the . + + + The Category of the event log entry can be + set using the Category property () + on the . + + + There is a limit of 32K characters for an event log message + + + When configuring the EventLogAppender a mapping can be + specified to map a logging level to an event log entry type. For example: + + + <mapping> + <level value="ERROR" /> + <eventLogEntryType value="Error" /> + </mapping> + <mapping> + <level value="DEBUG" /> + <eventLogEntryType value="Information" /> + </mapping> + + + The Level is the standard log4net logging level and eventLogEntryType can be any value + from the enum, i.e.: + + Erroran error event + Warninga warning event + Informationan informational event + + + + Aspi Havewala + Douglas de la Torre + Nicko Cadell + Gert Driesen + Thomas Voss + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class + with the specified . + + The to use with this appender. + + + Obsolete constructor. + + + + + + Add a mapping of level to - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the event log entry type for a level. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create an event log source + + + Uses different API calls under NET_2_0 + + + + + This method is called by the + method. + + the event to log + + Writes the event to the system event log using the + . + + If the event has an EventID property (see ) + set then this integer will be used as the event log event id. + + + There is a limit of 32K characters for an event log message + + + + + + Get the equivalent for a + + the Level to convert to an EventLogEntryType + The equivalent for a + + Because there are fewer applicable + values to use in logging levels than there are in the + this is a one way mapping. There is + a loss of information during the conversion. + + + + + The log name is the section in the event logs where the messages + are stored. + + + + + Name of the application to use when logging. This appears in the + application column of the event log named by . + + + + + The name of the machine which holds the event log. This is + currently only allowed to be '.' i.e. the current machine. + + + + + Mapping from level object to EventLogEntryType + + + + + The security context to use for privileged calls + + + + + The event ID to use unless one is explicitly specified via the LoggingEvent's properties. + + + + + The event category to use unless one is explicitly specified via the LoggingEvent's properties. + + + + + The fully qualified type of the EventLogAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + The maximum size supported by default. + + + http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx + The 32766 documented max size is two bytes shy of 32K (I'm assuming 32766 + may leave space for a two byte null terminator of #0#0). The 32766 max + length is what the .NET 4.0 source code checks for, but this is WRONG! + Strings with a length > 31839 on Windows Vista or higher can CORRUPT + the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() + for the use of the 32766 max size. + + + + + The maximum size supported by a windows operating system that is vista + or newer. + + + See ReportEvent API: + http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx + ReportEvent's lpStrings parameter: + "A pointer to a buffer containing an array of + null-terminated strings that are merged into the message before Event Viewer + displays the string to the user. This parameter must be a valid pointer + (or NULL), even if wNumStrings is zero. Each string is limited to 31,839 characters." + + Going beyond the size of 31839 will (at some point) corrupt the event log on Windows + Vista or higher! It may succeed for a while...but you will eventually run into the + error: "System.ComponentModel.Win32Exception : A device attached to the system is + not functioning", and the event log will then be corrupt (I was able to corrupt + an event log using a length of 31877 on Windows 7). + + The max size for Windows Vista or higher is documented here: + http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx. + Going over this size may succeed a few times but the buffer will overrun and + eventually corrupt the log (based on testing). + + The maxEventMsgSize size is based on the max buffer size of the lpStrings parameter of the ReportEvent API. + The documented max size for EventLog.WriteEntry for Windows Vista and higher is 31839, but I'm leaving room for a + terminator of #0#0, as we cannot see the source of ReportEvent (though we could use an API monitor to examine the + buffer, given enough time). + + + + + The maximum size that the operating system supports for + a event log message. + + + Used to determine the maximum string length that can be written + to the operating system event log and eventually truncate a string + that exceeds the limits. + + + + + This method determines the maximum event log message size allowed for + the current environment. + + + + + + The name of the log where messages will be stored. + + + The string name of the log where messages will be stored. + + + This is the name of the log as it appears in the Event Viewer + tree. The default value is to log into the Application + log, this is where most applications write their events. However + if you need a separate log for your application (or applications) + then you should set the appropriately. + This should not be used to distinguish your event log messages + from those of other applications, the + property should be used to distinguish events. This property should be + used to group together events into a single log. + + + + + + Property used to set the Application name. This appears in the + event logs when logging. + + + The string used to distinguish events from different sources. + + + Sets the event log source property. + + + + + This property is used to return the name of the computer to use + when accessing the event logs. Currently, this is the current + computer, denoted by a dot "." + + + The string name of the machine holding the event log that + will be logged into. + + + This property cannot be changed. It is currently set to '.' + i.e. the local machine. This may be changed in future. + + + + + Gets or sets the used to write to the EventLog. + + + The used to write to the EventLog. + + + + The system security context used to write to the EventLog. + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Gets or sets the EventId to use unless one is explicitly specified via the LoggingEvent's properties. + + + + The EventID of the event log entry will normally be + set using the EventID property () + on the . + This property provides the fallback value which defaults to 0. + + + + + + Gets or sets the Category to use unless one is explicitly specified via the LoggingEvent's properties. + + + + The Category of the event log entry will normally be + set using the Category property () + on the . + This property provides the fallback value which defaults to 0. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and its event log entry type. + + + + + + The for this entry + + + + Required property. + The for this entry + + + + + + Appends logging events to a file. + + + + Logging events are sent to the file specified by + the property. + + + The file can be opened in either append or overwrite mode + by specifying the property. + If the file path is relative it is taken as relative from + the application base directory. The file encoding can be + specified by setting the property. + + + The layout's and + values will be written each time the file is opened and closed + respectively. If the property is + then the file may contain multiple copies of the header and footer. + + + This appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + The supports pluggable file locking models via + the property. + The default behavior, implemented by + is to obtain an exclusive write lock on the file until this appender is closed. + The alternative models only hold a + write lock while the appender is writing a logging event () + or synchronize by using a named system wide Mutex (). + + + All locking strategies have issues and you should seriously consider using a different strategy that + avoids having multiple processes logging to the same file. + + + Nicko Cadell + Gert Driesen + Rodrigo B. de Oliveira + Douglas de la Torre + Niall Daley + + + + Sends logging events to a . + + + + An Appender that writes to a . + + + This appender may be used stand alone if initialized with an appropriate + writer, however it is typically used as a base class for an appender that + can open a to write to. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class and + sets the output destination to a new initialized + with the specified . + + The layout to use with this appender. + The to output to. + + + Obsolete constructor. + + + + + + Initializes a new instance of the class and sets + the output destination to the specified . + + The layout to use with this appender + The to output to + + The must have been previously opened. + + + + Obsolete constructor. + + + + + + This method determines if there is a sense in attempting to append. + + + + This method checks if an output target has been set and if a + layout has been set. + + + false if any of the preconditions fail. + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + This method writes all the bulk logged events to the output writer + before flushing the stream. + + + + + + Close this appender instance. The underlying stream or writer is also closed. + + + Closed appenders cannot be reused. + + + + + Writes the footer and closes the underlying . + + + + Writes the footer and closes the underlying . + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Clears internal references to the underlying + and other variables. + + + + Subclasses can override this method for an alternate closing behavior. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Called to allow a subclass to lazily initialize the writer + + + + This method is called when an event is logged and the or + have not been set. This allows a subclass to + attempt to initialize the writer multiple times. + + + + + + This is the where logging events + will be written to. + + + + + Immediate flush means that the underlying + or output stream will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logging events are not actually persisted if and when the application + crashes. + + + The default value is true. + + + + + + The fully qualified type of the TextWriterAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Flushes any buffered log data. + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + Gets or set whether the appender will flush at the end + of each append operation. + + + + The default behavior is to flush at the end of each + append operation. + + + If this option is set to false, then the underlying + stream can defer persisting the logging event to a later + time. + + + + Avoiding the flush operation at the end of each append results in + a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + Sets the where the log output will go. + + + + The specified must be open and writable. + + + The will be closed when the appender + instance is closed. + + + Note: Logging to an unopened will fail. + + + + + + Gets or set the and the underlying + , if any, for this appender. + + + The for this appender. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Gets or sets the where logging events + will be written to. + + + The where logging events are written. + + + + This is the where logging events + will be written to. + + + + + + Default constructor + + + + Default constructor + + + + + + Construct a new appender using the layout, file and append mode. + + the layout to use with this appender + the full path to the file to write to + flag to indicate if the file should be appended to + + + Obsolete constructor. + + + + + + Construct a new appender using the layout and file specified. + The file will be appended to. + + the layout to use with this appender + the full path to the file to write to + + + Obsolete constructor. + + + + + + Activate the options on the file appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This will cause the file to be opened. + + + + + + Closes any previously opened file and calls the parent's . + + + + Resets the filename and the file stream. + + + + + + Close this appender instance. The underlying stream or writer is also closed. + + + + + Called to initialize the file writer + + + + Will be called for each logged message until the file is + successfully opened. + + + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + Acquires the output file locks once before writing all the events to + the stream. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Closes the previously opened file. + + + + Writes the to the file and then + closes the file. + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + Calls but guarantees not to throw an exception. + Errors are passed to the . + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + If there was already an opened file, then the previous file + is closed first. + + + This method will ensure that the directory structure + for the specified exists. + + + + + + Sets the quiet writer used for file output + + the file stream that has been opened for writing + + + This implementation of creates a + over the and passes it to the + method. + + + This method can be overridden by sub classes that want to wrap the + in some way, for example to encrypt the output + data using a System.Security.Cryptography.CryptoStream. + + + + + + Sets the quiet writer being used. + + the writer over the file stream that has been opened for writing + + + This method can be overridden by sub classes that want to + wrap the in some way. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + Flag to indicate if we should append to the file + or overwrite the file. The default is to append. + + + + + The name of the log file. + + + + + The encoding to use for the file stream. + + + + + The security context to use for privileged calls + + + + + The stream to log to. Has added locking semantics + + + + + The locking model to use + + + + + The fully qualified type of the FileAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the path to the file that logging will be written to. + + + The path to the file that logging will be written to. + + + + If the path is relative it is taken as relative from + the application base directory. + + + + + + Gets or sets a flag that indicates whether the file should be + appended to or overwritten. + + + Indicates whether the file should be appended to or overwritten. + + + + If the value is set to false then the file will be overwritten, if + it is set to true then the file will be appended to. + + The default value is true. + + + + + Gets or sets used to write to the file. + + + The used to write to the file. + + + + The default encoding set is + which is the encoding for the system's current ANSI code page. + + + + + + Gets or sets the used to write to the file. + + + The used to write to the file. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Gets or sets the used to handle locking of the file. + + + The used to lock the file. + + + + Gets or sets the used to handle locking of the file. + + + There are three built in locking models, , and . + The first locks the file from the start of logging to the end, the + second locks only for the minimal amount of time when logging each message + and the last synchronizes processes using a named system wide Mutex. + + + The default locking model is the . + + + + + + Write only that uses the + to manage access to an underlying resource. + + + + + True asynchronous writes are not supported, the implementation forces a synchronous write. + + + + + Exception base type for log4net. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class with + the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Locking model base class + + + + Base class for the locking models available to the derived loggers. + + + + + + Open the output file + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + Helper method that creates a FileStream under CurrentAppender's SecurityContext. + + + + Typically called during OpenFile or AcquireLock. + + + If the directory portion of the does not exist, it is created + via Directory.CreateDirecctory. + + + + + + + + + + Helper method to close under CurrentAppender's SecurityContext. + + + Does not set to null. + + + + + + Gets or sets the for this LockingModel + + + The for this LockingModel + + + + The file appender this locking model is attached to and working on + behalf of. + + + The file appender is used to locate the security context and the error handler to use. + + + The value of this property will be set before is + called. + + + + + + Hold an exclusive lock on the output file + + + + Open the file once for writing and hold it open until is called. + Maintains an exclusive lock on the file during this time. + + + + + + Open the file specified and prepare for logging. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Does nothing. The lock is already taken + + + + + + Release the lock on the file + + + + Does nothing. The lock will be released when the file is closed. + + + + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + + + + Acquires the file lock for each write + + + + Opens the file once for each / cycle, + thus holding the lock for the minimal amount of time. This method of locking + is considerably slower than but allows + other processes to move/delete the log file whilst logging continues. + + + + + + Prepares to open the file when the first message is logged. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + + + + Provides cross-process file locking. + + Ron Grabowski + Steve Wranovsky + + + + Open the file specified and prepare for logging. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + - and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Does nothing. The lock is already taken + + + + + + Releases the lock and allows others to acquire a lock. + + + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + + + + This appender forwards logging events to attached appenders. + + + + The forwarding appender can be used to specify different thresholds + and filters for the same appender at different locations within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Forward the logging event to the attached appenders + + The event to log. + + + Delivers the logging event to all the attached appenders. + + + + + + Forward the logging events to the attached appenders + + The array of events to log. + + + Delivers the logging events to all the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Logs events to a local syslog service. + + + + This appender uses the POSIX libc library functions openlog, syslog, and closelog. + If these functions are not available on the local system then this appender will not work! + + + The functions openlog, syslog, and closelog are specified in SUSv2 and + POSIX 1003.1-2001 standards. These are used to log messages to the local syslog service. + + + This appender talks to a local syslog service. If you need to log to a remote syslog + daemon and you cannot configure your local syslog service to do this you may be + able to use the to log via UDP. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a local syslog service. + + + + + Add a mapping of level to severity + + The mapping to add + + + Adds a to this appender. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Close the syslog when the appender is closed + + + + Close the syslog when the appender is closed + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + + The facility. The default facility is . + + + + + The message identity + + + + + Marshaled handle to the identity string. We have to hold on to the + string as the openlog and syslog APIs just hold the + pointer to the ident and dereference it for each log message. + + + + + Mapping from level object to syslog severity + + + + + Open connection to system logger. + + + + + Generate a log message. + + + + The libc syslog method takes a format string and a variable argument list similar + to the classic printf function. As this type of vararg list is not supported + by C# we need to specify the arguments explicitly. Here we have specified the + format string with a single message argument. The caller must set the format + string to "%s". + + + + + + Close descriptor used to write to system logger. + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + syslog severities + + + + The log4net Level maps to a syslog severity using the + method and the + class. The severity is set on . + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facility defines which subsystem the logging comes from. + This is set on the property. + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Appends colorful logging events to the console, using the .NET 2 + built-in capabilities. + + + + ManagedColoredConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific type of message to be set. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + When configuring the colored console appender, mappings should be + specified to map logging levels to colors. For example: + + + + + + + + + + + + + + + + + + + + + + The Level is the standard log4net logging level while + ForeColor and BackColor are the values of + enumeration. + + + Based on the ColoredConsoleAppender + + + Rick Hobbs + Nicko Cadell + Pavlos Touboulidis + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Add a mapping of level to color - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colors + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level. + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level. + + + + + + Stores logging events in an array. + + + + The memory appender stores all the logging events + that are appended in an in-memory array. + + + Use the method to get + and clear the current list of events that have been appended. + + + Use the method to get the current + list of events that have been appended. Note there is a + race-condition when calling and + in pairs, you better use in that case. + + + Use the method to clear the + current list of events. Note there is a + race-condition when calling and + in pairs, you better use in that case. + + + Julian Biddle + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Gets the events that have been logged. + + The events that have been logged + + + Gets the events that have been logged. + + + + + + This method is called by the method. + + the event to log + + Stores the in the events list. + + + + + Clear the list of events + + + Clear the list of events + + + + + Gets the events that have been logged and clears the list of events. + + The events that have been logged + + + Gets the events that have been logged and clears the list of events. + + + + + + The list of events that have been appended. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + Gets or sets a value indicating whether only part of the logging event + data should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the event + data to be fixed and stored in the appender, hereby improving performance. + + + See for more information. + + + + + + Gets or sets the fields that will be fixed in the event + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + Logs entries by sending network messages using the + native function. + + + + You can send messages only to names that are active + on the network. If you send the message to a user name, + that user must be logged on and running the Messenger + service to receive the message. + + + The receiver will get a top most window displaying the + messages one at a time, therefore this appender should + not be used to deliver a high volume of messages. + + + The following table lists some possible uses for this appender : + + + + + Action + Property Value(s) + + + Send a message to a user account on the local machine + + + = <name of the local machine> + + + = <user name> + + + + + Send a message to a user account on a remote machine + + + = <name of the remote machine> + + + = <user name> + + + + + Send a message to a domain user account + + + = <name of a domain controller | uninitialized> + + + = <user name> + + + + + Send a message to all the names in a workgroup or domain + + + = <workgroup name | domain name>* + + + + + Send a message from the local machine to a remote machine + + + = <name of the local machine | uninitialized> + + + = <name of the remote machine> + + + + + + + Note : security restrictions apply for sending + network messages, see + for more information. + + + + + An example configuration section to log information + using this appender from the local machine, named + LOCAL_PC, to machine OPERATOR_PC : + + + + + + + + + + Nicko Cadell + Gert Driesen + + + + The DNS or NetBIOS name of the server on which the function is to execute. + + + + + The sender of the network message. + + + + + The message alias to which the message should be sent. + + + + + The security context to use for privileged calls + + + + + Initializes the appender. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified. + + + The required property was not specified. + + + + This method is called by the method. + + The event to log. + + + Sends the event using a network message. + + + + + + Sends a buffer of information to a registered message alias. + + The DNS or NetBIOS name of the server on which the function is to execute. + The message alias to which the message buffer should be sent + The originator of the message. + The message text. + The length, in bytes, of the message text. + + + The following restrictions apply for sending network messages: + + + + + Platform + Requirements + + + Windows NT + + + No special group membership is required to send a network message. + + + Admin, Accounts, Print, or Server Operator group membership is required to + successfully send a network message on a remote server. + + + + + Windows 2000 or later + + + If you send a message on a domain controller that is running Active Directory, + access is allowed or denied based on the access control list (ACL) for the securable + object. The default ACL permits only Domain Admins and Account Operators to send a network message. + + + On a member server or workstation, only Administrators and Server Operators can send a network message. + + + + + + + For more information see Security Requirements for the Network Management Functions. + + + + + If the function succeeds, the return value is zero. + + + + + + Gets or sets the sender of the message. + + + The sender of the message. + + + If this property is not specified, the message is sent from the local computer. + + + + + Gets or sets the message alias to which the message should be sent. + + + The recipient of the message. + + + This property should always be specified in order to send a message. + + + + + Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute. + + + DNS or NetBIOS name of the remote server on which the function is to execute. + + + + For Windows NT 4.0 and earlier, the string should begin with \\. + + + If this property is not specified, the local computer is used. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the OutputDebugString system. + + + + OutputDebugStringAppender appends log events to the + OutputDebugString system. + + + The string is passed to the native OutputDebugString + function. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the output debug string API + + the event to log + + + Write the logging event to the output debug string API + + + + + + Stub for OutputDebugString native method + + the string to output + + + Stub for OutputDebugString native method + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Logs events to a remote syslog daemon. + + + + The BSD syslog protocol is used to remotely log to + a syslog daemon. The syslogd listens for for messages + on UDP port 514. + + + The syslog UDP protocol is not authenticated. Most syslog daemons + do not accept remote log messages because of the security implications. + You may be able to use the LocalSyslogAppender to talk to a local + syslog service. + + + There is an RFC 3164 that claims to document the BSD Syslog Protocol. + This RFC can be seen here: http://www.faqs.org/rfcs/rfc3164.html. + This appender generates what the RFC calls an "Original Device Message", + i.e. does not include the TIMESTAMP or HOSTNAME fields. By observation + this format of message will be accepted by all current syslog daemon + implementations. The daemon will attach the current time and the source + hostname or IP address to any messages received. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Sends logging events as connectionless UDP datagrams to a remote host or a + multicast group using an . + + + + UDP guarantees neither that messages arrive, nor that they arrive in the correct order. + + + To view the logging results, a custom application can be developed that listens for logging + events. + + + When decoding events send via this appender remember to use the same encoding + to decode the events as was used to send the events. See the + property to specify the encoding to use. + + + + This example shows how to log receive logging events that are sent + on IP address 244.0.0.1 and port 8080 to the console. The event is + encoded in the packet as a unicode string and it is decoded as such. + + IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); + UdpClient udpClient; + byte[] buffer; + string loggingEvent; + + try + { + udpClient = new UdpClient(8080); + + while(true) + { + buffer = udpClient.Receive(ref remoteEndPoint); + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer); + Console.WriteLine(loggingEvent); + } + } + catch(Exception e) + { + Console.WriteLine(e.ToString()); + } + + + Dim remoteEndPoint as IPEndPoint + Dim udpClient as UdpClient + Dim buffer as Byte() + Dim loggingEvent as String + + Try + remoteEndPoint = new IPEndPoint(IPAddress.Any, 0) + udpClient = new UdpClient(8080) + + While True + buffer = udpClient.Receive(ByRef remoteEndPoint) + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer) + Console.WriteLine(loggingEvent) + Wend + Catch e As Exception + Console.WriteLine(e.ToString()) + End Try + + + An example configuration section to log information using this appender to the + IP 224.0.0.1 on port 8080: + + + + + + + + + + Gert Driesen + Nicko Cadell + + + + Initializes a new instance of the class. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified or + an invalid remote or local TCP port number was specified. + + + The required property was not specified. + The TCP port number assigned to or is less than or greater than . + + + + This method is called by the method. + + The event to log. + + + Sends the event using an UDP datagram. + + + Exceptions are passed to the . + + + + + + Closes the UDP connection and releases all resources associated with + this instance. + + + + Disables the underlying and releases all managed + and unmanaged resources associated with the . + + + + + + Initializes the underlying connection. + + + + The underlying is initialized and binds to the + port number from which you intend to communicate. + + + Exceptions are passed to the . + + + + + + The IP address of the remote host or multicast group to which + the logging event will be sent. + + + + + The TCP port number of the remote host or multicast group to + which the logging event will be sent. + + + + + The cached remote endpoint to which the logging events will be sent. + + + + + The TCP port number from which the will communicate. + + + + + The instance that will be used for sending the + logging events. + + + + + The encoding to use for the packet. + + + + + Gets or sets the IP address of the remote host or multicast group to which + the underlying should sent the logging event. + + + The IP address of the remote host or multicast group to which the logging event + will be sent. + + + + Multicast addresses are identified by IP class D addresses (in the range 224.0.0.0 to + 239.255.255.255). Multicast packets can pass across different networks through routers, so + it is possible to use multicasts in an Internet scenario as long as your network provider + supports multicasting. + + + Hosts that want to receive particular multicast messages must register their interest by joining + the multicast group. Multicast messages are not sent to networks where no host has joined + the multicast group. Class D IP addresses are used for multicast groups, to differentiate + them from normal host addresses, allowing nodes to easily detect if a message is of interest. + + + Static multicast addresses that are needed globally are assigned by IANA. A few examples are listed in the table below: + + + + + IP Address + Description + + + 224.0.0.1 + + + Sends a message to all system on the subnet. + + + + + 224.0.0.2 + + + Sends a message to all routers on the subnet. + + + + + 224.0.0.12 + + + The DHCP server answers messages on the IP address 224.0.0.12, but only on a subnet. + + + + + + + A complete list of actually reserved multicast addresses and their owners in the ranges + defined by RFC 3171 can be found at the IANA web site. + + + The address range 239.0.0.0 to 239.255.255.255 is reserved for administrative scope-relative + addresses. These addresses can be reused with other local groups. Routers are typically + configured with filters to prevent multicast traffic in this range from flowing outside + of the local network. + + + + + + Gets or sets the TCP port number of the remote host or multicast group to which + the underlying should sent the logging event. + + + An integer value in the range to + indicating the TCP port number of the remote host or multicast group to which the logging event + will be sent. + + + The underlying will send messages to this TCP port number + on the remote host or multicast group. + + The value specified is less than or greater than . + + + + Gets or sets the TCP port number from which the underlying will communicate. + + + An integer value in the range to + indicating the TCP port number from which the underlying will communicate. + + + + The underlying will bind to this port for sending messages. + + + Setting the value to 0 (the default) will cause the udp client not to bind to + a local port. + + + The value specified is less than or greater than . + + + + Gets or sets used to write the packets. + + + The used to write the packets. + + + + The used to write the packets. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to send logging events + over a network. Classes deriving from can use this + property to get or set this . Use the underlying + returned from if you require access beyond that which + provides. + + + + + Gets or sets the cached remote endpoint to which the logging events should be sent. + + + The cached remote endpoint to which the logging events will be sent. + + + The method will initialize the remote endpoint + with the values of the and + properties. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Syslog port 514 + + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a remote syslog daemon. + + + + + Add a mapping of level to severity + + The mapping to add + + + Add a mapping to this appender. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to syslog severity mappings set on this appender. + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + Generate a syslog priority. + + + + + + The facility. The default facility is . + + + + + The message identity + + + + + Mapping from level object to syslog severity + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + syslog severities + + + + The syslog severities. + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facilities + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Delivers logging events to a remote logging sink. + + + + This Appender is designed to deliver events to a remote sink. + That is any object that implements the + interface. It delivers the events using .NET remoting. The + object to deliver events to is specified by setting the + appenders property. + + The RemotingAppender buffers events before sending them. This allows it to + make more efficient use of the remoting infrastructure. + + Once the buffer is full the events are still not sent immediately. + They are scheduled to be sent using a pool thread. The effect is that + the send occurs asynchronously. This is very important for a + number of non obvious reasons. The remoting infrastructure will + flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + Because the events are sent asynchronously using pool threads it is possible to close + this appender before all the queued events have been sent. + When closing the appender attempts to wait until all the queued events have been sent, but + this will timeout after 30 seconds regardless. + + If this appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. If the runtime terminates the threads before + the queued events have been sent then they will be lost. To ensure that all events + are sent the appender must be closed before the application exits. See + for details on how to shutdown + log4net programmatically. + + + Nicko Cadell + Gert Driesen + Daniel Cazzulino + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Send the contents of the buffer to the remote sink. + + + The events are not sent immediately. They are scheduled to be sent + using a pool thread. The effect is that the send occurs asynchronously. + This is very important for a number of non obvious reasons. The remoting + infrastructure will flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + The events to send. + + + + Override base class close. + + + + This method waits while there are queued work items. The events are + sent asynchronously using work items. These items + will be sent once a thread pool thread is available to send them, therefore + it is possible to close the appender before all the queued events have been + sent. + + This method attempts to wait until all the queued events have been sent, but this + method will timeout after 30 seconds regardless. + + If the appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. + + + + + Flushes any buffered log data. + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + A work item is being queued into the thread pool + + + + + A work item from the thread pool has completed + + + + + Send the contents of the buffer to the remote sink. + + + This method is designed to be used with the . + This method expects to be passed an array of + objects in the state param. + + the logging events to send + + + + The URL of the remote sink. + + + + + The local proxy (.NET remoting) for the remote logging sink. + + + + + The number of queued callbacks currently waiting or executing + + + + + Event used to signal when there are no queued work items + + + This event is set when there are no queued work items. In this + state it is safe to close the appender. + + + + + Gets or sets the URL of the well-known object that will accept + the logging events. + + + The well-known URL of the remote sink. + + + + The URL of the remoting sink that will accept logging events. + The sink must implement the + interface. + + + + + + Interface used to deliver objects to a remote sink. + + + This interface must be implemented by a remoting sink + if the is to be used + to deliver logging events to the sink. + + + + + Delivers logging events to the remote sink + + Array of events to log. + + + Delivers logging events to the remote sink + + + + + + Appender that rolls log files based on size or date or both. + + + + RollingFileAppender can roll log files based on size or date or both + depending on the setting of the property. + When set to the log file will be rolled + once its size exceeds the . + When set to the log file will be rolled + once the date boundary specified in the property + is crossed. + When set to the log file will be + rolled once the date boundary specified in the property + is crossed, but within a date boundary the file will also be rolled + once its size exceeds the . + When set to the log file will be rolled when + the appender is configured. This effectively means that the log file can be + rolled once per program execution. + + + A of few additional optional features have been added: + + Attach date pattern for current log file + Backup number increments for newer files + Infinite number of backups by file size + + + + + + For large or infinite numbers of backup files a + greater than zero is highly recommended, otherwise all the backup files need + to be renamed each time a new backup is created. + + + When Date/Time based rolling is used setting + to will reduce the number of file renamings to few or none. + + + + + + Changing or without clearing + the log file directory of backup files will cause unexpected and unwanted side effects. + + + + + If Date/Time based rolling is enabled this appender will attempt to roll existing files + in the directory without a Date/Time tag based on the last write date of the base log file. + The appender only rolls the log file when a message is logged. If Date/Time based rolling + is enabled then the appender will not roll the log file at the Date/Time boundary but + at the point when the next message is logged after the boundary has been crossed. + + + + The extends the and + has the same behavior when opening the log file. + The appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + When rolling a backup file necessitates deleting an older backup file the + file to be deleted is moved to a temporary name before being deleted. + + + + + A maximum number of backup files when rolling on date/time boundaries is not supported. + + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + Edward Smit + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Cleans up all resources used by this appender. + + + + + The fully qualified type of the RollingFileAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Sets the quiet writer being used. + + + This method can be overridden by sub classes. + + the writer to set + + + + Write out a logging event. + + the event to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Write out an array of logging events. + + the events to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Performs any required rolling before outputting the next event + + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Creates and opens the file for logging. If + is false then the fully qualified name is determined and used. + + the name of the file to open + true to append to existing file + + This method will ensure that the directory structure + for the specified exists. + + + + + Get the current output file name + + the base file name + the output file name + + The output file name is based on the base fileName specified. + If is set then the output + file name is the same as the base file passed in. Otherwise + the output file depends on the date pattern, on the count + direction or both. + + + + + Determines curSizeRollBackups (only within the current roll point) + + + + + Generates a wildcard pattern that can be used to find all files + that are similar to the base file name. + + + + + + + Builds a list of filenames for all files matching the base filename plus a file + pattern. + + + + + + + Initiates a roll over if needed for crossing a date boundary since the last run. + + + + + Initializes based on existing conditions at time of . + + + + Initializes based on existing conditions at time of . + The following is done + + determine curSizeRollBackups (only within the current roll point) + initiates a roll over if needed for crossing a date boundary since the last run. + + + + + + + Does the work of bumping the 'current' file counter higher + to the highest count when an incremental file name is seen. + The highest count is either the first file (when count direction + is greater than 0) or the last file (when count direction less than 0). + In either case, we want to know the highest count that is present. + + + + + + + Attempts to extract a number from the end of the file name that indicates + the number of the times the file has been rolled over. + + + Certain date pattern extensions like yyyyMMdd will be parsed as valid backup indexes. + + + + + + + Takes a list of files and a base file name, and looks for + 'incremented' versions of the base file. Bumps the max + count up to the highest count seen. + + + + + + + Calculates the RollPoint for the datePattern supplied. + + the date pattern to calculate the check period for + The RollPoint that is most accurate for the date pattern supplied + + Essentially the date pattern is examined to determine what the + most suitable roll point is. The roll point chosen is the roll point + with the smallest period that can be detected using the date pattern + supplied. i.e. if the date pattern only outputs the year, month, day + and hour then the smallest roll point that can be detected would be + and hourly roll point as minutes could not be detected. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Sets initial conditions including date/time roll over information, first check, + scheduledFilename, and calls to initialize + the current number of backups. + + + + + + + + + .1, .2, .3, etc. + + + + + Rollover the file(s) to date/time tagged file(s). + + set to true if the file to be rolled is currently open + + + Rollover the file(s) to date/time tagged file(s). + Resets curSizeRollBackups. + If fileIsOpen is set then the new file is opened (through SafeOpenFile). + + + + + + Renames file to file . + + Name of existing file to roll. + New name for file. + + + Renames file to file . It + also checks for existence of target file and deletes if it does. + + + + + + Test if a file exists at a specified path + + the path to the file + true if the file exists + + + Test if a file exists at a specified path + + + + + + Deletes the specified file if it exists. + + The file to delete. + + + Delete a file if is exists. + The file is first moved to a new filename then deleted. + This allows the file to be removed even when it cannot + be deleted, but it still can be moved. + + + + + + Implements file roll base on file size. + + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. Moreover, File is + renamed File.1 and closed. + + + A new file is created to receive further log output. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + + + + Implements file roll. + + the base name to rename + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + This is called by to rename the files. + + + + + + Get the start time of the next window for the current rollpoint + + the current date + the type of roll point we are working with + the start time for the next roll point an interval after the currentDateTime date + + + Returns the date of the next roll point after the currentDateTime date passed to the method. + + + The basic strategy is to subtract the time parts that are less significant + than the rollpoint from the current time. This should roll the time back to + the start of the time window for the current rollpoint. Then we add 1 window + worth of time and get the start time of the next window for the rollpoint. + + + + + + This object supplies the current date/time. Allows test code to plug in + a method to control this class when testing date/time based rolling. The default + implementation uses the underlying value of DateTime.Now. + + + + + The date pattern. By default, the pattern is set to ".yyyy-MM-dd" + meaning daily rollover. + + + + + The actual formatted filename that is currently being written to + or will be the file transferred to on roll over + (based on staticLogFileName). + + + + + The timestamp when we shall next recompute the filename. + + + + + Holds date of last roll over + + + + + The type of rolling done + + + + + The default maximum file size is 10MB + + + + + There is zero backup files by default + + + + + How many sized based backups have been made so far + + + + + The rolling file count direction. + + + + + The rolling mode used in this appender. + + + + + Cache flag set if we are rolling by date. + + + + + Cache flag set if we are rolling by size. + + + + + Value indicating whether to always log to the same file. + + + + + Value indicating whether to preserve the file name extension when rolling. + + + + + FileName provided in configuration. Used for rolling properly + + + + + A mutex that is used to lock rolling of files. + + + + + The 1st of January 1970 in UTC + + + + + Gets or sets the strategy for determining the current date and time. The default + implementation is to use LocalDateTime which internally calls through to DateTime.Now. + DateTime.UtcNow may be used on frameworks newer than .NET 1.0 by specifying + . + + + An implementation of the interface which returns the current date and time. + + + + Gets or sets the used to return the current date and time. + + + There are two built strategies for determining the current date and time, + + and . + + + The default strategy is . + + + + + + Gets or sets the date pattern to be used for generating file names + when rolling over on date. + + + The date pattern to be used for generating file names when rolling + over on date. + + + + Takes a string in the same format as expected by + . + + + This property determines the rollover schedule when rolling over + on date. + + + + + + Gets or sets the maximum number of backup files that are kept before + the oldest is erased. + + + The maximum number of backup files that are kept before the oldest is + erased. + + + + If set to zero, then there will be no backup files and the log file + will be truncated when it reaches . + + + If a negative number is supplied then no deletions will be made. Note + that this could result in very slow performance as a large number of + files are rolled over unless is used. + + + The maximum applies to each time based group of files and + not the total. + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size in bytes that the output file is allowed to reach before being + rolled over to backup files. + + + + This property is equivalent to except + that it is required for differentiating the setter taking a + argument from the setter taking a + argument. + + + The default maximum file size is 10MB (10*1024*1024). + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size that the output file is allowed to reach before being + rolled over to backup files. + + + + This property allows you to specify the maximum size with the + suffixes "KB", "MB" or "GB" so that the size is interpreted being + expressed respectively in kilobytes, megabytes or gigabytes. + + + For example, the value "10KB" will be interpreted as 10240 bytes. + + + The default maximum file size is 10MB. + + + If you have the option to set the maximum file size programmatically + consider using the property instead as this + allows you to set the size in bytes as a . + + + + + + Gets or sets the rolling file count direction. + + + The rolling file count direction. + + + + Indicates if the current file is the lowest numbered file or the + highest numbered file. + + + By default newer files have lower numbers ( < 0), + i.e. log.1 is most recent, log.5 is the 5th backup, etc... + + + >= 0 does the opposite i.e. + log.1 is the first backup made, log.5 is the 5th backup made, etc. + For infinite backups use >= 0 to reduce + rollover costs. + + The default file count direction is -1. + + + + + Gets or sets the rolling style. + + The rolling style. + + + The default rolling style is . + + + When set to this appender's + property is set to false, otherwise + the appender would append to a single file rather than rolling + the file each time it is opened. + + + + + + Gets or sets a value indicating whether to preserve the file name extension when rolling. + + + true if the file name extension should be preserved. + + + + By default file.log is rolled to file.log.yyyy-MM-dd or file.log.curSizeRollBackup. + However, under Windows the new file name will loose any program associations as the + extension is changed. Optionally file.log can be renamed to file.yyyy-MM-dd.log or + file.curSizeRollBackup.log to maintain any program associations. + + + + + + Gets or sets a value indicating whether to always log to + the same file. + + + true if always should be logged to the same file, otherwise false. + + + + By default file.log is always the current file. Optionally + file.log.yyyy-mm-dd for current formatted datePattern can by the currently + logging file (or file.log.curSizeRollBackup or even + file.log.yyyy-mm-dd.curSizeRollBackup). + + + This will make time based rollovers with a large number of backups + much faster as the appender it won't have to rename all the backups! + + + + + + Style of rolling to use + + + + Style of rolling to use + + + + + + Roll files once per program execution + + + + Roll files once per program execution. + Well really once each time this appender is + configured. + + + Setting this option also sets AppendToFile to + false on the RollingFileAppender, otherwise + this appender would just be a normal file appender. + + + + + + Roll files based only on the size of the file + + + + + Roll files based only on the date + + + + + Roll files based on both the size and date of the file + + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + + + Roll the log not based on the date + + + + + Roll the log for each minute + + + + + Roll the log for each hour + + + + + Roll the log twice a day (midday and midnight) + + + + + Roll the log each day (midnight) + + + + + Roll the log each week + + + + + Roll the log each month + + + + + This interface is used to supply Date/Time information to the . + + + This interface is used to supply Date/Time information to the . + Used primarily to allow test classes to plug themselves in so they can + supply test date/times. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Default implementation of that returns the current time. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Implementation of that returns the current time as the coordinated universal time (UTC). + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Send an e-mail when a specific logging event occurs, typically on errors + or fatal errors. + + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Authentication and setting the server Port are only available on the MS .NET 1.1 runtime. + For these features to be enabled you need to ensure that you are using a version of + the log4net assembly that is built against the MS .NET 1.1 framework and that you are + running the your application on the MS .NET 1.1 runtime. On all other platforms only sending + unauthenticated messages to a server listening on port 25 (the default) is supported. + + + Authentication is supported by setting the property to + either or . + If using authentication then the + and properties must also be set. + + + To set the SMTP server port use the property. The default port is 25. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + + Send the email message + + the body text to include in the mail + + + + trims leading and trailing commas or semicolons + + + + + Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (use semicolon on .NET 1.1 and comma for later versions). + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + + Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses + that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions). + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses + that will be blind carbon copied. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of recipient e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the name of the SMTP relay mail server to use to send + the e-mail messages. + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + + + Obsolete + + + Use the BufferingAppenderSkeleton Fix methods instead + + + + Obsolete property. + + + + + + The mode to use to authentication with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + Valid Authentication mode values are: , + , and . + The default value is . When using + you must specify the + and to use to authenticate. + When using the Windows credentials for the current + thread, if impersonating, or the process will be used to authenticate. + + + + + + The username to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the username will be ignored. + + + + + + The password to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the password will be ignored. + + + + + + The port on which the SMTP server is listening + + + Server Port is only available on the MS .NET 1.1 runtime. + + The port on which the SMTP server is listening. The default + port is 25. The Port can only be changed when running on + the MS .NET 1.1 runtime. + + + + + + Gets or sets the priority of the e-mail message + + + One of the values. + + + + Sets the priority of the e-mails generated by this + appender. The default priority is . + + + If you are using this appender to report errors then + you may want to set the priority to . + + + + + + Enable or disable use of SSL when sending e-mail message + + + This is available on MS .NET 2.0 runtime and higher + + + + + Gets or sets the reply-to e-mail address. + + + This is available on MS .NET 2.0 runtime and higher + + + + + Gets or sets the subject encoding to be used. + + + The default encoding is the operating system's current ANSI codepage. + + + + + Gets or sets the body encoding to be used. + + + The default encoding is the operating system's current ANSI codepage. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Values for the property. + + + + SMTP authentication modes. + + + + + + No authentication + + + + + Basic authentication. + + + Requires a username and password to be supplied + + + + + Integrated authentication + + + Uses the Windows credentials from the current thread or process to authenticate. + + + + + Send an email when a specific logging event occurs, typically on errors + or fatal errors. Rather than sending via smtp it writes a file into the + directory specified by . This allows services such + as the IIS SMTP agent to manage sending the messages. + + + + The configuration for this appender is identical to that of the SMTPAppender, + except that instead of specifying the SMTPAppender.SMTPHost you specify + . + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Niall Daley + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + Sends the contents of the cyclic buffer as an e-mail message. + + + + + + Activate the options on this appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + The security context to use for privileged calls + + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the path to write the messages to. + + + + Gets or sets the path to write the messages to. This should be the same + as that used by the agent sending the messages. + + + + + + Gets or sets the file extension for the generated files + + + The file extension for the generated files + + + + The file extension for the generated files + + + + + + Gets or sets the used to write to the pickup directory. + + + The used to write to the pickup directory. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appender that allows clients to connect via Telnet to receive log messages + + + + The TelnetAppender accepts socket connections and streams logging messages + back to the client. + The output is provided in a telnet-friendly way so that a log can be monitored + over a TCP/IP socket. + This allows simple remote monitoring of application logging. + + + The default is 23 (the telnet port). + + + Keith Long + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + The fully qualified type of the TelnetAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Overrides the parent method to close the socket handler + + + + Closes all the outstanding connections. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Create the socket handler and wait for connections + + + + + + Writes the logging event to each connected client. + + The event to log. + + + Writes the logging event to each connected client. + + + + + + Gets or sets the TCP port number on which this will listen for connections. + + + An integer value in the range to + indicating the TCP port number on which this will listen for connections. + + + + The default value is 23 (the telnet port). + + + The value specified is less than + or greater than . + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Helper class to manage connected clients + + + + The SocketHandler class is used to accept connections from + clients. It is threaded so that clients can connect/disconnect + asynchronously. + + + + + + Opens a new server port on + + the local port to listen on for connections + + + Creates a socket handler on the specified local server port. + + + + + + Sends a string message to each of the connected clients + + the text to send + + + Sends a string message to each of the connected clients + + + + + + Add a client to the internal clients list + + client to add + + + + Remove a client from the internal clients list + + client to remove + + + + Callback used to accept a connection on the server socket + + The result of the asynchronous operation + + + On connection adds to the list of connections + if there are two many open connections you will be disconnected + + + + + + Close all network connections + + + + Make sure we close all network connections + + + + + + Test if this handler has active connections + + + true if this handler has active connections + + + + This property will be true while this handler has + active connections, that is at least one connection that + the handler will attempt to send a message to. + + + + + + Class that represents a client connected to this handler + + + + Class that represents a client connected to this handler + + + + + + Create this for the specified + + the client's socket + + + Opens a stream writer on the socket. + + + + + + Write a string to the client + + string to send + + + Write a string to the client + + + + + + Cleanup the clients connection + + + + Close the socket connection. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + trace system. + + + Events are written using the System.Diagnostics.Trace.Write(string,string) + method. The event's logger name is the default value for the category parameter + of the Write method. + + + Compact Framework
+ The Compact Framework does not support the + class for any operation except Assert. When using the Compact Framework this + appender will write to the system rather than + the Trace system. This appender will therefore behave like the . +
+
+ Douglas de la Torre + Nicko Cadell + Gert Driesen + Ron Grabowski +
+ + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Defaults to %logger + + + + + Flushes any buffered log data. + + The maximum time to wait for logging events to be flushed. + True if all logging events were flushed successfully, else false. + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + The category parameter sent to the Trace method. + + + + Defaults to %logger which will use the logger name of the current + as the category parameter. + + + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Assembly level attribute that specifies a domain to alias to this assembly's repository. + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's domain to its repository by + specifying this attribute with the name of the target domain. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required domains. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies a repository to alias to this assembly's repository. + + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's repository to its repository by + specifying this attribute with the name of the target repository. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required repositories. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + The repository to alias to this assemby's repository. + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + + + + + Gets or sets the repository to alias to this assemby's repository. + + + The repository to alias to this assemby's repository. + + + + The name of the repository to alias to this assemby's repository. + + + + + + Initializes a new instance of the class with + the specified domain to alias to this assembly's repository. + + The domain to alias to this assemby's repository. + + + Obsolete. Use instead of . + + + + + + Use this class to quickly configure a . + + + + Allows very simple programmatic configuration of log4net. + + + Only one appender can be configured using this configurator. + The appender is set at the root of the hierarchy and all logging + events will be delivered to that appender. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + The fully qualified type of the BasicConfigurator class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Initializes the log4net system with a default configuration. + + + + Initializes the log4net logging system using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the log4net system using the specified appenders. + + The appenders to use to log all logging events. + + + Initializes the log4net system using the specified appenders. + + + + + + Initializes the log4net system using the specified appender. + + The appender to use to log all logging events. + + + Initializes the log4net system using the specified appender. + + + + + + Initializes the with a default configuration. + + The repository to configure. + + + Initializes the specified repository using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the using the specified appender. + + The repository to configure. + The appender to use to log all logging events. + + + Initializes the using the specified appender. + + + + + + Initializes the using the specified appenders. + + The repository to configure. + The appenders to use to log all logging events. + + + Initializes the using the specified appender. + + + + + + Base class for all log4net configuration attributes. + + + This is an abstract class that must be extended by + specific configurators. This attribute allows the + configurator to be parameterized by an assembly level + attribute. + + Nicko Cadell + Gert Driesen + + + + Constructor used by subclasses. + + the ordering priority for this configurator + + + The is used to order the configurator + attributes before they are invoked. Higher priority configurators are executed + before lower priority ones. + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Abstract method implemented by a subclass. When this method is called + the subclass should configure the . + + + + + + Compare this instance to another ConfiguratorAttribute + + the object to compare to + see + + + Compares the priorities of the two instances. + Sorts by priority in descending order. Objects with the same priority are + randomly ordered. + + + + + + Assembly level attribute that specifies the logging domain for the assembly. + + + + DomainAttribute is obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + Assemblies are mapped to logging domains. Each domain has its own + logging repository. This attribute specified on the assembly controls + the configuration of the domain. The property specifies the name + of the domain that this assembly is a part of. The + specifies the type of the repository objects to create for the domain. If + this attribute is not specified and a is not specified + then the assembly will be part of the default shared logging domain. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies the logging repository for the assembly. + + + + Assemblies are mapped to logging repository. This attribute specified + on the assembly controls + the configuration of the repository. The property specifies the name + of the repository that this assembly is a part of. The + specifies the type of the object + to create for the assembly. If this attribute is not specified or a + is not specified then the assembly will be part of the default shared logging repository. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize a new instance of the class + with the name of the repository. + + The name of the repository. + + + Initialize the attribute with the name for the assembly's repository. + + + + + + Gets or sets the name of the logging repository. + + + The string name to use as the name of the repository associated with this + assembly. + + + + This value does not have to be unique. Several assemblies can share the + same repository. They will share the logging configuration of the repository. + + + + + + Gets or sets the type of repository to create for this assembly. + + + The type of repository to create for this assembly. + + + + The type of the repository to create for the assembly. + The type must implement the + interface. + + + This will be the type of repository created when + the repository is created. If multiple assemblies reference the + same repository then the repository is only created once using the + of the first assembly to call into the + repository. + + + + + + Initializes a new instance of the class. + + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Initialize a new instance of the class + with the name of the domain. + + The name of the domain. + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + The repository to configure. + + + + Configures log4net using a log4net element + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The element to parse. + + + + Configures the using the specified XML + element. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration file. + + A stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Assembly level attribute to configure the . + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + If neither of the or + properties are set the configuration is loaded from the application's .config file. + If set the property takes priority over the + property. The property + specifies a path to a file to load the config from. The path is relative to the + application's base directory; . + The property is used as a postfix to the assembly file name. + The config file must be located in the application's base directory; . + For example in a console application setting the to + config has the same effect as not specifying the or + properties. + + + The property can be set to cause the + to watch the configuration file for changes. + + + + Log4net will only look for assembly level configuration attributes once. + When using the log4net assembly level attributes to control the configuration + of log4net you must ensure that the first call to any of the + methods is made from the assembly with the configuration + attributes. + + + If you cannot guarantee the order in which log4net calls will be made from + different assemblies you must use programmatic configuration instead, i.e. + call the method directly. + + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Configure the repository using the . + The specified must extend the + class otherwise the will not be able to + configure it. + + + The does not extend . + + + + Attempt to load configuration from the local file system + + The assembly that this attribute was defined on. + The repository to configure. + + + + Configure the specified repository using a + + The repository to configure. + the FileInfo pointing to the config file + + + + Attempt to load configuration from a URI + + The assembly that this attribute was defined on. + The repository to configure. + + + + The fully qualified type of the XmlConfiguratorAttribute class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the filename of the configuration file. + + + The filename of the configuration file. + + + + If specified, this is the name of the configuration file to use with + the . This file path is relative to the + application base directory (). + + + The takes priority over the . + + + + + + Gets or sets the extension of the configuration file. + + + The extension of the configuration file. + + + + If specified this is the extension for the configuration file. + The path to the config file is built by using the application + base directory (), + the assembly file name and the config file extension. + + + If the is set to MyExt then + possible config file names would be: MyConsoleApp.exe.MyExt or + MyClassLibrary.dll.MyExt. + + + The takes priority over the . + + + + + + Gets or sets a value indicating whether to watch the configuration file. + + + true if the configuration should be watched, false otherwise. + + + + If this flag is specified and set to true then the framework + will watch the configuration file and will reload the config each time + the file is modified. + + + The config file can only be watched if it is loaded from local disk. + In a No-Touch (Smart Client) deployment where the application is downloaded + from a web server the config file may not reside on the local disk + and therefore it may not be able to watch it. + + + Watching configuration is not supported on the SSCLI. + + + + + + Class to register for the log4net section of the configuration file + + + The log4net section of the configuration file needs to have a section + handler registered. This is the section handler used. It simply returns + the XML element that is the root of the section. + + + Example of registering the log4net section handler : + + + +
+ + + log4net configuration XML goes here + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Parses the configuration section. + + The configuration settings in a corresponding parent configuration section. + The configuration context when called from the ASP.NET configuration system. Otherwise, this parameter is reserved and is a null reference. + The for the log4net section. + The for the log4net section. + + + Returns the containing the configuration data, + + + + + + Assembly level attribute that specifies a plugin to attach to + the repository. + + + + Specifies the type of a plugin to create and attach to the + assembly's repository. The plugin type must implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Interface used to create plugins. + + + + Interface used to create a plugin. + + + Nicko Cadell + Gert Driesen + + + + Creates the plugin object. + + the new plugin instance + + + Create and return a new plugin instance. + + + + + + Initializes a new instance of the class + with the specified type. + + The type name of plugin to create. + + + Create the attribute with the plugin type specified. + + + Where possible use the constructor that takes a . + + + + + + Initializes a new instance of the class + with the specified type. + + The type of plugin to create. + + + Create the attribute with the plugin type specified. + + + + + + Creates the plugin object defined by this attribute. + + + + Creates the instance of the object as + specified by this attribute. + + + The plugin object. + + + + Returns a representation of the properties of this object. + + + + Overrides base class method to + return a representation of the properties of this object. + + + A representation of the properties of this object + + + + Gets or sets the type for the plugin. + + + The type for the plugin. + + + + The type for the plugin. + + + + + + Gets or sets the type name for the plugin. + + + The type name for the plugin. + + + + The type name for the plugin. + + + Where possible use the property instead. + + + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + + + + Construct provider attribute with type specified + + the type of the provider to use + + + The provider specified must subclass the + class. + + + + + + Configures the SecurityContextProvider + + The assembly that this attribute was defined on. + The repository to configure. + + + Creates a provider instance from the specified. + Sets this as the default security context provider . + + + + + + The fully qualified type of the SecurityContextProviderAttribute class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the type of the provider to use. + + + the type of the provider to use. + + + + The provider specified must subclass the + class. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + The repository to configure. + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + + + + + Configures log4net using a log4net element + + + + Loads the log4net configuration from the XML element + supplied as . + + + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration URI. + + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The must support the URI scheme specified. + + + + + + Configures log4net using the specified configuration data stream. + + A stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified XML + element. + + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + URI. + + The repository to configure. + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The must support the URI scheme specified. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the specified repository using a log4net element. + + The hierarchy to configure. + The element to parse. + + + Loads the log4net configuration from the XML element + supplied as . + + + This method is ultimately called by one of the Configure methods + to load the configuration from an . + + + + + + Maps repository names to ConfigAndWatchHandler instances to allow a particular + ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is + reconfigured. + + + + + The fully qualified type of the XmlConfigurator class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Class used to watch config files. + + + + Uses the to monitor + changes to a specified file. Because multiple change notifications + may be raised when the file is modified, a timer is used to + compress the notifications into a single event. The timer + waits for time before delivering + the event notification. If any further + change notifications arrive while the timer is waiting it + is reset and waits again for to + elapse. + + + + + + The default amount of time to wait after receiving notification + before reloading the config file. + + + + + Holds the FileInfo used to configure the XmlConfigurator + + + + + Holds the repository being configured. + + + + + The timer used to compress the notification events. + + + + + Watches file for changes. This object should be disposed when no longer + needed to free system handles on the watched resources. + + + + + Initializes a new instance of the class to + watch a specified config file used to configure a repository. + + The repository to configure. + The configuration file to watch. + + + Initializes a new instance of the class. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Called by the timer when the configuration has been updated. + + null + + + + Release the handles held by the watcher and timer. + + + + + The implementation of the interface suitable + for use with the compact framework + + + + This implementation is a simple + mapping between repository name and + object. + + + The .NET Compact Framework 1.0 does not support retrieving assembly + level attributes therefore unlike the DefaultRepositorySelector + this selector does not examine the calling assembly for attributes. + + + Nicko Cadell + + + + Interface used by the to select the . + + + + The uses a + to specify the policy for selecting the correct + to return to the caller. + + + Nicko Cadell + Gert Driesen + + + + Gets the for the specified assembly. + + The assembly to use to lookup to the + The for the assembly. + + + Gets the for the specified assembly. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. The results of this method must be repeatable, i.e. + when called again with the same arguments the result must be the + save value. + + + + + + Gets the named . + + The name to use to lookup to the . + The named + + Lookup a named . This is the repository created by + calling . + + + + + Creates a new repository for the assembly specified. + + The assembly to use to create the domain to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the domain + specified such that a call to with the + same assembly specified will return the same repository instance. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. + + + + + + Creates a new repository with the name specified. + + The name to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the name + specified such that a call to with the + same name will return the same repository instance. + + + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets an array of all currently defined repositories. + + + An array of the instances created by + this . + + + Gets an array of all of the repositories created by this selector. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Create a new repository selector + + the type of the repositories to create, must implement + + + Create an new compact repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + throw if is null + throw if does not implement + + + + Get the for the specified assembly + + not used + The default + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Get the named + + the name of the repository to lookup + The named + + + Get the named . The default + repository is log4net-default-repository. Other repositories + must be created using the . + If the named repository does not exist an exception is thrown. + + + throw if is null + throw if the does not exist + + + + Create a new repository for the assembly specified + + not used + the type of repository to create, must implement + the repository created + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + If the is null then the + default repository type specified to the constructor is used. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Create a new repository for the repository specified + + the repository to associate with the + the type of repository to create, must implement . + If this param is null then the default repository type is used. + the repository created + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + If the named repository already exists an exception will be thrown. + + + If is null then the default + repository type specified to the constructor is used. + + + throw if is null + throw if the already exists + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + The fully qualified type of the CompactRepositorySelector class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Notify the registered listeners that the repository has been created + + The repository that has been created + + + Raises the LoggerRepositoryCreatedEvent + event. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + The default implementation of the interface. + + + + Uses attributes defined on the calling assembly to determine how to + configure the hierarchy for the repository. + + + Nicko Cadell + Gert Driesen + + + + Creates a new repository selector. + + The type of the repositories to create, must implement + + + Create an new repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + is . + does not implement . + + + + Gets the for the specified assembly. + + The assembly use to lookup the . + + + The type of the created and the repository + to create can be overridden by specifying the + attribute on the . + + + The default values are to use the + implementation of the interface and to use the + as the name of the repository. + + + The created will be automatically configured using + any attributes defined on + the . + + + The for the assembly + is . + + + + Gets the for the specified repository. + + The repository to use to lookup the . + The for the specified repository. + + + Returns the named repository. If is null + a is thrown. If the repository + does not exist a is thrown. + + + Use to create a repository. + + + is . + does not exist. + + + + Create a new repository for the assembly specified + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the assembly specified. + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The name to assign to the created repository + Set to true to read and apply the assembly attributes + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the specified repository. + + The repository to associate with the . + The type of repository to create, must implement . + If this param is then the default repository type is used. + The new repository. + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + is . + already exists. + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + Aliases a repository to an existing repository. + + The repository to alias. + The repository that the repository is aliased to. + + + The repository specified will be aliased to the repository when created. + The repository must not already exist. + + + When the repository is created it must utilize the same repository type as + the repository it is aliased to, otherwise the aliasing will fail. + + + + is . + -or- + is . + + + + + Notifies the registered listeners that the repository has been created. + + The repository that has been created. + + + Raises the event. + + + + + + Gets the repository name and repository type for the specified assembly. + + The assembly that has a . + in/out param to hold the repository name to use for the assembly, caller should set this to the default value before calling. + in/out param to hold the type of the repository to create for the assembly, caller should set this to the default value before calling. + is . + + + + Configures the repository using information from the assembly. + + The assembly containing + attributes which define the configuration for the repository. + The repository to configure. + + is . + -or- + is . + + + + + Loads the attribute defined plugins on the assembly. + + The assembly that contains the attributes. + The repository to add the plugins to. + + is . + -or- + is . + + + + + Loads the attribute defined aliases on the assembly. + + The assembly that contains the attributes. + The repository to alias to. + + is . + -or- + is . + + + + + The fully qualified type of the DefaultRepositorySelector class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Defined error codes that can be passed to the method. + + + + Values passed to the method. + + + Nicko Cadell + + + + A general error + + + + + Error while writing output + + + + + Failed to flush file + + + + + Failed to close file + + + + + Unable to open output file + + + + + No layout specified + + + + + Failed to parse address + + + + + An evaluator that triggers on an Exception type + + + + This evaluator will trigger if the type of the Exception + passed to + is equal to a Type in . /// + + + Drew Schaeffer + + + + Test if an triggers an action + + + + Implementations of this interface allow certain appenders to decide + when to perform an appender specific action. + + + The action or behavior triggered is defined by the implementation. + + + Nicko Cadell + + + + Test if this event triggers the action + + The event to check + true if this event triggers the action, otherwise false + + + Return true if this event triggers the action + + + + + + The type that causes the trigger to fire. + + + + + Causes subclasses of to cause the trigger to fire. + + + + + Default ctor to allow dynamic creation through a configurator. + + + + + Constructs an evaluator and initializes to trigger on + + the type that triggers this evaluator. + If true, this evaluator will trigger on subclasses of . + + + + Is this the triggering event? + + The event to check + This method returns true, if the logging event Exception + Type is . + Otherwise it returns false + + + This evaluator will trigger if the Exception Type of the event + passed to + is . + + + + + + The type that triggers this evaluator. + + + + + If true, this evaluator will trigger on subclasses of . + + + + + Appenders may delegate their error handling to an . + + + + Error handling is a particularly tedious to get right because by + definition errors are hard to predict and to reproduce. + + + Nicko Cadell + Gert Driesen + + + + Handles the error and information about the error condition is passed as + a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + The error code associated with the error. + + + Handles the error and information about the error condition is passed as + a parameter. + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + + + See . + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + + + See . + + + + + + Interface for objects that require fixing. + + + + Interface that indicates that the object requires fixing before it + can be taken outside the context of the appender's + method. + + + When objects that implement this interface are stored + in the context properties maps + and + are fixed + (see ) the + method will be called. + + + Nicko Cadell + + + + Get a portable version of this object + + the portable instance of this object + + + Get a portable instance object that represents the current + state of this object. The portable object can be stored + and logged from any thread with identical results. + + + + + + Interface that all loggers implement + + + + This interface supports logging events and testing if a level + is enabled for logging. + + + These methods will not throw exceptions. Note to implementor, ensure + that the implementation of these methods cannot allow an exception + to be thrown to the caller. + + + Nicko Cadell + Gert Driesen + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + the exception to log, including its stack trace. Pass null to not log an exception. + + + Generates a logging event for the specified using + the and . + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + + + + Gets the name of the logger. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Base interface for all wrappers + + + + Base interface for all wrappers. + + + All wrappers must implement this interface. + + + Nicko Cadell + + + + Get the implementation behind this wrapper object. + + + The object that in implementing this object. + + + + The object that in implementing this + object. The Logger object may not + be the same object as this object because of logger decorators. + This gets the actual underlying objects that is used to process + the log events. + + + + + + Delegate used to handle logger repository creation event notifications + + The which created the repository. + The event args + that holds the instance that has been created. + + + Delegate used to handle logger repository creation event notifications. + + + + + + Provides data for the event. + + + + A + event is raised every time a is created. + + + + + + The created + + + + + Construct instance using specified + + the that has been created + + + Construct instance using specified + + + + + + The that has been created + + + The that has been created + + + + The that has been created + + + + + + Defines the default set of levels recognized by the system. + + + + Each has an associated . + + + Levels have a numeric that defines the relative + ordering between levels. Two Levels with the same + are deemed to be equivalent. + + + The levels that are recognized by log4net are set for each + and each repository can have different levels defined. The levels are stored + in the on the repository. Levels are + looked up by name from the . + + + When logging at level INFO the actual level used is not but + the value of LoggerRepository.LevelMap["INFO"]. The default value for this is + , but this can be changed by reconfiguring the level map. + + + Each level has a in addition to its . The + is the string that is written into the output log. By default + the display name is the same as the level name, but this can be used to alias levels + or to localize the log output. + + + Some of the predefined levels recognized by the system are: + + + + . + + + . + + + . + + + . + + + . + + + . + + + . + + + + Nicko Cadell + Gert Driesen + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + The display name for this level. This may be localized or otherwise different from the name + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Returns the representation of the current + . + + + A representation of the current . + + + + Returns the level . + + + + + + Compares levels. + + The object to compare against. + true if the objects are equal. + + + Compares the levels of instances, and + defers to base class if the target object is not a + instance. + + + + + + Returns a hash code + + A hash code for the current . + + + Returns a hash code suitable for use in hashing algorithms and data + structures like a hash table. + + + Returns the hash code of the level . + + + + + + Compares this instance to a specified object and returns an + indication of their relative values. + + A instance or to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the + values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + This instance is less than . + + + Zero + This instance is equal to . + + + Greater than zero + + This instance is greater than . + -or- + is . + + + + + + + must be an instance of + or ; otherwise, an exception is thrown. + + + is not a . + + + + Returns a value indicating whether a specified + is greater than another specified . + + A + A + + true if is greater than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than another specified . + + A + A + + true if is less than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is greater than or equal to another specified . + + A + A + + true if is greater than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than or equal to another specified . + + A + A + + true if is less than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have the same value. + + A or . + A or . + + true if the value of is the same as the + value of ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have different values. + + A or . + A or . + + true if the value of is different from + the value of ; otherwise, false. + + + + Compares two levels. + + + + + + Compares two specified instances. + + The first to compare. + The second to compare. + + A 32-bit signed integer that indicates the relative order of the + two values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + is less than . + + + Zero + is equal to . + + + Greater than zero + is greater than . + + + + + + Compares two levels. + + + + + + The level designates a higher level than all the rest. + + + + + The level designates very severe error events. + System unusable, emergencies. + + + + + The level designates very severe error events. + System unusable, emergencies. + + + + + The level designates very severe error events + that will presumably lead the application to abort. + + + + + The level designates very severe error events. + Take immediate action, alerts. + + + + + The level designates very severe error events. + Critical condition, critical. + + + + + The level designates very severe error events. + + + + + The level designates error events that might + still allow the application to continue running. + + + + + The level designates potentially harmful + situations. + + + + + The level designates informational messages + that highlight the progress of the application at the highest level. + + + + + The level designates informational messages that + highlight the progress of the application at coarse-grained level. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates the lowest level possible. + + + + + Gets the name of this level. + + + The name of this level. + + + + Gets the name of this level. + + + + + + Gets the value of this level. + + + The value of this level. + + + + Gets the value of this level. + + + + + + Gets the display name of this level. + + + The display name of this level. + + + + Gets the display name of this level. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a LevelCollection instance. + + list to create a readonly wrapper arround + + A LevelCollection wrapper that is read-only. + + + + + Initializes a new instance of the LevelCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the LevelCollection class + that has the specified initial capacity. + + + The number of elements that the new LevelCollection is initially capable of storing. + + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified LevelCollection. + + The LevelCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + Copies the entire LevelCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire LevelCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the LevelCollection. + + The to be added to the end of the LevelCollection. + The index at which the value has been added. + + + + Removes all elements from the LevelCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the LevelCollection. + + The to check for. + true if is found in the LevelCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the LevelCollection. + + The to locate in the LevelCollection. + + The zero-based index of the first occurrence of + in the entire LevelCollection, if found; otherwise, -1. + + + + + Inserts an element into the LevelCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the LevelCollection. + + The to remove from the LevelCollection. + + The specified was not found in the LevelCollection. + + + + + Removes the element at the specified index of the LevelCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the LevelCollection. + + An for the entire LevelCollection. + + + + Adds the elements of another LevelCollection to the current LevelCollection. + + The LevelCollection whose elements should be added to the end of the current LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a array to the current LevelCollection. + + The array whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a collection to the current LevelCollection. + + The collection whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the LevelCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + false, because the backing type is an array, which is never thread-safe. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the LevelCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + A value + + + + + Supports simple iteration over a . + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + An evaluator that triggers at a threshold level + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + Nicko Cadell + + + + The threshold for triggering + + + + + Create a new evaluator using the threshold. + + + + Create a new evaluator using the threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Create a new evaluator using the specified threshold. + + the threshold to trigger at + + + Create a new evaluator using the specified threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Is this the triggering event? + + The event to check + This method returns true, if the event level + is equal or higher than the . + Otherwise it returns false + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + the threshold to trigger at + + + The that will cause this evaluator to trigger + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Mapping between string name and Level object + + + + Mapping between string name and object. + This mapping is held separately for each . + The level name is case insensitive. + + + Nicko Cadell + + + + Mapping from level name to Level object. The + level name is case insensitive + + + + + Construct the level map + + + + Construct the level map. + + + + + + Clear the internal maps of all levels + + + + Clear the internal maps of all levels + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + + + Create a new Level and add it to the map + + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + the display name to give to the Level + + + Create a new Level and add it to the map + + + + + + Add a Level to the map + + the Level to add + + + Add a Level to the map + + + + + + Lookup a named level from the map + + the name of the level to lookup is taken from this level. + If the level is not set on the map then this level is added + the level in the map with the name specified + + + Lookup a named level from the map. The name of the level to lookup is taken + from the property of the + argument. + + + If no level with the specified name is found then the + argument is added to the level map + and returned. + + + + + + Lookup a by name + + The name of the Level to lookup + a Level from the map with the name specified + + + Returns the from the + map with the name specified. If the no level is + found then null is returned. + + + + + + Return all possible levels as a list of Level objects. + + all possible levels as a list of Level objects + + + Return all possible levels as a list of Level objects. + + + + + + The internal representation of caller location information. + + + + This class uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. + + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + Nicko Cadell + Gert Driesen + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + Constructor + + The declaring type of the method that is + the stack boundary into the logging system for this call. + + + Initializes a new instance of the + class based on the current thread. + + + + + + Constructor + + The fully qualified class name. + The method name. + The file name. + The line number of the method within the file. + + + Initializes a new instance of the + class with the specified data. + + + + + + The fully qualified type of the LocationInfo class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the fully qualified class name of the caller making the logging + request. + + + The fully qualified class name of the caller making the logging + request. + + + + Gets the fully qualified class name of the caller making the logging + request. + + + + + + Gets the file name of the caller. + + + The file name of the caller. + + + + Gets the file name of the caller. + + + + + + Gets the line number of the caller. + + + The line number of the caller. + + + + Gets the line number of the caller. + + + + + + Gets the method name of the caller. + + + The method name of the caller. + + + + Gets the method name of the caller. + + + + + + Gets all available caller information + + + All available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + Gets all available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + + + Gets the stack frames from the stack trace of the caller making the log request + + + + + Static manager that controls the creation of repositories + + + + Static manager that controls the creation of repositories + + + This class is used by the wrapper managers (e.g. ) + to provide access to the objects. + + + This manager also holds the that is used to + lookup and create repositories. The selector can be set either programmatically using + the property, or by setting the log4net.RepositorySelector + AppSetting in the applications config file to the fully qualified type name of the + selector to use. + + + Nicko Cadell + Gert Driesen + + + + Private constructor to prevent instances. Only static methods should be used. + + + + Private constructor to prevent instances. Only static methods should be used. + + + + + + Hook the shutdown event + + + + On the full .NET runtime, the static constructor hooks up the + AppDomain.ProcessExit and AppDomain.DomainUnload> events. + These are used to shutdown the log4net system as the application exits. + + + + + + Register for ProcessExit and DomainUnload events on the AppDomain + + + + This needs to be in a separate method because the events make + a LinkDemand for the ControlAppDomain SecurityPermission. Because + this is a LinkDemand it is demanded at JIT time. Therefore we cannot + catch the exception in the method itself, we have to catch it in the + caller. + + + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + Returns the default instance. + + + + + + Returns the named logger if it exists. + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified repository. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns the named logger if it exists. + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified assembly's repository. + + + + If the named logger exists (in the specified assembly's repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Retrieves or creates a named logger. + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Retrieves or creates a named logger. + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Shorthand for . + + The repository to lookup in. + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shorthand for . + + the assembly to use to lookup the repository + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The repository to shutdown. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The assembly to use to lookup the repository. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Resets all values contained in this repository instance to their defaults. + + The repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + The assembly to use to lookup the repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Gets an array of all currently defined repositories. + + An array of all the known objects. + + + Gets an array of all currently defined repositories. + + + + + + Internal method to get pertinent version info. + + A string of version info. + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + The fully qualified type of the LoggerManager class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Initialize the default repository selector + + + + + Gets or sets the repository selector used by the . + + + The repository selector used by the . + + + + The repository selector () is used by + the to create and select repositories + (). + + + The caller to supplies either a string name + or an assembly (if not supplied the assembly is inferred using + ). + + + This context is used by the selector to lookup a specific repository. + + + For the full .NET Framework, the default repository is DefaultRepositorySelector; + for the .NET Compact Framework CompactRepositorySelector is the default + repository. + + + + + + Implementation of the interface. + + + + This class should be used as the base for all wrapper implementations. + + + Nicko Cadell + Gert Driesen + + + + Constructs a new wrapper for the specified logger. + + The logger to wrap. + + + Constructs a new wrapper for the specified logger. + + + + + + The logger that this object is wrapping + + + + + Gets the implementation behind this wrapper object. + + + The object that this object is implementing. + + + + The Logger object may not be the same object as this object + because of logger decorators. + + + This gets the actual underlying objects that is used to process + the log events. + + + + + + Portable data structure used by + + + + Portable data structure used by + + + Nicko Cadell + + + + The logger name. + + + + The logger name. + + + + + + Level of logging event. + + + + Level of logging event. Level cannot be Serializable + because it is a flyweight. Due to its special serialization it + cannot be declared final either. + + + + + + The application supplied message. + + + + The application supplied message of logging event. + + + + + + The name of thread + + + + The name of thread in which this logging event was generated + + + + + + Gets or sets the local time the event was logged + + + + Prefer using the setter, since local time can be ambiguous. + + + + + + Location information for the caller. + + + + Location information for the caller. + + + + + + String representation of the user + + + + String representation of the user's windows name, + like DOMAIN\username + + + + + + String representation of the identity. + + + + String representation of the current thread's principal identity. + + + + + + The string representation of the exception + + + + The string representation of the exception + + + + + + String representation of the AppDomain. + + + + String representation of the AppDomain. + + + + + + Additional event specific properties + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + + + + Gets or sets the UTC time the event was logged + + + + The TimeStamp is stored in the UTC time zone. + + + + + + Flags passed to the property + + + + Flags passed to the property + + + Nicko Cadell + + + + Fix the MDC + + + + + Fix the NDC + + + + + Fix the rendered message + + + + + Fix the thread name + + + + + Fix the callers location information + + + CAUTION: Very slow to generate + + + + + Fix the callers windows user name + + + CAUTION: Slow to generate + + + + + Fix the domain friendly name + + + + + Fix the callers principal name + + + CAUTION: May be slow to generate + + + + + Fix the exception text + + + + + Fix the event properties. Active properties must implement in order to be eligible for fixing. + + + + + No fields fixed + + + + + All fields fixed + + + + + Partial fields fixed + + + + This set of partial fields gives good performance. The following fields are fixed: + + + + + + + + + + + + + The internal representation of logging events. + + + + When an affirmative decision is made to log then a + instance is created. This instance + is passed around to the different log4net components. + + + This class is of concern to those wishing to extend log4net. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino + + + + The key into the Properties map for the host name value. + + + + + The key into the Properties map for the thread identity value. + + + + + The key into the Properties map for the user name value. + + + + + Initializes a new instance of the class + from the supplied parameters. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + The name of the logger of this event. + The level of this event. + The message of this event. + The exception for this event. + + + Except , and , + all fields of LoggingEvent are filled when actually needed. Call + to cache all data locally + to prevent inconsistencies. + + This method is called by the log4net framework + to create a logging event. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + The fields in the struct that have already been fixed. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + The parameter should be used to specify which fields in the + struct have been preset. Fields not specified in the + will be captured from the environment if requested or fixed. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Initializes a new instance of the class + using specific data. + + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Serialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Ensure that the repository is set. + + the value for the repository + + + + Write the rendered message to a TextWriter + + the writer to write the message to + + + Unlike the property this method + does store the message data in the internal cache. Therefore + if called only once this method should be faster than the + property, however if the message is + to be accessed multiple times then the property will be more efficient. + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + The data in this event must be fixed before it can be serialized. + + + The method must be called during the + method call if this event + is to be used outside that method. + + + + + + Gets the portable data for this . + + The for this event. + + + A new can be constructed using a + instance. + + + Does a fix of the data + in the logging event before returning the event data. + + + + + + Gets the portable data for this . + + The set of data to ensure is fixed in the LoggingEventData + The for this event. + + + A new can be constructed using a + instance. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Obsolete. Use instead. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Returns this event's exception's rendered using the + . + + + + + + Fix instance fields that hold volatile data. + + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + incurred by calling but it + is essential to maintaining data consistency. + + + Calling is equivalent to + calling passing the parameter + false. + + + See for more + information. + + + + + + Fixes instance fields that hold volatile data. + + Set to true to not fix data that takes a long time to fix. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + The param controls the data that + is fixed. Some of the data that can be fixed takes a long time to + generate, therefore if you do not require those settings to be fixed + they can be ignored by setting the param + to true. This setting will ignore the + and settings. + + + Set to false to ensure that all + settings are fixed. + + + + + + Fix the fields specified by the parameter + + the fields to fix + + + Only fields specified in the will be fixed. + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Lookup a composite property in this event + + the key for the property to lookup + the value for the property + + + This event has composite properties that combine together properties from + several different contexts in the following order: + + + this events properties + + This event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + + Get all the composite properties in this event + + the containing all the properties + + + See for details of the composite properties + stored by the event. + + + This method returns a single containing all the + properties defined for this event. + + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The fully qualified Type of the calling + logger class in the stack frame (i.e. the declaring type of the method). + + + + + The application supplied message of logging event. + + + + + The exception that was thrown. + + + This is not serialized. The string representation + is serialized instead. + + + + + The repository that generated the logging event + + + This is not serialized. + + + + + The fix state for this event + + + These flags indicate which fields have been fixed. + Not serialized. + + + + + Indicated that the internal cache is updateable (ie not fixed) + + + This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler + changes in the caching strategy. + + + + + Gets the time when the current process started. + + + This is the time when this process started. + + + + The TimeStamp is stored internally in UTC and converted to the local time zone for this computer. + + + Tries to get the start time for the current process. + Failing that it returns the time of the first call to + this property. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating and therefore + without the process start time being reset. + + + + + + Gets the UTC time when the current process started. + + + This is the UTC time when this process started. + + + + Tries to get the start time for the current process. + Failing that it returns the time of the first call to + this property. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating and therefore + without the process start time being reset. + + + + + + Gets the of the logging event. + + + The of the logging event. + + + + Gets the of the logging event. + + + + + + Gets the time of the logging event. + + + The time of the logging event. + + + + The TimeStamp is stored in UTC and converted to the local time zone for this computer. + + + + + + Gets UTC the time of the logging event. + + + The UTC time of the logging event. + + + + + Gets the name of the logger that logged the event. + + + The name of the logger that logged the event. + + + + Gets the name of the logger that logged the event. + + + + + + Gets the location information for this logging event. + + + The location information for this logging event. + + + + The collected information is cached for future use. + + + See the class for more information on + supported frameworks and the different behavior in Debug and + Release builds. + + + + + + Gets the message object used to initialize this event. + + + The message object used to initialize this event. + + + + Gets the message object used to initialize this event. + Note that this event may not have a valid message object. + If the event is serialized the message object will not + be transferred. To get the text of the message the + property must be used + not this property. + + + If there is no defined message object for this event then + null will be returned. + + + + + + Gets the exception object used to initialize this event. + + + The exception object used to initialize this event. + + + + Gets the exception object used to initialize this event. + Note that this event may not have a valid exception object. + If the event is serialized the exception object will not + be transferred. To get the text of the exception the + method must be used + not this property. + + + If there is no defined exception object for this event then + null will be returned. + + + + + + The that this event was created in. + + + + The that this event was created in. + + + + + + Gets the message, rendered through the . + + + The message rendered through the . + + + + The collected information is cached for future use. + + + + + + Gets the name of the current thread. + + + The name of the current thread, or the thread ID when + the name is not available. + + + + The collected information is cached for future use. + + + + + + Gets the name of the current user. + + + The name of the current user, or NOT AVAILABLE when the + underlying runtime has no support for retrieving the name of the + current user. + + + + Calls WindowsIdentity.GetCurrent().Name to get the name of + the current windows user. + + + To improve performance, we could cache the string representation of + the name, and reuse that as long as the identity stayed constant. + Once the identity changed, we would need to re-assign and re-render + the string. + + + However, the WindowsIdentity.GetCurrent() call seems to + return different objects every time, so the current implementation + doesn't do this type of caching. + + + Timing for these operations: + + + + Method + Results + + + WindowsIdentity.GetCurrent() + 10000 loops, 00:00:00.2031250 seconds + + + WindowsIdentity.GetCurrent().Name + 10000 loops, 00:00:08.0468750 seconds + + + + This means we could speed things up almost 40 times by caching the + value of the WindowsIdentity.GetCurrent().Name property, since + this takes (8.04-0.20) = 7.84375 seconds. + + + + + + Gets the identity of the current thread principal. + + + The string name of the identity of the current thread principal. + + + + Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get + the name of the current thread principal. + + + + + + Gets the AppDomain friendly name. + + + The AppDomain friendly name. + + + + Gets the AppDomain friendly name. + + + + + + Additional event specific properties. + + + Additional event specific properties. + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + This property is for events that have been added directly to + this event. The aggregate properties (which include these + event properties) can be retrieved using + and . + + + Once the properties have been fixed this property + returns the combined cached properties. This ensures that updates to + this property are always reflected in the underlying storage. When + returning the combined properties there may be more keys in the + Dictionary than expected. + + + + + + The fixed fields in this event + + + The set of fields that are fixed in this event + + + + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Implementation of wrapper interface. + + + + This implementation of the interface + forwards to the held by the base class. + + + This logger has methods to allow the caller to log at the following + levels: + + + + DEBUG + + The and methods log messages + at the DEBUG level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + INFO + + The and methods log messages + at the INFO level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + WARN + + The and methods log messages + at the WARN level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + ERROR + + The and methods log messages + at the ERROR level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + FATAL + + The and methods log messages + at the FATAL level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + + The values for these levels and their semantic meanings can be changed by + configuring the for the repository. + + + Nicko Cadell + Gert Driesen + + + + The ILog interface is use by application to log messages into + the log4net framework. + + + + Use the to obtain logger instances + that implement this interface. The + static method is used to get logger instances. + + + This class contains methods for logging at different levels and also + has properties for determining if those logging levels are + enabled in the current configuration. + + + This interface can be implemented in different ways. This documentation + specifies reasonable behavior that a caller can expect from the actual + implementation, however different implementations reserve the right to + do things differently. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + Log a message object with the level. + + Log a message object with the level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Logs a message object with the INFO level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + For some ILog interface log, when you write: + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, string construction and concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed (who isn't), then you should write: + + + if (log.IsDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in and once in + the . This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. This is the preferred style of logging. + + Alternatively if your logger is available statically then the is debug + enabled state can be stored in a static variable like this: + + + private static readonly bool isDebugEnabled = log.IsDebugEnabled; + + + Then when you come to log you can write: + + + if (isDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way the debug enabled state is only queried once + when the class is loaded. Using a private static readonly + variable is the most efficient because it is a run time constant + and can be heavily optimized by the JIT compiler. + + + Of course if you use a static readonly variable to + hold the enabled state of the logger then you cannot + change the enabled state at runtime to vary the logging + that is produced. You have to decide if you need absolute + speed or runtime flexibility. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Construct a new wrapper for the specified logger. + + The logger to wrap. + + + Construct a new wrapper for the specified logger. + + + + + + Virtual method called when the configuration of the repository changes + + the repository holding the levels + + + Virtual method called when the configuration of the repository changes + + + + + + Logs a message object with the DEBUG level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + DEBUG level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the DEBUG level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the DEBUG level including + the stack trace of the passed + as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + INFO level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the INFO level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the WARN level. + + the message object to log + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + WARN level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the WARN level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the WARN level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the ERROR level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + ERROR level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the ERROR level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the ERROR level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the FATAL level. + + The message object to log. + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + FATAL level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the FATAL level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the FATAL level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Event handler for the event + + the repository + Empty + + + + The fully qualified name of this declaring type not the type of any subclass. + + + + + Checks if this logger is enabled for the DEBUG + level. + + + true if this logger is enabled for DEBUG events, + false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + + For some log Logger object, when you write: + + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed, then you should write: + + + if (log.IsDebugEnabled()) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in IsDebugEnabled and once in + the Debug. This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. + + + + + + Checks if this logger is enabled for the INFO level. + + + true if this logger is enabled for INFO events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the WARN level. + + + true if this logger is enabled for WARN events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the ERROR level. + + + true if this logger is enabled for ERROR events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + Checks if this logger is enabled for the FATAL level. + + + true if this logger is enabled for FATAL events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + provides method information without actually referencing a System.Reflection.MethodBase + as that would require that the containing assembly is loaded. + + + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + constructs a method item for an unknown method. + + + + + constructs a method item from the name of the method. + + + + + + constructs a method item from the name of the method and its parameters. + + + + + + + constructs a method item from a method base by determining the method name and its parameters. + + + + + + The fully qualified type of the StackFrameItem class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the method name of the caller making the logging + request. + + + The method name of the caller making the logging + request. + + + + Gets the method name of the caller making the logging + request. + + + + + + Gets the method parameters of the caller making + the logging request. + + + The method parameters of the caller making + the logging request + + + + Gets the method parameters of the caller making + the logging request. + + + + + + A SecurityContext used by log4net when interacting with protected resources + + + + A SecurityContext used by log4net when interacting with protected resources + for example with operating system services. This can be used to impersonate + a principal that has been granted privileges on the system resources. + + + Nicko Cadell + + + + Impersonate this SecurityContext + + State supplied by the caller + An instance that will + revoke the impersonation of this SecurityContext, or null + + + Impersonate this security context. Further calls on the current + thread should now be made in the security context provided + by this object. When the result + method is called the security + context of the thread should be reverted to the state it was in + before was called. + + + + + + The providers default instances. + + + + A configured component that interacts with potentially protected system + resources uses a to provide the elevated + privileges required. If the object has + been not been explicitly provided to the component then the component + will request one from this . + + + By default the is + an instance of which returns only + objects. This is a reasonable default + where the privileges required are not know by the system. + + + This default behavior can be overridden by subclassing the + and overriding the method to return + the desired objects. The default provider + can be replaced by programmatically setting the value of the + property. + + + An alternative is to use the log4net.Config.SecurityContextProviderAttribute + This attribute can be applied to an assembly in the same way as the + log4net.Config.XmlConfiguratorAttribute". The attribute takes + the type to use as the as an argument. + + + Nicko Cadell + + + + The default provider + + + + + Protected default constructor to allow subclassing + + + + Protected default constructor to allow subclassing + + + + + + Create a SecurityContext for a consumer + + The consumer requesting the SecurityContext + An impersonation context + + + The default implementation is to return a . + + + Subclasses should override this method to provide their own + behavior. + + + + + + Gets or sets the default SecurityContextProvider + + + The default SecurityContextProvider + + + + The default provider is used by configured components that + require a and have not had one + given to them. + + + By default this is an instance of + that returns objects. + + + The default provider can be set programmatically by setting + the value of this property to a sub class of + that has the desired behavior. + + + + + + provides stack frame information without actually referencing a System.Diagnostics.StackFrame + as that would require that the containing assembly is loaded. + + + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + returns a stack frame item from a stack frame. This + + + + + + + The fully qualified type of the StackFrameItem class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the fully qualified class name of the caller making the logging + request. + + + The fully qualified class name of the caller making the logging + request. + + + + Gets the fully qualified class name of the caller making the logging + request. + + + + + + Gets the file name of the caller. + + + The file name of the caller. + + + + Gets the file name of the caller. + + + + + + Gets the line number of the caller. + + + The line number of the caller. + + + + Gets the line number of the caller. + + + + + + Gets the method name of the caller. + + + The method name of the caller. + + + + Gets the method name of the caller. + + + + + + Gets all available caller information + + + All available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + Gets all available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + + + An evaluator that triggers after specified number of seconds. + + + + This evaluator will trigger if the specified time period + has passed since last check. + + + Robert Sevcik + + + + The default time threshold for triggering in seconds. Zero means it won't trigger at all. + + + + + The time threshold for triggering in seconds. Zero means it won't trigger at all. + + + + + The UTC time of last check. This gets updated when the object is created and when the evaluator triggers. + + + + + Create a new evaluator using the time threshold in seconds. + + + + Create a new evaluator using the time threshold in seconds. + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + Create a new evaluator using the specified time threshold in seconds. + + + The time threshold in seconds to trigger after. + Zero means it won't trigger at all. + + + + Create a new evaluator using the specified time threshold in seconds. + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + Is this the triggering event? + + The event to check + This method returns true, if the specified time period + has passed since last check.. + Otherwise it returns false + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + The time threshold in seconds to trigger after + + + The time threshold in seconds to trigger after. + Zero means it won't trigger at all. + + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + Delegate used to handle creation of new wrappers. + + The logger to wrap in a wrapper. + + + Delegate used to handle creation of new wrappers. This delegate + is called from the + method to construct the wrapper for the specified logger. + + + The delegate to use is supplied to the + constructor. + + + + + + Maps between logger objects and wrapper objects. + + + + This class maintains a mapping between objects and + objects. Use the method to + lookup the for the specified . + + + New wrapper instances are created by the + method. The default behavior is for this method to delegate construction + of the wrapper to the delegate supplied + to the constructor. This allows specialization of the behavior without + requiring subclassing of this type. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the + + The handler to use to create the wrapper objects. + + + Initializes a new instance of the class with + the specified handler to create the wrapper objects. + + + + + + Gets the wrapper object for the specified logger. + + The wrapper object for the specified logger + + + If the logger is null then the corresponding wrapper is null. + + + Looks up the wrapper it it has previously been requested and + returns it. If the wrapper has never been requested before then + the virtual method is + called. + + + + + + Creates the wrapper object for the specified logger. + + The logger to wrap in a wrapper. + The wrapper object for the logger. + + + This implementation uses the + passed to the constructor to create the wrapper. This method + can be overridden in a subclass. + + + + + + Called when a monitored repository shutdown event is received. + + The that is shutting down + + + This method is called when a that this + is holding loggers for has signaled its shutdown + event . The default + behavior of this method is to release the references to the loggers + and their wrappers generated for this repository. + + + + + + Event handler for repository shutdown event. + + The sender of the event. + The event args. + + + + Map of logger repositories to hashtables of ILogger to ILoggerWrapper mappings + + + + + The handler to use to create the extension wrapper objects. + + + + + Internal reference to the delegate used to register for repository shutdown events. + + + + + Gets the map of logger repositories. + + + Map of logger repositories. + + + + Gets the hashtable that is keyed on . The + values are hashtables keyed on with the + value being the corresponding . + + + + + + Formats a as "HH:mm:ss,fff". + + + + Formats a in the format "HH:mm:ss,fff" for example, "15:49:37,459". + + + Nicko Cadell + Gert Driesen + + + + Render a as a string. + + + + Interface to abstract the rendering of a + instance into a string. + + + The method is used to render the + date to a text writer. + + + Nicko Cadell + Gert Driesen + + + + Formats the specified date as a string. + + The date to format. + The writer to write to. + + + Format the as a string and write it + to the provided. + + + + + + String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is ABSOLUTE. + + + + + String constant used to specify DateTimeDateFormat in layouts. Current value is DATE. + + + + + String constant used to specify ISO8601DateFormat in layouts. Current value is ISO8601. + + + + + Renders the date into a string. Format is "HH:mm:ss". + + The date to render into a string. + The string builder to write to. + + + Subclasses should override this method to render the date + into a string using a precision up to the second. This method + will be called at most once per second and the result will be + reused if it is needed again during the same second. + + + + + + Renders the date into a string. Format is "HH:mm:ss,fff". + + The date to render into a string. + The writer to write to. + + + Uses the method to generate the + time string up to the seconds and then appends the current + milliseconds. The results from are + cached and is called at most once + per second. + + + Sub classes should override + rather than . + + + + + + Last stored time with precision up to the second. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Formats a as "dd MMM yyyy HH:mm:ss,fff" + + + + Formats a in the format + "dd MMM yyyy HH:mm:ss,fff" for example, + "06 Nov 1994 15:49:37,459". + + + Nicko Cadell + Gert Driesen + Angelika Schnagl + + + + Default constructor. + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats a DateTime in the format "dd MMM yyyy HH:mm:ss" + for example, "06 Nov 1994 15:49:37". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + The format info for the invariant culture. + + + + + Formats the as "yyyy-MM-dd HH:mm:ss,fff". + + + + Formats the specified as a string: "yyyy-MM-dd HH:mm:ss,fff". + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats the date specified as a string: "yyyy-MM-dd HH:mm:ss". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + Formats the using the method. + + + + Formats the using the method. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The format string. + + + Initializes a new instance of the class + with the specified format string. + + + The format string must be compatible with the options + that can be supplied to . + + + + + + Formats the date using . + + The date to convert to a string. + The writer to write to. + + + Uses the date format string supplied to the constructor to call + the method to format the date. + + + + + + The format string used to format the . + + + + The format string must be compatible with the options + that can be supplied to . + + + + + + This filter drops all . + + + + You can add this filter to the end of a filter chain to + switch from the default "accept all unless instructed otherwise" + filtering behavior to a "deny all unless instructed otherwise" + behavior. + + + Nicko Cadell + Gert Driesen + + + + Subclass this type to implement customized logging event filtering + + + + Users should extend this class to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface to provide customized logging event filtering + + + + Users should implement this interface to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Decide if the logging event should be logged through an appender. + + The LoggingEvent to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Points to the next filter in the filter chain. + + + + See for more information. + + + + + + Initialize the filter with the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Typically filter's options become active immediately on set, + however this method must still be called. + + + + + + Decide if the should be logged through an appender. + + The to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + This method is marked abstract and must be implemented + in a subclass. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Default constructor + + + + + Always returns the integer constant + + the LoggingEvent to filter + Always returns + + + Ignores the event being logged and just returns + . This can be used to change the default filter + chain behavior from to . This filter + should only be used as the last filter in the chain + as any further filters will be ignored! + + + + + + The return result from + + + + The return result from + + + + + + The log event must be dropped immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This filter is neutral with respect to the log event. + The remaining filters, if any, should be consulted for a final decision. + + + + + The log event must be logged immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This is a very simple filter based on matching. + + + + The filter admits two options and + . If there is an exact match between the value + of the option and the of the + , then the method returns in + case the option value is set + to true, if it is false then + is returned. If the does not match then + the result will be . + + + Nicko Cadell + Gert Driesen + + + + flag to indicate if the filter should on a match + + + + + the to match against + + + + + Default constructor + + + + + Tests if the of the logging event matches that of the filter + + the event to filter + see remarks + + + If the of the event matches the level of the + filter then the result of the function depends on the + value of . If it is true then + the function will return , it it is false then it + will return . If the does not match then + the result will be . + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + The level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + This is a simple filter based on matching. + + + + The filter admits three options and + that determine the range of priorities that are matched, and + . If there is a match between the range + of priorities and the of the , then the + method returns in case the + option value is set to true, if it is false + then is returned. If there is no match, is returned. + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when matching a + + + + + the minimum value to match + + + + + the maximum value to match + + + + + Default constructor + + + + + Check if the event should be logged. + + the logging event to check + see remarks + + + If the of the logging event is outside the range + matched by this filter then + is returned. If the is matched then the value of + is checked. If it is true then + is returned, otherwise + is returned. + + + + + + when matching and + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Set the minimum matched + + + + The minimum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Sets the maximum matched + + + + The maximum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a string in the event's logger name. + + + + The works very similar to the . It admits two + options and . If the + of the starts + with the value of the option, then the + method returns in + case the option value is set to true, + if it is false then is returned. + + + Daniel Cazzulino + + + + Flag to indicate the behavior when we have a match + + + + + The logger name string to substring match against the event + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the equals the beginning of + the incoming () + then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + This filter will attempt to match this value against logger name in + the following way. The match will be done against the beginning of the + logger name (using ). The match is + case sensitive. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a keyed string in the + + + + Simple filter to match a keyed string in the + + + As the MDC has been replaced with layered properties the + should be used instead. + + + Nicko Cadell + Gert Driesen + + + + Simple filter to match a string an event property + + + + Simple filter to match a string in the value for a + specific event property + + + Nicko Cadell + + + + Simple filter to match a string in the rendered message + + + + Simple filter to match a string in the rendered message + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when we have a match + + + + + The string to substring match against the message + + + + + A string regex to match + + + + + A regex object to match (generated from m_stringRegexToMatch) + + + + + Default constructor + + + + + Initialize and precompile the Regex if required + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the occurs as a substring within + the message then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching or + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Sets the static string to match + + + + The string that will be substring matched against + the rendered message. If the message contains this + string then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + Sets the regular expression to match + + + + The regular expression pattern that will be matched against + the rendered message. If the message matches this + pattern then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + The key to use to lookup the string from the event properties + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The event property for the is matched against + the . + If the occurs as a substring within + the property value then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + The key to lookup in the event properties and then match against. + + + + The key name to use to lookup in the properties map of the + . The match will be performed against + the value of this property if it exists. + + + + + + Simple filter to match a string in the + + + + Simple filter to match a string in the + + + As the MDC has been replaced with named stacks stored in the + properties collections the should + be used instead. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Sets the to "NDC". + + + + + + Write the event appdomain name to the output + + + + Writes the to the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + + Nicko Cadell + Gert Driesen + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Protected constructor + + + + Initializes a new instance of the class. + + + + + + Evaluate this pattern converter and write the output to a writer. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the appropriate way. + + + + + + Set the next pattern converter in the chains + + the pattern converter that should follow this converter in the chain + the next converter + + + The PatternConverter can merge with its neighbor during this method (or a sub class). + Therefore the return value may or may not be the value of the argument passed in. + + + + + + Write the pattern converter to the writer with appropriate formatting + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + This method calls to allow the subclass to perform + appropriate conversion of the pattern converter. If formatting options have + been specified via the then this method will + apply those formattings before writing the output. + + + + + + Fast space padding method. + + to which the spaces will be appended. + The number of spaces to be padded. + + + Fast space padding method. + + + + + + The option string to the converter + + + + + Write an dictionary to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the to a writer in the form: + + + {key1=value1, key2=value2, key3=value3} + + + If the specified + is not null then it is used to render the key and value to text, otherwise + the object's ToString method is called. + + + + + + Write an dictionary to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the to a writer in the form: + + + {key1=value1, key2=value2, key3=value3} + + + If the specified + is not null then it is used to render the key and value to text, otherwise + the object's ToString method is called. + + + + + + Write an object to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the Object to a writer. If the specified + is not null then it is used to render the object to text, otherwise + the object's ToString method is called. + + + + + + Get the next pattern converter in the chain + + + the next pattern converter in the chain + + + + Get the next pattern converter in the chain + + + + + + Gets or sets the formatting info for this converter + + + The formatting info for this converter + + + + Gets or sets the formatting info for this converter + + + + + + Gets or sets the option value for this converter + + + The option for this converter + + + + Gets or sets the option value for this converter + + + + + + + + + + + Initializes a new instance of the class. + + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The on which the pattern converter should be executed. + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + + Flag indicating if this converter handles exceptions + + + false if this converter handles exceptions + + + + + Flag indicating if this converter handles the logging event exception + + false if this converter handles the logging event exception + + + If this converter handles the exception object contained within + , then this property should be set to + false. Otherwise, if the layout ignores the exception + object, then the property should be set to true. + + + Set this value to override a this default setting. The default + value is true, this converter does not handle the exception. + + + + + + Write the event appdomain name to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output . + + + + + + Converter for items in the ASP.Net Cache. + + + + Outputs an item from the . + + + Ron Grabowski + + + + Abstract class that provides access to the current HttpContext () that + derived classes need. + + + This class handles the case when HttpContext.Current is null by writing + to the writer. + + Ron Grabowski + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. If no property has been set, all key value pairs from the Cache will + be written to the output. + + + + + + Converter for items in the . + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net HttpContext item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. + + + + + + Converter for items in the ASP.Net Cache. + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. + + + + + + Converter for items in the ASP.Net Cache. + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. If no property has been set, all key value pairs from the Session will + be written to the output. + + + + + + Date pattern converter, uses a to format + the date of a . + + + + Render the to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,yyyy" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter pattern based on the property. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert the pattern into the rendered message + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone. + + + + + + The fully qualified type of the DatePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write the exception text to the output + + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + Nicko Cadell + + + + Default constructor + + + + + Write the exception text to the output + + that will receive the formatted result. + the event being logged + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception or the exception property specified + by the Option value does not exist then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + Recognized values for the Option parameter are: + + + + Message + + + Source + + + StackTrace + + + TargetSite + + + HelpLink + + + + + + + Writes the caller location file name to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location file name to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Write the caller location info to the output + + + + Writes the to the output writer. + + + Nicko Cadell + + + + Write the caller location info to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output writer. + + + + + + Writes the event identity to the output + + + + Writes the value of the to + the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Writes the event identity to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the + to + the output . + + + + + + Write the event level to the output + + + + Writes the display name of the event + to the writer. + + + Nicko Cadell + + + + Write the event level to the output + + that will receive the formatted result. + the event being logged + + + Writes the of the + to the . + + + + + + Write the caller location line number to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location line number to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Converter for logger name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Converter to output and truncate '.' separated strings + + + + This abstract class supports truncating a '.' separated string + to show a specified number of elements from the right hand side. + This is used to truncate class names that are fully qualified. + + + Subclasses should override the method to + return the fully qualified string. + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Get the fully qualified string data + + the event being logged + the fully qualified name + + + Overridden by subclasses to get the fully qualified name before the + precision is applied to it. + + + Return the fully qualified '.' (dot/period) separated string. + + + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + Render the to the precision + specified by the property. + + + + + The fully qualified type of the NamedPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the fully qualified name of the logger + + the event being logged + The fully qualified logger name + + + Returns the of the . + + + + + + Writes the event message to the output + + + + Uses the method + to write out the event message. + + + Nicko Cadell + + + + Writes the event message to the output + + that will receive the formatted result. + the event being logged + + + Uses the method + to write out the event message. + + + + + + Write the method name to the output + + + + Writes the caller location to + the output. + + + Nicko Cadell + + + + Write the method name to the output + + that will receive the formatted result. + the event being logged + + + Writes the caller location to + the output. + + + + + + Converter to include event NDC + + + + Outputs the value of the event property named NDC. + + + The should be used instead. + + + Nicko Cadell + + + + Write the event NDC to the output + + that will receive the formatted result. + the event being logged + + + As the thread context stacks are now stored in named event properties + this converter simply looks up the value of the NDC property. + + + The should be used instead. + + + + + + Property pattern converter + + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + the event being logged + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + Converter to output the relative time of the event + + + + Converter to output the time of the event relative to the start of the program. + + + Nicko Cadell + + + + Write the relative time to the output + + that will receive the formatted result. + the event being logged + + + Writes out the relative time of the event in milliseconds. + That is the number of milliseconds between the event + and the . + + + + + + Helper method to get the time difference between two DateTime objects + + start time (in the current local time zone) + end time (in the current local time zone) + the time difference in milliseconds + + + + Write the caller stack frames to the output + + + + Writes the to the output writer, using format: + type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + + + Adam Davies + + + + Write the caller stack frames to the output + + + + Writes the to the output writer, using format: + type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + + + Michael Cromwell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the strack frames to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output writer. + + + + + + Returns the Name of the method + + + This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter + string + + + + The fully qualified type of the StackTracePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + The fully qualified type of the StackTraceDetailPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Converter to include event thread name + + + + Writes the to the output. + + + Nicko Cadell + + + + Write the ThreadName to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the . + + + + + + Pattern converter for the class name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Gets the fully qualified name of the class + + the event being logged + The fully qualified type name for the caller location + + + Returns the of the . + + + + + + Converter to include event user name + + Douglas de la Torre + Nicko Cadell + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + + + Write the TimeStamp to the output + + + + Date pattern converter, uses a to format + the date of a . + + + Uses a to format the + in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the TimeStamp to the output + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone, this is converted + to Universal time before it is rendered. + + + + + + + The fully qualified type of the UtcDatePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + A flexible layout configurable with pattern string that re-evaluates on each call. + + + This class is built on and provides all the + features and capabilities of PatternLayout. PatternLayout is a 'static' class + in that its layout is done once at configuration time. This class will recreate + the layout on each reference. + One important difference between PatternLayout and DynamicPatternLayout is the + treatment of the Header and Footer parameters in the configuration. The Header and Footer + parameters for DynamicPatternLayout must be syntactically in the form of a PatternString, + but should not be marked as type log4net.Util.PatternString. Doing so causes the + pattern to be statically converted at configuration time and causes DynamicPatternLayout + to perform the same as PatternLayout. + Please see for complete documentation. + + <layout type="log4net.Layout.DynamicPatternLayout"> + <param name="Header" value="%newline**** Trace Opened Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + <param name="Footer" value="**** Trace Closed %date{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + </layout> + + + + + + A flexible layout configurable with pattern string. + + + + The goal of this class is to a + as a string. The results + depend on the conversion pattern. + + + The conversion pattern is closely related to the conversion + pattern of the printf function in C. A conversion pattern is + composed of literal text and format control expressions called + conversion specifiers. + + + You are free to insert any literal text within the conversion + pattern. + + + Each conversion specifier starts with a percent sign (%) and is + followed by optional format modifiers and a conversion + pattern name. The conversion pattern name specifies the type of + data, e.g. logger, level, date, thread name. The format + modifiers control such things as field width, padding, left and + right justification. The following is a simple example. + + + Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume + that the log4net environment was set to use a PatternLayout. Then the + statements + + + ILog log = LogManager.GetLogger(typeof(TestApp)); + log.Debug("Message 1"); + log.Warn("Message 2"); + + would yield the output + + DEBUG [main]: Message 1 + WARN [main]: Message 2 + + + Note that there is no explicit separator between text and + conversion specifiers. The pattern parser knows when it has reached + the end of a conversion specifier when it reads a conversion + character. In the example above the conversion specifier + %-5level means the level of the logging event should be left + justified to a width of five characters. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + a + Equivalent to appdomain + + + appdomain + + Used to output the friendly name of the AppDomain where the + logging event was generated. + + + + aspnet-cache + + + Used to output all cache items in the case of %aspnet-cache or just one named item if used as %aspnet-cache{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-context + + + Used to output all context items in the case of %aspnet-context or just one named item if used as %aspnet-context{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-request + + + Used to output all request parameters in the case of %aspnet-request or just one named param if used as %aspnet-request{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-session + + + Used to output all session items in the case of %aspnet-session or just one named item if used as %aspnet-session{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + c + Equivalent to logger + + + C + Equivalent to type + + + class + Equivalent to type + + + d + Equivalent to date + + + date + + + Used to output the date of the logging event in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + exception + + + Used to output the exception passed in with the log message. + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + + + F + Equivalent to file + + + file + + + Used to output the file name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + WARNING Generating caller information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + l + Equivalent to location + + + L + Equivalent to line + + + location + + + Used to output location information of the caller which generated + the logging event. + + + The location information depends on the CLI implementation but + usually consists of the fully qualified name of the calling + method followed by the callers source the file name and line + number between parentheses. + + + The location information can be very useful. However, its + generation is extremely slow. Its use should be avoided + unless execution speed is not an issue. + + + See the note below on the availability of caller location information. + + + + + level + + + Used to output the level of the logging event. + + + + + line + + + Used to output the line number from where the logging request + was issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + logger + + + Used to output the logger of the logging event. The + logger conversion specifier can be optionally followed by + precision specifier, that is a decimal constant in + brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the logger name will be + printed. By default the logger name is printed in full. + + + For example, for the logger name "a.b.c" the pattern + %logger{2} will output "b.c". + + + + + m + Equivalent to message + + + M + Equivalent to method + + + message + + + Used to output the application supplied message associated with + the logging event. + + + + + mdc + + + The MDC (old name for the ThreadContext.Properties) is now part of the + combined event properties. This pattern is supported for compatibility + but is equivalent to property. + + + + + method + + + Used to output the method name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + n + Equivalent to newline + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + ndc + + + Used to output the NDC (nested diagnostic context) associated + with the thread that generated the logging event. + + + + + p + Equivalent to level + + + P + Equivalent to property + + + properties + Equivalent to property + + + property + + + Used to output the an event specific property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are added to events by loggers or appenders. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the event properties + + The event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + r + Equivalent to timestamp + + + stacktrace + + + Used to output the stack trace of the logging event + The stack trace level specifier may be enclosed + between braces. For example, %stacktrace{level}. + If no stack trace level specifier is given then 1 is assumed + + + Output uses the format: + type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + + + This pattern is not available for Compact Framework assemblies. + + + + + stacktracedetail + + + Used to output the stack trace of the logging event + The stack trace level specifier may be enclosed + between braces. For example, %stacktracedetail{level}. + If no stack trace level specifier is given then 1 is assumed + + + Output uses the format: + type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + + + This pattern is not available for Compact Framework assemblies. + + + + + t + Equivalent to thread + + + timestamp + + + Used to output the number of milliseconds elapsed since the start + of the application until the creation of the logging event. + + + + + thread + + + Used to output the name of the thread that generated the + logging event. Uses the thread number if no name is available. + + + + + type + + + Used to output the fully qualified type name of the caller + issuing the logging request. This conversion specifier + can be optionally followed by precision specifier, that + is a decimal constant in brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the class name will be + printed. By default the class name is output in fully qualified form. + + + For example, for the class name "log4net.Layout.PatternLayout", the + pattern %type{1} will output "PatternLayout". + + + WARNING Generating the caller class information is + slow. Thus, its use should be avoided unless execution speed is + not an issue. + + + See the note below on the availability of caller location information. + + + + + u + Equivalent to identity + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + WARNING Generating caller WindowsIdentity information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + w + Equivalent to username + + + x + Equivalent to ndc + + + X + Equivalent to mdc + + + % + + + The sequence %% outputs a single percent sign. + + + + + + The single letter patterns are deprecated in favor of the + longer more descriptive pattern names. + + + By default the relevant information is output as is. However, + with the aid of format modifiers it is possible to change the + minimum field width, the maximum field width and justification. + + + The optional format modifier is placed between the percent sign + and the conversion pattern name. + + + The first optional format modifier is the left justification + flag which is just the minus (-) character. Then comes the + optional minimum field width modifier. This is a decimal + constant that represents the minimum number of characters to + output. If the data item requires fewer characters, it is padded on + either the left or the right until the minimum width is + reached. The default is to pad on the left (right justify) but you + can specify right padding with the left justification flag. The + padding character is space. If the data item is larger than the + minimum field width, the field is expanded to accommodate the + data. The value is never truncated. + + + This behavior can be changed using the maximum field + width modifier which is designated by a period followed by a + decimal constant. If the data item is longer than the maximum + field, then the extra characters are removed from the + beginning of the data item and not from the end. For + example, it the maximum field width is eight and the data item is + ten characters long, then the first two characters of the data item + are dropped. This behavior deviates from the printf function in C + where truncation is done from the end. + + + Below are various format modifier examples for the logger + conversion specifier. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none + + Left pad with spaces if the logger name is less than 20 + characters long. + +
%-20loggertrue20none + + Right pad with spaces if the logger + name is less than 20 characters long. + +
%.30loggerNAnone30 + + Truncate from the beginning if the logger + name is longer than 30 characters. + +
%20.30loggerfalse2030 + + Left pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
%-20.30loggertrue2030 + + Right pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
+
+ + Note about caller location information.
+ The following patterns %type %file %line %method %location %class %C %F %L %l %M + all generate caller location information. + Location information uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. +
+ + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + + Additional pattern converters may be registered with a specific + instance using the method. + +
+ + This is a more detailed pattern. + %timestamp [%thread] %level %logger %ndc - %message%newline + + + A similar pattern except that the relative time is + right padded if less than 6 digits, thread name is right padded if + less than 15 characters and truncated if longer and the logger + name is left padded if shorter than 30 characters and truncated if + longer. + %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino +
+ + + Extend this abstract class to create your own log layout format. + + + + This is the base implementation of the + interface. Most layout objects should extend this class. + + + + + + Subclasses must implement the + method. + + + Subclasses should set the in their default + constructor. + + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by layout objects + + + + An object is used to format a + as text. The method is called by an + appender to transform the into a string. + + + The layout can also supply and + text that is appender before any events and after all the events respectively. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text and output to a writer. + + + If the caller does not have a and prefers the + event to be formatted as a then the following + code can be used to format the event into a . + + + StringWriter writer = new StringWriter(); + Layout.Format(writer, loggingEvent); + string formattedEvent = writer.ToString(); + + + + + + The content type output by this layout. + + The content type + + + The content type output by this layout. + + + This is a MIME type e.g. "text/plain". + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handle exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + + + + The header text + + + + See for more information. + + + + + + The footer text + + + + See for more information. + + + + + + Flag indicating if this layout handles exceptions + + + + false if this layout handles exceptions + + + + + + Empty default constructor + + + + Empty default constructor + + + + + + Activate component options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This method must be implemented by the subclass. + + + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text. + + + + + + Convenience method for easily formatting the logging event into a string variable. + + + + Creates a new StringWriter instance to store the formatted logging event. + + + + + The content type output by this layout. + + The content type is "text/plain" + + + The content type output by this layout. + + + This base class uses the value "text/plain". + To change this value a subclass must override this + property. + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handles exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + Set this value to override a this default setting. The default + value is true, this layout does not handle the exception. + + + + + + Default pattern string for log output. + + + + Default pattern string for log output. + Currently set to the string "%message%newline" + which just prints the application supplied message. + + + + + + A detailed conversion pattern + + + + A conversion pattern which includes Time, Thread, Logger, and Nested Context. + Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. + + + + + + Internal map of converter identifiers to converter types. + + + + This static map is overridden by the m_converterRegistry instance map + + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternLayout only + + + + + Initialize the global registry + + + + Defines the builtin global rules. + + + + + + Constructs a PatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + As per the contract the + method must be called after the properties on this object have been + configured. + + + + + + Constructs a PatternLayout using the supplied conversion pattern + + the pattern to use + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + When using this constructor the method + need not be called. This may not be the case when using a subclass. + + + + + + Create the pattern parser instance + + the pattern to parse + The that will format the event + + + Creates the used to parse the conversion string. Sets the + global and instance rules on the . + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string as specified by the conversion pattern. + + the event being logged + The TextWriter to write the formatted event to + + + Parse the using the patter format + specified in the property. + + + + + + Add a converter to this PatternLayout + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternLayout + + the name of the conversion pattern for this converter + the type of the converter + + + Add a named pattern converter to this instance. This + converter will be used in the formatting of the event. + This method must be called before . + + + The specified must extend the + type. + + + + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + The header PatternString + + + + + The footer PatternString + + + + + Constructs a DynamicPatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + + + + Constructs a DynamicPatternLayout using the supplied conversion pattern + + the pattern to use + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + The pattern will be formatted on each get operation. + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + The pattern will be formatted on each get operation. + + + + + A Layout that renders only the Exception text from the logging event + + + + A Layout that renders only the Exception text from the logging event. + + + This Layout should only be used with appenders that utilize multiple + layouts (e.g. ). + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Constructs a ExceptionLayout + + + + + + Activate component options + + + + Part of the component activation + framework. + + + This method does nothing as options become effective immediately. + + + + + + Gets the exception text from the logging event + + The TextWriter to write the formatted event to + the event being logged + + + Write the exception string to the . + The exception string is retrieved from . + + + + + + Interface for raw layout objects + + + + Interface used to format a + to an object. + + + This interface should not be confused with the + interface. This interface is used in + only certain specialized situations where a raw object is + required rather than a formatted string. The + is not generally useful than this interface. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The event to format + returns the formatted event + + + Implement this method to create your own layout format. + + + + + + Adapts any to a + + + + Where an is required this adapter + allows a to be specified. + + + Nicko Cadell + Gert Driesen + + + + The layout to adapt + + + + + Construct a new adapter + + the layout to adapt + + + Create the adapter for the specified . + + + + + + Format the logging event as an object. + + The event to format + returns the formatted event + + + Format the logging event as an object. + + + Uses the object supplied to + the constructor to perform the formatting. + + + + + + Type converter for the interface + + + + Used to convert objects to the interface. + Supports converting from the interface to + the interface using the . + + + Nicko Cadell + Gert Driesen + + + + Interface supported by type converters + + + + This interface supports conversion from arbitrary types + to a single target type. See . + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Test if the can be converted to the + type supported by this converter. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Converts the to the type supported + by this converter. + + + + + + Can the sourceType be converted to an + + the source to be to be converted + true if the source type can be converted to + + + Test if the can be converted to a + . Only is supported + as the . + + + + + + Convert the value to a object + + the value to convert + the object + + + Convert the object to a + object. If the object + is a then the + is used to adapt between the two interfaces, otherwise an + exception is thrown. + + + + + + Extract the value of a property from the + + + + Extract the value of a property from the + + + Nicko Cadell + + + + Constructs a RawPropertyLayout + + + + + Lookup the property for + + The event to format + returns property value + + + Looks up and returns the object value of the property + named . If there is no property defined + with than name then null will be returned. + + + + + + The name of the value to lookup in the LoggingEvent Properties collection. + + + Value to lookup in the LoggingEvent Properties collection + + + + String name of the property to lookup in the . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in local time. To format the time stamp + in universal time use . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawUtcTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in universal time. To format the time stamp + in local time use . + + + + + + A very simple layout + + + + SimpleLayout consists of the level of the log statement, + followed by " - " and then the log message itself. For example, + + DEBUG - Hello world + + + + Nicko Cadell + Gert Driesen + + + + Constructs a SimpleLayout + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a simple formatted output. + + the event being logged + The TextWriter to write the formatted event to + + + Formats the event as the level of the even, + followed by " - " and then the log message itself. The + output is terminated by a newline. + + + + + + Layout that formats the log events as XML elements. + + + + The output of the consists of a series of + log4net:event elements. It does not output a complete well-formed XML + file. The output is designed to be included as an external entity + in a separate file to form a correct XML file. + + + For example, if abc is the name of the file where + the output goes, then a well-formed XML file would + be: + + + <?xml version="1.0" ?> + + <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> + + <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> + &data; + </log4net:events> + + + This approach enforces the independence of the + and the appender where it is embedded. + + + The version attribute helps components to correctly + interpret output generated by . The value of + this attribute should be "1.2" for release 1.2 and later. + + + Alternatively the Header and Footer properties can be + configured to output the correct XML header, open tag and close tag. + When setting the Header and Footer properties it is essential + that the underlying data store not be appendable otherwise the data + will become invalid XML. + + + Nicko Cadell + Gert Driesen + + + + Layout that formats the log events as XML elements. + + + + This is an abstract class that must be subclassed by an implementation + to conform to a specific schema. + + + Deriving classes must implement the method. + + + Nicko Cadell + Gert Driesen + + + + Protected constructor to support subclasses + + + + Initializes a new instance of the class + with no location info. + + + + + + Protected constructor to support subclasses + + + + The parameter determines whether + location information will be output by the layout. If + is set to true, then the + file name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string. + + The event being logged. + The TextWriter to write the formatted event to + + + Format the and write it to the . + + + This method creates an that writes to the + . The is passed + to the method. Subclasses should override the + method rather than this method. + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Subclasses should override this method to format + the as XML. + + + + + + Flag to indicate if location information should be included in + the XML events. + + + + + The string to replace invalid chars with + + + + + Gets a value indicating whether to include location information in + the XML events. + + + true if location information should be included in the XML + events; otherwise, false. + + + + If is set to true, then the file + name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + The string to replace characters that can not be expressed in XML with. + + + Not all characters may be expressed in XML. This property contains the + string to replace those that can not with. This defaults to a ?. Set it + to the empty string to simply remove offending characters. For more + details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets + Character replacement will occur in the log message, the property names + and the property values. + + + + + + + Gets the content type output by this layout. + + + As this is the XML layout, the value is always "text/xml". + + + + As this is the XML layout, the value is always "text/xml". + + + + + + Constructs an XmlLayout + + + + + Constructs an XmlLayout. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SmtpAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Builds a cache of the element names + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Override the base class method + to write the to the . + + + + + + The prefix to use for all generated element names + + + + + The prefix to use for all element names + + + + The default prefix is log4net. Set this property + to change the prefix. If the prefix is set to an empty string + then no prefix will be written. + + + + + + Set whether or not to base64 encode the message. + + + + By default the log message will be written as text to the xml + output. This can cause problems when the message contains binary + data. By setting this to true the contents of the message will be + base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the log message. + + + + + + Set whether or not to base64 encode the property values. + + + + By default the properties will be written as text to the xml + output. This can cause problems when one or more properties contain + binary data. By setting this to true the values of the properties + will be base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the property values. + + + + + + Layout that formats the log events as XML elements compatible with the log4j schema + + + + Formats the log events according to the http://logging.apache.org/log4j schema. + + + Nicko Cadell + + + + The 1st of January 1970 in UTC + + + + + Constructs an XMLLayoutSchemaLog4j + + + + + Constructs an XMLLayoutSchemaLog4j. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Actually do the writing of the xml + + the writer to use + the event to write + + + Generate XML that is compatible with the log4j schema. + + + + + + The version of the log4j schema to use. + + + + Only version 1.2 of the log4j schema is supported. + + + + + + The default object Renderer. + + + + The default renderer supports rendering objects and collections to strings. + + + See the method for details of the output. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface in order to render objects as strings + + + + Certain types require special case conversion to + string form. This conversion is done by an object renderer. + Object renderers implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a + string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + + + + Default constructor + + + + Default constructor + + + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + The default renderer supports rendering objects to strings as follows: + + + + Value + Rendered String + + + null + + "(null)" + + + + + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + , & + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: {a, b, c}. + + + All collection classes that implement its subclasses, + or generic equivalents all implement the interface. + + + + + + + + Rendered as the key, an equals sign ('='), and the value (using the appropriate + renderer). + + + For example: key=value. + + + + + other + + Object.ToString() + + + + + + + + Render the array argument into a string + + The map used to lookup renderers + the array to render + The writer to render to + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + + Render the enumerator argument into a string + + The map used to lookup renderers + the enumerator to render + The writer to render to + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + {a, b, c}. + + + + + + Render the DictionaryEntry argument into a string + + The map used to lookup renderers + the DictionaryEntry to render + The writer to render to + + + Render the key, an equals sign ('='), and the value (using the appropriate + renderer). For example: key=value. + + + + + + Map class objects to an . + + + + Maintains a mapping between types that require special + rendering and the that + is used to render them. + + + The method is used to render an + object using the appropriate renderers defined in this map. + + + Nicko Cadell + Gert Driesen + + + + Default Constructor + + + + Default constructor. + + + + + + Render using the appropriate renderer. + + the object to render to a string + the object rendered as a string + + + This is a convenience method used to render an object to a string. + The alternative method + should be used when streaming output to a . + + + + + + Render using the appropriate renderer. + + the object to render to a string + The writer to render to + + + Find the appropriate renderer for the type of the + parameter. This is accomplished by calling the + method. Once a renderer is found, it is + applied on the object and the result is returned + as a . + + + + + + Gets the renderer for the specified object type + + the object to lookup the renderer for + the renderer for + + + Gets the renderer for the specified object type. + + + Syntactic sugar method that calls + with the type of the object parameter. + + + + + + Gets the renderer for the specified type + + the type to lookup the renderer for + the renderer for the specified type + + + Returns the renderer for the specified type. + If no specific renderer has been defined the + will be returned. + + + + + + Internal function to recursively search interfaces + + the type to lookup the renderer for + the renderer for the specified type + + + + Clear the map of renderers + + + + Clear the custom renderers defined by using + . The + cannot be removed. + + + + + + Register an for . + + the type that will be rendered by + the renderer for + + + Register an object renderer for a specific source type. + This renderer will be returned from a call to + specifying the same as an argument. + + + + + + Get the default renderer instance + + the default renderer + + + Get the default renderer + + + + + + Interface implemented by logger repository plugins. + + + + Plugins define additional behavior that can be associated + with a . + The held by the + property is used to store the plugins for a repository. + + + The log4net.Config.PluginAttribute can be used to + attach plugins to repositories created using configuration + attributes. + + + Nicko Cadell + Gert Driesen + + + + Attaches the plugin to the specified . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + Gets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a PluginCollection instance. + + list to create a readonly wrapper arround + + A PluginCollection wrapper that is read-only. + + + + + Initializes a new instance of the PluginCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the PluginCollection class + that has the specified initial capacity. + + + The number of elements that the new PluginCollection is initially capable of storing. + + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified PluginCollection. + + The PluginCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire PluginCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire PluginCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the PluginCollection. + + The to be added to the end of the PluginCollection. + The index at which the value has been added. + + + + Removes all elements from the PluginCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the PluginCollection. + + The to check for. + true if is found in the PluginCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the PluginCollection. + + The to locate in the PluginCollection. + + The zero-based index of the first occurrence of + in the entire PluginCollection, if found; otherwise, -1. + + + + + Inserts an element into the PluginCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the PluginCollection. + + The to remove from the PluginCollection. + + The specified was not found in the PluginCollection. + + + + + Removes the element at the specified index of the PluginCollection. + + The zero-based index of the element to remove. + + is less than zero. + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the PluginCollection. + + An for the entire PluginCollection. + + + + Adds the elements of another PluginCollection to the current PluginCollection. + + The PluginCollection whose elements should be added to the end of the current PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a array to the current PluginCollection. + + The array whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a collection to the current PluginCollection. + + The collection whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the PluginCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + false, because the backing type is an array, which is never thread-safe. + + + + Gets an object that can be used to synchronize access to the collection. + + + An object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + + The at the specified index. + + The zero-based index of the element to get or set. + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false. + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false. + + + + Gets or sets the number of elements the PluginCollection can contain. + + + The number of elements the PluginCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + The current element in the collection. + + + + + + + + Map of repository plugins. + + + + This class is a name keyed map of the plugins that are + attached to a repository. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The repository that the plugins should be attached to. + + + Initialize a new instance of the class with a + repository that the plugins should be attached to. + + + + + + Adds a to the map. + + The to add to the map. + + + The will be attached to the repository when added. + + + If there already exists a plugin with the same name + attached to the repository then the old plugin will + be and replaced with + the new plugin. + + + + + + Removes a from the map. + + The to remove from the map. + + + Remove a specific plugin from this map. + + + + + + Gets a by name. + + The name of the to lookup. + + The from the map with the name specified, or + null if no plugin is found. + + + + Lookup a plugin by name. If the plugin is not found null + will be returned. + + + + + + Gets all possible plugins as a list of objects. + + All possible plugins as a list of objects. + + + Get a collection of all the plugins defined in this map. + + + + + + Base implementation of + + + + Default abstract implementation of the + interface. This base class can be used by implementors + of the interface. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + the name of the plugin + + Initializes a new Plugin with the specified name. + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + The name of this plugin. + + + + + The repository this plugin is attached to. + + + + + Gets or sets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + The name of the plugin must not change one the + plugin has been attached to a repository. + + + + + + The repository for this plugin + + + The that this plugin is attached to. + + + + Gets or sets the that this plugin is + attached to. + + + + + + Plugin that listens for events from the + + + + This plugin publishes an instance of + on a specified . This listens for logging events delivered from + a remote . + + + When an event is received it is relogged within the attached repository + as if it had been raised locally. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + The property must be set. + + + + + + Construct with sink Uri. + + The name to publish the sink under in the remoting infrastructure. + See for more details. + + + Initializes a new instance of the class + with specified name. + + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + When the plugin is shutdown the remote logging + sink is disconnected. + + + + + + The fully qualified type of the RemoteLoggingServerPlugin class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the URI of this sink. + + + The URI of this sink. + + + + This is the name under which the object is marshaled. + + + + + + + Delivers objects to a remote sink. + + + + Internal class used to listen for logging events + and deliver them to the local repository. + + + + + + Constructor + + The repository to log to. + + + Initializes a new instance of the for the + specified . + + + + + + Logs the events to the repository. + + The events to log. + + + The events passed are logged to the + + + + + + Obtains a lifetime service object to control the lifetime + policy for this instance. + + null to indicate that this instance should live forever. + + + Obtains a lifetime service object to control the lifetime + policy for this instance. This object should live forever + therefore this implementation returns null. + + + + + + The underlying that events should + be logged to. + + + + + Default implementation of + + + + This default implementation of the + interface is used to create the default subclass + of the object. + + + Nicko Cadell + Gert Driesen + + + + Interface abstracts creation of instances + + + + This interface is used by the to + create new objects. + + + The method is called + to create a named . + + + Implement this interface to create new subclasses of . + + + Nicko Cadell + Gert Driesen + + + + Create a new instance + + The that will own the . + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Create a new instance + + The that will own the . + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default internal subclass of + + + + This subclass has no additional behavior over the + class but does allow instances + to be created. + + + + + + Implementation of used by + + + + Internal class used to provide implementation of + interface. Applications should use to get + logger instances. + + + This is one of the central classes in the log4net implementation. One of the + distinctive features of log4net are hierarchical loggers and their + evaluation. The organizes the + instances into a rooted tree hierarchy. + + + The class is abstract. Only concrete subclasses of + can be created. The + is used to create instances of this type for the . + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + + + + This constructor created a new instance and + sets its name. + + The name of the . + + + This constructor is protected and designed to be used by + a subclass that is not abstract. + + + Loggers are constructed by + objects. See for the default + logger creator. + + + + + + Add to the list of appenders of this + Logger instance. + + An appender to add to this logger + + + Add to the list of appenders of this + Logger instance. + + + If is already in the list of + appenders, then it won't be added again. + + + + + + Look for the appender named as name + + The name of the appender to lookup + The appender with the name specified, or null. + + + Returns the named appender, or null if the appender is not found. + + + + + + Remove all previously added appenders from this Logger instance. + + + + Remove all previously added appenders from this Logger instance. + + + This is useful when re-reading configuration information. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The appender to remove + The appender removed from the list + + + Remove the appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The name of the appender to remove + The appender removed from the list + + + Remove the named appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the and . + + + This method must not throw any exception to the caller. + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + This method must not throw any exception to the caller. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + This method must not throw any exception to the caller. + + + + + + Deliver the to the attached appenders. + + The event to log. + + + Call the appenders in the hierarchy starting at + this. If no appenders could be found, emit a + warning. + + + This method calls all the appenders inherited from the + hierarchy circumventing any evaluation of whether to log or not + to log the particular log request. + + + + + + Closes all attached appenders implementing the interface. + + + + Used to ensure that the appenders are correctly shutdown. + + + + + + This is the most generic printing method. This generic form is intended to be used by wrappers + + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the . + + + + + + Creates a new logging event and logs the event without further checks. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generates a logging event and delivers it to the attached + appenders. + + + + + + Creates a new logging event and logs the event without further checks. + + The event being logged. + + + Delivers the logging event to the attached appenders. + + + + + + The fully qualified type of the Logger class. + + + + + The name of this logger. + + + + + The assigned level of this logger. + + + + The level variable need not be + assigned a value in which case it is inherited + form the hierarchy. + + + + + + The parent of this logger. + + + + The parent of this logger. + All loggers have at least one ancestor which is the root logger. + + + + + + Loggers need to know what Hierarchy they are in. + + + + Loggers need to know what Hierarchy they are in. + The hierarchy that this logger is a member of is stored + here. + + + + + + Helper implementation of the interface + + + + + Flag indicating if child loggers inherit their parents appenders + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl + + + + + Gets or sets the parent logger in the hierarchy. + + + The parent logger in the hierarchy. + + + + Part of the Composite pattern that makes the hierarchy. + The hierarchy is parent linked rather than child linked. + + + + + + Gets or sets a value indicating if child loggers inherit their parent's appenders. + + + true if child loggers inherit their parent's appenders. + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Gets the effective level for this logger. + + The nearest level in the logger hierarchy. + + + Starting from this logger, searches the logger hierarchy for a + non-null level and returns it. Otherwise, returns the level of the + root logger. + + The Logger class is designed so that this method executes as + quickly as possible. + + + + + Gets or sets the where this + Logger instance is attached to. + + The hierarchy that this logger belongs to. + + + This logger must be attached to a single . + + + + + + Gets or sets the assigned , if any, for this Logger. + + + The of this logger. + + + + The assigned can be null. + + + + + + Get the appenders contained in this logger as an + . + + A collection of the appenders in this logger + + + Get the appenders contained in this logger as an + . If no appenders + can be found, then a is returned. + + + + + + Gets the logger name. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Construct a new Logger + + the name of the logger + + + Initializes a new instance of the class + with the specified name. + + + + + + Delegate used to handle logger creation event notifications. + + The in which the has been created. + The event args that hold the instance that has been created. + + + Delegate used to handle logger creation event notifications. + + + + + + Provides data for the event. + + + + A event is raised every time a + is created. + + + + + + The created + + + + + Constructor + + The that has been created. + + + Initializes a new instance of the event argument + class,with the specified . + + + + + + Gets the that has been created. + + + The that has been created. + + + + The that has been created. + + + + + + Hierarchical organization of loggers + + + + The casual user should not have to deal with this class + directly. + + + This class is specialized in retrieving loggers by name and + also maintaining the logger hierarchy. Implements the + interface. + + + The structure of the logger hierarchy is maintained by the + method. The hierarchy is such that children + link to their parent but parents do not have any references to their + children. Moreover, loggers can be instantiated in any order, in + particular descendant before ancestor. + + + In case a descendant is created before a particular ancestor, + then it creates a provision node for the ancestor and adds itself + to the provision node. Other descendants of the same ancestor add + themselves to the previously created provision node. + + + Nicko Cadell + Gert Driesen + + + + Base implementation of + + + + Default abstract implementation of the interface. + + + Skeleton implementation of the interface. + All types can extend this type. + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by logger repositories. + + + + This interface is implemented by logger repositories. e.g. + . + + + This interface is used by the + to obtain interfaces. + + + Nicko Cadell + Gert Driesen + + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + The name of the logger to lookup + The Logger object with the name specified + + + If the names logger exists it is returned, otherwise + null is returned. + + + + + + Returns all the currently defined loggers as an Array. + + All the defined loggers + + + Returns all the currently defined loggers as an Array. + + + + + + Returns a named logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Returns a named logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + Shutdown the repository + + + Shutting down a repository will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + The name of the repository + + + The name of the repository + + + + The name of the repository. + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Collection of internal messages captured during the most + recent configuration process. + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + + These properties can be specified on a repository specific basis. + + + + + + Default Constructor + + + + Initializes the repository with default (empty) properties. + + + + + + Construct the repository using specific properties + + the properties to set for this repository + + + Initializes the repository with specified properties. + + + + + + Test if logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the repository + + All the defined loggers + + + Returns all the currently defined loggers in the repository as an Array. + + + + + + Return a new logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Return a new logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + + Shutdown the repository + + + + Shutdown the repository. Can be overridden in a subclass. + This base class implementation notifies the + listeners and all attached plugins of the shutdown event. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + The fully qualified type of the LoggerRepositorySkeleton class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Adds an object renderer for a specific class. + + The type that will be rendered by the renderer supplied. + The object renderer used to render the object. + + + Adds an object renderer for a specific class. + + + + + + Notify the registered listeners that the repository is shutting down + + Empty EventArgs + + + Notify any listeners that this repository is shutting down. + + + + + + Notify the registered listeners that the repository has had its configuration reset + + Empty EventArgs + + + Notify any listeners that this repository's configuration has been reset. + + + + + + Notify the registered listeners that the repository has had its configuration changed + + Empty EventArgs + + + Notify any listeners that this repository's configuration has changed. + + + + + + Raise a configuration changed event on this repository + + EventArgs.Empty + + + Applications that programmatically change the configuration of the repository should + raise this event notification to notify listeners. + + + + + + Flushes all configured Appenders that implement . + + The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed, + or to wait indefinitely. + True if all logging events were flushed successfully, else false. + + + + The name of the repository + + + The string name of the repository + + + + The name of this repository. The name is + used to store and lookup the repositories + stored by the . + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Contains a list of internal messages captures during the + last configuration. + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + These properties can be specified on a repository specific basis + + + + + Basic Configurator interface for repositories + + + + Interface used by basic configurator to configure a + with a default . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified appender + + the appender to use to log all logging events + + + Configure the repository to route all logging events to the + specified appender. + + + + + + Initialize the repository using the specified appenders + + the appenders to use to log all logging events + + + Configure the repository to route all logging events to the + specified appenders. + + + + + + Configure repository using XML + + + + Interface used by Xml configurator to configure a . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified config + + the element containing the root of the config + + + The schema for the XML configuration data is defined by + the implementation. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Construct with properties + + The properties to pass to this repository. + + + Initializes a new instance of the class. + + + + + + Construct with a logger factory + + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Construct with properties and a logger factory + + The properties to pass to this repository. + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Test if a logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the hierarchy. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the hierarchy as an Array + + All the defined loggers + + + Returns all the currently defined loggers in the hierarchy as an Array. + The root logger is not included in the returned + enumeration. + + + + + + Return a new logger instance named as the first parameter using + the default factory. + + + + Return a new logger instance named as the first parameter using + the default factory. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + The name of the logger to retrieve + The logger object with the name specified + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The Shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset all values contained in this hierarchy instance to their default. + + + + Reset all values contained in this hierarchy instance to their + default. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this hierarchy. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are currently configured + + An array containing all the currently configured appenders + + + Returns all the instances that are currently configured. + All the loggers are searched for appenders. The appenders may also be containers + for appenders and these are also searched for additional loggers. + + + The list returned is unordered but does not contain duplicates. + + + + + + Collect the appenders from an . + The appender may also be a container. + + + + + + + Collect the appenders from an container + + + + + + + Initialize the log4net system using the specified appender + + the appender to use to log all logging events + + + + Initialize the log4net system using the specified appenders + + the appenders to use to log all logging events + + + + Initialize the log4net system using the specified appenders + + the appenders to use to log all logging events + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Test if this hierarchy is disabled for the specified . + + The level to check against. + + true if the repository is disabled for the level argument, false otherwise. + + + + If this hierarchy has not been configured then this method will + always return true. + + + This method will return true if this repository is + disabled for level object passed as parameter and + false otherwise. + + + See also the property. + + + + + + Clear all logger definitions from the internal hashtable + + + + This call will clear all logger definitions from the internal + hashtable. Invoking this method will irrevocably mess up the + logger hierarchy. + + + You should really know what you are doing before + invoking this method. + + + + + + Return a new logger instance named as the first parameter using + . + + The name of the logger to retrieve + The factory that will make the new logger instance + The logger object with the name specified + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated by the + parameter and linked with its existing + ancestors as well as children. + + + + + + Sends a logger creation event to all registered listeners + + The newly created logger + + Raises the logger creation event. + + + + + Updates all the parents of the specified logger + + The logger to update the parents for + + + This method loops through all the potential parents of + . There 3 possible cases: + + + + No entry for the potential parent of exists + + We create a ProvisionNode for this potential + parent and insert in that provision node. + + + + The entry is of type Logger for the potential parent. + + The entry is 's nearest existing parent. We + update 's parent field with this entry. We also break from + he loop because updating our parent's parent is our parent's + responsibility. + + + + The entry is of type ProvisionNode for this potential parent. + + We add to the list of children for this + potential parent. + + + + + + + + Replace a with a in the hierarchy. + + + + + + We update the links for all the children that placed themselves + in the provision node 'pn'. The second argument 'log' is a + reference for the newly created Logger, parent of all the + children in 'pn'. + + + We loop on all the children 'c' in 'pn'. + + + If the child 'c' has been already linked to a child of + 'log' then there is no need to update 'c'. + + + Otherwise, we set log's parent field to c's parent and set + c's parent field to log. + + + + + + Define or redefine a Level using the values in the argument + + the level values + + + Define or redefine a Level using the values in the argument + + + Supports setting levels via the configuration file. + + + + + + Set a Property using the values in the argument + + the property value + + + Set a Property using the values in the argument. + + + Supports setting property values via the configuration file. + + + + + + The fully qualified type of the Hierarchy class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Event used to notify that a logger has been created. + + + + Event raised when a logger is created. + + + + + + Has no appender warning been emitted + + + + Flag to indicate if we have already issued a warning + about not having an appender warning. + + + + + + Get the root of this hierarchy + + + + Get the root of this hierarchy. + + + + + + Gets or sets the default instance. + + The default + + + The logger factory is used to create logger instances. + + + + + + A class to hold the value, name and display name for a level + + + + A class to hold the value, name and display name for a level + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Value of the level + + + + If the value is not set (defaults to -1) the value will be looked + up for the current level with the same name. + + + + + + Name of the level + + + The name of the level + + + + The name of the level. + + + + + + Display name for the level + + + The display name of the level + + + + The display name of the level. + + + + + + Used internally to accelerate hash table searches. + + + + Internal class used to improve performance of + string keyed hashtables. + + + The hashcode of the string is cached for reuse. + The string is stored as an interned value. + When comparing two objects for equality + the reference equality of the interned strings is compared. + + + Nicko Cadell + Gert Driesen + + + + Construct key with string name + + + + Initializes a new instance of the class + with the specified name. + + + Stores the hashcode of the string and interns + the string key to optimize comparisons. + + + The Compact Framework 1.0 the + method does not work. On the Compact Framework + the string keys are not interned nor are they + compared by reference. + + + The name of the logger. + + + + Returns a hash code for the current instance. + + A hash code for the current instance. + + + Returns the cached hashcode. + + + + + + Determines whether two instances + are equal. + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + + Compares the references of the interned strings. + + + + + + Provision nodes are used where no logger instance has been specified + + + + instances are used in the + when there is no specified + for that node. + + + A provision node holds a list of child loggers on behalf of + a logger that does not exist. + + + Nicko Cadell + Gert Driesen + + + + Create a new provision node with child node + + A child logger to add to this node. + + + Initializes a new instance of the class + with the specified child logger. + + + + + + The sits at the root of the logger hierarchy tree. + + + + The is a regular except + that it provides several guarantees. + + + First, it cannot be assigned a null + level. Second, since the root logger cannot have a parent, the + property always returns the value of the + level field without walking the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Construct a + + The level to assign to the root logger. + + + Initializes a new instance of the class with + the specified logging level. + + + The root logger names itself as "root". However, the root + logger cannot be retrieved by name. + + + + + + The fully qualified type of the RootLogger class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the assigned level value without walking the logger hierarchy. + + The assigned level value without walking the logger hierarchy. + + + Because the root logger cannot have a parent and its level + must not be null this property just returns the + value of . + + + + + + Gets or sets the assigned for the root logger. + + + The of the root logger. + + + + Setting the level of the root logger to a null reference + may have catastrophic results. We prevent this here. + + + + + + Initializes the log4net environment using an XML DOM. + + + + Configures a using an XML DOM. + + + Nicko Cadell + Gert Driesen + + + + Construct the configurator for a hierarchy + + The hierarchy to build. + + + Initializes a new instance of the class + with the specified . + + + + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + The root element to parse. + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + + + + + Parse appenders by IDREF. + + The appender ref element. + The instance of the appender that the ref refers to. + + + Parse an XML element that represents an appender and return + the appender. + + + + + + Parses an appender element. + + The appender element. + The appender instance or null when parsing failed. + + + Parse an XML element that represents an appender and return + the appender instance. + + + + + + Parses a logger element. + + The logger element. + + + Parse an XML element that represents a logger. + + + + + + Parses the root logger element. + + The root element. + + + Parse an XML element that represents the root logger. + + + + + + Parses the children of a logger element. + + The category element. + The logger instance. + Flag to indicate if the logger is the root logger. + + + Parse the child elements of a <logger> element. + + + + + + Parses an object renderer. + + The renderer element. + + + Parse an XML element that represents a renderer. + + + + + + Parses a level element. + + The level element. + The logger object to set the level on. + Flag to indicate if the logger is the root logger. + + + Parse an XML element that represents a level. + + + + + + Sets a parameter on an object. + + The parameter element. + The object to set the parameter on. + + The parameter name must correspond to a writable property + on the object. The value of the parameter is a string, + therefore this function will attempt to set a string + property first. If unable to set a string property it + will inspect the property and its argument type. It will + attempt to call a static method called Parse on the + type of the property. This method will take a single + string argument and return a value that can be used to + set the property. + + + + + Test if an element has no attributes or child elements + + the element to inspect + true if the element has any attributes or child elements, false otherwise + + + + Test if a is constructible with Activator.CreateInstance. + + the type to inspect + true if the type is creatable using a default constructor, false otherwise + + + + Look for a method on the that matches the supplied + + the type that has the method + the name of the method + the method info found + + + The method must be a public instance method on the . + The method must be named or "Add" followed by . + The method must take a single parameter. + + + + + + Converts a string value to a target type. + + The type of object to convert the string to. + The string value to use as the value of the object. + + + An object of type with value or + null when the conversion could not be performed. + + + + + + Creates an object as specified in XML. + + The XML element that contains the definition of the object. + The object type to use if not explicitly specified. + The type that the returned object must be or must inherit from. + The object or null + + + Parse an XML element and create an object instance based on the configuration + data. + + + The type of the instance may be specified in the XML. If not + specified then the is used + as the type. However the type is specified it must support the + type. + + + + + + key: appenderName, value: appender. + + + + + The Hierarchy being configured. + + + + + The fully qualified type of the XmlHierarchyConfigurator class. + + + Used by the internal logger to record the Type of the + log message. + + + + + + + + + + + + + + + + + + + + + Delegate used to handle logger repository shutdown event notifications + + The that is shutting down. + Empty event args + + + Delegate used to handle logger repository shutdown event notifications. + + + + + + Delegate used to handle logger repository configuration reset event notifications + + The that has had its configuration reset. + Empty event args + + + Delegate used to handle logger repository configuration reset event notifications. + + + + + + Delegate used to handle event notifications for logger repository configuration changes. + + The that has had its configuration changed. + Empty event arguments. + + + Delegate used to handle event notifications for logger repository configuration changes. + + + + + + Write the name of the current AppDomain to the output + + + + Write the name of the current AppDomain to the output writer + + + Nicko Cadell + + + + Write the name of the current AppDomain to the output + + the writer to write to + null, state is not set + + + Writes name of the current AppDomain to the output . + + + + + + AppSetting pattern converter + + + + This pattern converter reads appSettings from the application configuration file. + + + If the is specified then that will be used to + lookup a single appSettings value. If no is specified + then all appSettings will be dumped as a list of key value pairs. + + + A typical use is to specify a base directory for log files, e.g. + + + + + ... + + + ]]> + + + + + + + Write the property value to the output + + that will receive the formatted result. + null, state is not set + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + Write the current date to the output + + + + Date pattern converter, uses a to format + the current date and time to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The date and time is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current date to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date and time passed is in the local time zone. + + + + + + The fully qualified type of the DatePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write an folder path to the output + + + + Write an special path environment folder path to the output writer. + The value of the determines + the name of the variable to output. + should be a value in the enumeration. + + + Ron Grabowski + + + + Write an special path environment folder path to the output + + the writer to write to + null, state is not set + + + Writes the special path environment folder path to the output . + The name of the special path environment folder path to output must be set + using the + property. + + + + + + The fully qualified type of the EnvironmentFolderPathPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write an environment variable to the output + + + + Write an environment variable to the output writer. + The value of the determines + the name of the variable to output. + + + Nicko Cadell + + + + Write an environment variable to the output + + the writer to write to + null, state is not set + + + Writes the environment variable to the output . + The name of the environment variable to output must be set + using the + property. + + + + + + The fully qualified type of the EnvironmentPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write the current thread identity to the output + + + + Write the current thread identity to the output writer + + + Nicko Cadell + + + + Write the current thread identity to the output + + the writer to write to + null, state is not set + + + Writes the current thread identity to the output . + + + + + + The fully qualified type of the IdentityPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Pattern converter for literal string instances in the pattern + + + + Writes the literal string value specified in the + property to + the output. + + + Nicko Cadell + + + + Set the next converter in the chain + + The next pattern converter in the chain + The next pattern converter + + + Special case the building of the pattern converter chain + for instances. Two adjacent + literals in the pattern can be represented by a single combined + pattern converter. This implementation detects when a + is added to the chain + after this converter and combines its value with this converter's + literal value. + + + + + + Write the literal to the output + + the writer to write to + null, not set + + + Override the formatting behavior to ignore the FormattingInfo + because we have a literal instead. + + + Writes the value of + to the output . + + + + + + Convert this pattern into the rendered message + + that will receive the formatted result. + null, not set + + + This method is not used. + + + + + + Writes a newline to the output + + + + Writes the system dependent line terminator to the output. + This behavior can be overridden by setting the : + + + + Option Value + Output + + + DOS + DOS or Windows line terminator "\r\n" + + + UNIX + UNIX line terminator "\n" + + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current process ID to the output + + + + Write the current process ID to the output writer + + + Nicko Cadell + + + + Write the current process ID to the output + + the writer to write to + null, state is not set + + + Write the current process ID to the output . + + + + + + The fully qualified type of the ProcessIdPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Property pattern converter + + + + This pattern converter reads the thread and global properties. + The thread properties take priority over global properties. + See for details of the + thread properties. See for + details of the global properties. + + + If the is specified then that will be used to + lookup a single property. If no is specified + then all properties will be dumped as a list of key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + null, state is not set + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + A Pattern converter that generates a string of random characters + + + + The converter generates a string of random characters. By default + the string is length 4. This can be changed by setting the + to the string value of the length required. + + + The random characters in the string are limited to uppercase letters + and numbers only. + + + The random number generator used by this class is not cryptographically secure. + + + Nicko Cadell + + + + Shared random number generator + + + + + Length of random string to generate. Default length 4. + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write a randoim string to the output + + the writer to write to + null, state is not set + + + Write a randoim string to the output . + + + + + + The fully qualified type of the RandomStringPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write the current threads username to the output + + + + Write the current threads username to the output writer + + + Nicko Cadell + + + + Write the current threads username to the output + + the writer to write to + null, state is not set + + + Write the current threads username to the output . + + + + + + The fully qualified type of the UserNamePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Write the UTC date time to the output + + + + Date pattern converter, uses a to format + the current date and time in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the current date and time to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date is in Universal time when it is rendered. + + + + + + + The fully qualified type of the UtcDatePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Type converter for Boolean. + + + + Supports conversion from string to bool type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Exception base type for conversion errors. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class + with the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + An instance of the . + + + Creates a new instance of the class. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + A nested exception to include. + An instance of the . + + + Creates a new instance of the class. + + + + + + Register of type converters for specific types. + + + + Maintains a registry of type converters used to convert between + types. + + + Use the and + methods to register new converters. + The and methods + lookup appropriate converters to use. + + + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + Initializes a new instance of the class. + + + + + Static constructor. + + + + This constructor defines the intrinsic type converters. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type converter to use to convert to the destination type. + + + Adds a converter instance for a specific type. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type of the type converter to use to convert to the destination type. + + + Adds a converter for a specific type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted from. + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Lookups the type converter to use as specified by the attributes on the + destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + + Creates the instance of the type converter. + + The type of the type converter. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + The type specified for the type converter must implement + the or interfaces + and must have a public default (no argument) constructor. + + + + + + The fully qualified type of the ConverterRegistry class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Mapping from to type converter. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an encoding + the encoding + + + Uses the method to + convert the argument to an . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Interface supported by type converters + + + + This interface supports conversion from a single type to arbitrary types. + See . + + + Nicko Cadell + + + + Returns whether this converter can convert the object to the specified type + + A Type that represents the type you want to convert to + true if the conversion is possible + + + Test if the type supported by this converter can be converted to the + . + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Converts the (which must be of the type supported + by this converter) to the specified.. + + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an IPAddress + the IPAddress + + + Uses the method to convert the + argument to an . + If that fails then the string is resolved as a DNS hostname. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternLayout + the PatternLayout + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Convert between string and + + + + Supports conversion from string to type, + and from a type to a string. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the target type be converted to the type supported by this object + + A that represents the type you want to convert to + true if the conversion is possible + + + Returns true if the is + assignable from a type. + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + . To check for this condition use the + method. + + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternString + the PatternString + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a Type + the Type + + + Uses the method to convert the + argument to a . + Additional effort is made to locate partially specified types + by searching the loaded assemblies. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Attribute used to associate a type converter + + + + Class and Interface level attribute that specifies a type converter + to use with the associated type. + + + To associate a type converter with a target type apply a + TypeConverterAttribute to the target type. Specify the + type of the type converter on the attribute. + + + Nicko Cadell + Gert Driesen + + + + The string type name of the type converter + + + + + Default constructor + + + + Default constructor + + + + + + Create a new type converter attribute for the specified type name + + The string type name of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + Create a new type converter attribute for the specified type + + The type of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + The string type name of the type converter + + + The string type name of the type converter + + + + The type specified must implement the + or the interfaces. + + + + + + A straightforward implementation of the interface. + + + + This is the default implementation of the + interface. Implementors of the interface + should aggregate an instance of this type. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Append on on all attached appenders. + + The event being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Append on on all attached appenders. + + The array of events being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Calls the DoAppende method on the with + the objects supplied. + + The appender + The events + + + If the supports the + interface then the will be passed + through using that interface. Otherwise the + objects in the array will be passed one at a time. + + + + + + Attaches an appender. + + The appender to add. + + + If the appender is already in the list it won't be added again. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Lookup an attached appender by name. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + List of appenders + + + + + Array of appenders, used to cache the m_appenderList + + + + + The fully qualified type of the AppenderAttachedImpl class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets all attached appenders. + + + A collection of attached appenders, or null if there + are no attached appenders. + + + + The read only collection of all currently attached appenders. + + + + + + This class aggregates several PropertiesDictionary collections together. + + + + Provides a dictionary style lookup over an ordered list of + collections. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Add a Properties Dictionary to this composite collection + + the properties to add + + + Properties dictionaries added first take precedence over dictionaries added + later. + + + + + + Flatten this composite collection into a single properties dictionary + + the flattened dictionary + + + Reduces the collection of ordered dictionaries to a single dictionary + containing the resultant values for the keys. + + + + + + Gets the value of a property + + + The value for the property with the specified key + + + + Looks up the value for the specified. + The collections are searched + in the order in which they were added to this collection. The value + returned is the value held by the first collection that contains + the specified key. + + + If none of the collections contain the specified key then + null is returned. + + + + + + Base class for Context Properties implementations + + + + This class defines a basic property get set accessor + + + Nicko Cadell + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Wrapper class used to map converter names to converter types + + + + Pattern converter info class used during configuration by custom + PatternString and PatternLayer converters. + + + + + + default constructor + + + + + + + + + + + Gets or sets the name of the conversion pattern + + + + The name of the pattern in the format string + + + + + + Gets or sets the type of the converter + + + + The value specified must extend the + type. + + + + + + + + + + + Subclass of that maintains a count of + the number of bytes written. + + + + This writer counts the number of bytes written. + + + Nicko Cadell + Gert Driesen + + + + that does not leak exceptions + + + + does not throw exceptions when things go wrong. + Instead, it delegates error handling to its . + + + Nicko Cadell + Gert Driesen + + + + Adapter that extends and forwards all + messages to an instance of . + + + + Adapter that extends and forwards all + messages to an instance of . + + + Nicko Cadell + + + + The writer to forward messages to + + + + + Create an instance of that forwards all + messages to a . + + The to forward to + + + Create an instance of that forwards all + messages to a . + + + + + + Closes the writer and releases any system resources associated with the writer + + + + + + + + + Dispose this writer + + flag indicating if we are being disposed + + + Dispose this writer + + + + + + Flushes any buffered output + + + + Clears all buffers for the writer and causes any buffered data to be written + to the underlying device + + + + + + Writes a character to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a character to the wrapped TextWriter + + + + + + Writes a character buffer to the wrapped TextWriter + + the data buffer + the start index + the number of characters to write + + + Writes a character buffer to the wrapped TextWriter + + + + + + Writes a string to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a string to the wrapped TextWriter + + + + + + Gets or sets the underlying . + + + The underlying . + + + + Gets or sets the underlying . + + + + + + The Encoding in which the output is written + + + The + + + + The Encoding in which the output is written + + + + + + Gets an object that controls formatting + + + The format provider + + + + Gets an object that controls formatting + + + + + + Gets or sets the line terminator string used by the TextWriter + + + The line terminator to use + + + + Gets or sets the line terminator string used by the TextWriter + + + + + + Constructor + + the writer to actually write to + the error handler to report error to + + + Create a new QuietTextWriter using a writer and error handler + + + + + + Writes a character to the underlying writer + + the char to write + + + Writes a character to the underlying writer + + + + + + Writes a buffer to the underlying writer + + the buffer to write + the start index to write from + the number of characters to write + + + Writes a buffer to the underlying writer + + + + + + Writes a string to the output. + + The string data to write to the output. + + + Writes a string to the output. + + + + + + Closes the underlying output writer. + + + + Closes the underlying output writer. + + + + + + The error handler instance to pass all errors to + + + + + Flag to indicate if this writer is closed + + + + + Gets or sets the error handler that all errors are passed to. + + + The error handler that all errors are passed to. + + + + Gets or sets the error handler that all errors are passed to. + + + + + + Gets a value indicating whether this writer is closed. + + + true if this writer is closed, otherwise false. + + + + Gets a value indicating whether this writer is closed. + + + + + + Constructor + + The to actually write to. + The to report errors to. + + + Creates a new instance of the class + with the specified and . + + + + + + Writes a character to the underlying writer and counts the number of bytes written. + + the char to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a buffer to the underlying writer and counts the number of bytes written. + + the buffer to write + the start index to write from + the number of characters to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a string to the output and counts the number of bytes written. + + The string data to write to the output. + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Total number of bytes written. + + + + + Gets or sets the total number of bytes written. + + + The total number of bytes written. + + + + Gets or sets the total number of bytes written. + + + + + + A fixed size rolling buffer of logging events. + + + + An array backed fixed size leaky bucket. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The maximum number of logging events in the buffer. + + + Initializes a new instance of the class with + the specified maximum number of buffered logging events. + + + The argument is not a positive integer. + + + + Appends a to the buffer. + + The event to append to the buffer. + The event discarded from the buffer, if the buffer is full, otherwise null. + + + Append an event to the buffer. If the buffer still contains free space then + null is returned. If the buffer is full then an event will be dropped + to make space for the new event, the event dropped is returned. + + + + + + Get and remove the oldest event in the buffer. + + The oldest logging event in the buffer + + + Gets the oldest (first) logging event in the buffer and removes it + from the buffer. + + + + + + Pops all the logging events from the buffer into an array. + + An array of all the logging events in the buffer. + + + Get all the events in the buffer and clear the buffer. + + + + + + Clear the buffer + + + + Clear the buffer of all events. The events in the buffer are lost. + + + + + + Gets the th oldest event currently in the buffer. + + The th oldest event currently in the buffer. + + + If is outside the range 0 to the number of events + currently in the buffer, then null is returned. + + + + + + Gets the maximum size of the buffer. + + The maximum size of the buffer. + + + Gets the maximum size of the buffer + + + + + + Gets the number of logging events in the buffer. + + The number of logging events in the buffer. + + + This number is guaranteed to be in the range 0 to + (inclusive). + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + The singleton instance of the empty collection. + + + + + Gets the singleton instance of the empty collection. + + The singleton instance of the empty collection. + + + Gets the singleton instance of the empty collection. + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the . + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Adds an element with the provided key and value to the + . + + The to use as the key of the element to add. + The to use as the value of the element to add. + + + As the collection is empty no new values can be added. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Removes all elements from the . + + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Determines whether the contains an element + with the specified key. + + The key to locate in the . + false + + + As the collection is empty the method always returns false. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Removes the element with the specified key from the . + + The key of the element to remove. + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + The singleton instance of the empty dictionary. + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + Gets a value indicating whether the has a fixed size. + + true + + + As the collection is empty always returns true. + + + + + + Gets a value indicating whether the is read-only. + + true + + + As the collection is empty always returns true. + + + + + + Gets an containing the keys of the . + + An containing the keys of the . + + + As the collection is empty a is returned. + + + + + + Gets an containing the values of the . + + An containing the values of the . + + + As the collection is empty a is returned. + + + + + + Gets or sets the element with the specified key. + + The key of the element to get or set. + null + + + As the collection is empty no values can be looked up or stored. + If the index getter is called then null is returned. + A is thrown if the setter is called. + + + This dictionary is always empty and cannot be modified. + + + + Contain the information obtained when parsing formatting modifiers + in conversion modifiers. + + + + Holds the formatting information extracted from the format string by + the . This is used by the + objects when rendering the output. + + + Nicko Cadell + Gert Driesen + + + + Defaut Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + + + Initializes a new instance of the class + with the specified parameters. + + + + + + Gets or sets the minimum value. + + + The minimum value. + + + + Gets or sets the minimum value. + + + + + + Gets or sets the maximum value. + + + The maximum value. + + + + Gets or sets the maximum value. + + + + + + Gets or sets a flag indicating whether left align is enabled + or not. + + + A flag indicating whether left align is enabled or not. + + + + Gets or sets a flag indicating whether left align is enabled or not. + + + + + + Implementation of Properties collection for the + + + + This class implements a properties collection that is thread safe and supports both + storing properties and capturing a read only copy of the current propertied. + + + This class is optimized to the scenario where the properties are read frequently + and are modified infrequently. + + + Nicko Cadell + + + + The read only copy of the properties. + + + + This variable is declared volatile to prevent the compiler and JIT from + reordering reads and writes of this thread performed on different threads. + + + + + + Lock object used to synchronize updates within this instance + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property from the global context + + the key for the entry to remove + + + Removing an entry from the global context properties is relatively expensive compared + with reading a value. + + + + + + Clear the global context properties + + + + + Get a readonly immutable copy of the properties + + the current global context properties + + + This implementation is fast because the GlobalContextProperties class + stores a readonly copy of the properties. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Reading the value for a key is faster than setting the value. + When the value is written a new read only copy of + the properties is created. + + + + + + The static class ILogExtensions contains a set of widely used + methods that ease the interaction with the ILog interface implementations. + + + + This class contains methods for logging at different levels and checks the + properties for determining if those logging levels are enabled in the current + configuration. + + + Simple example of logging messages + + using log4net.Util; + + ILog log = LogManager.GetLogger("application-log"); + + log.InfoExt("Application Start"); + log.DebugExt("This is a debug message"); + + + + + + The fully qualified type of the Logger class. + + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + + + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + + + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + + + This method first checks if this logger is WARN + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is WARN enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is WARN + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is WARN enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + + + This method first checks if this logger is ERROR + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is ERROR enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is ERROR + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is ERROR enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + + + This method first checks if this logger is FATAL + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is FATAL enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is FATAL + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is FATAL enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Manages a mapping from levels to + + + + Manages an ordered mapping from instances + to subclasses. + + + Nicko Cadell + + + + Default constructor + + + + Initialise a new instance of . + + + + + + Add a to this mapping + + the entry to add + + + If a has previously been added + for the same then that entry will be + overwritten. + + + + + + Lookup the mapping for the specified level + + the level to lookup + the for the level or null if no mapping found + + + Lookup the value for the specified level. Finds the nearest + mapping value for the level that is equal to or less than the + specified. + + + If no mapping could be found then null is returned. + + + + + + Initialize options + + + + Caches the sorted list of in an array + + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + This class stores its properties in a slot on the named + log4net.Util.LogicalThreadContextProperties. + + + For .NET Standard 1.3 this class uses + System.Threading.AsyncLocal rather than . + + + The requires a link time + for the + . + If the calling code does not have this permission then this context will be disabled. + It will not store any property values set on it. + + + Nicko Cadell + + + + Flag used to disable this context if we don't have permission to access the CallContext. + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove the value for the specified from the context. + + + + + + Clear all the context properties + + + + Clear all the context properties + + + + + + Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. + + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doings so. + + + + + + Gets the call context get data. + + The peroperties dictionary stored in the call context + + The method has a + security link demand, therfore we must put the method call in a seperate method + that we can wrap in an exception handler. + + + + + Sets the call context data. + + The properties. + + The method has a + security link demand, therfore we must put the method call in a seperate method + that we can wrap in an exception handler. + + + + + The fully qualified type of the LogicalThreadContextProperties class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Get or set the property value for the specified. + + + + + + Delegate type used for LogicalThreadContextStack's callbacks. + + + + + Implementation of Stack for the + + + + Implementation of Stack for the + + + Nicko Cadell + + + + The stack store. + + + + + The name of this within the + . + + + + + The callback used to let the register a + new instance of a . + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Clears all the contextual information held in this stack. + + + + Clears all the contextual information held in this stack. + Only call this if you think that this thread is being reused after + a previous call execution which may not have completed correctly. + You do not need to use this method if you always guarantee to call + the method of the + returned from even in exceptional circumstances, + for example by using the using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + syntax. + + + + + + Removes the top context from this stack. + + The message in the context that was removed from the top of this stack. + + + Remove the top context from this stack, and return + it to the caller. If this stack is empty then an + empty string (not ) is returned. + + + + + + Pushes a new context message into this stack. + + The new context message. + + An that can be used to clean up the context stack. + + + + Pushes a new context onto this stack. An + is returned that can be used to clean up this stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + { + log.Warn("This should have an ThreadContext Stack message"); + } + + + + + + Gets the current context information for this stack. + + The current context information. + + + + Gets the current context information for this stack. + + Gets the current context information + + + Gets the current context information for this stack. + + + + + + Get a portable version of this object + + the portable instance of this object + + + Get a cross thread portable version of this object + + + + + + The number of messages in the stack + + + The current number of messages in the stack + + + + The current number of messages in the stack. That is + the number of times has been called + minus the number of times has been called. + + + + + + Gets and sets the internal stack used by this + + The internal storage stack + + + This property is provided only to support backward compatability + of the . Tytpically the internal stack should not + be modified. + + + + + + Inner class used to represent a single context frame in the stack. + + + + Inner class used to represent a single context frame in the stack. + + + + + + Constructor + + The message for this context. + The parent context in the chain. + + + Initializes a new instance of the class + with the specified message and parent context. + + + + + + Get the message. + + The message. + + + Get the message. + + + + + + Gets the full text of the context down to the root level. + + + The full text of the context down to the root level. + + + + Gets the full text of the context down to the root level. + + + + + + Struct returned from the method. + + + + This struct implements the and is designed to be used + with the pattern to remove the stack frame at the end of the scope. + + + + + + The depth to trim the stack to when this instance is disposed + + + + + The outer LogicalThreadContextStack. + + + + + Constructor + + The internal stack used by the ThreadContextStack. + The depth to return the stack to when this object is disposed. + + + Initializes a new instance of the class with + the specified stack and return depth. + + + + + + Returns the stack to the correct depth. + + + + Returns the stack to the correct depth. + + + + + + Implementation of Stacks collection for the + + + + Implementation of Stacks collection for the + + + Nicko Cadell + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + The fully qualified type of the ThreadContextStacks class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the named thread context stack + + + The named stack + + + + Gets the named thread context stack + + + + + + + + + + + + + Outputs log statements from within the log4net assembly. + + + + Log4net components cannot make log4net logging calls. However, it is + sometimes useful for the user to learn about what log4net is + doing. + + + All log4net internal debug calls go to the standard output stream + whereas internal error messages are sent to the standard error output + stream. + + + Nicko Cadell + Gert Driesen + + + + Formats Prefix, Source, and Message in the same format as the value + sent to Console.Out and Trace.Write. + + + + + + Initializes a new instance of the class. + + + + + + + + + Static constructor that initializes logging by reading + settings from the application configuration file. + + + + The log4net.Internal.Debug application setting + controls internal debugging. This setting should be set + to true to enable debugging. + + + The log4net.Internal.Quiet application setting + suppresses all internal logging including error messages. + This setting should be set to true to enable message + suppression. + + + + + + Raises the LogReceived event when an internal messages is received. + + + + + + + + + Writes log4net internal debug messages to the + standard output stream. + + + The message to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal debug messages to the + standard output stream. + + The Type that generated this message. + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The Type that generated this message. + The message to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The Type that generated this message. + The message to log. + An exception to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The Type that generated this message. + The message to log. + + + All internal error messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The Type that generated this message. + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes output to the standard output stream. + + The message to log. + + + Writes to both Console.Out and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Writes output to the standard error stream. + + The message to log. + + + Writes to both Console.Error and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Default debug level + + + + + In quietMode not even errors generate any output. + + + + + The event raised when an internal message has been received. + + + + + The Type that generated the internal message. + + + + + The DateTime stamp of when the internal message was received. + + + + + The UTC DateTime stamp of when the internal message was received. + + + + + A string indicating the severity of the internal message. + + + "log4net: ", + "log4net:ERROR ", + "log4net:WARN " + + + + + The internal log message. + + + + + The Exception related to the message. + + + Optional. Will be null if no Exception was passed. + + + + + Gets or sets a value indicating whether log4net internal logging + is enabled or disabled. + + + true if log4net internal logging is enabled, otherwise + false. + + + + When set to true, internal debug level logging will be + displayed. + + + This value can be set by setting the application setting + log4net.Internal.Debug in the application configuration + file. + + + The default value is false, i.e. debugging is + disabled. + + + + + The following example enables internal debugging using the + application configuration file : + + + + + + + + + + + + + Gets or sets a value indicating whether log4net should generate no output + from internal logging, not even for errors. + + + true if log4net should generate no output at all from internal + logging, otherwise false. + + + + When set to true will cause internal logging at all levels to be + suppressed. This means that no warning or error reports will be logged. + This option overrides the setting and + disables all debug also. + + This value can be set by setting the application setting + log4net.Internal.Quiet in the application configuration file. + + + The default value is false, i.e. internal logging is not + disabled. + + + + The following example disables internal logging using the + application configuration file : + + + + + + + + + + + + + + + + + Test if LogLog.Debug is enabled for output. + + + true if Debug is enabled + + + + Test if LogLog.Debug is enabled for output. + + + + + + Test if LogLog.Warn is enabled for output. + + + true if Warn is enabled + + + + Test if LogLog.Warn is enabled for output. + + + + + + Test if LogLog.Error is enabled for output. + + + true if Error is enabled + + + + Test if LogLog.Error is enabled for output. + + + + + + Subscribes to the LogLog.LogReceived event and stores messages + to the supplied IList instance. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a native error code and message. + + + + Represents a Win32 platform native error. + + + Nicko Cadell + Gert Driesen + + + + Create an instance of the class with the specified + error number and message. + + The number of the native error. + The message of the native error. + + + Create an instance of the class with the specified + error number and message. + + + + + + Create a new instance of the class for the last Windows error. + + + An instance of the class for the last windows error. + + + + The message for the error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Create a new instance of the class. + + the error number for the native error + + An instance of the class for the specified + error number. + + + + The message for the specified error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Retrieves the message corresponding with a Win32 message identifier. + + Message identifier for the requested message. + + The message corresponding with the specified message identifier. + + + + The message will be searched for in system message-table resource(s) + using the native FormatMessage function. + + + + + + Return error information string + + error information string + + + Return error information string + + + + + + Formats a message string. + + Formatting options, and how to interpret the parameter. + Location of the message definition. + Message identifier for the requested message. + Language identifier for the requested message. + If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . + If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the maximum number of TCHARs that can be stored in the output buffer. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, this parameter specifies the minimum number of TCHARs to allocate for an output buffer. + Pointer to an array of values that are used as insert values in the formatted message. + + + The function requires a message definition as input. The message definition can come from a + buffer passed into the function. It can come from a message table resource in an + already-loaded module. Or the caller can ask the function to search the system's message + table resource(s) for the message definition. The function finds the message definition + in a message table resource based on a message identifier and a language identifier. + The function copies the formatted message text to an output buffer, processing any embedded + insert sequences if requested. + + + To prevent the usage of unsafe code, this stub does not support inserting values in the formatted message. + + + + + If the function succeeds, the return value is the number of TCHARs stored in the output + buffer, excluding the terminating null character. + + + If the function fails, the return value is zero. To get extended error information, + call . + + + + + + Gets the number of the native error. + + + The number of the native error. + + + + Gets the number of the native error. + + + + + + Gets the message of the native error. + + + The message of the native error. + + + + + Gets the message of the native error. + + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance. + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current key from the enumerator. + + + Throws an exception because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current value from the enumerator. + + The current value from the enumerator. + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current entry from the enumerator. + + + Throws an because the + never has a current entry. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Get the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + A SecurityContext used when a SecurityContext is not required + + + + The is a no-op implementation of the + base class. It is used where a + is required but one has not been provided. + + + Nicko Cadell + + + + Singleton instance of + + + + Singleton instance of + + + + + + Private constructor + + + + Private constructor for singleton pattern. + + + + + + Impersonate this SecurityContext + + State supplied by the caller + null + + + No impersonation is done and null is always returned. + + + + + + Implements log4net's default error handling policy which consists + of emitting a message for the first error in an appender and + ignoring all subsequent errors. + + + + The error message is processed using the LogLog sub-system by default. + + + This policy aims at protecting an otherwise working application + from being flooded with error messages when logging fails. + + + Nicko Cadell + Gert Driesen + Ron Grabowski + + + + Default Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + The prefix to use for each message. + + + Initializes a new instance of the class + with the specified prefix. + + + + + + Reset the error handler back to its initial disabled state. + + + + + Log an Error + + The error message. + The exception. + The internal error code. + + + Invokes if and only if this is the first error or the first error after has been called. + + + + + + Log the very first error + + The error message. + The exception. + The internal error code. + + + Sends the error information to 's Error method. + + + + + + Log an Error + + The error message. + The exception. + + + Invokes if and only if this is the first error or the first error after has been called. + + + + + + Log an error + + The error message. + + + Invokes if and only if this is the first error or the first error after has been called. + + + + + + The UTC date the error was recorded. + + + + + Flag to indicate if it is the first error + + + + + The message recorded during the first error. + + + + + The exception recorded during the first error. + + + + + The error code recorded during the first error. + + + + + String to prefix each message with + + + + + The fully qualified type of the OnlyOnceErrorHandler class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Is error logging enabled + + + + Is error logging enabled. Logging is only enabled for the + first error delivered to the . + + + + + + The date the first error that trigged this error handler occurred, or if it has not been triggered. + + + + + The UTC date the first error that trigged this error handler occured, or if it has not been triggered. + + + + + The message from the first error that trigged this error handler. + + + + + The exception from the first error that trigged this error handler. + + + May be . + + + + + The error code from the first error that trigged this error handler. + + + Defaults to + + + + + A convenience class to convert property values to specific types. + + + + Utility functions for converting types and parsing values. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Converts a string to a value. + + String to convert. + The default value. + The value of . + + + If is "true", then true is returned. + If is "false", then false is returned. + Otherwise, is returned. + + + + + + Parses a file size into a number. + + String to parse. + The default value. + The value of . + + + Parses a file size of the form: number[KB|MB|GB] into a + long value. It is scaled with the appropriate multiplier. + + + is returned when + cannot be converted to a value. + + + + + + Converts a string to an object. + + The target type to convert to. + The string to convert to an object. + + The object converted from a string or null when the + conversion failed. + + + + Converts a string to an object. Uses the converter registry to try + to convert the string value into the specified target type. + + + + + + Checks if there is an appropriate type conversion from the source type to the target type. + + The type to convert from. + The type to convert to. + true if there is a conversion from the source type to the target type. + + Checks if there is an appropriate type conversion from the source type to the target type. + + + + + + + Converts an object to the target type. + + The object to convert to the target type. + The type to convert to. + The converted object. + + + Converts an object to the target type. + + + + + + Instantiates an object given a class name. + + The fully qualified class name of the object to instantiate. + The class to which the new object should belong. + The object to return in case of non-fulfillment. + + An instance of the or + if the object could not be instantiated. + + + + Checks that the is a subclass of + . If that test fails or the object could + not be instantiated, then is returned. + + + + + + Performs variable substitution in string from the + values of keys found in . + + The string on which variable substitution is performed. + The dictionary to use to lookup variables. + The result of the substitutions. + + + The variable substitution delimiters are ${ and }. + + + For example, if props contains key=value, then the call + + + + string s = OptionConverter.SubstituteVariables("Value of key is ${key}."); + + + + will set the variable s to "Value of key is value.". + + + If no value could be found for the specified key, then substitution + defaults to an empty string. + + + For example, if system properties contains no value for the key + "nonExistentKey", then the call + + + + string s = OptionConverter.SubstituteVariables("Value of nonExistentKey is [${nonExistentKey}]"); + + + + will set s to "Value of nonExistentKey is []". + + + An Exception is thrown if contains a start + delimiter "${" which is not balanced by a stop delimiter "}". + + + + + + Converts the string representation of the name or numeric value of one or + more enumerated constants to an equivalent enumerated object. + + The type to convert to. + The enum string value. + If true, ignore case; otherwise, regard case. + An object of type whose value is represented by . + + + + The fully qualified type of the OptionConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Most of the work of the class + is delegated to the PatternParser class. + + + + The PatternParser processes a pattern string and + returns a chain of objects. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The pattern to parse. + + + Initializes a new instance of the class + with the specified pattern string. + + + + + + Parses the pattern into a chain of pattern converters. + + The head of a chain of pattern converters. + + + Parses the pattern into a chain of pattern converters. + + + + + + Build the unified cache of converters from the static and instance maps + + the list of all the converter names + + + Build the unified cache of converters from the static and instance maps + + + + + + Internal method to parse the specified pattern to find specified matches + + the pattern to parse + the converter names to match in the pattern + + + The matches param must be sorted such that longer strings come before shorter ones. + + + + + + Process a parsed literal + + the literal text + + + + Process a parsed converter pattern + + the name of the converter + the optional option for the converter + the formatting info for the converter + + + + Resets the internal state of the parser and adds the specified pattern converter + to the chain. + + The pattern converter to add. + + + + The first pattern converter in the chain + + + + + the last pattern converter in the chain + + + + + The pattern + + + + + Internal map of converter identifiers to converter types + + + + This map overrides the static s_globalRulesRegistry map. + + + + + + The fully qualified type of the PatternParser class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Get the converter registry used by this parser + + + The converter registry used by this parser + + + + Get the converter registry used by this parser + + + + + + Sort strings by length + + + + that orders strings by string length. + The longest strings are placed first + + + + + + This class implements a patterned string. + + + + This string has embedded patterns that are resolved and expanded + when the string is formatted. + + + This class functions similarly to the + in that it accepts a pattern and renders it to a string. Unlike the + however the PatternString + does not render the properties of a specific but + of the process in general. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + appdomain + + + Used to output the friendly name of the current AppDomain. + + + + + appsetting + + + Used to output the value of a specific appSetting key in the application + configuration file. + + + + + date + + + Used to output the current date and time in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + env + + + Used to output the a specific environment variable. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %env{COMPUTERNAME} would include the value + of the COMPUTERNAME environment variable. + + + The env pattern is not supported on the .NET Compact Framework. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern name offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + processid + + + Used to output the system process ID for the current process. + + + + + property + + + Used to output a specific context property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are stored in logging contexts. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + random + + + Used to output a random string of characters. The string is made up of + uppercase letters and numbers. By default the string is 4 characters long. + The length of the string can be specified within braces directly following the + pattern specifier, e.g. %random{8} would output an 8 character string. + + + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + % + + + The sequence %% outputs a single percent sign. + + + + + + Additional pattern converters may be registered with a specific + instance using or + . + + + See the for details on the + format modifiers supported by the patterns. + + + Nicko Cadell + + + + Internal map of converter identifiers to converter types. + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternString only + + + + + Initialize the global registry + + + + + Default constructor + + + + Initialize a new instance of + + + + + + Constructs a PatternString + + The pattern to use with this PatternString + + + Initialize a new instance of with the pattern specified. + + + + + + Initialize object options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create the used to parse the pattern + + the pattern to parse + The + + + Returns PatternParser used to parse the conversion string. Subclasses + may override this to return a subclass of PatternParser which recognize + custom conversion pattern name. + + + + + + Produces a formatted string as specified by the conversion pattern. + + The TextWriter to write the formatted event to + + + Format the pattern to the . + + + + + + Format the pattern as a string + + the pattern formatted as a string + + + Format the pattern to a string. + + + + + + Add a converter to this PatternString + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternString + + the name of the conversion pattern for this converter + the type of the converter + + + Add a converter to this PatternString + + + + + + Gets or sets the pattern formatting string + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + String keyed object map. + + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + String keyed object map that is read only. + + + + This collection is readonly and cannot be modified. + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + The Hashtable used to store the properties data + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Copy Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Deserialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Gets the key names. + + An array of all the keys. + + + Gets the key names. + + + + + + Test if the dictionary contains a specified key + + the key to look for + true if the dictionary contains the specified key + + + Test if the dictionary contains a specified key + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + Serializes this object into the provided. + + + + + + See + + + + + See + + + + + + See + + + + + + + Remove all properties from the properties collection + + + + + See + + + + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + The hashtable used to store the properties + + + The internal collection used to store the properties + + + + The hashtable used to store the properties + + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + The number of properties in this collection + + + + + See + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class + with serialized data. + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Because this class is sealed the serialization constructor is private. + + + + + + Remove the entry with the specified key from this dictionary + + the key for the entry to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + an enumerator + + + Returns a over the contest of this collection. + + + + + + See + + the key to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + the key to lookup in the collection + true if the collection contains the specified key + + + Test if this collection contains a specified key. + + + + + + Remove all properties from the properties collection + + + + Remove all properties from the properties collection + + + + + + See + + the key + the value to store for the key + + + Store a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + See + + + false + + + + This collection is modifiable. This property always + returns false. + + + + + + See + + + The value for the key specified. + + + + Get or set a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + A class to hold the key and data for a property set in the config file + + + + A class to hold the key and data for a property set in the config file + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Property Key + + + Property Key + + + + Property Key. + + + + + + Property Value + + + Property Value + + + + Property Value. + + + + + + A that ignores the message + + + + This writer is used in special cases where it is necessary + to protect a writer from being closed by a client. + + + Nicko Cadell + + + + Constructor + + the writer to actually write to + + + Create a new ProtectCloseTextWriter using a writer + + + + + + Attach this instance to a different underlying + + the writer to attach to + + + Attach this instance to a different underlying + + + + + + Does not close the underlying output writer. + + + + Does not close the underlying output writer. + This method does nothing. + + + + + + Defines a lock that supports single writers and multiple readers + + + + ReaderWriterLock is used to synchronize access to a resource. + At any given time, it allows either concurrent read access for + multiple threads, or write access for a single thread. In a + situation where a resource is changed infrequently, a + ReaderWriterLock provides better throughput than a simple + one-at-a-time lock, such as . + + + If a platform does not support a System.Threading.ReaderWriterLock + implementation then all readers and writers are serialized. Therefore + the caller must not rely on multiple simultaneous readers. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Acquires a reader lock + + + + blocks if a different thread has the writer + lock, or if at least one thread is waiting for the writer lock. + + + + + + Decrements the lock count + + + + decrements the lock count. When the count + reaches zero, the lock is released. + + + + + + Acquires the writer lock + + + + This method blocks if another thread has a reader lock or writer lock. + + + + + + Decrements the lock count on the writer lock + + + + ReleaseWriterLock decrements the writer lock count. + When the count reaches zero, the writer lock is released. + + + + + + A that can be and reused + + + + A that can be and reused. + This uses a single buffer for string operations. + + + Nicko Cadell + + + + Create an instance of + + the format provider to use + + + Create an instance of + + + + + + Override Dispose to prevent closing of writer + + flag + + + Override Dispose to prevent closing of writer + + + + + + Reset this string writer so that it can be reused. + + the maximum buffer capacity before it is trimmed + the default size to make the buffer + + + Reset this string writer so that it can be reused. + The internal buffers are cleared and reset. + + + + + + Utility class for system specific information. + + + + Utility class of static methods for system specific information. + + + Nicko Cadell + Gert Driesen + Alexey Solofnenko + + + + Private constructor to prevent instances. + + + + Only static methods are exposed from this type. + + + + + + Initialize default values for private static fields. + + + + Only static methods are exposed from this type. + + + + + + Gets the assembly location path for the specified assembly. + + The assembly to get the location for. + The location of the assembly. + + + This method does not guarantee to return the correct path + to the assembly. If only tries to give an indication as to + where the assembly was loaded from. + + + + + + Gets the fully qualified name of the , including + the name of the assembly from which the was + loaded. + + The to get the fully qualified name for. + The fully qualified name for the . + + + This is equivalent to the Type.AssemblyQualifiedName property, + but this method works on the .NET Compact Framework 1.0 as well as + the full .NET runtime. + + + + + + Gets the short name of the . + + The to get the name for. + The short name of the . + + + The short name of the assembly is the + without the version, culture, or public key. i.e. it is just the + assembly's file name without the extension. + + + Use this rather than Assembly.GetName().Name because that + is not available on the Compact Framework. + + + Because of a FileIOPermission security demand we cannot do + the obvious Assembly.GetName().Name. We are allowed to get + the of the assembly so we + start from there and strip out just the assembly name. + + + + + + Gets the file name portion of the , including the extension. + + The to get the file name for. + The file name of the assembly. + + + Gets the file name portion of the , including the extension. + + + + + + Loads the type specified in the type string. + + A sibling type to use to load the type. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified, it will be loaded from the assembly + containing the specified relative type. If the type is not found in the assembly + then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the + assembly that is directly calling this method. If the type is not found + in the assembly then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + An assembly to load the type from. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the specified + assembly. If the type is not found in the assembly then all the loaded assemblies + will be searched for the type. + + + + + + Generate a new guid + + A new Guid + + + Generate a new guid + + + + + + Create an + + The name of the parameter that caused the exception + The value of the argument that causes this exception + The message that describes the error + the ArgumentOutOfRangeException object + + + Create a new instance of the class + with a specified error message, the parameter name, and the value + of the argument. + + + The Compact Framework does not support the 3 parameter constructor for the + type. This method provides an + implementation that works for all platforms. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Lookup an application setting + + the application settings key to lookup + the value for the key, or null + + + Configuration APIs are not supported under the Compact Framework + + + + + + Convert a path into a fully qualified local file path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + The path specified must be a local file path, a URI is not supported. + + + + + + Creates a new case-insensitive instance of the class with the default initial capacity. + + A new case-insensitive instance of the class with the default initial capacity + + + The new Hashtable instance uses the default load factor, the CaseInsensitiveHashCodeProvider, and the CaseInsensitiveComparer. + + + + + + Tests two strings for equality, the ignoring case. + + + If the platform permits, culture information is ignored completely (ordinal comparison). + The aim of this method is to provide a fast comparison that deals with null and ignores different casing. + It is not supposed to deal with various, culture-specific habits. + Use it to compare against pure ASCII constants, like keywords etc. + + The one string. + The other string. + true if the strings are equal, false otherwise. + + + + Gets an empty array of types. + + + + The Type.EmptyTypes field is not available on + the .NET Compact Framework 1.0. + + + + + + The fully qualified type of the SystemInfo class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Cache the host name for the current machine + + + + + Cache the application friendly name + + + + + Text to output when a null is encountered. + + + + + Text to output when an unsupported feature is requested. + + + + + Start time for the current process. + + + + + Gets the system dependent line terminator. + + + The system dependent line terminator. + + + + Gets the system dependent line terminator. + + + + + + Gets the base directory for this . + + The base directory path for the current . + + + Gets the base directory for this . + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the configuration file for the current . + + The path to the configuration file for the current . + + + The .NET Compact Framework 1.0 does not have a concept of a configuration + file. For this runtime, we use the entry assembly location as the root for + the configuration file name. + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the file that first executed in the current . + + The path to the entry assembly. + + + Gets the path to the file that first executed in the current . + + + + + + Gets the ID of the current thread. + + The ID of the current thread. + + + On the .NET framework, the AppDomain.GetCurrentThreadId method + is used to obtain the thread ID for the current thread. This is the + operating system ID for the thread. + + + On the .NET Compact Framework 1.0 it is not possible to get the + operating system thread ID for the current thread. The native method + GetCurrentThreadId is implemented inline in a header file + and cannot be called. + + + On the .NET Framework 2.0 the Thread.ManagedThreadId is used as this + gives a stable id unrelated to the operating system thread ID which may + change if the runtime is using fibers. + + + + + + Get the host name or machine name for the current machine + + + The hostname or machine name + + + + Get the host name or machine name for the current machine + + + The host name () or + the machine name (Environment.MachineName) for + the current machine, or if neither of these are available + then NOT AVAILABLE is returned. + + + + + + Get this application's friendly name + + + The friendly name of this application as a string + + + + If available the name of the application is retrieved from + the AppDomain using AppDomain.CurrentDomain.FriendlyName. + + + Otherwise the file name of the entry assembly is used. + + + + + + Get the start time for the current process. + + + + This is the time at which the log4net library was loaded into the + AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime + this is not the start time for the current process. + + + The log4net library should be loaded by an application early during its + startup, therefore this start time should be a good approximation for + the actual start time. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating, however this start time + will be set per AppDomain. + + + + + + Get the UTC start time for the current process. + + + + This is the UTC time at which the log4net library was loaded into the + AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime + this is not the start time for the current process. + + + The log4net library should be loaded by an application early during its + startup, therefore this start time should be a good approximation for + the actual start time. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating, however this start time + will be set per AppDomain. + + + + + + Text to output when a null is encountered. + + + + Use this value to indicate a null has been encountered while + outputting a string representation of an item. + + + The default value is (null). This value can be overridden by specifying + a value for the log4net.NullText appSetting in the application's + .config file. + + + + + + Text to output when an unsupported feature is requested. + + + + Use this value when an unsupported feature is requested. + + + The default value is NOT AVAILABLE. This value can be overridden by specifying + a value for the log4net.NotAvailableText appSetting in the application's + .config file. + + + + + + Utility class that represents a format string. + + + + Utility class that represents a format string. + + + Nicko Cadell + + + + Initialise the + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + + + Format the string and arguments + + the formatted string + + + + Replaces the format item in a specified with the text equivalent + of the value of a corresponding instance in a specified array. + A specified parameter supplies culture-specific formatting information. + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + A copy of format in which the format items have been replaced by the + equivalent of the corresponding instances of in args. + + + + This method does not throw exceptions. If an exception thrown while formatting the result the + exception and arguments are returned in the result string. + + + + + + Process an error during StringFormat + + + + + Dump the contents of an array into a string builder + + + + + Dump an object to a string + + + + + The fully qualified type of the SystemStringFormat class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + Nicko Cadell + + + + Each thread will automatically have its instance. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove a property + + + + + + Get the keys stored in the properties. + + + Gets the keys stored in the properties. + + a set of the defined keys + + + + Clear all properties + + + + Clear all properties + + + + + + Get the PropertiesDictionary for this thread. + + create the dictionary if it does not exist, otherwise return null if does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doing so. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Implementation of Stack for the + + + + Implementation of Stack for the + + + Nicko Cadell + + + + The stack store. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Clears all the contextual information held in this stack. + + + + Clears all the contextual information held in this stack. + Only call this if you think that this tread is being reused after + a previous call execution which may not have completed correctly. + You do not need to use this method if you always guarantee to call + the method of the + returned from even in exceptional circumstances, + for example by using the using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + syntax. + + + + + + Removes the top context from this stack. + + The message in the context that was removed from the top of this stack. + + + Remove the top context from this stack, and return + it to the caller. If this stack is empty then an + empty string (not ) is returned. + + + + + + Pushes a new context message into this stack. + + The new context message. + + An that can be used to clean up the context stack. + + + + Pushes a new context onto this stack. An + is returned that can be used to clean up this stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + { + log.Warn("This should have an ThreadContext Stack message"); + } + + + + + + Gets the current context information for this stack. + + The current context information. + + + + Gets the current context information for this stack. + + Gets the current context information + + + Gets the current context information for this stack. + + + + + + Get a portable version of this object + + the portable instance of this object + + + Get a cross thread portable version of this object + + + + + + The number of messages in the stack + + + The current number of messages in the stack + + + + The current number of messages in the stack. That is + the number of times has been called + minus the number of times has been called. + + + + + + Gets and sets the internal stack used by this + + The internal storage stack + + + This property is provided only to support backward compatability + of the . Tytpically the internal stack should not + be modified. + + + + + + Inner class used to represent a single context frame in the stack. + + + + Inner class used to represent a single context frame in the stack. + + + + + + Constructor + + The message for this context. + The parent context in the chain. + + + Initializes a new instance of the class + with the specified message and parent context. + + + + + + Get the message. + + The message. + + + Get the message. + + + + + + Gets the full text of the context down to the root level. + + + The full text of the context down to the root level. + + + + Gets the full text of the context down to the root level. + + + + + + Struct returned from the method. + + + + This struct implements the and is designed to be used + with the pattern to remove the stack frame at the end of the scope. + + + + + + The ThreadContextStack internal stack + + + + + The depth to trim the stack to when this instance is disposed + + + + + Constructor + + The internal stack used by the ThreadContextStack. + The depth to return the stack to when this object is disposed. + + + Initializes a new instance of the class with + the specified stack and return depth. + + + + + + Returns the stack to the correct depth. + + + + Returns the stack to the correct depth. + + + + + + Implementation of Stacks collection for the + + + + Implementation of Stacks collection for the + + + Nicko Cadell + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + The fully qualified type of the ThreadContextStacks class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the named thread context stack + + + The named stack + + + + Gets the named thread context stack + + + + + + Utility class for transforming strings. + + + + Utility class for transforming strings. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Write a string to an + + the writer to write to + the string to write + The string to replace non XML compliant chars with + + + The test is escaped either using XML escape entities + or using CDATA sections. + + + + + + Replace invalid XML characters in text string + + the XML text input string + the string to use in place of invalid characters + A string that does not contain invalid XML characters. + + + Certain Unicode code points are not allowed in the XML InfoSet, for + details see: http://www.w3.org/TR/REC-xml/#charsets. + + + This method replaces any illegal characters in the input string + with the mask string specified. + + + + + + Count the number of times that the substring occurs in the text + + the text to search + the substring to find + the number of times the substring occurs in the text + + + The substring is assumed to be non repeating within itself. + + + + + + Characters illegal in XML 1.0 + + + + + Impersonate a Windows Account + + + + This impersonates a Windows account. + + + How the impersonation is done depends on the value of . + This allows the context to either impersonate a set of user credentials specified + using username, domain name and password or to revert to the process credentials. + + + + + + Default constructor + + + + Default constructor + + + + + + Initialize the SecurityContext based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The security context will try to Logon the specified user account and + capture a primary token for impersonation. + + + The required , + or properties were not specified. + + + + Impersonate the Windows account specified by the and properties. + + caller provided state + + An instance that will revoke the impersonation of this SecurityContext + + + + Depending on the property either + impersonate a user using credentials supplied or revert + to the process credentials. + + + + + + Create a given the userName, domainName and password. + + the user name + the domain name + the password + the for the account specified + + + Uses the Windows API call LogonUser to get a principal token for the account. This + token is used to initialize the WindowsIdentity. + + + + + + Gets or sets the impersonation mode for this security context + + + The impersonation mode for this security context + + + + Impersonate either a user with user credentials or + revert this thread to the credentials of the process. + The value is one of the + enum. + + + The default value is + + + When the mode is set to + the user's credentials are established using the + , and + values. + + + When the mode is set to + no other properties need to be set. If the calling thread is + impersonating then it will be reverted back to the process credentials. + + + + + + Gets or sets the Windows username for this security context + + + The Windows username for this security context + + + + This property must be set if + is set to (the default setting). + + + + + + Gets or sets the Windows domain name for this security context + + + The Windows domain name for this security context + + + + The default value for is the local machine name + taken from the property. + + + This property must be set if + is set to (the default setting). + + + + + + Sets the password for the Windows account specified by the and properties. + + + The password for the Windows account specified by the and properties. + + + + This property must be set if + is set to (the default setting). + + + + + + The impersonation modes for the + + + + See the property for + details. + + + + + + Impersonate a user using the credentials supplied + + + + + Revert this the thread to the credentials of the process + + + + + Adds to + + + + Helper class to expose the + through the interface. + + + + + + Constructor + + the impersonation context being wrapped + + + Constructor + + + + + + Revert the impersonation + + + + Revert the impersonation + + + + + + The log4net Global Context. + + + + The GlobalContext provides a location for global debugging + information to be stored. + + + The global context has a properties map and these properties can + be included in the output of log messages. The + supports selecting and outputing these properties. + + + By default the log4net:HostName property is set to the name of + the current machine. + + + + + GlobalContext.Properties["hostname"] = Environment.MachineName; + + + + Nicko Cadell + + + + Private Constructor. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + The global context properties instance + + + + + The global properties map. + + + The global properties map. + + + + The global properties map. + + + + + + Provides information about the environment the assembly has + been built for. + + + + Version of the assembly + + + Version of the framework targeted + + + Type of framework targeted + + + Does it target a client profile? + + + + Identifies the version and target for this assembly. + + + + + The log4net Logical Thread Context. + + + + The LogicalThreadContext provides a location for specific debugging + information to be stored. + The LogicalThreadContext properties override any or + properties with the same name. + + + For .NET Standard 1.3 this class uses + System.Threading.AsyncLocal rather than . + + + The Logical Thread Context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Logical Thread Context provides a diagnostic context for the current call context. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Logical Thread Context is managed on a per basis. + + + The requires a link time + for the + . + If the calling code does not have this permission then this context will be disabled. + It will not store any property values set on it. + + + Example of using the thread context properties to store a username. + + LogicalThreadContext.Properties["user"] = userName; + log.Info("This log message has a LogicalThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(LogicalThreadContext.Stacks["LDC"].Push("my context message")) + { + log.Info("This log message has a LogicalThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The LogicalThreadContext properties override any + or properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The logical thread stacks. + + + + + + This class is used by client applications to request logger instances. + + + + This class has static methods that are used by a client to request + a logger instance. The method is + used to retrieve a logger. + + + See the interface for more details. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + Returns the named logger if it exists. + + Returns the named logger if it exists. + + + + If the named logger exists (in the default repository) then it + returns a reference to the logger, otherwise it returns null. + + + The fully qualified logger name to look for. + The logger found, or null if no logger could be found. + + + Get the currently defined loggers. + + Returns all the currently defined loggers in the default repository. + + + The root logger is not included in the returned array. + + All the defined loggers. + + + Get or create a logger. + + Retrieves or creates a named logger. + + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The name of the logger to retrieve. + The logger with the name specified. + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the logger doesn't exist in the specified + repository. + + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the repository for the specified assembly) then it + returns a reference to the logger, otherwise it returns + null. + + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger, or null if the logger doesn't exist in the specified + assembly's repository. + + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Get the logger for the fully qualified name of the type specified. + + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The repository to lookup in. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The assembly to use to lookup the repository. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + Shutdown a logger repository. + + Shuts down the default repository. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + default repository. + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The repository to shutdown. + + + + Shuts down the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The assembly to use to lookup the repository. + + + Reset the configuration of a repository + + Resets all values contained in this repository instance to their defaults. + + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The repository to reset. + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The assembly to use to lookup the repository to reset. + + + Get the logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Get a logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Create a domain + + Creates a repository with the specified repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + Create a logger repository. + + Creates a repository with the specified repository type. + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + + + + Creates a repository with the specified name. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name. + + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Creates a repository for the specified assembly and repository type. + + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Gets the list of currently defined repositories. + + + + Get an array of all the objects that have been created. + + + An array of all the known objects. + + + + Flushes logging events buffered in all configured appenders in the default repository. + + The maximum time in milliseconds to wait for logging events from asycnhronous appenders to be flushed. + True if all logging events were flushed successfully, else false. + + + + Looks up the wrapper object for the logger specified. + + The logger to get the wrapper for. + The wrapper for the logger specified. + + + + Looks up the wrapper objects for the loggers specified. + + The loggers to get the wrappers for. + The wrapper objects for the loggers specified. + + + + Create the objects used by + this manager. + + The logger to wrap. + The wrapper for the logger specified. + + + + The wrapper map to use to hold the objects. + + + + + Implementation of Mapped Diagnostic Contexts. + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + The MDC class is similar to the class except that it is + based on a map instead of a stack. It provides mapped + diagnostic contexts. A Mapped Diagnostic Context, or + MDC in short, is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The MDC is managed on a per thread basis. + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Gets the context value identified by the parameter. + + The key to lookup in the MDC. + The string value held for the key, or a null reference if no corresponding value is found. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + If the parameter does not look up to a + previously defined context then null will be returned. + + + + + + Add an entry to the MDC + + The key to store the value under. + The value to store. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Puts a context value (the parameter) as identified + with the parameter into the current thread's + context map. + + + If a value is already defined for the + specified then the value will be replaced. If the + is specified as null then the key value mapping will be removed. + + + + + + Removes the key value mapping for the key specified. + + The key to remove. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove the specified entry from this thread's MDC + + + + + + Clear all entries in the MDC + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove all the entries from this thread's MDC + + + + + + Implementation of Nested Diagnostic Contexts. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + A Nested Diagnostic Context, or NDC in short, is an instrument + to distinguish interleaved log output from different sources. Log + output is typically interleaved when a server handles multiple + clients near-simultaneously. + + + Interleaved log output can still be meaningful if each log entry + from different contexts had a distinctive stamp. This is where NDCs + come into play. + + + Note that NDCs are managed on a per thread basis. The NDC class + is made up of static methods that operate on the context of the + calling thread. + + + How to push a message into the context + + using(NDC.Push("my context message")) + { + ... all log calls will have 'my context message' included ... + + } // at the end of the using block the message is automatically removed + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Clears all the contextual information held on the current thread. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Clears the stack of NDC data held on the current thread. + + + + + + Creates a clone of the stack of context information. + + A clone of the context info for this thread. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The results of this method can be passed to the + method to allow child threads to inherit the context of their + parent thread. + + + + + + Inherits the contextual information from another thread. + + The context stack to inherit. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This thread will use the context information from the stack + supplied. This can be used to initialize child threads with + the same contextual information as their parent threads. These + contexts will NOT be shared. Any further contexts that + are pushed onto the stack will not be visible to the other. + Call to obtain a stack to pass to + this method. + + + + + + Removes the top context from the stack. + + + The message in the context that was removed from the top + of the stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Remove the top context from the stack, and return + it to the caller. If the stack is empty then an + empty string (not null) is returned. + + + + + + Pushes a new context message. + + The new context message. + + An that can be used to clean up + the context stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Pushes a new context onto the context stack. An + is returned that can be used to clean up the context stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.NDC.Push("NDC_Message")) + { + log.Warn("This should have an NDC message"); + } + + + + + + Pushes a new context message. + + The new context message string format. + Arguments to be passed into messageFormat. + + An that can be used to clean up + the context stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Pushes a new context onto the context stack. An + is returned that can be used to clean up the context stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + var someValue = "ExampleContext" + using(log4net.NDC.PushFormat("NDC_Message {0}", someValue)) + { + log.Warn("This should have an NDC message"); + } + + + + + + Removes the context information for this thread. It is + not required to call this method. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This method is not implemented. + + + + + + Forces the stack depth to be at most . + + The maximum depth of the stack + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Forces the stack depth to be at most . + This may truncate the head of the stack. This only affects the + stack in the current thread. Also it does not prevent it from + growing, it only sets the maximum depth at the time of the + call. This can be used to return to a known context depth. + + + + + + Gets the current context depth. + + The current context depth. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The number of context values pushed onto the context stack. + + + Used to record the current depth of the context. This can then + be restored using the method. + + + + + + + The log4net Thread Context. + + + + The ThreadContext provides a location for thread specific debugging + information to be stored. + The ThreadContext properties override any + properties with the same name. + + + The thread context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Thread Context provides a diagnostic context for the current thread. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Thread Context is managed on a per thread basis. + + + Example of using the thread context properties to store a username. + + ThreadContext.Properties["user"] = userName; + log.Info("This log message has a ThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(ThreadContext.Stacks["NDC"].Push("my context message")) + { + log.Info("This log message has a ThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The ThreadContext properties override any + properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The thread local stacks. + + + + + diff --git a/Bin/myLog.dll b/Bin/myLog.dll new file mode 100644 index 0000000..4e3e801 Binary files /dev/null and b/Bin/myLog.dll differ diff --git a/Bin/myLog.pdb b/Bin/myLog.pdb new file mode 100644 index 0000000..614dc36 Binary files /dev/null and b/Bin/myLog.pdb differ diff --git a/DXTempFolder/BinaryData/20ec0b42-896c-41a0-985b-74d43185b991Page1_WebChartInOrders2.bmp b/DXTempFolder/BinaryData/20ec0b42-896c-41a0-985b-74d43185b991Page1_WebChartInOrders2.bmp new file mode 100644 index 0000000..db1e4d9 Binary files /dev/null and b/DXTempFolder/BinaryData/20ec0b42-896c-41a0-985b-74d43185b991Page1_WebChartInOrders2.bmp differ diff --git a/DXTempFolder/BinaryData/234d5061-85ed-4df3-bd78-a7558d5cf9b4Page1_WebChartOutOrders.bmp b/DXTempFolder/BinaryData/234d5061-85ed-4df3-bd78-a7558d5cf9b4Page1_WebChartOutOrders.bmp new file mode 100644 index 0000000..c5d1ae3 Binary files /dev/null and b/DXTempFolder/BinaryData/234d5061-85ed-4df3-bd78-a7558d5cf9b4Page1_WebChartOutOrders.bmp differ diff --git a/DXTempFolder/BinaryData/3b374027-dbae-4280-8171-bcb4513ca357Page1_WebChartInOutLines.bmp b/DXTempFolder/BinaryData/3b374027-dbae-4280-8171-bcb4513ca357Page1_WebChartInOutLines.bmp new file mode 100644 index 0000000..a400d06 Binary files /dev/null and b/DXTempFolder/BinaryData/3b374027-dbae-4280-8171-bcb4513ca357Page1_WebChartInOutLines.bmp differ diff --git a/DXTempFolder/BinaryData/4f87dab5-417d-418f-bd17-64f301204ddePage1_WebChartInOrders.bmp b/DXTempFolder/BinaryData/4f87dab5-417d-418f-bd17-64f301204ddePage1_WebChartInOrders.bmp new file mode 100644 index 0000000..6426a04 Binary files /dev/null and b/DXTempFolder/BinaryData/4f87dab5-417d-418f-bd17-64f301204ddePage1_WebChartInOrders.bmp differ diff --git a/DXTempFolder/BinaryData/5dcb3185-e1a4-4f12-a394-8d78b96cc9ccPage1_WebChartLocs.bmp b/DXTempFolder/BinaryData/5dcb3185-e1a4-4f12-a394-8d78b96cc9ccPage1_WebChartLocs.bmp new file mode 100644 index 0000000..5a2928e Binary files /dev/null and b/DXTempFolder/BinaryData/5dcb3185-e1a4-4f12-a394-8d78b96cc9ccPage1_WebChartLocs.bmp differ diff --git a/DXTempFolder/BinaryData/77b211fc-a02b-42e6-bb08-70dc2d6bfa76Page1_WebChartTasks.bmp b/DXTempFolder/BinaryData/77b211fc-a02b-42e6-bb08-70dc2d6bfa76Page1_WebChartTasks.bmp new file mode 100644 index 0000000..34a8ad4 Binary files /dev/null and b/DXTempFolder/BinaryData/77b211fc-a02b-42e6-bb08-70dc2d6bfa76Page1_WebChartTasks.bmp differ diff --git a/DXTempFolder/BinaryData/8ed4471f-8746-4410-9538-641a4e3d9d69Page1_WebChartStatePie.bmp b/DXTempFolder/BinaryData/8ed4471f-8746-4410-9538-641a4e3d9d69Page1_WebChartStatePie.bmp new file mode 100644 index 0000000..08bd25e Binary files /dev/null and b/DXTempFolder/BinaryData/8ed4471f-8746-4410-9538-641a4e3d9d69Page1_WebChartStatePie.bmp differ diff --git a/DXTempFolder/BinaryData/bb3fd5c4-ee4b-464c-85ff-73c221bd18eaPage1_WebChartEmpTasks.bmp b/DXTempFolder/BinaryData/bb3fd5c4-ee4b-464c-85ff-73c221bd18eaPage1_WebChartEmpTasks.bmp new file mode 100644 index 0000000..68c0818 Binary files /dev/null and b/DXTempFolder/BinaryData/bb3fd5c4-ee4b-464c-85ff-73c221bd18eaPage1_WebChartEmpTasks.bmp differ diff --git a/DXTempFolder/BinaryData/d5cf3cd0-a0f0-4ff3-88f8-5ad7826769afPage1_WebChartPartTasks.bmp b/DXTempFolder/BinaryData/d5cf3cd0-a0f0-4ff3-88f8-5ad7826769afPage1_WebChartPartTasks.bmp new file mode 100644 index 0000000..e48c956 Binary files /dev/null and b/DXTempFolder/BinaryData/d5cf3cd0-a0f0-4ff3-88f8-5ad7826769afPage1_WebChartPartTasks.bmp differ diff --git a/Default.aspx b/Default.aspx new file mode 100644 index 0000000..ae3a6cc --- /dev/null +++ b/Default.aspx @@ -0,0 +1,14 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + diff --git a/Default.aspx.cs b/Default.aspx.cs new file mode 100644 index 0000000..4cd9d78 --- /dev/null +++ b/Default.aspx.cs @@ -0,0 +1,32 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +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; + +public partial class _Default : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + Response.Redirect("index.aspx",true); + } + protected void Button1_Click(object sender, EventArgs e) + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString());abc + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + } +} diff --git a/Desktop.aspx b/Desktop.aspx new file mode 100644 index 0000000..504fcbb --- /dev/null +++ b/Desktop.aspx @@ -0,0 +1,194 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" ClassName="Desktop" + CodeFile="Desktop.aspx.cs" Inherits="Desktop" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + +
+   +   +  
+ + + + + + + + + + + + + + + + + 没有可显示的工作计划 + + + + + + + + + + + + + + + + + + + + + + + + + + 没有可显示的工作计划 + + + + + + + + + + + + + + + + + + + + + + + + + + 没有可显示的工作计划 + + + + + + +
+
+
+
修改密码 +
+ + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+
+ +
+ + 在线用户 +
+ + + + + +   + + +
+ +
+
+
+ + + +  
+
+ diff --git a/Desktop.aspx.cs b/Desktop.aspx.cs new file mode 100644 index 0000000..87a8785 --- /dev/null +++ b/Desktop.aspx.cs @@ -0,0 +1,298 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +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 ajax; +using DeiNiu.Utils; +using DeiNiu.wms.Logical; + +public partial class Desktop : PageBase +{ +   + protected void Page_Load(object sender, EventArgs e) + { +   + bindWorkplan(); + //bindProjectInfo(); + //bindTrainingInfo(); + showOnlineUsers(); + } + + void bindWorkplan() + { + LWorkplan wp = new LWorkplan(); + lbToday.Text = DateTime.Today.ToShortDateString(); + lbTomorrow.Text = DateTime.Today.AddDays(1).ToShortDateString(); + lbafterTomorrow.Text = DateTime.Today.AddDays(2).ToShortDateString(); + gvWorkplan1.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbToday.Text); + gvWorkplan2.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbTomorrow.Text); + gvWorkplan3.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbafterTomorrow.Text); + gvWorkplan3.DataBind(); + gvWorkplan2.DataBind(); + gvWorkplan1.DataBind(); + } + /* + void bindProjectInfo() + { + LProject lpj = new LProject(); + + //上个月 + + + DataTable lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID,DateTime.Now.AddMonths(-1).Year.ToString(), + DateTime.Now.AddMonths(-1).Month.ToString()) ; + DataView dv = lmDt.DefaultView; + //上个月通过数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + + " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') "; + lbLMPassed.Text = dv.Count.ToString(); + + //上个月未通过数量 + dv.RowFilter = " pj_status like '%未通过%' or pd_status like '%未通过%'"; + lblmFailed.Text = dv.Count.ToString(); + //上个月待提交数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交 + "')" + + " and pd_status in('" + ProjectDetailStatus.月度未提交 + "') "; + lblm4submit.Text = dv.Count.ToString(); + + + + //上个月得分 + dv.RowFilter = string.Empty; + Double lmscore = 0; + for(int i =0;i'" + + ProjectDetailStatus.考核通过 + + "' or pd_status in('" + ProjectDetailStatus.审核通过 + "')"; + + lb4preapprove.Text = (Convert.ToInt32( lb4preapprove.Text)+ dv.Count).ToString(); + } + + + + + //本月 + + + lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID, DateTime.Now.Year.ToString(), + DateTime.Now.Month.ToString()); + dv = lmDt.DefaultView; + //本月通过数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + + " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') "; + lbpassed.Text = dv.Count.ToString(); + + //本月未通过数量 + dv.RowFilter = " pj_status like '%未通过%' or pd_status like '%未通过%'"; + lbfailed.Text = dv.Count.ToString(); + + + //本月得分 + dv.RowFilter = string.Empty; + lmscore = 0; + for (int i = 0; i < lmDt.Rows.Count; i++) + { + lmscore += Convert.ToDouble(lmDt.Rows[i]["pj_score"]); + } + + lbscore.Text = lmscore.ToString(); + + //本月待提交数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交 + "')" + + " and pd_status in('" + ProjectDetailStatus.月度未提交 + "') "; + lb4submit.Text = dv.Count.ToString(); + + + //本月待审核 + lb4approve.Text = "0"; + if (lem.CanShenHe || lem.CanYuShen) + { + lmDt = lpj.Get4ApproveList(lem.GetCanApproveDeptList(), DateTime.Now .Year.ToString(), + DateTime.Now .Month.ToString()); + dv = lmDt.DefaultView; + lb4approve.Text = dv.Count.ToString(); + } + if (lem.CanKaoHe) + { + dv = lpj.GetProjectsByYearMonth(DateTime.Now .Year.ToString(), DateTime.Now .Month.ToString()).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "') and pd_status <>'" + + ProjectDetailStatus.考核通过 + + "' or pd_status in('" + ProjectDetailStatus.审核通过 + "')"; + + lb4approve.Text = (Convert.ToInt32(lb4preapprove.Text) + dv.Count).ToString(); + } + + + + //全年项目 + + + lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID, DateTime.Now.Year.ToString() ); + dv = lmDt.DefaultView; + //全年通过数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + + " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') "; + lbYearPassed .Text = dv.Count.ToString(); + + //全年未通过数量 + dv.RowFilter = " pj_status like '%未通过%' or pd_status like '%未通过%'"; + lbYearFailed.Text = dv.Count.ToString(); + + + //全年得分 + dv.RowFilter = string.Empty; + lmscore = 0; + for (int i = 0; i < lmDt.Rows.Count; i++) + { + lmscore += Convert.ToDouble(lmDt.Rows[i]["pj_score"]); + } + + lbYearscore1.Text = lmscore.ToString(); + + //全年待提交数量 + dv.RowFilter = " pj_status in('" + + ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交 + "')" + + " and pd_status in('" + ProjectDetailStatus.月度未提交 + "') "; + lbyear4submit.Text = dv.Count.ToString(); + + + } + */ + /* + void bindTrainingInfo() + { + + DataTable dt = lem.GetLessons(lem.GetEmployee.ID); + DataView dv = dt.DefaultView; + dv.RowFilter = "train_passed=1"; + lbtpassed.Text = dv.Count.ToString(); + dv.RowFilter = "train_passed=0 and le_enddate< '" + DateTime.Now.ToShortDateString() +"'"; + lbtfailed.Text = dv.Count.ToString(); + + //总学分 + decimal allScore = 0; + + for(int i=0;i "; + } + } + + protected void btn_save_Click(object sender, EventArgs e) + { + + if(lem.GetEmployee.ValidUser(lem.GetEmployee.em_account, txtOldPasswd.Text)>0) + { + lem.GetEmployee.em_passwd = Util.Encrypt(txtNewPasswd.Text); + lem.GetEmployee.Update(); + } + + + this.divPasswdChg.Visible = false; + } + protected void btn_cancel_Click(object sender, EventArgs e) + { + + this.divPasswdChg.Visible = false; + } + protected void lkChgPswd_Click(object sender, EventArgs e) + { + + this.divPasswdChg.Visible = !divPasswdChg.Visible; + } + /* + protected void LinkButton1_Click(object sender, EventArgs e) + { + Response.Redirect("~/training/Lessonview.aspx"); + } + protected void LinkButton4_Click(object sender, EventArgs e) + { + Response.Redirect("~/training/Lessonview.aspx"); + } + protected void LinkButton2_Click(object sender, EventArgs e) + { + Response.Redirect("~/training/Lessonview.aspx"); + } + protected void LinkButton3_Click(object sender, EventArgs e) + { + Response.Redirect("~/training/Lessonview.aspx"); + } + */ + protected void lkbtnusers_Click(object sender, EventArgs e) + { + divOnlineUsers.Visible = !divOnlineUsers.Visible; + } +} diff --git a/Dict/.svn/entries b/Dict/.svn/entries new file mode 100644 index 0000000..b3b1949 --- /dev/null +++ b/Dict/.svn/entries @@ -0,0 +1,572 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/Dict +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +DeptMain.aspx.cs +file + + + + +2011-04-01T02:51:03.289823Z +16712142e760c3e3ca05f45b4c57db33 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +11293 + +RoleMain.aspx +file + + + + +2011-04-01T02:51:03.289823Z +e86a662f72124fe2cc27f337d8ddcdcc +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6333 + +RoleEmp.aspx.cs +file + + + + +2011-04-01T02:51:03.305448Z +29348ca6500b98725ee06c066a4239aa +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +7294 + +RoleMain.aspx.cs +file + + + + +2011-04-01T02:51:03.321073Z +3c85c792f5bd33b889e2b19cb3f3c7eb +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6742 + +PublicNewsMain.aspx +file + + + + +2011-04-01T02:51:03.321073Z +7eca18f28e1e3addf4103a5718da3b2f +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5727 + +RoleAuth.aspx +file + + + + +2011-04-01T02:51:03.336698Z +923c19644561f8abd2223b27bc39ea5d +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +4914 + +PublicNewsMain.aspx.cs +file + + + + +2011-04-01T02:51:03.367949Z +da6058e5b414376016fd3ff1f92a1d55 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +7327 + +EmployeeMain.aspx +file + + + + +2011-04-01T02:51:03.352323Z +b1e9c22e4ad270cf8d85e9e9231bfd66 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +21972 + +RoleAuth.aspx.cs +file + + + + +2011-04-01T02:51:03.383574Z +8e3ca1ea83b574b2fa6f2fb11f07e496 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +7171 + +EmployeeMain.aspx.cs +file + + + + +2011-04-01T02:51:03.383574Z +6eff2b885c77e15164d857702de2ca53 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +16631 + +AuthorityMain.aspx +file + + + + +2011-04-01T02:51:03.399199Z +ce3967044bd3a42f90be997ca92794fe +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6956 + +DeptEmp.aspx +file + + + + +2011-04-01T02:51:03.414824Z +1f9769b3547376f0636c60df6d538452 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +3986 + +DeptMain.aspx +file + + + + +2011-04-01T02:51:03.430449Z +615dea6c12eabab33e8b27fccf9398c6 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6799 + +AuthorityMain.aspx.cs +file + + + + +2011-04-01T02:51:03.430449Z +d273d8709e68a9505712a8cfb4feb8c6 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +10578 + +DeptEmp.aspx.cs +file + + + + +2011-04-01T02:51:03.446074Z +59457379588f33f15f70f8c8c5d61564 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +8261 + +RoleEmp.aspx +file + + + + +2011-04-01T02:51:03.461699Z +3e2ed1f1a7b9334d307e2b47e7aa6a7e +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5646 + diff --git a/Dict/.svn/text-base/AuthorityMain.aspx.cs.svn-base b/Dict/.svn/text-base/AuthorityMain.aspx.cs.svn-base new file mode 100644 index 0000000..9a91587 --- /dev/null +++ b/Dict/.svn/text-base/AuthorityMain.aspx.cs.svn-base @@ -0,0 +1,319 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +namespace ajax.Dict +{ + public partial class AuthorityMain :PageBase + { + private LAuthority _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LAuthority(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡŽڵIJ + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + + if (TreeAuth.SelectedNode != null) + { + TreeAuth.SelectedNode.ChildNodes.Clear(); + BindTree(TreeAuth.SelectedNode.Value, TreeAuth.SelectedNode, dv); + + //бѡеIJµв + dv.RowFilter = "auth_uplevel = '" + TreeAuth.SelectedValue + "'"; + } + GridView1.DataSource = dv; + GridView1.DataBind(); + UpdateSession(); + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + //ϢurlΪpublic + LAuthority ltmp = new LAuthority(); + ltmp.Initialize(Convert.ToInt32(TreeAuth.SelectedValue)); + chkPublic.Enabled = !ltmp.GetAuthority.auth_publicInfomation; + chkPublicInfo.Enabled = !ltmp.GetAuthority.auth_publicInfomation; + chkAlert.Enabled =!chkPublicInfo.Enabled; //ƵϼǹϢ + if (chkPublicInfo.Checked) txtLink.Enabled = false; + + DataDetail.Visible = true; + txtName.Text = _logic.GetAuthority.auth_name; + txtDesc.Text = _logic.GetAuthority.auth_desc; + txtLink.Text = _logic.GetAuthority.auth_link; + chkPublic.Checked = _logic.GetAuthority.auth_public; + chkPublicInfo.Checked = _logic.GetAuthority.auth_publicInfomation; + //ϼΪϢ¼Ҳ + if(ltmp.GetAuthority.auth_publicInfomation) + chkPublicInfo.Checked = ltmp.GetAuthority.auth_publicInfomation; + if (ltmp.GetAuthority.auth_public) + chkPublic.Checked = ltmp.GetAuthority.auth_public; + chkAlert.Checked = _logic.GetAuthority.auth_marqueen; + chkPublic.Checked = _logic.GetAuthority.auth_public; + ltmp = null; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + GridView1.SelectedIndex = -1; + Databound(); + DetailDataBind(); + + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetAuthority.ID > 0 ? _logic.GetAuthority.Update() : _logic.GetAuthority.Add(); + ClearDetail(); + Databound(); + lbEdit.Text = ""; + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetAuthority.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetAuthority.ID > 0)) + { + _logic.GetAuthority.lastmodified = DateTime.Now.ToString(); + _logic.GetAuthority.auth_uplevel = Convert.ToInt32(TreeAuth.SelectedValue); + } + + _logic.GetAuthority.auth_name = txtName.Text; + _logic.GetAuthority.auth_desc = txtDesc.Text; + _logic.GetAuthority.auth_link = txtLink.Text; + _logic.GetAuthority.auth_public = chkPublic.Checked; + _logic.GetAuthority.auth_publicInfomation =chkPublicInfo.Checked ; + _logic.GetAuthority.auth_marqueen = chkAlert.Checked; + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + txtLink.Text =""; + chkPublic.Checked = false; + chkPublicInfo.Checked = false; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["auth_name"].ToString(); + node.Value = row["pk_authority"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeAuth.Nodes.Add(node); + node.Expanded = false; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = false; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + + protected void TreeAuth_SelectedNodeChanged1(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.RowFilter = "auth_uplevel = '" + TreeAuth.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + if(TreeAuth.SelectedNode.ChildNodes.Count>0)TreeAuth.SelectedNode.Expand(); + } + + protected void chkPublicInfo_CheckedChanged(object sender, EventArgs e) + { + switch (chkPublicInfo.Checked) + { + case true: + txtLink.Text = string.Empty; + txtLink.Enabled = false; + chkPublic.Checked = true; + chkPublic.Enabled = false; + break; + + case false: + txtLink.Text = _logic.GetAuthority.auth_link; + txtLink.Enabled = false; + chkPublic.Checked = false; + chkPublic.Enabled = true; + break; + + } + + } + + + + + protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e) + { + + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[4].Text.Trim().Equals("True"); + e.Row.Cells[4].Controls.Add(chk); + } + } + } +} \ No newline at end of file diff --git a/Dict/.svn/text-base/AuthorityMain.aspx.svn-base b/Dict/.svn/text-base/AuthorityMain.aspx.svn-base new file mode 100644 index 0000000..8298dde --- /dev/null +++ b/Dict/.svn/text-base/AuthorityMain.aspx.svn-base @@ -0,0 +1,126 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="AuthorityMain.aspx.cs" Inherits="ajax.Dict.AuthorityMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+ + + + +  
+
  + + +
+
+
+
+
+ diff --git a/Dict/.svn/text-base/DeptEmp.aspx.cs.svn-base b/Dict/.svn/text-base/DeptEmp.aspx.cs.svn-base new file mode 100644 index 0000000..7301efc --- /dev/null +++ b/Dict/.svn/text-base/DeptEmp.aspx.cs.svn-base @@ -0,0 +1,309 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class DeptEmp : PageBase +{ + private LEmployee _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LEmployee(); + + Databound(); + + //ɫʱʼԱ + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + bindGV(); + UpdateSession(); + bindDept(); + bindDeptEmp(); + + + } + + /// + /// 󶨲 + /// + private void bindDept() + { + TreeDept.Nodes.Clear(); + BindTree(TreeDept, "0", TreeDept.SelectedNode, _logic.GetDepartments().DefaultView); + SetTreeDeptChecked(); + + } + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode, _logic.GetDepartments().DefaultView, _logic.GetActivedEmpDept().DefaultView); + + + + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + "" ; + node.Value = row["pk_department"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , emrow["pk_employee"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + tree.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(tree,node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + public void BindTree(TreeView tree, string id, TreeNode pNode, DataView deptdv ) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"].ToString() + ""; + node.Value = row["pk_department"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = true; + node.Expanded = true; + + if (pNode == null) + //˵Ǹڵ + { + + tree.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindTree(tree, node.Value, node, new DataView(deptdv.Table)); + + } + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LEmployee)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (TreeDeptEmp.SelectedNode== null) return; + ArrayList al = new ArrayList(); + + GetCheckedNode(TreeDept.Nodes, al); + _logic.Initialize(); +// using (TransactionScope trans = new TransactionScope()) + { + try + { + _logic.GetDeptEmp.Delete(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + + foreach (string id in al) + { + _logic.GetDeptEmp.de_dept = Convert.ToInt32(id); + _logic.GetDeptEmp.de_employee = Convert.ToInt32(TreeDeptEmp.SelectedValue); + _logic.GetDeptEmp.Add(); + } + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + + + } + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + void SetTreeDeptChecked() + { + if( TreeDeptEmp.SelectedNode ==null) return; + ArrayList deptList = new ArrayList(); + DataTable dt = _logic.GetDepartments(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + foreach (DataRow dr in dt.Rows) + { + deptList.Add(dr["pk_department"]); + } + SetCheckedNode(TreeDept.Nodes, deptList); + } + + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GvDept.SelectedIndex = -1; + SetTreeDeptChecked(); + bindGV(); + + } + + + void bindGV( ) + { + //Ա嵥 + string nodevalue = TreeDeptEmp.SelectedValue; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmDept.Text = TreeDeptEmp.SelectedNode.Text + " Ա嵥"; + GvDept.DataSource = _logic.GetDepartments(Convert.ToInt32(nodevalue)); + + + } + GvDept.DataBind(); + + } + + protected void GvDept_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + if (GvDept.DataKeys != null) + { + string id = GvDept.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetDeptEmp.ID = Convert.ToInt32(id); + _logic.GetDeptEmp.getModel(); + + _logic.GetDeptEmp.de_title = ((TextBox)GvDept.Rows[e.RowIndex].Cells[3].Controls[1]).Text; + + //_logic.GetTrainingDetail.operater = + _logic.GetDeptEmp.Update(); + } + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowEditing(object sender, GridViewEditEventArgs e) + { + GvDept.EditIndex = e.NewEditIndex; + GvDept.SelectedIndex = e.NewEditIndex; + bindGV(); + } +} \ No newline at end of file diff --git a/Dict/.svn/text-base/DeptEmp.aspx.svn-base b/Dict/.svn/text-base/DeptEmp.aspx.svn-base new file mode 100644 index 0000000..f6c0097 --- /dev/null +++ b/Dict/.svn/text-base/DeptEmp.aspx.svn-base @@ -0,0 +1,86 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="DeptEmp.aspx.cs" Inherits="DeptEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
  + +
+ +
+ +
+ diff --git a/Dict/.svn/text-base/DeptMain.aspx.cs.svn-base b/Dict/.svn/text-base/DeptMain.aspx.cs.svn-base new file mode 100644 index 0000000..38fd8a7 --- /dev/null +++ b/Dict/.svn/text-base/DeptMain.aspx.cs.svn-base @@ -0,0 +1,361 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class DeptMain : PageBase +{ + private LDepartment _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LDepartment(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨲б + drplstDept.DataSource = _logic.GetAllActiveData(); + drplstDept.DataTextField = "dep_name"; + drplstDept.DataValueField = "pk_department"; + drplstDept.DataBind(); + + + + + drplstDept.Items.Insert(0, (new ListItem("", "0"))); + drplstDept.SelectedItem.Selected = false; + drplstDept.Items.FindByText("").Selected = true; + + + + //󶨲Աб + DropDownList1.DataSource = _logic.GetEmployees(); + DropDownList1.DataTextField = "em_name"; + DropDownList1.DataValueField = "pk_employee"; + DropDownList1.DataBind(); + DropDownList1.Items.Insert(0,(new ListItem("ѡ...","0"))); + DropDownList1.SelectedItem.Selected = false; + DropDownList1.Items.FindByText("ѡ...").Selected = true; + //װѡŽڵIJ + DataView dv = new DataView(_logic.GetAllActiveData()); + string selectedValue = TreeDept.SelectedValue; + TreeDept.Nodes.Clear(); + TreeDept.Nodes.Add(new TreeNode("","0")); + TreeDept.Nodes[0].Expanded = true; + BindTree("0", TreeDept.Nodes[0], dv); + // TreeDept.SelectedNode.ChildNodes.Clear(); + // BindTree(TreeDept.SelectedValue, TreeDept.SelectedNode, dv); + // TreeDept.Nodes.AddAt(0, new TreeNode("", "0")); + if (selectedValue =="0") TreeDept.Nodes[0].Selected = true; + else + { + setTreeDeptSelected(selectedValue, TreeDept.Nodes[0]); + } + + //бѡеIJµв + dv.RowFilter = "dep_mastdept = '" + selectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + + + drplstDept.Items.Clear(); + initializeDrlstDept(TreeDept.Nodes, drplstDept ,""); + } + + + + void initializeDrlstDept(TreeNodeCollection nds, DropDownList drplist, string emptyString) + { + + + foreach (TreeNode nd in nds) + { + + ListItem li = new ListItem(emptyString + nd.Text,nd.Value); + drplist.Items.Add(li); + string NextemptyString = emptyString+ "----"; + foreach (TreeNode nd1 in nd.ChildNodes) + { + li = new ListItem(NextemptyString + nd1.Text, nd1.Value); + drplist.Items.Add(li); + + if (nd1.ChildNodes.Count > 0) + { + NextemptyString +="----"; + initializeDrlstDept(nd1.ChildNodes, drplist, NextemptyString); + } + + + } + } + } + + + + void setTreeDeptSelected(string toFind,TreeNode nd) + { + foreach (TreeNode cnd in nd.ChildNodes) + { + if (cnd.Value == toFind) + { + cnd.Selected = true; + break; + } + else + { + setTreeDeptSelected(toFind,cnd); + } + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LDepartment)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtDepName.Text = _logic.GetDepartment.dep_name ; + txtDepcode.Text = _logic.GetDepartment.dep_code; + txtDepDesc.Text = _logic.GetDepartment.dep_desc; + txtDepType.Text = _logic.GetDepartment.dep_type; + DropDownList1.SelectedItem.Selected = false; + if(DropDownList1.Items.FindByValue(_logic.GetDepartment.dep_manager.ToString())!=null) + { + DropDownList1.Items.FindByValue(_logic.GetDepartment.dep_manager.ToString()).Selected = true; + } + drplstDept.SelectedItem.Selected = false; + if (drplstDept.Items.FindByValue(_logic.GetDepartment.dep_mastdept.ToString()) != null) + { + drplstDept.Items.FindByValue(_logic.GetDepartment.dep_mastdept.ToString()).Selected = true; + } + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + GridView1.SelectedIndex = -1; + Databound(); + drplstDept.SelectedItem.Selected = false; + if (drplstDept.Items.FindByValue(TreeDept.SelectedNode.Value) != null) + { + drplstDept.Items.FindByValue(TreeDept.SelectedNode.Value).Selected = true; + } + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetDepartment.ID > 0 ? _logic.GetDepartment.Update() : _logic.GetDepartment.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetDepartment.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[3].Text.Trim().Equals("1"); + e.Row.Cells[3].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetDepartment.ID > 0 )) + { + _logic.GetDepartment.lastmodified = DateTime.Now.ToString(); + _logic.GetDepartment.dep_mastdept = Convert.ToInt32(TreeDept.SelectedValue); + } + + _logic.GetDepartment.dr = true; + _logic.GetDepartment.dep_name = txtDepName.Text; + _logic.GetDepartment.dep_desc = txtDepDesc.Text; + _logic.GetDepartment.dep_code = txtDepcode.Text; + _logic.GetDepartment.dep_type = txtDepType.Text; + if (DropDownList1.SelectedItem != null ) _logic.GetDepartment.dep_manager = Convert.ToInt32(DropDownList1.SelectedValue); + if (drplstDept.SelectedItem != null) _logic.GetDepartment.dep_mastdept = Convert.ToInt32(drplstDept.SelectedValue); + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtDepName.Text = ""; + txtDepcode.Text = ""; + txtDepDesc.Text = ""; + txtDepType.Text =""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["dep_name"].ToString(); + node.Value = row["pk_department"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData()); + dv.RowFilter = "dep_mastdept = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + } +} \ No newline at end of file diff --git a/Dict/.svn/text-base/DeptMain.aspx.svn-base b/Dict/.svn/text-base/DeptMain.aspx.svn-base new file mode 100644 index 0000000..4a58ec3 --- /dev/null +++ b/Dict/.svn/text-base/DeptMain.aspx.svn-base @@ -0,0 +1,123 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="DeptMain.aspx.cs" Inherits="DeptMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +   + +
+ + + + +
+ + + + + + + + +
+
+ +
+
+
+
+
+ diff --git a/Dict/.svn/text-base/EmployeeMain.aspx.cs.svn-base b/Dict/.svn/text-base/EmployeeMain.aspx.cs.svn-base new file mode 100644 index 0000000..08fea1e --- /dev/null +++ b/Dict/.svn/text-base/EmployeeMain.aspx.cs.svn-base @@ -0,0 +1,533 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using view.App_Code; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class EmployeeMain : PageBase +{ + private LEmployee _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + + _logic = new LEmployee(); + bindDeptTree(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + void bindDeptTree() + { + + DataView dvDept = new DataView(_logic.GetDepartments()); + + //װѡŽڵIJ + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + } + + + + /// + /// bound the query list. + /// + private void Databound() + { + + //󶨲ѡеIJµԱ + bindGrid(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LEmployee)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtAccount.ReadOnly = true; + txtName.Text = _logic.GetEmployee.em_name; + txtBirthday.Text = _logic.GetEmployee.em_birthday.ToString(); + txtCell.Text = _logic.GetEmployee.em_cellnum; + txtDateParty.Text = _logic.GetEmployee.em_date_in_party.ToString(); + txtID.Text = _logic.GetEmployee.em_idnum; + txtMail.Text = _logic.GetEmployee.em_email; + //txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtAccount.Text = _logic.GetEmployee.em_account; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + drplstSex.Items.FindByValue("1").Selected = true; + + if (_logic.GetEmployee.em_sex) + { + drplstSex.Items.FindByValue("0").Selected = false; + drplstSex.Items.FindByValue("1").Selected = true; + } + else + { + drplstSex.Items.FindByValue("1").Selected = false; + drplstSex.Items.FindByValue("0").Selected = true; + } + if (drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education) != null) + // drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education).Selected=true; //ListItemColleciton can only select one item, if another has been selected, this will case error. + SetDropDownlistSelection(drplstEducation, _logic.GetEmployee.em_education); + + bindGV(); + + if (drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_politic) != null) + //drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_politic).Selected = true; + SetDropDownlistSelection(drlstPlitics, _logic.GetEmployee.em_politic); + +// chkStatus.Checked = _logic.GetRole.dr; + } + + + void bindGV() + { + GvDept.DataSource = _logic.GetDepartments(_logic.GetEmployee.ID); + GvDept.DataBind(); + + } + + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + if(TreeDept.SelectedValue == "0" ) + { + ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + "alert('ѡûš');", true); + return; + } + txtAccount.ReadOnly = false; + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + GridView1.SelectedIndex = -1; + Databound(); + txtTitle.Enabled = true; + lbTitle.Visible = true; + txtTitle.Visible = true; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + // DetailDataBind(); + DataDetail.Visible = true; + bindGV(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + + bool userNotExist = true; + SetDataBack(); + if (txtName.Text.Trim().Length == 0) + { + txtName.Focus(); + bindGrid(); + // ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + // "alert('û');", true); + return; + + } + if (txtAccount.Text.Trim().Length == 0) + { + txtAccount.Focus(); + bindGrid(); + // ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert", + // "alert('û˺š');", true); + return; + } + + + + + /* + if(lem.GetEmployee.em_account !="mysec" ) + if (_logic != null) + if (_logic.GetEmployee != null) + if(_logic.GetEmployee.QueryActived().Tables[0].Rows.Count>20) + return; + */ + + if (_logic != null) + if (_logic.GetEmployee != null) + if (_logic.GetEmployee.ID > 0) + _logic.GetEmployee.Update(); + else + { + userNotExist = _logic.AddEmployee(); + + + } + if (!userNotExist) + { + ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert", + "alert('û " + txtAccount.Text + + " Ѿڣ룬ʧܡ');", true); + + bindGrid(); + + txtAccount.Text =""; + txtAccount.Focus(); + } + else + { + ClearDetail(); + Databound(); + DataDetail.Visible = false; + } + + } + void bindGrid() + { + _logic.GetEmployee.em_dept = TreeDept.SelectedValue; + DataView dv = TreeDept.SelectedValue != "0" ? new DataView(_logic.GetActiveEmpByDept(Convert.ToInt32(TreeDept.SelectedValue))) : new DataView(_logic.GetActivedEmpDept()); + dv.RowFilter = "em_name <>'Root'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + + } + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetEmployee.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + Label lb; + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + lb = new Label(); + lb.Text = e.Row.Cells[3].Text.Trim().Equals("True") ? "" : "Ů"; + e.Row.Cells[3].Controls.Add(lb); + break; + } + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if ( _logic.GetEmployee.ID >0 ) + { + _logic.GetEmployee.lastmodified = DateTime.Now.ToString(); + + if(txtPasswd.Text.Trim().Length>0) + _logic.GetEmployee.em_passwd = PublicUtils.Encrypt(txtPasswd.Text.Trim()); + } + else + { + _logic.GetEmployee.em_passwd = PublicUtils.Encrypt(txtPasswd.Text.Trim()); + } + + + + _logic.GetEmployee.dr = true; + _logic.GetEmployee.em_name = txtName.Text; + _logic.GetEmployee.em_account = txtAccount.Text; + _logic.GetEmployee.em_birthday = txtBirthday.Text; + _logic.GetEmployee.em_cellnum = txtCell.Text; + _logic.GetEmployee.em_date_in_party = txtDateParty.Text; + _logic.GetEmployee.em_date_work = txtworkdate.Text; + _logic.GetEmployee.em_education = drplstEducation.SelectedValue; + _logic.GetEmployee.em_email = txtMail.Text; + _logic.GetEmployee.em_idnum = txtID.Text; + + _logic.GetEmployee.em_politic = drlstPlitics.SelectedValue; + _logic.GetEmployee.em_sex = drplstSex.SelectedIndex == 0; + + + _logic.GetEmployee.em_dept = TreeDept.SelectedValue; + _logic.GetEmployee.em_jobcode = txtTitle.Text; + + + + + + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + lbEdit.Text = ""; + txtworkdate.Text = ""; + txtName.Text = "" ; + txtBirthday.Text = ""; + txtCell.Text = ""; + txtDateParty.Text = ""; + txtID.Text = ""; + txtMail.Text =""; + txtPasswd.Text =""; + txtAccount.Text =""; + txtTitle.Text = ""; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + txtPasswd.Text = ""; + InitDropdownlist(); + //װѡŽڵIJ + // drlstPlitics.SelectedIndex = -1; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + lbTitle.Visible = false; + txtTitle.Visible = false; + Databound(); + DetailDataBind(); + txtTitle.Enabled = false; + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["dep_name"].ToString(); + node.Value = row["pk_department"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + /* + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "em_dept = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + */ + if (_logic != null) _logic.Initialize(); + GridView1.SelectedIndex = -1; + Databound(); + + + } + protected void drplstSex_SelectedIndexChanged(object sender, EventArgs e) + { + ListItem selectedItem = drplstSex.Items[1]; + selectedItem.Selected = true; + } + + protected void InitDropdownlist() + { + + drplstSex.Items[ drplstSex.SelectedIndex].Selected = false; + drplstSex.Items.FindByValue("1").Selected = true; + + drlstPlitics.Items[drlstPlitics.SelectedIndex].Selected = false; + drlstPlitics.Items[0].Selected = true; + + } + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[11].Visible = false; + Databound(); + Export("application/ms-excel", "ϵͳûб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[11].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + + protected void GvDept_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + if (GvDept.DataKeys != null) + { + string id = GvDept.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetDeptEmp.ID = Convert.ToInt32(id); + _logic.GetDeptEmp.getModel(); + + _logic.GetDeptEmp.de_title = ((TextBox)GvDept.Rows[e.RowIndex].Cells[3].Controls[1]).Text; + + //_logic.GetTrainingDetail.operater = + _logic.GetDeptEmp.Update(); + } + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowEditing(object sender, GridViewEditEventArgs e) + { + GvDept.EditIndex = e.NewEditIndex; + GvDept.SelectedIndex = e.NewEditIndex; + bindGV(); + } + +} \ No newline at end of file diff --git a/Dict/.svn/text-base/EmployeeMain.aspx.svn-base b/Dict/.svn/text-base/EmployeeMain.aspx.svn-base new file mode 100644 index 0000000..9ae1d49 --- /dev/null +++ b/Dict/.svn/text-base/EmployeeMain.aspx.svn-base @@ -0,0 +1,297 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" + AutoEventWireup="true" CodeFile="EmployeeMain.aspx.cs" Inherits="EmployeeMain" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + * + + + + Ů + + + + + +
+ + + + + + + ޵ + йԱ + Ա + + + + +
+ + + +   + + + + + ѧ + + ʿ + ˶ʿо + + ר + ר + + + Сѧ + +
+ + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+
+ + +
+
+
+
+ + +
+
+
diff --git a/Dict/.svn/text-base/PublicNewsMain.aspx.cs.svn-base b/Dict/.svn/text-base/PublicNewsMain.aspx.cs.svn-base new file mode 100644 index 0000000..34dc58d --- /dev/null +++ b/Dict/.svn/text-base/PublicNewsMain.aspx.cs.svn-base @@ -0,0 +1,266 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using Tracen.Utils; +using ZhangPu.Gov.Logical; + +public partial class PublicNewsMain : PageBase +{ + private LPublicNews _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LPublicNews(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡڵ + DataView dv = new DataView(_logic.QueryPublicInfomation()); + + TreeAuth.SelectedNode.ChildNodes.Clear(); + BindTree(TreeAuth.SelectedNode.Value, TreeAuth.SelectedNode, dv); + //бѡе + + GridView1.DataSource = _logic.QueryNews(Convert.ToInt32(TreeAuth.SelectedValue)); + GridView1.DataBind(); + + // GVFiles.DataSource = null; + // GVFiles.DataBind(); + UpdateSession(); + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LPublicNews)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + + DataDetail.Visible = true; + txtTitle.Text = _logic.GetPublicNews.news_title; + txtDesc.Text = _logic.GetPublicNews.news_content; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + + GridView1.SelectedIndex = -1; + Databound(); + DetailDataBind(); + //todo bind attached files infomationsss\\ + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetPublicNews.ID > 0 ? _logic.GetPublicNews.Update() : _logic.GetPublicNews.Add(); + ClearDetail(); + Databound(); + lbEdit.Text = ""; + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetPublicNews.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetPublicNews.ID > 0)) + { + _logic.GetPublicNews.last_modified = DateTime.Now.ToString(); + _logic.GetPublicNews.news_authority = Convert.ToInt32(TreeAuth.SelectedValue); + } + + _logic.GetPublicNews.news_title = txtTitle.Text; + _logic.GetPublicNews.news_content = txtDesc.Text; + + //todo bind files + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtTitle.Text = ""; + txtDesc.Text = ""; + + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["auth_name"].ToString(); + node.Value = row["pk_authority"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeAuth.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + + protected void TreeAuth_SelectedNodeChanged1(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.QueryNews(Convert.ToInt32(TreeAuth.SelectedValue))); + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + } + + + + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + + + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + if (e.Row.Cells[2].Text.Trim().Length > 30) e.Row.Cells[2].Text = e.Row.Cells[2].Text.Substring(0,30)+"...."; + + break; + } + } +} \ No newline at end of file diff --git a/Dict/.svn/text-base/PublicNewsMain.aspx.svn-base b/Dict/.svn/text-base/PublicNewsMain.aspx.svn-base new file mode 100644 index 0000000..5a53297 --- /dev/null +++ b/Dict/.svn/text-base/PublicNewsMain.aspx.svn-base @@ -0,0 +1,108 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="PublicNewsMain.aspx.cs" Inherits="PublicNewsMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + + + + +
  + + +
+
+ +
+
+
+ diff --git a/Dict/.svn/text-base/RoleAuth.aspx.cs.svn-base b/Dict/.svn/text-base/RoleAuth.aspx.cs.svn-base new file mode 100644 index 0000000..3332cd7 --- /dev/null +++ b/Dict/.svn/text-base/RoleAuth.aspx.cs.svn-base @@ -0,0 +1,279 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class RoleAuth : PageBase +{ + private LRoleAuthority _logic; + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new LRoleAuthority(); + Databound(); + bindAuth(); + bindRoles(); + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + + bindGV(); + UpdateSession(); + + + } + + /// + /// Ȩ + /// + void bindAuth() + { + treeAuth.Nodes.Clear(); + BindAuthTree("0", treeAuth.SelectedNode, _logic.QueryNonePublicAuthority().DefaultView); + } + + + /// + ///󶨽ɫ + /// + private void bindRoles() + { + DataView dv = _logic.GetAllRoles().DefaultView; + dv.RowFilter = "role_4Approve =0"; + listRoles.DataSource =dv; + listRoles.DataTextField = "role_name"; + listRoles.DataValueField = "pk_role"; + listRoles.DataBind(); + } + + + + public void BindAuthTree(string id, TreeNode pNode, DataView dv ) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + string authLink = row["auth_link"].ToString(); + node.Value = row["pk_authority"].ToString(); + node.Expanded = true; + if (authLink == string.Empty || authLink.Trim().Length < 6) //not *.aspx + { + node.Text = "" + row["auth_name"] + ""; + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + } else + + { + node.Text = row["auth_name"].ToString() ; + } + + + if (pNode == null) + //˵Ǹڵ + { + + treeAuth.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindAuthTree(node.Value, node, new DataView(dv.Table)); + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRoleAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (listRoles.SelectedValue == string.Empty) return; + //ɫȨ + ArrayList al = new ArrayList(); + GetCheckedNode(treeAuth.Nodes, al); + _logic.Initialize(); +// using (TransactionScope trans = new TransactionScope()) + { + try + { + + _logic.GetRoleAuthority.Delete(Convert.ToInt32(listRoles.SelectedValue)); + // _logic.Initialize(); + foreach (string id in al) + { + _logic.GetRoleAuthority.ra_role = Convert.ToInt32(listRoles.SelectedValue); + _logic.GetRoleAuthority.ra_authority = Convert.ToInt32(id); + _logic.GetRoleAuthority.Add(); + } + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + + + } + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + private void ClearDetail() + { + + } + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + + /* + if (treeAuth.SelectedNode != null) treeAuth.SelectedNode.Selected = false; + lbAuthRole.Text = "Ȩ޽ɫ嵥" ; + GvRole.DataSource = null; + GvRole.DataBind(); + */ + + //--Ȩѡ + ArrayList autList = new ArrayList(); + DataView dv = _logic.GetRoleAuthority.QueryActived().Tables[0].DefaultView; + dv.RowFilter = "ra_role ='" + listRoles.SelectedValue + "'"; + foreach (DataRowView drv in dv) + { + autList.Add(drv["ra_authority"]); + } + SetCheckedNode(treeAuth.Nodes, autList); + + bindGV(); + + } + + + protected void treeAuth_SelectedNodeChanged(object sender, EventArgs e) + { + bindGV(); + + } + + void bindGV() + { + //ɫӦԱ嵥 + if (listRoles.SelectedItem != null) + { + + lbRoleEm.Text = listRoles.SelectedItem.Text + " ɫԱ嵥"; + GvEm.DataSource = _logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)); + } + GvEm.DataBind(); + + + //Ȩ޶ӦĽɫ,Ա嵥 + if (treeAuth.SelectedNode != null) + { + lbAuthEm.Text = treeAuth.SelectedNode.Text + " ȨԱ嵥"; + GvAuthEm.DataSource = _logic.GetEmListByAuth(Convert.ToInt32(treeAuth.SelectedValue)); + lbAuthRole.Text = treeAuth.SelectedNode.Text + " Ȩ޽ɫ嵥"; + GvRole.DataSource = _logic.GetRoleListByAuth(Convert.ToInt32(treeAuth.SelectedValue)); + + } + GvAuthEm.DataBind(); + GvRole.DataBind(); + } + +} \ No newline at end of file diff --git a/Dict/.svn/text-base/RoleAuth.aspx.svn-base b/Dict/.svn/text-base/RoleAuth.aspx.svn-base new file mode 100644 index 0000000..eae8516 --- /dev/null +++ b/Dict/.svn/text-base/RoleAuth.aspx.svn-base @@ -0,0 +1,117 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleAuth.aspx.cs" Inherits="RoleAuth" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
  + +
+ +
+ +
+ diff --git a/Dict/.svn/text-base/RoleEmp.aspx.cs.svn-base b/Dict/.svn/text-base/RoleEmp.aspx.cs.svn-base new file mode 100644 index 0000000..6343f83 --- /dev/null +++ b/Dict/.svn/text-base/RoleEmp.aspx.cs.svn-base @@ -0,0 +1,277 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class RoleEmp : PageBase +{ + private LRoleAuthority _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LRoleAuthority(); + Databound(); + bindRoles(); + bindDeptEmp(); //ɫʱʼԱ + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + // if (!isRoleAuth) bindDeptEmp(); //ɫʱʼԱ + bindGV(); + UpdateSession(); + + + } + + + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + BindTree("0", TreeDeptEmp.SelectedNode, new LEmployee().GetDepartments().DefaultView, new LEmployee().GetActivedEmpDept().DefaultView); + + + } + + /// + ///󶨽ɫ + /// + private void bindRoles() + { + + listRoles.DataSource = _logic.GetAllRoles(); + listRoles.DataTextField = "role_name"; + listRoles.DataValueField = "pk_role"; + listRoles.DataBind(); + } + + public void BindTree(string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + "" + row["pk_department"]; + node.Value = row["pk_department"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , emrow["pk_employee"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeDeptEmp.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRoleAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (listRoles.SelectedValue == string.Empty) return; + ArrayList al = new ArrayList(); + + GetCheckedNode(TreeDeptEmp.Nodes, al); + _logic.Initialize(); + // using (TransactionScope trans = new TransactionScope()) + { + try + { + + _logic.GetRoleEmp.Delete(Convert.ToInt32(listRoles.SelectedValue)); + + foreach (string id in al) + { + _logic.GetRoleEmp.re_role = Convert.ToInt32(listRoles.SelectedValue); + _logic.GetRoleEmp.re_employee = Convert.ToInt32(id); + _logic.GetRoleEmp.Add(); + } + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + + + } + + + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + + //--Աѡ + /* + if (TreeDeptEmp.SelectedNode != null) TreeDeptEmp.SelectedNode.Selected = false; + + lbAuthRole.Text = "Աɫ嵥"; + GvRole.DataSource = null; + GvRole.DataBind(); + * */ + //--ѡԱѡ + + ArrayList empList = new ArrayList(); + DataTable dt =_logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)) ; + foreach (DataRow dr in dt.Rows) + { + empList.Add(dr["pk_employee"]); + } + SetCheckedNode(TreeDeptEmp.Nodes, empList); + + bindGV(); + + } + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + + bindGV(); + + } + + + void bindGV( ) + { + //ԱɫȨ嵥 + string nodevalue = TreeDeptEmp.SelectedValue; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmRole.Text = TreeDeptEmp.SelectedNode.Text + " Աɫ嵥"; + GvRole.DataSource = _logic.GetRoleByEm(Convert.ToInt32(nodevalue)); + + lbEmAuth.Text = TreeDeptEmp.SelectedNode.Text + " ԱȨ嵥"; + GVauth.DataSource = _logic.GetAuthByEm(Convert.ToInt32(nodevalue)); + + } + GvRole.DataBind(); + GVauth.DataBind(); + + //ɫӦԱ嵥 + if (listRoles.SelectedItem != null) + { + + lbRoleEm.Text = listRoles.SelectedItem.Text + " ɫԱ嵥"; + GvEm.DataSource = _logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)); + } + GvEm.DataBind(); + } + +} \ No newline at end of file diff --git a/Dict/.svn/text-base/RoleEmp.aspx.svn-base b/Dict/.svn/text-base/RoleEmp.aspx.svn-base new file mode 100644 index 0000000..5f20ccd --- /dev/null +++ b/Dict/.svn/text-base/RoleEmp.aspx.svn-base @@ -0,0 +1,125 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleEmp.aspx.cs" Inherits="RoleEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
  + +
+ +
+ +
+ diff --git a/Dict/.svn/text-base/RoleMain.aspx.cs.svn-base b/Dict/.svn/text-base/RoleMain.aspx.cs.svn-base new file mode 100644 index 0000000..04c8183 --- /dev/null +++ b/Dict/.svn/text-base/RoleMain.aspx.cs.svn-base @@ -0,0 +1,235 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class RoleMain : PageBase +{ + private LRole _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LRole(); + Databound(); + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = _logic.GetAllActiveData().Tables[0]; + GridView1.DataBind(); + UpdateSession(); + + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRole)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + chkApprove.Checked=_logic.GetRole.role_4Approve ; + txtJobName.Text = _logic.GetRole.role_name; + txtJobDesc.Text = _logic.GetRole.role_desc; +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + Databound(); + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + txtJobName.Focus(); + GridView1.SelectedIndex = -1; + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + txtJobName.Focus(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + if (txtJobDesc.Text.Trim().Length + txtJobName.Text.Trim().Length == 0) + { + txtJobName.Focus(); + Databound(); + DataDetail.Visible = true; + ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + "alert('ɫơ');", true); + return; + + } + int oper = 0; + oper = _logic.GetRole.ID > 0 ? _logic.GetRole.Update() : _logic.GetRole.Add(); + ClearDetail(); + + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetRole.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[3].Text.Trim().Equals("True"); + e.Row.Cells[3].Controls.Add(chk); + } + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + + string sortExpression = e.SortExpression; + if (GridView1.SortDirection == SortDirection.Ascending) // + { + + SortGridView(sortExpression, " DESC"); + } + else + { + + SortGridView(sortExpression, " ASC"); + } + } + private void SortGridView(string sortExpression, string direction) + { + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.Sort = sortExpression + direction; + GridView1.DataSource = dv; //DataView󶨵GridView + GridView1.DataBind(); + + } + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + if (_logic.GetRole.ID > 0) + _logic.GetRole.lastmodified = DateTime.Now.ToString(); + _logic.GetRole.dr = true; + _logic.GetRole.role_name = txtJobName.Text; + _logic.GetRole.role_desc = txtJobDesc.Text; + _logic.GetRole.role_4Approve = chkApprove.Checked; + } + + private void chgOperTxt(bool addNew) + { + btnSubmit.Enabled = true; + DataDetail.Visible = true; + } + + private void ClearDetail() + { + chkApprove.Checked = false; + txtJobName.Text = ""; + txtJobDesc.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + +} \ No newline at end of file diff --git a/Dict/.svn/text-base/RoleMain.aspx.svn-base b/Dict/.svn/text-base/RoleMain.aspx.svn-base new file mode 100644 index 0000000..930cb28 --- /dev/null +++ b/Dict/.svn/text-base/RoleMain.aspx.svn-base @@ -0,0 +1,123 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleMain.aspx.cs" Inherits="RoleMain" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + * + + + +   +   + + + * +
+ + +
+ +
+
+ + + + + + +
  +
+
+ + + + +
+ +
+ +
+ diff --git a/Dict/AuthorityMain.aspx b/Dict/AuthorityMain.aspx new file mode 100644 index 0000000..6c74957 --- /dev/null +++ b/Dict/AuthorityMain.aspx @@ -0,0 +1,168 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="AuthorityMain.aspx.cs" Inherits="ajax.Dict.AuthorityMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + +
+
+   +
+
+
+
+
diff --git a/Dict/AuthorityMain.aspx.cs b/Dict/AuthorityMain.aspx.cs new file mode 100644 index 0000000..5fc5569 --- /dev/null +++ b/Dict/AuthorityMain.aspx.cs @@ -0,0 +1,350 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +namespace ajax.Dict +{ + public partial class AuthorityMain :PageBase + { + private LAuthority _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LAuthority(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡŽڵIJ + DataView dv = new DataView(_logic.getAllActiveData().Tables[0]); + + if (TreeAuth.SelectedNode != null) + { + TreeAuth.SelectedNode.ChildNodes.Clear(); + BindTree(TreeAuth.SelectedNode.Value, TreeAuth.SelectedNode, dv); + + //бѡеIJµв + dv.RowFilter = "auth_uplevel = '" + TreeAuth.SelectedValue + "'"; + } + GridView1.DataSource = dv; + GridView1.DataBind(); + UpdateSession(); + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + //ϢurlΪpublic + LAuthority ltmp = new LAuthority(); + ltmp.Initialize(Convert.ToInt32(TreeAuth.SelectedValue)); + chkPublic.Enabled = !ltmp.GetAuthority.auth_publicInfomation; + chkPublicInfo.Enabled = !ltmp.GetAuthority.auth_publicInfomation; + chkAlert.Enabled =!chkPublicInfo.Enabled; //ƵϼǹϢ + if (chkPublicInfo.Checked) + { + txtLink.Enabled = false; + txtFormClass.Enabled = false; + } + DataDetail.Visible = true; + txtName.Text = _logic.GetAuthority.auth_name; + txtDesc.Text = _logic.GetAuthority.auth_desc; + txtLink.Text = _logic.GetAuthority.auth_link; + txtFormClass.Text = _logic.GetAuthority.auth_class; + chkPublic.Checked = _logic.GetAuthority.auth_public; + chkPublicInfo.Checked = _logic.GetAuthority.auth_publicInfomation; + chkSpecial.Checked = _logic.GetAuthority.auth_special; + txtOrder.Text = _logic.GetAuthority.auth_order + ""; + //ϼΪϢ¼Ҳ + if(ltmp.GetAuthority.auth_publicInfomation) + chkPublicInfo.Checked = ltmp.GetAuthority.auth_publicInfomation; + if (ltmp.GetAuthority.auth_public) + chkPublic.Checked = ltmp.GetAuthority.auth_public; + chkAlert.Checked = _logic.GetAuthority.auth_marqueen; + chkPublic.Checked = _logic.GetAuthority.auth_public; + chkEnable.Checked = _logic.GetAuthority.dr; + ltmp = null; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + GridView1.SelectedIndex = -1; + Databound(); + DetailDataBind(); + + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetAuthority.ID > 0 ? _logic.GetAuthority.Update() : _logic.GetAuthority.Add(); + ClearDetail(); + Databound(); + lbEdit.Text = ""; + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetAuthority.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetAuthority.ID > 0)) + { + // _logic.GetAuthority.lastmodified = DateTime.Now.ToString(); + _logic.GetAuthority.auth_uplevel = Convert.ToInt32(TreeAuth.SelectedValue); + } + + _logic.GetAuthority.auth_name = txtName.Text; + _logic.GetAuthority.auth_desc = txtDesc.Text; + _logic.GetAuthority.auth_link = txtLink.Text; + _logic.GetAuthority.auth_class = txtFormClass.Text; + _logic.GetAuthority.auth_public = chkPublic.Checked; + _logic.GetAuthority.auth_publicInfomation =chkPublicInfo.Checked ; + _logic.GetAuthority.auth_marqueen = chkAlert.Checked; + _logic.GetAuthority.auth_special = chkSpecial.Checked; + _logic.GetAuthority.auth_order = Convert.ToInt16( txtOrder.Text.Trim()); + _logic.GetAuthority.dr = chkEnable.Checked; + + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + txtLink.Text =""; + txtLink.Text = ""; + chkPublic.Checked = false; + chkPublicInfo.Checked = false; + DataDetail.Visible = false; + chkSpecial.Checked = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["auth_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeAuth.Nodes.Add(node); + node.Expanded = false; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = false; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + + protected void TreeAuth_SelectedNodeChanged1(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.getAllActiveData().Tables[0]); + dv.RowFilter = "auth_uplevel = '" + TreeAuth.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + if(TreeAuth.SelectedNode.ChildNodes.Count>0)TreeAuth.SelectedNode.Expand(); + } + + protected void chkPublicInfo_CheckedChanged(object sender, EventArgs e) + { + switch (chkPublicInfo.Checked) + { + case true: + txtLink.Text = string.Empty; + txtLink.Enabled = false; + txtFormClass.Text = string.Empty; + txtFormClass.Enabled = false; + chkPublic.Checked = true; + chkPublic.Enabled = false; + break; + + case false: + txtLink.Text = _logic.GetAuthority.auth_link; + txtFormClass.Text = _logic.GetAuthority.auth_class; + txtFormClass.Enabled = true; + txtLink.Enabled = true ; + chkPublic.Checked = false; + chkPublic.Enabled = true; + break; + + } + + } + + protected void chkSpecial_CheckedChanged(object sender, EventArgs e) + { + + + } + + + protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e) + { + + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[4].Text.Trim().Equals("True"); + e.Row.Cells[4].Controls.Add(chk); + + + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[5].Text.Trim().Equals("True"); + e.Row.Cells[5].Controls.Add(chk); + + + } + } + } +} \ No newline at end of file diff --git a/Dict/DeptEmp.aspx b/Dict/DeptEmp.aspx new file mode 100644 index 0000000..18a5a51 --- /dev/null +++ b/Dict/DeptEmp.aspx @@ -0,0 +1,90 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="DeptEmp.aspx.cs" Inherits="DeptEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + +
+
+
+   +
+
+
+
diff --git a/Dict/DeptEmp.aspx.cs b/Dict/DeptEmp.aspx.cs new file mode 100644 index 0000000..3a16c1d --- /dev/null +++ b/Dict/DeptEmp.aspx.cs @@ -0,0 +1,309 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; +using DeiNiu.wms.Data.Model; + +public partial class DeptEmp : PageBase +{ + private LEmployee _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LEmployee(); + + Databound(); + + //ɫʱʼԱ + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + bindGV(); + UpdateSession(); + bindDept(); + bindDeptEmp(); + + + } + + /// + /// 󶨲 + /// + private void bindDept() + { + TreeDept.Nodes.Clear(); + BindTree(TreeDept, "0", TreeDept.SelectedNode, _logic.GetDepartments().DefaultView); + SetTreeDeptChecked(); + + } + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode, _logic.GetDepartments().DefaultView, _logic.GetActivedEmpDept().DefaultView); + + + + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = row["ID"].ToString() + "_" + row["dep_name"] + "" ; + node.Value = row["ID"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , emrow["empId"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + tree.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(tree,node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + public void BindTree(TreeView tree, string id, TreeNode pNode, DataView deptdv ) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + + TreeNode node = new TreeNode(); + node.Text = row["ID"].ToString() +"_" + row["dep_name"].ToString() + ""; + node.Value = row["ID"].ToString(); + + node.SelectAction = TreeNodeSelectAction.None; + + // node.ShowCheckBox = Convert.ToInt16(row["dep_type"].ToString()) == 1; + + node.Expanded = true; + + if (pNode == null) + //˵Ǹڵ + { + tree.Nodes.Add(node); + } + else + { + pNode.ChildNodes.Add(node); + } + BindTree(tree, node.Value, node, new DataView(deptdv.Table)); + + } + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LEmployee)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (TreeDeptEmp.SelectedNode== null) return; + ArrayList al = new ArrayList(); + + GetCheckedNode(TreeDept.Nodes, al); + _logic.Initialize(); +// using (TransactionScope trans = new TransactionScope()) + { + try + { + _logic.GetDeptEmp.Delete(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + + foreach (string id in al) + { + _logic.GetDeptEmp.de_dept = Convert.ToInt32(id); + _logic.GetDeptEmp.de_employee = Convert.ToInt32(TreeDeptEmp.SelectedValue); + _logic.GetDeptEmp.Add(); + } + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + + + } + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + void SetTreeDeptChecked() + { + if( TreeDeptEmp.SelectedNode ==null) return; + ArrayList deptList = new ArrayList(); + DataTable dt = _logic.GetDepartments(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + foreach (DataRow dr in dt.Rows) + { + deptList.Add(dr["de_dept"]); + } + SetCheckedNode(TreeDept.Nodes, deptList); + } + + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GvDept.SelectedIndex = -1; + SetTreeDeptChecked(); + bindGV(); + + } + + + void bindGV( ) + { + //Ա嵥 + string nodevalue = TreeDeptEmp.SelectedValue; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmDept.Text = TreeDeptEmp.SelectedNode.Text + " Ա嵥"; + GvDept.DataSource = _logic.GetDepartments(Convert.ToInt32(nodevalue)); + + + } + GvDept.DataBind(); + + } + + protected void GvDept_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + if (GvDept.DataKeys != null) + { + string id = GvDept.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetDeptEmp.ID = Convert.ToInt32(id); + _logic.GetDeptEmp.getModel(); + + _logic.GetDeptEmp.de_title = ((TextBox)GvDept.Rows[e.RowIndex].Cells[3].Controls[1]).Text; + + //_logic.GetTrainingDetail.operater = + _logic.GetDeptEmp.Update(); + } + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowEditing(object sender, GridViewEditEventArgs e) + { + GvDept.EditIndex = e.NewEditIndex; + GvDept.SelectedIndex = e.NewEditIndex; + bindGV(); + } +} \ No newline at end of file diff --git a/Dict/DeptMain.aspx b/Dict/DeptMain.aspx new file mode 100644 index 0000000..1066dc5 --- /dev/null +++ b/Dict/DeptMain.aspx @@ -0,0 +1,144 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="DeptMain.aspx.cs" Inherits="DeptMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +   + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + +
+
+ +
+
+
+
+
+ diff --git a/Dict/DeptMain.aspx.cs b/Dict/DeptMain.aspx.cs new file mode 100644 index 0000000..29eb013 --- /dev/null +++ b/Dict/DeptMain.aspx.cs @@ -0,0 +1,429 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; +using DeiNiu.wms.Data.Model; + +public partial class DeptMain : PageBase +{ + private LDepartment _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LDepartment(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨲б + drplstDept.DataSource = _logic.GetAllActiveData(); + drplstDept.DataTextField = "dep_name"; + drplstDept.DataValueField = "ID"; + drplstDept.DataBind(); + + + + + drplstDept.Items.Insert(0, (new ListItem("WMS", "0"))); + drplstDept.SelectedItem.Selected = false; + drplstDept.Items.FindByText("WMS").Selected = true; + + + + //󶨲Աб + DropDownList1.DataSource = _logic.GetEmployees(); + DropDownList1.DataTextField = "em_name"; + DropDownList1.DataValueField = "ID"; + DropDownList1.DataBind(); + DropDownList1.Items.Insert(0,(new ListItem("ѡ...","0"))); + DropDownList1.SelectedItem.Selected = false; + DropDownList1.Items.FindByText("ѡ...").Selected = true; + //װѡŽڵIJ + + dlstDeptType.Items.Clear(); + dlstDeptType.Items.Add(new ListItem("ͨ", "0")); + dlstDeptType.Items.Add(new ListItem("ֹ", "1")); + dlstDeptType.Items.Add(new ListItem("ֿ", "2")); + dlstDeptType.Items.Add(new ListItem("", "3")); + DataView dv = _logic.GetAllActiveData().DefaultView; + string selectedValue = TreeDept.SelectedValue; + TreeDept.Nodes.Clear(); + TreeDept.Nodes.Add(new TreeNode("WMS", "0")); + TreeDept.Nodes[0].Expanded = true; + BindTree("0", TreeDept.Nodes[0], dv); + // TreeDept.SelectedNode.ChildNodes.Clear(); + // BindTree(TreeDept.SelectedValue, TreeDept.SelectedNode, dv); + // TreeDept.Nodes.AddAt(0, new TreeNode("WMS", "0")); + if (selectedValue == "0") TreeDept.Nodes[0].Selected = true; + else + { + setTreeDeptSelected(selectedValue, TreeDept.Nodes[0]); + } + dv.RowFilter = "dep_mastdept = '" + selectedValue + "'"; + bindGridview(dv); + + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + + + drplstDept.Items.Clear(); + initializeDrlstDept(TreeDept.Nodes, drplstDept ,""); + } + + void bindGridview(DataView dv ) + { + + //бѡеIJµв + + + foreach (DataRowView drv in dv) + { + foreach (ListItem li in dlstDeptType.Items) + { + if (drv["dep_type"].ToString().Equals(li.Value)) + { + drv.Row["typeName"] = li.Text; + } + } + } + + GridView1.DataSource = dv; + GridView1.DataBind(); + } + + void initializeDrlstDept(TreeNodeCollection nds, DropDownList drplist, string emptyString) + { + + + foreach (TreeNode nd in nds) + { + + ListItem li = new ListItem(emptyString + nd.Text,nd.Value); + drplist.Items.Add(li); + string NextemptyString = emptyString+ "----"; + foreach (TreeNode nd1 in nd.ChildNodes) + { + li = new ListItem(NextemptyString + nd1.Text, nd1.Value); + drplist.Items.Add(li); + + if (nd1.ChildNodes.Count > 0) + { + NextemptyString +="----"; + initializeDrlstDept(nd1.ChildNodes, drplist, NextemptyString); + } + + + } + } + } + + + + void setTreeDeptSelected(string toFind,TreeNode nd) + { + foreach (TreeNode cnd in nd.ChildNodes) + { + if (cnd.Value == toFind) + { + cnd.Selected = true; + break; + } + else + { + setTreeDeptSelected(toFind,cnd); + } + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LDepartment)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtDepName.Text = _logic.GetDepartment.dep_name ; + txtDepcode.Text = _logic.GetDepartment.dep_code; + txtDepDesc.Text = _logic.GetDepartment.dep_desc; + txtSvrAddress.Text = _logic.GetDepartment.svrAdress; + // txtDepType.Text = _logic.GetDepartment.dep_type+""; + DropDownList1.SelectedItem.Selected = false; + if(DropDownList1.Items.FindByValue(_logic.GetDepartment.dep_manager.ToString())!=null) + { + DropDownList1.Items.FindByValue(_logic.GetDepartment.dep_manager.ToString()).Selected = true; + } + drplstDept.SelectedItem.Selected = false; + if (drplstDept.Items.FindByValue(_logic.GetDepartment.dep_mastdept.ToString()) != null) + { + drplstDept.Items.FindByValue(_logic.GetDepartment.dep_mastdept.ToString()).Selected = true; + } + dlstDeptType.SelectedItem.Selected = false; + if (dlstDeptType.Items.FindByValue(_logic.GetDepartment.dep_type.ToString()) != null) + { + dlstDeptType.Items.FindByValue(_logic.GetDepartment.dep_type.ToString()).Selected = true; + } + + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + GridView1.SelectedIndex = -1; + Databound(); + drplstDept.SelectedItem.Selected = false; + if (drplstDept.Items.FindByValue(TreeDept.SelectedNode.Value) != null) + { + drplstDept.Items.FindByValue(TreeDept.SelectedNode.Value).Selected = true; + } + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + if (_logic.GetDepartment.ID > 0) + { + _logic.GetDepartment.Update(); + } + else + { + _logic.GetDepartment.Add(); + if (_logic.GetDepartment.warehouse == 0 && _logic.GetDepartment.dep_type==1) + { + _logic.GetDepartment.warehouse = _logic.GetDepartment.ID; + _logic.GetDepartment.Update(); + } + } + + + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetDepartment.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[3].Text.Trim().Equals("1"); + e.Row.Cells[3].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetDepartment.ID > 0 )) + { + // _logic.GetDepartment.lastmodified = DateTime.Now.ToString(); + _logic.GetDepartment.dep_mastdept = Convert.ToInt32(TreeDept.SelectedValue); + } + + // _logic.GetDepartment.dr = true; + _logic.GetDepartment.dep_name = txtDepName.Text; + _logic.GetDepartment.dep_desc = txtDepDesc.Text; + _logic.GetDepartment.dep_code = txtDepcode.Text; + _logic.GetDepartment.svrAdress = txtSvrAddress.Text; + if (dlstDeptType.SelectedItem != null) _logic.GetDepartment.dep_type = Convert.ToInt16(dlstDeptType.SelectedValue); + if (DropDownList1.SelectedItem != null ) _logic.GetDepartment.dep_manager = Convert.ToInt32(DropDownList1.SelectedValue); + if (drplstDept.SelectedItem != null) _logic.GetDepartment.dep_mastdept = Convert.ToInt32(drplstDept.SelectedValue); + + if (_logic.GetDepartment.dep_type != (int)enumDepartmentType.ֿ)//ŲDzֿ + { + if (_logic.GetDepartment.dep_mastdept > 0) //̳ϼŵIJֿ + { + Department dept = new Department(_logic.GetDepartment.dep_mastdept); + if (dept.dep_type != 1) + { + _logic.GetDepartment.warehouse = dept.warehouse; + } + else + { + _logic.GetDepartment.warehouse = dept.ID; + } + } + } + else + { + _logic.GetDepartment.warehouse = _logic.GetDepartment.ID; + + } + + + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtDepName.Text = ""; + txtDepcode.Text = ""; + txtDepDesc.Text = ""; + //txtDepType.Text =""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["dep_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData()); + dv.RowFilter = "dep_mastdept = '" + TreeDept.SelectedValue + "'"; + bindGridview(dv); + ClearDetail(); + } +} \ No newline at end of file diff --git a/Dict/EmployeeMain.aspx b/Dict/EmployeeMain.aspx new file mode 100644 index 0000000..6c220e3 --- /dev/null +++ b/Dict/EmployeeMain.aspx @@ -0,0 +1,290 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" + AutoEventWireup="true" CodeFile="EmployeeMain.aspx.cs" Inherits="EmployeeMain" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + * + + + + Ů + +   +  
+ + + + + + + ֿԱ + Ա + +   +  
+ + + +   + + + + + + ѧ + + ʿ + ˶ʿо + + ר + ר + + + Сѧ + +
+ + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + +   +   + +
+ +
+
+ + +
+
+
+
+ + +
+
+
diff --git a/Dict/EmployeeMain.aspx.cs b/Dict/EmployeeMain.aspx.cs new file mode 100644 index 0000000..544f18f --- /dev/null +++ b/Dict/EmployeeMain.aspx.cs @@ -0,0 +1,534 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using view.App_Code; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class EmployeeMain : PageBase +{ + private LEmployee _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + + _logic = new LEmployee(); + bindDeptTree(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + void bindDeptTree() + { + + DataView dvDept = new DataView(_logic.GetDepartments()); + + //װѡŽڵIJ + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + } + + + + /// + /// bound the query list. + /// + private void Databound() + { + + //󶨲ѡеIJµԱ + bindGrid(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LEmployee)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtAccount.ReadOnly = true; + txtName.Text = _logic.GetEmployee.em_name; + txtBirthday.Text = _logic.GetEmployee.em_birthday.ToString(); + txtCell.Text = _logic.GetEmployee.em_cellnum; + + txtID.Text = _logic.GetEmployee.em_idnum; + txtMail.Text = _logic.GetEmployee.em_email; + //txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtAccount.Text = _logic.GetEmployee.em_account; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + drplstSex.Items.FindByValue("1").Selected = true; + + if (_logic.GetEmployee.em_sex) + { + drplstSex.Items.FindByValue("0").Selected = false; + drplstSex.Items.FindByValue("1").Selected = true; + } + else + { + drplstSex.Items.FindByValue("1").Selected = false; + drplstSex.Items.FindByValue("0").Selected = true; + } + if (drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education) != null) + // drplstEducation.Items.FindByValue(_logic.GetEmployee.em_education).Selected=true; //ListItemColleciton can only select one item, if another has been selected, this will case error. + SetDropDownlistSelection(drplstEducation, _logic.GetEmployee.em_education); + + bindGV(); + + if (drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_type) != null) + //drlstPlitics.Items.FindByValue(_logic.GetEmployee.em_politic).Selected = true; + SetDropDownlistSelection(drlstPlitics, _logic.GetEmployee.em_type); + +// chkStatus.Checked = _logic.GetRole.dr; + } + + + void bindGV() + { + GvDept.DataSource = _logic.GetDepartments(_logic.GetEmployee.ID); + GvDept.DataBind(); + + } + + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + if(TreeDept.SelectedValue == "0" ) + { + ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + "alert('ѡûš');", true); + return; + } + txtAccount.ReadOnly = false; + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + GridView1.SelectedIndex = -1; + Databound(); + txtTitle.Enabled = true; + lbTitle.Visible = true; + txtTitle.Visible = true; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + // DetailDataBind(); + DataDetail.Visible = true; + bindGV(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + + bool userNotExist = true; + SetDataBack(); + if (txtName.Text.Trim().Length == 0) + { + txtName.Focus(); + bindGrid(); + // ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + // "alert('û');", true); + return; + + } + if (txtAccount.Text.Trim().Length == 0) + { + txtAccount.Focus(); + bindGrid(); + // ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert", + // "alert('û˺š');", true); + return; + } + + + + + /* + if(lem.GetEmployee.em_account !="mysec" ) + if (_logic != null) + if (_logic.GetEmployee != null) + if(_logic.GetEmployee.QueryActived().Tables[0].Rows.Count>20) + return; + */ + + if (_logic != null) + if (_logic.GetEmployee != null) + if (_logic.GetEmployee.ID > 0) + _logic.GetEmployee.Update(); + else + { + userNotExist = _logic.AddEmployee(); + + + } + if (!userNotExist) + { + ScriptManager.RegisterStartupScript(btnSubmit, typeof (UpdatePanel), "alert", + "alert('û " + txtAccount.Text + + " Ѿڣ룬ʧܡ');", true); + + bindGrid(); + + txtAccount.Text =""; + txtAccount.Focus(); + } + else + { + ClearDetail(); + Databound(); + DataDetail.Visible = false; + } + + } + void bindGrid() + { + _logic.GetEmployee.em_dept = TreeDept.SelectedValue; + DataView dv = TreeDept.SelectedValue != "0" + ? new DataView(_logic.GetActiveEmpByDept(Convert.ToInt32(TreeDept.SelectedValue))) + : new DataView(_logic.GetActivedEmpDept()); + dv.RowFilter = "em_name <>'Root'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + + } + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetEmployee.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + Label lb; + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + lb = new Label(); + lb.Text = e.Row.Cells[3].Text.Trim().Equals("True") ? "" : "Ů"; + e.Row.Cells[3].Controls.Add(lb); + break; + } + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if ( _logic.GetEmployee.ID >0 ) + { + // _logic.GetEmployee.lastmodified = DateTime.Now.ToString(); + + if(txtPasswd.Text.Trim().Length>0) + _logic.GetEmployee.em_passwd = Util.Encrypt(txtPasswd.Text.Trim()); + } + else + { + _logic.GetEmployee.em_passwd = Util.Encrypt(txtPasswd.Text.Trim()); + } + + + + // _logic.GetEmployee.dr = true; + _logic.GetEmployee.em_name = txtName.Text; + _logic.GetEmployee.em_account = txtAccount.Text; + _logic.GetEmployee.em_birthday = txtBirthday.Text; + _logic.GetEmployee.em_cellnum = txtCell.Text; + + _logic.GetEmployee.em_education = drplstEducation.SelectedValue; + _logic.GetEmployee.em_email = txtMail.Text; + _logic.GetEmployee.em_idnum = txtID.Text; + + _logic.GetEmployee.em_type = drlstPlitics.SelectedValue; + _logic.GetEmployee.em_sex = drplstSex.SelectedIndex == 0; + + + _logic.GetEmployee.em_dept = TreeDept.SelectedValue; + _logic.GetEmployee.em_jobcode = txtTitle.Text; + + + + + + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + lbEdit.Text = ""; + + txtName.Text = "" ; + txtBirthday.Text = ""; + txtCell.Text = ""; + + txtID.Text = ""; + txtMail.Text =""; + txtPasswd.Text =""; + txtAccount.Text =""; + txtTitle.Text = ""; + lbSelectedDept.Text = TreeDept.SelectedNode.Text; + txtPasswd.Text = ""; + InitDropdownlist(); + //װѡŽڵIJ + // drlstPlitics.SelectedIndex = -1; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + lbTitle.Visible = false; + txtTitle.Visible = false; + Databound(); + DetailDataBind(); + txtTitle.Enabled = false; + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["dep_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + /* + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "em_dept = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + */ + if (_logic != null) _logic.Initialize(); + GridView1.SelectedIndex = -1; + Databound(); + + + } + protected void drplstSex_SelectedIndexChanged(object sender, EventArgs e) + { + ListItem selectedItem = drplstSex.Items[1]; + selectedItem.Selected = true; + } + + protected void InitDropdownlist() + { + + drplstSex.Items[ drplstSex.SelectedIndex].Selected = false; + drplstSex.Items.FindByValue("1").Selected = true; + + drlstPlitics.Items[drlstPlitics.SelectedIndex].Selected = false; + drlstPlitics.Items[0].Selected = true; + + } + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[11].Visible = false; + Databound(); + Export("application/ms-excel", "WMSϵͳûб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[11].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + + protected void GvDept_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + if (GvDept.DataKeys != null) + { + string id = GvDept.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetDeptEmp.ID = Convert.ToInt32(id); + _logic.GetDeptEmp.getModel(); + + _logic.GetDeptEmp.de_title = ((TextBox)GvDept.Rows[e.RowIndex].Cells[3].Controls[1]).Text; + + //_logic.GetTrainingDetail.operater = + _logic.GetDeptEmp.Update(); + } + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvDept.EditIndex = -1; + GvDept.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvDept_RowEditing(object sender, GridViewEditEventArgs e) + { + GvDept.EditIndex = e.NewEditIndex; + GvDept.SelectedIndex = e.NewEditIndex; + bindGV(); + } + +} \ No newline at end of file diff --git a/Dict/PublicNewsMain.aspx b/Dict/PublicNewsMain.aspx new file mode 100644 index 0000000..7b8f358 --- /dev/null +++ b/Dict/PublicNewsMain.aspx @@ -0,0 +1,108 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="PublicNewsMain.aspx.cs" Inherits="PublicNewsMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + + + + + +
  + + +
+
+ +
+
+
+ diff --git a/Dict/PublicNewsMain.aspx.cs b/Dict/PublicNewsMain.aspx.cs new file mode 100644 index 0000000..ca31d40 --- /dev/null +++ b/Dict/PublicNewsMain.aspx.cs @@ -0,0 +1,266 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.Utils; +using DeiNiu.wms.Logical; + +public partial class PublicNewsMain : PageBase +{ + private LPublicNews _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LPublicNews(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡڵ + DataView dv = new DataView(_logic.QueryPublicInfomation()); + + TreeAuth.SelectedNode.ChildNodes.Clear(); + BindTree(TreeAuth.SelectedNode.Value, TreeAuth.SelectedNode, dv); + //бѡе + + GridView1.DataSource = _logic.QueryNews(Convert.ToInt32(TreeAuth.SelectedValue)); + GridView1.DataBind(); + + // GVFiles.DataSource = null; + // GVFiles.DataBind(); + UpdateSession(); + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LPublicNews)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + + DataDetail.Visible = true; + txtTitle.Text = _logic.GetPublicNews.news_title; + txtDesc.Text = _logic.GetPublicNews.news_content; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + + GridView1.SelectedIndex = -1; + Databound(); + DetailDataBind(); + //todo bind attached files infomationsss\\ + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetPublicNews.ID > 0 ? _logic.GetPublicNews.Update() : _logic.GetPublicNews.Add(); + ClearDetail(); + Databound(); + lbEdit.Text = ""; + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetPublicNews.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetPublicNews.ID > 0)) + { + //_logic.GetPublicNews.last_modified = DateTime.Now.ToString(); + _logic.GetPublicNews.news_authority = Convert.ToInt32(TreeAuth.SelectedValue); + } + + _logic.GetPublicNews.news_title = txtTitle.Text; + _logic.GetPublicNews.news_content = txtDesc.Text; + + //todo bind files + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtTitle.Text = ""; + txtDesc.Text = ""; + + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["auth_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeAuth.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + + protected void TreeAuth_SelectedNodeChanged1(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.QueryNews(Convert.ToInt32(TreeAuth.SelectedValue))); + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + } + + + + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + + + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + if (e.Row.Cells[2].Text.Trim().Length > 30) e.Row.Cells[2].Text = e.Row.Cells[2].Text.Substring(0,30)+"...."; + + break; + } + } +} \ No newline at end of file diff --git a/Dict/RoleAuth.aspx b/Dict/RoleAuth.aspx new file mode 100644 index 0000000..07b4c39 --- /dev/null +++ b/Dict/RoleAuth.aspx @@ -0,0 +1,120 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleAuth.aspx.cs" Inherits="RoleAuth" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
  + +    + + +
+ +
+ +
+ diff --git a/Dict/RoleAuth.aspx.cs b/Dict/RoleAuth.aspx.cs new file mode 100644 index 0000000..c821261 --- /dev/null +++ b/Dict/RoleAuth.aspx.cs @@ -0,0 +1,285 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class RoleAuth : PageBase +{ + private LRoleAuthority _logic; + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new LRoleAuthority(); + Databound(); + bindAuth(); + bindRoles(); + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + + bindGV(); + UpdateSession(); + + + } + + /// + /// Ȩ + /// + void bindAuth() + { + treeAuth.Nodes.Clear(); + BindAuthTree("0", treeAuth.SelectedNode, _logic.QueryNonePublicAuthority().DefaultView); + } + + + /// + ///󶨽ɫ + /// + private void bindRoles() + { + DataView dv = _logic.GetAllRoles().DefaultView; + dv.RowFilter = "role_4Approve =0"; + listRoles.DataSource =dv; + listRoles.DataTextField = "role_name"; + listRoles.DataValueField = "ID"; + listRoles.DataBind(); + } + + + + public void BindAuthTree(string id, TreeNode pNode, DataView dv ) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + string authLink = row["auth_link"].ToString(); + string authForm = row["auth_class"].ToString(); + node.Value = row["ID"].ToString(); + node.Expanded = true; + string authLevel = row["auth_uplevel"].ToString(); + // if (authForm == string.Empty && (authLink == string.Empty || authLink.Trim().Length < 6)) //not *.aspx + if (authLevel.Equals("0")) + { + node.Text = "" + row["auth_name"] + ""; + node.SelectAction = TreeNodeSelectAction.None; + // node.ShowCheckBox = false; + } else + + { + node.Text = row["auth_name"].ToString() ; + + } + + + if (pNode == null) + //˵Ǹڵ + { + + treeAuth.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindAuthTree(node.Value, node, new DataView(dv.Table)); + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRoleAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + lbmsg.Text = " "; + if (listRoles.SelectedValue == string.Empty) return; + //ɫȨ + ArrayList al = new ArrayList(); + GetCheckedNode(treeAuth.Nodes, al); + _logic.Initialize(); +// using (TransactionScope trans = new TransactionScope()) + { + try + { + + _logic.GetRoleAuthority.Delete(Convert.ToInt32(listRoles.SelectedValue)); + // _logic.Initialize(); + foreach (string id in al) + { + _logic.GetRoleAuthority.ra_role = Convert.ToInt32(listRoles.SelectedValue); + _logic.GetRoleAuthority.ra_authority = Convert.ToInt32(id); + _logic.GetRoleAuthority.Add(); + } + lbmsg.Text = "ɹ"; +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + + + } + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues) + { + foreach (TreeNode node in tnc) + { + if (node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } + + } + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + private void ClearDetail() + { + + } + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + lbmsg.Text = " "; + /* + if (treeAuth.SelectedNode != null) treeAuth.SelectedNode.Selected = false; + lbAuthRole.Text = "Ȩ޽ɫ嵥" ; + GvRole.DataSource = null; + GvRole.DataBind(); + */ + + //--Ȩѡ + ArrayList autList = new ArrayList(); + DataView dv = _logic.GetRoleAuthority.QueryActived().Tables[0].DefaultView; + dv.RowFilter = "ra_role ='" + listRoles.SelectedValue + "'"; + foreach (DataRowView drv in dv) + { + autList.Add(drv["ra_authority"]); + } + SetCheckedNode(treeAuth.Nodes, autList); + + bindGV(); + + } + + + protected void treeAuth_SelectedNodeChanged(object sender, EventArgs e) + { + bindGV(); + + } + + void bindGV() + { + //ɫӦԱ嵥 + if (listRoles.SelectedItem != null) + { + + lbRoleEm.Text = listRoles.SelectedItem.Text + " ɫԱ嵥"; + GvEm.DataSource = _logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)); + } + GvEm.DataBind(); + + + //Ȩ޶ӦĽɫ,Ա嵥 + if (treeAuth.SelectedNode != null) + { + lbAuthEm.Text = treeAuth.SelectedNode.Text + " ȨԱ嵥"; + GvAuthEm.DataSource = _logic.GetEmListByAuth(Convert.ToInt32(treeAuth.SelectedValue)); + lbAuthRole.Text = treeAuth.SelectedNode.Text + " Ȩ޽ɫ嵥"; + GvRole.DataSource = _logic.GetRoleListByAuth(Convert.ToInt32(treeAuth.SelectedValue)); + + } + GvAuthEm.DataBind(); + GvRole.DataBind(); + } + +} \ No newline at end of file diff --git a/Dict/RoleEmp.aspx b/Dict/RoleEmp.aspx new file mode 100644 index 0000000..2296daf --- /dev/null +++ b/Dict/RoleEmp.aspx @@ -0,0 +1,131 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleEmp.aspx.cs" Inherits="RoleEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
  +    + +
+ +
+ +
+ diff --git a/Dict/RoleEmp.aspx.cs b/Dict/RoleEmp.aspx.cs new file mode 100644 index 0000000..822618c --- /dev/null +++ b/Dict/RoleEmp.aspx.cs @@ -0,0 +1,284 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class RoleEmp : PageBase +{ + private LRoleAuthority _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LRoleAuthority(); + Databound(); + bindRoles(); + bindDeptEmp(); //ɫʱʼԱ + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + // if (!isRoleAuth) bindDeptEmp(); //ɫʱʼԱ + bindGV(); + UpdateSession(); + + + } + + + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + BindTree("0", TreeDeptEmp.SelectedNode, new LEmployee().GetDepartments().DefaultView, new LEmployee().GetActivedEmpDept().DefaultView); + + + } + + /// + ///󶨽ɫ + /// + private void bindRoles() + { + + listRoles.DataSource = _logic.GetAllRoles(); + listRoles.DataTextField = "role_name"; + listRoles.DataValueField = "ID"; + listRoles.DataBind(); + } + + public void BindTree(string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + "" +" "+ row["ID"]; + node.Value = row["ID"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , + emrow["DE_EMPLOYEE"].ToString() + ";" + emrow["WAREHOUSE"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeDeptEmp.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRoleAuthority)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + lbmsg.Text = " "; + if (listRoles.SelectedValue == string.Empty) return; + ArrayList al = new ArrayList(); + + GetCheckedNode(TreeDeptEmp.Nodes, al); + _logic.Initialize(); + + try + { + using (TransactionScope trans = new TransactionScope()) + { + int roleId = Convert.ToInt32(listRoles.SelectedValue); + _logic.GetRoleEmp.Delete(roleId); + + foreach (string id in al) + { + string[] ls= id.Split(';'); + _logic.GetRoleEmp.re_role = roleId; + _logic.GetRoleEmp.re_employee = Convert.ToInt32(ls[0]) ; + if (ls.Length > 1) + { + _logic.GetRoleEmp.warehouse = Convert.ToInt32(ls[1]); + } + _logic.GetRoleEmp.Add(); + } + + trans.Complete(); + } + lbmsg.Text = "ɹ"; + } + catch (MyException) + { + throw; + } + catch (Exception er) + { + throw new Exception("쳣ʧܡ"); + } + + + Databound(); + } + + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + string[] ls = node.Value.Split(';'); + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(ls[0])); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + + //--Աѡ + /* + if (TreeDeptEmp.SelectedNode != null) TreeDeptEmp.SelectedNode.Selected = false; + + lbAuthRole.Text = "Աɫ嵥"; + GvRole.DataSource = null; + GvRole.DataBind(); + * */ + //--ѡԱѡ + + ArrayList empList = new ArrayList(); + DataTable dt =_logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)) ; + foreach (DataRow dr in dt.Rows) + { + empList.Add(dr["ID"]); + } + SetCheckedNode(TreeDeptEmp.Nodes, empList); + + bindGV(); + + } + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + + bindGV(); + + } + + + void bindGV( ) + { + //ԱɫȨ嵥 + string nodevalue = TreeDeptEmp.SelectedValue; + nodevalue = nodevalue.Split(';')[0]; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmRole.Text = TreeDeptEmp.SelectedNode.Text;// +" Աɫ嵥"; + GvRole.DataSource = _logic.GetRoleByEm(Convert.ToInt32(nodevalue)); + + lbEmAuth.Text = TreeDeptEmp.SelectedNode.Text;// +" ԱȨ嵥"; + GVauth.DataSource = _logic.GetAuthByEm(Convert.ToInt32(nodevalue)); + + } + GvRole.DataBind(); + GVauth.DataBind(); + + //ɫӦԱ嵥 + if (listRoles.SelectedItem != null) + { + + lbRoleEm.Text = listRoles.SelectedItem.Text;// +" ɫԱ嵥"; + GvEm.DataSource = _logic.GetEmListByRole(Convert.ToInt32(listRoles.SelectedValue)); + } + GvEm.DataBind(); + } + +} \ No newline at end of file diff --git a/Dict/RoleMain.aspx b/Dict/RoleMain.aspx new file mode 100644 index 0000000..c2d14a2 --- /dev/null +++ b/Dict/RoleMain.aspx @@ -0,0 +1,123 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="RoleMain.aspx.cs" Inherits="RoleMain" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + * + + + +   +   + + + * +
+ + +
+ +
+
+ + + + + + +
  +
+
+ + + + +
+ +
+ +
+ diff --git a/Dict/RoleMain.aspx.cs b/Dict/RoleMain.aspx.cs new file mode 100644 index 0000000..2d90346 --- /dev/null +++ b/Dict/RoleMain.aspx.cs @@ -0,0 +1,236 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class RoleMain : PageBase +{ + private LRole _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LRole(); + Databound(); + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = _logic.GetAllActiveData().Tables[0]; + GridView1.DataBind(); + UpdateSession(); + + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LRole)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + chkApprove.Checked=_logic.GetRole.role_4Approve ; + txtJobName.Text = _logic.GetRole.role_name; + txtJobDesc.Text = _logic.GetRole.role_desc; +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + Databound(); + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + txtJobName.Focus(); + GridView1.SelectedIndex = -1; + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + txtJobName.Focus(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + if (txtJobDesc.Text.Trim().Length + txtJobName.Text.Trim().Length == 0) + { + txtJobName.Focus(); + Databound(); + DataDetail.Visible = true; + ScriptManager.RegisterStartupScript(btnSubmit, typeof(UpdatePanel), "alert", + "alert('ɫơ');", true); + return; + + } + int oper = 0; + oper = _logic.GetRole.ID > 0 ? _logic.GetRole.Update() : _logic.GetRole.Add(); + ClearDetail(); + Databound(); + + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetRole.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.Text = ""; + chk.Enabled = false; + chk.Checked = e.Row.Cells[3].Text.Trim().Equals("True"); + e.Row.Cells[3].Controls.Add(chk); + } + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + + string sortExpression = e.SortExpression; + if (GridView1.SortDirection == SortDirection.Ascending) // + { + + SortGridView(sortExpression, " DESC"); + } + else + { + + SortGridView(sortExpression, " ASC"); + } + } + private void SortGridView(string sortExpression, string direction) + { + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.Sort = sortExpression + direction; + GridView1.DataSource = dv; //DataView󶨵GridView + GridView1.DataBind(); + + } + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + // if (_logic.GetRole.ID > 0) + // _logic.GetRole.lastmodified = DateTime.Now.ToString(); + // _logic.GetRole.dr = true; + _logic.GetRole.role_name = txtJobName.Text; + _logic.GetRole.role_desc = txtJobDesc.Text; + _logic.GetRole.role_4Approve = chkApprove.Checked; + } + + private void chgOperTxt(bool addNew) + { + btnSubmit.Enabled = true; + DataDetail.Visible = true; + } + + private void ClearDetail() + { + chkApprove.Checked = false; + txtJobName.Text = ""; + txtJobDesc.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + +} \ No newline at end of file diff --git a/FileNotFound.aspx b/FileNotFound.aspx new file mode 100644 index 0000000..a2e8312 --- /dev/null +++ b/FileNotFound.aspx @@ -0,0 +1,24 @@ +<%@ Page Language="C#" MasterPageFile="masterPage.master" AutoEventWireup="true" CodeFile="FileNotFound.aspx.cs" Inherits="FileNotFound" %> + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ diff --git a/FileNotFound.aspx.cs b/FileNotFound.aspx.cs new file mode 100644 index 0000000..fa488cd --- /dev/null +++ b/FileNotFound.aspx.cs @@ -0,0 +1,20 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +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 System.Text; +public partial class FileNotFound : Page +{ + protected void Page_Load(object sender, EventArgs e) + { + + lbErrtrace.Text = "ûҵҪʵļ"; + + } +} diff --git a/Global.asax b/Global.asax new file mode 100644 index 0000000..35a43a5 --- /dev/null +++ b/Global.asax @@ -0,0 +1,127 @@ +<%@ Application Language="C#" %> +<%@ Import Namespace="view.App_Code"%> +<%@ Import Namespace="DeiNiu.Utils"%> + + diff --git a/Images/.svn/entries b/Images/.svn/entries new file mode 100644 index 0000000..ecda76c --- /dev/null +++ b/Images/.svn/entries @@ -0,0 +1,1728 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/Images +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +error2.gif +file + + + + +2011-04-01T02:51:07.367974Z +331f6dfb37f8606d1f5d4d9f54d7bd77 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +394 + +line_dot2.gif +file + + + + +2011-04-01T02:51:07.399224Z +32e782320c2978ef31c9d7f97eac9969 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +50 + +ancor1.gif +file + + + + +2011-04-01T02:51:07.430475Z +43476573a379ab294307bfea1c825224 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +79 + +UP.gif +file + + + + +2011-04-01T02:51:07.477350Z +4b324d3859a23c34bf3a7e04977aaac9 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +156 + +arr.gif +file + + + + +2011-04-01T02:51:07.508600Z +2bc039efab8a7c1d7151d4901a1e2680 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +290 + +bg.gif +file + + + + +2011-04-01T02:51:07.524225Z +dceb13b61e4ac6092c1c38649c4af545 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +654 + +button_100.gif +file + + + + +2011-04-01T02:51:07.571100Z +98a1953d7dd65ddea4d8acef5a9aca2e +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +428 + +t_below.gif +file + + + + +2011-04-01T02:51:07.602351Z +f83d32ce6b3b18f4a24fd122df6afef0 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +117 + +button_101.gif +file + + + + +2011-04-01T02:51:07.633601Z +7256f1a7bb7719dad53705e3865631f9 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +405 + +t_mid.gif +file + + + + +2011-04-01T02:51:07.649226Z +7108534928254d097a3683558fe1c86d +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +57 + +button_120.gif +file + + + + +2011-04-01T02:51:07.664851Z +5e97896e10cc4797757b89c5bf503762 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +448 + +line_dot.gif +file + + + + +2011-04-01T02:51:07.696101Z +ec2e787cc45417223316a2ea595d2800 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +61 + +Navigate.gif +file + + + + +2011-04-01T02:51:07.711726Z +abcd76e120bcdf149bdf808df9369e8a +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +676 + +save.gif +file + + + + +2011-04-01T02:51:07.727351Z +a78daedd8be18da8776da19753b6bab0 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +165 + +logo.gif +file + + + + +2011-04-01T02:51:07.758602Z +436f2b063cf9e7745216ba31496c8aa7 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +2041 + +detail.gif +file + + + + +2011-04-01T02:51:07.821102Z +146ea82d432d997c8641818cc8b13b51 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +590 + +delete.GIF +file + + + + +2011-04-01T02:51:07.774227Z +93e6220a4a80f61b6dde0597c82b7e49 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +587 + +biaoqian_1.gif +file + + + + +2011-04-01T02:51:07.836727Z +4b8969af1a185fa42c3858948f78036c +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +1229 + +biaoqian_2.gif +file + + + + +2011-04-01T02:51:07.867977Z +3a80986a3ef87d97463be3653af30f2a +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +1320 + +arr1.gif +file + + + + +2011-04-01T02:51:07.930478Z +d8da9217bb4307fc98d39d251223ffe1 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +65 + +undo.gif +file + + + + +2011-04-01T02:51:07.914853Z +4e87a4414e536dac59a99e37572be748 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +125 + +dot_green.gif +file + + + + +2011-04-01T02:51:07.977353Z +28a8a4f6068b767712b468d142b21288 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +49 + +Line_long.gif +file + + + + +2011-04-01T02:51:07.946103Z +acc3a1008706fe8c910b7e29da90a6e4 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +511 + +DOWN.gif +file + + + + +2011-04-01T02:51:08.024228Z +114620ea4346993e08e109fd4bd4d354 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +158 + +help.png +file + + + + +2011-04-01T02:51:07.992978Z +2dba7cc177725ec730a552c4d20cddb1 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +669 + +active.gif +file + + + + +2011-04-01T02:51:08.055479Z +2f1a87bacbb060961c56952828e222a1 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +240 + +m_top.gif +file + + + + +2011-04-01T02:51:08.086729Z +33f469dfb6bc203532fd365a2c384a77 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +1362 + +bg_SelectedItem.gif +file + + + + +2011-04-01T02:51:08.164854Z +f04aa22dc8a2f16e8e3e278cc7f5494d +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +142 + +expand.gif +file + + + + +2011-04-01T02:51:08.102354Z +34aa8c06f280791d3ab86e9bd74085e7 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +336 + +find.gif +file + + + + +2011-04-01T02:51:08.196104Z +e8a95dc02e1692c40508f19adfeabbff +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +158 + +update.gif +file + + + + +2011-04-01T02:51:08.227355Z +a78daedd8be18da8776da19753b6bab0 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +165 + +bg_news.gif +file + + + + +2011-04-01T02:51:08.258605Z +95e70bdac148542b0ea40a03f009a742 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +588 + +edit.gif +file + + + + +2011-04-01T02:51:08.305480Z +07c50963d50f87d694f56e2c48f8bbfc +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +248 + +t_top.gif +file + + + + +2011-04-01T02:51:08.321105Z +786c492269c69dc04898cca31a8b9b16 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +117 + +dot.gif +file + + + + +2011-04-01T02:51:08.367981Z +aa02b3e0c1dbcbe2dee8d3e16402275a +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +67 + +bg_top_tit.gif +file + + + + +2011-04-01T02:51:08.399231Z +06bf7f949c2aebff619c187f51ec4577 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +144 + +left.gif +file + + + + +2011-04-01T02:51:08.430481Z +7771cfbfa1ced337a279c2be4ceadccf +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +12336 + +button_150.gif +file + + + + +2011-04-01T02:51:08.461731Z +f2876b13946fa7461a56d88bb1c8b07f +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +490 + +1.gif +file + + + + +2011-04-01T02:51:08.477356Z +ed280a0ea3cc38f3cbbc747acfbef47d +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +49 + +collapse.gif +file + + + + +2011-04-01T02:51:08.492981Z +f86a052c4705b9679c2e822cb85b7cc4 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +344 + +bg_left.gif +file + + + + +2011-04-01T02:51:08.508606Z +9d556f748707fe8985356503e0ea442d +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +60 + +head11.gif +file + + + + +2011-04-01T02:51:08.539857Z +ab541a2732f46d53105dae7ddf7c1c46 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +22738 + +Search.gif +file + + + + +2011-04-01T02:51:08.555482Z +6383a6bee4020788c8757ced23e79961 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +561 + +End.GIF +file + + + + +2011-04-01T02:51:08.571107Z +af22e95be6df00749d31d78ce84d7a13 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +210 + +cross.png +file + + + + +2011-04-01T02:51:08.586732Z +42492684e24356a4081134894eabeb9e +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +655 + +calendar.gif +file + + + + +2011-04-01T02:51:08.602357Z +c50738cb7e92f4868e37cc478e0e0154 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +162 + +Tabstrip1.gif +file + + + + +2011-04-01T02:51:08.617982Z +d8ee1a1069cb5a09b3c721187c52f841 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +473 + +tick.png +file + + + + +2011-04-01T02:51:08.633607Z +93b0e63a528104e30a8c29c6768d4390 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +467 + +Tabstrip2.gif +file + + + + +2011-04-01T02:51:08.649232Z +7589520ae3f72b8b317c76f4d1a500fc +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +1742 + +error1.gif +file + + + + +2011-04-01T02:51:08.680483Z +dcd08857d902b3c02d89057257472622 +2011-03-31T02:53:16.230701Z +2 +mwang +has-props + + + + + + + + + + + + + + + + + + + + +9257 + diff --git a/Images/.svn/prop-base/1.gif.svn-base b/Images/.svn/prop-base/1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/DOWN.gif.svn-base b/Images/.svn/prop-base/DOWN.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/DOWN.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/End.GIF.svn-base b/Images/.svn/prop-base/End.GIF.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/End.GIF.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/Line_long.gif.svn-base b/Images/.svn/prop-base/Line_long.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/Line_long.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/Navigate.gif.svn-base b/Images/.svn/prop-base/Navigate.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/Navigate.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/Search.gif.svn-base b/Images/.svn/prop-base/Search.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/Search.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/Tabstrip1.gif.svn-base b/Images/.svn/prop-base/Tabstrip1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/Tabstrip1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/Tabstrip2.gif.svn-base b/Images/.svn/prop-base/Tabstrip2.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/Tabstrip2.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/UP.gif.svn-base b/Images/.svn/prop-base/UP.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/UP.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/active.gif.svn-base b/Images/.svn/prop-base/active.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/active.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/ancor1.gif.svn-base b/Images/.svn/prop-base/ancor1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/ancor1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/arr.gif.svn-base b/Images/.svn/prop-base/arr.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/arr.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/arr1.gif.svn-base b/Images/.svn/prop-base/arr1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/arr1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/bg.gif.svn-base b/Images/.svn/prop-base/bg.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/bg.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/bg_SelectedItem.gif.svn-base b/Images/.svn/prop-base/bg_SelectedItem.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/bg_SelectedItem.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/bg_left.gif.svn-base b/Images/.svn/prop-base/bg_left.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/bg_left.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/bg_news.gif.svn-base b/Images/.svn/prop-base/bg_news.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/bg_news.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/bg_top_tit.gif.svn-base b/Images/.svn/prop-base/bg_top_tit.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/bg_top_tit.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/biaoqian_1.gif.svn-base b/Images/.svn/prop-base/biaoqian_1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/biaoqian_1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/biaoqian_2.gif.svn-base b/Images/.svn/prop-base/biaoqian_2.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/biaoqian_2.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/button_100.gif.svn-base b/Images/.svn/prop-base/button_100.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/button_100.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/button_101.gif.svn-base b/Images/.svn/prop-base/button_101.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/button_101.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/button_120.gif.svn-base b/Images/.svn/prop-base/button_120.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/button_120.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/button_150.gif.svn-base b/Images/.svn/prop-base/button_150.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/button_150.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/calendar.gif.svn-base b/Images/.svn/prop-base/calendar.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/calendar.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/collapse.gif.svn-base b/Images/.svn/prop-base/collapse.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/collapse.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/cross.png.svn-base b/Images/.svn/prop-base/cross.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/cross.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/delete.GIF.svn-base b/Images/.svn/prop-base/delete.GIF.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/delete.GIF.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/detail.gif.svn-base b/Images/.svn/prop-base/detail.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/detail.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/dot.gif.svn-base b/Images/.svn/prop-base/dot.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/dot.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/dot_green.gif.svn-base b/Images/.svn/prop-base/dot_green.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/dot_green.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/edit.gif.svn-base b/Images/.svn/prop-base/edit.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/edit.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/error1.gif.svn-base b/Images/.svn/prop-base/error1.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/error1.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/error2.gif.svn-base b/Images/.svn/prop-base/error2.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/error2.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/expand.gif.svn-base b/Images/.svn/prop-base/expand.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/expand.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/find.gif.svn-base b/Images/.svn/prop-base/find.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/find.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/head11.gif.svn-base b/Images/.svn/prop-base/head11.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/head11.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/help.png.svn-base b/Images/.svn/prop-base/help.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/help.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/left.gif.svn-base b/Images/.svn/prop-base/left.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/left.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/line_dot.gif.svn-base b/Images/.svn/prop-base/line_dot.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/line_dot.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/line_dot2.gif.svn-base b/Images/.svn/prop-base/line_dot2.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/line_dot2.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/logo.gif.svn-base b/Images/.svn/prop-base/logo.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/logo.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/m_top.gif.svn-base b/Images/.svn/prop-base/m_top.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/m_top.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/save.gif.svn-base b/Images/.svn/prop-base/save.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/save.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/t_below.gif.svn-base b/Images/.svn/prop-base/t_below.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/t_below.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/t_mid.gif.svn-base b/Images/.svn/prop-base/t_mid.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/t_mid.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/t_top.gif.svn-base b/Images/.svn/prop-base/t_top.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/t_top.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/tick.png.svn-base b/Images/.svn/prop-base/tick.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/tick.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/undo.gif.svn-base b/Images/.svn/prop-base/undo.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/undo.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/prop-base/update.gif.svn-base b/Images/.svn/prop-base/update.gif.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/Images/.svn/prop-base/update.gif.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/Images/.svn/text-base/1.gif.svn-base b/Images/.svn/text-base/1.gif.svn-base new file mode 100644 index 0000000..c95709f Binary files /dev/null and b/Images/.svn/text-base/1.gif.svn-base differ diff --git a/Images/.svn/text-base/DOWN.gif.svn-base b/Images/.svn/text-base/DOWN.gif.svn-base new file mode 100644 index 0000000..71cddd6 Binary files /dev/null and b/Images/.svn/text-base/DOWN.gif.svn-base differ diff --git a/Images/.svn/text-base/End.GIF.svn-base b/Images/.svn/text-base/End.GIF.svn-base new file mode 100644 index 0000000..cca4d1b Binary files /dev/null and b/Images/.svn/text-base/End.GIF.svn-base differ diff --git a/Images/.svn/text-base/Line_long.gif.svn-base b/Images/.svn/text-base/Line_long.gif.svn-base new file mode 100644 index 0000000..1073884 Binary files /dev/null and b/Images/.svn/text-base/Line_long.gif.svn-base differ diff --git a/Images/.svn/text-base/Navigate.gif.svn-base b/Images/.svn/text-base/Navigate.gif.svn-base new file mode 100644 index 0000000..b976bcf Binary files /dev/null and b/Images/.svn/text-base/Navigate.gif.svn-base differ diff --git a/Images/.svn/text-base/Search.gif.svn-base b/Images/.svn/text-base/Search.gif.svn-base new file mode 100644 index 0000000..7ab14b3 Binary files /dev/null and b/Images/.svn/text-base/Search.gif.svn-base differ diff --git a/Images/.svn/text-base/Tabstrip1.gif.svn-base b/Images/.svn/text-base/Tabstrip1.gif.svn-base new file mode 100644 index 0000000..acb2132 Binary files /dev/null and b/Images/.svn/text-base/Tabstrip1.gif.svn-base differ diff --git a/Images/.svn/text-base/Tabstrip2.gif.svn-base b/Images/.svn/text-base/Tabstrip2.gif.svn-base new file mode 100644 index 0000000..98b5fce Binary files /dev/null and b/Images/.svn/text-base/Tabstrip2.gif.svn-base differ diff --git a/Images/.svn/text-base/UP.gif.svn-base b/Images/.svn/text-base/UP.gif.svn-base new file mode 100644 index 0000000..3a6ea16 Binary files /dev/null and b/Images/.svn/text-base/UP.gif.svn-base differ diff --git a/Images/.svn/text-base/active.gif.svn-base b/Images/.svn/text-base/active.gif.svn-base new file mode 100644 index 0000000..33785ba Binary files /dev/null and b/Images/.svn/text-base/active.gif.svn-base differ diff --git a/Images/.svn/text-base/ancor1.gif.svn-base b/Images/.svn/text-base/ancor1.gif.svn-base new file mode 100644 index 0000000..38df00d Binary files /dev/null and b/Images/.svn/text-base/ancor1.gif.svn-base differ diff --git a/Images/.svn/text-base/arr.gif.svn-base b/Images/.svn/text-base/arr.gif.svn-base new file mode 100644 index 0000000..b15f158 Binary files /dev/null and b/Images/.svn/text-base/arr.gif.svn-base differ diff --git a/Images/.svn/text-base/arr1.gif.svn-base b/Images/.svn/text-base/arr1.gif.svn-base new file mode 100644 index 0000000..b533bf1 Binary files /dev/null and b/Images/.svn/text-base/arr1.gif.svn-base differ diff --git a/Images/.svn/text-base/bg.gif.svn-base b/Images/.svn/text-base/bg.gif.svn-base new file mode 100644 index 0000000..1fc00d3 Binary files /dev/null and b/Images/.svn/text-base/bg.gif.svn-base differ diff --git a/Images/.svn/text-base/bg_SelectedItem.gif.svn-base b/Images/.svn/text-base/bg_SelectedItem.gif.svn-base new file mode 100644 index 0000000..515b635 Binary files /dev/null and b/Images/.svn/text-base/bg_SelectedItem.gif.svn-base differ diff --git a/Images/.svn/text-base/bg_left.gif.svn-base b/Images/.svn/text-base/bg_left.gif.svn-base new file mode 100644 index 0000000..6f28e61 Binary files /dev/null and b/Images/.svn/text-base/bg_left.gif.svn-base differ diff --git a/Images/.svn/text-base/bg_news.gif.svn-base b/Images/.svn/text-base/bg_news.gif.svn-base new file mode 100644 index 0000000..3df1bf7 Binary files /dev/null and b/Images/.svn/text-base/bg_news.gif.svn-base differ diff --git a/Images/.svn/text-base/bg_top_tit.gif.svn-base b/Images/.svn/text-base/bg_top_tit.gif.svn-base new file mode 100644 index 0000000..852c0ff Binary files /dev/null and b/Images/.svn/text-base/bg_top_tit.gif.svn-base differ diff --git a/Images/.svn/text-base/biaoqian_1.gif.svn-base b/Images/.svn/text-base/biaoqian_1.gif.svn-base new file mode 100644 index 0000000..f4964df Binary files /dev/null and b/Images/.svn/text-base/biaoqian_1.gif.svn-base differ diff --git a/Images/.svn/text-base/biaoqian_2.gif.svn-base b/Images/.svn/text-base/biaoqian_2.gif.svn-base new file mode 100644 index 0000000..e7f535a Binary files /dev/null and b/Images/.svn/text-base/biaoqian_2.gif.svn-base differ diff --git a/Images/.svn/text-base/button_100.gif.svn-base b/Images/.svn/text-base/button_100.gif.svn-base new file mode 100644 index 0000000..8c57211 Binary files /dev/null and b/Images/.svn/text-base/button_100.gif.svn-base differ diff --git a/Images/.svn/text-base/button_101.gif.svn-base b/Images/.svn/text-base/button_101.gif.svn-base new file mode 100644 index 0000000..7620237 Binary files /dev/null and b/Images/.svn/text-base/button_101.gif.svn-base differ diff --git a/Images/.svn/text-base/button_120.gif.svn-base b/Images/.svn/text-base/button_120.gif.svn-base new file mode 100644 index 0000000..f29b731 Binary files /dev/null and b/Images/.svn/text-base/button_120.gif.svn-base differ diff --git a/Images/.svn/text-base/button_150.gif.svn-base b/Images/.svn/text-base/button_150.gif.svn-base new file mode 100644 index 0000000..5e5bf43 Binary files /dev/null and b/Images/.svn/text-base/button_150.gif.svn-base differ diff --git a/Images/.svn/text-base/calendar.gif.svn-base b/Images/.svn/text-base/calendar.gif.svn-base new file mode 100644 index 0000000..4ebebba Binary files /dev/null and b/Images/.svn/text-base/calendar.gif.svn-base differ diff --git a/Images/.svn/text-base/collapse.gif.svn-base b/Images/.svn/text-base/collapse.gif.svn-base new file mode 100644 index 0000000..9dd7622 Binary files /dev/null and b/Images/.svn/text-base/collapse.gif.svn-base differ diff --git a/Images/.svn/text-base/cross.png.svn-base b/Images/.svn/text-base/cross.png.svn-base new file mode 100644 index 0000000..1514d51 Binary files /dev/null and b/Images/.svn/text-base/cross.png.svn-base differ diff --git a/Images/.svn/text-base/delete.GIF.svn-base b/Images/.svn/text-base/delete.GIF.svn-base new file mode 100644 index 0000000..a493cb7 Binary files /dev/null and b/Images/.svn/text-base/delete.GIF.svn-base differ diff --git a/Images/.svn/text-base/detail.gif.svn-base b/Images/.svn/text-base/detail.gif.svn-base new file mode 100644 index 0000000..b8bd043 Binary files /dev/null and b/Images/.svn/text-base/detail.gif.svn-base differ diff --git a/Images/.svn/text-base/dot.gif.svn-base b/Images/.svn/text-base/dot.gif.svn-base new file mode 100644 index 0000000..8404e07 Binary files /dev/null and b/Images/.svn/text-base/dot.gif.svn-base differ diff --git a/Images/.svn/text-base/dot_green.gif.svn-base b/Images/.svn/text-base/dot_green.gif.svn-base new file mode 100644 index 0000000..63cc646 Binary files /dev/null and b/Images/.svn/text-base/dot_green.gif.svn-base differ diff --git a/Images/.svn/text-base/edit.gif.svn-base b/Images/.svn/text-base/edit.gif.svn-base new file mode 100644 index 0000000..55f291c Binary files /dev/null and b/Images/.svn/text-base/edit.gif.svn-base differ diff --git a/Images/.svn/text-base/error1.gif.svn-base b/Images/.svn/text-base/error1.gif.svn-base new file mode 100644 index 0000000..408fd0f Binary files /dev/null and b/Images/.svn/text-base/error1.gif.svn-base differ diff --git a/Images/.svn/text-base/error2.gif.svn-base b/Images/.svn/text-base/error2.gif.svn-base new file mode 100644 index 0000000..c45af2b Binary files /dev/null and b/Images/.svn/text-base/error2.gif.svn-base differ diff --git a/Images/.svn/text-base/expand.gif.svn-base b/Images/.svn/text-base/expand.gif.svn-base new file mode 100644 index 0000000..bcf0a80 Binary files /dev/null and b/Images/.svn/text-base/expand.gif.svn-base differ diff --git a/Images/.svn/text-base/find.gif.svn-base b/Images/.svn/text-base/find.gif.svn-base new file mode 100644 index 0000000..ffc070d Binary files /dev/null and b/Images/.svn/text-base/find.gif.svn-base differ diff --git a/Images/.svn/text-base/head11.gif.svn-base b/Images/.svn/text-base/head11.gif.svn-base new file mode 100644 index 0000000..cf1911f Binary files /dev/null and b/Images/.svn/text-base/head11.gif.svn-base differ diff --git a/Images/.svn/text-base/help.png.svn-base b/Images/.svn/text-base/help.png.svn-base new file mode 100644 index 0000000..eb3d885 Binary files /dev/null and b/Images/.svn/text-base/help.png.svn-base differ diff --git a/Images/.svn/text-base/left.gif.svn-base b/Images/.svn/text-base/left.gif.svn-base new file mode 100644 index 0000000..7bc762a Binary files /dev/null and b/Images/.svn/text-base/left.gif.svn-base differ diff --git a/Images/.svn/text-base/line_dot.gif.svn-base b/Images/.svn/text-base/line_dot.gif.svn-base new file mode 100644 index 0000000..65a0072 Binary files /dev/null and b/Images/.svn/text-base/line_dot.gif.svn-base differ diff --git a/Images/.svn/text-base/line_dot2.gif.svn-base b/Images/.svn/text-base/line_dot2.gif.svn-base new file mode 100644 index 0000000..b3b7ca8 Binary files /dev/null and b/Images/.svn/text-base/line_dot2.gif.svn-base differ diff --git a/Images/.svn/text-base/logo.gif.svn-base b/Images/.svn/text-base/logo.gif.svn-base new file mode 100644 index 0000000..f70be2a Binary files /dev/null and b/Images/.svn/text-base/logo.gif.svn-base differ diff --git a/Images/.svn/text-base/m_top.gif.svn-base b/Images/.svn/text-base/m_top.gif.svn-base new file mode 100644 index 0000000..3d16554 Binary files /dev/null and b/Images/.svn/text-base/m_top.gif.svn-base differ diff --git a/Images/.svn/text-base/save.gif.svn-base b/Images/.svn/text-base/save.gif.svn-base new file mode 100644 index 0000000..fde7924 Binary files /dev/null and b/Images/.svn/text-base/save.gif.svn-base differ diff --git a/Images/.svn/text-base/t_below.gif.svn-base b/Images/.svn/text-base/t_below.gif.svn-base new file mode 100644 index 0000000..4d12a01 Binary files /dev/null and b/Images/.svn/text-base/t_below.gif.svn-base differ diff --git a/Images/.svn/text-base/t_mid.gif.svn-base b/Images/.svn/text-base/t_mid.gif.svn-base new file mode 100644 index 0000000..49ce826 Binary files /dev/null and b/Images/.svn/text-base/t_mid.gif.svn-base differ diff --git a/Images/.svn/text-base/t_top.gif.svn-base b/Images/.svn/text-base/t_top.gif.svn-base new file mode 100644 index 0000000..1654869 Binary files /dev/null and b/Images/.svn/text-base/t_top.gif.svn-base differ diff --git a/Images/.svn/text-base/tick.png.svn-base b/Images/.svn/text-base/tick.png.svn-base new file mode 100644 index 0000000..dd94984 Binary files /dev/null and b/Images/.svn/text-base/tick.png.svn-base differ diff --git a/Images/.svn/text-base/undo.gif.svn-base b/Images/.svn/text-base/undo.gif.svn-base new file mode 100644 index 0000000..879f9ef Binary files /dev/null and b/Images/.svn/text-base/undo.gif.svn-base differ diff --git a/Images/.svn/text-base/update.gif.svn-base b/Images/.svn/text-base/update.gif.svn-base new file mode 100644 index 0000000..fde7924 Binary files /dev/null and b/Images/.svn/text-base/update.gif.svn-base differ diff --git a/Images/1.gif b/Images/1.gif new file mode 100644 index 0000000..c95709f Binary files /dev/null and b/Images/1.gif differ diff --git a/Images/DOWN.gif b/Images/DOWN.gif new file mode 100644 index 0000000..71cddd6 Binary files /dev/null and b/Images/DOWN.gif differ diff --git a/Images/End.GIF b/Images/End.GIF new file mode 100644 index 0000000..cca4d1b Binary files /dev/null and b/Images/End.GIF differ diff --git a/Images/Line_long.gif b/Images/Line_long.gif new file mode 100644 index 0000000..1073884 Binary files /dev/null and b/Images/Line_long.gif differ diff --git a/Images/Navigate.gif b/Images/Navigate.gif new file mode 100644 index 0000000..b976bcf Binary files /dev/null and b/Images/Navigate.gif differ diff --git a/Images/Search.gif b/Images/Search.gif new file mode 100644 index 0000000..7ab14b3 Binary files /dev/null and b/Images/Search.gif differ diff --git a/Images/Tabstrip1.gif b/Images/Tabstrip1.gif new file mode 100644 index 0000000..acb2132 Binary files /dev/null and b/Images/Tabstrip1.gif differ diff --git a/Images/Tabstrip2.gif b/Images/Tabstrip2.gif new file mode 100644 index 0000000..98b5fce Binary files /dev/null and b/Images/Tabstrip2.gif differ diff --git a/Images/UP.gif b/Images/UP.gif new file mode 100644 index 0000000..3a6ea16 Binary files /dev/null and b/Images/UP.gif differ diff --git a/Images/active.gif b/Images/active.gif new file mode 100644 index 0000000..33785ba Binary files /dev/null and b/Images/active.gif differ diff --git a/Images/ancor1.gif b/Images/ancor1.gif new file mode 100644 index 0000000..38df00d Binary files /dev/null and b/Images/ancor1.gif differ diff --git a/Images/arr.gif b/Images/arr.gif new file mode 100644 index 0000000..b15f158 Binary files /dev/null and b/Images/arr.gif differ diff --git a/Images/arr1.gif b/Images/arr1.gif new file mode 100644 index 0000000..b533bf1 Binary files /dev/null and b/Images/arr1.gif differ diff --git a/Images/bg.gif b/Images/bg.gif new file mode 100644 index 0000000..1fc00d3 Binary files /dev/null and b/Images/bg.gif differ diff --git a/Images/bg_SelectedItem.gif b/Images/bg_SelectedItem.gif new file mode 100644 index 0000000..515b635 Binary files /dev/null and b/Images/bg_SelectedItem.gif differ diff --git a/Images/bg_left.gif b/Images/bg_left.gif new file mode 100644 index 0000000..6f28e61 Binary files /dev/null and b/Images/bg_left.gif differ diff --git a/Images/bg_news.gif b/Images/bg_news.gif new file mode 100644 index 0000000..3df1bf7 Binary files /dev/null and b/Images/bg_news.gif differ diff --git a/Images/bg_top_tit.gif b/Images/bg_top_tit.gif new file mode 100644 index 0000000..852c0ff Binary files /dev/null and b/Images/bg_top_tit.gif differ diff --git a/Images/biaoqian_1.gif b/Images/biaoqian_1.gif new file mode 100644 index 0000000..f4964df Binary files /dev/null and b/Images/biaoqian_1.gif differ diff --git a/Images/biaoqian_2.gif b/Images/biaoqian_2.gif new file mode 100644 index 0000000..e7f535a Binary files /dev/null and b/Images/biaoqian_2.gif differ diff --git a/Images/btnFirst.Image.png b/Images/btnFirst.Image.png new file mode 100644 index 0000000..8d7c4fc Binary files /dev/null and b/Images/btnFirst.Image.png differ diff --git a/Images/btnLast.Image.png b/Images/btnLast.Image.png new file mode 100644 index 0000000..06858cb Binary files /dev/null and b/Images/btnLast.Image.png differ diff --git a/Images/btnNext.Image.png b/Images/btnNext.Image.png new file mode 100644 index 0000000..5b7c53d Binary files /dev/null and b/Images/btnNext.Image.png differ diff --git a/Images/btnPrev.Image.png b/Images/btnPrev.Image.png new file mode 100644 index 0000000..1c0001a Binary files /dev/null and b/Images/btnPrev.Image.png differ diff --git a/Images/button_100.gif b/Images/button_100.gif new file mode 100644 index 0000000..8c57211 Binary files /dev/null and b/Images/button_100.gif differ diff --git a/Images/button_101.gif b/Images/button_101.gif new file mode 100644 index 0000000..7620237 Binary files /dev/null and b/Images/button_101.gif differ diff --git a/Images/button_120.gif b/Images/button_120.gif new file mode 100644 index 0000000..f29b731 Binary files /dev/null and b/Images/button_120.gif differ diff --git a/Images/button_150.gif b/Images/button_150.gif new file mode 100644 index 0000000..5e5bf43 Binary files /dev/null and b/Images/button_150.gif differ diff --git a/Images/calendar.gif b/Images/calendar.gif new file mode 100644 index 0000000..4ebebba Binary files /dev/null and b/Images/calendar.gif differ diff --git a/Images/collapse.gif b/Images/collapse.gif new file mode 100644 index 0000000..9dd7622 Binary files /dev/null and b/Images/collapse.gif differ diff --git a/Images/cross.png b/Images/cross.png new file mode 100644 index 0000000..1514d51 Binary files /dev/null and b/Images/cross.png differ diff --git a/Images/delete.GIF b/Images/delete.GIF new file mode 100644 index 0000000..a493cb7 Binary files /dev/null and b/Images/delete.GIF differ diff --git a/Images/detail.gif b/Images/detail.gif new file mode 100644 index 0000000..b8bd043 Binary files /dev/null and b/Images/detail.gif differ diff --git a/Images/dot.gif b/Images/dot.gif new file mode 100644 index 0000000..8404e07 Binary files /dev/null and b/Images/dot.gif differ diff --git a/Images/dot_green.gif b/Images/dot_green.gif new file mode 100644 index 0000000..63cc646 Binary files /dev/null and b/Images/dot_green.gif differ diff --git a/Images/edit.gif b/Images/edit.gif new file mode 100644 index 0000000..55f291c Binary files /dev/null and b/Images/edit.gif differ diff --git a/Images/error1.gif b/Images/error1.gif new file mode 100644 index 0000000..408fd0f Binary files /dev/null and b/Images/error1.gif differ diff --git a/Images/error2.gif b/Images/error2.gif new file mode 100644 index 0000000..c45af2b Binary files /dev/null and b/Images/error2.gif differ diff --git a/Images/expand.gif b/Images/expand.gif new file mode 100644 index 0000000..bcf0a80 Binary files /dev/null and b/Images/expand.gif differ diff --git a/Images/find.gif b/Images/find.gif new file mode 100644 index 0000000..ffc070d Binary files /dev/null and b/Images/find.gif differ diff --git a/Images/head11.gif b/Images/head11.gif new file mode 100644 index 0000000..cf1911f Binary files /dev/null and b/Images/head11.gif differ diff --git a/Images/help.png b/Images/help.png new file mode 100644 index 0000000..eb3d885 Binary files /dev/null and b/Images/help.png differ diff --git a/Images/left.gif b/Images/left.gif new file mode 100644 index 0000000..7bc762a Binary files /dev/null and b/Images/left.gif differ diff --git a/Images/line_dot.gif b/Images/line_dot.gif new file mode 100644 index 0000000..65a0072 Binary files /dev/null and b/Images/line_dot.gif differ diff --git a/Images/line_dot2.gif b/Images/line_dot2.gif new file mode 100644 index 0000000..b3b7ca8 Binary files /dev/null and b/Images/line_dot2.gif differ diff --git a/Images/logo.gif b/Images/logo.gif new file mode 100644 index 0000000..f70be2a Binary files /dev/null and b/Images/logo.gif differ diff --git a/Images/m_top.gif b/Images/m_top.gif new file mode 100644 index 0000000..3d16554 Binary files /dev/null and b/Images/m_top.gif differ diff --git a/Images/save.gif b/Images/save.gif new file mode 100644 index 0000000..fde7924 Binary files /dev/null and b/Images/save.gif differ diff --git a/Images/t_below.gif b/Images/t_below.gif new file mode 100644 index 0000000..4d12a01 Binary files /dev/null and b/Images/t_below.gif differ diff --git a/Images/t_mid.gif b/Images/t_mid.gif new file mode 100644 index 0000000..49ce826 Binary files /dev/null and b/Images/t_mid.gif differ diff --git a/Images/t_top.gif b/Images/t_top.gif new file mode 100644 index 0000000..1654869 Binary files /dev/null and b/Images/t_top.gif differ diff --git a/Images/tick.png b/Images/tick.png new file mode 100644 index 0000000..dd94984 Binary files /dev/null and b/Images/tick.png differ diff --git a/Images/undo.gif b/Images/undo.gif new file mode 100644 index 0000000..879f9ef Binary files /dev/null and b/Images/undo.gif differ diff --git a/Images/update.gif b/Images/update.gif new file mode 100644 index 0000000..fde7924 Binary files /dev/null and b/Images/update.gif differ diff --git a/Project/.svn/entries b/Project/.svn/entries new file mode 100644 index 0000000..4bf5426 --- /dev/null +++ b/Project/.svn/entries @@ -0,0 +1,708 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/Project +file:///D:/Repositories/ZhangPu + + + +2011-03-31T06:56:19.747664Z +8 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +WorkPlanMain.aspx.cs +file + + + + +2011-04-01T02:51:09.852365Z +e1358884635a6bd226bc06ab378d19b5 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6888 + +ProjectMain.aspx.bak +file + + + + +2011-04-01T02:51:09.883615Z +98905de18fa6bc4f9e3e99bc1a45b4b4 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +44582 + +ProjectCenter.aspx +file + + + + +2011-04-01T02:51:09.867990Z +874a6a4851fa3cc24cf8ec148fae311f +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +44364 + +ProjectApprove.aspx.cs +file + + + + +2011-04-01T02:51:09.867990Z +f6be8ba18052bbc1bbe3fa6789e28e24 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +32563 + +ProjectApprove.aspx.csb +file + + + + +2011-04-01T02:51:09.883615Z +8220fc078f2c3e38ae26e78c973eb7e3 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +29496 + +ProjectsQuery.aspx.bak +file + + + + +2011-04-01T02:51:09.914865Z +5682cba62b5ef5e0e0d09f8f5cbe7b68 +2011-03-31T06:10:11.232039Z +7 +mwang + + + + + + + + + + + + + + + + + + + + + +10982 + +ProjectMain.aspx +file + + + + +2011-04-01T02:51:09.899240Z +882fedc23cc447cf93e88823f4f47028 +2011-03-31T06:10:11.232039Z +7 +mwang + + + + + + + + + + + + + + + + + + + + + +44622 + +ProjectCenter.aspx.cs +file + + + + +2011-04-01T02:51:09.899240Z +d06fd643f3de795e3c8021269b702337 +2011-03-31T05:34:41.698027Z +4 +mwang + + + + + + + + + + + + + + + + + + + + + +38411 + +WorkReport.aspx +file + + + + +2011-04-01T02:51:09.930491Z +e3d1837aab60809ed17fe4adb40e8a60 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6097 + +ProjectsQuery.aspx +file + + + + +2011-04-01T02:51:09.946116Z +5138b93349fa909414ac79b0caa0fc7e +2011-03-31T06:56:19.747664Z +8 +mwang + + + + + + + + + + + + + + + + + + + + + +11075 + +ProjectMain.aspx.cs +file + + + + +2011-04-01T02:51:09.930491Z +f817081f0b2059d7219b86768c4fc8e4 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +41694 + +WorkReport.aspx.cs +file + + + + +2011-04-01T02:51:09.946116Z +f8e568034e0de71887c04162359cdd32 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5920 + +ProjectsQuery.aspx.cs +file + + + + +2011-04-01T02:51:09.961741Z +0a57280859321377ea6730f4fc30a604 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +8552 + +复件 ProjectApprove.aspxpu +file + + + + +2011-04-01T02:51:09.961741Z +d989dae083b09438d7da8285344e0d7e +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +26890 + +复件 ProjectApprove.aspx.cspu +file + + + + +2011-04-01T02:51:09.977366Z +069fb1ead17ff6ec6a7d688c03a4a6ce +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +31530 + +ProjectApprove.aspx.bak +file + + + + +2011-04-01T02:51:09.977366Z +dd3d73943e4b7c25323ddfc7e57985cf +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +27905 + +WorkPlanMain.aspx +file + + + + +2011-04-01T02:51:10.008616Z +a374b50d1bf8aae0ae98eb8bd65294d8 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5649 + +ProjectApprove.aspx.cs.bak +file + + + + +2011-04-01T02:51:10.024241Z +8a03b375376cc68cbc6ccb61de35fc00 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +32561 + +ProjectApprove.aspx +file + + + + +2011-04-01T02:51:10.024241Z +fd8aee7ed43de0794f3e677528f00159 +2011-03-31T06:10:11.232039Z +7 +mwang + + + + + + + + + + + + + + + + + + + + + +27941 + +ProjectApprove.aspxa +file + + + + +2011-04-01T02:51:10.039866Z +0a2e85ebfb34425f3e8c7cda901a2f49 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +26493 + diff --git a/Project/.svn/text-base/ProjectApprove.aspx.bak.svn-base b/Project/.svn/text-base/ProjectApprove.aspx.bak.svn-base new file mode 100644 index 0000000..fd2194d --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspx.bak.svn-base @@ -0,0 +1,456 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + + + + + * +
+ +
+
+
+ + +
+
+
diff --git a/Project/.svn/text-base/ProjectApprove.aspx.cs.bak.svn-base b/Project/.svn/text-base/ProjectApprove.aspx.cs.bak.svn-base new file mode 100644 index 0000000..347cc9b --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspx.cs.bak.svn-base @@ -0,0 +1,851 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.EndsWith("δͨ")); + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; //2011.3.14 ͨ--ѷ״̬ ൱ڴxsl load. + //_logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.Update(); + _logic.GetProject.balanceThePercent(); //do the percent balance + _logic.GetProject.getModel(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + // _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + // _logic.PaObj.pa_score = Convert.ToDecimal(txtSystemScore.Text) * Convert.ToDecimal(txtApproveScore.Text); + _logic.PaObj.pa_score = Convert.ToDecimal(txtApproveScore.Text) ; + if (_logic.GetProject.pj_nextDept == -1) + { + _logic.GetProject.pj_score =_logic.GetProject.pj_score * _logic.PaObj.pa_score ; + } + + + } + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} + \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectApprove.aspx.cs.svn-base b/Project/.svn/text-base/ProjectApprove.aspx.cs.svn-base new file mode 100644 index 0000000..da9789d --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspx.cs.svn-base @@ -0,0 +1,851 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.EndsWith("δͨ")); + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; //2011.3.14 ͨ--ѷ״̬ ൱ڴxsl load. + //_logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.Update(); + _logic.GetProject.balanceThePercent(); //do the percent balance + _logic.GetProject.getModel(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + // _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + // _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + // _logic.PaObj.pa_score = Convert.ToDecimal(txtSystemScore.Text) * Convert.ToDecimal(txtApproveScore.Text); + _logic.PaObj.pa_score = Convert.ToDecimal(txtApproveScore.Text) ; + if (_logic.GetProject.pj_nextDept == -1) + { + _logic.GetProject.pj_score =_logic.GetProject.pj_score * _logic.PaObj.pa_score ; + } + + + } + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} + \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectApprove.aspx.csb.svn-base b/Project/.svn/text-base/ProjectApprove.aspx.csb.svn-base new file mode 100644 index 0000000..12eb1a4 --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspx.csb.svn-base @@ -0,0 +1,785 @@ +using System; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + // _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + + } + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + +} + \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectApprove.aspx.svn-base b/Project/.svn/text-base/ProjectApprove.aspx.svn-base new file mode 100644 index 0000000..17b588f --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspx.svn-base @@ -0,0 +1,457 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + + + + + * +
+ +
+
+
+ + +
+
+
diff --git a/Project/.svn/text-base/ProjectApprove.aspxa.svn-base b/Project/.svn/text-base/ProjectApprove.aspxa.svn-base new file mode 100644 index 0000000..d452b51 --- /dev/null +++ b/Project/.svn/text-base/ProjectApprove.aspxa.svn-base @@ -0,0 +1,436 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ ¼ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + +
+
+ + + +
+
diff --git a/Project/.svn/text-base/ProjectCenter.aspx.cs.svn-base b/Project/.svn/text-base/ProjectCenter.aspx.cs.svn-base new file mode 100644 index 0000000..dd45d93 --- /dev/null +++ b/Project/.svn/text-base/ProjectCenter.aspx.cs.svn-base @@ -0,0 +1,1017 @@ +using System; +using System.Collections; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectCenter : PageBase + { + private LProject _logic; + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + + } + SessionSeting(); + + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = getProjects(); + GridView1.DataBind(); + UpdateSession(); + + // ProjectDataBind(); + // ProjectDetailDataBind(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + intializeProjectMasterDept(); + } + + /// + /// ȡӦĿϢ + /// + /// + DataView getProjects() + { + if (TreeDeptEmp.Nodes.Count == 0) return new DataView(); + DataView dv = _logic.GetProjectsByYearMonth( btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + string selectDept = string.Empty; + string selectEmp = string.Empty; + string inputProjectName = string.Empty; + string rowFilter = string.Empty; + + + + + if(rdlstAssignQry.SelectedValue=="0") //all assigned and unassigned + { + + //趨ԱͲ + if( TreeDeptEmp.SelectedNode != null) + if(TreeDeptEmp.SelectedNode.Text.StartsWith(".")) //employee + { + rowFilter = "pj_master = " + TreeDeptEmp.SelectedValue; + } + else + { + rowFilter = "pj_dept =" + TreeDeptEmp.SelectedValue; + } + + } + else + { + if (rdlstAssignQry.SelectedValue == "1") //assigned + rowFilter = "pj_status ='" + ProjectStatus.Ŀѷ +"'"; + else + rowFilter = "pj_status ='" + ProjectStatus.Ŀδ +"'"; + } + + //趨Ŀƹ + if(txtQryProjectName.Text.Trim().Length>0) + { + if(rowFilter.Length>0) + { + rowFilter += " and "; + + } + + rowFilter += " pj_name like '%" + txtQryProjectName.Text.Trim() + "%'"; + + } + + + dv.RowFilter = rowFilter; + return dv; + } + + + + + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + intializeProjectMasterDept(); + bindDeptEmp(); + validDeptEmp(); + } + + void validDeptEmp() + { + if(lem.CanManageProjects) return; + + } + + + + void intializeProjectMasterDept() + { + txtProjMaster.Text = ""; + drplstProjDept.Items.Clear(); + if (TreeDeptEmp.SelectedValue == "0") return; + if (TreeDeptEmp.SelectedNode != null) + if (TreeDeptEmp.SelectedNode.Text.StartsWith(".")) //employee + { + LEmployee tmp = new LEmployee(); + tmp.Initialize(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + drplstProjDept.DataSource = tmp.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + txtProjMaster.Text = TreeDeptEmp.SelectedNode.Text.Substring(1).Replace("","").Replace("",string.Empty); + } + else + { + string dept = TreeDeptEmp.SelectedNode.Text.Substring(4); + dept = dept.Substring(0, dept.Length -5); + drplstProjDept.Items.Add(new ListItem(dept,TreeDeptEmp.SelectedNode.Value)); + } + } + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + if (lem.CanManageProjects) //ӵйĿĽɫԿĿ + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode, lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + else + BindEmpTree(TreeDeptEmp, PublicUtils.buildWhereIntIn(lem.GetCanApproveDeptList()), TreeDeptEmp.SelectedNode, lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + if (TreeDeptEmp.Nodes.Count >0) TreeDeptEmp.Nodes[0].Selected = true; + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + if (lem.CanManageProjects) + { + deptdv.RowFilter = "dep_mastdept in (" + id + ")"; + } + else + { + if (id == string.Empty) return; + deptdv.RowFilter = "dep_mastdept in (" + id + ")"; + + if (pNode == null) + deptdv.RowFilter = "pk_department in (" + id + ")"; + } + + + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + ""; + node.Value = row["pk_department"].ToString(); + node.ShowCheckBox = false; + node.Expanded = false; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("." + emrow["em_name"].ToString() +"" , emrow["pk_employee"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + tree.Nodes.Add(node); + } + else + { + + pNode.ChildNodes.Add(node); + + } + + BindEmpTree(tree, node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + + private void SessionSeting() + { + if (IsPostBack) + { + // _logic = (LEmployee)Session[appScope.PagelevelObj]; + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { +// Session[appScope.PagelevelObj] = _logic; + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + // txtProjMaster.Text = lem.GetEmployee.em_name; + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString() ; + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + + ApproveListBind(_logic.GetProject.ID); + + + + } + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// ҳĿϢϢشĿʵ + /// + /// + void SetProjectDataBack() + { + + if (_logic.GetProject.ID > 0) + { + _logic.GetProject.lastmodified = DateTime.Now.ToString(); + + } + + // ProjectDetail.Visible = true; + _logic.GetProject.pj_name = txtProjectName.Text; + _logic.GetProject.pj_planStartDate = drpdProjlisFromYear.SelectedValue +"-" + drplstProjFromMonth.SelectedValue +"-01"; + _logic.GetProject.pj_planEndDate = drplstProjectToYear.SelectedValue +"-" + drlstProjToMonth.SelectedValue +"-01"; + _logic.GetProject.pj_master = lem.GetEmployee.ID; + _logic.GetProject.pj_mem =txtPrjDesc.Text; + // _logic.GetProject.pj_progress = Convert.ToInt32(txtProjProgress.Text) ; //Ŀ + _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text) ; //ĿȨ + _logic.GetProject.pj_type = drplstProjType.SelectedValue; + _logic.GetProject.pj_status = ProjectStatus.δύ; + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_dept = Convert.ToInt32(drplstProjDept.SelectedValue); + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment( _logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if(dep.GetDepartment.dep_mastdept==0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + } + } + _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text); + lbuploadmessage.Text = ""; + } + + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + btnSubmit.Visible = true; + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + ApproveListBind(_logic.GetProjectDetail.ID); + + } + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + btnSubmit.Visible = false; + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + panelApprovelist.Visible = false; + + + } + + + private void SetProjectDetailBack() + { + if (_logic.GetProjectDetail.ID > 0) + { + _logic.GetProjectDetail.lastmodified = DateTime.Now.ToString(); + + } + + _logic.GetProject.pj_progress = Convert.ToInt32(txtPrjProgress.Text) ; + _logic.GetProject.pj_finishDate =txtPdActualEndDate.Text ; + _logic.GetProjectDetail.pd_planTarget =txtPdPlanTarget.Text ; + _logic.GetProjectDetail.pd_finishedTarget = txtPdFinishTarget.Text ; + _logic.GetProjectDetail.pd_percent =Convert.ToInt32(txtPdPercent.Text) ; + _logic.GetProjectDetail.pd_mem =txtPdMem.Text ; + //ʱstatusĬΪδύ + lbuploadmessage.Text = ""; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearProjData(); + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + validProjControles(); + intializeProjectMasterDept(); + lbuploadmessage.Text = ""; + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + /// + /// ĿϢ + /// + /// + /// + protected void btnProjSubmit_Click(object sender, EventArgs e) + { + + //Ŀ״̬ûб仯仯档 + if(!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ) + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿ䣬޸ģʧܡ');", true); + return; + } + + + LProject lp = new LProject(); + lp.GetProject.ID =_logic.GetProject.ID; + lp.GetProject.getModel(); + if(!lp.GetProject.pj_status.Equals(_logic.GetProject.pj_status)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿ޸ģʧܡ');", true); + _logic.Initialize(_logic.GetProject.ID); + Databound(); + ProjectDataBind(); + return; + } + + SetProjectDataBack(); + if (_logic.GetProject.ID > 0) _logic.UpdateProject(); else _logic.AddProject(); + ClearProjData(); + Databound(); + + } + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.ID = e.Row.Cells[0].Text.Trim(); + string pdstatus = e.Row.Cells[13].Text.Trim(); + chk.Enabled = (pdstatus == ProjectDetailStatus.¶δύ || pdstatus == ProjectDetailStatus.δͨ || + pdstatus == ProjectDetailStatus.δͨ || pdstatus == ProjectDetailStatus.Ԥδͨ); + e.Row.Cells[1].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnReset_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + + /// + /// delete the project and details + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ)) + { + + _logic.GetProject.Delete(); + } + } + + Databound(); + + } + + /***************************************** internal methods ********************************************/ + + + private void chgOperTxt(bool addNew) + { + + + btnSubmit.Enabled = true; + } + + private void ClearProjData() + { + ProjectDetail.Visible = false; + btnSaveNewProj.Enabled = false; + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + panelApprovelist.Visible = false; + + drplstProjDept.Items.Clear(); + lbuploadmessage.Text = ""; + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + if(drdlst.SelectedIndex>=0) + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + // btnSaveNewProj.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + // btnDelete.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + validProjControles(); + btnSubmit.Visible = false; + + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + validPdControles(); + } + void validProjControles() + { + divEditProject.Visible = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ; + txtProjectName.ReadOnly =!divEditProject.Visible; + drpdProjlisFromYear.Enabled = divEditProject.Visible; + drplstProjFromMonth.Enabled = divEditProject.Visible; + drplstProjectToYear.Enabled = divEditProject.Visible; + drlstProjToMonth.Enabled = divEditProject.Visible; + drplstProjType.Enabled = divEditProject.Visible; + txtPrjDesc.ReadOnly =!divEditProject.Visible; + txtProjProgress.ReadOnly =!divEditProject.Visible; //Ŀ + txtProjPercent.ReadOnly =!divEditProject.Visible; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly =!divEditProject.Visible; //δύ; + // lbprjmem4Delete.Visible = divEditProject.Visible; + drplstProjDept.Enabled = divEditProject.Visible; + txtProjMaster.ReadOnly =!divEditProject.Visible; + } + void validPdControles() + { + //--monthly detail. + projMonthDetailEdit.Visible = false; + txtPdName.ReadOnly =!projMonthDetailEdit.Visible; + txtPdStartDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdEndDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPrjProgress.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdActualEndDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdPlanTarget.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdFinishTarget.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdPercent.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdMem.ReadOnly =! projMonthDetailEdit.Visible ; + + + + } + + + /// + /// project detail + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetProjectDetailBack(); + + _logic.GetProjectDetail.Update(); + ClearProjDetailData(); + Databound(); + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + + + protected void btnToApprove_Click(object sender, EventArgs e) + { + // _logic.GetProject.ID = Convert.ToInt32(GridView1.Rows[1].Cells[0].Text.Trim()); + + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if( _logic.GetProject.pj_status.EndsWith("δύ")|| _logic.GetProject.pj_status.EndsWith("δͨ") ) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + _logic.GetProject.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.pj_status = ProjectStatus.ύ; + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void btnpdToApprove_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.Update(); + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + } + + Databound(); + + } + protected void btnpd2approve_Click(object sender, EventArgs e) + { + + } + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + intializeProjectMasterDept(); + Databound(); + } + protected void btnQuery_Click(object sender, EventArgs e) + { + Databound(); + } + protected void btnAssign_Click(object sender, EventArgs e) + { + + if (TreeDeptEmp.SelectedNode == null || TreeDeptEmp.SelectedNode != null && TreeDeptEmp.SelectedValue == "0" || TreeDeptEmp.SelectedNode.Parent.Value=="0") + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('ѡĿˡ');", true); + return; + } + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; + _logic.GetProject.pj_master = Convert.ToInt32(TreeDeptEmp.SelectedValue); + _logic.GetProject.pj_dept = Convert.ToInt32(TreeDeptEmp.SelectedNode.Parent.Value); + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + protected void btnUnAssign_Click(object sender, EventArgs e) + { + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + _logic.GetProject.Update(); + } + } + + Databound(); + } + + protected void btnFileUpload1_Click(object sender, EventArgs e) + { + const string projectDest = "~/upload/projects/"; + if (fileUpload1.FileName.Length==0) return; + lbuploadmessage.Text = ""; + DirectoryInfo dir = new DirectoryInfo(Server.MapPath(projectDest)); + if (!dir.Exists) + dir.Create(); + string fileSavePath = Server.MapPath(projectDest + fileUpload1.FileName); + fileUpload1.SaveAs(fileSavePath); + // Master.ScriptMgr.EnablePartialRendering = true; + // pdUpload.Visible = false; + + + + importProjects(fileSavePath); + lbuploadmessage.Text = "ϴɹ"; + Databound(); + + System.IO.File.Delete(fileSavePath); + + } + + void importProjects(string fileName) + { + int Count = 1; + string tableName = string.Empty; + try + { + + DataSet ds = PublicUtils.Excel2DataSet(fileName); + foreach (DataTable dt in ds.Tables) + { + + Count = 1; + tableName = dt.TableName; + foreach (DataRow dr in dt.Rows) + { + Count++; + _logic.Initialize(); + if (dr["Ŵ"].ToString().Length>0) + _logic.GetProject.pj_dept = Convert.ToInt32(dr["Ŵ"].ToString()); + if (dr["Ա"].ToString().Length > 0) + _logic.GetProject.pj_master = Convert.ToInt32(dr["Ա"].ToString()); + _logic.GetProject.pj_mem = dr["Ŀ"].ToString().Substring(0,500); + _logic.GetProject.pj_name = dr["Ŀ"].ToString().Substring(0,50); + if (dr["ĿȨ"].ToString().Length > 0) + _logic.GetProject.pj_percent = Convert.ToInt32(dr["ĿȨ"].ToString()); + _logic.GetProject.pj_type = dr["Ŀ"].ToString(); + _logic.GetProject.pj_nextDept =-1; // + if (_logic.GetProject.pj_master >0) _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; + else + { + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + + _logic.GetProject.pj_planStartDate = dr["Ŀʼ"].ToString().Trim() + "-" + dr["Ŀʼ·"].ToString().Trim() + "-01"; + _logic.GetProject.pj_planEndDate = _logic.GetProject.pj_planStartDate; + + Convert.ToDateTime(_logic.GetProject.pj_planStartDate).AddMonths(Convert.ToInt32(dr["ĿȨ"].ToString())); + _logic.AddProject(); + } + } + + } + catch (Exception ) + { + string errorMsg = " " + tableName +" "+ Count +" д󣬼ԡ"; + lbuploadmessage.Text = lbuploadmessage.Text + errorMsg; + throw; + // ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('"+ errorMsg+"');", true); + + + } + + + + } + + + + + protected void btnActive_Click(object sender, EventArgs e) + { + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀⶳ)) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀⶳ; + _logic.GetProject.Update(); + } + } + + Databound(); + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + protected void Page_Init() + { + + // PostBackTrigger trigger = new PostBackTrigger(); + // trigger.ControlID = Button1.UniqueID; + // ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + + void page_init() + { + Master.ScriptMgr.EnablePartialRendering = false; + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + } + + + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} + \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectCenter.aspx.svn-base b/Project/.svn/text-base/ProjectCenter.aspx.svn-base new file mode 100644 index 0000000..b986c47 --- /dev/null +++ b/Project/.svn/text-base/ProjectCenter.aspx.svn-base @@ -0,0 +1,524 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectCenter.aspx.cs" Inherits="ProjectCenter" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + ȫ + ѷ + δ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+   + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+
+
+ + +   +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + % + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ +
+
+
+ +
+
+ + + + + + + + + + + + + +
+ + +   +   +
+ + + +   +
+
+
+
+
diff --git a/Project/.svn/text-base/ProjectMain.aspx.bak.svn-base b/Project/.svn/text-base/ProjectMain.aspx.bak.svn-base new file mode 100644 index 0000000..d163925 --- /dev/null +++ b/Project/.svn/text-base/ProjectMain.aspx.bak.svn-base @@ -0,0 +1,483 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectMain.aspx.cs" Inherits="ProjectMain" EnableEventValidation = "false" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + ѡ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + +   +
+
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0% + + + +
+ + + + + + +
+ + + + صĿ + һĿ + + + + + 0 + %* + *
+ + + +
+ + + + * +
+
+
+ + +   + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + +
+ + +   +  
+
+ + + + + +
+ + + % + + * + * +  
+ + +
+
+ + + +   +  
+   + + + + + + + + + + + + + + û + + + + + +
+
+
+ +
+
+
+ + + + + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+
+
diff --git a/Project/.svn/text-base/ProjectMain.aspx.cs.svn-base b/Project/.svn/text-base/ProjectMain.aspx.cs.svn-base new file mode 100644 index 0000000..d3ed871 --- /dev/null +++ b/Project/.svn/text-base/ProjectMain.aspx.cs.svn-base @@ -0,0 +1,1000 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using view.App_Code; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectMain : PageBase + { + private LProject _logic; + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + Validbtncontrols(rdblstMonth.SelectedValue=="0"); + CurrentMonthSubmit(); + + } + + /***************************************** private methods ******************************************/ + + /// + /// ֻύǰµĿ + /// + void CurrentMonthSubmit() + { + this.btnpdToApprove.Visible = Convert.ToInt32(this.btnYear.Text) == DateTime.Today.Year && rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected; + btnpd2approve.Visible = btnpdToApprove.Visible; + } + + void Validbtncontrols(bool visible) + { + btn_addNew.Visible = visible; + btnPrjToApprove.Visible = visible; + btnDelete.Visible = visible; + + + } + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = _logic.GetAllProjectDetail(lem.GetEmployee.ID,btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + GridView1.DataBind(); + UpdateSession(); + + // ProjectDataBind(); + // ProjectDetailDataBind(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + // this.TxtBtnYear.Text = btnYear.Text; + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + // _logic = (LEmployee)Session[appScope.PagelevelObj]; + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { +// Session[appScope.PagelevelObj] = _logic; + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + // txtProjMem4delete.Visible = (_logic.GetProject.pj_status == ProjectStatus.δύ) && rdblstMonth.Items[0].Selected; //ֻɾԼġ + txtProjMem4delete.Visible = rdblstMonth.Items[0].Selected; // ɾκĿ״̬ + lbprjmem4Delete.Visible = txtProjMem4delete.Visible; + btnDelete.Visible = txtProjMem4delete.Visible; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + txtProjMaster.Text = lem.GetEmployee.em_name; + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString() ; + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + + ApproveListBind(_logic.GetProject.ID); + + // btnDelete.Visible = true; + } + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// ҳĿϢϢشĿʵ + /// + /// + void SetProjectDataBack() + { + + if (_logic.GetProject.ID > 0) + { + _logic.GetProject.lastmodified = DateTime.Now.ToString(); + + } + + // ProjectDetail.Visible = true; + _logic.GetProject.pj_name = txtProjectName.Text; + _logic.GetProject.pj_planStartDate = drpdProjlisFromYear.SelectedValue +"-" + drplstProjFromMonth.SelectedValue +"-01"; + _logic.GetProject.pj_planEndDate = drplstProjectToYear.SelectedValue +"-" + drlstProjToMonth.SelectedValue +"-01"; + _logic.GetProject.pj_master = lem.GetEmployee.ID; + _logic.GetProject.pj_mem =txtPrjDesc.Text; + // _logic.GetProject.pj_progress = Convert.ToInt32(txtProjProgress.Text) ; //Ŀ + if (txtProjPercent.Text != string.Empty) _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text) ; //ĿȨ + _logic.GetProject.pj_type = drplstProjType.SelectedValue; + _logic.GetProject.pj_status = _logic.GetProject.pj_status == String.Empty ? ProjectStatus.δύ : _logic.GetProject.pj_status; + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_dept = Convert.ToInt32(drplstProjDept.SelectedValue); + if (_logic.GetProject.pj_nextDept == 0) + _logic.GetProject.pj_nextDept = -1; + else + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_nextDept; + + /* + * _logic.GetProject.pj_nextDept = _logic.GetProject.pj_nextDept == 0 ? -1 ; _logic.GetProject.pj_nextDept; + + * _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment( _logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if(dep.GetDepartment.dep_mastdept==0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + } + } + * */ + + } + + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + btnSubmit.Visible = true; + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + ApproveListBind(_logic.GetProjectDetail.ID); + + } + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + btnSubmit.Visible = false; + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + panelApprovelist.Visible = false; + } + + + private void SetProjectDetailBack() + { + if (_logic.GetProjectDetail.ID > 0) + { + _logic.GetProjectDetail.lastmodified = DateTime.Now.ToString(); + + } + + _logic.GetProject.pj_progress = Convert.ToInt32(txtPrjProgress.Text) ; + _logic.GetProject.pj_finishDate =txtPdActualEndDate.Text ; + _logic.GetProjectDetail.pd_planTarget =txtPdPlanTarget.Text ; + _logic.GetProjectDetail.pd_finishedTarget = txtPdFinishTarget.Text ; + _logic.GetProjectDetail.pd_percent =Convert.ToInt32(txtPdPercent.Text) ; + _logic.GetProjectDetail.pd_mem =txtPdMem.Text ; + //ʱstatusĬΪδύ + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearProjData(); + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + validProjControles(); + ProjectMonthDetail.Visible = false; + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + /// + /// ĿϢ + /// + /// + /// + protected void btnProjSubmit_Click(object sender, EventArgs e) + { + + if(_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + + //Ŀ״̬ûб仯仯档 + if(_logic.GetProject.pj_status.Equals(ProjectStatus.ύ)||_logic.GetProject.pj_status.Equals(ProjectStatus.ɾύ)) + { + LProject lp = new LProject(); + lp.GetProject.ID =_logic.GetProject.ID; + lp.GetProject.getModel(); + if(!lp.GetProject.pj_status.Equals(_logic.GetProject.pj_status)) + { + // Response.Write(""); + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿʧܡ');", true); + ProjectDataBind(); + return; + } + } + SetProjectDataBack(); + if (_logic.GetProject.pj_name == string.Empty || _logic.GetProject.pj_name.Trim().Length == 0) return; + if (_logic.GetProject.pj_percent==0) return; + if (_logic.GetProject.ID > 0) _logic.UpdateProject(); else _logic.AddProject(); + ClearProjData(); + Databound(); + + } + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.ID = e.Row.Cells[0].Text.Trim(); + string pdstatus = e.Row.Cells[13].Text.Trim(); + chk.Enabled = (pdstatus == ProjectDetailStatus.¶δύ || pdstatus == ProjectDetailStatus.δͨ || + pdstatus == ProjectDetailStatus.δͨ || pdstatus == ProjectDetailStatus.Ԥδͨ); + e.Row.Cells[1].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnReset_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + + /// + /// delete the project and details + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + if(txtProjMem4delete.Text ==null ) return; + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) + { + + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ĿѾɣɾ');", true); + return; + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if ( (dep.GetDepartment.dep_manager != lem.GetEmployee.ID) &&(dep.GetDepartment.dep_mastdept != 0)) + { + return; + } + } + + + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) ) + { + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_status = Tracen.Utils.ProjectStatus.ɾδύ; + + _logic.GetProject.Update(); + } + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + + _logic.Delete(); + + } + + + + ClearProjData(); + Databound(); + } + + /***************************************** internal methods ********************************************/ + + + private void chgOperTxt(bool addNew) + { + + + btnSubmit.Enabled = true; + } + + private void ClearProjData() + { + ProjectDetail.Visible = false; + btnSaveNewProj.Enabled = false; + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + panelApprovelist.Visible = false; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + // btnSaveNewProj.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + // btnDelete.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + validProjControles(); + btnSubmit.Visible = false; + + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + validPdControles(); + } + void validProjControles() + { + bool canEditSubmit; + canEditSubmit = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || !_logic.GetProject.pj_status.EndsWith("ѷ") && !_logic.GetProject.pj_status.EndsWith("ͨ") && !_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) + &&!_logic.GetProject.pj_status.EndsWith("ͨ")|| + _logic.GetProject.pj_status.EndsWith("δͨ") || _logic.GetProject.pj_status.Equals(string.Empty); + txtProjectName.ReadOnly = !canEditSubmit; + // drpdProjlisFromYear.Enabled = divEditProject.Visible; + //drplstProjFromMonth.Enabled = divEditProject.Visible; + // drplstProjectToYear.Enabled = divEditProject.Visible; + // drlstProjToMonth.Enabled = divEditProject.Visible; + drplstProjType.Enabled = canEditSubmit; + txtPrjDesc.ReadOnly = !canEditSubmit; + // txtProjProgress.ReadOnly = !divEditProject.Visible; //Ŀ + txtProjPercent.ReadOnly = !canEditSubmit; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + // txtProjMem4delete.ReadOnly = !canEditSubmit; //δύ; + // lbprjmem4Delete.Visible = divEditProject.Visible; + drplstProjDept.Enabled = canEditSubmit; + + bool canNotDel = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status == String.Empty || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ); + + bool canDel = !canNotDel; + canDel = canDel && this.rdblstMonth.Items[0].Selected; + txtProjMem4delete.Visible = canDel; + lbprjmem4Delete.Visible = canDel; + // if (btnDelete.Visible) + btnDelete.Visible = canDel; + + + } + void validPdControles() + { + //--monthly detail. + projMonthDetailEdit.Visible = _logic.GetProjectDetail.pd_status.Equals(ProjectDetailStatus.¶δύ) || + !_logic.GetProjectDetail.pd_status.EndsWith("ͨ") && + !_logic.GetProjectDetail.pd_status.EndsWith("ͨ") || + _logic.GetProjectDetail.pd_status.Equals(string.Empty); + + + + projMonthDetailEdit.Visible = projMonthDetailEdit.Visible && + !(_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && + !_logic.GetProject.pj_status.EndsWith("δͨ")) || + _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProjectDetail.pd_status.EndsWith("δύ") || + _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || + _logic.GetProject.pj_status.StartsWith("ɾ")); + + projMonthDetailEdit.Visible = projMonthDetailEdit.Visible || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀѷ); + txtPdName.ReadOnly = !projMonthDetailEdit.Visible; + // txtPdStartDate.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPdEndDate.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPrjProgress.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPdActualEndDate.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdPlanTarget.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdFinishTarget.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdPercent.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdMem.ReadOnly = ! projMonthDetailEdit.Visible ; + + //--˰ť + + + } + + + /// + /// project detail + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + + SetProjectDetailBack(); + + _logic.GetProjectDetail.Update(); + ClearProjDetailData(); + Databound(); + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnToApprove_Click(object sender, EventArgs e) + { + // _logic.GetProject.ID = Convert.ToInt32(GridView1.Rows[1].Cells[0].Text.Trim()); + + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if( _logic.GetProject.pj_status.EndsWith("δύ")|| _logic.GetProject.pj_status.EndsWith("δͨ") ) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + _logic.GetProject.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.pj_status = ProjectStatus.ύ; + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; + } + + /// + /// ¶ύ + /// + /// + /// + protected void btnpdToApprove_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) continue; //Ŀύ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) continue; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ԥͨ)) continue; + if (_logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) continue; + if (_logic.GetProject.pj_status.StartsWith("") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) continue; + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || _logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + } + _logic.GetProject.Update(); + + } + + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + + _logic.GetProjectDetail.Update(); + + _logic.GetProject.Update(); + } + + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ)) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ)) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + else + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + continue; //쵼 + } + continue; + } + //ύ쵼׼ + + if (_logic.GetProject.pj_status.EndsWith("δύ")||_logic.GetProject.pj_status.EndsWith("δͨ")) + { + if(_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾύ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.ύ; + } + } + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + _logic.GetProject.Update(); + } + } + + Databound(); + + } + protected void btnpd2approve_Click(object sender, EventArgs e) + { + btnSubmit_Click( sender, e); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) return; + if (_logic.GetProject.pj_status.StartsWith("") && ( !_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ))) return; + + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || _logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + } + _logic.GetProject.Update(); + } + + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProjectDetail.Update(); + _logic.GetProject.Update(); + } + + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ)) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ)) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + else + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + //쵼 + } + Databound(); + return; + } + //ύ쵼׼ + + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾύ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.ύ; + } + } + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + _logic.GetProject.Update(); + } + Databound(); + } + protected void btnpj2approve_Click(object sender, EventArgs e) + { + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; //Ŀύ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.Update(); + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + Databound(); + } + protected void btnFileUpload_Click(object sender, EventArgs e) + { + + + Session["uploadCode"] = new Random().Next(); + string fileCode = Session["uploadCode"].ToString(); + string fileType = ((int)FileType.ProjectDetail).ToString(); + string fileInfo = _logic.GetProjectDetail.ID.ToString(); + string fileUPload = " window.showModalDialog('../upload/fileUpload.aspx?'+Math.random() +'=" + fileCode + "&fileType=" + fileType + "&fileInfo=" + fileInfo + "&id=" + lem.GetEmployee.ID + "' )"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", fileUPload, true); + + + + } + + protected void btnFileUploadReferesh_Click1(object sender, EventArgs e) + { + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + protected void GVFiles_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles != null) + { + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[e.RowIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + fileObj.GetFilesmgrExt.Delete(); + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest ; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + protected void btnpj2approve_Click1(object sender, EventArgs e) + { + + } + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl( Button1); + GridView1.AllowPaging = false; + GridView1.Columns[1].Visible = false; + GridView1.Columns[GridView1.Columns.Count -1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = true; + GridView1.Columns[1].Visible = true; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + +} + \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectMain.aspx.svn-base b/Project/.svn/text-base/ProjectMain.aspx.svn-base new file mode 100644 index 0000000..6c6db5f --- /dev/null +++ b/Project/.svn/text-base/ProjectMain.aspx.svn-base @@ -0,0 +1,484 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectMain.aspx.cs" Inherits="ProjectMain" EnableEventValidation = "false" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + ѡ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + +   +
+
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0% + + + +
+ + + + + + +
+ + + + صĿ + һĿ + + + + + 0 + %* + *
+ + + +
+ + + + * +
+
+
+ + +   + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + +
+ + +   +  
+
+ + + + + +
+ + + % + + * + * +  
+ + +
+
+ + + +   +  
+   + + + + + + + + + + + + + + û + + + + + +
+
+
+ +
+
+
+ + + + + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+
+
diff --git a/Project/.svn/text-base/ProjectsQuery.aspx.bak.svn-base b/Project/.svn/text-base/ProjectsQuery.aspx.bak.svn-base new file mode 100644 index 0000000..d66588c --- /dev/null +++ b/Project/.svn/text-base/ProjectsQuery.aspx.bak.svn-base @@ -0,0 +1,222 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="ProjectsQuery.aspx.cs" Inherits="ProjectsQuery" EnableEventValidation = "false"%> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ŀ
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + +
+ +
Ŀϸ
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+ +
+ +
+ +
+
+ + + +
+
+
+ diff --git a/Project/.svn/text-base/ProjectsQuery.aspx.cs.svn-base b/Project/.svn/text-base/ProjectsQuery.aspx.cs.svn-base new file mode 100644 index 0000000..ea86289 --- /dev/null +++ b/Project/.svn/text-base/ProjectsQuery.aspx.cs.svn-base @@ -0,0 +1,298 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class ProjectsQuery : PageBase +{ + private LProject _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + _logic = new LProject(); + bindDeptEmp(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + DataView dv2 = _logic.GetSumProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + if ( TreeDeptEmp.SelectedNode !=null && TreeDeptEmp.SelectedNode.Value!="0") + { + string selectedValue = TreeDeptEmp.SelectedValue; + string wherecls = "pk_department= '" + selectedValue + "'"; + if (TreeDeptEmp.SelectedNode.Text.StartsWith(".")) + { + wherecls = "pk_employee= '" + selectedValue + "'"; + } + dv2.RowFilter = wherecls; + } + + + + GridView1.DataSource = dv2 ; + GridView1.DataBind(); + if (GridView1.DataKeys != null && GridView1.DataKeys.Count>0 && GridView1.SelectedIndex!=-1) + { + Databound( GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString()); + }else + + { + GridView2.DataSource = null; + GridView2.DataBind(); + } + + + + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + } + + private void Databound(string empId) + { + // if (empId == null) throw new ArgumentNullException("empId"); + if (empId == null) return; + + DataView dv = _logic.GetAllProjectDetail(Convert.ToInt32(empId),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + GridView2.DataSource = dv; + GridView2.DataBind(); + + } + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + // TreeDeptEmp.Nodes.Clear(); + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode,lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + + + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + ""; + node.Value = row["pk_department"].ToString(); + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode( "."+emrow["em_name"] , emrow["pk_employee"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + tree.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(tree, node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + void setTreeDeptEmpSelected(string toFind,TreeNode nd) + { + foreach (TreeNode cnd in nd.ChildNodes) + { + if (cnd.Value == toFind) + { + cnd.Selected = true; + break; + } + else + { + setTreeDeptEmpSelected(toFind,cnd); + } + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView2.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + Databound(); + + } + + + + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + + Databound(); + + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + trigger = new PostBackTrigger(); + trigger.ControlID = Button2.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export1("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + protected void Excel_Click2(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView2.AllowPaging = false; + + Databound(); + Export2("application/ms-excel", "Ŀϸб.xls"); + GridView2.AllowPaging = false; + + Databound(); + + } + + + private void Export1(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + private void Export2(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView2.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} \ No newline at end of file diff --git a/Project/.svn/text-base/ProjectsQuery.aspx.svn-base b/Project/.svn/text-base/ProjectsQuery.aspx.svn-base new file mode 100644 index 0000000..a7c2f6b --- /dev/null +++ b/Project/.svn/text-base/ProjectsQuery.aspx.svn-base @@ -0,0 +1,224 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="ProjectsQuery.aspx.cs" Inherits="ProjectsQuery" EnableEventValidation = "false"%> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ŀ
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + +
+ +
Ŀϸ
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+ +
+ +
+ +
+
+ + + +
+
+
+ diff --git a/Project/.svn/text-base/WorkPlanMain.aspx.cs.svn-base b/Project/.svn/text-base/WorkPlanMain.aspx.cs.svn-base new file mode 100644 index 0000000..a1b1182 --- /dev/null +++ b/Project/.svn/text-base/WorkPlanMain.aspx.cs.svn-base @@ -0,0 +1,232 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class WorkPlanMain : PageBase +{ + private LWorkPlan _logic; + + protected void Page_Load(object sender, EventArgs e) + { + lem = (LEmployee)Session["CurrentUser"]; + if (!IsPostBack) + { + _logic = new LWorkPlan(); + Calendar1.SelectedDate = DateTime.Today ; + Databound(); + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + _logic.CheckWorkPlan(lem.GetEmployee.ID, Calendar1.SelectedDate.ToString(),true); + GridView1.DataSource = _logic.GetLWorkPlan.getWorkplanDetails(lem.GetEmployee.ID,Calendar1.SelectedDate.ToString()); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LWorkPlan)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtPlanContent.Text = _logic.GetLWorkPlanDetail.wpd_content; + txtPlanMem.Text = _logic.GetLWorkPlanDetail.wpd_mem; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + // _logic.Initialize(); _logic.CheckWorkPlan ʼƻ + _logic.InitializeDetail(); + UpdateSession(); + DetailDataBind(); + txtPlanContent.Focus(); + GridView1.SelectedIndex = -1; + + Databound(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + txtPlanContent.Focus(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLWorkPlanDetail.ID > 0 ? _logic.GetLWorkPlanDetail.Update() : _logic.GetLWorkPlanDetail.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetLWorkPlanDetail.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + + string sortExpression = e.SortExpression; + if (GridView1.SortDirection == SortDirection.Ascending) // + { + + SortGridView(sortExpression, " DESC"); + } + else + { + + SortGridView(sortExpression, " ASC"); + } + } + private void SortGridView(string sortExpression, string direction) + { + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.Sort = sortExpression + direction; + GridView1.DataSource = dv; //DataView󶨵GridView + GridView1.DataBind(); + + } + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + if (_logic.GetLWorkPlanDetail.ID > 0) + _logic.GetLWorkPlanDetail.lastmodified = DateTime.Now.ToString(); + + _logic.GetLWorkPlanDetail.wpd_content = txtPlanContent.Text; + _logic.GetLWorkPlanDetail.wpd_mem = txtPlanMem.Text; + _logic.GetLWorkPlanDetail.wpd_workplan = _logic.GetLWorkPlan.ID; + _logic.GetLWorkPlanDetail.wpd_number = _logic.getNexNumber(_logic.GetLWorkPlan.ID); + } + + private void chgOperTxt(bool addNew) + { + btnSubmit.Enabled = true; + DataDetail.Visible = true; + } + + private void ClearDetail() + { + txtPlanMem.Text = ""; + txtPlanContent.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + protected void Calendar1_SelectionChanged(object sender, EventArgs e) + { + Databound(); + } + protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) + { + // e.Cell.Controls.Add(new LiteralControl(" ")); + // e.Cell.Font.Size = FontUnit.XXLarge; + } +} diff --git a/Project/.svn/text-base/WorkPlanMain.aspx.svn-base b/Project/.svn/text-base/WorkPlanMain.aspx.svn-base new file mode 100644 index 0000000..5dc5725 --- /dev/null +++ b/Project/.svn/text-base/WorkPlanMain.aspx.svn-base @@ -0,0 +1,116 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="WorkPlanMain.aspx.cs" Inherits="WorkPlanMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + û + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+
+ + + + + + +
+ +
+ +
+ diff --git a/Project/.svn/text-base/WorkReport.aspx.cs.svn-base b/Project/.svn/text-base/WorkReport.aspx.cs.svn-base new file mode 100644 index 0000000..ab303db --- /dev/null +++ b/Project/.svn/text-base/WorkReport.aspx.cs.svn-base @@ -0,0 +1,164 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.IO; +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 Tracen.Utils; +using ZhangPu.Gov.Logical; + +public partial class Project_WorkReport : PageBase +{ + private LFile _logic; + protected void Page_Load(object sender, EventArgs e) + { + if(! IsPostBack) + { + InitializeControles(); + _logic =new LFile(); + Databound(); + } + + SessionSeting(); + + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LFile)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + void Databound() + { + GVFiles.DataSource = _logic.GetFilesmgrExt.GetFilesByEmpFileType(lem.GetEmployee.ID,Convert.ToInt32(drplstFileType.SelectedValue)); + GVFiles.DataBind(); + UpdateSession(); + + } + void InitializeControles() + { + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + ListItem li = new ListItem("半年度计划",((int)FileType.半年度计划).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("半年度总结", ((int)FileType.半年度总结).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("年度计划", ((int)FileType.年度计划).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("年度总结", ((int)FileType.年度总结).ToString()); + drplstFileType.Items.Add(li); + } + + protected void btnFileUpload_Click(object sender, EventArgs e) + { + try + { + if (drplstProjDept.Items.Count==0) return; + if (fileUpload.FileName.Length == 0) return; + lbuploadmessage.Text = ""; + string fileName = fileUpload.FileName; + + System.Random rand = new Random(); + int len = rand.Next(); + fileName = lem.GetEmployee.ID + "T" + drplstFileType.SelectedValue + len + + fileName.Substring(fileName.LastIndexOf(".")); + DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/upload/" + drplstFileType.SelectedValue)); + if (!dir.Exists) + dir.Create(); + string fileSavePath = Server.MapPath("~/upload/" + drplstFileType.SelectedValue + "/" + fileName); + fileUpload.SaveAs(fileSavePath); + lbuploadmessage.Text = "上传成功!"; + + LFile _logic = new LFile(); + _logic.Initialize(); + _logic.GetFilesmgrExt.File_type = Convert.ToInt32(drplstFileType.SelectedValue); + _logic.GetFilesmgrExt.file_dest = fileName; + _logic.GetFilesmgrExt.File_Desc = txtFileDesc.Text; + _logic.GetFilesmgrExt.File_Emp = Convert.ToInt32(lem.GetEmployee.ID); + _logic.GetFilesmgrExt.file_Dept = Convert.ToInt32(drplstProjDept.SelectedValue); + _logic.GetFilesmgrExt.Add(); + Databound(); + + } + catch (Exception) + { + + lbuploadmessage.Text = "上传失败!"; + } + } + protected void GVFiles_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles != null) + { + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[e.RowIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + if(fileObj.GetFilesmgrExt.File_Emp != lem.GetEmployee.ID) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('不可以删除他人的文档。 ');", true); + return; + } + fileObj.GetFilesmgrExt.Delete(); + Databound(); + } + } + + + } + // 查看附件 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + void page_init() + { + Master.ScriptMgr.EnablePartialRendering = false; + } + + protected void btnQuery_Click(object sender, EventArgs e) + { + if( drplstProjDept.Items.Count ==0) return; + DataView dv; + string dept = drplstProjDept.SelectedValue; + dv = _logic.GetFilesmgrExt.GetFilesByEmpFileType(lem.GetEmployee.ID, Convert.ToInt32(drplstFileType.SelectedValue)).DefaultView; + if(lem.GetCanApproveDeptList().Contains(dept)) + dv = _logic.GetFilesmgrExt.GetFilesByDeptFileType( Convert.ToInt32(dept), Convert.ToInt32(drplstFileType.SelectedValue)).DefaultView; + + GVFiles.DataSource = dv; + GVFiles.DataBind(); + + + + } +} diff --git a/Project/.svn/text-base/WorkReport.aspx.svn-base b/Project/.svn/text-base/WorkReport.aspx.svn-base new file mode 100644 index 0000000..d40f18c --- /dev/null +++ b/Project/.svn/text-base/WorkReport.aspx.svn-base @@ -0,0 +1,96 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="WorkReport.aspx.cs" Inherits="Project_WorkReport" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +    + + +
+ + +   +  
+ + +   + + + + +  
+
+
+   +   + + + + + + + + + + + + + + + 没有数据 + + + + +
+
+ diff --git a/Project/.svn/text-base/复件 ProjectApprove.aspx.cspu.svn-base b/Project/.svn/text-base/复件 ProjectApprove.aspx.cspu.svn-base new file mode 100644 index 0000000..071342d --- /dev/null +++ b/Project/.svn/text-base/复件 ProjectApprove.aspx.cspu.svn-base @@ -0,0 +1,836 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "PK_DEPARTMENT"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == Tracen.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + + using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + _logic.GetProject.balanceThePercent(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + + } + + using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgrExt.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgrExt.File_type + "/" + fileObj.GetFilesmgrExt.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} + \ No newline at end of file diff --git a/Project/.svn/text-base/复件 ProjectApprove.aspxpu.svn-base b/Project/.svn/text-base/复件 ProjectApprove.aspxpu.svn-base new file mode 100644 index 0000000..9da1653 --- /dev/null +++ b/Project/.svn/text-base/复件 ProjectApprove.aspxpu.svn-base @@ -0,0 +1,445 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" EnableEventValidation = "true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ ¼ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + + +
+ + + + + + +
+ + +
+
+
+ + +
+
+
diff --git a/Project/ProjectApprove.aspx b/Project/ProjectApprove.aspx new file mode 100644 index 0000000..3245510 --- /dev/null +++ b/Project/ProjectApprove.aspx @@ -0,0 +1,457 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + + + + + * +
+ +
+
+
+ + +
+
+
diff --git a/Project/ProjectApprove.aspx.bak b/Project/ProjectApprove.aspx.bak new file mode 100644 index 0000000..10572b2 --- /dev/null +++ b/Project/ProjectApprove.aspx.bak @@ -0,0 +1,456 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + + + + + * +
+ +
+
+
+ + +
+
+
diff --git a/Project/ProjectApprove.aspx.cs b/Project/ProjectApprove.aspx.cs new file mode 100644 index 0000000..aedb2a5 --- /dev/null +++ b/Project/ProjectApprove.aspx.cs @@ -0,0 +1,851 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.EndsWith("δͨ")); + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; //2011.3.14 ͨ--ѷ״̬ ൱ڴxsl load. + //_logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.Update(); + _logic.GetProject.balanceThePercent(); //do the percent balance + _logic.GetProject.getModel(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + // _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + // _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + // _logic.PaObj.pa_score = Convert.ToDecimal(txtSystemScore.Text) * Convert.ToDecimal(txtApproveScore.Text); + _logic.PaObj.pa_score = Convert.ToDecimal(txtApproveScore.Text) ; + if (_logic.GetProject.pj_nextDept == -1) + { + _logic.GetProject.pj_score =_logic.GetProject.pj_score * _logic.PaObj.pa_score ; + } + + + } + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} + \ No newline at end of file diff --git a/Project/ProjectApprove.aspx.cs.bak b/Project/ProjectApprove.aspx.cs.bak new file mode 100644 index 0000000..687576f --- /dev/null +++ b/Project/ProjectApprove.aspx.cs.bak @@ -0,0 +1,851 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.EndsWith("δͨ")); + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; //2011.3.14 ͨ--ѷ״̬ ൱ڴxsl load. + //_logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.Update(); + _logic.GetProject.balanceThePercent(); //do the percent balance + _logic.GetProject.getModel(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + // _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + // _logic.PaObj.pa_score = Convert.ToDecimal(txtSystemScore.Text) * Convert.ToDecimal(txtApproveScore.Text); + _logic.PaObj.pa_score = Convert.ToDecimal(txtApproveScore.Text) ; + if (_logic.GetProject.pj_nextDept == -1) + { + _logic.GetProject.pj_score =_logic.GetProject.pj_score * _logic.PaObj.pa_score ; + } + + + } + +// using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} + \ No newline at end of file diff --git a/Project/ProjectApprove.aspx.csb b/Project/ProjectApprove.aspx.csb new file mode 100644 index 0000000..eeb5ffc --- /dev/null +++ b/Project/ProjectApprove.aspx.csb @@ -0,0 +1,785 @@ +using System; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + // _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + + } + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + +// trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + +} + \ No newline at end of file diff --git a/Project/ProjectApprove.aspxa b/Project/ProjectApprove.aspxa new file mode 100644 index 0000000..515179b --- /dev/null +++ b/Project/ProjectApprove.aspxa @@ -0,0 +1,436 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ ¼ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + +
+ + + + + + +
+
+ + + +
+
diff --git a/Project/ProjectCenter.aspx b/Project/ProjectCenter.aspx new file mode 100644 index 0000000..f69d1e5 --- /dev/null +++ b/Project/ProjectCenter.aspx @@ -0,0 +1,524 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectCenter.aspx.cs" Inherits="ProjectCenter" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + ȫ + ѷ + δ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+   + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+
+
+ + +   +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + % + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ +
+
+
+ +
+
+ + + + + + + + + + + + + +
+ + +   +   +
+ + + +   +
+
+
+
+
diff --git a/Project/ProjectCenter.aspx.cs b/Project/ProjectCenter.aspx.cs new file mode 100644 index 0000000..a526c11 --- /dev/null +++ b/Project/ProjectCenter.aspx.cs @@ -0,0 +1,1017 @@ +using System; +using System.Collections; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectCenter : PageBase + { + private LProject _logic; + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + + } + SessionSeting(); + + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = getProjects(); + GridView1.DataBind(); + UpdateSession(); + + // ProjectDataBind(); + // ProjectDetailDataBind(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + intializeProjectMasterDept(); + } + + /// + /// ȡӦĿϢ + /// + /// + DataView getProjects() + { + if (TreeDeptEmp.Nodes.Count == 0) return new DataView(); + DataView dv = _logic.GetProjectsByYearMonth( btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + string selectDept = string.Empty; + string selectEmp = string.Empty; + string inputProjectName = string.Empty; + string rowFilter = string.Empty; + + + + + if(rdlstAssignQry.SelectedValue=="0") //all assigned and unassigned + { + + //趨ԱͲ + if( TreeDeptEmp.SelectedNode != null) + if(TreeDeptEmp.SelectedNode.Text.StartsWith(".")) //employee + { + rowFilter = "pj_master = " + TreeDeptEmp.SelectedValue; + } + else + { + rowFilter = "pj_dept =" + TreeDeptEmp.SelectedValue; + } + + } + else + { + if (rdlstAssignQry.SelectedValue == "1") //assigned + rowFilter = "pj_status ='" + ProjectStatus.Ŀѷ +"'"; + else + rowFilter = "pj_status ='" + ProjectStatus.Ŀδ +"'"; + } + + //趨Ŀƹ + if(txtQryProjectName.Text.Trim().Length>0) + { + if(rowFilter.Length>0) + { + rowFilter += " and "; + + } + + rowFilter += " pj_name like '%" + txtQryProjectName.Text.Trim() + "%'"; + + } + + + dv.RowFilter = rowFilter; + return dv; + } + + + + + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + intializeProjectMasterDept(); + bindDeptEmp(); + validDeptEmp(); + } + + void validDeptEmp() + { + if(lem.CanManageProjects) return; + + } + + + + void intializeProjectMasterDept() + { + txtProjMaster.Text = ""; + drplstProjDept.Items.Clear(); + if (TreeDeptEmp.SelectedValue == "0") return; + if (TreeDeptEmp.SelectedNode != null) + if (TreeDeptEmp.SelectedNode.Text.StartsWith(".")) //employee + { + LEmployee tmp = new LEmployee(); + tmp.Initialize(Convert.ToInt32(TreeDeptEmp.SelectedValue)); + drplstProjDept.DataSource = tmp.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + txtProjMaster.Text = TreeDeptEmp.SelectedNode.Text.Substring(1).Replace("","").Replace("",string.Empty); + } + else + { + string dept = TreeDeptEmp.SelectedNode.Text.Substring(4); + dept = dept.Substring(0, dept.Length -5); + drplstProjDept.Items.Add(new ListItem(dept,TreeDeptEmp.SelectedNode.Value)); + } + } + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeDeptEmp.Nodes.Clear(); + if (lem.CanManageProjects) //ӵйĿĽɫԿĿ + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode, lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + else + BindEmpTree(TreeDeptEmp, Util.buildWhereIntIn(lem.GetCanApproveDeptList()), TreeDeptEmp.SelectedNode, lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + if (TreeDeptEmp.Nodes.Count >0) TreeDeptEmp.Nodes[0].Selected = true; + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + if (lem.CanManageProjects) + { + deptdv.RowFilter = "dep_mastdept in (" + id + ")"; + } + else + { + if (id == string.Empty) return; + deptdv.RowFilter = "dep_mastdept in (" + id + ")"; + + if (pNode == null) + deptdv.RowFilter = "ID in (" + id + ")"; + } + + + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + ""; + node.Value = row["ID"].ToString(); + node.ShowCheckBox = false; + node.Expanded = false; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("." + emrow["em_name"].ToString() +"" , emrow["ID"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + tree.Nodes.Add(node); + } + else + { + + pNode.ChildNodes.Add(node); + + } + + BindEmpTree(tree, node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + + private void SessionSeting() + { + if (IsPostBack) + { + // _logic = (LEmployee)Session[appScope.PagelevelObj]; + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { +// Session[appScope.PagelevelObj] = _logic; + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + // txtProjMaster.Text = lem.GetEmployee.em_name; + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString() ; + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + + ApproveListBind(_logic.GetProject.ID); + + + + } + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// ҳĿϢϢشĿʵ + /// + /// + void SetProjectDataBack() + { + + //if (_logic.GetProject.ID > 0) + //{ + // _logic.GetProject.lastmodified = DateTime.Now.ToString(); + + //} + + // ProjectDetail.Visible = true; + _logic.GetProject.pj_name = txtProjectName.Text; + _logic.GetProject.pj_planStartDate = drpdProjlisFromYear.SelectedValue +"-" + drplstProjFromMonth.SelectedValue +"-01"; + _logic.GetProject.pj_planEndDate = drplstProjectToYear.SelectedValue +"-" + drlstProjToMonth.SelectedValue +"-01"; + _logic.GetProject.pj_master = lem.GetEmployee.ID; + _logic.GetProject.pj_mem =txtPrjDesc.Text; + // _logic.GetProject.pj_progress = Convert.ToInt32(txtProjProgress.Text) ; //Ŀ + _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text) ; //ĿȨ + _logic.GetProject.pj_type = drplstProjType.SelectedValue; + _logic.GetProject.pj_status = ProjectStatus.δύ; + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_dept = Convert.ToInt32(drplstProjDept.SelectedValue); + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment( _logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if(dep.GetDepartment.dep_mastdept==0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + } + } + _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text); + lbuploadmessage.Text = ""; + } + + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + btnSubmit.Visible = true; + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + ApproveListBind(_logic.GetProjectDetail.ID); + + } + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + btnSubmit.Visible = false; + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + panelApprovelist.Visible = false; + + + } + + + private void SetProjectDetailBack() + { + //if (_logic.GetProjectDetail.ID > 0) + //{ + // _logic.GetProjectDetail.lastmodified = DateTime.Now.ToString(); + + //} + + _logic.GetProject.pj_progress = Convert.ToInt32(txtPrjProgress.Text) ; + _logic.GetProject.pj_finishDate =txtPdActualEndDate.Text ; + _logic.GetProjectDetail.pd_planTarget =txtPdPlanTarget.Text ; + _logic.GetProjectDetail.pd_finishedTarget = txtPdFinishTarget.Text ; + _logic.GetProjectDetail.pd_percent =Convert.ToInt32(txtPdPercent.Text) ; + _logic.GetProjectDetail.pd_mem =txtPdMem.Text ; + //ʱstatusĬΪδύ + lbuploadmessage.Text = ""; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearProjData(); + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + validProjControles(); + intializeProjectMasterDept(); + lbuploadmessage.Text = ""; + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + /// + /// ĿϢ + /// + /// + /// + protected void btnProjSubmit_Click(object sender, EventArgs e) + { + + //Ŀ״̬ûб仯仯档 + if(!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ) + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿ䣬޸ģʧܡ');", true); + return; + } + + + LProject lp = new LProject(); + lp.GetProject.ID =_logic.GetProject.ID; + lp.GetProject.getModel(); + if(!lp.GetProject.pj_status.Equals(_logic.GetProject.pj_status)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿ޸ģʧܡ');", true); + _logic.Initialize(_logic.GetProject.ID); + Databound(); + ProjectDataBind(); + return; + } + + SetProjectDataBack(); + if (_logic.GetProject.ID > 0) _logic.UpdateProject(); else _logic.AddProject(); + ClearProjData(); + Databound(); + + } + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.ID = e.Row.Cells[0].Text.Trim(); + string pdstatus = e.Row.Cells[13].Text.Trim(); + chk.Enabled = (pdstatus == ProjectDetailStatus.¶δύ || pdstatus == ProjectDetailStatus.δͨ || + pdstatus == ProjectDetailStatus.δͨ || pdstatus == ProjectDetailStatus.Ԥδͨ); + e.Row.Cells[1].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnReset_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + + /// + /// delete the project and details + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ)) + { + + _logic.GetProject.Delete(); + } + } + + Databound(); + + } + + /***************************************** internal methods ********************************************/ + + + private void chgOperTxt(bool addNew) + { + + + btnSubmit.Enabled = true; + } + + private void ClearProjData() + { + ProjectDetail.Visible = false; + btnSaveNewProj.Enabled = false; + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + panelApprovelist.Visible = false; + + drplstProjDept.Items.Clear(); + lbuploadmessage.Text = ""; + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + if(drdlst.SelectedIndex>=0) + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + // btnSaveNewProj.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + // btnDelete.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + validProjControles(); + btnSubmit.Visible = false; + + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + validPdControles(); + } + void validProjControles() + { + divEditProject.Visible = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ; + txtProjectName.ReadOnly =!divEditProject.Visible; + drpdProjlisFromYear.Enabled = divEditProject.Visible; + drplstProjFromMonth.Enabled = divEditProject.Visible; + drplstProjectToYear.Enabled = divEditProject.Visible; + drlstProjToMonth.Enabled = divEditProject.Visible; + drplstProjType.Enabled = divEditProject.Visible; + txtPrjDesc.ReadOnly =!divEditProject.Visible; + txtProjProgress.ReadOnly =!divEditProject.Visible; //Ŀ + txtProjPercent.ReadOnly =!divEditProject.Visible; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly =!divEditProject.Visible; //δύ; + // lbprjmem4Delete.Visible = divEditProject.Visible; + drplstProjDept.Enabled = divEditProject.Visible; + txtProjMaster.ReadOnly =!divEditProject.Visible; + } + void validPdControles() + { + //--monthly detail. + projMonthDetailEdit.Visible = false; + txtPdName.ReadOnly =!projMonthDetailEdit.Visible; + txtPdStartDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdEndDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPrjProgress.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdActualEndDate.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdPlanTarget.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdFinishTarget.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdPercent.ReadOnly =! projMonthDetailEdit.Visible ; + txtPdMem.ReadOnly =! projMonthDetailEdit.Visible ; + + + + } + + + /// + /// project detail + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetProjectDetailBack(); + + _logic.GetProjectDetail.Update(); + ClearProjDetailData(); + Databound(); + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + + + protected void btnToApprove_Click(object sender, EventArgs e) + { + // _logic.GetProject.ID = Convert.ToInt32(GridView1.Rows[1].Cells[0].Text.Trim()); + + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if( _logic.GetProject.pj_status.EndsWith("δύ")|| _logic.GetProject.pj_status.EndsWith("δͨ") ) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + _logic.GetProject.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.pj_status = ProjectStatus.ύ; + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void btnpdToApprove_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.Update(); + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + } + + Databound(); + + } + protected void btnpd2approve_Click(object sender, EventArgs e) + { + + } + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + intializeProjectMasterDept(); + Databound(); + } + protected void btnQuery_Click(object sender, EventArgs e) + { + Databound(); + } + protected void btnAssign_Click(object sender, EventArgs e) + { + + if (TreeDeptEmp.SelectedNode == null || TreeDeptEmp.SelectedNode != null && TreeDeptEmp.SelectedValue == "0" || TreeDeptEmp.SelectedNode.Parent.Value=="0") + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('ѡĿˡ');", true); + return; + } + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ) ) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; + _logic.GetProject.pj_master = Convert.ToInt32(TreeDeptEmp.SelectedValue); + _logic.GetProject.pj_dept = Convert.ToInt32(TreeDeptEmp.SelectedNode.Parent.Value); + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + protected void btnUnAssign_Click(object sender, EventArgs e) + { + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + _logic.GetProject.Update(); + } + } + + Databound(); + } + + protected void btnFileUpload1_Click(object sender, EventArgs e) + { + const string projectDest = "~/upload/projects/"; + if (fileUpload1.FileName.Length==0) return; + lbuploadmessage.Text = ""; + DirectoryInfo dir = new DirectoryInfo(Server.MapPath(projectDest)); + if (!dir.Exists) + dir.Create(); + string fileSavePath = Server.MapPath(projectDest + fileUpload1.FileName); + fileUpload1.SaveAs(fileSavePath); + // Master.ScriptMgr.EnablePartialRendering = true; + // pdUpload.Visible = false; + + + + importProjects(fileSavePath); + lbuploadmessage.Text = "ϴɹ"; + Databound(); + + System.IO.File.Delete(fileSavePath); + + } + + void importProjects(string fileName) + { + int Count = 1; + string tableName = string.Empty; + try + { + + DataSet ds = Util.Excel2DataSet(fileName); + foreach (DataTable dt in ds.Tables) + { + + Count = 1; + tableName = dt.TableName; + foreach (DataRow dr in dt.Rows) + { + Count++; + _logic.Initialize(); + if (dr["Ŵ"].ToString().Length>0) + _logic.GetProject.pj_dept = Convert.ToInt32(dr["Ŵ"].ToString()); + if (dr["Ա"].ToString().Length > 0) + _logic.GetProject.pj_master = Convert.ToInt32(dr["Ա"].ToString()); + _logic.GetProject.pj_mem = dr["Ŀ"].ToString().Substring(0,500); + _logic.GetProject.pj_name = dr["Ŀ"].ToString().Substring(0,50); + if (dr["ĿȨ"].ToString().Length > 0) + _logic.GetProject.pj_percent = Convert.ToInt32(dr["ĿȨ"].ToString()); + _logic.GetProject.pj_type = dr["Ŀ"].ToString(); + _logic.GetProject.pj_nextDept =-1; // + if (_logic.GetProject.pj_master >0) _logic.GetProject.pj_status = ProjectStatus.Ŀѷ; + else + { + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + + _logic.GetProject.pj_planStartDate = dr["Ŀʼ"].ToString().Trim() + "-" + dr["Ŀʼ·"].ToString().Trim() + "-01"; + _logic.GetProject.pj_planEndDate = _logic.GetProject.pj_planStartDate; + + Convert.ToDateTime(_logic.GetProject.pj_planStartDate).AddMonths(Convert.ToInt32(dr["ĿȨ"].ToString())); + _logic.AddProject(); + } + } + + } + catch (Exception ) + { + string errorMsg = " " + tableName +" "+ Count +" д󣬼ԡ"; + lbuploadmessage.Text = lbuploadmessage.Text + errorMsg; + throw; + // ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('"+ errorMsg+"');", true); + + + } + + + + } + + + + + protected void btnActive_Click(object sender, EventArgs e) + { + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀⶳ)) + { + + _logic.GetProject.pj_status = ProjectStatus.Ŀⶳ; + _logic.GetProject.Update(); + } + } + + Databound(); + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + protected void Page_Init() + { + + // PostBackTrigger trigger = new PostBackTrigger(); + // trigger.ControlID = Button1.UniqueID; + // ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + + void page_init() + { + Master.ScriptMgr.EnablePartialRendering = false; + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + } + + + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} + \ No newline at end of file diff --git a/Project/ProjectMain.aspx b/Project/ProjectMain.aspx new file mode 100644 index 0000000..62c10a2 --- /dev/null +++ b/Project/ProjectMain.aspx @@ -0,0 +1,484 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectMain.aspx.cs" Inherits="ProjectMain" EnableEventValidation = "false" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + ѡ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + +   +
+
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0% + + + +
+ + + + + + +
+ + + + صĿ + һĿ + + + + + 0 + %* + *
+ + + +
+ + + + * +
+
+
+ + +   + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + +
+ + +   +  
+
+ + + + + +
+ + + % + + * + * +  
+ + +
+
+ + + +   +  
+   + + + + + + + + + + + + + + û + + + + + +
+
+
+ +
+
+
+ + + + + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+
+
diff --git a/Project/ProjectMain.aspx.bak b/Project/ProjectMain.aspx.bak new file mode 100644 index 0000000..532c5e6 --- /dev/null +++ b/Project/ProjectMain.aspx.bak @@ -0,0 +1,483 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" + CodeFile="ProjectMain.aspx.cs" Inherits="ProjectMain" EnableEventValidation = "false" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + ѡ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + +   +
+
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0% + + + +
+ + + + + + +
+ + + + صĿ + һĿ + + + + + 0 + %* + *
+ + + +
+ + + + * +
+
+
+ + +   + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + +
+ + +   +  
+
+ + + + + +
+ + + % + + * + * +  
+ + +
+
+ + + +   +  
+   + + + + + + + + + + + + + + û + + + + + +
+
+
+ +
+
+
+ + + + + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ϵʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"PA_SCORE") %> + + <%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+
+
diff --git a/Project/ProjectMain.aspx.cs b/Project/ProjectMain.aspx.cs new file mode 100644 index 0000000..a673f65 --- /dev/null +++ b/Project/ProjectMain.aspx.cs @@ -0,0 +1,1000 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using view.App_Code; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectMain : PageBase + { + private LProject _logic; + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + Validbtncontrols(rdblstMonth.SelectedValue=="0"); + CurrentMonthSubmit(); + + } + + /***************************************** private methods ******************************************/ + + /// + /// ֻύǰµĿ + /// + void CurrentMonthSubmit() + { + this.btnpdToApprove.Visible = Convert.ToInt32(this.btnYear.Text) == DateTime.Today.Year && rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected; + btnpd2approve.Visible = btnpdToApprove.Visible; + } + + void Validbtncontrols(bool visible) + { + btn_addNew.Visible = visible; + btnPrjToApprove.Visible = visible; + btnDelete.Visible = visible; + + + } + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = _logic.GetAllProjectDetail(lem.GetEmployee.ID,btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + GridView1.DataBind(); + UpdateSession(); + + // ProjectDataBind(); + // ProjectDetailDataBind(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + // this.TxtBtnYear.Text = btnYear.Text; + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + // _logic = (LEmployee)Session[appScope.PagelevelObj]; + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { +// Session[appScope.PagelevelObj] = _logic; + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + // txtProjMem4delete.Visible = (_logic.GetProject.pj_status == ProjectStatus.δύ) && rdblstMonth.Items[0].Selected; //ֻɾԼġ + txtProjMem4delete.Visible = rdblstMonth.Items[0].Selected; // ɾκĿ״̬ + lbprjmem4Delete.Visible = txtProjMem4delete.Visible; + btnDelete.Visible = txtProjMem4delete.Visible; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + txtProjMaster.Text = lem.GetEmployee.em_name; + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString() ; + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + + ApproveListBind(_logic.GetProject.ID); + + // btnDelete.Visible = true; + } + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// ҳĿϢϢشĿʵ + /// + /// + void SetProjectDataBack() + { + + //if (_logic.GetProject.ID > 0) + //{ + // _logic.GetProject.lastmodified = DateTime.Now.ToString(); + + //} + + // ProjectDetail.Visible = true; + _logic.GetProject.pj_name = txtProjectName.Text; + _logic.GetProject.pj_planStartDate = drpdProjlisFromYear.SelectedValue +"-" + drplstProjFromMonth.SelectedValue +"-01"; + _logic.GetProject.pj_planEndDate = drplstProjectToYear.SelectedValue +"-" + drlstProjToMonth.SelectedValue +"-01"; + _logic.GetProject.pj_master = lem.GetEmployee.ID; + _logic.GetProject.pj_mem =txtPrjDesc.Text; + // _logic.GetProject.pj_progress = Convert.ToInt32(txtProjProgress.Text) ; //Ŀ + if (txtProjPercent.Text != string.Empty) _logic.GetProject.pj_percent = Convert.ToInt32(txtProjPercent.Text) ; //ĿȨ + _logic.GetProject.pj_type = drplstProjType.SelectedValue; + _logic.GetProject.pj_status = _logic.GetProject.pj_status == String.Empty ? ProjectStatus.δύ : _logic.GetProject.pj_status; + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_dept = Convert.ToInt32(drplstProjDept.SelectedValue); + if (_logic.GetProject.pj_nextDept == 0) + _logic.GetProject.pj_nextDept = -1; + else + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_nextDept; + + /* + * _logic.GetProject.pj_nextDept = _logic.GetProject.pj_nextDept == 0 ? -1 ; _logic.GetProject.pj_nextDept; + + * _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment( _logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if(dep.GetDepartment.dep_mastdept==0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + } + } + * */ + + } + + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + btnSubmit.Visible = true; + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + ApproveListBind(_logic.GetProjectDetail.ID); + + } + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + btnSubmit.Visible = false; + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + panelApprovelist.Visible = false; + } + + + private void SetProjectDetailBack() + { + //if (_logic.GetProjectDetail.ID > 0) + //{ + // _logic.GetProjectDetail.lastmodified = DateTime.Now.ToString(); + + //} + + _logic.GetProject.pj_progress = Convert.ToInt32(txtPrjProgress.Text) ; + _logic.GetProject.pj_finishDate =txtPdActualEndDate.Text ; + _logic.GetProjectDetail.pd_planTarget =txtPdPlanTarget.Text ; + _logic.GetProjectDetail.pd_finishedTarget = txtPdFinishTarget.Text ; + _logic.GetProjectDetail.pd_percent =Convert.ToInt32(txtPdPercent.Text) ; + _logic.GetProjectDetail.pd_mem =txtPdMem.Text ; + //ʱstatusĬΪδύ + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearProjData(); + ProjectDetail.Visible = true; + btnSaveNewProj.Enabled = true; + validProjControles(); + ProjectMonthDetail.Visible = false; + + + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + /// + /// ĿϢ + /// + /// + /// + protected void btnProjSubmit_Click(object sender, EventArgs e) + { + + if(_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + + //Ŀ״̬ûб仯仯档 + if(_logic.GetProject.pj_status.Equals(ProjectStatus.ύ)||_logic.GetProject.pj_status.Equals(ProjectStatus.ɾύ)) + { + LProject lp = new LProject(); + lp.GetProject.ID =_logic.GetProject.ID; + lp.GetProject.getModel(); + if(!lp.GetProject.pj_status.Equals(_logic.GetProject.pj_status)) + { + // Response.Write(""); + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + "Ѿʧܡ');", true); + ProjectDataBind(); + return; + } + } + SetProjectDataBack(); + if (_logic.GetProject.pj_name == string.Empty || _logic.GetProject.pj_name.Trim().Length == 0) return; + if (_logic.GetProject.pj_percent==0) return; + if (_logic.GetProject.ID > 0) _logic.UpdateProject(); else _logic.AddProject(); + ClearProjData(); + Databound(); + + } + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + /* + CheckBox chk; + if (e.Row.RowType == DataControlRowType.DataRow) + { + chk = new CheckBox(); + chk.ID = e.Row.Cells[0].Text.Trim(); + string pdstatus = e.Row.Cells[13].Text.Trim(); + chk.Enabled = (pdstatus == ProjectDetailStatus.¶δύ || pdstatus == ProjectDetailStatus.δͨ || + pdstatus == ProjectDetailStatus.δͨ || pdstatus == ProjectDetailStatus.Ԥδͨ); + e.Row.Cells[1].Controls.Add(chk); + } + */ + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnReset_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + + /// + /// delete the project and details + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + if(txtProjMem4delete.Text ==null ) return; + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) + { + + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ĿѾɣɾ');", true); + return; + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if ( (dep.GetDepartment.dep_manager != lem.GetEmployee.ID) &&(dep.GetDepartment.dep_mastdept != 0)) + { + return; + } + } + + + if (!_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) ) + { + _logic.GetProject.pj_mem4del = txtProjMem4delete.Text; + _logic.GetProject.pj_status = DeiNiu.Utils.ProjectStatus.ɾδύ; + + _logic.GetProject.Update(); + } + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + + _logic.Delete(); + + } + + + + ClearProjData(); + Databound(); + } + + /***************************************** internal methods ********************************************/ + + + private void chgOperTxt(bool addNew) + { + + + btnSubmit.Enabled = true; + } + + private void ClearProjData() + { + ProjectDetail.Visible = false; + btnSaveNewProj.Enabled = false; + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + panelApprovelist.Visible = false; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + // btnSaveNewProj.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + // btnDelete.Enabled = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || _logic.GetProject.pj_status.EndsWith("δͨ"); + validProjControles(); + btnSubmit.Visible = false; + + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + validPdControles(); + } + void validProjControles() + { + bool canEditSubmit; + canEditSubmit = _logic.GetProject.pj_status.Equals(ProjectStatus.δύ) || !_logic.GetProject.pj_status.EndsWith("ѷ") && !_logic.GetProject.pj_status.EndsWith("ͨ") && !_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) + &&!_logic.GetProject.pj_status.EndsWith("ͨ")|| + _logic.GetProject.pj_status.EndsWith("δͨ") || _logic.GetProject.pj_status.Equals(string.Empty); + txtProjectName.ReadOnly = !canEditSubmit; + // drpdProjlisFromYear.Enabled = divEditProject.Visible; + //drplstProjFromMonth.Enabled = divEditProject.Visible; + // drplstProjectToYear.Enabled = divEditProject.Visible; + // drlstProjToMonth.Enabled = divEditProject.Visible; + drplstProjType.Enabled = canEditSubmit; + txtPrjDesc.ReadOnly = !canEditSubmit; + // txtProjProgress.ReadOnly = !divEditProject.Visible; //Ŀ + txtProjPercent.ReadOnly = !canEditSubmit; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + // txtProjMem4delete.ReadOnly = !canEditSubmit; //δύ; + // lbprjmem4Delete.Visible = divEditProject.Visible; + drplstProjDept.Enabled = canEditSubmit; + + bool canNotDel = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status == String.Empty || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ); + + bool canDel = !canNotDel; + canDel = canDel && this.rdblstMonth.Items[0].Selected; + txtProjMem4delete.Visible = canDel; + lbprjmem4Delete.Visible = canDel; + // if (btnDelete.Visible) + btnDelete.Visible = canDel; + + + } + void validPdControles() + { + //--monthly detail. + projMonthDetailEdit.Visible = _logic.GetProjectDetail.pd_status.Equals(ProjectDetailStatus.¶δύ) || + !_logic.GetProjectDetail.pd_status.EndsWith("ͨ") && + !_logic.GetProjectDetail.pd_status.EndsWith("ͨ") || + _logic.GetProjectDetail.pd_status.Equals(string.Empty); + + + + projMonthDetailEdit.Visible = projMonthDetailEdit.Visible && + !(_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && + !_logic.GetProject.pj_status.EndsWith("δͨ")) || + _logic.GetProject.pj_status.StartsWith("") && + (!_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) || + _logic.GetProjectDetail.pd_status.EndsWith("δύ") || + _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || + _logic.GetProject.pj_status.StartsWith("ɾ")); + + projMonthDetailEdit.Visible = projMonthDetailEdit.Visible || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀѷ); + txtPdName.ReadOnly = !projMonthDetailEdit.Visible; + // txtPdStartDate.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPdEndDate.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPrjProgress.ReadOnly = ! projMonthDetailEdit.Visible ; + // txtPdActualEndDate.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdPlanTarget.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdFinishTarget.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdPercent.ReadOnly = ! projMonthDetailEdit.Visible ; + txtPdMem.ReadOnly = ! projMonthDetailEdit.Visible ; + + //--˰ť + + + } + + + /// + /// project detail + /// + /// + /// + protected void btnSubmit_Click(object sender, EventArgs e) + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + + SetProjectDetailBack(); + + _logic.GetProjectDetail.Update(); + ClearProjDetailData(); + Databound(); + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnToApprove_Click(object sender, EventArgs e) + { + // _logic.GetProject.ID = Convert.ToInt32(GridView1.Rows[1].Cells[0].Text.Trim()); + + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + if( _logic.GetProject.pj_status.EndsWith("δύ")|| _logic.GetProject.pj_status.EndsWith("δͨ") ) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProject.pj_status = ProjectStatus.ͨ; + _logic.GetProject.Update(); + continue; //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.pj_status = ProjectStatus.ύ; + _logic.GetProject.Update(); + } + } + + Databound(); + + + } + + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; + } + + /// + /// ¶ύ + /// + /// + /// + protected void btnpdToApprove_Click(object sender, EventArgs e) + { + + foreach (GridViewRow row in this.GridView1.Rows) + { + HtmlInputCheckBox checkNews = (HtmlInputCheckBox)row.FindControl("checkNews"); + if (!checkNews.Checked) continue; + _logic.Initialize(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value.ToString())); + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) continue; //Ŀύ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) continue; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ԥͨ)) continue; + if (_logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) continue; + if (_logic.GetProject.pj_status.StartsWith("") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.δύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) continue; + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || _logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + } + _logic.GetProject.Update(); + + } + + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + + _logic.GetProjectDetail.Update(); + + _logic.GetProject.Update(); + } + + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ)) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ)) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + else + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + continue; //쵼 + } + continue; + } + //ύ쵼׼ + + if (_logic.GetProject.pj_status.EndsWith("δύ")||_logic.GetProject.pj_status.EndsWith("δͨ")) + { + if(_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾύ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.ύ; + } + } + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + _logic.GetProject.Update(); + } + } + + Databound(); + + } + protected void btnpd2approve_Click(object sender, EventArgs e) + { + btnSubmit_Click( sender, e); + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + if (_logic.GetProject.pj_status.StartsWith("ɾ") && (!_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ) && !_logic.GetProject.pj_status.EndsWith("δͨ"))) return; + if (_logic.GetProject.pj_status.StartsWith("") && ( !_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ))) return; + + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ") || _logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + } + _logic.GetProject.Update(); + } + + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProjectDetail.Update(); + _logic.GetProject.Update(); + } + + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ɾδύ)) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + else if (_logic.GetProject.pj_status.Equals(ProjectStatus.δύ)) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + else + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + //쵼 + } + Databound(); + return; + } + //ύ쵼׼ + + if (_logic.GetProject.pj_status.EndsWith("δύ") || _logic.GetProject.pj_status.EndsWith("δͨ")) + { + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + { + _logic.GetProject.pj_status = ProjectStatus.ɾύ; + } + + if (_logic.GetProject.pj_status.StartsWith("")) + { + _logic.GetProject.pj_status = ProjectStatus.ύ; + } + } + else + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + _logic.GetProject.Update(); + } + Databound(); + } + protected void btnpj2approve_Click(object sender, EventArgs e) + { + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; //Ŀύ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ)) return; + + if (_logic.GetProjectDetail.pd_status.EndsWith("δύ") || _logic.GetProjectDetail.pd_status.EndsWith("δͨ")) + { + _logic.GetProject.pj_nextDept = _logic.GetProject.pj_dept; + //ĿDZŵܣύϼ + LDepartment dep = new LDepartment(_logic.GetProject.pj_dept); + if (dep.GetDepartment.dep_manager == lem.GetEmployee.ID) + { + _logic.GetProject.pj_nextDept = dep.GetDepartment.dep_mastdept; + if (dep.GetDepartment.dep_mastdept == 0) //ûϼ + { + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.Update(); + _logic.GetProjectDetail.Update(); + //쵼 + } + } + //ύ쵼׼ + _logic.GetProject.Update(); + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.¶ύ; + _logic.GetProjectDetail.Update(); + } + Databound(); + } + protected void btnFileUpload_Click(object sender, EventArgs e) + { + + + Session["uploadCode"] = new Random().Next(); + string fileCode = Session["uploadCode"].ToString(); + string fileType = ((int)FileType.ProjectDetail).ToString(); + string fileInfo = _logic.GetProjectDetail.ID.ToString(); + string fileUPload = " window.showModalDialog('../upload/fileUpload.aspx?'+Math.random() +'=" + fileCode + "&fileType=" + fileType + "&fileInfo=" + fileInfo + "&id=" + lem.GetEmployee.ID + "' )"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", fileUPload, true); + + + + } + + protected void btnFileUploadReferesh_Click1(object sender, EventArgs e) + { + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + protected void GVFiles_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles != null) + { + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[e.RowIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + fileObj.GetFilesmgr.Delete(); + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest ; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + protected void btnpj2approve_Click1(object sender, EventArgs e) + { + + } + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl( Button1); + GridView1.AllowPaging = false; + GridView1.Columns[1].Visible = false; + GridView1.Columns[GridView1.Columns.Count -1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = true; + GridView1.Columns[1].Visible = true; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + +} + \ No newline at end of file diff --git a/Project/ProjectsQuery.aspx b/Project/ProjectsQuery.aspx new file mode 100644 index 0000000..0f8f3bb --- /dev/null +++ b/Project/ProjectsQuery.aspx @@ -0,0 +1,224 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="ProjectsQuery.aspx.cs" Inherits="ProjectsQuery" EnableEventValidation = "false"%> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ŀ
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + +
+ +
Ŀϸ
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+ +
+ +
+ +
+
+ + + +
+
+
+ diff --git a/Project/ProjectsQuery.aspx.bak b/Project/ProjectsQuery.aspx.bak new file mode 100644 index 0000000..094fe02 --- /dev/null +++ b/Project/ProjectsQuery.aspx.bak @@ -0,0 +1,222 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="ProjectsQuery.aspx.cs" Inherits="ProjectsQuery" EnableEventValidation = "false"%> +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ŀ
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + +
+ +
Ŀϸ
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + +
+ +
+ +
+ +
+
+ + + +
+
+
+ diff --git a/Project/ProjectsQuery.aspx.cs b/Project/ProjectsQuery.aspx.cs new file mode 100644 index 0000000..edea638 --- /dev/null +++ b/Project/ProjectsQuery.aspx.cs @@ -0,0 +1,298 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class ProjectsQuery : PageBase +{ + private LProject _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + _logic = new LProject(); + bindDeptEmp(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + DataView dv2 = _logic.GetSumProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + if ( TreeDeptEmp.SelectedNode !=null && TreeDeptEmp.SelectedNode.Value!="0") + { + string selectedValue = TreeDeptEmp.SelectedValue; + string wherecls = "ID= '" + selectedValue + "'"; + if (TreeDeptEmp.SelectedNode.Text.StartsWith(".")) + { + wherecls = "ID= '" + selectedValue + "'"; + } + dv2.RowFilter = wherecls; + } + + + + GridView1.DataSource = dv2 ; + GridView1.DataBind(); + if (GridView1.DataKeys != null && GridView1.DataKeys.Count>0 && GridView1.SelectedIndex!=-1) + { + Databound( GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString()); + }else + + { + GridView2.DataSource = null; + GridView2.DataBind(); + } + + + + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + } + + private void Databound(string empId) + { + // if (empId == null) throw new ArgumentNullException("empId"); + if (empId == null) return; + + DataView dv = _logic.GetAllProjectDetail(Convert.ToInt32(empId),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + GridView2.DataSource = dv; + GridView2.DataBind(); + + } + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + // TreeDeptEmp.Nodes.Clear(); + BindEmpTree(TreeDeptEmp, "0", TreeDeptEmp.SelectedNode,lem.GetDepartments().DefaultView, lem.GetActivedEmpDept().DefaultView); + + + + } + + + + public void BindEmpTree(TreeView tree, string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + ""; + node.Value = row["ID"].ToString(); + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "de_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode( "."+emrow["em_name"] , emrow["ID"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + tree.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(tree, node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + void setTreeDeptEmpSelected(string toFind,TreeNode nd) + { + foreach (TreeNode cnd in nd.ChildNodes) + { + if (cnd.Value == toFind) + { + cnd.Selected = true; + break; + } + else + { + setTreeDeptEmpSelected(toFind,cnd); + } + + } + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView2.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + Databound(); + + } + + + + protected void TreeDeptEmp_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + + Databound(); + + } + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + // btnYear.Text = TxtBtnYear.Text; + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + trigger = new PostBackTrigger(); + trigger.ControlID = Button2.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export1("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + protected void Excel_Click2(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView2.AllowPaging = false; + + Databound(); + Export2("application/ms-excel", "Ŀϸб.xls"); + GridView2.AllowPaging = false; + + Databound(); + + } + + + private void Export1(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + private void Export2(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView2.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} \ No newline at end of file diff --git a/Project/WorkPlanMain.aspx b/Project/WorkPlanMain.aspx new file mode 100644 index 0000000..a4a300a --- /dev/null +++ b/Project/WorkPlanMain.aspx @@ -0,0 +1,116 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="WorkplanMain.aspx.cs" Inherits="WorkplanMain" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + û + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+
+ + + + + + +
+ +
+ +
+ diff --git a/Project/WorkPlanMain.aspx.cs b/Project/WorkPlanMain.aspx.cs new file mode 100644 index 0000000..4f17cc5 --- /dev/null +++ b/Project/WorkPlanMain.aspx.cs @@ -0,0 +1,232 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class WorkplanMain : PageBase +{ + private LWorkplan _logic; + + protected void Page_Load(object sender, EventArgs e) + { + lem = (LEmployee)Session["CurrentUser"]; + if (!IsPostBack) + { + _logic = new LWorkplan(); + Calendar1.SelectedDate = DateTime.Today ; + Databound(); + + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + _logic.CheckWorkplan(lem.GetEmployee.ID, Calendar1.SelectedDate.ToString(),true); + GridView1.DataSource = _logic.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID,Calendar1.SelectedDate.ToString()); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + // ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LWorkplan)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtPlanContent.Text = _logic.GetLWorkplanDetail.wpd_content; + txtPlanMem.Text = _logic.GetLWorkplanDetail.wpd_mem; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + // _logic.Initialize(); _logic.CheckWorkplan ʼƻ + _logic.InitializeDetail(); + UpdateSession(); + DetailDataBind(); + txtPlanContent.Focus(); + GridView1.SelectedIndex = -1; + + Databound(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + txtPlanContent.Focus(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLWorkplanDetail.ID > 0 ? _logic.GetLWorkplanDetail.Update() : _logic.GetLWorkplanDetail.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + /* + _logic.GetRole.dr = false; + _logic.GetRole.Update(); + + */ + _logic.GetLWorkplanDetail.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) + { + + } + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + + string sortExpression = e.SortExpression; + if (GridView1.SortDirection == SortDirection.Ascending) // + { + + SortGridView(sortExpression, " DESC"); + } + else + { + + SortGridView(sortExpression, " ASC"); + } + } + private void SortGridView(string sortExpression, string direction) + { + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.Sort = sortExpression + direction; + GridView1.DataSource = dv; //DataView󶨵GridView + GridView1.DataBind(); + + } + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + ClearDetail(); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + //if (_logic.GetLWorkplanDetail.ID > 0) + // _logic.GetLWorkplanDetail.lastmodified = DateTime.Now.ToString(); + + _logic.GetLWorkplanDetail.wpd_content = txtPlanContent.Text; + _logic.GetLWorkplanDetail.wpd_mem = txtPlanMem.Text; + _logic.GetLWorkplanDetail.wpd_workplan = _logic.GetLWorkplan.ID; + _logic.GetLWorkplanDetail.wpd_number = _logic.getNexNumber(_logic.GetLWorkplan.ID); + } + + private void chgOperTxt(bool addNew) + { + btnSubmit.Enabled = true; + DataDetail.Visible = true; + } + + private void ClearDetail() + { + txtPlanMem.Text = ""; + txtPlanContent.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + protected void Calendar1_SelectionChanged(object sender, EventArgs e) + { + Databound(); + } + protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) + { + // e.Cell.Controls.Add(new LiteralControl(" ")); + // e.Cell.Font.Size = FontUnit.XXLarge; + } +} diff --git a/Project/WorkReport.aspx b/Project/WorkReport.aspx new file mode 100644 index 0000000..7e210d5 --- /dev/null +++ b/Project/WorkReport.aspx @@ -0,0 +1,96 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="WorkReport.aspx.cs" Inherits="Project_WorkReport" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +    + + +
+ + +   +  
+ + +   + + + + +  
+
+
+   +   + + + + + + + + + + + + + + + 没有数据 + + + + +
+
+ diff --git a/Project/WorkReport.aspx.cs b/Project/WorkReport.aspx.cs new file mode 100644 index 0000000..a08313e --- /dev/null +++ b/Project/WorkReport.aspx.cs @@ -0,0 +1,164 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.IO; +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 DeiNiu.Utils; +using DeiNiu.wms.Logical; + +public partial class Project_WorkReport : PageBase +{ + private LFile _logic; + protected void Page_Load(object sender, EventArgs e) + { + if(! IsPostBack) + { + InitializeControles(); + _logic =new LFile(); + Databound(); + } + + SessionSeting(); + + } + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LFile)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + void Databound() + { + GVFiles.DataSource = _logic.GetFilesmgr.GetFilesByEmpFileType(lem.GetEmployee.ID,Convert.ToInt32(drplstFileType.SelectedValue)); + GVFiles.DataBind(); + UpdateSession(); + + } + void InitializeControles() + { + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + ListItem li = new ListItem("半年度计划",((int)FileType.半年度计划).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("半年度总结", ((int)FileType.半年度总结).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("年度计划", ((int)FileType.年度计划).ToString()); + drplstFileType.Items.Add(li); + li = new ListItem("年度总结", ((int)FileType.年度总结).ToString()); + drplstFileType.Items.Add(li); + } + + protected void btnFileUpload_Click(object sender, EventArgs e) + { + try + { + if (drplstProjDept.Items.Count==0) return; + if (fileUpload.FileName.Length == 0) return; + lbuploadmessage.Text = ""; + string fileName = fileUpload.FileName; + + System.Random rand = new Random(); + int len = rand.Next(); + fileName = lem.GetEmployee.ID + "T" + drplstFileType.SelectedValue + len + + fileName.Substring(fileName.LastIndexOf(".")); + DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/upload/" + drplstFileType.SelectedValue)); + if (!dir.Exists) + dir.Create(); + string fileSavePath = Server.MapPath("~/upload/" + drplstFileType.SelectedValue + "/" + fileName); + fileUpload.SaveAs(fileSavePath); + lbuploadmessage.Text = "上传成功!"; + + LFile _logic = new LFile(); + _logic.Initialize(); + _logic.GetFilesmgr.File_type = Convert.ToInt32(drplstFileType.SelectedValue); + _logic.GetFilesmgr.file_dest = fileName; + _logic.GetFilesmgr.File_Desc = txtFileDesc.Text; + _logic.GetFilesmgr.File_Emp = Convert.ToInt32(lem.GetEmployee.ID); + _logic.GetFilesmgr.file_Dept = Convert.ToInt32(drplstProjDept.SelectedValue); + _logic.GetFilesmgr.Add(); + Databound(); + + } + catch (Exception) + { + + lbuploadmessage.Text = "上传失败!"; + } + } + protected void GVFiles_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles != null) + { + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[e.RowIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + if(fileObj.GetFilesmgr.File_Emp != lem.GetEmployee.ID) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('不可以删除他人的文档。 ');", true); + return; + } + fileObj.GetFilesmgr.Delete(); + Databound(); + } + } + + + } + // 查看附件 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + void page_init() + { + Master.ScriptMgr.EnablePartialRendering = false; + } + + protected void btnQuery_Click(object sender, EventArgs e) + { + if( drplstProjDept.Items.Count ==0) return; + DataView dv; + string dept = drplstProjDept.SelectedValue; + dv = _logic.GetFilesmgr.GetFilesByEmpFileType(lem.GetEmployee.ID, Convert.ToInt32(drplstFileType.SelectedValue)).DefaultView; + if(lem.GetCanApproveDeptList().Contains(dept)) + dv = _logic.GetFilesmgr.GetFilesByDeptFileType( Convert.ToInt32(dept), Convert.ToInt32(drplstFileType.SelectedValue)).DefaultView; + + GVFiles.DataSource = dv; + GVFiles.DataBind(); + + + + } +} diff --git a/Project/复件 ProjectApprove.aspx.cspu b/Project/复件 ProjectApprove.aspx.cspu new file mode 100644 index 0000000..d45b53b --- /dev/null +++ b/Project/复件 ProjectApprove.aspx.cspu @@ -0,0 +1,836 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Transactions; +using System.Web; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + + + +public partial class ProjectApprove : PageBase + { + private LProject _logic; + private string authType = ""; + protected void Page_Load(object sender, EventArgs e) + { + + + // divPreApproveSubmit.Visible = authType.Equals("100"); //ְ¼ + // divApproveSubmit.Visible = authType.Equals("200"); //ְ¼ + // emId = Master.lem.GetEmployee.ID; masterpage has not been initialized yet + + authType = Request.QueryString[0] ; + if (!IsPostBack) + { + if (lem == null) return ; + _logic = new LProject(); + initializeControles(); + Databound(); + } + SessionSeting(); + + + } + + /***************************************** private methods ******************************************/ + + + + + /// + /// bound the query list. + /// + private void Databound() + { + GridView1.DataSource = GetProjectListByRole(); + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearProjDetailData(); + ClearProjData(); + PanelApprove.Visible = false; + } + /// + /// ͨжϵǰûݣȷزͬĿб + /// + /// + DataView GetProjectListByRole() + { + if(authType.Equals("100")) //Ԥ + { + if (lem.CanShenHe || lem.CanYuShen) // ǰûĿȨ + { + return _logic.Get4ApproveList(lem.GetCanApproveDeptList(),btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + + } + + } + + if (authType.Equals("200")) + if (lem.CanKaoHe ) // + { + DataView dv = _logic.GetProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "','" +ProjectStatus.ɾͨ+ "') and pd_status not in ('" + + ProjectDetailStatus.ͨ + "','" +ProjectDetailStatus.δͨ +"')" + + " or pd_status in('" + ProjectDetailStatus.ͨ + "')"; + return dv; + + } + + if (authType.Equals("300")) + if (lem.CanKaoHe) // ʷ¼ + { + DataView dv = _logic.GetKaoHeHistoryProjectsByYearMonth(btnYear.Text, rdblstMonth.SelectedValue).DefaultView; + dv.RowFilter = "pj_status in('" + ProjectStatus.ͨ + "','" + ProjectStatus.Ŀ + "')"; + return dv; + + } + + return new DataView(); + } + + void initializeControles() + { + btnYear.Text = DateTime.Today.Year.ToString(); + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items.FindByValue(DateTime.Today.Month.ToString()).Selected = true; + + drpdProjlisFromYear.Items.Clear(); + drplstProjectToYear.Items.Clear(); + + for (int i = DateTime.Now.Year-10; i < DateTime.Now.Year + 10; i++) + { + ListItem li = new ListItem(i.ToString(),i.ToString()); + drpdProjlisFromYear.Items.Add(li); + drplstProjectToYear.Items.Add(li); + } + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + + drplstProjDept.DataSource = lem.GetEmployee.GetDepartments(); + drplstProjDept.DataTextField = "DEP_NAME"; + drplstProjDept.DataValueField = "ID"; + drplstProjDept.DataBind(); + + + } + + private void SessionSeting() + { + if (IsPostBack) + { + + _logic = (LProject)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// 󶨵ǰĿϢҳĿϢ + /// + void ProjectDataBind() + { + ProjectDetail.Visible = true; + txtProjectName.Text = _logic.GetProject.pj_name; + SetDropDownlistSelection(drpdProjlisFromYear, Convert.ToDateTime(_logic.GetProject.pj_planStartDate) .Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, Convert.ToDateTime(_logic.GetProject.pj_planStartDate).Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, Convert.ToDateTime(_logic.GetProject.pj_planEndDate).Month.ToString()); + + txtPrjDesc.Text = _logic.GetProject.pj_mem; + txtProjProgress.Text = _logic.GetProject.pj_progress.ToString(); //Ŀ + txtProjPercent.Text = _logic.GetProject.pj_percent.ToString(); //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + lbprjmem4Delete.Visible = _logic.GetProject.pj_status == DeiNiu.Utils.ProjectStatus.δύ; + txtProjMem4delete.Text = _logic.GetProject.pj_mem4del; + validControles(); + ApproveListBind(_logic.GetProject.ID); + + SetDropDownlistSelection(drplstProjDept, _logic.GetProject.pj_dept.ToString() ); + divApproveScore.Visible = false; + } + + void ApproveListBind(int id) + { + RepeaterApproveList.DataSource = _logic.PaObj.GetApproveListByTastkId(id); + RepeaterApproveList.DataBind(); + panelApprovelist.Visible = true; + } + /// + /// set data from shift object to page + /// + private void ProjectDetailDataBind() + { + ProjectMonthDetail.Visible = true; + + txtPdName.Text = _logic.GetProject.pj_name; + txtPdStartDate.Text = _logic.GetProject.pj_planStartDate; + txtPdEndDate.Text = _logic.GetProject.pj_planEndDate; + txtPrjProgress.Text = _logic.GetProject.pj_progress.ToString(); + txtPdActualEndDate.Text = _logic.GetProject.pj_finishDate; + txtPdPlanTarget.Text = _logic.GetProjectDetail.pd_planTarget; + txtPdFinishTarget.Text = _logic.GetProjectDetail.pd_finishedTarget; + txtPdPercent.Text = _logic.GetProjectDetail.pd_percent.ToString(); + txtPdMem.Text = _logic.GetProjectDetail.pd_mem; + ApproveListBind(_logic.GetProjectDetail.ID); + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + validControles(); + MonthlyScore(); + } + void MonthlyScore() + { + + divApproveScore.Visible = true; + txtSystemScore.Text = (Convert.ToDouble(_logic.GetProject.pj_percent*_logic.GetProjectDetail.pd_percent)/100).ToString(); + + } + + + /// + /// set data from shift object to page + /// + private void ClearProjDetailData() + { + ProjectMonthDetail.Visible = false; + + txtPdName.Text = ""; + txtPdStartDate.Text = ""; + txtPdEndDate.Text = ""; + txtPrjProgress.Text = ""; + txtPdActualEndDate.Text = ""; + txtPdPlanTarget.Text =""; + txtPdFinishTarget.Text = ""; + txtPdPercent.Text = ""; + txtPdMem.Text =""; + + //bind the files + + GVFiles.DataSource = _logic.GetProjectDetail.GetFiles(); + GVFiles.DataBind(); + + } + + + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + + + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + + + + /***************************************** internal methods ********************************************/ + + + + private void ClearProjData() + { + ProjectDetail.Visible = false; + + txtProjectName.Text = ""; + SetDropDownlistSelection(drpdProjlisFromYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drplstProjFromMonth, DateTime.Now.Month.ToString()); + SetDropDownlistSelection(drplstProjectToYear, DateTime.Now.Year.ToString()); + SetDropDownlistSelection(drlstProjToMonth, DateTime.Now.Month.ToString()); + + txtProjMaster.Text = ""; + txtPrjDesc.Text =""; + txtProjProgress.Text = ""; //Ŀ + txtProjPercent.Text = ""; //ĿȨ + // SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.Visible =false; + lbprjmem4Delete.Visible =false; + txtProjMem4delete.Text = ""; + + } + + + + protected void SetDropDownlistSelection(DropDownList drdlst,string value) + { + drdlst.Items[drdlst.SelectedIndex].Selected = false; + if (drdlst.Items.FindByValue(value)!=null) + drdlst.Items.FindByValue(value).Selected = true; + } + + + /// + /// edit project detail + /// + /// + /// + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + /* + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + + */ + } + + + /// + /// ʾĿϢ + /// + /// + /// + protected void GridView1_EditProject(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + GridView1.SelectedIndex = e.RowIndex; + Databound(); + ProjectDataBind(); + PanelApprove.Visible = true; + } + + + /// + /// ȱ༭/ƻ + /// + /// + /// + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + ProjectDetailDataBind(); + PanelApprove.Visible = true; + divApproveProject.Visible = _logic.GetProject.pj_status == ProjectStatus.ͨ || + _logic.GetProject.pj_status == ProjectStatus.Ŀѷ || + _logic.GetProject.pj_status == ProjectStatus.Ŀδ || + _logic.GetProject.pj_status == ProjectStatus.Ŀ || + _logic.GetProject.pj_status == ProjectStatus.Ŀⶳ; + } + void validControles() + { + txtProjectName.ReadOnly = true; + drpdProjlisFromYear.Enabled = false ; + drplstProjFromMonth.Enabled = false; + drplstProjectToYear.Enabled = false; + drlstProjToMonth.Enabled = false; + drplstProjType.Enabled = false; + txtPrjDesc.ReadOnly = true; + txtProjProgress.ReadOnly = true; //Ŀ + txtProjPercent.ReadOnly = true; //ĿȨ + SetDropDownlistSelection(drplstProjType, _logic.GetProject.pj_type); + txtProjMem4delete.ReadOnly = true; //δύ; + // lbprjmem4Delete.Visible = false; + drplstProjDept.Enabled = false; + + //--monthly detail. + + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + txtPdName.ReadOnly = true; + txtPdStartDate.ReadOnly = true; + txtPdEndDate.ReadOnly = true; + txtPrjProgress.ReadOnly = true; + txtPdActualEndDate.ReadOnly = true; + txtPdPlanTarget.ReadOnly = true; + txtPdFinishTarget.ReadOnly = true; + txtPdPercent.ReadOnly = true; + txtPdMem.ReadOnly = true; + //--˰ť + btnApprove.Visible = true; + btnReject.Visible = true; + + } + + + protected void rdblstMonth_SelectedIndexChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + Databound(); + } + protected void btnYear_Click(object sender, EventArgs e) + { + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + + + } + + void bindProjectNote() + { + + } + + protected void btnApprove_Click(object sender, EventArgs e) + { + + + + } + protected void btnReject_Click(object sender, EventArgs e) + { + + if (ProjectDetail.Visible) //Ŀ + { + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪʧܡ');", true); + return; + } + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)) + { + if (authType.Equals("100")) //Ԥ + + { ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨ ʧ');", true);return; + } + if (authType.Equals("200")) //ˣٳ֣ΪδĿ + if (!lem.CanKaoHe) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧ');", true); return; + + + } + + } + + + + //Ŀ״̬ + if (lem.CanKaoHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.δͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾδͨ; + } + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥδͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤδͨ; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + + } + else + { + //Ŀ¶ϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.δͨ; + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥδͨ; + } + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + + } + + + using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + //Ŀһ + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.Update(); + //¼˶ + + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + _logic.PaObj.pa_isProj = !ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = false; + _logic.PaObj.Add(); + + trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + + + ApproveListBind(_logic.GetProject.ID); + GridView1.SelectedIndex = -1; + Databound();//° + txtApproveMem.Text = ""; + // ApproveListBind(_logic.GetProject.ID); + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + protected void btnApprove_Click1(object sender, EventArgs e) + { + + + + LDepartment dept = new LDepartment( ); + dept.Initialize(_logic.GetProject.pj_nextDept); + + if (ProjectDetail.Visible) //Ŀ + { + + + + //жĿǷѾֹڶ¶ʱĿ + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + " ѾͨҪʧܡ');", true); + + return; + + } + + if (_logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)|| _logic.GetProject.pj_status.Equals(ProjectStatus.ɾͨ)) + { + if (authType.Equals("100")) //Ԥ + + {ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " Ѿͨٴʧܡ');", true); + return; + } + + if (!lem.CanKaoHe) // + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof (UpdatePanel), "alert", + "alert('Ŀ " + _logic.GetProject.pj_name + + " ѾͨҪп˵Ȩܽпˣʧܡ');", true); + return; + } + + + } + + //Ŀ״̬ + if (lem.CanKaoHe && authType.Equals("200") ) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + _logic.GetProject.balanceThePercent(); + _logic.GetProject.pj_nextDept = -1; + } + + else if (lem.CanShenHe) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.ͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾͨ; + /* { + _logic.GetProject.pj_master = -1; + _logic.GetProject.pj_dept = -1; + _logic.GetProject.pj_status = ProjectStatus.Ŀδ; + } + */ + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + else if (lem.CanYuShen) + { + if (_logic.GetProject.pj_status.StartsWith("")) + _logic.GetProject.pj_status = ProjectStatus.Ԥͨ; + if (_logic.GetProject.pj_status.StartsWith("ɾ")) + _logic.GetProject.pj_status = ProjectStatus.ɾԤͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + _logic.PaObj.pa_id = _logic.GetProject.ID; + + } + else + { + +/* + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.StartsWith("ɾ") || + _logic.GetProject.pj_status.StartsWith("") && + (! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ) || + +! _logic.GetProject.pj_status.Equals(ProjectStatus.ͨ)); + */ + bool canNotApprove = _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀ) || + _logic.GetProject.pj_status.Equals(ProjectStatus.Ŀδ); + + + if(canNotApprove ) + { + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", "alert('Ŀ " + _logic.GetProject.pj_name + + " ¶ʧܡ');", true); + return; + } + + + + + //Ŀϸ״̬ + if (lem.CanKaoHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + _logic.GetProject.pj_nextDept = -1; + _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + // _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + + + } + + else if (lem.CanShenHe) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.ͨ; + + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + + _logic.GetProject.pj_status = ProjectStatus.Ŀ; + // _logic.GetProject.pj_score = Convert.ToDecimal(txtSystemScore.Text); //Ŀ + _logic.GetProject.pj_finishDate = DateTime.Now.ToShortDateString(); + _logic.GetProject.pj_score = _logic.GetProjectDetail.pd_percent; + + + } + else if (lem.CanYuShen) + { + + _logic.GetProjectDetail.pd_status = ProjectDetailStatus.Ԥͨ; + _logic.GetProject.pj_nextDept = dept.GetDepartment.dep_mastdept; + } + + _logic.PaObj.pa_id = _logic.GetProjectDetail.ID; + // _logic.PaObj.pa_score = txtApproveScore.Text.Length>0 ? Convert.ToInt32(txtApproveScore.Text) : Convert.ToInt32(txtSystemScore.Text); + _logic.PaObj.pa_score=Convert.ToDecimal(txtSystemScore.Text); + + } + + using (TransactionScope trans = new TransactionScope()) + { + try + { + if (!ProjectDetail.Visible) + _logic.GetProjectDetail.Update(); + //Ŀһ + + _logic.GetProject.Update(); + //¼˶ + _logic.PaObj.pa_dept = _logic.GetProject.pj_dept; + + _logic.PaObj.pa_emp = lem.GetEmployee.ID; + + _logic.PaObj.pa_isProj = ProjectDetail.Visible; + _logic.PaObj.pa_mem = txtApproveMem.Text.Trim(); + _logic.PaObj.pa_pass = true; + _logic.PaObj.Add(); + + trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣Ŀʧܡ"); + } + + + } + + ApproveListBind(_logic.GetProject.ID); + txtApproveMem.Text = ""; + GridView1.SelectedIndex = -1; + Databound();//° + + // ProjectMonthDetail.Visible = false; + // ProjectDetail.Visible = false; + // PanelApprove.Visible = false; + } + + public string FormatShowContent(bool pass) + { + if (pass) + return "ͨ" + ""; + return "δͨ" + ""; ; + } + + protected void TxtBtnYear_TextChanged(object sender, EventArgs e) + { + + rdblstMonth.SelectedItem.Selected = false; + rdblstMonth.Items[0].Selected = true; + Databound(); + + } + // 鿴 + protected void GVFiles_SelectedIndexChanged(object sender, EventArgs e) + { + LFile fileObj = new LFile(); + if (GVFiles.DataKeys != null) + { + string id = GVFiles.DataKeys[GVFiles.SelectedIndex].Value.ToString(); + + fileObj.Initialize(int.Parse(id)); + string fileName = fileObj.GetFilesmgr.file_dest; + fileName = Server.UrlEncode("../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest); + fileName = "../upload/" + fileObj.GetFilesmgr.File_type + "/" + fileObj.GetFilesmgr.file_dest; + string openFile = "window.open('" + fileName + "');"; + ScriptManager.RegisterStartupScript(Master.UpdatePanelMaster, typeof(UpdatePanel), "alert", openFile, true); + } + } + + + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + + } + public override void VerifyRenderingInServerForm(Control control) + { + } + + protected void Excel_Click(object sender, EventArgs e) + { + Master.ScriptMgr.RegisterPostBackControl(Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "Ŀб.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } +} + \ No newline at end of file diff --git a/Project/复件 ProjectApprove.aspxpu b/Project/复件 ProjectApprove.aspxpu new file mode 100644 index 0000000..ea35f39 --- /dev/null +++ b/Project/复件 ProjectApprove.aspxpu @@ -0,0 +1,445 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" EnableEventValidation = "true" + CodeFile="ProjectApprove.aspx.cs" Inherits="ProjectApprove" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +   +
+ + + + + ȫ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + û + + + + + + +
+   + + + +
+ + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + 2009 + 2010 + 2011 + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 +
+ + 0 + %  + + + + +
+ + + + + + + +
+ + + + صĿ + һĿ + + + + + + + %
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + +
+ + + +   + +   +
+
+ + + + + +
+ + + + +   +
+ + +
+   + + + + + + + + + + + + + + û + + + + +
+
+
+ ¼ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ʱ
<%# FormatShowContent((bool)DataBinder.Eval(Container.DataItem,"PA_PASS")) %><%# DataBinder.Eval(Container.DataItem,"EM_NAME") %><%# DataBinder.Eval(Container.DataItem,"CREATE_TIME") %>
ע
 <%# DataBinder.Eval(Container.DataItem,"PA_MEM") %>
+
+
+
+
+ + + +
+ + + + + + +
+ + +
+
+
+ + +
+
+
diff --git a/ShowError.aspx b/ShowError.aspx new file mode 100644 index 0000000..809f1ca --- /dev/null +++ b/ShowError.aspx @@ -0,0 +1,24 @@ +<%@ Page Language="C#" MasterPageFile="masterPage.master" AutoEventWireup="true" CodeFile="ShowError.aspx.cs" Inherits="ShowError" %> + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ diff --git a/ShowError.aspx.cs b/ShowError.aspx.cs new file mode 100644 index 0000000..e834156 --- /dev/null +++ b/ShowError.aspx.cs @@ -0,0 +1,25 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +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 System.Text; +public partial class ShowError : Page +{ + protected void Page_Load(object sender, EventArgs e) + { + // StringBuilder strResponse =(StringBuilder) Session["ERROINFO"]; + // String strResponse = Session["ERROINFO"].ToString(); + // Response.Write(strResponse); + // lbErrtrace.Text = Session["ERROINFO"] == null ? "ûе¼ǰỰѹڣµ¼" : Session["ERROINFO"].ToString(); + + lbErrtrace.Text =Application["error"]!=null? Application["error"].ToString() : " ϵԱ"; + Application["error"] = null; + + } +} diff --git a/ShowNews.aspx b/ShowNews.aspx new file mode 100644 index 0000000..c4f6f54 --- /dev/null +++ b/ShowNews.aspx @@ -0,0 +1,42 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowNews.aspx.cs" Inherits="ShowNews" %> + + + + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ +
+ + +


+ + + + +
+ +
+ + diff --git a/ShowNews.aspx.cs b/ShowNews.aspx.cs new file mode 100644 index 0000000..db71b92 --- /dev/null +++ b/ShowNews.aspx.cs @@ -0,0 +1,28 @@ +using System; +using System.Web.UI; +using DeiNiu.wms.Logical; + + +public partial class ShowNews : Page +{ + protected void Page_Load(object sender, EventArgs e) + { + string newsID = Request.QueryString["newsID"]; + LPublicNews logic = new LPublicNews(); + try + { + logic.GetPublicNews.ID = Convert.ToInt32(newsID) ; + logic.GetPublicNews.getModel(); + lbTitle.Text = logic.GetPublicNews.news_title ; + txtContent.Text = logic.GetPublicNews.news_content; + this.Title = logic.GetPublicNews.news_title; + } + catch (Exception) + { + news.Visible = false; + Response.Write("ûҵҪϢ"); + } + + + } +} \ No newline at end of file diff --git a/ShowNewsCate.aspx b/ShowNewsCate.aspx new file mode 100644 index 0000000..5d5aac4 --- /dev/null +++ b/ShowNewsCate.aspx @@ -0,0 +1,72 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="ShowNewsCate.aspx.cs" Inherits="ShowNewsCate" %> + + + + + + + + + + + + + + + + + + + + + + + + + +
<%# DataBinder.Eval(Container.DataItem,"auth_name") %>
+ + + + +
+
    <%# DataBinder.Eval(Container.DataItem,"auth_name") %>   
+ + + + +
+ +      · <%# FormatShowContent((string)DataBinder.Eval(Container.DataItem, "news_title"),25) %> <%# DataBinder.Eval(Container.DataItem, "create_time", "{0:MM/dd} ")%>
+ +
+ + +
+ +
+ +
+ +
+ +
  
+ + + + +    <%# DataBinder.Eval(Container.DataItem,"news_title") %>
+ +<%# DataBinder.Eval(Container.DataItem,"news_content") %> + +
+
+ +
+ + + +  
+ +
+ diff --git a/ShowNewsCate.aspx.cs b/ShowNewsCate.aspx.cs new file mode 100644 index 0000000..00d9a65 --- /dev/null +++ b/ShowNewsCate.aspx.cs @@ -0,0 +1,114 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.Utils; +using DeiNiu.wms.Logical; + +public partial class ShowNewsCate : Page +{ + private string cateId; + private string upId; + protected void Page_Load(object sender, EventArgs e) + { + + cateId = Request.QueryString["cateId"]; + upId = Request.QueryString["upId"]; + if (!IsPostBack) + bindData(); + } + + private void InitializeComponent() + { + + } + + + void bindData() + { + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryTopCatagory().DefaultView; + dv.RowFilter = "ID='" + upId+"'"; + RepeaterTop.DataSource = dv; + RepeaterTop.DataBind(); + + RepeaterMarquee.DataSource = logic.QueryMarqueen().DefaultView; + RepeaterMarquee.DataBind(); + + } + + protected void RepeaterTop_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) + { + if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) + { + Repeater rpColumnNews = (Repeater)e.Item.FindControl("RepeaterSecond"); + //找到分类Repeater关联的数据项 + DataRowView rowv = (DataRowView)e.Item.DataItem; + //提取分类ID + string authID = Convert.ToString(rowv["ID"]); + //里面的Repeater + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryPublicInfomation().DefaultView; + // dv.RowFilter = "auth_uplevel='" + authID + "' and auth_marqueen=0 "; + dv.RowFilter = "ID='" + cateId + "'"; + rpColumnNews.DataSource = dv; + rpColumnNews.DataBind(); + + + } + } + + protected void RepeaterSecond_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) + { + if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) + { + Repeater rpColumnNews = (Repeater)e.Item.FindControl("RepeaterThird"); + //找到分类Repeater关联的数据项 + DataRowView rowv = (DataRowView)e.Item.DataItem; + //提取分类ID + string authID = Convert.ToString(rowv["ID"]); + //里面的Repeater + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryNews(Convert.ToInt32(authID)).DefaultView; + dv = GetTopDataViewRows(dv,10); + rpColumnNews.DataSource = dv; + rpColumnNews.DataBind(); + + + } + } + + public string FormatShowContent(string titlecontent, int titlelength) + { + if (titlecontent.Length > titlelength) + { + return titlecontent.Substring(0, titlelength); + } + else + { + for (int i = 0; i < titlelength - titlecontent.Length;i++ ) + titlecontent += " "; + + return titlecontent; + + } + + } + + private DataView GetTopDataViewRows(DataView dv, int n) + { + DataTable dt = dv.Table.Clone(); + + for (int i = 0; i < n - 1; i++) + { + if (i >= dv.Count) + { + break; + } + dt.ImportRow(dv[i].Row); + } + return new DataView(dt, dv.RowFilter, dv.Sort, dv.RowStateFilter); + } + + +} diff --git a/Training/.svn/entries b/Training/.svn/entries new file mode 100644 index 0000000..c9ff03b --- /dev/null +++ b/Training/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/Training +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +LessonCategory.aspx.cs +file + + + + +2011-04-01T02:51:02.086690Z +868c83c734e86953183a262661b6dd2a +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +6660 + +LessonEmp.aspx +file + + + + +2011-04-01T02:51:02.086690Z +ed02ed38d52dfe5c6b38229faee3a881 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5322 + +Lesson.aspx.cs +file + + + + +2011-04-01T02:51:02.102315Z +22b853e52dd1c687385ae76b76e33835 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +9623 + +LessonEmp.aspx.cs +file + + + + +2011-04-01T02:51:02.258566Z +c8d7092d7dba2250d948385775f55f60 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +10742 + +LessonView.aspx +file + + + + +2011-04-01T02:51:02.274192Z +ea6c8f89000eb9cf2846ec6bb076fee6 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +11441 + +LessonCategory.aspx +file + + + + +2011-04-01T02:51:02.274192Z +5c98a26aaad0784c3e0f5b223b709a7d +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +5566 + +LessonView.aspx.cs +file + + + + +2011-04-01T02:51:02.289817Z +0def9b1ad3489fe776bcd6dfd2d779b7 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +9471 + +Lesson.aspx +file + + + + +2011-04-01T02:51:02.289817Z +495689bb176b9de34fa73bfc530a0c82 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +14744 + diff --git a/Training/.svn/text-base/Lesson.aspx.cs.svn-base b/Training/.svn/text-base/Lesson.aspx.cs.svn-base new file mode 100644 index 0000000..55b2e7a --- /dev/null +++ b/Training/.svn/text-base/Lesson.aspx.cs.svn-base @@ -0,0 +1,327 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class Lesson :PageBase +{ + private Llesson _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new Llesson(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨿γ̷ + DataView dvDept = new DataView(_logic.GetAllActivedCategories()); + + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + //󶨿γ̷ѡеĿγ̷µпγ + DataView dv = TreeDept.SelectedValue != "0" ? new DataView(_logic.GetLessonsByCat(Convert.ToInt32(TreeDept.SelectedValue))) : new DataView(_logic.GetAllActiveData().Tables[0]); + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (Llesson)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLesson.le_name; + txtDesc.Text = _logic.GetLesson.le_desc; + txtLocation.Text = _logic.GetLesson.le_location; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = _logic.GetLesson.le_xuefen.ToString(); + txtTrainer.Text = _logic.GetLesson.le_trainer; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = _logic.GetLesson.le_startdate; + txtEndDate.Text = _logic.GetLesson.le_enddate; + + + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + // DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLesson.ID > 0 ? _logic.GetLesson.Update() : _logic.GetLesson.Add(); + ClearDetail(); + Databound(); + DataDetail.Visible = false; + + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLesson.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (_logic.GetLesson.ID > 0) + { + _logic.GetLesson.last_modified = DateTime.Now.ToString(); + + } + _logic.GetLesson.le_category = Convert.ToInt32(TreeDept.SelectedValue); + + + _logic.GetLesson.le_name = txtName.Text ; + _logic.GetLesson.le_desc =txtDesc.Text ; + _logic.GetLesson.le_location =txtLocation.Text ; + // txtMaster.Text = _logic.GetLesson.le_master; + _logic.GetLesson.le_xuefen = Convert.ToInt32(txtXunFen.Text); + _logic.GetLesson.le_trainer = txtTrainer.Text; + _logic.GetLesson.le_startdate = txtStartDate.Text; + _logic.GetLesson.le_enddate =txtEndDate.Text ; + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + + txtName.Text = ""; + txtDesc.Text = ""; + txtLocation.Text = ""; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = ""; + txtTrainer.Text = ""; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = ""; + txtEndDate.Text = ""; + + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["pk_lessonCategory"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "le_category = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + DataDetail.Visible = false; + + } + + + + + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count -1].Visible = false; + Databound(); + Export("application/ms-excel", "ѵ.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = true; + Databound(); + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + +} \ No newline at end of file diff --git a/Training/.svn/text-base/Lesson.aspx.svn-base b/Training/.svn/text-base/Lesson.aspx.svn-base new file mode 100644 index 0000000..4ff8ba6 --- /dev/null +++ b/Training/.svn/text-base/Lesson.aspx.svn-base @@ -0,0 +1,192 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" EnableEventValidation="false" + AutoEventWireup="true" CodeFile="Lesson.aspx.cs" Inherits="Lesson" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + +
+ + 0 + + + + + + + + + +
+ + + +
+ + + +
+ +
+   + +   +   +   +   +  
+
+
+
+
+
diff --git a/Training/.svn/text-base/LessonCategory.aspx.cs.svn-base b/Training/.svn/text-base/LessonCategory.aspx.cs.svn-base new file mode 100644 index 0000000..2137bee --- /dev/null +++ b/Training/.svn/text-base/LessonCategory.aspx.cs.svn-base @@ -0,0 +1,235 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class LessonCategory :PageBase +{ + private LlessonCat _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LlessonCat(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡŽڵIJ + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dv); + //бѡеIJµв + dv.RowFilter="lc_uplevel = '"+ TreeDept.SelectedValue +"'"; + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LlessonCat)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLessonCat.lc_name ; + + txtDesc.Text = _logic.GetLessonCat.lc_desc; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLessonCat.ID > 0 ? _logic.GetLessonCat.Update() : _logic.GetLessonCat.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLessonCat.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (!(_logic.GetLessonCat.ID > 0)) + { + _logic.GetLessonCat.last_modified = DateTime.Now.ToString(); + } + _logic.GetLessonCat.lc_uplevel = Convert.ToInt32(TreeDept.SelectedValue); + _logic.GetLessonCat.lc_name= txtName.Text ; + + _logic.GetLessonCat.lc_desc = txtDesc.Text; + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + // lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["pk_lessonCategory"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.RowFilter = "lc_uplevel = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + } +} \ No newline at end of file diff --git a/Training/.svn/text-base/LessonCategory.aspx.svn-base b/Training/.svn/text-base/LessonCategory.aspx.svn-base new file mode 100644 index 0000000..b393fbe --- /dev/null +++ b/Training/.svn/text-base/LessonCategory.aspx.svn-base @@ -0,0 +1,113 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="LessonCategory.aspx.cs" Inherits="LessonCategory" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + + +
+ + + + +
+
+ +
+
+
+ diff --git a/Training/.svn/text-base/LessonEmp.aspx.cs.svn-base b/Training/.svn/text-base/LessonEmp.aspx.cs.svn-base new file mode 100644 index 0000000..2da6573 --- /dev/null +++ b/Training/.svn/text-base/LessonEmp.aspx.cs.svn-base @@ -0,0 +1,373 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class LessonEmp : PageBase +{ + private LlessonEmp _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LlessonEmp(); + Databound(); + bindLessons(); + bindDeptEmp(); //ɫʱʼԱ + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + // if (!isRoleAuth) bindDeptEmp(); //ɫʱʼԱ + bindGV(); + UpdateSession(); + + + } + + + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeEmp.Nodes.Clear(); + BindEmpTree( "0", TreeEmp.SelectedNode, _logic.GetAllDepartments().DefaultView, _logic.GetAllEmployee().DefaultView); + + + } + + /// + ///󶨽ɫ + /// + private void bindLessons() + { + BindLessonTree("0",TreeLesson.SelectedNode,_logic.GetAllCategories().DefaultView,_logic.GetAllActiveData().Tables[0].DefaultView ); + } + public void BindLessonTree(string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + + deptdv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["lc_name"] + "" + row["pk_lessonCategory"]; + node.Value = row["pk_lessonCategory"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.Expanded = true; + empdv.RowFilter = "le_category=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["le_name"] + "", emrow["pk_lesson"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeLesson.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindLessonTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + public void BindEmpTree(string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + "" + row["pk_department"]; + node.Value = row["pk_department"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "em_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , emrow["pk_employee"].ToString()); + tnEmp.ShowCheckBox = true; + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeEmp.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LlessonEmp)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + + if (TreeLesson.SelectedValue == string.Empty) return; + + ArrayList al = new ArrayList(); + ArrayList al2del = new ArrayList(); + + GetCheckedNode(TreeEmp.Nodes, al); + + string tmpid; + DataTable dt = _logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)); + for (int i = 0; i < dt.Rows.Count;i++ ) + { + tmpid = dt.Rows[i]["train_student"].ToString().Trim(); + if (al.Contains(tmpid )) + { + al.Remove(tmpid); + } + else + { + al2del.Add(tmpid); + } + + + } + if(al.Count >0 || al2del.Count >0) + { + _logic.Initialize(); + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + // _logic.GetLesson.Delete(Convert.ToInt32(TreeLesson.SelectedValue)); + + + foreach (string id in al2del) + { + _logic.GetTrainingDetail.ID = Convert.ToInt32(id); + _logic.GetTrainingDetail.getModel(); + _logic.GetTrainingDetail.Delete(); + } + + foreach (string id in al) + { + _logic.GetTrainingDetail.train_lesson = Convert.ToInt32(TreeLesson.SelectedValue); + _logic.GetTrainingDetail.train_student = Convert.ToInt32(id); + _logic.GetTrainingDetail.Add(); + } + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + } + Databound(); + + } + + } + + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + + //--Աѡ + /* + if (TreeDeptEmp.SelectedNode != null) TreeDeptEmp.SelectedNode.Selected = false; + + lbAuthRole.Text = "Աɫ嵥"; + GvRole.DataSource = null; + GvRole.DataBind(); + * */ + //--ѡԱѡ + GvRole.SelectedIndex = -1; + ArrayList empList = new ArrayList(); + DataTable dt =_logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)) ; + foreach (DataRow dr in dt.Rows) + { + empList.Add(dr["pk_employee"]); + } + SetCheckedNode(TreeEmp.Nodes, empList); + + bindGV(); + + } + + + void bindGV( ) + { + //Աγ 嵥 + string nodevalue = TreeEmp.SelectedValue; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmRole.Text = TreeEmp.SelectedNode.Text + " Աγ嵥"; + GvRole.DataSource = _logic.GetLessionsByEmp(Convert.ToInt32(nodevalue)); + + + } + GvRole.DataBind(); + + + //γ̶ӦԱ嵥 + if (TreeLesson.SelectedNode != null) + { + + lbRoleEm.Text = TreeLesson.SelectedNode.Text + " γԱ嵥"; + GvEm.DataSource = _logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)); + } + GvEm.DataBind(); + } + + protected void TreeLesson_SelectedNodeChanged(object sender, EventArgs e) + { + GvEm.SelectedIndex = -1; + bindGV(); + } + + + protected void GvRole_RowDataBound(object sender, GridViewRowEventArgs e) + { + Label lb; + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + lb = new Label(); + lb.Text = e.Row.Cells[1].Text.Trim().Equals("True") ? "" : ""; + e.Row.Cells[1].Controls.Add(lb); + break; + } + } + protected void GvEm_RowEditing(object sender, GridViewEditEventArgs e) + { + GvEm.EditIndex = e.NewEditIndex; + GvEm.SelectedIndex = e.NewEditIndex; + bindGV(); + } + protected void GvEm_RowCommand(object sender, GridViewCommandEventArgs e) + { + + } + protected void GvEm_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + + if (GvEm.DataKeys != null) + { + string id = GvEm.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetTrainingDetail.ID = Convert.ToInt32(id); + _logic.GetTrainingDetail.getModel(); + + _logic.GetTrainingDetail.train_passed = ((CheckBox)GvEm.Rows[e.RowIndex].Cells[3].Controls[1]).Checked; + _logic.GetTrainingDetail.train_passedDate = DateTime.Now.ToShortDateString(); + //_logic.GetTrainingDetail.operater = + _logic.GetTrainingDetail.Update(); + } + GvEm.EditIndex = -1; + GvEm.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvEm_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvEm.EditIndex = -1; + GvEm.SelectedIndex = e.RowIndex; + bindGV(); + } +} \ No newline at end of file diff --git a/Training/.svn/text-base/LessonEmp.aspx.svn-base b/Training/.svn/text-base/LessonEmp.aspx.svn-base new file mode 100644 index 0000000..dfcd3c2 --- /dev/null +++ b/Training/.svn/text-base/LessonEmp.aspx.svn-base @@ -0,0 +1,104 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="LessonEmp.aspx.cs" Inherits="LessonEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
  + +
+ +
+ +
+ diff --git a/Training/.svn/text-base/LessonView.aspx.cs.svn-base b/Training/.svn/text-base/LessonView.aspx.cs.svn-base new file mode 100644 index 0000000..4bd2389 --- /dev/null +++ b/Training/.svn/text-base/LessonView.aspx.cs.svn-base @@ -0,0 +1,320 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using ZhangPu.Gov.Logical; +using Tracen.Utils; + +public partial class LessonView : PageBase +{ + private Llesson _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new Llesson(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨿γ̷ + DataView dvDept = new DataView(_logic.GetAllActivedCategories()); + + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + //󶨿γ̷ѡеĿγ̷µпγ + DataView dv = TreeDept.SelectedValue != "0" ? new DataView(_logic.GetLessonsByCat(Convert.ToInt32(TreeDept.SelectedValue))) : new DataView(_logic.GetAllActiveData().Tables[0]); + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (Llesson)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLesson.le_name; + txtDesc.Text = _logic.GetLesson.le_desc; + txtLocation.Text = _logic.GetLesson.le_location; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = _logic.GetLesson.le_xuefen.ToString(); + txtTrainer.Text = _logic.GetLesson.le_trainer; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = _logic.GetLesson.le_startdate; + txtEndDate.Text = _logic.GetLesson.le_enddate; + + + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + // DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLesson.ID > 0 ? _logic.GetLesson.Update() : _logic.GetLesson.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLesson.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + if (_logic.GetLesson.ID > 0) + { + _logic.GetLesson.last_modified = DateTime.Now.ToString(); + + } + _logic.GetLesson.le_category = Convert.ToInt32(TreeDept.SelectedValue); + + + _logic.GetLesson.le_name = txtName.Text ; + _logic.GetLesson.le_desc =txtDesc.Text ; + _logic.GetLesson.le_location =txtLocation.Text ; + // txtMaster.Text = _logic.GetLesson.le_master; + _logic.GetLesson.le_xuefen = Convert.ToInt32(txtXunFen.Text); + _logic.GetLesson.le_trainer = txtTrainer.Text; + _logic.GetLesson.le_startdate = txtStartDate.Text; + _logic.GetLesson.le_enddate =txtEndDate.Text ; + + } + + private void chgOperTxt(bool addNew) + { + + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + txtLocation.Text = ""; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = ""; + txtTrainer.Text = ""; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = ""; + txtEndDate.Text = ""; + + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["pk_lessonCategory"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "le_category = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + + } + + + + + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "ѵ.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} \ No newline at end of file diff --git a/Training/.svn/text-base/LessonView.aspx.svn-base b/Training/.svn/text-base/LessonView.aspx.svn-base new file mode 100644 index 0000000..052050d --- /dev/null +++ b/Training/.svn/text-base/LessonView.aspx.svn-base @@ -0,0 +1,170 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" EnableEventValidation = "false" AutoEventWireup="true" CodeFile="LessonView.aspx.cs" Inherits="LessonView" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +   + + +   +
+ + 0 +   + + + + + +
+ + + +
+ + +
+  
+   +    +   +   +   +  
+
+
+
+
+ diff --git a/Training/Lesson.aspx b/Training/Lesson.aspx new file mode 100644 index 0000000..2f3105d --- /dev/null +++ b/Training/Lesson.aspx @@ -0,0 +1,192 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" EnableEventValidation="false" + AutoEventWireup="true" CodeFile="Lesson.aspx.cs" Inherits="Lesson" %> + +<%@ MasterType VirtualPath="~/masterPage.master" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + + + + + +
+ + 0 + + + + + + + + + +
+ + + +
+ + + +
+ +
+   + +   +   +   +   +  
+
+
+
+
+
diff --git a/Training/Lesson.aspx.cs b/Training/Lesson.aspx.cs new file mode 100644 index 0000000..11a414b --- /dev/null +++ b/Training/Lesson.aspx.cs @@ -0,0 +1,327 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class Lesson :PageBase +{ + private Llesson _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new Llesson(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨿γ̷ + DataView dvDept = new DataView(_logic.GetAllActivedCategories()); + + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + //󶨿γ̷ѡеĿγ̷µпγ + DataView dv = TreeDept.SelectedValue != "0" ? new DataView(_logic.GetLessonsByCat(Convert.ToInt32(TreeDept.SelectedValue))) : new DataView(_logic.GetAllActiveData().Tables[0]); + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (Llesson)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLesson.le_name; + txtDesc.Text = _logic.GetLesson.le_desc; + txtLocation.Text = _logic.GetLesson.le_location; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = _logic.GetLesson.le_xuefen.ToString(); + txtTrainer.Text = _logic.GetLesson.le_trainer; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = _logic.GetLesson.le_startdate; + txtEndDate.Text = _logic.GetLesson.le_enddate; + + + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + // DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLesson.ID > 0 ? _logic.GetLesson.Update() : _logic.GetLesson.Add(); + ClearDetail(); + Databound(); + DataDetail.Visible = false; + + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLesson.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + // if (_logic.GetLesson.ID > 0) + //{ + // _logic.GetLesson.last_modified = DateTime.Now.ToString(); + + //} + _logic.GetLesson.le_category = Convert.ToInt32(TreeDept.SelectedValue); + + + _logic.GetLesson.le_name = txtName.Text ; + _logic.GetLesson.le_desc =txtDesc.Text ; + _logic.GetLesson.le_location =txtLocation.Text ; + // txtMaster.Text = _logic.GetLesson.le_master; + _logic.GetLesson.le_xuefen = Convert.ToInt32(txtXunFen.Text); + _logic.GetLesson.le_trainer = txtTrainer.Text; + _logic.GetLesson.le_startdate = txtStartDate.Text; + _logic.GetLesson.le_enddate =txtEndDate.Text ; + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + + txtName.Text = ""; + txtDesc.Text = ""; + txtLocation.Text = ""; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = ""; + txtTrainer.Text = ""; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = ""; + txtEndDate.Text = ""; + + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "le_category = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + DataDetail.Visible = false; + + } + + + + + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count -1].Visible = false; + Databound(); + Export("application/ms-excel", "ѵ.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = true; + Databound(); + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + + +} \ No newline at end of file diff --git a/Training/LessonCategory.aspx b/Training/LessonCategory.aspx new file mode 100644 index 0000000..30bf5dc --- /dev/null +++ b/Training/LessonCategory.aspx @@ -0,0 +1,113 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="LessonCategory.aspx.cs" Inherits="LessonCategory" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + Namespace="System.Web.UI" TagPrefix="asp" %> + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + + +
+ + + + +
+
+ +
+
+
+ diff --git a/Training/LessonCategory.aspx.cs b/Training/LessonCategory.aspx.cs new file mode 100644 index 0000000..4fcc021 --- /dev/null +++ b/Training/LessonCategory.aspx.cs @@ -0,0 +1,235 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class LessonCategory :PageBase +{ + private LlessonCat _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LlessonCat(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + + + //װѡŽڵIJ + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dv); + //бѡеIJµв + dv.RowFilter="lc_uplevel = '"+ TreeDept.SelectedValue +"'"; + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LlessonCat)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLessonCat.lc_name ; + + txtDesc.Text = _logic.GetLessonCat.lc_desc; + +// chkStatus.Checked = _logic.GetRole.dr; + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLessonCat.ID > 0 ? _logic.GetLessonCat.Update() : _logic.GetLessonCat.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLessonCat.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + // if (!(_logic.GetLessonCat.ID > 0)) + //{ + // _logic.GetLessonCat.last_modified = DateTime.Now.ToString(); + //} + _logic.GetLessonCat.lc_uplevel = Convert.ToInt32(TreeDept.SelectedValue); + _logic.GetLessonCat.lc_name= txtName.Text ; + + _logic.GetLessonCat.lc_desc = txtDesc.Text; + + } + + private void chgOperTxt(bool addNew) + { + DataDetail.Visible = true; + // lbEdit.Text = addNew ? "¼¼" : "޸м¼"; + btnSubmit.Enabled = true; + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + DataDetail.Visible = false; + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + dv.RowFilter = "lc_uplevel = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + } +} \ No newline at end of file diff --git a/Training/LessonEmp.aspx b/Training/LessonEmp.aspx new file mode 100644 index 0000000..dc42549 --- /dev/null +++ b/Training/LessonEmp.aspx @@ -0,0 +1,104 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" AutoEventWireup="true" CodeFile="LessonEmp.aspx.cs" Inherits="LessonEmp" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
  + +
+ +
+ +
+ diff --git a/Training/LessonEmp.aspx.cs b/Training/LessonEmp.aspx.cs new file mode 100644 index 0000000..5c69cb0 --- /dev/null +++ b/Training/LessonEmp.aspx.cs @@ -0,0 +1,373 @@ +using System; +using System.Collections; +using System.Data; +using System.Transactions; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class LessonEmp : PageBase +{ + private LlessonEmp _logic; + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + _logic = new LlessonEmp(); + Databound(); + bindLessons(); + bindDeptEmp(); //ɫʱʼԱ + } + SessionSeting(); + + } + + /// + /// bound the query list. + /// + private void Databound() + { + // bindAuth(); + // bindRoles(); + // if (!isRoleAuth) bindDeptEmp(); //ɫʱʼԱ + bindGV(); + UpdateSession(); + + + } + + + + + /// + /// 󶨲żû + /// + private void bindDeptEmp() + { + TreeEmp.Nodes.Clear(); + BindEmpTree( "0", TreeEmp.SelectedNode, _logic.GetAllDepartments().DefaultView, _logic.GetAllEmployee().DefaultView); + + + } + + /// + ///󶨽ɫ + /// + private void bindLessons() + { + BindLessonTree("0",TreeLesson.SelectedNode,_logic.GetAllCategories().DefaultView,_logic.GetAllActiveData().Tables[0].DefaultView ); + } + public void BindLessonTree(string id, TreeNode pNode, DataView deptdv, DataView empdv) + { + + deptdv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["lc_name"] + "" + row["ID"]; + node.Value = row["ID"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.Expanded = true; + empdv.RowFilter = "le_category=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["le_name"] + "", emrow["ID"].ToString()); + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeLesson.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindLessonTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + public void BindEmpTree(string id, TreeNode pNode, DataView deptdv,DataView empdv) + { + + deptdv.RowFilter = "dep_mastdept = '" + id + "'"; + foreach (DataRowView row in deptdv) + { + TreeNode node = new TreeNode(); + node.Text = "" + row["dep_name"] + "" + row["ID"]; + node.Value = row["ID"].ToString(); + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + node.Expanded = true; + empdv.RowFilter = "em_dept=" + node.Value; + foreach (DataRowView emrow in empdv) + { + TreeNode tnEmp = new TreeNode("" + emrow["em_name"] + "" , emrow["ID"].ToString()); + tnEmp.ShowCheckBox = true; + node.ChildNodes.Add(tnEmp); + } + if (pNode == null) + //˵Ǹڵ + { + + TreeEmp.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindEmpTree(node.Value, node, new DataView(deptdv.Table), new DataView(empdv.Table)); + + } + } + + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (LlessonEmp)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + + /************************************** protected methods (event listeners) ********************************/ + + + protected void btnSubmit_Click(object sender, EventArgs e) + { + + if (TreeLesson.SelectedValue == string.Empty) return; + + ArrayList al = new ArrayList(); + ArrayList al2del = new ArrayList(); + + GetCheckedNode(TreeEmp.Nodes, al); + + string tmpid; + DataTable dt = _logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)); + for (int i = 0; i < dt.Rows.Count;i++ ) + { + tmpid = dt.Rows[i]["train_student"].ToString().Trim(); + if (al.Contains(tmpid )) + { + al.Remove(tmpid); + } + else + { + al2del.Add(tmpid); + } + + + } + if(al.Count >0 || al2del.Count >0) + { + _logic.Initialize(); + + // using (TransactionScope trans = new TransactionScope()) + { + try + { + // _logic.GetLesson.Delete(Convert.ToInt32(TreeLesson.SelectedValue)); + + + foreach (string id in al2del) + { + _logic.GetTrainingDetail.ID = Convert.ToInt32(id); + _logic.GetTrainingDetail.getModel(); + _logic.GetTrainingDetail.Delete(); + } + + foreach (string id in al) + { + _logic.GetTrainingDetail.train_lesson = Convert.ToInt32(TreeLesson.SelectedValue); + _logic.GetTrainingDetail.train_student = Convert.ToInt32(id); + _logic.GetTrainingDetail.Add(); + } + + // trans.Complete(); + } + catch (MyException) + { + throw; + } + catch (Exception) + { + throw new Exception("쳣ʧܡ"); + } + } + Databound(); + + } + + } + + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + + + } + + void GetCheckedNode(TreeNodeCollection tnc, ArrayList checkedvalues ) + { + foreach(TreeNode node in tnc) + { + if(node.Checked) + { + checkedvalues.Add(node.Value); + + } + GetCheckedNode(node.ChildNodes, checkedvalues); + } +} + + void SetCheckedNode(TreeNodeCollection tnc, ArrayList setcheckedvalues) + { + foreach (TreeNode node in tnc) + { + node.Checked = setcheckedvalues.Contains(Convert.ToInt32(node.Value)); + + SetCheckedNode(node.ChildNodes, setcheckedvalues); + } + } + + + private void chgOperTxt(bool addNew) + { + + btnSubmit.Enabled = true; + + } + + + + + protected void listRoles_SelectedIndexChanged(object sender, EventArgs e) + { + + + //--Աѡ + /* + if (TreeDeptEmp.SelectedNode != null) TreeDeptEmp.SelectedNode.Selected = false; + + lbAuthRole.Text = "Աɫ嵥"; + GvRole.DataSource = null; + GvRole.DataBind(); + * */ + //--ѡԱѡ + GvRole.SelectedIndex = -1; + ArrayList empList = new ArrayList(); + DataTable dt =_logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)) ; + foreach (DataRow dr in dt.Rows) + { + empList.Add(dr["ID"]); + } + SetCheckedNode(TreeEmp.Nodes, empList); + + bindGV(); + + } + + + void bindGV( ) + { + //Աγ 嵥 + string nodevalue = TreeEmp.SelectedValue; + if (nodevalue.Length >0 && nodevalue != "0") //selected node is an employee + { + + lbEmRole.Text = TreeEmp.SelectedNode.Text + " Աγ嵥"; + GvRole.DataSource = _logic.GetLessionsByEmp(Convert.ToInt32(nodevalue)); + + + } + GvRole.DataBind(); + + + //γ̶ӦԱ嵥 + if (TreeLesson.SelectedNode != null) + { + + lbRoleEm.Text = TreeLesson.SelectedNode.Text + " γԱ嵥"; + GvEm.DataSource = _logic.GetEmpByLesson(Convert.ToInt32(TreeLesson.SelectedValue)); + } + GvEm.DataBind(); + } + + protected void TreeLesson_SelectedNodeChanged(object sender, EventArgs e) + { + GvEm.SelectedIndex = -1; + bindGV(); + } + + + protected void GvRole_RowDataBound(object sender, GridViewRowEventArgs e) + { + Label lb; + switch (e.Row.RowType) + { + case DataControlRowType.DataRow: + lb = new Label(); + lb.Text = e.Row.Cells[1].Text.Trim().Equals("True") ? "" : ""; + e.Row.Cells[1].Controls.Add(lb); + break; + } + } + protected void GvEm_RowEditing(object sender, GridViewEditEventArgs e) + { + GvEm.EditIndex = e.NewEditIndex; + GvEm.SelectedIndex = e.NewEditIndex; + bindGV(); + } + protected void GvEm_RowCommand(object sender, GridViewCommandEventArgs e) + { + + } + protected void GvEm_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + + if (GvEm.DataKeys != null) + { + string id = GvEm.DataKeys[e.RowIndex].Value.ToString(); + + _logic.GetTrainingDetail.ID = Convert.ToInt32(id); + _logic.GetTrainingDetail.getModel(); + + _logic.GetTrainingDetail.train_passed = ((CheckBox)GvEm.Rows[e.RowIndex].Cells[3].Controls[1]).Checked; + _logic.GetTrainingDetail.train_passedDate = DateTime.Now.ToShortDateString(); + //_logic.GetTrainingDetail.operater = + _logic.GetTrainingDetail.Update(); + } + GvEm.EditIndex = -1; + GvEm.SelectedIndex = e.RowIndex; + bindGV(); + } + protected void GvEm_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GvEm.EditIndex = -1; + GvEm.SelectedIndex = e.RowIndex; + bindGV(); + } +} \ No newline at end of file diff --git a/Training/LessonView.aspx b/Training/LessonView.aspx new file mode 100644 index 0000000..ebf3e82 --- /dev/null +++ b/Training/LessonView.aspx @@ -0,0 +1,170 @@ +<%@ Page Language="C#" MasterPageFile="../masterPage.master" EnableEventValidation = "false" AutoEventWireup="true" CodeFile="LessonView.aspx.cs" Inherits="LessonView" %> +<%@ MasterType VirtualPath="~/masterPage.master" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +   + + +   +
+ + 0 +   + + + + + +
+ + + +
+ + +
+  
+   +    +   +   +   +  
+
+
+
+
+ diff --git a/Training/LessonView.aspx.cs b/Training/LessonView.aspx.cs new file mode 100644 index 0000000..93ab46e --- /dev/null +++ b/Training/LessonView.aspx.cs @@ -0,0 +1,320 @@ +using System; +using System.Data; +using System.IO; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; +using DeiNiu.Utils; + +public partial class LessonView : PageBase +{ + private Llesson _logic; + protected void Page_Init() + { + + PostBackTrigger trigger = new PostBackTrigger(); + trigger.ControlID = Button1.UniqueID; + + // (Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString(); + + // (UpdatePanel)(Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger); + + ((UpdatePanel)Master.FindControl("UpdatePanel1")).Triggers.Add(trigger); + +} + + protected void Page_Load(object sender, EventArgs e) + { + + + if (!IsPostBack) + { + _logic = new Llesson(); + Databound(); + } + SessionSeting(); + } + + /***************************************** private methods ******************************************/ + + /// + /// bound the query list. + /// + private void Databound() + { + //󶨿γ̷ + DataView dvDept = new DataView(_logic.GetAllActivedCategories()); + + + TreeDept.SelectedNode.ChildNodes.Clear(); + BindTree(TreeDept.SelectedNode.Value, TreeDept.SelectedNode, dvDept); + //󶨿γ̷ѡеĿγ̷µпγ + DataView dv = TreeDept.SelectedValue != "0" ? new DataView(_logic.GetLessonsByCat(Convert.ToInt32(TreeDept.SelectedValue))) : new DataView(_logic.GetAllActiveData().Tables[0]); + GridView1.DataSource = dv; + GridView1.SelectedIndex = -1; + GridView1.DataBind(); + + + + UpdateSession(); + // btnSubmit.Enabled = false; + ClearDetail(); + } + + private void SessionSeting() + { + if (IsPostBack) + { + _logic = (Llesson)Session[appScope.PagelevelObj]; + } + } + + private void UpdateSession() + { + Session[appScope.PagelevelObj] = _logic; + } + + /// + /// set data from shift object to page + /// + private void DetailDataBind() + { + DataDetail.Visible = true; + txtName.Text = _logic.GetLesson.le_name; + txtDesc.Text = _logic.GetLesson.le_desc; + txtLocation.Text = _logic.GetLesson.le_location; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = _logic.GetLesson.le_xuefen.ToString(); + txtTrainer.Text = _logic.GetLesson.le_trainer; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = _logic.GetLesson.le_startdate; + txtEndDate.Text = _logic.GetLesson.le_enddate; + + + + } + + /************************************** protected methods (event listeners) ********************************/ + + protected void btnAddnew_Click(object sender, EventArgs e) + { + chgOperTxt(true); + _logic.Initialize(); + ClearDetail(); + // DetailDataBind(); + } + + protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e) + { + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.NewEditIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + Databound(); + DetailDataBind(); + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + SetDataBack(); + //shifts id eq 0 means this is new one,to add; else an old one, to update + + int oper = 0; + oper = _logic.GetLesson.ID > 0 ? _logic.GetLesson.Update() : _logic.GetLesson.Add(); + ClearDetail(); + Databound(); + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + + if (GridView1 != null) + { + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + } + + _logic.GetLesson.Delete(); + ClearDetail(); + Databound(); + } + + protected void GridView1_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) + { + GridView1.PageIndex = e.NewPageIndex; + Databound(); + + //GridView1.DataSource = shiftLgc.getAllShifts().Tables[0]; + // GridView1.DataBind(); + } + + protected void GridView1_DataBinding(object sender, EventArgs e) + { + } + + + + protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) + { + } + + //reset the page + protected void btnCancel_Click(object sender, EventArgs e) + { + _logic.Initialize(); + Page_Load(this, e); + } + + /***************************************** internal methods ********************************************/ + + /// + /// set data from page to shift object + /// + private void SetDataBack() + { + // _logic.GetRole.operater = Session["CurrentUserID"].ToString(); todo: write a public method to handle operater,createtime,lastmodfied ... log info. + + // if (_logic.GetLesson.ID > 0) + //{ + // _logic.GetLesson.last_modified = DateTime.Now.ToString(); + + //} + _logic.GetLesson.le_category = Convert.ToInt32(TreeDept.SelectedValue); + + + _logic.GetLesson.le_name = txtName.Text ; + _logic.GetLesson.le_desc =txtDesc.Text ; + _logic.GetLesson.le_location =txtLocation.Text ; + // txtMaster.Text = _logic.GetLesson.le_master; + _logic.GetLesson.le_xuefen = Convert.ToInt32(txtXunFen.Text); + _logic.GetLesson.le_trainer = txtTrainer.Text; + _logic.GetLesson.le_startdate = txtStartDate.Text; + _logic.GetLesson.le_enddate =txtEndDate.Text ; + + } + + private void chgOperTxt(bool addNew) + { + + } + + private void ClearDetail() + { + txtName.Text = ""; + txtDesc.Text = ""; + txtLocation.Text = ""; + // txtMaster.Text = _logic.GetLesson.le_master; + txtXunFen.Text = ""; + txtTrainer.Text = ""; + // txtPasswd.Text = _logic.GetEmployee.em_passwd; + txtStartDate.Text = ""; + txtEndDate.Text = ""; + + } + + protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) + { + chgOperTxt(false); + if (GridView1.DataKeys != null) + { + string id = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); + _logic.Initialize(int.Parse(id)); + } + DetailDataBind(); + } + + + + public void BindTree(string id, TreeNode pNode, DataView dv) + { + + + dv.RowFilter = "lc_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + node.Text = row["lc_name"].ToString(); + node.Value = row["ID"].ToString(); + if (pNode == null) + //˵Ǹڵ + { + + TreeDept.Nodes.Add(node); + node.Expanded = true; + + } + else + { + pNode.ChildNodes.Add(node); + node.Expanded = true; + + } + BindTree(node.Value, node, new DataView(dv.Table)); + + } + } + protected void TreeDept_SelectedNodeChanged(object sender, EventArgs e) + { + GridView1.SelectedIndex = -1; + DataView dv = new DataView(_logic.GetAllActiveData().Tables[0]); + if(TreeDept.SelectedValue !="0") + dv.RowFilter = "le_category = '" + TreeDept.SelectedValue + "'"; + GridView1.DataSource = dv; + GridView1.DataBind(); + ClearDetail(); + + } + + + + + +//û淽ᱨ͡GridViewĿؼGridView1ھ runat=server Ĵ + public override void VerifyRenderingInServerForm(Control control) + { + } + protected void Excel_Click(object sender, EventArgs e) + { + + Master.ScriptMgr.RegisterPostBackControl(this.Button1); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count-1].Visible = false; + Databound(); + Export("application/ms-excel", "ѵ.xls"); + GridView1.AllowPaging = false; + GridView1.Columns[GridView1.Columns.Count - 1].Visible = true; + Databound(); + } + + private void Export(string FileType, string FileName) + { + + Response.Charset = "GB2312"; + Response.ContentEncoding = Encoding.UTF7; + Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); + Response.ContentType = FileType; + EnableViewState = false; + StringWriter tw = new StringWriter(); + HtmlTextWriter hw = new HtmlTextWriter(tw); + GridView1.RenderControl(hw); + Response.Write(tw.ToString()); + Response.End(); + + } + +} \ No newline at end of file diff --git a/Web.config b/Web.config new file mode 100644 index 0000000..6343670 --- /dev/null +++ b/Web.config @@ -0,0 +1,72 @@ + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Web.sitemap b/Web.sitemap new file mode 100644 index 0000000..66daf51 --- /dev/null +++ b/Web.sitemap @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ZhangPuStyle.css b/ZhangPuStyle.css new file mode 100644 index 0000000..25e4f94 --- /dev/null +++ b/ZhangPuStyle.css @@ -0,0 +1,560 @@ +body +{ + background-color:#FFFFFF; + margin-left: 0; + margin-top: 0; + margin-right: 0; + font-family: Arial,Verdana; + font-size: 10pt; + background:url(Images/bg.gif) repeat-x; +} + + + +A +{ + FONT-WEIGHT: normal; COLOR:#333333; FONT-FAMILY: Arial; + text-decoration:none; +} +A:active +{ + FONT-WEIGHT: normal; COLOR: #333333; FONT-FAMILY: Arial; text-decoration:none; +} +A:visited +{ + FONT-WEIGHT: normal; COLOR: Gray; FONT-FAMILY: Arial; text-decoration:none; +} +A:hover +{ + FONT-WEIGHT: normal; COLOR: #000; FONT-FAMILY: Arial; TEXT-DECORATION: underline +} + +/* Table Class*/ + +.Table_NoBorder +{ + + font-weight: normal; + color:#666666; + background-color:Transparent; + border-width: 0px; + border-style: solid; + +} +.Table_Border +{ + font-family: Arial,Verdana, Helvetica,serif,sans-serif; + + font-weight: 100; + background-color:White; + /* border-color:Olive; */ + border-color: #5B8200; + border-width: 1px; + border-style: solid; +} +.Table_Table +{ + + font-weight: normal; + color:#858585; + background-color:Transparent; + border-width: 1px; + border-style: solid; +} + +/* Header */ +.HEADER +{ + background-color:Green; +} + +/*Label Class*/ +.Label +{ + + font-size: 9pt; + font-weight:normal; + height: 19px; + font-style:normal; + background-color :Transparent ; + color :#858585; +} +.Label_Title +{ + color :#3A3A3A; + font-size:15pt ; + font-weight:bold; + font-family :Serif; +} +.Label_Header +{ + + + font-size: 9pt; + font-weight:bold; + height: 19px; + color :#3A3A3A; +} + +/*TextBox style */ +.TextBox +{ + height: 15PX; + width: 150PX; + font-size:15px; + font-family:Arial; + +} +.TextBox_Long +{ + height: 15PX; + font-size:11px; + font-family:Arial; +} +.TextBox_Show +{ + height: 19PX; + width: 150PX; + font-size:11px; + font-family:Arial; + + background-color:#D3D3D3; + width:100px; + + +} +.TextBox_Show_Long +{ + height: 19PX; + font-size:11px; + font-family:Arial; + color:#3A3A3A; + background-color:#E0E0E0; + + border-width: 1px; +} +.TextBox_NoBorder +{ + height: 19PX; + width: 150PX; + font-size:11px; + font-family:Arial; + color:#3A3A3A; + background-color:White; + + border-width: 0px; +} + +/*DropDownList Style*/ +.DropDownList +{ + height: 20px; + width: 150px; + border-color:Gray; + border-style: none; + border-width: 0px; + background-color:White; + font-size:11px; + font-family:Arial; +} +.CheckBox,.RadioButton +{ + font-size:9pt; + font-family:Arial; + font-weight:normal; + height: 19px; + font-style:normal; +} + +/*Button style */ +.Button +{ + background-image:url(./images/button_100.gif); + background-repeat :repeat-x ; + background-color:Transparent; + width :100px; + color :#5B8200; + border-style :none ; + font-family:Arial; +} + +.Button_login +{ + background-image:url(./images/button_101.gif); + background-repeat :repeat-x ; + background-color:Transparent; + width :70px; + color :White; + border-style :none ; + font-family:Arial; +} + +.Button_120 +{ + background-image:url(./images/button_120.gif); + background-repeat :repeat-x ; + background-color:White; + width :120px; + color :#5B8200; + border-style :none ; + font-family:Arial; +} +.Button_150 +{ + background-image:url(./images/button_150.gif); + background-repeat :repeat-x ; + background-color:White; + width :150px; + color :#5B8200; + border-style :none ; + font-family:Arial; +} +.Button_UpLoad +{ +} +.Button_DownLoad +{ +} + +/*DataList*/ +.DataList +{ + font-size:8pt; + font-weight: normal; + color:#666666; + border-width: 0px; +} + +/*DataGrid Style */ +.DataGrid +{ + font-size:9pt; + font-weight: normal; + border-width:1px; + border-color:#858585; + border-left-style :none; +} +.HeaderStyle +{ + font-weight: bold; + font-size: 9pt; + font-weight: normal; + border-color: #858585; + color :#3A3A3A; + text-align: left; + background-color:#ECF1D9 ; + /*background-color: #FFE0C0;*/ + border-left-style :none ; + border-right-style :none ; +} +.ItemStyle +{ + font-size: 9pt; + background-color: White; + border-color :#D5D5D5; + color :#666666; + border-left-style :none ; + border-right-style :none ; + border-bottom-width :1; + border-top-width :1; + text-align:left ; + + + +} +.SelectedItemStyle +{ + font-size: 9pt; + background-color:#FFE0C0; + border-color :#D5D5D5; + color :white; + border-left-style :none ; + border-right-style :none ; + border-bottom-width :1; + border-top-width :1; + text-align:left ; + background:url(Images/bg_SelectedItem.gif) repeat-x; +} +.AlternatingItemStyle +{ + font-size: 9pt; + /*background-color:InfoBackground; */ + background-color : #EDF7FF; + border-color :#D5D5D5; + color :#666666; + border-left-style :none ; + border-right-style :none ; + border-bottom-width :1; + border-top-width :1; + text-align:left ; +} +.PagerStyle +{ + +} + +.Banner +{ + background-color:#60B6FF ; +/* background-image :url(./images/head11.gif); + background-repeat : no-repeat ; +*/ + font-size :large ; + color :White ; + font-family :Arial; + font-weight :Bold ; +} + +.FBannerText +{ + background-color:Transparent ; + font-size :9pt; + font-family :Arial ; + font-weight :bold ; + color :#666666 ; +} + .ILeft +{ + background-color:Transparent ; + /* + background-image :url(./images/Left.gif); + background-repeat :no-repeat ;*/ +} +.MTop +{ + background-color:Transparent ; + background-image :url(./images/m_top.gif); + background-repeat :no-repeat ; +} +.LTop +{ + background-color:Transparent ; + background-image :url(./images/t_top.gif); + background-repeat :no-repeat ; +} +.LMid +{ + background-color:Transparent ; + background-image :url(./images/t_mid.gif); + background-repeat :repeat ; +} +.LBel +{ + background-color:Transparent ; + background-image :url(./images/t_below.gif); + background-repeat :no-repeat ; +} +/*pseudoclasses*/ +.LMenu +{ + font-weight:bold; + FONT-SIZE: 12px; + COLOR:Black; + FONT-FAMILY: Arial; + TEXT-DECORATION: none; +} +.LMenu:active +{ + font-weight:bold; + FONT-SIZE: 12px; + COLOR:Black; + FONT-FAMILY: Arial; + TEXT-DECORATION: none +} +.LMenu:visited +{ + font-weight:bold; + FONT-SIZE: 12px; + COLOR:Black; + FONT-FAMILY: Arial; + TEXT-DECORATION:none +} +.LMenu:hover +{ + font-weight:bold; + FONT-SIZE: 12px; + COLOR: #0e0084; + FONT-FAMILY: Arial; + TEXT-DECORATION: none +} +.LAbout +{ + font-weight:bold; + FONT-SIZE: 22px; + COLOR:#605b84; + FONT-FAMILY: Arial; +} +.LAbout:active +{ + font-weight:bold; + FONT-SIZE: 22px; + COLOR:#605b84; + FONT-FAMILY: Arial; +} +.LAbout:visited +{ + font-weight:bold; + FONT-SIZE: 22px; + COLOR:#605b84; + FONT-FAMILY: Arial; +} +.LAbout:hover +{ + font-weight:bold; + FONT-SIZE: 22px; + COLOR:#605b84; + FONT-FAMILY: Arial; +} +.LINE +{ + background-image :url(./images/line_dot2.gif); + background-repeat :repeat-x ; + background-position:center; + height: 20px; +} +.LLine +{ + background-image :url(./images/line_dot.gif); + background-repeat :repeat-x ; + height: 1px; +} +.ALine +{ + background-image :url(./images/dot_green.gif); + background-repeat :repeat-x ; + height :30px; + background-position:center; +} +.ALineNoheight +{ + background-image :url(./images/dot_green.gif); + background-repeat :repeat-x ; + height :5px; + background-position:center; +} +.VLine +{ + background-image :url(./images/dot_green.gif); + background-repeat :repeat-y ; + width :1px; + background-position:center; +} +.RED +{ + color:Red; +} +.file +{ + /*border-color: #CCCCCC; + border-style: solid;*/ + border-width: 1px; + width:385px; + height: 19px; + font-size:11px; + color:#3A3A3A; + background-color:White; + +} +/*wyj*/ +.top_bg{ +background:url(Images/bg_top_tit.gif) repeat-x ; +color: #EDF7FF ; +width:200px; +line-height:30px + +} +.bg_top_title +{ +background:url(Images/bg_top_tit.gif) repeat-x; +color:#FFFFFF +} +.Table_border1{ border:1px solid #7197AC; padding:2px;} +.Table_border2{ border:1px solid #C9D5E1; margin:2px;} +.left{ +border:1px solid #C9D5E1; +background-color:#EDF7FF; +height:18px} +.tree_in{ +padding:10px;} +/*tree*/ +.title_tree{ +width:100%; +height:30px; +/**/ +background:url(Images/bg_top_tit.gif) repeat-x; +color:white; +line-height:30px; +text-align:center} +.left_title +{ +/*background:url(Images/bg_left.gif) repeat-x;*/ +color:#265AA3; +width:200px; +} +.3boder{ +border-left-color:#000000; +border-left-width:1px; +border-left-style:solid; +} +.2boder{ +border-left:1px solid #C6D7DF ; +border-right:1px solid #C6D7DF ; +} +.news_line{ +background:url(Images/ancor1.gif) no-repeat left; +padding-left:20px; +font-size:16px; +border-bottom:1px dotted #D5696C; +color:#A30206; +padding-top:10px; +line-height:20px +} +.site_map{ +background:url(Images/ancor1.gif) no-repeat left; +padding-left:13px; +font-size:16px; +border-bottom:1px ; +color:#A30206; +padding-top:10px; +line-height:20px +} +.right{ +border:1px solid #C9D5E1; +height:18px} +.news_table +{ +padding-top:5px; + font-size: 9pt; + font-weight: normal; + color:#666666; + background-color:Transparent; + border:1px solid #CCCCCC; + margin-top:8px ; + margin-bottom:5px ; + margin-right:8px ; + margin-left:5px ; + background:url(Images/bg_news.gif) repeat-x top; + +} + +.MyCalendar.ajax__calendar_container { + border:1px solid #646464; + background-color: Window; + color: red; +} +.MyCalendar.ajax__calendar_other .ajax__calendar_day, +.MyCalendar .ajax__calendar_other .ajax__calendar_year { + color: black; +} +.MyCalendar.ajax__calendar_hover .ajax__calendar_day, +.MyCalendar.ajax__calendar_hover .ajax__calendar_month, +.MyCalendar.ajax__calendar_hover .ajax__calendar_year { + color: black; +} +.MyCalendar.ajax__calendar_active .ajax__calendar_day, +.MyCalendar.ajax__calendar_active .ajax__calendar_month, +.MyCalendar.ajax__calendar_active .ajax__calendar_year { + color: black; + font-weight:bold; +} + \ No newline at end of file diff --git a/changes.txt b/changes.txt new file mode 100644 index 0000000..1884fbb --- /dev/null +++ b/changes.txt @@ -0,0 +1,14 @@ +2011.03.30 + +ϵĵ÷ʾλС + +alter table t_project alter column pj_score numeric(18, 4) + + +2011.03.31 + +projectEXt_imp.cs. line 174 + +ȫĿּܷ⡣ + +desktop ı desktopʾֵܷĸʽintdouble. \ No newline at end of file diff --git a/index.aspx b/index.aspx new file mode 100644 index 0000000..940afc3 --- /dev/null +++ b/index.aspx @@ -0,0 +1,73 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %> + + + + + + + + + + + + + + + + + + + + + + + + + +
<%# DataBinder.Eval(Container.DataItem,"auth_name") %>
+ + + + +
+
    <%# DataBinder.Eval(Container.DataItem,"auth_name") %>    查看全部...
+ + + + +
+ +      · <%# FormatShowContent((string)DataBinder.Eval(Container.DataItem, "news_title"),25) %> <%# DataBinder.Eval(Container.DataItem, "create_time", "{0:MM/dd} ")%>
+ +
+ + +
+ +
+ +
+ +
+
  
+ + + + +    <%# DataBinder.Eval(Container.DataItem,"news_title") %>
+ +<%# DataBinder.Eval(Container.DataItem,"news_content") %> + +
+
+ +
+ + + +  
+ + + +
+ diff --git a/index.aspx.cs b/index.aspx.cs new file mode 100644 index 0000000..ddcd9da --- /dev/null +++ b/index.aspx.cs @@ -0,0 +1,114 @@ +using System; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.Utils; +using DeiNiu.wms.Logical; + +public partial class index : Page +{ + + protected void Page_Load(object sender, EventArgs e) + { + // if(!IsPostBack) + // Session[appScope.PagelevelObj] = this; + + // if (!IsPostBack) + // bindData(); + + Response.Redirect("login.aspx"); + + } + + private void InitializeComponent() + { + + } + + + void bindData() + { + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryTopCatagory().DefaultView; + RepeaterTop.DataSource = dv; + RepeaterTop.DataBind(); + + RepeaterMarquee.DataSource = logic.QueryMarqueen().DefaultView; + RepeaterMarquee.DataBind(); + + } + + protected void RepeaterTop_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) + { + if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) + { + Repeater rpColumnNews = (Repeater)e.Item.FindControl("RepeaterSecond"); + //找到分类Repeater关联的数据项 + DataRowView rowv = (DataRowView)e.Item.DataItem; + //提取分类ID + string authID = Convert.ToString(rowv["ID"]); + //里面的Repeater + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryPublicInfomation().DefaultView; + dv.RowFilter = "auth_uplevel='" + authID + "' and auth_marqueen=0 "; + rpColumnNews.DataSource = dv; + rpColumnNews.DataBind(); + + + } + } + + protected void RepeaterSecond_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) + { + if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) + { + Repeater rpColumnNews = (Repeater)e.Item.FindControl("RepeaterThird"); + //找到分类Repeater关联的数据项 + DataRowView rowv = (DataRowView)e.Item.DataItem; + //提取分类ID + string authID = Convert.ToString(rowv["ID"]); + //里面的Repeater + LPublicNews logic = new LPublicNews(); + DataView dv = logic.QueryNews(Convert.ToInt32(authID)).DefaultView; + dv = GetTopDataViewRows(dv,3); + rpColumnNews.DataSource = dv; + rpColumnNews.DataBind(); + + + } + } + + public string FormatShowContent(string titlecontent, int titlelength) + { + if (titlecontent.Length > titlelength) + { + return titlecontent.Substring(0, titlelength); + } + else + { + for (int i = 0; i < titlelength - titlecontent.Length;i++ ) + titlecontent += " "; + + return titlecontent; + + } + + } + + private DataView GetTopDataViewRows(DataView dv, int n) + { + DataTable dt = dv.Table.Clone(); + + for (int i = 0; i < n - 1; i++) + { + if (i >= dv.Count) + { + break; + } + dt.ImportRow(dv[i].Row); + } + return new DataView(dt, dv.RowFilter, dv.Sort, dv.RowStateFilter); + } + + +} diff --git a/index.aspx.resx b/index.aspx.resx new file mode 100644 index 0000000..52a9ad3 --- /dev/null +++ b/index.aspx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/licenses.licx b/licenses.licx new file mode 100644 index 0000000..f853b11 --- /dev/null +++ b/licenses.licx @@ -0,0 +1,4 @@ +DevExpress.Patch.InMemoryPatch, DevExpress.Patch.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7fc7bfca2443de66 +DevExpress.XtraCharts.Web.WebChartControl, DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxPageControl, DevExpress.Web.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxGridView, DevExpress.Web.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/login.aspx b/login.aspx new file mode 100644 index 0000000..3a0036e --- /dev/null +++ b/login.aspx @@ -0,0 +1,70 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + + + + +
+  
+
+ +
+ diff --git a/login.aspx.cs b/login.aspx.cs new file mode 100644 index 0000000..6f9b9ce --- /dev/null +++ b/login.aspx.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections; +using DeiNiu.wms.Logical; + +public partial class login : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + txtUserName.Focus(); + } + protected void lklogin_Click(object sender, EventArgs e) + { + + if (Session["checkcode"] == null) Session["checkcode"] = new Random().Next(2, 4); + LEmployee lem = new LEmployee(); + + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LoginLog(txtUserName.Text , " trying to login "); + string CheckCode = this.txtCheck.Text.ToUpper(); + bool paswdpassed = lem.Login(txtUserName.Text, txtPasswd.Text); + bool loginPassed = paswdpassed + && Session["checkcode"].ToString().Equals(CheckCode); + + if (paswdpassed) logobj.LoginLog(txtUserName.Text," passwd passed"); else logobj.LoginLog(txtUserName.Text ," passwd failed"); + if (!loginPassed) + { + txtPasswd.Text = string.Empty; + lblResult.Text = "用户登录信息错误,请重新输入"; + logobj.LoginLog(txtUserName.Text, " login failed "); + + } + else + { + lblResult.Text = "Passed"; + + if (((ArrayList) Application["userlst"]).Contains(lem.GetEmployee.em_account)) + { + lblResult.Text = "" + lem.GetEmployee.em_account + "用户已在线,不可重复登录。"; + // return; + } + else //系统在线人数 + { + + Application["usercnt"] = Convert.ToInt32(Application["usercnt"].ToString()) + 1; + + ((ArrayList) Application["userlst"]).Add(lem.GetEmployee.em_account); + + } + DeiNiu.Utils. LoginInfo.UserId = lem.GetEmployee.ID; + + lem.GetEmployee.em_isOnline = true; + lem.GetEmployee.Update(); + + + + Session["CurrentUserId"] = lem.GetEmployee.ID; + Session["CurrentUserAccount"] = lem.GetEmployee.em_account; + Session["CurrentUser"] = lem; + logobj.LoginLog(txtUserName.Text, " login succeed"); + Response.Redirect("desktop.aspx"); + } + } + + protected void btnCancelLogin_Click(object sender, EventArgs e) + { + Response.Redirect("index.aspx"); + } +} diff --git a/masterPage.master b/masterPage.master new file mode 100644 index 0000000..cdcc3eb --- /dev/null +++ b/masterPage.master @@ -0,0 +1,229 @@ +<%@ Master Language="C#" AutoEventWireup="true" CodeFile="masterPage.master.cs" Inherits="ajax.DeiNiuMasterPage" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + WMS v1.0 + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+  
+ + +
+
+ + + + + + + + + + + +
+ + + + +
+
+ ûȨ
+
+ + + + +
+
+
+ + + + + + + + + + +
+ + + + + + +   + + + + + + + + + + + +   + ˳ + +   + ҳ  +    +    + +   +
+ + +
+ + + +
+
+                         +                         +                        +         +           +                                +                        +          +
+
+ +
+ + + + +
+ +   +
+ +
+
+
+
+ + + diff --git a/masterPage.master.cs b/masterPage.master.cs new file mode 100644 index 0000000..adef8bd --- /dev/null +++ b/masterPage.master.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections; +using System.Data; +using System.Web.UI; +using System.Web.UI.WebControls; +using DeiNiu.wms.Logical; + +namespace ajax +{ + public partial class DeiNiuMasterPage : System.Web.UI.MasterPage + { + public LEmployee lem; + protected void Page_Load(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(Request.QueryString["___command"])) + { + string cmd = Request.QueryString["___command"]; + if (cmd == "ClearSession") + { + if ((Session["CurrentUser"] != null)) + { + + if( System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + Session.Abandon(); //Session, all sessions will be clear ? no kiding, it will obsolete the current session. + } + } + + + //ҳ治ز + Response.Buffer = true; + + Response.ExpiresAbsolute = DateTime.Now.AddMinutes(-1); + + Response.Expires = 0; + + Response.CacheControl = "no-cache"; + try + { + // if (Session["CurrentUser"] != null) + InitializeUserUi(); + }catch(Exception){} + + } + + /// + /// ǰûûе¼ + /// + void ShowLogin() + { + // login.Visible = lem == null; + lbWelcome.Text = lem != null ? "ӭ" + lem.GetEmployee.em_name +",": ""; + lkbtnLogin.Text = lem != null ? "˳" : "¼"; + // lkIndex.Visible = lem != null; + divAuhtority.Visible = lem != null; + lkDesktop.Visible = lem != null; + leftMenu.Visible = lem!=null; + lkkanban.Visible = lem != null; + ImageBtnHelp.Visible = leftMenu.Visible; + } + + /// + /// ûȨޣʼû棬˵ + /// + public void InitializeUserUi() + { + lem = (LEmployee)Session["CurrentUser"]; + if (lem != null) setTree(); else treeMenu.Nodes.Clear(); + ShowLogin(); + + + } + public UpdatePanel UpdatePanelMaster + { + get + { + return UpdatePanel1; + } + } + + /// + /// ͨȨб + /// + private void setTree() + { + treeMenu.Nodes.Clear(); + BindAuthTree2("0", null, new LAuthority().getAllActiveData().Tables[0].DefaultView); + if (lem != null) + { + // if( lem.GetEmployee.em_account !="Root") + + { + ArrayList al = new LRoleAuthority().GetPublicAuthorityList(); + + removeUnAuthoritedMenu(lem.AuthList ,al ,treeMenu.Nodes); + } + } + /* else + { + BindAuthTree2("0", null, new LRoleAuthority().GetPublicAuthorityTable().DefaultView); + }*/ + } + void removeUnAuthoritedMenu(ArrayList toKeepAuthority,ArrayList toKeepPublic, TreeNodeCollection nd) + { + // foreach (TreeNode node in nd) + for (int i = 0; i < nd.Count;i++ ) + { + TreeNode node = nd[i]; + // foreach (TreeNode cnd in node.ChildNodes) + for (int j = 0; j < node.ChildNodes.Count; j++) + { + TreeNode cnd = node.ChildNodes[j]; + if (cnd.ChildNodes.Count > 0) + { + removeUnAuthoritedMenu(toKeepAuthority, toKeepPublic,cnd.ChildNodes); + } + else + if (string.IsNullOrEmpty(cnd.NavigateUrl) || lem.GetEmployee.em_account !="Root" && !(toKeepAuthority.Contains(cnd.NavigateUrl.ToUpper()) || toKeepPublic.Contains(cnd.NavigateUrl.ToUpper()))) + { + node.ChildNodes.Remove(cnd); + j--; + } + + } + if (node.ChildNodes.Count == 0) + { + nd.Remove(node); + i--; + } + } + } + + + public void BindAuthTree2(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "' and auth_publicinfomation=0"; + foreach (DataRowView row in dv) + { + TreeNode node = new TreeNode(); + string authLink = row["auth_link"].ToString(); + node.Value = row["ID"].ToString(); + node.Expanded = true; + if (authLink == string.Empty || authLink.Trim().Length < 6) //not *.aspx + { + node.Text = "" + row["auth_name"] + ""; + node.SelectAction = TreeNodeSelectAction.None; + node.ShowCheckBox = false; + } + else + { + node.Text = row["auth_name"].ToString(); + node.NavigateUrl = authLink; + } + + + if (pNode == null) + //˵Ǹڵ + { + + treeMenu.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindAuthTree2(node.Value, node, new DataView(dv.Table)); + + } + } + + + public void BindAuthTree(string id, TreeNode pNode, DataView dv) + { + + dv.RowFilter = "auth_uplevel = '" + id + "'"; + foreach (DataRowView row in dv) + { + TreeNode node; + string authLink = row["auth_link"].ToString(); + + + if (authLink == string.Empty || authLink.Trim().Length < 6) //not *.aspx + { + // node = new TreeNode("" + row["auth_name"] + "", row["ID"].ToString() ,"","",""); + node = new TreeNode(); + node.Text = "" + row["auth_name"] + ""; + node.Value = row["ID"].ToString(); + } + else + { + node = new TreeNode(row["auth_name"].ToString(), row["ID"].ToString(), "", authLink, ""); + } + node.Expanded = true; + + if (pNode == null) + //˵Ǹڵ + { + + treeMenu.Nodes.Add(node); + + + } + else + { + + pNode.ChildNodes.Add(node); + + } + BindAuthTree(node.Value, node, new DataView(dv.Table)); + + } + } + + + + void Login() + { + + if (Session["CurrentUser"]==null) //not login + { + + Response.Redirect("~/login.aspx"); + } + else + { + ((ArrayList)Application["userlst"]).Remove(lem.GetEmployee.em_account); + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + + Application["usercnt"] = Convert.ToInt32(Application["usercnt"].ToString()) - 1; + + Session.RemoveAll(); + Session.Abandon(); + Response.Redirect("~/login.aspx"); + } + + + } + + protected void lkbtnLogin_Click(object sender, EventArgs e) + { + Login(); + + + } + + public ScriptManager ScriptMgr + { + get + { + return this.ScriptManager1; + } + } + + protected void lkIndex_Click(object sender, EventArgs e) + { + Response.Redirect("~/index.aspx"); + } + + + protected void lkDesktop_Click(object sender, EventArgs e) + { + Response.Redirect("~/desktop.aspx"); + } + protected void lklogin_Click(object sender, EventArgs e) + { + Login(); + } + + protected void LinkHelp_Click(object sender, EventArgs e) + { + + } + protected void ImageButton1_Click(object sender, ImageClickEventArgs e) + { + + string requestPage = Request.AppRelativeCurrentExecutionFilePath; + + string helpDoc = Request.ApplicationPath+ "/ug/"+ requestPage.Substring(2, requestPage.IndexOf(".aspx")-2)+".html"; + // string helpDoc = siteName + requestPage.Substring(2, requestPage.IndexOf(".aspx") - 2) + ".html"; + // if (!System.IO.File.Exists(Server.MapPath(helpDoc))) + // helpDoc = siteName+ "/nohelpdoc.html"; // helpDoc = Request.ApplicationPath+ "/ug/nohelpdoc.html"; + + string newWindow = "openwin('" + helpDoc + "');"; + ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "alert", newWindow, true); + } + protected void lkkanban_Click(object sender, EventArgs e) + { + Response.Redirect("~/wms/Charts.aspx"); + } +} +} \ No newline at end of file diff --git a/public/.svn/entries b/public/.svn/entries new file mode 100644 index 0000000..7081cc5 --- /dev/null +++ b/public/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/public +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +JScript.js +file + + + + +2011-04-01T02:51:02.492943Z +0c195519c5832317b51564ac69179a71 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +4998 + diff --git a/public/.svn/text-base/JScript.js.svn-base b/public/.svn/text-base/JScript.js.svn-base new file mode 100644 index 0000000..1415b3e --- /dev/null +++ b/public/.svn/text-base/JScript.js.svn-base @@ -0,0 +1,218 @@ + + + document.onkeydown = function() + { + //F5F11 + if ( window.event.keyCode == 116 || window.event.keyCode == 117 || window.event.keyCode == 122) + { + event.keyCode = 0; + return false; + } + // Alt+ , Alt+ + if ((window.event.altKey) + + &&((window.event.keyCode == 37) || (window.event.keyCode == 39))) + { + return false; + } + //CTRL+N + if (window.event.ctrlKey && window.event.keyCode == 78) + { + return false; + } + //CTRL+R + if (window.event.ctrlKey && window.event.keyCode == 82) + { + return false; + } + //CTRL+H + if (window.event.ctrlKey && window.event.keyCode == 72) + { + return false; + } + //CTRL+I + if (window.event.ctrlKey && window.event.keyCode == 73) + { + return false; + } + //SHIFT+F10 + if (window.event.shiftKey && window.event.keyCode == 121) + { + return false; + } + //DZ༭BACK SPACE + if (window.event.keyCode == 8) + { + var e= window.event.srcElement; + if ((e.tagName.toUpperCase() != "INPUT" && e.tagName.toUpperCase() != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase()!="FILE") ||(!e.isContentEditable) || (e.disabled) ) + { + return false; + } + } + } + /* + //DZ༭Ҽ˵ + document.oncontextmenu = function() + { + var e= event.srcElement; + if ((e.tagName != "INPUT" && e.tagName != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase() != "FILE")) + //if (e.tagName != "INPUT" || e.type != "text") + { + return false; + } + } + */ + + + function delete_click() + { + return confirm("ȷҪɾ"); + } + window.onload =function() +{ + if(getcookie("height")!=null) + document.body.scrollTop=getcookie("height"); +} + +window.onunload =function () +{ + setcookie("height",document.body.scrollTop); +} +function getcookie(sName) +{ + var aCookie = document.cookie.split("; "); + for (var i=0; i < aCookie.length; i++) + { + var aCrumb = aCookie[i].split("="); + if (sName == aCrumb[0]) + return unescape(aCrumb[1]); + } + return null; +} + +function setcookie(sName, sValue) +{ + date = new Date(); + date.setTime(date.getTime()+5000); //5 second + document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString(); +} + + + + + +function openwin(Name) +{ + winSub=window.open(Name,'aaa','width=780,center=1,help=no,scrollbars=1,maxnimize=yes') ; + winSub.focus(); +} + +function get_cookie(Name) +{ + var search = Name + "=" + var returnvalue = ""; + if (document.cookie.length > 0) + { + offset = document.cookie.indexOf(search) ; + if (offset != -1) + { + offset += search.length + end = document.cookie.indexOf(";", offset); + if (end == -1) + end = document.cookie.length; + returnvalue=unescape(document.cookie.substring(offset, end)) ; + alert(returnvalue); + } + } + return returnvalue; +} + + function loadpopup(Name,id) +{ + if (get_cookie(id)=='') + { + openwin(Name) + document.cookie=id+"=yes" + } +} + +function windowclose(id) +{ + document.cookie(id)==''; +} + + /* + function window.onunload() + { + if (event.clientX < 0 && event.clientY < 0) + window.showModalDialog('~/logout.aspx' ); + } + */ + + function GetXmlHttpObject() +{ + //XMLHttpRequestͺͽHTTPӦ + xmlHttpObj = null; + try + { + // FireFox Opera 8.0+ Safari + xmlHttpObj = new XMLHttpRequest(); + if(xmlHttpObj.overrideMimeType) + { + xmlHttpObj.overrideMimeType('text/xml'); + } + } + catch(e) + { + // IE + try + { + xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch(e) + { + xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + } + return xmlHttpObj; +} + +function StateChanged() +{ + if(___xmlHttp.readyState == 4) + { + if(___xmlHttp.status == 200) + { + } + else + { + } + } +} + +var ___xmlHttp=null; +function ClearSession() +{ + + if(___xmlHttp==null) + ___xmlHttp = GetXmlHttpObject(); + if(___xmlHttp == null) + return false; + + var url = "?___command=ClearSession&___clientRandom=" + Math.random(); + + ___xmlHttp.open("GET", url, true); + ___xmlHttp.onreadystatechange = StateChanged; + ___xmlHttp.send(null); + +} + +window.onbeforeunload = function() +{ + var n = window.event.screenX - window.screenLeft; + var b = n > document.documentElement.scrollWidth-20; + if(b && window.event.clientY < 0 || window.event.altKey) + { + ClearSession(); + } +} diff --git a/public/JScript.js b/public/JScript.js new file mode 100644 index 0000000..24ada79 --- /dev/null +++ b/public/JScript.js @@ -0,0 +1,214 @@ + + +document.onkeydown = function () { + + alert(window.event.keyCode); + //F5F11 + if (window.event.keyCode == 116 || window.event.keyCode == 117 || window.event.keyCode == 122) { + event.keyCode = 0; + return false; + } + // Alt+ , Alt+ + if ((window.event.altKey) + + && ((window.event.keyCode == 37) || (window.event.keyCode == 39))) { + return false; + } + //CTRL+N + if (window.event.ctrlKey && window.event.keyCode == 78) { + return false; + } + //CTRL+R + if (window.event.ctrlKey && window.event.keyCode == 82) { + return false; + } + //CTRL+H + if (window.event.ctrlKey && window.event.keyCode == 72) { + return false; + } + //CTRL+I + if (window.event.ctrlKey && window.event.keyCode == 73) { + return false; + } + //SHIFT+F10 + if (window.event.shiftKey && window.event.keyCode == 121) { + return false; + } + //DZ༭BACK SPACE + if (window.event.keyCode == 8) { + var e = window.event.srcElement; + alert("tagName " + e.tagName.toUpperCase()); + alert("type " + e.type.toUpperCase()); + alert("isContentEditable " + e.isContentEditable )); + alert("disabled " + e.disabled); + if ((e.tagName.toUpperCase() != "INPUT" && e.tagName.toUpperCase() != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase() != "FILE") || (!e.isContentEditable) || (e.disabled)) { + return false; + } + } +} + /* + //DZ༭Ҽ˵ + document.oncontextmenu = function() + { + var e= event.srcElement; + if ((e.tagName != "INPUT" && e.tagName != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase() != "FILE")) + //if (e.tagName != "INPUT" || e.type != "text") + { + return false; + } + } + */ + + + function delete_click() + { + return confirm("ȷҪɾ"); + } + window.onload =function() +{ + if(getcookie("height")!=null) + document.body.scrollTop=getcookie("height"); +} + +window.onunload =function () +{ + setcookie("height",document.body.scrollTop); +} +function getcookie(sName) +{ + var aCookie = document.cookie.split("; "); + for (var i=0; i < aCookie.length; i++) + { + var aCrumb = aCookie[i].split("="); + if (sName == aCrumb[0]) + return unescape(aCrumb[1]); + } + return null; +} + +function setcookie(sName, sValue) +{ + date = new Date(); + date.setTime(date.getTime()+5000); //5 second + document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString(); +} + + + + + +function openwin(Name) +{ + winSub=window.open(Name,'aaa','width=780,center=1,help=no,scrollbars=1,maxnimize=yes') ; + winSub.focus(); +} + +function get_cookie(Name) +{ + var search = Name + "=" + var returnvalue = ""; + if (document.cookie.length > 0) + { + offset = document.cookie.indexOf(search) ; + if (offset != -1) + { + offset += search.length + end = document.cookie.indexOf(";", offset); + if (end == -1) + end = document.cookie.length; + returnvalue=unescape(document.cookie.substring(offset, end)) ; + alert(returnvalue); + } + } + return returnvalue; +} + + function loadpopup(Name,id) +{ + if (get_cookie(id)=='') + { + openwin(Name) + document.cookie=id+"=yes" + } +} + +function windowclose(id) +{ + document.cookie(id)==''; +} + + /* + function window.onunload() + { + if (event.clientX < 0 && event.clientY < 0) + window.showModalDialog('~/logout.aspx' ); + } + */ + + function GetXmlHttpObject() +{ + //XMLHttpRequestͺͽHTTPӦ + xmlHttpObj = null; + try + { + // FireFox Opera 8.0+ Safari + xmlHttpObj = new XMLHttpRequest(); + if(xmlHttpObj.overrideMimeType) + { + xmlHttpObj.overrideMimeType('text/xml'); + } + } + catch(e) + { + // IE + try + { + xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch(e) + { + xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); + } + } + return xmlHttpObj; +} + +function StateChanged() +{ + if(___xmlHttp.readyState == 4) + { + if(___xmlHttp.status == 200) + { + } + else + { + } + } +} + +var ___xmlHttp=null; +function ClearSession() +{ + + if(___xmlHttp==null) + ___xmlHttp = GetXmlHttpObject(); + if(___xmlHttp == null) + return false; + + var url = "?___command=ClearSession&___clientRandom=" + Math.random(); + + ___xmlHttp.open("GET", url, true); + ___xmlHttp.onreadystatechange = StateChanged; + ___xmlHttp.send(null); + +} + +window.onbeforeunload = function() +{ + var n = window.event.screenX - window.screenLeft; + var b = n > document.documentElement.scrollWidth-20; + if(b && window.event.clientY < 0 || window.event.altKey) + { + ClearSession(); + } +} diff --git a/public/Pager.ascx b/public/Pager.ascx new file mode 100644 index 0000000..713275a --- /dev/null +++ b/public/Pager.ascx @@ -0,0 +1,53 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pager.ascx.cs" Inherits="public_Pager" %> + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/public/Pager.ascx.cs b/public/Pager.ascx.cs new file mode 100644 index 0000000..fae5ab6 --- /dev/null +++ b/public/Pager.ascx.cs @@ -0,0 +1,296 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class public_Pager : System.Web.UI.UserControl +{ + + /**/ + /// + /// 申明委托 + /// + /// + /// + public delegate int EventPagingHandler(EventPagingArg e); + /**/ + /// + /// 分页控件呈现 + /// + protected void Page_Load(object sender, EventArgs e) + { + + } + + + + public event EventPagingHandler EventPaging; + /**/ + /// + /// 每页显示记录数 + /// + private int _pageSize = 100; + /**/ + /// + /// 每页显示记录数 + /// + public int PageSize + { + get { return _pageSize; } + set + { + _pageSize = value; + GetPageCount(); + } + } + + private int _nMax = 0; + /**/ + /// + /// 总记录数 + /// + public int NMax + { + get { return _nMax; } + set + { + _nMax = value; + GetPageCount(); + } + } + + private int _pageCount = 0; + /**/ + /// + /// 页数=总记录数/每页显示记录数 + /// + public int PageCount + { + get { return _pageCount; } + set { _pageCount = value; } + } + + private int _pageCurrent = 0; + /**/ + /// + /// 当前页号 + /// + public int PageCurrent + { + get { return _pageCurrent; } + set { _pageCurrent = value; } + } + + /// + /// 设置页面大小 + /// + private void GetPageCount() + { + if (this.NMax > 0) + { + this.PageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(this.NMax) / Convert.ToDouble(this.PageSize))); + // lblPageCount.Text = " / " + PageCount.ToString(); + lblcurentpage.Text = PageCurrent.ToString() + " / " + PageCount.ToString(); + //lblPageCount1.Text = "每页 "+PageSize .ToString ()+" 条,共 "+PageCount.ToString()+" 页"; + // lblPageCount1.Text = "Page no: " + PageSize.ToString() + ",Total:" + PageCount.ToString() + " pages"; + // lblPageCount1.Text = PageSize.ToString() + "/" + PageCount.ToString() ; + } + else + { + this.PageCount = 0; + } + } + + /**/ + /// + /// 翻页控件数据绑定的方法 关键是这步,都是调用这里 + /// + public void Bind() + { + if (this.EventPaging != null) + { + this.NMax = this.EventPaging(new EventPagingArg(this.PageCurrent)); + } + + if (this.PageCurrent > this.PageCount) + { + this.PageCurrent = this.PageCount; + } + if (this.PageCount == 1) + { + this.PageCurrent = 1; + } + lblcurentpage.Text = PageCurrent.ToString() + " / " + PageCount.ToString(); + lblRecordCount.Text = "共" + NMax.ToString() + "条"; + // lblRecordCount.Text = "Total: " + NMax.ToString() + " records"; + + + btnPrev.Enabled = true; + btnFirst.Enabled = true; + btnLast.Enabled = true; + btnNext.Enabled = true; + + if (this.PageCurrent == 1) + { + this.btnPrev.Enabled = false; + this.btnFirst.Enabled = false; + } + + + if (this.PageCurrent == this.PageCount) + { + this.btnLast.Enabled = false; + this.btnNext.Enabled = false; + } + + if (this.NMax == 0) + { + btnNext.Enabled = false; + btnLast.Enabled = false; + btnFirst.Enabled = false; + btnPrev.Enabled = false; + } + cmbPagecount.Items.Clear(); + for (int i = 1; i <= PageCount; i++) + { + cmbPagecount.Items.Add(i.ToString()); + //if(i== PageCurrent - 1){ + // cmbPagecount.SelectedItem = cmbPagecount.Items[i - 1]; + //} + } + this.cmbPagecount.SelectedIndexChanged -= new System.EventHandler(this.cmbPagecount_SelectedIndexChanged); + cmbPagecount.SelectedIndex = PageCurrent - 1; + this.cmbPagecount.SelectedIndexChanged += new System.EventHandler(this.cmbPagecount_SelectedIndexChanged); + + + comPagesize.Items.Clear(); + for (int i = 100; i <= 900; i += 100) + { + comPagesize.Items.Add(i.ToString()); + + } + /* + for (int i = 50; i <= 500; i+=50) + { + comPagesize.Items.Add(i.ToString()); + + } + */ + for (int i = 1000; i <= 5000; i += 1000) + { + comPagesize.Items.Add(i.ToString()); + } + this.comPagesize.SelectedIndexChanged -= new System.EventHandler(this.comPagesize_SelectedIndexChanged); + // comPagesize.SelectedIndex = this._pageSize / 100 -1; + // comPagesize.SelectedIndex = this._pageSize / 50 - 1 ; + comPagesize.SelectedIndex = _pageSize <= 1000 ? this._pageSize / 100 - 1 : 10 + _pageSize / 1000 - 2; + this.comPagesize.SelectedIndexChanged += new System.EventHandler(this.comPagesize_SelectedIndexChanged); + + + } + /// + /// 首页 + /// + /// + /// + public void btnFirst_Click(object sender, ImageClickEventArgs e) + { + PageCurrent = 1; + this.Bind(); + } + //上一页 + /// + /// + /// + /// + /// + public void btnPrev_Click(object sender, ImageClickEventArgs e) + { + PageCurrent -= 1; + if (PageCurrent <= 0) + { + PageCurrent = 1; + } + this.Bind(); + } + /// + /// 下一页 + /// + /// + /// + public void btnNext_Click(object sender, ImageClickEventArgs e) + { + this.PageCurrent += 1; + if (PageCurrent > PageCount) + { + PageCurrent = PageCount; + } + this.Bind(); + } + /// + /// 最后页 + /// + /// + /// + public void btnLast_Click(object sender, ImageClickEventArgs e) + { + PageCurrent = PageCount; + this.Bind(); + } + /// + /// 转到新页 + /// + /// + /// + public void btnGo_Click(object sender, ImageClickEventArgs e) + { + if (Int32.TryParse(cmbPagecount.SelectedItem.ToString(), out _pageCurrent)) + { + this.Bind(); + } + } + + public void cmbPagecount_SelectedIndexChanged(object sender, EventArgs e) + { + if (Int32.TryParse(cmbPagecount.SelectedItem.ToString(), out _pageCurrent)) + { + this.Bind(); + } + } + public void comPagesize_SelectedIndexChanged(object sender, EventArgs e) + { + if (Int32.TryParse(comPagesize.SelectedItem.ToString(), out _pageSize)) + { + GetPageCount(); + this.Bind(); + } + + + } + + + + + + + + + + + + + +} /**/ +/// +/// 自定义事件数据基类 +/// +public class EventPagingArg : EventArgs +{ + private int _intPageIndex; + public EventPagingArg(int PageIndex) + { + _intPageIndex = PageIndex; + } +} \ No newline at end of file diff --git a/public/kindeditor/asp.net/README.txt b/public/kindeditor/asp.net/README.txt new file mode 100644 index 0000000..24c7ad4 --- /dev/null +++ b/public/kindeditor/asp.net/README.txt @@ -0,0 +1,12 @@ +KindEditor ASP.NET + +本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。 +如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + +使用方法: + +1. 解压zip文件,将所有文件复制到IIS的wwwroot/kindeditor目录下。 + +2. 将kindeditor/asp.net/bin目录下的dll文件复制到wwwroot/bin目录下。 + +3. 打开浏览器,输入http://localhost:[P0RT]/kindeditor/asp.net/demo.aspx。 diff --git a/public/kindeditor/asp.net/bin/LitJSON.dll b/public/kindeditor/asp.net/bin/LitJSON.dll new file mode 100644 index 0000000..9cc439d Binary files /dev/null and b/public/kindeditor/asp.net/bin/LitJSON.dll differ diff --git a/public/kindeditor/asp.net/demo.aspx b/public/kindeditor/asp.net/demo.aspx new file mode 100644 index 0000000..6c0b0e3 --- /dev/null +++ b/public/kindeditor/asp.net/demo.aspx @@ -0,0 +1,80 @@ +<%@ Page Language="C#" AutoEventWireup="true" validateRequest="false" %> + + + + + + + + + KindEditor ASP.NET + + + + + + + + + +
+ +
+ (提交快捷键: Ctrl + Enter) + + + diff --git a/public/kindeditor/asp.net/file_manager_json.ashx b/public/kindeditor/asp.net/file_manager_json.ashx new file mode 100644 index 0000000..857e7ce --- /dev/null +++ b/public/kindeditor/asp.net/file_manager_json.ashx @@ -0,0 +1,227 @@ +<%@ webhandler Language="C#" class="FileManager" %> + +/** + * KindEditor ASP.NET + * + * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。 + * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + * + */ + +using System; +using System.Collections; +using System.Web; +using System.IO; +using System.Text.RegularExpressions; +using LitJson; +using System.Collections.Generic; + +public class FileManager : IHttpHandler +{ + public void ProcessRequest(HttpContext context) + { + String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); + + //根目录路径,相对路径 + String rootPath = "../attached/"; + //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ + String rootUrl = aspxUrl + "../attached/"; + //图片扩展名 + String fileTypes = "gif,jpg,jpeg,png,bmp"; + + String currentPath = ""; + String currentUrl = ""; + String currentDirPath = ""; + String moveupDirPath = ""; + + String dirPath = context.Server.MapPath(rootPath); + String dirName = context.Request.QueryString["dir"]; + if (!String.IsNullOrEmpty(dirName)) { + if (Array.IndexOf("image,flash,media,file".Split(','), dirName) == -1) { + context.Response.Write("Invalid Directory name."); + context.Response.End(); + } + dirPath += dirName + "/"; + rootUrl += dirName + "/"; + if (!Directory.Exists(dirPath)) { + Directory.CreateDirectory(dirPath); + } + } + + //根据path参数,设置各路径和URL + String path = context.Request.QueryString["path"]; + path = String.IsNullOrEmpty(path) ? "" : path; + if (path == "") + { + currentPath = dirPath; + currentUrl = rootUrl; + currentDirPath = ""; + moveupDirPath = ""; + } + else + { + currentPath = dirPath + path; + currentUrl = rootUrl + path; + currentDirPath = path; + moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1"); + } + + //排序形式,name or size or type + String order = context.Request.QueryString["order"]; + order = String.IsNullOrEmpty(order) ? "" : order.ToLower(); + + //不允许使用..移动到上一级目录 + if (Regex.IsMatch(path, @"\.\.")) + { + context.Response.Write("Access is not allowed."); + context.Response.End(); + } + //最后一个字符不是/ + if (path != "" && !path.EndsWith("/")) + { + context.Response.Write("Parameter is not valid."); + context.Response.End(); + } + //目录不存在或不是目录 + if (!Directory.Exists(currentPath)) + { + context.Response.Write("Directory does not exist."); + context.Response.End(); + } + + //遍历目录取得文件信息 + string[] dirList = Directory.GetDirectories(currentPath); + string[] fileList = Directory.GetFiles(currentPath); + + switch (order) + { + case "size": + Array.Sort(dirList, new NameSorter()); + Array.Sort(fileList, new SizeSorter()); + break; + case "type": + Array.Sort(dirList, new NameSorter()); + Array.Sort(fileList, new TypeSorter()); + break; + case "name": + default: + Array.Sort(dirList, new NameSorter()); + Array.Sort(fileList, new NameSorter()); + break; + } + + Hashtable result = new Hashtable(); + result["moveup_dir_path"] = moveupDirPath; + result["current_dir_path"] = currentDirPath; + result["current_url"] = currentUrl; + result["total_count"] = dirList.Length + fileList.Length; + List dirFileList = new List(); + result["file_list"] = dirFileList; + for (int i = 0; i < dirList.Length; i++) + { + DirectoryInfo dir = new DirectoryInfo(dirList[i]); + Hashtable hash = new Hashtable(); + hash["is_dir"] = true; + hash["has_file"] = (dir.GetFileSystemInfos().Length > 0); + hash["filesize"] = 0; + hash["is_photo"] = false; + hash["filetype"] = ""; + hash["filename"] = dir.Name; + hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); + dirFileList.Add(hash); + } + for (int i = 0; i < fileList.Length; i++) + { + FileInfo file = new FileInfo(fileList[i]); + Hashtable hash = new Hashtable(); + hash["is_dir"] = false; + hash["has_file"] = false; + hash["filesize"] = file.Length; + hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0); + hash["filetype"] = file.Extension.Substring(1); + hash["filename"] = file.Name; + hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); + dirFileList.Add(hash); + } + context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); + context.Response.Write(JsonMapper.ToJson(result)); + context.Response.End(); + } + + public class NameSorter : IComparer + { + public int Compare(object x, object y) + { + if (x == null && y == null) + { + return 0; + } + if (x == null) + { + return -1; + } + if (y == null) + { + return 1; + } + FileInfo xInfo = new FileInfo(x.ToString()); + FileInfo yInfo = new FileInfo(y.ToString()); + + return xInfo.FullName.CompareTo(yInfo.FullName); + } + } + + public class SizeSorter : IComparer + { + public int Compare(object x, object y) + { + if (x == null && y == null) + { + return 0; + } + if (x == null) + { + return -1; + } + if (y == null) + { + return 1; + } + FileInfo xInfo = new FileInfo(x.ToString()); + FileInfo yInfo = new FileInfo(y.ToString()); + + return xInfo.Length.CompareTo(yInfo.Length); + } + } + + public class TypeSorter : IComparer + { + public int Compare(object x, object y) + { + if (x == null && y == null) + { + return 0; + } + if (x == null) + { + return -1; + } + if (y == null) + { + return 1; + } + FileInfo xInfo = new FileInfo(x.ToString()); + FileInfo yInfo = new FileInfo(y.ToString()); + + return xInfo.Extension.CompareTo(yInfo.Extension); + } + } + + public bool IsReusable + { + get + { + return true; + } + } +} diff --git a/public/kindeditor/asp.net/upload_json.ashx b/public/kindeditor/asp.net/upload_json.ashx new file mode 100644 index 0000000..4382dc9 --- /dev/null +++ b/public/kindeditor/asp.net/upload_json.ashx @@ -0,0 +1,121 @@ +<%@ webhandler Language="C#" class="Upload" %> + +/** + * KindEditor ASP.NET + * + * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。 + * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + * + */ + +using System; +using System.Collections; +using System.Web; +using System.IO; +using System.Globalization; +using LitJson; + +public class Upload : IHttpHandler +{ + private HttpContext context; + + public void ProcessRequest(HttpContext context) + { + String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); + + //文件保存目录路径 + String savePath = "/public/upload/attached/"; + + //文件保存目录URL + String saveUrl = aspxUrl + "/public/upload/attached/"; + + //定义允许上传的文件扩展名 + Hashtable extTable = new Hashtable(); + extTable.Add("image", "gif,jpg,jpeg,png,bmp"); + extTable.Add("flash", "swf,flv"); + extTable.Add("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb"); + extTable.Add("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); + + //最大文件大小 + int maxSize = 1000000; + this.context = context; + + HttpPostedFile imgFile = context.Request.Files["imgFile"]; + if (imgFile == null) + { + showError("请选择文件。"); + } + + String dirPath = context.Server.MapPath(savePath); + if (!Directory.Exists(dirPath)) + { + showError("上传目录不存在。"); + } + + String dirName = context.Request.QueryString["dir"]; + if (String.IsNullOrEmpty(dirName)) { + dirName = "image"; + } + if (!extTable.ContainsKey(dirName)) { + showError("目录名不正确。"); + } + + String fileName = imgFile.FileName; + String fileExt = Path.GetExtension(fileName).ToLower(); + + if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize) + { + showError("上传文件大小超过限制。"); + } + + if (String.IsNullOrEmpty(fileExt) || Array.IndexOf(((String)extTable[dirName]).Split(','), fileExt.Substring(1).ToLower()) == -1) + { + showError("上传文件扩展名是不允许的扩展名。\n只允许" + ((String)extTable[dirName]) + "格式。"); + } + + //创建文件夹 + dirPath += dirName + "/"; + saveUrl += dirName + "/"; + if (!Directory.Exists(dirPath)) { + Directory.CreateDirectory(dirPath); + } + String ymd = DateTime.Now.ToString("yyyyMMdd", DateTimeFormatInfo.InvariantInfo); + dirPath += ymd + "/"; + saveUrl += ymd + "/"; + if (!Directory.Exists(dirPath)) { + Directory.CreateDirectory(dirPath); + } + + String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt; + String filePath = dirPath + newFileName; + + imgFile.SaveAs(filePath); + + String fileUrl = saveUrl + newFileName; + + Hashtable hash = new Hashtable(); + hash["error"] = 0; + hash["url"] = fileUrl; + context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); + context.Response.Write(JsonMapper.ToJson(hash)); + context.Response.End(); + } + + private void showError(string message) + { + Hashtable hash = new Hashtable(); + hash["error"] = 1; + hash["message"] = message; + context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); + context.Response.Write(JsonMapper.ToJson(hash)); + context.Response.End(); + } + + public bool IsReusable + { + get + { + return true; + } + } +} diff --git a/public/kindeditor/asp/JSON_2.0.4.asp b/public/kindeditor/asp/JSON_2.0.4.asp new file mode 100644 index 0000000..ae1b383 --- /dev/null +++ b/public/kindeditor/asp/JSON_2.0.4.asp @@ -0,0 +1,210 @@ +<% +' +' VBS JSON 2.0.3 +' Copyright (c) 2009 Turul Topuz +' Under the MIT (MIT-LICENSE.txt) license. +' + +Const JSON_OBJECT = 0 +Const JSON_ARRAY = 1 + +Class jsCore + Public Collection + Public Count + Public QuotedVars + Public Kind ' 0 = object, 1 = array + + Private Sub Class_Initialize + Set Collection = CreateObject("Scripting.Dictionary") + QuotedVars = True + Count = 0 + End Sub + + Private Sub Class_Terminate + Set Collection = Nothing + End Sub + + ' counter + Private Property Get Counter + Counter = Count + Count = Count + 1 + End Property + + ' - data maluplation + ' -- pair + Public Property Let Pair(p, v) + If IsNull(p) Then p = Counter + Collection(p) = v + End Property + + Public Property Set Pair(p, v) + If IsNull(p) Then p = Counter + If TypeName(v) <> "jsCore" Then + Err.Raise &hD, "class: class", "Incompatible types: '" & TypeName(v) & "'" + End If + Set Collection(p) = v + End Property + + Public Default Property Get Pair(p) + If IsNull(p) Then p = Count - 1 + If IsObject(Collection(p)) Then + Set Pair = Collection(p) + Else + Pair = Collection(p) + End If + End Property + ' -- pair + Public Sub Clean + Collection.RemoveAll + End Sub + + Public Sub Remove(vProp) + Collection.Remove vProp + End Sub + ' data maluplation + + ' encoding + Function jsEncode(str) + Dim charmap(127), haystack() + charmap(8) = "\b" + charmap(9) = "\t" + charmap(10) = "\n" + charmap(12) = "\f" + charmap(13) = "\r" + charmap(34) = "\""" + charmap(47) = "\/" + charmap(92) = "\\" + + Dim strlen : strlen = Len(str) - 1 + ReDim haystack(strlen) + + Dim i, charcode + For i = 0 To strlen + haystack(i) = Mid(str, i + 1, 1) + + charcode = AscW(haystack(i)) And 65535 + If charcode < 127 Then + If Not IsEmpty(charmap(charcode)) Then + haystack(i) = charmap(charcode) + ElseIf charcode < 32 Then + haystack(i) = "\u" & Right("000" & Hex(charcode), 4) + End If + Else + haystack(i) = "\u" & Right("000" & Hex(charcode), 4) + End If + Next + + jsEncode = Join(haystack, "") + End Function + + ' converting + Public Function toJSON(vPair) + Select Case VarType(vPair) + Case 0 ' Empty + toJSON = "null" + Case 1 ' Null + toJSON = "null" + Case 7 ' Date + ' toJSON = "new Date(" & (vPair - CDate(25569)) * 86400000 & ")" ' let in only utc time + toJSON = """" & CStr(vPair) & """" + Case 8 ' String + toJSON = """" & jsEncode(vPair) & """" + Case 9 ' Object + Dim bFI,i + bFI = True + If vPair.Kind Then toJSON = toJSON & "[" Else toJSON = toJSON & "{" + For Each i In vPair.Collection + If bFI Then bFI = False Else toJSON = toJSON & "," + + If vPair.Kind Then + toJSON = toJSON & toJSON(vPair(i)) + Else + If QuotedVars Then + toJSON = toJSON & """" & i & """:" & toJSON(vPair(i)) + Else + toJSON = toJSON & i & ":" & toJSON(vPair(i)) + End If + End If + Next + If vPair.Kind Then toJSON = toJSON & "]" Else toJSON = toJSON & "}" + Case 11 + If vPair Then toJSON = "true" Else toJSON = "false" + Case 12, 8192, 8204 + toJSON = RenderArray(vPair, 1, "") + Case Else + toJSON = Replace(vPair, ",", ".") + End select + End Function + + Function RenderArray(arr, depth, parent) + Dim first : first = LBound(arr, depth) + Dim last : last = UBound(arr, depth) + + Dim index, rendered + Dim limiter : limiter = "," + + RenderArray = "[" + For index = first To last + If index = last Then + limiter = "" + End If + + On Error Resume Next + rendered = RenderArray(arr, depth + 1, parent & index & "," ) + + If Err = 9 Then + On Error GoTo 0 + RenderArray = RenderArray & toJSON(Eval("arr(" & parent & index & ")")) & limiter + Else + RenderArray = RenderArray & rendered & "" & limiter + End If + Next + RenderArray = RenderArray & "]" + End Function + + Public Property Get jsString + jsString = toJSON(Me) + End Property + + Sub Flush + If TypeName(Response) <> "Empty" Then + Response.Write(jsString) + ElseIf WScript <> Empty Then + WScript.Echo(jsString) + End If + End Sub + + Public Function Clone + Set Clone = ColClone(Me) + End Function + + Private Function ColClone(core) + Dim jsc, i + Set jsc = new jsCore + jsc.Kind = core.Kind + For Each i In core.Collection + If IsObject(core(i)) Then + Set jsc(i) = ColClone(core(i)) + Else + jsc(i) = core(i) + End If + Next + Set ColClone = jsc + End Function + +End Class + +Function jsObject + Set jsObject = new jsCore + jsObject.Kind = JSON_OBJECT +End Function + +Function jsArray + Set jsArray = new jsCore + jsArray.Kind = JSON_ARRAY +End Function + +Function toJSON(val) + toJSON = (new jsCore).toJSON(val) +End Function +%> \ No newline at end of file diff --git a/public/kindeditor/asp/UpLoad_Class.asp b/public/kindeditor/asp/UpLoad_Class.asp new file mode 100644 index 0000000..476f6f9 --- /dev/null +++ b/public/kindeditor/asp/UpLoad_Class.asp @@ -0,0 +1,561 @@ +<% +'========================================================= + '类名: AnUpLoad(艾恩无组件上传类) + '作者: Anlige + '版本: 艾恩ASP无组件上传类V11.03.25 + '开发日期: 2008-4-12 + '修改日期: 2011-03025 + '主页: http://dev.mo.cn + 'Email: zhanghuiguoanlige@126.com + 'QQ: 1034555083 +'========================================================= +Dim StreamT +Class AnUpLoad + Private Form, Fils + Private vCharSet, vMaxSize, vSingleSize, vErr, vVersion, vTotalSize, vExe, pID, vOP, vErrExe,vboundary, vLostTime, vMode, vFileCount + + '============================== + '设置和读取属性开始 + '============================== + Public Property Let Mode(ByVal value) + vMode = value + End Property + + Public Property Let MaxSize(ByVal value) + vMaxSize = value + End Property + + Public Property Let SingleSize(ByVal value) + vSingleSize = value + End Property + + Public Property Let Exe(ByVal value) + vExe = LCase(value) + End Property + + Public Property Let CharSet(ByVal value) + vCharSet = value + End Property + + Public Property Get ErrorID() + ErrorID = vErr + End Property + + Public Property Get FileCount() + FileCount = Fils.count + End Property + + Public Property Get Description() + Description = GetErr(vErr) + End Property + + Public Property Get Version() + Version = vVersion + End Property + + Public Property Get TotalSize() + TotalSize = vTotalSize + End Property + + Public Property Get ProcessID() + ProcessID = pID + End Property + + Public Property Let openProcesser(ByVal value) + vOP = value + End Property + + Public Property Get LostTime() + LostTime = vLostTime + End Property + '============================== + '设置和读取属性结束,初始化类 + '============================== + + Private Sub Class_Initialize() + set Form = server.createobject("Scripting.Dictionary") + set Fils = server.createobject("Scripting.Dictionary") + Set StreamT = server.CreateObject("Adodb.stream") + vVersion = "艾恩ASP无组件上传类V10.10.22" + vMaxSize = -1 + vSingleSize = -1 + vErr = -1 + vExe = "" + vTotalSize = 0 + vCharSet = "utf-8" + vOP=false + pID="AnUpload" + setApp "",0,0,"" + vMode = 0 + End Sub + + Private Sub Class_Terminate() + Dim f + Form.RemoveAll() + For each f in Fils + Fils(f).value=empty + Set Fils(f) = Nothing + Next + Fils.RemoveAll() + Set Form = Nothing + Set Fils = Nothing + StreamT.Close() + Set StreamT = Nothing + End Sub + + '============================== + '函数名:GetData + '作用:处理客户端提交来的所有数据 + '============================== + Public Sub GetData() + Dim time1 + time1 = timer() + if vOP And trim(request.querystring("processid"))<>"" then pID=request.querystring("processid") + Dim value, str, bcrlf, fpos, sSplit, slen, istart,ef + Dim TotalBytes,tempdata,BytesRead,ChunkReadSize,PartSize,DataPart,formend, formhead, startpos, endpos, formname, FileName, fileExe, valueend, NewName,localname,type_1,contentType + TotalBytes = Request.TotalBytes + ef = false + If checkEntryType = false Then ef = true : vErr = 2 + '下面3句注释掉了,因为在IIS5.0中,如果上传大小大于限制大小的文件,会出错,一直没找到解决方法。如果是在IIS5以上的版本使用,可以取消下面3句的注释 + 'If Not ef Then + 'If vMaxSize > 0 And TotalBytes > vMaxSize Then ef = true : vErr = 1 + 'End If + If ef Then Exit Sub + If vMode = 0 Then + vTotalSize = 0 + StreamT.Type = 1 + StreamT.Mode = 3 + StreamT.Open + BytesRead = 0 + ChunkReadSize = 1024 * 16 + Do While BytesRead < TotalBytes + PartSize = ChunkReadSize + If PartSize + BytesRead > TotalBytes Then PartSize = TotalBytes - BytesRead + DataPart = Request.BinaryRead(PartSize) + StreamT.Write DataPart + BytesRead = BytesRead + PartSize + setApp "uploading",TotalBytes,BytesRead,"" + Loop + setApp "uploaded",TotalBytes,BytesRead,"" + StreamT.Position = 0 + tempdata = StreamT.Read + Else + tempdata = Request.BinaryRead(TotalBytes) + End If + bcrlf = ChrB(13) & ChrB(10) + fpos = InStrB(1, tempdata, bcrlf) + sSplit = MidB(tempdata, 1, fpos - 1) + slen = LenB(sSplit) + istart = slen + 2 + Do + formend = InStrB(istart, tempdata, bcrlf & bcrlf) + formhead = MidB(tempdata, istart, formend - istart) + str = Bytes2Str(formhead) + startpos = InStr(str, "name=""") + 6 + endpos = InStr(startpos, str, """") + formname = LCase(Mid(str, startpos, endpos - startpos)) + valueend = InStrB(formend + 3, tempdata, sSplit) + If InStr(str, "filename=""") > 0 Then + startpos = InStr(str, "filename=""") + 10 + endpos = InStr(startpos, str, """") + type_1=instr(endpos,lcase(str),"content-type") + contentType=trim(mid(str,type_1+13)) + FileName = Mid(str, startpos, endpos - startpos) + If Trim(FileName) <> "" Then + LocalName = FileName + FileName = Replace(FileName, "/", "\") + FileName = Mid(FileName, InStrRev(FileName, "\") + 1) + If instr(FileName,".")>0 Then + fileExe = Split(FileName, ".")(UBound(Split(FileName, "."))) + else + fileExe = "" + End If + If vExe <> "" Then '判断扩展名 + If checkExe(fileExe) = True Then + vErr = 3 + vErrExe = fileExe + tempdata = empty + Exit Sub + End If + End If + NewName = Getname() + NewName = NewName & "." & fileExe + vTotalSize = vTotalSize + valueend - formend - 6 + If vSingleSize > 0 And (valueend - formend - 6) > vSingleSize Then '判断上传单个文件大小 + vErr = 5 + tempdata = empty + Exit Sub + End If + If vMaxSize > 0 And vTotalSize > vMaxSize Then '判断上传数据总大小 + vErr = 1 + tempdata = empty + Exit Sub + End If + If Fils.Exists(formname) Then + vErr = 4 + tempdata = empty + Exit Sub + Else + Dim fileCls:set fileCls= new UploadFileEx + fileCls.ContentType=contentType + fileCls.Size = (valueend - formend - 6) + fileCls.Position = (formend + 3) + fileCls.FormName = formname + fileCls.NewName = NewName + fileCls.FileName = FileName + fileCls.LocalName = FileName + fileCls.extend=split(NewName,".")(ubound(split(NewName,"."))) + Fils.Add formname, fileCls + Set fileCls = Nothing + End If + End If + Else + value = MidB(tempdata, formend + 4, valueend - formend - 6) + If Form.Exists(formname) Then + Form(formname) = Form(formname) & "," & Bytes2Str(value) + Else + Form.Add formname, Bytes2Str(value) + End If + End If + istart = valueend + 2 + slen + Loop Until (istart + 2) >= LenB(tempdata) + vErr = 0 + tempdata = empty + vLostTime = FormatNumber((timer-time1)*1000,2) + End Sub + + Public sub setApp(stp,total,current,desc) + Application.lock() + Application(pID)="{ID:""" & pID & """,step:""" & stp & """,total:" & total & ",now:" & current & ",description:""" & desc & """,dt:""" & now() & """}" + Application.unlock() + end sub + '============================== + '判断扩展名 + '============================== + Private Function checkExe(ByVal ex) + Dim notIn: notIn = True + If vExe="*" then + notIn=false + elseIf InStr(1, vExe, "|") > 0 Then + Dim tempExe: tempExe = Split(vExe, "|") + Dim I: I = 0 + For I = 0 To UBound(tempExe) + If LCase(ex) = tempExe(I) Then + notIn = False + Exit For + End If + Next + Else + If vExe = LCase(ex) Then + notIn = False + End If + End If + checkExe = notIn + End Function + + '============================== + '把数字转换为文件大小显示方式 + '============================== + Public Function GetSize(ByVal Size) + If Size < 1024 Then + GetSize = FormatNumber(Size, 2) & "B" + ElseIf Size >= 1024 And Size < 1048576 Then + GetSize = FormatNumber(Size / 1024, 2) & "KB" + ElseIf Size >= 1048576 Then + GetSize = FormatNumber((Size / 1024) / 1024, 2) & "MB" + End If + End Function + + '============================== + '二进制数据转换为字符 + '============================== + Private Function Bytes2Str(ByVal byt) + If LenB(byt) = 0 Then + Bytes2Str = "" + Exit Function + End If + Dim mystream, bstr + Set mystream =server.createobject("ADODB.Stream") + mystream.Type = 2 + mystream.Mode = 3 + mystream.Open + mystream.WriteText byt + mystream.Position = 0 + mystream.CharSet = vCharSet + mystream.Position = 2 + bstr = mystream.ReadText() + mystream.Close + Set mystream = Nothing + Bytes2Str = bstr + End Function + + '============================== + '获取错误描述 + '============================== + Private Function GetErr(ByVal Num) + Select Case Num + Case 0 + GetErr = "数据处理完毕!" + Case 1 + GetErr = "上传数据超过" & GetSize(vMaxSize) & "限制!可设置MaxSize属性来改变限制!" + Case 2 + GetErr = "未设置上传表单enctype属性为multipart/form-data或者未设置method属性为Post,上传无效!" + Case 3 + GetErr = "含有非法扩展名(" & vErrExe & ")文件!只能上传扩展名为" & Replace(vExe, "|", ",") & "的文件" + Case 4 + GetErr = "对不起,程序不允许使用相同name属性的文件域!" + Case 5 + GetErr = "单个文件大小超出" & GetSize(vSingleSize) & "的上传限制!" + End Select + End Function + + '============================== + '根据日期生成随机文件名 + '============================== + Private Function Getname() + Dim y, m, d, h, mm, S, r + Randomize + y = Year(Now) + m = right("0" & Month(Now),2) + d = right("0" & Day(Now),2) + h = right("0" & Hour(Now),2) + mm =right("0" & Minute(Now),2) + S = right("0" & Second(Now),2) + r = 0 + r = CInt(Rnd() * 10000) + S = right("0000" & r,4) + Getname = y & m & d & h & mm & S & r + End Function + + '============================== + '检测上传类型是否为multipart/form-data + '============================== + Private Function checkEntryType() + Dim ContentType, ctArray, bArray,RequestMethod + RequestMethod=trim(LCase(Request.ServerVariables("REQUEST_METHOD"))) + if RequestMethod="" or RequestMethod<>"post" then + checkEntryType = False + exit function + end if + ContentType = LCase(Request.ServerVariables("HTTP_CONTENT_TYPE")) + ctArray = Split(ContentType, ";") + if ubound(ctarray)>=0 then + If Trim(ctArray(0)) = "multipart/form-data" Then + checkEntryType = True + vboundary = Split(ContentType,"boundary=")(1) + Else + checkEntryType = False + End If + else + checkEntryType = False + end if + End Function + + '============================== + '获取上传表单值,参数可选,如果为-1则返回一个包含所有表单项的一个dictionary对象 + '============================== + Public Function Forms(ByVal formname) + If trim(formname) = "-1" Then + Set Forms = Form + Else + If Form.Exists(LCase(formname)) Then + Forms = Form(LCase(formname)) + Else + Forms = "" + End If + End If + End Function + + '============================== + '获取上传的文件类,参数可选,如果为-1则返回一个包含所有上传文件类的一个dictionary对象 + '============================== + Public Function Files(ByVal formname) + If trim(formname) = "-1" Then + Set Files = Fils + Else + If Fils.Exists(LCase(formname)) Then + Set Files = Fils(LCase(formname)) + Else + Set Files = Nothing + End If + End If + End Function +End Class + +Class UploadFileEx + Private mvarFormName , mvarNewName , mvarLocalName , mvarFileName , mvarUserSetName , mvarContentType ,mException,mvarPosition + Private mvarSize , mvarValue , mvarPath , mvarExtend ,mvarWidth, mvarHeight + + Public Property Let Extend(ByVal vData ) + mvarExtend = vData + End Property + Public Property Get Extend() + Extend = mvarExtend + End Property + + Public Property Get Width() + Width = mvarWidth + End Property + + Public Property Get Height() + Height = mvarHeight + End Property + + + Public Property Let Path(ByVal vData ) + mvarPath = vData + End Property + Public Property Get Path() + Path = mvarPath + End Property + + Public Property Get Exception() + Exception = mException + End Property + + Public Property Let Value(ByVal vData ) + mvarValue = vData + End Property + + Public Property Get Value() + Value = mvarValue + End Property + + Public Property Let Size(ByVal vData ) + mvarSize = vData + End Property + Public Property Get Size() + Size = mvarSize + End Property + + Public Property Let Position(ByVal vData ) + mvarPosition = vData + End Property + Public Property Get Position() + Size = mvarPosition + End Property + + Public Property Let ContentType(ByVal vData ) + mvarContentType = vData + End Property + Public Property Get ContentType() + ContentType = mvarContentType + End Property + + Public Property Let UserSetName(ByVal vData ) + mvarUserSetName = vData + End Property + Public Property Get UserSetName() + UserSetName = mvarUserSetName + End Property + + Public Property Let FileName(ByVal vData ) + mvarFileName = vData + End Property + Public Property Get FileName() + FileName = mvarFileName + End Property + + Public Property Let LocalName(ByVal vData ) + mvarLocalName = vData + End Property + Public Property Get LocalName() + LocalName = mvarLocalName + End Property + + Public Property Let NewName(ByVal vData ) + mvarNewName = vData + End Property + Public Property Get NewName() + NewName = mvarNewName + End Property + + Public Property Let FormName(ByVal vData ) + mvarFormName = vData + End Property + Public Property Get FormName() + FormName = mvarFormName + End Property + + Private Sub Class_Initialize() + mvarSize =0 + mvarWidth = 0 + mvarHeight = 0 + End Sub + + Public Function SaveToFile(ByVal Path , byval tOption, byval OverWrite) + On Error Resume Next + Dim IsP + IsP = (InStr(Path, ":") = 2) + If Not IsP Then Path = Server.MapPath(Path) + Path = Replace(Path, "/", "\") + If Mid(Path, Len(Path) - 1) <> "\" Then Path = Path + "\" + CreateFolder Path + mvarPath = Path + If tOption = 1 Then + Path = Path & mvarLocalName: mvarFileName = mvarLocalName + Else + If tOption = -1 And mvarUserSetName <> "" Then + Path = Path & mvarUserSetName & "." & mvarExtend: mvarFileName = mvarUserSetName & "." & mvarExtend + Else + Path = Path & mvarNewName: mvarFileName = mvarNewName + End If + End If + If Not OverWrite Then + Path = GetFilePath() + End If + Dim tmpStrm + Set tmpStrm =server.CreateObject("ADODB.Stream") + tmpStrm.Mode = 3 + tmpStrm.Type = 1 + tmpStrm.Open + StreamT.Position = mvarPosition + StreamT.copyto tmpStrm,mvarSize + tmpStrm.SaveToFile Path, 2 + tmpStrm.Close + Set tmpStrm = Nothing + If Not Err Then + Set SaveToFile = objFromJson("{error:false}") + Else + Set SaveToFile = objFromJson("{error:true,description:'" & replace(Err.Description,"'","\'") & "'}") + mException=Err.Description + End If + End Function + + Public Function GetBytes() + StreamT.Position = mvarPosition + GetBytes = StreamT.read(mvarSize) + End Function + Private Function CreateFolder(ByVal folderPath ) + Dim oFSO + Set oFSO = server.CreateObject("Scripting.FileSystemObject") + Dim sParent + sParent = oFSO.GetParentFolderName(folderPath) + If sParent = "" Then Exit Function + If Not oFSO.FolderExists(sParent) Then CreateFolder (sParent) + If Not oFSO.FolderExists(folderPath) Then oFSO.CreateFolder (folderPath) + Set oFSO = Nothing + End Function + + Private Function GetFilePath() + Dim oFSO, Fname , FNameL , i + i = 0 + Set oFSO = server.CreateObject("Scripting.FileSystemObject") + Fname = mvarPath & mvarFileName + FNameL = Mid(mvarFileName, 1, InStr(mvarFileName, ".") - 1) + Do While oFSO.FileExists(Fname) + Fname = mvarPath & FNameL & "(" & i & ")." & mvarExtend + mvarFileName = FNameL & "(" & i & ")." & mvarExtend + i = i + 1 + Loop + Set oFSO = Nothing + GetFilePath = Fname + End Function +End Class +%> + \ No newline at end of file diff --git a/public/kindeditor/asp/demo.asp b/public/kindeditor/asp/demo.asp new file mode 100644 index 0000000..1f84c4c --- /dev/null +++ b/public/kindeditor/asp/demo.asp @@ -0,0 +1,60 @@ +<%@ CODEPAGE=65001 %> +<% +Option Explicit +Response.CodePage=65001 +Response.Charset="UTF-8" + +Dim htmlData + +htmlData = Request.Form("content1") + +Function htmlspecialchars(str) + str = Replace(str, "&", "&") + str = Replace(str, "<", "<") + str = Replace(str, ">", ">") + str = Replace(str, """", """) + htmlspecialchars = str +End Function +%> + + + + + KindEditor ASP + + + + + + + + + <%=htmlData%> +
+ +
+ (提交快捷键: Ctrl + Enter) +
+ + diff --git a/public/kindeditor/asp/file_manager_json.asp b/public/kindeditor/asp/file_manager_json.asp new file mode 100644 index 0000000..1f1ce51 --- /dev/null +++ b/public/kindeditor/asp/file_manager_json.asp @@ -0,0 +1,228 @@ +<%@ CODEPAGE=65001 %> +<% Option Explicit %> +<% Response.CodePage=65001 %> +<% Response.Charset="UTF-8" %> + +<% + +' KindEditor ASP +' +' 本ASP程序是演示程序,建议不要直接在实际项目中使用。 +' 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 +' + +Dim aspUrl, rootPath, rootUrl, fileTypes +Dim currentPath, currentUrl, currentDirPath, moveupDirPath +Dim path, order, dirName, fso, folder, dir, file, result +Dim fileExt, dirCount, fileCount, orderIndex, i, j +Dim dirList(), fileList(), isDir, hasFile, filesize, isPhoto, filetype, filename, datetime + +aspUrl = Request.ServerVariables("SCRIPT_NAME") +aspUrl = left(aspUrl, InStrRev(aspUrl, "/")) + +'根目录路径,可以指定绝对路径,比如 /var/www/attached/ +rootPath = "../attached/" +'根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ +rootUrl = aspUrl & "../attached/" +'图片扩展名 +fileTypes = "gif,jpg,jpeg,png,bmp" + +currentPath = "" +currentUrl = "" +currentDirPath = "" +moveupDirPath = "" + +Set fso = Server.CreateObject("Scripting.FileSystemObject") + +'目录名 +dirName = Request.QueryString("dir") +If Not isEmpty(dirName) Then + If instr(lcase("image,flash,media,file"), dirName) < 1 Then + Response.Write "Invalid Directory name." + Response.End + End If + rootPath = rootPath & dirName & "/" + rootUrl = rootUrl & dirName & "/" + If Not fso.FolderExists(Server.mappath(rootPath)) Then + fso.CreateFolder(Server.mappath(rootPath)) + End If +End If + +'根据path参数,设置各路径和URL +path = Request.QueryString("path") +If path = "" Then + currentPath = Server.MapPath(rootPath) & "\" + currentUrl = rootUrl + currentDirPath = "" + moveupDirPath = "" +Else + currentPath = Server.MapPath(rootPath & path) & "\" + currentUrl = rootUrl + path + currentDirPath = path + moveupDirPath = RegexReplace(currentDirPath, "(.*?)[^\/]+\/$", "$1") +End If + +Set folder = fso.GetFolder(currentPath) + +'排序形式,name or size or type +order = lcase(Request.QueryString("order")) +Select Case order + Case "type" orderIndex = 4 + Case "size" orderIndex = 2 + Case Else orderIndex = 5 +End Select + +'不允许使用..移动到上一级目录 +If RegexIsMatch(path, "\.\.") Then + Response.Write "Access is not allowed." + Response.End +End If +'最后一个字符不是/ +If path <> "" And Not RegexIsMatch(path, "\/$") Then + Response.Write "Parameter is not allowed." + Response.End +End If +'目录不存在或不是目录 +If Not DirectoryExists(currentPath) Then + Response.Write "Directory does not exist." + Response.End +End If + +Set result = jsObject() +'相对于根目录的上一级目录 +result("moveup_dir_path") = moveupDirPath +'相对于根目录的当前目录 +result("current_dir_path") = currentDirPath +'当前目录的URL +result("current_url") = currentUrl + +'文件数 +dirCount = folder.SubFolders.count +fileCount = folder.Files.count +result("total_count") = dirCount + fileCount + +ReDim dirList(dirCount) +i = 0 +For Each dir in folder.SubFolders + isDir = True + hasFile = (dir.Files.count > 0) + filesize = 0 + isPhoto = False + filetype = "" + filename = dir.name + datetime = FormatDate(dir.DateLastModified) + dirList(i) = Array(isDir, hasFile, filesize, isPhoto, filetype, filename, datetime) + i = i + 1 +Next +ReDim fileList(fileCount) +i = 0 +For Each file in folder.Files + fileExt = lcase(mid(file.name, InStrRev(file.name, ".") + 1)) + isDir = False + hasFile = False + filesize = file.size + isPhoto = (instr(lcase(fileTypes), fileExt) > 0) + filetype = fileExt + filename = file.name + datetime = FormatDate(file.DateLastModified) + fileList(i) = Array(isDir, hasFile, filesize, isPhoto, filetype, filename, datetime) + i = i + 1 +Next + +'排序 +Dim minidx, temp +For i = 0 To dirCount - 2 + minidx = i + For j = i + 1 To dirCount - 1 + If (dirList(minidx)(5) > dirList(j)(5)) Then + minidx = j + End If + Next + If minidx <> i Then + temp = dirList(minidx) + dirList(minidx) = dirList(i) + dirList(i) = temp + End If +Next +For i = 0 To fileCount - 2 + minidx = i + For j = i + 1 To fileCount - 1 + If (fileList(minidx)(orderIndex) > fileList(j)(orderIndex)) Then + minidx = j + End If + Next + If minidx <> i Then + temp = fileList(minidx) + fileList(minidx) = fileList(i) + fileList(i) = temp + End If +Next + +Set result("file_list") = jsArray() +For i = 0 To dirCount - 1 + Set result("file_list")(Null) = jsObject() + result("file_list")(Null)("is_dir") = dirList(i)(0) + result("file_list")(Null)("has_file") = dirList(i)(1) + result("file_list")(Null)("filesize") = dirList(i)(2) + result("file_list")(Null)("is_photo") = dirList(i)(3) + result("file_list")(Null)("filetype") = dirList(i)(4) + result("file_list")(Null)("filename") = dirList(i)(5) + result("file_list")(Null)("datetime") = dirList(i)(6) +Next +For i = 0 To fileCount - 1 + Set result("file_list")(Null) = jsObject() + result("file_list")(Null)("is_dir") = fileList(i)(0) + result("file_list")(Null)("has_file") = fileList(i)(1) + result("file_list")(Null)("filesize") = fileList(i)(2) + result("file_list")(Null)("is_photo") = fileList(i)(3) + result("file_list")(Null)("filetype") = fileList(i)(4) + result("file_list")(Null)("filename") = fileList(i)(5) + result("file_list")(Null)("datetime") = fileList(i)(6) +Next + +'输出JSON字符串 +Response.AddHeader "Content-Type", "text/html; charset=UTF-8" +result.Flush +Response.End + +'自定义函数 +Function DirectoryExists(dirPath) + Dim fso + Set fso = Server.CreateObject("Scripting.FileSystemObject") + DirectoryExists = fso.FolderExists(dirPath) +End Function + +Function RegexIsMatch(subject, pattern) + Dim reg + Set reg = New RegExp + reg.Global = True + reg.MultiLine = True + reg.Pattern = pattern + RegexIsMatch = reg.Test(subject) +End Function + +Function RegexReplace(subject, pattern, replacement) + Dim reg + Set reg = New RegExp + reg.Global = True + reg.MultiLine = True + reg.Pattern = pattern + RegexReplace = reg.Replace(subject, replacement) +End Function + +Public Function FormatDate(datetime) + Dim y, m, d, h, i, s + y = CStr(Year(datetime)) + m = CStr(Month(datetime)) + If Len(m) = 1 Then m = "0" & m + d = CStr(Day(datetime)) + If Len(d) = 1 Then d = "0" & d + h = CStr(Hour(datetime)) + If Len(h) = 1 Then h = "0" & h + i = CStr(Minute(datetime)) + If Len(i) = 1 Then i = "0" & i + s = CStr(Second(datetime)) + If Len(s) = 1 Then s = "0" & s + FormatDate = y & "-" & m & "-" & d & " " & h & ":" & i & ":" & s +End Function +%> diff --git a/public/kindeditor/asp/upload_json.asp b/public/kindeditor/asp/upload_json.asp new file mode 100644 index 0000000..209f107 --- /dev/null +++ b/public/kindeditor/asp/upload_json.asp @@ -0,0 +1,119 @@ +<%@ CODEPAGE=65001 %> +<% Option Explicit %> +<% Response.CodePage=65001 %> +<% Response.Charset="UTF-8" %> + + +<% + +' KindEditor ASP +' +' 本ASP程序是演示程序,建议不要直接在实际项目中使用。 +' 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 +' + +Dim aspUrl, savePath, saveUrl, maxSize, fileName, fileExt, newFileName, filePath, fileUrl, dirName +Dim extStr, imageExtStr, flashExtStr, mediaExtStr, fileExtStr +Dim upload, file, fso, ranNum, hash, ymd, mm, dd, result + +aspUrl = Request.ServerVariables("SCRIPT_NAME") +aspUrl = left(aspUrl, InStrRev(aspUrl, "/")) + +'文件保存目录路径 +savePath = "../attached/" +'文件保存目录URL +saveUrl = aspUrl & "../attached/" +'定义允许上传的文件扩展名 +imageExtStr = "gif|jpg|jpeg|png|bmp" +flashExtStr = "swf|flv" +mediaExtStr = "swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|asf|rm|rmvb" +fileExtStr = "doc|docx|xls|xlsx|ppt|htm|html|txt|zip|rar|gz|bz2" +'最大文件大小 +maxSize = 5 * 1024 * 1024 '5M + +Set fso = Server.CreateObject("Scripting.FileSystemObject") +If Not fso.FolderExists(Server.mappath(savePath)) Then + showError("上传目录不存在。") +End If + +dirName = Request.QueryString("dir") +If isEmpty(dirName) Then + dirName = "image" +End If +If instr(lcase("image,flash,media,file"), dirName) < 1 Then + showError("目录名不正确。") +End If + +Select Case dirName + Case "flash" extStr = flashExtStr + Case "media" extStr = mediaExtStr + Case "file" extStr = fileExtStr + Case Else extStr = imageExtStr +End Select + +set upload = new AnUpLoad +upload.Exe = extStr +upload.MaxSize = maxSize +upload.GetData() +if upload.ErrorID>0 then + showError(upload.Description) +end if + +'创建文件夹 +savePath = savePath & dirName & "/" +saveUrl = saveUrl & dirName & "/" +If Not fso.FolderExists(Server.mappath(savePath)) Then + fso.CreateFolder(Server.mappath(savePath)) +End If +mm = month(now) +If mm < 10 Then + mm = "0" & mm +End If +dd = day(now) +If dd < 10 Then + dd = "0" & dd +End If +ymd = year(now) & mm & dd +savePath = savePath & ymd & "/" +saveUrl = saveUrl & ymd & "/" +If Not fso.FolderExists(Server.mappath(savePath)) Then + fso.CreateFolder(Server.mappath(savePath)) +End If + +set file = upload.files("imgFile") +if file is nothing then + showError("请选择文件。") +end if + +set result = file.saveToFile(savePath, 0, true) +if result.error then + showError(file.Exception) +end if + +filePath = Server.mappath(savePath & file.filename) +fileUrl = saveUrl & file.filename + +Set upload = nothing +Set file = nothing + +If Not fso.FileExists(filePath) Then + showError("上传文件失败。") +End If + +Response.AddHeader "Content-Type", "text/html; charset=UTF-8" +Set hash = jsObject() +hash("error") = 0 +hash("url") = fileUrl +hash.Flush +Response.End + +Function showError(message) + Response.AddHeader "Content-Type", "text/html; charset=UTF-8" + Dim hash + Set hash = jsObject() + hash("error") = 1 + hash("message") = message + hash.Flush + Response.End +End Function +%> diff --git a/public/kindeditor/jsp/README.txt b/public/kindeditor/jsp/README.txt new file mode 100644 index 0000000..f59dc08 --- /dev/null +++ b/public/kindeditor/jsp/README.txt @@ -0,0 +1,15 @@ +KindEditor JSP + +本JSP程序是演示程序,建议不要直接在实际项目中使用。 +如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + +使用方法: + +1. 解压zip文件,将所有文件复制到Tomcat的webapps/kindeditor目录下。 + +2. 将kindeditor/jsp/lib目录下的3个jar文件复制到Tomcat的lib目录下,并重新启动Tomcat。 + * commons-fileupload-1.2.1.jar + * commons-io-1.4.jar + * json_simple-1.1.jar + +3. 打开浏览器,输入http://localhost:[P0RT]/kindeditor/jsp/demo.jsp。 diff --git a/public/kindeditor/jsp/demo.jsp b/public/kindeditor/jsp/demo.jsp new file mode 100644 index 0000000..aa944f7 --- /dev/null +++ b/public/kindeditor/jsp/demo.jsp @@ -0,0 +1,56 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<% +request.setCharacterEncoding("UTF-8"); +String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : ""; +%> + + + + + KindEditor JSP + + + + + + + + + <%=htmlData%> +
+ +
+ (提交快捷键: Ctrl + Enter) +
+ + +<%! +private String htmlspecialchars(String str) { + str = str.replaceAll("&", "&"); + str = str.replaceAll("<", "<"); + str = str.replaceAll(">", ">"); + str = str.replaceAll("\"", """); + return str; +} +%> \ No newline at end of file diff --git a/public/kindeditor/jsp/file_manager_json.jsp b/public/kindeditor/jsp/file_manager_json.jsp new file mode 100644 index 0000000..808ada0 --- /dev/null +++ b/public/kindeditor/jsp/file_manager_json.jsp @@ -0,0 +1,155 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ page import="java.util.*,java.io.*" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="org.json.simple.*" %> +<% + +/** + * KindEditor JSP + * + * 本JSP程序是演示程序,建议不要直接在实际项目中使用。 + * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + * + */ + +//根目录路径,可以指定绝对路径,比如 /var/www/attached/ +String rootPath = pageContext.getServletContext().getRealPath("/") + "attached/"; +//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ +String rootUrl = request.getContextPath() + "/attached/"; +//图片扩展名 +String[] fileTypes = new String[]{"gif", "jpg", "jpeg", "png", "bmp"}; + +String dirName = request.getParameter("dir"); +if (dirName != null) { + if(!Arrays.asList(new String[]{"image", "flash", "media", "file"}).contains(dirName)){ + out.println("Invalid Directory name."); + return; + } + rootPath += dirName + "/"; + rootUrl += dirName + "/"; + File saveDirFile = new File(rootPath); + if (!saveDirFile.exists()) { + saveDirFile.mkdirs(); + } +} +//根据path参数,设置各路径和URL +String path = request.getParameter("path") != null ? request.getParameter("path") : ""; +String currentPath = rootPath + path; +String currentUrl = rootUrl + path; +String currentDirPath = path; +String moveupDirPath = ""; +if (!"".equals(path)) { + String str = currentDirPath.substring(0, currentDirPath.length() - 1); + moveupDirPath = str.lastIndexOf("/") >= 0 ? str.substring(0, str.lastIndexOf("/") + 1) : ""; +} + +//排序形式,name or size or type +String order = request.getParameter("order") != null ? request.getParameter("order").toLowerCase() : "name"; + +//不允许使用..移动到上一级目录 +if (path.indexOf("..") >= 0) { + out.println("Access is not allowed."); + return; +} +//最后一个字符不是/ +if (!"".equals(path) && !path.endsWith("/")) { + out.println("Parameter is not valid."); + return; +} +//目录不存在或不是目录 +File currentPathFile = new File(currentPath); +if(!currentPathFile.isDirectory()){ + out.println("Directory does not exist."); + return; +} + +//遍历目录取的文件信息 +List fileList = new ArrayList(); +if(currentPathFile.listFiles() != null) { + for (File file : currentPathFile.listFiles()) { + Hashtable hash = new Hashtable(); + String fileName = file.getName(); + if(file.isDirectory()) { + hash.put("is_dir", true); + hash.put("has_file", (file.listFiles() != null)); + hash.put("filesize", 0L); + hash.put("is_photo", false); + hash.put("filetype", ""); + } else if(file.isFile()){ + String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); + hash.put("is_dir", false); + hash.put("has_file", false); + hash.put("filesize", file.length()); + hash.put("is_photo", Arrays.asList(fileTypes).contains(fileExt)); + hash.put("filetype", fileExt); + } + hash.put("filename", fileName); + hash.put("datetime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file.lastModified())); + fileList.add(hash); + } +} + +if ("size".equals(order)) { + Collections.sort(fileList, new SizeComparator()); +} else if ("type".equals(order)) { + Collections.sort(fileList, new TypeComparator()); +} else { + Collections.sort(fileList, new NameComparator()); +} +JSONObject result = new JSONObject(); +result.put("moveup_dir_path", moveupDirPath); +result.put("current_dir_path", currentDirPath); +result.put("current_url", currentUrl); +result.put("total_count", fileList.size()); +result.put("file_list", fileList); + +response.setContentType("application/json; charset=UTF-8"); +out.println(result.toJSONString()); +%> +<%! +public class NameComparator implements Comparator { + public int compare(Object a, Object b) { + Hashtable hashA = (Hashtable)a; + Hashtable hashB = (Hashtable)b; + if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) { + return -1; + } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) { + return 1; + } else { + return ((String)hashA.get("filename")).compareTo((String)hashB.get("filename")); + } + } +} +public class SizeComparator implements Comparator { + public int compare(Object a, Object b) { + Hashtable hashA = (Hashtable)a; + Hashtable hashB = (Hashtable)b; + if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) { + return -1; + } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) { + return 1; + } else { + if (((Long)hashA.get("filesize")) > ((Long)hashB.get("filesize"))) { + return 1; + } else if (((Long)hashA.get("filesize")) < ((Long)hashB.get("filesize"))) { + return -1; + } else { + return 0; + } + } + } +} +public class TypeComparator implements Comparator { + public int compare(Object a, Object b) { + Hashtable hashA = (Hashtable)a; + Hashtable hashB = (Hashtable)b; + if (((Boolean)hashA.get("is_dir")) && !((Boolean)hashB.get("is_dir"))) { + return -1; + } else if (!((Boolean)hashA.get("is_dir")) && ((Boolean)hashB.get("is_dir"))) { + return 1; + } else { + return ((String)hashA.get("filetype")).compareTo((String)hashB.get("filetype")); + } + } +} +%> \ No newline at end of file diff --git a/public/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar b/public/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar new file mode 100644 index 0000000..aa209b3 Binary files /dev/null and b/public/kindeditor/jsp/lib/commons-fileupload-1.2.1.jar differ diff --git a/public/kindeditor/jsp/lib/commons-io-1.4.jar b/public/kindeditor/jsp/lib/commons-io-1.4.jar new file mode 100644 index 0000000..133dc6c Binary files /dev/null and b/public/kindeditor/jsp/lib/commons-io-1.4.jar differ diff --git a/public/kindeditor/jsp/lib/json_simple-1.1.jar b/public/kindeditor/jsp/lib/json_simple-1.1.jar new file mode 100644 index 0000000..f395f41 Binary files /dev/null and b/public/kindeditor/jsp/lib/json_simple-1.1.jar differ diff --git a/public/kindeditor/jsp/upload_json.jsp b/public/kindeditor/jsp/upload_json.jsp new file mode 100644 index 0000000..559e6cd --- /dev/null +++ b/public/kindeditor/jsp/upload_json.jsp @@ -0,0 +1,122 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ page import="java.util.*,java.io.*" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="org.apache.commons.fileupload.*" %> +<%@ page import="org.apache.commons.fileupload.disk.*" %> +<%@ page import="org.apache.commons.fileupload.servlet.*" %> +<%@ page import="org.json.simple.*" %> +<% + +/** + * KindEditor JSP + * + * 本JSP程序是演示程序,建议不要直接在实际项目中使用。 + * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 + * + */ + +//文件保存目录路径 +String savePath = pageContext.getServletContext().getRealPath("/") + "attached/"; + +//文件保存目录URL +String saveUrl = request.getContextPath() + "/attached/"; + +//定义允许上传的文件扩展名 +HashMap extMap = new HashMap(); +extMap.put("image", "gif,jpg,jpeg,png,bmp"); +extMap.put("flash", "swf,flv"); +extMap.put("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb"); +extMap.put("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); + +//最大文件大小 +long maxSize = 1000000; + +response.setContentType("text/html; charset=UTF-8"); + +if(!ServletFileUpload.isMultipartContent(request)){ + out.println(getError("请选择文件。")); + return; +} +//检查目录 +File uploadDir = new File(savePath); +if(!uploadDir.isDirectory()){ + out.println(getError("上传目录不存在。")); + return; +} +//检查目录写权限 +if(!uploadDir.canWrite()){ + out.println(getError("上传目录没有写权限。")); + return; +} + +String dirName = request.getParameter("dir"); +if (dirName == null) { + dirName = "image"; +} +if(!extMap.containsKey(dirName)){ + out.println(getError("目录名不正确。")); + return; +} +//创建文件夹 +savePath += dirName + "/"; +saveUrl += dirName + "/"; +File saveDirFile = new File(savePath); +if (!saveDirFile.exists()) { + saveDirFile.mkdirs(); +} +SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); +String ymd = sdf.format(new Date()); +savePath += ymd + "/"; +saveUrl += ymd + "/"; +File dirFile = new File(savePath); +if (!dirFile.exists()) { + dirFile.mkdirs(); +} + +FileItemFactory factory = new DiskFileItemFactory(); +ServletFileUpload upload = new ServletFileUpload(factory); +upload.setHeaderEncoding("UTF-8"); +List items = upload.parseRequest(request); +Iterator itr = items.iterator(); +while (itr.hasNext()) { + FileItem item = (FileItem) itr.next(); + String fileName = item.getName(); + long fileSize = item.getSize(); + if (!item.isFormField()) { + //检查文件大小 + if(item.getSize() > maxSize){ + out.println(getError("上传文件大小超过限制。")); + return; + } + //检查扩展名 + String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); + if(!Arrays.asList(extMap.get(dirName).split(",")).contains(fileExt)){ + out.println(getError("上传文件扩展名是不允许的扩展名。\n只允许" + extMap.get(dirName) + "格式。")); + return; + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); + String newFileName = df.format(new Date()) + "_" + new Random().nextInt(1000) + "." + fileExt; + try{ + File uploadedFile = new File(savePath, newFileName); + item.write(uploadedFile); + }catch(Exception e){ + out.println(getError("上传文件失败。")); + return; + } + + JSONObject obj = new JSONObject(); + obj.put("error", 0); + obj.put("url", saveUrl + newFileName); + out.println(obj.toJSONString()); + } +} +%> +<%! +private String getError(String message) { + JSONObject obj = new JSONObject(); + obj.put("error", 1); + obj.put("message", message); + return obj.toJSONString(); +} +%> \ No newline at end of file diff --git a/public/kindeditor/kindeditor-all-min.js b/public/kindeditor/kindeditor-all-min.js new file mode 100644 index 0000000..9d4aacb --- /dev/null +++ b/public/kindeditor/kindeditor-all-min.js @@ -0,0 +1,7 @@ +/* KindEditor 4.1.11 (2016-03-31), Copyright (C) kindsoft.net, Licence: http://kindeditor.net/license.php */ +!function(window,undefined){function _isArray(a){return a?"[object Array]"===Object.prototype.toString.call(a):!1}function _isFunction(a){return a?"[object Function]"===Object.prototype.toString.call(a):!1}function _inArray(a,b){for(var c=0,d=b.length;d>c;c++)if(a===b[c])return c;return-1}function _each(a,b){if(_isArray(a))for(var c=0,d=a.length;d>c&&b.call(a[c],c,a[c])!==!1;c++);else for(var e in a)if(a.hasOwnProperty(e)&&b.call(a[e],e,a[e])===!1)break}function _trim(a){return a.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,"")}function _inString(a,b,c){return c=c===undefined?",":c,(c+b+c).indexOf(c+a+c)>=0}function _addUnit(a,b){return b=b||"px",a&&/^-?\d+(?:\.\d+)?$/.test(a)?a+b:a}function _removeUnit(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function _escape(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _unescape(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function _toCamel(a){var b=a.split("-");return a="",_each(b,function(b,c){a+=b>0?c.charAt(0).toUpperCase()+c.substr(1):c}),a}function _toHex(a){function b(a){var b=parseInt(a,10).toString(16).toUpperCase();return b.length>1?b:"0"+b}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi,function(a,c,d,e){return"#"+b(c)+b(d)+b(e)})}function _toMap(a,b){b=b===undefined?",":b;var c,d={},e=_isArray(a)?a:a.split(b);return _each(e,function(a,b){if(c=/^(\d+)\.\.(\d+)$/.exec(b))for(var e=parseInt(c[1],10);e<=parseInt(c[2],10);e++)d[e.toString()]=!0;else d[b]=!0}),d}function _toArray(a,b){return Array.prototype.slice.call(a,b||0)}function _undef(a,b){return a===undefined?b:a}function _invalidUrl(a){return!a||/[<>"]/.test(a)}function _addParam(a,b){return a.indexOf("?")>=0?a+"&"+b:a+"?"+b}function _extend(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype,d=new e,_each(c,function(a,b){d[a]=b})}else d=c;d.constructor=a,a.prototype=d,a.parent=b?b.prototype:null}function _json(text){var match;(match=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))&&(text=match[0]);var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+text+")");throw"JSON parse error"}function _getBasePath(){for(var a,b=document.getElementsByTagName("script"),c=0,d=b.length;d>c;c++)if(a=b[c].src||"",/kindeditor[\w\-\.]*\.js/.test(a))return a.substring(0,a.lastIndexOf("/")+1);return""}function _bindEvent(a,b,c){a.addEventListener?a.addEventListener(b,c,_useCapture):a.attachEvent&&a.attachEvent("on"+b,c)}function _unbindEvent(a,b,c){a.removeEventListener?a.removeEventListener(b,c,_useCapture):a.detachEvent&&a.detachEvent("on"+b,c)}function KEvent(a,b){this.init(a,b)}function _getId(a){return a[_eventExpendo]||null}function _setId(a){return a[_eventExpendo]=++_eventId,_eventId}function _removeId(a){try{delete a[_eventExpendo]}catch(b){a.removeAttribute&&a.removeAttribute(_eventExpendo)}}function _bind(a,b,c){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_bind(a,this,c)});var d=_getId(a);d||(d=_setId(a)),_eventData[d]===undefined&&(_eventData[d]={});var e=_eventData[d][b];e&&e.length>0?_unbindEvent(a,b,e[0]):(_eventData[d][b]=[],_eventData[d].el=a),e=_eventData[d][b],0===e.length&&(e[0]=function(b){var c=b?new KEvent(a,b):undefined;_each(e,function(b,d){b>0&&d&&d.call(a,c)})}),_inArray(c,e)<0&&e.push(c),_bindEvent(a,b,e[0])}function _unbind(a,b,c){if(b&&b.indexOf(",")>=0)return void _each(b.split(","),function(){_unbind(a,this,c)});var d=_getId(a);if(d){if(b===undefined)return void(d in _eventData&&(_each(_eventData[d],function(b,c){"el"!=b&&c.length>0&&_unbindEvent(a,b,c[0])}),delete _eventData[d],_removeId(a)));if(_eventData[d]){var e=_eventData[d][b];if(e&&e.length>0){c===undefined?(_unbindEvent(a,b,e[0]),delete _eventData[d][b]):(_each(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),1==e.length&&(_unbindEvent(a,b,e[0]),delete _eventData[d][b]));var f=0;_each(_eventData[d],function(){f++}),2>f&&(delete _eventData[d],_removeId(a))}}}}function _fire(a,b){if(b.indexOf(",")>=0)return void _each(b.split(","),function(){_fire(a,this)});var c=_getId(a);if(c){var d=_eventData[c][b];_eventData[c]&&d&&d.length>0&&d[0]()}}function _ctrl(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0),_bind(a,"keydown",function(d){!d.ctrlKey||d.which!=b||d.shiftKey||d.altKey||(c.call(a),d.stop())})}function _ready(a){function b(){e||(e=!0,a(KindEditor),_readyFinished=!0)}function c(){if(!e){try{document.documentElement.doScroll("left")}catch(a){return void setTimeout(c,100)}b()}}function d(){"complete"===document.readyState&&b()}if(_readyFinished)return void a(KindEditor);var e=!1;if(document.addEventListener)_bind(document,"DOMContentLoaded",b);else if(document.attachEvent){_bind(document,"readystatechange",d);var f=!1;try{f=null==window.frameElement}catch(g){}document.documentElement.doScroll&&f&&c()}_bind(window,"load",b)}function _getCssList(a){for(var b,c={},d=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g;b=d.exec(a);){var e=_trim(b[1].toLowerCase()),f=_trim(_toHex(b[2]));c[e]=f}return c}function _getAttrList(a){for(var b,c={},d=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;b=d.exec(a);){var e=(b[1]||b[2]||b[4]||b[6]).toLowerCase(),f=(b[2]?b[3]:b[4]?b[5]:b[7])||"";c[e]=f}return c}function _addClassToTag(a,b){return a=/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,c,d,e){return(" "+d+" ").indexOf(" "+b+" ")<0?""===d?c+b+e:c+d+" "+b+e:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function _formatCss(a){var b="";return _each(_getCssList(a),function(a,c){b+=a+":"+c+";"}),b}function _formatUrl(a,b,c,d){function e(a){for(var b=a.split("/"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];".."==f?c.length>0&&c.pop():""!==f&&"."!=f&&c.push(f)}return"/"+c.join("/")}function f(b,c){if(a.substr(0,b.length)===b){for(var e=[],g=0;c>g;g++)e.push("..");var i=".";return e.length>0&&(i+="/"+e.join("/")),"/"==d&&(i+="/"),i+a.substr(b.length)}return(h=/^(.*)\//.exec(b))?f(h[1],++c):void 0}if(b=_undef(b,"").toLowerCase(),"data:"!=a.substr(0,5)&&(a=a.replace(/([^:])\/\//g,"$1/")),_inArray(b,["absolute","relative","domain"])<0)return a;if(c=c||location.protocol+"//"+location.host,d===undefined){var g=location.pathname.match(/^(\/.*)\//);d=g?g[1]:""}var h;if(h=/^(\w+:\/\/[^\/]*)/.exec(a)){if(h[1]!==c)return a}else if(/^\w+:/.test(a))return a;return/^\//.test(a)?a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a)),"relative"===b?a=f(c+d,0).substr(2):"absolute"===b&&a.substr(0,c.length)===c&&(a=a.substr(c.length)),a}function _formatHtml(a,b,c,d,e){null==a&&(a=""),c=c||"",d=_undef(d,!1),e=_undef(e," ");var f="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/gi,"\n")+d}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/gi,"

"),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/gi,"$1
$2"),a=a.replace(/\u200B/g,""),a=a.replace(/\u00A9/g,"©"),a=a.replace(/\u00AE/g,"®"),a=a.replace(/\u2003/g," "),a=a.replace(/\u3000/g," "),a=a.replace(/<[^>]+/g,function(a){return a.replace(/\s+/g," ")});var g={};b&&(_each(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;e>d;d++)g[c[d]]=_toMap(b)}),g.script||(a=a.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/gi,"")),g.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var h=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,i=[];return a=a.replace(h,function(a,h,j,k,l,m,n){var o=a,p=h||"",q=j||"",r=k.toLowerCase(),s=l||"",t=m?" "+m:"",u=n||"";if(b&&!g[r])return"";if(""===t&&_SINGLE_TAG_MAP[r]&&(t=" /"),_INLINE_TAG_MAP[r]&&(p&&(p=" "),u&&(u=" ")),_PRE_TAG_MAP[r]&&(q?u="\n":p="\n"),d&&"br"==r&&(u="\n"),_BLOCK_TAG_MAP[r]&&!_PRE_TAG_MAP[r])if(d){q&&i.length>0&&i[i.length-1]===r?i.pop():i.push(r),p="\n",u="\n";for(var v=0,w=q?i.length:i.length-1;w>v;v++)p+=e,q||(u+=e);t?i.pop():q||(u+=e)}else p=u="";if(""!==s){var x=_getAttrList(o);if("font"===r){var y={},z="";_each(x,function(a,b){"color"===a&&(y.color=b,delete x[a]),"size"===a&&(y["font-size"]=f[parseInt(b,10)-1]||"",delete x[a]),"face"===a&&(y["font-family"]=b,delete x[a]),"style"===a&&(z=b)}),z&&!/;$/.test(z)&&(z+=";"),_each(y,function(a,b){""!==b&&(/\s/.test(b)&&(b="'"+b+"'"),z+=a+":"+b+";")}),x.style=z}_each(x,function(a,d){if(_FILL_ATTR_MAP[a]&&(x[a]=a),_inArray(a,["src","href"])>=0&&(x[a]=_formatUrl(d,c)),(b&&"style"!==a&&!g[r]["*"]&&!g[r][a]||"body"===r&&"contenteditable"===a||/^kindeditor_\d+$/.test(a))&&delete x[a],"style"===a&&""!==d){var e=_getCssList(d);_each(e,function(a){!b||g[r].style||g[r]["."+a]||delete e[a]});var f="";_each(e,function(a,b){f+=a+":"+b+";"}),x.style=f}}),s="",_each(x,function(a,b){("style"!==a||""!==b)&&(b=b.replace(/"/g,"""),s+=" "+a+'="'+b+'"')})}return"font"===r&&(r="span"),p+"<"+q+r+s+t+">"+u}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(a,b,c,d){return b+c.replace(/\n/g,'\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n"),_trim(a)}function _clearMsWord(a,b){return a=a.replace(//gi,"").replace(//gi,"").replace(/]*>[\s\S]*?<\/style>/gi,"").replace(/]*>[\s\S]*?<\/script>/gi,"").replace(/]+>[\s\S]*?<\/w:[^>]+>/gi,"").replace(/]+>[\s\S]*?<\/o:[^>]+>/gi,"").replace(/[\s\S]*?<\/xml>/gi,"").replace(/<(?:table|td)[^>]*>/gi,function(a){return a.replace(/border-bottom:([#\w\s]+)/gi,"border:$1")}),_formatHtml(a,b)}function _mediaType(a){return/\.(rm|rmvb)(\?|$)/i.test(a)?"audio/x-pn-realaudio-plugin":/\.(swf|flv)(\?|$)/i.test(a)?"application/x-shockwave-flash":"video/x-ms-asf-plugin"}function _mediaClass(a){return/realaudio/i.test(a)?"ke-rm":/flash/i.test(a)?"ke-flash":"ke-media"}function _mediaAttrs(a){return _getAttrList(unescape(a))}function _mediaEmbed(a){var b="0&&(g+="width:"+c+"px;"),/\D/.test(d)?g+="height:"+d+";":d>0&&(g+="height:"+d+"px;");var h=''}function _tmpl(a,b){var c=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return b?c(b):c}function _contains(a,b){if(9==a.nodeType&&9!=b.nodeType)return!0;for(;b=b.parentNode;)if(b==a)return!0;return!1}function _getAttr(a,b){b=b.toLowerCase();var c=null;if(_GET_SET_ATTRIBUTE||"script"==a.nodeName.toLowerCase())try{c=a.getAttribute(b,2)}catch(d){c=a.getAttribute(b,1)}else{var e=a.ownerDocument.createElement("div");e.appendChild(a.cloneNode(!1));var f=_getAttrList(_unescape(e.innerHTML));b in f&&(c=f[b])}return"style"===b&&null!==c&&(c=_formatCss(c)),c}function _queryAll(a,b){function c(a){return"string"!=typeof a?a:a.replace(/([^\w\-])/g,"\\$1")}function d(a){return a.replace(/\\/g,"")}function e(a,b){return"*"===a||a.toLowerCase()===c(b.toLowerCase())}function f(a,b,c){var f=[],g=c.ownerDocument||c,h=g.getElementById(d(a));return h&&e(b,h.nodeName)&&_contains(c,h)&&f.push(h),f}function g(a,b,c){var f,g,h,i,j=c.ownerDocument||c,k=[];if(c.getElementsByClassName)for(f=c.getElementsByClassName(d(a)),g=0,h=f.length;h>g;g++)i=f[g],e(b,i.nodeName)&&k.push(i);else if(j.querySelectorAll)for(f=j.querySelectorAll(("#document"!==c.nodeName?c.nodeName+" ":"")+b+"."+a),g=0,h=f.length;h>g;g++)i=f[g],_contains(c,i)&&k.push(i);else for(f=c.getElementsByTagName(b),a=" "+a+" ",g=0,h=f.length;h>g;g++)if(i=f[g],1==i.nodeType){var l=i.className;l&&(" "+l+" ").indexOf(a)>-1&&k.push(i)}return k}function h(a,b,c){for(var f,g=[],h=c.ownerDocument||c,i=h.getElementsByName(d(a)),j=0,k=i.length;k>j;j++)f=i[j],e(b,f.nodeName)&&_contains(c,f)&&null!==f.getAttribute("name")&&g.push(f);return g}function i(a,b,d,e){for(var f,g=[],h=e.getElementsByTagName(d),i=0,j=h.length;j>i;i++)f=h[i],1==f.nodeType&&(null===b?null!==_getAttr(f,a)&&g.push(f):b===c(_getAttr(f,a))&&g.push(f));return g}function j(a,b){var c,d=[];c=/^((?:\\.|[^.#\s\[<>])+)/.exec(a);var e=c?c[1]:"*";if(c=/#((?:[\w\-]|\\.)+)$/.exec(a))d=f(c[1],e,b);else if(c=/\.((?:[\w\-]|\\.)+)$/.exec(a))d=g(c[1],e,b);else if(c=/\[((?:[\w\-]|\\.)+)\]/.exec(a))d=i(c[1].toLowerCase(),null,e,b);else if(c=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){var j=c[1].toLowerCase(),k=c[2];d="id"===j?f(k,e,b):"class"===j?g(k,e,b):"name"===j?h(k,e,b):i(j,k,e,b)}else for(var l,m=b.getElementsByTagName(e),n=0,o=m.length;o>n;n++)l=m[n],1==l.nodeType&&d.push(l);return d}var k=a.split(",");if(k.length>1){var l=[];return _each(k,function(){_each(_queryAll(this,b),function(){_inArray(this,l)<0&&l.push(this)})}),l}b=b||document;for(var m,n=[],o=/((?:\\.|[^\s>])+|[\s>])/g;m=o.exec(a);)" "!==m[1]&&n.push(m[1]);var p=[];if(1==n.length)return j(n[0],b);var q,r,s,t,u,v,w,x,y,z,A=!1;for(v=0,lenth=n.length;v"!==q){if(v>0){for(r=[],w=0,y=p.length;y>w;w++)for(t=p[w],s=j(q,t),x=0,z=s.length;z>x;x++)u=s[x],A?t===u.parentNode&&r.push(u):r.push(u);p=r}else p=j(q,b);if(0===p.length)return[]}else A=!0;return p}function _query(a,b){var c=_queryAll(a,b);return c.length>0?c[0]:null}function _get(a){return K(a)[0]}function _getDoc(a){return a?a.ownerDocument||a.document||a:document}function _getWin(a){if(!a)return window;var b=_getDoc(a);return b.parentWindow||b.defaultView}function _setHtml(a,b){if(1==a.nodeType){var c=_getDoc(a);try{a.innerHTML=''+b;var d=c.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d)}catch(e){K(a).empty(),K("@"+b,c).each(function(){a.appendChild(this)})}}}function _hasClass(a,b){return _inString(b,a.className," ")}function _setAttr(a,b,c){_IE&&8>_V&&"class"==b.toLowerCase()&&(b="className"),a.setAttribute(b,""+c)}function _removeAttr(a,b){_IE&&8>_V&&"class"==b.toLowerCase()&&(b="className"),_setAttr(a,b,""),a.removeAttribute(b)}function _getNodeName(a){return a&&a.nodeName?a.nodeName.toLowerCase():""}function _computedCss(a,b){var c=_getWin(a),d=_toCamel(b),e="";if(c.getComputedStyle){var f=c.getComputedStyle(a,null);e=f[d]||f.getPropertyValue(b)||a.style[d]}else a.currentStyle&&(e=a.currentStyle[d]||a.style[d]);return e}function _hasVal(a){return!!_VALUE_TAG_MAP[_getNodeName(a)]}function _docElement(a){return a=a||document,_QUIRKS?a.body:a.documentElement}function _docHeight(a){var b=_docElement(a);return Math.max(b.scrollHeight,b.clientHeight)}function _docWidth(a){var b=_docElement(a);return Math.max(b.scrollWidth,b.clientWidth)}function _getScrollPos(a){a=a||document;var b,c;return _IE||_NEWIE||_OPERA?(b=_docElement(a).scrollLeft,c=_docElement(a).scrollTop):(b=_getWin(a).scrollX,c=_getWin(a).scrollY),{x:b,y:c}}function KNode(a){this.init(a)}function _updateCollapsed(a){return a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset,a}function _copyAndDelete(a,b,c){function d(d,e,f){var g,i=d.nodeValue.length;if(b){var j=d.cloneNode(!0);g=e>0?j.splitText(e):j,i>f&&g.splitText(f-e)}if(c){var k=d;if(e>0&&(k=d.splitText(e),a.setStart(d,e)),i>f){var l=k.splitText(f-e);a.setEnd(l,0)}h.push(k)}return g}function e(){c&&a.up().collapse(!0);for(var b=0,d=h.length;d>b;b++){var e=h[b];e.parentNode&&e.parentNode.removeChild(e)}}function f(e,n){for(var o,p=e.firstChild;p;){var q=new KRange(g).selectNode(p);if(j=q.compareBoundaryPoints(_START_TO_END,a),j>=0&&0>=k&&(k=q.compareBoundaryPoints(_START_TO_START,a)),k>=0&&0>=l&&(l=q.compareBoundaryPoints(_END_TO_END,a)),l>=0&&0>=m&&(m=q.compareBoundaryPoints(_END_TO_START,a)),m>=0)return!1;if(o=p.nextSibling,j>0)if(1==p.nodeType)if(k>=0&&0>=l)b&&n.appendChild(p.cloneNode(!0)),c&&h.push(p);else{var r;if(b&&(r=p.cloneNode(!1),n.appendChild(r)),f(p,r)===!1)return!1}else if(3==p.nodeType){var s;if(s=p==i.startContainer?d(p,i.startOffset,p.nodeValue.length):p==i.endContainer?d(p,0,i.endOffset):d(p,0,p.nodeValue.length),b)try{n.appendChild(s)}catch(t){}}p=o}}var g=a.doc,h=[],i=a.cloneRange().down(),j=-1,k=-1,l=-1,m=-1,n=a.commonAncestor(),o=g.createDocumentFragment();if(3==n.nodeType){var p=d(n,a.startOffset,a.endOffset);return b&&o.appendChild(p),e(),b?o:a}f(n,o),c&&a.up().collapse(!0);for(var q=0,r=h.length;r>q;q++){var s=h[q];s.parentNode&&s.parentNode.removeChild(s)}return b?o:a}function _moveToElementText(a,b){for(var c=b;c;){var d=K(c);if("marquee"==d.name||"select"==d.name)return;c=c.parentNode}try{a.moveToElementText(b)}catch(e){}}function _getStartEnd(a,b){var c=a.parentElement().ownerDocument,d=a.duplicate();d.collapse(b);var e=d.parentElement(),f=e.childNodes;if(0===f.length)return{node:e.parentNode,offset:K(e).index()};var g=c,h=0,i=-1,j=a.duplicate();_moveToElementText(j,e);for(var k=0,l=f.length;l>k;k++){var m=f[k];if(i=j.compareEndPoints("StartToStart",d),0===i)return{node:m.parentNode,offset:k};if(1==m.nodeType){var n,o=a.duplicate(),p=K(m),q=m;p.isControl()&&(n=c.createElement("span"),p.after(n),q=n,h+=p.text().replace(/\r\n|\n|\r/g,"").length),_moveToElementText(o,q),j.setEndPoint("StartToEnd",o),i>0?h+=o.text.replace(/\r\n|\n|\r/g,"").length:h=0,n&&K(n).remove()}else 3==m.nodeType&&(j.moveStart("character",m.nodeValue.length),h+=m.nodeValue.length);0>i&&(g=m)}if(0>i&&1==g.nodeType)return{node:e,offset:K(e.lastChild).index()+1};if(i>0)for(;g.nextSibling&&1==g.nodeType;)g=g.nextSibling;if(j=a.duplicate(),_moveToElementText(j,e),j.setEndPoint("StartToEnd",d),h-=j.text.replace(/\r\n|\n|\r/g,"").length,i>0&&3==g.nodeType)for(var r=g.previousSibling;r&&3==r.nodeType;)h-=r.nodeValue.length,r=r.previousSibling;return{node:g,offset:h}}function _getEndRange(a,b){var c=a.ownerDocument||a,d=c.body.createTextRange();if(c==a)return d.collapse(!0),d;if(1==a.nodeType&&a.childNodes.length>0){var e,f,g=a.childNodes;if(0===b?(f=g[0],e=!0):(f=g[b-1],e=!1),!f)return d;if("head"===K(f).name)return 1===b&&(e=!0),2===b&&(e=!1),d.collapse(e),d;if(1==f.nodeType){var h,i=K(f);return i.isControl()&&(h=c.createElement("span"),e?i.before(h):i.after(h),f=h),_moveToElementText(d,f),d.collapse(e),h&&K(h).remove(),d}a=f,b=e?0:f.nodeValue.length}var j=c.createElement("span");return K(a).before(j),_moveToElementText(d,j),d.moveStart("character",b),K(j).remove(),d}function _toRange(a){function b(a){"tr"==K(a.node).name&&(a.node=a.node.cells[a.offset],a.offset=0)}var c,d;if(_IERANGE){if(a.item)return c=_getDoc(a.item(0)),d=new KRange(c),d.selectNode(a.item(0)),d;c=a.parentElement().ownerDocument;var e=_getStartEnd(a,!0),f=_getStartEnd(a,!1);return b(e),b(f),d=new KRange(c),d.setStart(e.node,e.offset),d.setEnd(f.node,f.offset),d}var g=a.startContainer;return c=g.ownerDocument||g,d=new KRange(c),d.setStart(g,a.startOffset),d.setEnd(a.endContainer,a.endOffset),d}function KRange(a){this.init(a)}function _range(a){return a.nodeName?new KRange(a):a.constructor===KRange?a:_toRange(a)}function _nativeCommand(a,b,c){try{a.execCommand(b,!1,c)}catch(d){}}function _nativeCommandValue(a,b){var c="";try{c=a.queryCommandValue(b)}catch(d){}return"string"!=typeof c&&(c=""),c}function _getSel(a){var b=_getWin(a);return _IERANGE?a.selection:b.getSelection()}function _getRng(a){var b,c=_getSel(a);try{b=c.rangeCount>0?c.getRangeAt(0):c.createRange()}catch(d){}return!_IERANGE||b&&(b.item||b.parentElement().ownerDocument===a)?b:null}function _singleKeyMap(a){var b,c,d={};return _each(a,function(a,e){b=a.split(",");for(var f=0,g=b.length;g>f;f++)c=b[f],d[c]=e}),d}function _hasAttrOrCss(a,b){return _hasAttrOrCssByKey(a,b,"*")||_hasAttrOrCssByKey(a,b)}function _hasAttrOrCssByKey(a,b,c){if(c=c||a.name,1!==a.type)return!1;var d=_singleKeyMap(b);if(!d[c])return!1;for(var e=d[c].split(","),f=0,g=e.length;g>f;f++){var h=e[f];if("*"===h)return!0;var i=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(h),j=i[1]?"css":"attr";h=i[2];var k=i[3]||"";if(""===k&&""!==a[j](h))return!0;if(""!==k&&a[j](h)===k)return!0}return!1}function _removeAttrOrCss(a,b){1==a.type&&(_removeAttrOrCssByKey(a,b,"*"),_removeAttrOrCssByKey(a,b))}function _removeAttrOrCssByKey(a,b,c){if(c=c||a.name,1===a.type){var d=_singleKeyMap(b);if(d[c]){for(var e=d[c].split(","),f=!1,g=0,h=e.length;h>g;g++){var i=e[g];if("*"===i){f=!0;break}var j=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(i);i=j[2],j[1]?(i=_toCamel(i),a[0].style[i]&&(a[0].style[i]="")):a.removeAttr(i)}f&&a.remove(!0)}}}function _getInnerNode(a){for(var b=a;b.first();)b=b.first();return b}function _isEmptyNode(a){return 1!=a.type||a.isSingle()?!1:""===a.html().replace(/<[^>]+>/g,"")}function _mergeWrapper(a,b){a=a.clone(!0);for(var c=_getInnerNode(a),d=a,e=!1;b;){for(;d;)d.name===b.name&&(_mergeAttrs(d,b.attr(),b.css()),e=!0),d=d.first();e||c.append(b.clone(!1)),e=!1,b=b.first()}return a}function _wrapNode(a,b){if(b=b.clone(!0),3==a.type)return _getInnerNode(b).append(a.clone(!1)),a.replaceWith(b),b;for(var c,d=a;(c=a.first())&&1==c.children().length;)a=c;c=a.first();for(var e=a.doc.createDocumentFragment();c;)e.appendChild(c[0]),c=c.next();return b=_mergeWrapper(d,b),e.firstChild&&_getInnerNode(b).append(e),d.replaceWith(b),b}function _mergeAttrs(a,b,c){_each(b,function(b,c){"style"!==b&&a.attr(b,c)}),_each(c,function(b,c){a.css(b,c)})}function _inPreElement(a){for(;a&&"body"!=a.name;){if(_PRE_TAG_MAP[a.name]||"div"==a.name&&a.hasClass("ke-script"))return!0;a=a.parent()}return!1}function KCmd(a){this.init(a)}function _cmd(a){if(a.nodeName){var b=_getDoc(a);a=_range(b).selectNodeContents(b.body).collapse(!1)}return new KCmd(a)}function _drag(a){var b=a.moveEl,c=a.moveFn,d=a.clickEl||b,e=a.beforeDrag,f=a.iframeFix===undefined?!0:a.iframeFix,g=[document];f&&K("iframe").each(function(){var a=_formatUrl(this.src||"","absolute");if(!/^https?:\/\//.test(a)){var b;try{b=_iframeDoc(this)}catch(c){}if(b){var d=K(this).pos();K(b).data("pos-x",d.x),K(b).data("pos-y",d.y),g.push(b)}}}),d.mousedown(function(a){function f(a){a.preventDefault();var b=K(_getDoc(a.target)),e=_round((b.data("pos-x")||0)+a.pageX-o),f=_round((b.data("pos-y")||0)+a.pageY-p);c.call(d,k,l,m,n,e,f)}function h(a){a.preventDefault()}function i(a){a.preventDefault(),K(g).unbind("mousemove",f).unbind("mouseup",i).unbind("selectstart",h),j.releaseCapture&&j.releaseCapture()}if(0===a.button||1===a.button){a.stopPropagation();var j=d.get(),k=_removeUnit(b.css("left")),l=_removeUnit(b.css("top")),m=b.width(),n=b.height(),o=a.pageX,p=a.pageY;e&&e(),K(g).mousemove(f).mouseup(i).bind("selectstart",h),j.setCapture&&j.setCapture()}})}function KWidget(a){this.init(a)}function _widget(a){return new KWidget(a)}function _iframeDoc(a){return a=_get(a),a.contentDocument||a.contentWindow.document}function _getInitHtml(a,b,c,d){var e=[""===_direction?"":'','',""];return _isArray(c)||(c=[c]),_each(c,function(a,b){b&&e.push('')}),d&&e.push(""),e.push(""),e.join("\n")}function _elementVal(a,b){if(a.hasVal()){if(b===undefined){var c=a.val();return c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,"")}return a.val(b)}return a.html(b)}function KEdit(a){this.init(a)}function _edit(a){return new KEdit(a)}function _selectToolbar(a,b){var c=this,d=c.get(a);if(d){if(d.hasClass("ke-disabled"))return;b(d)}}function KToolbar(a){this.init(a)}function _toolbar(a){return new KToolbar(a)}function KMenu(a){this.init(a)}function _menu(a){return new KMenu(a)}function KColorPicker(a){this.init(a)}function _colorpicker(a){return new KColorPicker(a)}function KUploadButton(a){this.init(a)}function _uploadbutton(a){return new KUploadButton(a)}function _createButton(a){a=a||{};var b=a.name||"",c=K(''),d=K('');return a.click&&d.click(a.click),c.append(d),c}function KDialog(a){this.init(a)}function _dialog(a){return new KDialog(a)}function _tabs(a){var b=_widget(a),c=b.remove,d=a.afterSelect,e=b.div,f=[];e.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()});var g=K('
    ');return e.append(g),b.add=function(a){var b=K('
  • '+a.title+"
  • ");b.data("tab",a),f.push(b),g.append(b)},b.selectedIndex=0,b.select=function(a){b.selectedIndex=a,_each(f,function(c,d){d.unbind(),c===a?(d.addClass("ke-tabs-li-selected"),K(d.data("tab").panel).show("")):(d.removeClass("ke-tabs-li-selected").removeClass("ke-tabs-li-on").mouseover(function(){K(this).addClass("ke-tabs-li-on")}).mouseout(function(){K(this).removeClass("ke-tabs-li-on")}).click(function(){b.select(c)}),K(d.data("tab").panel).hide())}),d&&d.call(b,a)},b.remove=function(){_each(f,function(){this.remove()}),g.remove(),c.call(b)},b}function _loadScript(a,b){var c=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),d=document.createElement("script");c.appendChild(d),d.src=a,d.charset="utf-8",d.onload=d.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState||(b&&b(),d.onload=d.onreadystatechange=null,c.removeChild(d))}}function _chopQuery(a){var b=a.indexOf("?");return b>0?a.substr(0,b):a}function _loadStyle(a){for(var b=document.getElementsByTagName("head")[0]||(_QUIRKS?document.body:document.documentElement),c=document.createElement("link"),d=_chopQuery(_formatUrl(a,"absolute")),e=K('link[rel="stylesheet"]',b),f=0,g=e.length;g>f;f++)if(_chopQuery(_formatUrl(e[f].href,"absolute"))===d)return;b.appendChild(c),c.href=a,c.rel="stylesheet"}function _ajax(a,b,c,d,e){c=c||"GET",e=e||"json";var f=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(f.open(c,a,!0),f.onreadystatechange=function(){if(4==f.readyState&&200==f.status&&b){var a=_trim(f.responseText);"json"==e&&(a=_json(a)),b(a)}},"POST"==c){var g=[];_each(d,function(a,b){g.push(encodeURIComponent(a)+"="+encodeURIComponent(b))});try{f.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(h){}f.send(g.join("&"))}else f.send(null)}function _plugin(a,b){return a===undefined?_plugins:b?void(_plugins[a]=b):_plugins[a]}function _parseLangKey(a){var b,c="core";return(b=/^(\w+)\.(\w+)$/.exec(a))&&(c=b[1],a=b[2]),{ns:c,key:a}}function _lang(a,b){if(b=b===undefined?K.options.langType:b,"string"==typeof a){if(!_language[b])return"no language";var c=a.length-1;if("."===a.substr(c))return _language[b][a.substr(0,c)];var d=_parseLangKey(a);return _language[b][d.ns][d.key]}_each(a,function(a,c){var d=_parseLangKey(a);_language[b]||(_language[b]={}),_language[b][d.ns]||(_language[b][d.ns]={}),_language[b][d.ns][d.key]=c})}function _getImageFromRange(a,b){if(!a.collapsed){a=a.cloneRange().up();var c=a.startContainer,d=a.startOffset;if(_WEBKIT||a.isControl()){var e=K(c.childNodes[d]);if(e&&"img"==e.name)return b(e)?e:void 0}}}function _bindContextmenuEvent(){var a=this,b=a.edit.doc;K(b).contextmenu(function(b){if(a.menu&&a.hideMenu(),!a.useContextmenu)return void b.preventDefault();if(0!==a._contextmenus.length){var c=0,d=[];for(_each(a._contextmenus,function(){return"-"==this.title?void d.push(this):void(this.cond&&this.cond()&&(d.push(this),this.width&&this.width>c&&(c=this.width)))});d.length>0&&"-"==d[0].title;)d.shift();for(;d.length>0&&"-"==d[d.length-1].title;)d.pop();var e=null;if(_each(d,function(a){"-"==this.title&&"-"==e.title&&delete d[a],e=this}),d.length>0){b.preventDefault();var f=K(a.edit.iframe).pos(),g=_menu({x:f.x+b.clientX,y:f.y+b.clientY,width:c,css:{visibility:"hidden"},shadowMode:a.shadowMode});_each(d,function(){this.title&&g.addItem(this)});var h=_docElement(g.doc),i=g.div.height();b.clientY+i>=h.clientHeight-100&&g.pos(g.x,_removeUnit(g.y)-i),g.div.css("visibility","visible"),a.menu=g}}})}function _bindNewlineEvent(){function a(a){for(var b=K(a.commonAncestor());b&&(1!=b.type||b.isStyle());)b=b.parent();return b.name}var b=this,c=b.edit.doc,d=b.newlineTag;if(!(_IE&&"br"!==d||_GECKO&&3>_V&&"p"!==d||_OPERA&&9>_V)){var e=_toMap("h1,h2,h3,h4,h5,h6,pre,li"),f=_toMap("p,h1,h2,h3,h4,h5,h6,pre,li,blockquote");K(c).keydown(function(g){if(!(13!=g.which||g.shiftKey||g.ctrlKey||g.altKey)){b.cmd.selection();var h=a(b.cmd.range);if("marquee"!=h&&"select"!=h)return"br"!==d||e[h]?void(f[h]||_nativeCommand(c,"formatblock","

    ")):(g.preventDefault(),void b.insertHtml("
    "+(_IE&&9>_V?"":"​")))}}),K(c).keyup(function(e){if(!(13!=e.which||e.shiftKey||e.ctrlKey||e.altKey)&&"br"!=d){if(_GECKO){var g=b.cmd.commonAncestor("p"),h=b.cmd.commonAncestor("a");return void(h&&""==h.text()&&(h.remove(!0),b.cmd.range.selectNodeContents(g[0]).collapse(!0),b.cmd.select()))}b.cmd.selection();var i=a(b.cmd.range);if("marquee"!=i&&"select"!=i){f[i]||_nativeCommand(c,"formatblock","

    ");var j=b.cmd.commonAncestor("div");if(j){for(var k=K("

    "),l=j[0].firstChild;l;){var m=l.nextSibling;k.append(l),l=m}j.before(k),j.remove(),b.cmd.range.selectNodeContents(k[0]),b.cmd.select()}}}})}}function _bindTabEvent(){var a=this,b=a.edit.doc;K(b).keydown(function(c){if(9==c.which){if(c.preventDefault(),a.afterTab)return void a.afterTab.call(a,c);var d=a.cmd,e=d.range;e.shrink(),e.collapsed&&1==e.startContainer.nodeType&&(e.insertNode(K("@ ",b)[0]),d.select()),a.insertHtml("    ")}})}function _bindFocusEvent(){var a=this;K(a.edit.textarea[0],a.edit.win).focus(function(b){a.afterFocus&&a.afterFocus.call(a,b)}).blur(function(b){a.afterBlur&&a.afterBlur.call(a,b)})}function _removeBookmarkTag(a){return _trim(a.replace(/]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/gi,""))}function _removeTempTag(a){return a.replace(/]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/gi,"")}function _addBookmarkToStack(a,b){if(0===a.length)return void a.push(b);var c=a[a.length-1];_removeBookmarkTag(b.html)!==_removeBookmarkTag(c.html)&&a.push(b)}function _undoToRedo(a,b){var c,d,e=this,f=e.edit,g=f.doc.body;if(0===a.length)return e;f.designMode?(c=e.cmd.range,d=c.createBookmark(!0),d.html=g.innerHTML):d={html:g.innerHTML},_addBookmarkToStack(b,d); +var h=a.pop();return _removeBookmarkTag(d.html)===_removeBookmarkTag(h.html)&&a.length>0&&(h=a.pop()),f.designMode?(f.html(h.html),h.start&&(c.moveToBookmark(h),e.select())):K(g).html(_removeBookmarkTag(h.html)),e}function KEditor(a){function b(a,b){KEditor.prototype[a]===undefined&&(c[a]=b),c.options[a]=b}var c=this;c.options={},_each(a,function(c){b(c,a[c])}),_each(K.options,function(a,d){c[a]===undefined&&b(a,d)});var d=K(c.srcElement||"').css("width","100%"),c.tabIndex=isNaN(parseInt(a.tabIndex,10))?c.srcElement.attr("tabindex"):parseInt(a.tabIndex,10),c.iframe.attr("tabindex",c.tabIndex),c.textarea.attr("tabindex",c.tabIndex),c.width&&c.setWidth(c.width),c.height&&c.setHeight(c.height),c.designMode?c.textarea.hide():c.iframe.hide(),h&&c.iframe.bind("load",function(){c.iframe.unbind("load"),_IE?b():setTimeout(b,0)}),c.div.append(c.iframe),c.div.append(c.textarea),c.srcElement.hide(),!h&&b()},setWidth:function(a){var b=this;return a=_addUnit(a),b.width=a,b.div.css("width",a),b},setHeight:function(a){var b=this;return a=_addUnit(a),b.height=a,b.div.css("height",a),b.iframe.css("height",a),(_IE&&8>_V||_QUIRKS)&&(a=_addUnit(_removeUnit(a)-2)),b.textarea.css("height",a),b},remove:function(){var a=this,b=a.doc;K(b.body).unbind(),K(b).unbind(),K(a.win).unbind(),a._mousedownHandler&&K(document).unbind("mousedown",a._mousedownHandler),_elementVal(a.srcElement,a.html()),a.srcElement.show(),a.iframe.unbind(),a.textarea.unbind(),KEdit.parent.remove.call(a)},html:function(a,b){var c=this,d=c.doc;if(c.designMode){var e=d.body;return a===undefined?(a=b?""+e.parentNode.innerHTML+"":e.innerHTML,c.beforeGetHtml&&(a=c.beforeGetHtml(a)),_GECKO&&"
    "==a&&(a=""),a):(c.beforeSetHtml&&(a=c.beforeSetHtml(a)),_IE&&_V>=9&&(a=a.replace(/(<.*?checked=")checked(".*>)/gi,"$1$2")),K(e).html(a),c.afterSetHtml&&c.afterSetHtml(),c)}return a===undefined?c.textarea.val():(c.textarea.val(a),c)},design:function(a){var b,c=this;if(a===undefined?!c.designMode:a){if(!c.designMode){b=c.html(),c.designMode=!0,c.textarea.hide(),c.html(b);var d=c.iframe,e=_removeUnit(c.height);d.height(e-2),d.show(),setTimeout(function(){d.height(e)},0)}}else c.designMode&&(b=c.html(),c.designMode=!1,c.html(b),c.iframe.hide(),c.textarea.show());return c.focus()},focus:function(){var a=this;return a.designMode?a.win.focus():a.textarea[0].focus(),a},blur:function(){var a=this;if(_IE){var b=K('',a.div);a.div.append(b),b[0].focus(),b.remove()}else a.designMode?a.win.blur():a.textarea[0].blur();return a},afterChange:function(a){function b(b){setTimeout(function(){a(b)},1)}var c=this,d=c.doc,e=d.body;return K(d).keyup(function(b){b.ctrlKey||b.altKey||!_CHANGE_KEY_MAP[b.which]||a(b)}),K(d).mouseup(a).contextmenu(a),K(c.win).blur(a),K(e).bind("paste",b),K(e).bind("cut",b),c}}),K.EditClass=KEdit,K.edit=_edit,K.iframeDoc=_iframeDoc,_extend(KToolbar,KWidget,{init:function(a){function b(a){var b=K(a);return b.hasClass("ke-outline")?b:b.hasClass("ke-toolbar-icon")?b.parent():void 0}function c(a,c){var d=b(a.target);if(d){if(d.hasClass("ke-disabled"))return;if(d.hasClass("ke-selected"))return;d[c]("ke-on")}}var d=this;KToolbar.parent.init.call(d,a),d.disableMode=_undef(a.disableMode,!1),d.noDisableItemMap=_toMap(_undef(a.noDisableItems,[])),d._itemMap={},d.div.addClass("ke-toolbar").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()}).attr("unselectable","on"),d.div.mouseover(function(a){c(a,"addClass")}).mouseout(function(a){c(a,"removeClass")}).click(function(a){var c=b(a.target);if(c){if(c.hasClass("ke-disabled"))return;d.options.click.call(this,a,c.attr("data-name"))}})},get:function(a){return this._itemMap[a]?this._itemMap[a]:this._itemMap[a]=K("span.ke-icon-"+a,this.div).parent()},select:function(a){return _selectToolbar.call(this,a,function(a){a.addClass("ke-selected")}),self},unselect:function(a){return _selectToolbar.call(this,a,function(a){a.removeClass("ke-selected").removeClass("ke-on")}),self},enable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-disabled"),c.opacity(1)),b},disable:function(a){var b=this,c=a.get?a:b.get(a);return c&&(c.removeClass("ke-selected").addClass("ke-disabled"),c.opacity(.5)),b},disableAll:function(a,b){var c=this,d=c.noDisableItemMap;return b&&(d=_toMap(b)),(a===undefined?!c.disableMode:a)?(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.disable(a)}),c.disableMode=!0):(K("span.ke-outline",c.div).each(function(){var a=K(this),b=a[0].getAttribute("data-name",2);d[b]||c.enable(a)}),c.disableMode=!1),c}}),K.ToolbarClass=KToolbar,K.toolbar=_toolbar,_extend(KMenu,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KMenu.parent.init.call(b,a),b.centerLineMode=_undef(a.centerLineMode,!0),b.div.addClass("ke-menu").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on")},addItem:function(a){var b=this;if("-"===a.title)return void b.div.append(K('
    '));var c=K('
    '),d=K('
    '),e=K('
    '),f=_addUnit(a.height),g=_undef(a.iconClass,"");b.div.append(c),f&&(c.css("height",f),e.css("line-height",f));var h;return b.centerLineMode&&(h=K('
    '),f&&h.css("height",f)),c.mouseover(function(){K(this).addClass("ke-menu-item-on"),h&&h.addClass("ke-menu-item-center-on")}).mouseout(function(){K(this).removeClass("ke-menu-item-on"),h&&h.removeClass("ke-menu-item-center-on")}).click(function(b){a.click.call(K(this)),b.stopPropagation()}).append(d),h&&c.append(h),c.append(e),a.checked&&(g="ke-icon-checked"),""!==g&&d.html(''),e.html(a.title),b},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),K(".ke-menu-item",a.div[0]).unbind(),KMenu.parent.remove.call(a),a}}),K.MenuClass=KMenu,K.menu=_menu,_extend(KColorPicker,KWidget,{init:function(a){var b=this;a.z=a.z||811213,KColorPicker.parent.init.call(b,a);var c=a.colors||[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]];b.selectedColor=(a.selectedColor||"").toLowerCase(),b._cells=[],b.div.addClass("ke-colorpicker").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on");var d=b.doc.createElement("table");b.div.append(d),d.className="ke-colorpicker-table",d.cellPadding=0,d.cellSpacing=0,d.border=0;var e=d.insertRow(0),f=e.insertCell(0);f.colSpan=c[0].length,b._addAttr(f,"","ke-colorpicker-cell-top");for(var g=0;g').css("background-color",b)):a.html(d.options.noColor),K(a).attr("unselectable","on"),d._cells.push(a)},remove:function(){var a=this;return _each(a._cells,function(){this.unbind()}),KColorPicker.parent.remove.call(a),a}}),K.ColorPickerClass=KColorPicker,K.colorpicker=_colorpicker,_extend(KUploadButton,{init:function(a){var b=this,c=K(a.button),d=a.fieldName||"file",e=a.url||"",f=c.val(),g=a.extraParams||{},h=c[0].className||"",i=a.target||"kindeditor_upload_iframe_"+(new Date).getTime();a.afterError=a.afterError||function(a){alert(a)};var j=[];for(var k in g)j.push('');var l=['
    ',a.target?"":'',a.form?'
    ':'
    ','',j.join(""),'',"",'',a.form?"
    ":"","
    "].join(""),m=K(l,c.doc);c.hide(),c.before(m),b.div=m,b.button=c,b.iframe=a.target?K('iframe[name="'+i+'"]'):K("iframe",m),b.form=a.form?K(a.form):K("form",m),b.fileBox=K(".ke-upload-file",m);var n=a.width||K(".ke-button-common",m).width();K(".ke-upload-area",m).width(n),b.options=a},submit:function(){var a=this,b=a.iframe;return b.bind("load",function(){b.unbind();var c=document.createElement("form");a.fileBox.before(c),K(c).append(a.fileBox),c.reset(),K(c).remove(!0);var d,e=K.iframeDoc(b),f=e.getElementsByTagName("pre")[0],g="";g=f?f.innerHTML:e.body.innerHTML,g=_unescape(g),b[0].src="javascript:false";try{d=K.json(g)}catch(h){a.options.afterError.call(a,""+e.body.parentNode.innerHTML+"")}d&&a.options.afterUpload.call(a,d)}),a.form[0].submit(),a},remove:function(){var a=this;return a.fileBox&&a.fileBox.unbind(),a.iframe.remove(),a.div.remove(),a.button.show(),a}}),K.UploadButtonClass=KUploadButton,K.uploadbutton=_uploadbutton,_extend(KDialog,KWidget,{init:function(a){var b=this,c=_undef(a.shadowMode,!0);a.z=a.z||811213,a.shadowMode=!1,a.autoScroll=_undef(a.autoScroll,!0),KDialog.parent.init.call(b,a);var d=a.title,e=K(a.body,b.doc),f=a.previewBtn,g=a.yesBtn,h=a.noBtn,i=a.closeBtn,j=_undef(a.showMask,!0);b.div.addClass("ke-dialog").bind("click,mousedown",function(a){a.stopPropagation()});var k=K('
    ').appendTo(b.div);_IE&&7>_V?b.iframeMask=K('').appendTo(b.div):c&&K('
    ').appendTo(b.div);var l=K('
    ');k.append(l),l.html(d),b.closeIcon=K('').click(i.click),l.append(b.closeIcon),b.draggable({clickEl:l,beforeDrag:a.beforeDrag});var m=K('
    ');k.append(m),m.append(e);var n=K('');if((f||g||h)&&k.append(n),_each([{btn:f,name:"preview"},{btn:g,name:"yes"},{btn:h,name:"no"}],function(){if(this.btn){var a=_createButton(this.btn);a.addClass("ke-dialog-"+this.name),n.append(a)}}),b.height&&m.height(_removeUnit(b.height)-l.height()-n.height()),b.div.width(b.div.width()),b.div.height(b.div.height()),b.mask=null,j){var o=_docElement(b.doc),p=Math.max(o.scrollWidth,o.clientWidth),q=Math.max(o.scrollHeight,o.clientHeight);b.mask=_widget({x:0,y:0,z:b.z-1,cls:"ke-dialog-mask",width:p,height:q})}b.autoPos(b.div.width(),b.div.height()),b.footerDiv=n,b.bodyDiv=m,b.headerDiv=l,b.isLoading=!1},setMaskIndex:function(a){var b=this;b.mask.div.css("z-index",a)},showLoading:function(a){a=_undef(a,"");var b=this,c=b.bodyDiv;return b.loading=K('
    '+a+"
    ").width(c.width()).height(c.height()).css("top",b.headerDiv.height()+"px"),c.css("visibility","hidden").after(b.loading),b.isLoading=!0,b},hideLoading:function(){return this.loading&&this.loading.remove(),this.bodyDiv.css("visibility","visible"),this.isLoading=!1,this},remove:function(){var a=this;return a.options.beforeRemove&&a.options.beforeRemove.call(a),a.mask&&a.mask.remove(),a.iframeMask&&a.iframeMask.remove(),a.closeIcon.unbind(),K("input",a.div).unbind(),K("button",a.div).unbind(),a.footerDiv.unbind(),a.bodyDiv.unbind(),a.headerDiv.unbind(),K("iframe",a.div).each(function(){K(this).remove()}),KDialog.parent.remove.call(a),a}}),K.DialogClass=KDialog,K.dialog=_dialog,K.tabs=_tabs,K.loadScript=_loadScript,K.loadStyle=_loadStyle,K.ajax=_ajax;var _plugins={},_language={};KEditor.prototype={lang:function(a){return _lang(a,this.langType)},loadPlugin:function(a,b){var c=this,d=this._pluginStatus;return d||(d=this._pluginStatus={}),_plugins[a]?_isFunction(_plugins[a])?(d[a]||(_plugins[a].call(c,KindEditor),d[a]="inited"),b&&b.call(c),c):(setTimeout(function(){c.loadPlugin(a,b)},100),c):(_plugins[a]="loading",_loadScript(c.pluginsPath+a+"/"+a+".js?ver="+encodeURIComponent(K.DEBUG?_TIME:_VERSION),function(){setTimeout(function(){_plugins[a]&&c.loadPlugin(a,b)},0)}),c)},handler:function(a,b){var c=this;return c._handlers[a]||(c._handlers[a]=[]),_isFunction(b)?(c._handlers[a].push(b),c):(_each(c._handlers[a],function(){b=this.call(c,b)}),b)},clickToolbar:function(a,b){var c=this,d="clickToolbar"+a;return b===undefined?c._handlers[d]?c.handler(d):(c.loadPlugin(a,function(){c.handler(d)}),c):c.handler(d,b)},updateState:function(){var a=this;return _each("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","),function(b,c){a.cmd.state(c)?a.toolbar.select(c):a.toolbar.unselect(c)}),a},addContextmenu:function(a){return this._contextmenus.push(a),this},afterCreate:function(a){return this.handler("afterCreate",a)},beforeRemove:function(a){return this.handler("beforeRemove",a)},beforeGetHtml:function(a){return this.handler("beforeGetHtml",a)},beforeSetHtml:function(a){return this.handler("beforeSetHtml",a)},afterSetHtml:function(a){return this.handler("afterSetHtml",a)},create:function(){function a(){return 0===i.height()?void setTimeout(a,100):void b.resize(d,e,!1)}var b=this,c=b.fullscreenMode;if(b.isCreated)return b;if(b.srcElement.data("kindeditor"))return b;b.srcElement.data("kindeditor","true"),_docElement().style.overflow=c?"hidden":"";var d=c?_docElement().clientWidth+"px":b.width,e=c?_docElement().clientHeight+"px":b.height;(_IE&&8>_V||_QUIRKS)&&(e=_addUnit(_removeUnit(e)+2));var f=b.container=K(b.layout);c?K(document.body).append(f):b.srcElement.before(f);var g=K(".toolbar",f),h=K(".edit",f),i=b.statusbar=K(".statusbar",f);f.removeClass("container").addClass("ke-container ke-container-"+b.themeType).css("width",d),c?(f.css({position:"absolute",left:0,top:0,"z-index":811211}),_GECKO||(b._scrollPos=_getScrollPos()),window.scrollTo(0,0),K(document.body).css({height:"1px",overflow:"hidden"}),K(document.body.parentNode).css("overflow","hidden"),b._fullscreenExecuted=!0):(b._fullscreenExecuted&&(K(document.body).css({height:"",overflow:""}),K(document.body.parentNode).css("overflow","")),b._scrollPos&&window.scrollTo(b._scrollPos.x,b._scrollPos.y));var j=[];K.each(b.items,function(a,c){"|"==c?j.push(''):"/"==c?j.push('
    '):(j.push(''),j.push(''))});var k=b.toolbar=_toolbar({src:g,html:j.join(""),noDisableItems:b.noDisableItems,click:function(a,c){if(a.stop(),b.menu){var d=b.menu.name;if(b.hideMenu(),d===c)return}b.clickToolbar(c)}}),l=_removeUnit(e)-k.div.height(),m=b.edit=_edit({height:l>0&&_removeUnit(e)>b.minHeight?l:b.minHeight,src:h,srcElement:b.srcElement,designMode:b.designMode,themesPath:b.themesPath,bodyClass:b.bodyClass,cssPath:b.cssPath,cssData:b.cssData,beforeGetHtml:function(a){return a=b.beforeGetHtml(a),a=_removeBookmarkTag(_removeTempTag(a)),_formatHtml(a,b.filterMode?b.htmlTags:null,b.urlType,b.wellFormatMode,b.indentChar)},beforeSetHtml:function(a){return a=_formatHtml(a,b.filterMode?b.htmlTags:null,"",!1),b.beforeSetHtml(a)},afterSetHtml:function(){b.edit=m=this,b.afterSetHtml()},afterCreate:function(){if(b.edit=m=this,b.cmd=m.cmd,b._docMousedownFn=function(){b.menu&&b.hideMenu()},K(m.doc,document).mousedown(b._docMousedownFn),_bindContextmenuEvent.call(b),_bindNewlineEvent.call(b),_bindTabEvent.call(b),_bindFocusEvent.call(b),m.afterChange(function(){m.designMode&&(b.updateState(),b.addBookmark(),b.options.afterChange&&b.options.afterChange.call(b))}),m.textarea.keyup(function(a){a.ctrlKey||a.altKey||!_INPUT_KEY_MAP[a.which]||b.options.afterChange&&b.options.afterChange.call(b)}),b.readonlyMode&&b.readonly(),b.isCreated=!0,""===b.initContent&&(b.initContent=b.html()),b._undoStack.length>0){var a=b._undoStack.pop();a.start&&(b.html(a.html),m.cmd.range.moveToBookmark(a),b.select())}b.afterCreate(),b.options.afterCreate&&b.options.afterCreate.call(b)}});return i.removeClass("statusbar").addClass("ke-statusbar").append('').append(''),b._fullscreenResizeHandler&&(K(window).unbind("resize",b._fullscreenResizeHandler),b._fullscreenResizeHandler=null),a(),c?(b._fullscreenResizeHandler=function(){b.isCreated&&b.resize(_docElement().clientWidth,_docElement().clientHeight,!1)},K(window).bind("resize",b._fullscreenResizeHandler),k.select("fullscreen"),i.first().css("visibility","hidden"),i.last().css("visibility","hidden")):(_GECKO&&K(window).bind("scroll",function(){b._scrollPos=_getScrollPos()}),b.resizeType>0?_drag({moveEl:f,clickEl:i,moveFn:function(a,c,d,e,f,g){e+=g,b.resize(null,e)}}):i.first().css("visibility","hidden"),2===b.resizeType?_drag({moveEl:f,clickEl:i.last(),moveFn:function(a,c,d,e,f,g){d+=f,e+=g,b.resize(d,e)}}):i.last().css("visibility","hidden")),b},remove:function(){var a=this;return a.isCreated?(a.beforeRemove(),a.srcElement.data("kindeditor",""),a.menu&&a.hideMenu(),_each(a.dialogs,function(){a.hideDialog()}),K(document).unbind("mousedown",a._docMousedownFn),a.toolbar.remove(),a.edit.remove(),a.statusbar.last().unbind(),a.statusbar.unbind(),a.container.remove(),a.container=a.toolbar=a.edit=a.menu=null,a.dialogs=[],a.isCreated=!1,a):a},resize:function(a,b,c){var d=this;return c=_undef(c,!0),a&&(/%/.test(a)||(a=_removeUnit(a),a=a/gi,"").replace(/ /gi," ")):b.html(_escape(a))},isEmpty:function(){return""===_trim(this.text().replace(/\r\n|\n|\r/,""))},isDirty:function(){return _trim(this.initContent.replace(/\r\n|\n|\r|t/g,""))!==_trim(this.html().replace(/\r\n|\n|\r|t/g,""))},selectedHtml:function(){var a=this.isCreated?this.cmd.range.html():"";return a=_removeBookmarkTag(_removeTempTag(a))},count:function(a){var b=this;return a=(a||"html").toLowerCase(),"html"===a?b.html().length:"text"===a?b.text().replace(/<(?:img|embed).*?>/gi,"K").replace(/\r\n|\n|\r/g,"").length:0},exec:function(a){a=a.toLowerCase();var b=this,c=b.cmd,d=_inArray(a,"selectall,copy,paste,print".split(","))<0;return d&&b.addBookmark(!1),c[a].apply(c,_toArray(arguments,1)),d&&(b.updateState(),b.addBookmark(!1),b.options.afterChange&&b.options.afterChange.call(b)),b},insertHtml:function(a,b){return this.isCreated?(a=this.beforeSetHtml(a),this.exec("inserthtml",a,b),this):this},appendHtml:function(a){if(this.html(this.html()+a),this.isCreated){var b=this.cmd;b.range.selectNodeContents(b.doc.body).collapse(!1),b.select()}return this},sync:function(){return _elementVal(this.srcElement,this.html()),this},focus:function(){return this.isCreated?this.edit.focus():this.srcElement[0].focus(),this},blur:function(){return this.isCreated?this.edit.blur():this.srcElement[0].blur(),this},addBookmark:function(a){a=_undef(a,!0);var b,c=this,d=c.edit,e=d.doc.body,f=_removeTempTag(e.innerHTML);if(a&&c._undoStack.length>0){var g=c._undoStack[c._undoStack.length-1];if(Math.abs(f.length-_removeBookmarkTag(g.html).length)0){var c=b.dialogs[0],d=b.dialogs[b.dialogs.length-1];c.setMaskIndex(d.z+2),a.z=d.z+3,a.showMask=!1}var e=_dialog(a);return b.dialogs.push(e),e},hideDialog:function(){var a=this;if(a.dialogs.length>0&&a.dialogs.pop().remove(),a.dialogs.length>0){var b=a.dialogs[0],c=a.dialogs[a.dialogs.length-1];b.setMaskIndex(c.z-1)}return a},errorDialog:function(a){var b=this,c=b.createDialog({width:750,title:b.lang("uploadError"),body:'
    '}),d=K("iframe",c.div),e=K.iframeDoc(d);return e.open(),e.write(a),e.close(),K(e.body).css("background-color","#FFF"),d[0].contentWindow.focus(),b}},_instances=[],K.remove=function(a){_eachEditor(a,function(a){this.remove(),_instances.splice(a,1)})},K.sync=function(a){_eachEditor(a,function(){this.sync()})},K.html=function(a,b){_eachEditor(a,function(){this.html(b)})},K.insertHtml=function(a,b){_eachEditor(a,function(){this.insertHtml(b)})},K.appendHtml=function(a,b){_eachEditor(a,function(){this.appendHtml(b)})},_IE&&7>_V&&_nativeCommand(document,"BackgroundImageCache",!0),K.EditorClass=KEditor,K.editor=_editor,K.create=_create,K.instances=_instances,K.plugin=_plugin,K.lang=_lang,_plugin("core",function(a){var b=this,c={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};if(b.afterSetHtml(function(){b.options.afterChange&&b.options.afterChange.call(b)}),b.afterCreate(function(){if("form"==b.syncType){for(var c=a(b.srcElement),d=!1;c=c.parent();)if("form"==c.name){d=!0;break}if(d){c.bind("submit",function(){b.sync(),a(window).bind("unload",function(){b.edit.textarea.remove()})});var e=a('[type="reset"]',c);e.click(function(){b.html(b.initContent),b.cmd.selection()}),b.beforeRemove(function(){c.unbind(),e.unbind()})}}}),b.clickToolbar("source",function(){b.edit.designMode?(b.toolbar.disableAll(!0),b.edit.design(!1),b.toolbar.select("source")):(b.toolbar.disableAll(!1),b.edit.design(!0),b.toolbar.unselect("source"),_GECKO?setTimeout(function(){b.cmd.selection()},0):b.cmd.selection()),b.designMode=b.edit.designMode}),b.afterCreate(function(){b.designMode||b.toolbar.disableAll(!0).select("source")}),b.clickToolbar("fullscreen",function(){b.fullscreen()}),b.fullscreenShortcut){var d=!1;b.afterCreate(function(){if(a(b.edit.doc,b.edit.textarea).keyup(function(a){27==a.which&&setTimeout(function(){b.fullscreen()},0)}),d){if(_IE&&!b.designMode)return;b.focus()}d||(d=!0)})}_each("undo,redo".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.clickToolbar(d)})}),b.clickToolbar(d,function(){b[d]()})}),b.clickToolbar("formatblock",function(){var a=b.lang("formatblock.formatBlock"),c={h1:28,h2:24,h3:18,H4:14,p:12},d=b.cmd.val("formatblock"),e=b.createMenu({name:"formatblock",width:"en"==b.langType?200:150});_each(a,function(a,f){var g="font-size:"+c[a]+"px;";"h"===a.charAt(0)&&(g+="font-weight:bold;"),e.addItem({title:''+f+"",height:c[a]+12,checked:d===a||d===f,click:function(){b.select().exec("formatblock","<"+a+">").hideMenu()}})})}),b.clickToolbar("fontname",function(){var a=b.cmd.val("fontname"),c=b.createMenu({name:"fontname",width:150});_each(b.lang("fontname.fontName"),function(d,e){c.addItem({title:''+e+"",checked:a===d.toLowerCase()||a===e.toLowerCase(),click:function(){b.exec("fontname",d).hideMenu()}})})}),b.clickToolbar("fontsize",function(){var a=b.cmd.val("fontsize"),c=b.createMenu({name:"fontsize",width:150});_each(b.fontSizeTable,function(d,e){c.addItem({title:''+e+"",height:_removeUnit(e)+12,checked:a===e,click:function(){b.exec("fontsize",e).hideMenu()}})})}),_each("forecolor,hilitecolor".split(","),function(a,c){b.clickToolbar(c,function(){b.createMenu({name:c,selectedColor:b.cmd.val(c)||"default",colors:b.colorTable,click:function(a){b.exec(c,a).hideMenu()}})})}),_each("cut,copy,paste".split(","),function(a,c){b.clickToolbar(c,function(){b.focus();try{b.exec(c,null)}catch(a){alert(b.lang(c+"Error"))}})}),b.clickToolbar("about",function(){var a='
    KindEditor '+_VERSION+'
    Copyright © kindsoft.net All rights reserved.
    ';b.createDialog({name:"about",width:350,title:b.lang("about"),body:a})}),b.plugin.getSelectedLink=function(){return b.cmd.commonAncestor("a")},b.plugin.getSelectedImage=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return!/^ke-\w+$/i.test(a[0].className)})},b.plugin.getSelectedFlash=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-flash"==a[0].className})},b.plugin.getSelectedMedia=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-media"==a[0].className||"ke-rm"==a[0].className})},b.plugin.getSelectedAnchor=function(){return _getImageFromRange(b.edit.cmd.range,function(a){return"ke-anchor"==a[0].className})},_each("link,image,flash,media,anchor".split(","),function(a,c){var d=c.charAt(0).toUpperCase()+c.substr(1);_each("edit,delete".split(","),function(a,e){b.addContextmenu({title:b.lang(e+d),click:function(){b.loadPlugin(c,function(){b.plugin[c][e](),b.hideMenu()})},cond:b.plugin["getSelected"+d],width:150,iconClass:"edit"==e?"ke-icon-"+c:undefined}) +}),b.addContextmenu({title:"-"})}),b.plugin.getSelectedTable=function(){return b.cmd.commonAncestor("table")},b.plugin.getSelectedRow=function(){return b.cmd.commonAncestor("tr")},b.plugin.getSelectedCell=function(){return b.cmd.commonAncestor("td")},_each("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,insert,delete".split(","),function(a,c){var d=_inArray(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.getSelectedTable;b.addContextmenu({title:b.lang("table"+c),click:function(){b.loadPlugin("table",function(){b.plugin.table[c](),b.hideMenu()})},cond:d,width:170,iconClass:"ke-icon-table"+c})}),b.addContextmenu({title:"-"}),_each("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","),function(a,d){c[d]&&b.afterCreate(function(){_ctrl(this.edit.doc,c[d],function(){b.cmd.selection(),b.clickToolbar(d)})}),b.clickToolbar(d,function(){b.focus().exec(d,null)})}),b.afterCreate(function(){function c(){d.range.moveToBookmark(e),d.select(),_WEBKIT&&(a("div."+h,f).each(function(){a(this).after("
    ").remove(!0)}),a("span.Apple-style-span",f).remove(!0),a("span.Apple-tab-span",f).remove(!0),a("span[style]",f).each(function(){"nowrap"==a(this).css("white-space")&&a(this).remove(!0)}),a("meta",f).remove());var c=f[0].innerHTML;f.remove(),""!==c&&(_WEBKIT&&(c=c.replace(/(
    )\1/gi,"$1")),2===b.pasteType&&(c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/gi,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(c)?c=_clearMsWord(c,b.filterMode?b.htmlTags:a.options.htmlTags):(c=_formatHtml(c,b.filterMode?b.htmlTags:null),c=b.beforeSetHtml(c))),1===b.pasteType&&(c=c.replace(/ /gi," "),c=c.replace(/\n\s*\n/g,"\n"),c=c.replace(/]*>/gi,"\n"),c=c.replace(/<\/p>]*>/gi,"\n"),c=c.replace(/<[^>]+>/g,""),c=c.replace(/ {2}/g,"  "),"p"==b.newlineTag?/\n/.test(c)&&(c=c.replace(/^/,"

    ").replace(/$/,"

    ").replace(/\n/g,"

    ")):c=c.replace(/\n/g,"
    $&")),b.insertHtml(c,!0))}var d,e,f,g=b.edit.doc,h="__kindeditor_paste__",i=!1;a(g.body).bind("paste",function(j){if(0===b.pasteType)return void j.stop();if(!i){if(i=!0,a("div."+h,g).remove(),d=b.cmd.selection(),e=d.range.createBookmark(),f=a('

    ',g).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(e.start).pos().y+"px","white-space":"nowrap"}),a(g.body).append(f),_IE){var k=d.range.get(!0);k.moveToElementText(f[0]),k.select(),k.execCommand("paste"),j.preventDefault()}else d.range.selectNodeContents(f[0]),d.select(),f[0].tabIndex=-1,f[0].focus();setTimeout(function(){c(),i=!1},0)}})}),b.beforeGetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b){return unescape(b)}),a=a.replace(/(]*)?>)/gi,function(a,b,c){return/\s+type="[^"]+"/i.test(a)?a:b+' type="text"'+c})),a.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/gi,function(a,b,c,d){return b+_unescape(c).replace(/\s+/g," ")+d}).replace(/]*class="?ke-(flash|rm|media)"?[^>]*>/gi,function(a){var b=_getAttrList(a),c=_getCssList(b.style||""),d=_mediaAttrs(b["data-ke-tag"]),e=_undef(c.width,""),f=_undef(c.height,"");return/px/i.test(e)&&(e=_removeUnit(e)),/px/i.test(f)&&(f=_removeUnit(f)),d.width=_undef(b.width,e),d.height=_undef(b.height,f),_mediaEmbed(d)}).replace(/]*class="?ke-anchor"?[^>]*>/gi,function(a){var b=_getAttrList(a);return''}).replace(/]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return""+unescape(c)+""}).replace(/]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/gi,function(a,b,c){return""+unescape(c)+""}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/gi,function(a,b,c){return a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(a,b,d){return b+_unescape(c)+d}),a=a.replace(/\s+data-ke-src="[^"]*"/i,"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/gi,function(a,b,c){return b+c})}),b.beforeSetHtml(function(a){return _IE&&8>=_V&&(a=a.replace(/]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/gi,function(a){var b=_getAttrList(a),c=_getCssList(b.style||"");return"none"==c.display?'
    ':a})),a.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/gi,function(a){var c=_getAttrList(a);return c.src=_undef(c.src,""),c.width=_undef(c.width,0),c.height=_undef(c.height,0),_mediaImg(b.themesPath+"common/blank.gif",c)}).replace(/]*name="([^"]+)"[^>]*>(?:<\/a>)?/gi,function(a){var c=_getAttrList(a);return c.href!==undefined?a:''}).replace(/]*)>([\s\S]*?)<\/script>/gi,function(a,b,c){return'
    '+escape(c)+"
    "}).replace(/]*)>([\s\S]*?)<\/noscript>/gi,function(a,b,c){return'
    '+escape(c)+"
    "}).replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/gi,function(a,b,c,d,e){return a.match(/\sdata-ke-src="[^"]*"/i)?a:a=b+c+'="'+d+'" data-ke-src="'+_escape(d)+'"'+e}).replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/gi,function(a,b,c){return b+"data-ke-"+c}).replace(/]*\s+border="0"[^>]*>/gi,function(a){return a.indexOf("ke-zeroborder")>=0?a:_addClassToTag(a,"ke-zeroborder")})})})}}(window),KindEditor.lang({source:"HTML代码",preview:"预览",undo:"后退(Ctrl+Z)",redo:"前进(Ctrl+Y)",cut:"剪切(Ctrl+X)",copy:"复制(Ctrl+C)",paste:"粘贴(Ctrl+V)",plainpaste:"粘贴为无格式文本",wordpaste:"从Word粘贴",selectall:"全选(Ctrl+A)",justifyleft:"左对齐",justifycenter:"居中",justifyright:"右对齐",justifyfull:"两端对齐",insertorderedlist:"编号",insertunorderedlist:"项目符号",indent:"增加缩进",outdent:"减少缩进",subscript:"下标",superscript:"上标",formatblock:"段落",fontname:"字体",fontsize:"文字大小",forecolor:"文字颜色",hilitecolor:"文字背景",bold:"粗体(Ctrl+B)",italic:"斜体(Ctrl+I)",underline:"下划线(Ctrl+U)",strikethrough:"删除线",removeformat:"删除格式",image:"图片",multiimage:"批量图片上传",flash:"Flash",media:"视音频",table:"表格",tablecell:"单元格",hr:"插入横线",emoticons:"插入表情",link:"超级链接",unlink:"取消超级链接",fullscreen:"全屏显示",about:"关于",print:"打印(Ctrl+P)",filemanager:"文件空间",code:"插入程序代码",map:"Google地图",baidumap:"百度地图",lineheight:"行距",clearhtml:"清理HTML代码",pagebreak:"插入分页符",quickformat:"一键排版",insertfile:"插入文件",template:"插入模板",anchor:"锚点",yes:"确定",no:"取消",close:"关闭",editImage:"图片属性",deleteImage:"删除图片",editFlash:"Flash属性",deleteFlash:"删除Flash",editMedia:"视音频属性",deleteMedia:"删除视音频",editLink:"超级链接属性",deleteLink:"取消超级链接",editAnchor:"锚点属性",deleteAnchor:"删除锚点",tableprop:"表格属性",tablecellprop:"单元格属性",tableinsert:"插入表格",tabledelete:"删除表格",tablecolinsertleft:"左侧插入列",tablecolinsertright:"右侧插入列",tablerowinsertabove:"上方插入行",tablerowinsertbelow:"下方插入行",tablerowmerge:"向下合并单元格",tablecolmerge:"向右合并单元格",tablerowsplit:"拆分行",tablecolsplit:"拆分列",tablecoldelete:"删除列",tablerowdelete:"删除行",noColor:"无颜色",pleaseSelectFile:"请选择文件。",invalidImg:"请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",invalidMedia:"请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",invalidWidth:"宽度必须为数字。",invalidHeight:"高度必须为数字。",invalidBorder:"边框必须为数字。",invalidUrl:"请输入有效的URL地址。",invalidRows:"行数为必选项,只允许输入大于0的数字。",invalidCols:"列数为必选项,只允许输入大于0的数字。",invalidPadding:"边距必须为数字。",invalidSpacing:"间距必须为数字。",invalidJson:"服务器发生故障。",uploadSuccess:"上传成功。",cutError:"您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。",copyError:"您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。",pasteError:"您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。",ajaxLoading:"加载中,请稍候 ...",uploadLoading:"上传中,请稍候 ...",uploadError:"上传错误","plainpaste.comment":"请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。","wordpaste.comment":"请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。","code.pleaseInput":"请输入程序代码。","link.url":"URL","link.linkType":"打开类型","link.newWindow":"新窗口","link.selfWindow":"当前窗口","flash.url":"URL","flash.width":"宽度","flash.height":"高度","flash.upload":"上传","flash.viewServer":"文件空间","media.url":"URL","media.width":"宽度","media.height":"高度","media.autostart":"自动播放","media.upload":"上传","media.viewServer":"文件空间","image.remoteImage":"网络图片","image.localImage":"本地上传","image.remoteUrl":"图片地址","image.localUrl":"上传文件","image.size":"图片大小","image.width":"宽","image.height":"高","image.resetSize":"重置大小","image.align":"对齐方式","image.defaultAlign":"默认方式","image.leftAlign":"左对齐","image.rightAlign":"右对齐","image.imgTitle":"图片说明","image.upload":"浏览...","image.viewServer":"图片空间","multiimage.uploadDesc":"允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>","multiimage.startUpload":"开始上传","multiimage.clearAll":"全部清空","multiimage.insertAll":"全部插入","multiimage.queueLimitExceeded":"文件数量超过限制。","multiimage.fileExceedsSizeLimit":"文件大小超过限制。","multiimage.zeroByteFile":"无法上传空文件。","multiimage.invalidFiletype":"文件类型不正确。","multiimage.unknownError":"发生异常,无法上传。","multiimage.pending":"等待上传","multiimage.uploadError":"上传失败","filemanager.emptyFolder":"空文件夹","filemanager.moveup":"移到上一级文件夹","filemanager.viewType":"显示方式:","filemanager.viewImage":"缩略图","filemanager.listImage":"详细信息","filemanager.orderType":"排序方式:","filemanager.fileName":"名称","filemanager.fileSize":"大小","filemanager.fileType":"类型","insertfile.url":"URL","insertfile.title":"文件说明","insertfile.upload":"上传","insertfile.viewServer":"文件空间","table.cells":"单元格数","table.rows":"行数","table.cols":"列数","table.size":"大小","table.width":"宽度","table.height":"高度","table.percent":"%","table.px":"px","table.space":"边距间距","table.padding":"边距","table.spacing":"间距","table.align":"对齐方式","table.textAlign":"水平对齐","table.verticalAlign":"垂直对齐","table.alignDefault":"默认","table.alignLeft":"左对齐","table.alignCenter":"居中","table.alignRight":"右对齐","table.alignTop":"顶部","table.alignMiddle":"中部","table.alignBottom":"底部","table.alignBaseline":"基线","table.border":"边框","table.borderWidth":"边框","table.borderColor":"颜色","table.backgroundColor":"背景颜色","map.address":"地址: ","map.search":"搜索","baidumap.address":"地址: ","baidumap.search":"搜索","baidumap.insertDynamicMap":"插入动态地图","anchor.name":"锚点名称","formatblock.formatBlock":{h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",p:"正 文"},"fontname.fontName":{SimSun:"宋体",NSimSun:"新宋体",FangSong_GB2312:"仿宋_GB2312",KaiTi_GB2312:"楷体_GB2312",SimHei:"黑体","Microsoft YaHei":"微软雅黑",Arial:"Arial","Arial Black":"Arial Black","Times New Roman":"Times New Roman","Courier New":"Courier New",Tahoma:"Tahoma",Verdana:"Verdana"},"lineheight.lineHeight":[{1:"单倍行距"},{1.5:"1.5倍行距"},{2:"2倍行距"},{2.5:"2.5倍行距"},{3:"3倍行距"}],"template.selectTemplate":"可选模板","template.replaceContent":"替换当前内容","template.fileList":{"1.html":"图片和文字","2.html":"表格","3.html":"项目编号"}},"zh-CN"),KindEditor.options.langType="zh-CN",KindEditor.plugin("anchor",function(a){var b=this,c="anchor",d=b.lang(c+".");b.plugin.anchor={edit:function(){var e=['
    ','
    ','",'',"
    ","
    "].join(""),f=b.createDialog({name:c,width:300,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(){b.insertHtml('').hideDialog().focus()}}}),g=f.div,h=a('input[name="name"]',g),i=b.plugin.getSelectedAnchor();i&&h.val(unescape(i.attr("data-ke-name"))),h[0].focus(),h[0].select()},"delete":function(){b.plugin.getSelectedAnchor().remove()}},b.clickToolbar(c,b.plugin.anchor.edit)}),KindEditor.plugin("autoheight",function(a){function b(){var a=e.edit,b=a.doc.body;a.iframe[0].scroll="no",b.style.overflowY="hidden"}function c(){var b=e.edit,c=b.doc.body;b.iframe.height(f),e.resize(null,Math.max((a.IE?c.scrollHeight:c.offsetHeight)+76,f))}function d(){f=a.removeUnit(e.height),e.edit.afterChange(c),b(),c()}var e=this;if(e.autoHeightMode){var f;e.isCreated?d():e.afterCreate(d)}}),KindEditor.plugin("baidumap",function(a){var b=this,c="baidumap",d=b.lang(c+"."),e=a.undef(b.mapWidth,558),f=a.undef(b.mapHeight,360);b.clickToolbar(c,function(){function g(){h=p[0].contentWindow,i=a.iframeDoc(p)}var h,i,j=['
    ','
    ','
    ',d.address+' ','','',"","
    ",'
    ',' ","
    ",'
    ',"
    ",'
    ',"
    "].join(""),k=b.createDialog({name:c,width:e+42,title:b.lang(c),body:j,yesBtn:{name:b.lang("yes"),click:function(){var a=h.map,c=a.getCenter(),d=c.lng+","+c.lat,g=a.getZoom(),i=[o[0].checked?b.pluginsPath+"baidumap/index.html":"http://api.map.baidu.com/staticimage","?center="+encodeURIComponent(d),"&zoom="+encodeURIComponent(g),"&width="+e,"&height="+f,"&markers="+encodeURIComponent(d),"&markerStyles="+encodeURIComponent("l,A")].join("");o[0].checked?b.insertHtml(''):b.exec("insertimage",i),b.hideDialog().focus()}},beforeRemove:function(){n.remove(),i&&i.write(""),p.remove()}}),l=k.div,m=a('[name="address"]',l),n=a('[name="searchBtn"]',l),o=a('[name="insertDynamicMap"]',k.div),p=a('');p.bind("load",function(){p.unbind("load"),a.IE?g():setTimeout(g,0)}),a(".ke-map",l).replaceWith(p),n.click(function(){h.search(m.val())})})}),KindEditor.plugin("map",function(a){var b=this,c="map",d=b.lang(c+".");b.clickToolbar(c,function(){function e(){f=m[0].contentWindow,g=a.iframeDoc(m)}var f,g,h=['
    ','
    ',d.address+' ','','',"","
    ",'
    ',"
    "].join(""),i=b.createDialog({name:c,width:600,title:b.lang(c),body:h,yesBtn:{name:b.lang("yes"),click:function(){var a=(f.geocoder,f.map),c=a.getCenter().lat()+","+a.getCenter().lng(),d=a.getZoom(),e=a.getMapTypeId(),g="http://maps.googleapis.com/maps/api/staticmap";g+="?center="+encodeURIComponent(c),g+="&zoom="+encodeURIComponent(d),g+="&size=558x360",g+="&maptype="+encodeURIComponent(e),g+="&markers="+encodeURIComponent(c),g+="&language="+b.langType,g+="&sensor=false",b.exec("insertimage",g).hideDialog().focus()}},beforeRemove:function(){l.remove(),g&&g.write(""),m.remove()}}),j=i.div,k=a('[name="address"]',j),l=a('[name="searchBtn"]',j),m=(["",'',"",'',"","",'','
    ',""].join("\n"),a(''));m.bind("load",function(){m.unbind("load"),a.IE?e():setTimeout(e,0)}),a(".ke-map",j).replaceWith(m),l.click(function(){f.search(k.val())})})}),KindEditor.plugin("clearhtml",function(a){var b=this,c="clearhtml";b.clickToolbar(c,function(){b.focus();var c=b.html();c=c.replace(/(]*>)([\s\S]*?)(<\/script>)/gi,""),c=c.replace(/(]*>)([\s\S]*?)(<\/style>)/gi,""),c=a.formatHtml(c,{a:["href","target"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],img:["src","width","height","border","alt","title",".width",".height"],table:["border"],"td,th":["rowspan","colspan"],"div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":[]}),b.html(c),b.cmd.selection(!0),b.addBookmark()})}),KindEditor.plugin("code",function(a){var b=this,c="code";b.clickToolbar(c,function(){var d=b.lang(c+"."),e=['
    ','
    ','","
    ",'',"
    "].join(""),f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(){var c=a(".ke-code-type",f.div).val(),e=g.val(),h=""===c?"":" lang-"+c,i='
    \n'+a.escape(e)+"
    ";return""===a.trim(e)?(alert(d.pleaseInput),void g[0].focus()):void b.insertHtml(i).hideDialog().focus()}}}),g=a("textarea",f.div);g[0].focus()})}),KindEditor.plugin("emoticons",function(a){var b=this,c="emoticons",d=b.emoticonsPath||b.pluginsPath+"emoticons/images/",e=void 0===b.allowPreviewEmoticons?!0:b.allowPreviewEmoticons,f=1;b.clickToolbar(c,function(){function g(c,e,f){c.mouseover(v?function(){e>r?(v.css("left",0),v.css("right","")):(v.css("left",""),v.css("right",0)),w.attr("src",d+f+".gif"),a(this).addClass("ke-on")}:function(){a(this).addClass("ke-on")}),c.mouseout(function(){a(this).removeClass("ke-on")}),c.click(function(a){b.insertHtml('').hideMenu().focus(),a.stop()})}function h(b,c){var e=document.createElement("table");c.append(e),v&&(a(e).mouseover(function(){v.show("block")}),a(e).mouseout(function(){v.hide()}),t.push(a(e))),e.className="ke-table",e.cellPadding=0,e.cellSpacing=0,e.border=0;for(var f=(b-1)*p+o,h=0;l>h;h++)for(var i=e.insertRow(h),j=0;m>j;j++){var k=a(i.insertCell(j));k.addClass("ke-cell"),g(k,j,f);var n=a('').css("background-position","-"+24*f+"px 0px").css("background-image","url("+d+"static.gif)");k.append(n),t.push(k),f++}return e}function i(){a.each(t,function(){this.unbind()})}function j(a,b){a.click(function(a){i(),y.parentNode.removeChild(y),x.remove(),y=h(b,s),k(b),f=b,a.stop()})}function k(b){x=a('
    '),s.append(x);for(var c=1;q>=c;c++){if(b!==c){var d=a('
    ['+c+"]");j(d,c),x.append(d),t.push(d)}else x.append(a("@["+c+"]"));x.append(a("@ "))}}var l=5,m=9,n=135,o=0,p=l*m,q=Math.ceil(n/p),r=Math.floor(m/2),s=a('
    '),t=[],u=b.createMenu({name:c,beforeRemove:function(){i()}});u.div.append(s);var v,w;e&&(v=a('
    ').css("right",0),w=a(''),s.append(v),v.append(w));var x,y=h(f,s);k(f)})}),KindEditor.plugin("filemanager",function(a){function b(a,b,c){return a+" ("+Math.ceil(b/1024)+"KB, "+c+")"}function c(a,c){c.is_dir?a.attr("title",c.filename):a.attr("title",b(c.filename,c.filesize,c.datetime))}var d=this,e="filemanager",f=a.undef(d.fileManagerJson,d.basePath+"php/file_manager_json.php"),g=d.pluginsPath+e+"/images/",h=d.lang(e+".");d.plugin.filemanagerDialog=function(b){function i(b,c,e){var g="path="+b+"&order="+c+"&dir="+p;t.showLoading(d.lang("ajaxLoading")),a.ajax(a.addParam(f,g+"&"+(new Date).getTime()),function(a){t.hideLoading(),e(a)})}function j(b,c,d,e){var f=a.formatUrl(c.current_url+d.filename,"absolute"),g=encodeURIComponent(c.current_dir_path+d.filename+"/");b.click(d.is_dir?function(){i(g,y.val(),e)}:d.is_photo?function(){r.call(this,f,d.filename)}:function(){r.call(this,f,d.filename)}),z.push(b)}function k(b,c){function d(){"VIEW"==x.val()?i(b.current_dir_path,y.val(),m):i(b.current_dir_path,y.val(),l)}a.each(z,function(){this.unbind()}),w.unbind(),x.unbind(),y.unbind(),b.current_dir_path&&w.click(function(){i(b.moveup_dir_path,y.val(),c)}),x.change(d),y.change(d),v.html("")}function l(b){k(b,l);var c=document.createElement("table");c.className="ke-table",c.cellPadding=0,c.cellSpacing=0,c.border=0,v.append(c);for(var d=b.file_list,e=0,f=d.length;f>e;e++){var i=d[e],m=a(c.insertRow(e));m.mouseover(function(){a(this).addClass("ke-on")}).mouseout(function(){a(this).removeClass("ke-on")});var n=g+(i.is_dir?"folder-16.gif":"file-16.gif"),o=a(''+i.filename+''),p=a(m[0].insertCell(0)).addClass("ke-cell ke-name").append(o).append(document.createTextNode(" "+i.filename));!i.is_dir||i.has_file?(m.css("cursor","pointer"),p.attr("title",i.filename),j(p,b,i,l)):p.attr("title",h.emptyFolder),a(m[0].insertCell(1)).addClass("ke-cell ke-size").html(i.is_dir?"-":Math.ceil(i.filesize/1024)+"KB"),a(m[0].insertCell(2)).addClass("ke-cell ke-datetime").html(i.datetime)}}function m(b){k(b,m);for(var d=b.file_list,e=0,f=d.length;f>e;e++){var i=d[e],l=a('
    ');v.append(l);var n=a('
    ').mouseover(function(){a(this).addClass("ke-on")}).mouseout(function(){a(this).removeClass("ke-on")});l.append(n);var o=b.current_url+i.filename,p=i.is_dir?g+"folder-64.gif":i.is_photo?o:g+"file-64.gif",q=a(''+i.filename+'');!i.is_dir||i.has_file?(n.css("cursor","pointer"),c(n,i),j(n,b,i,m)):n.attr("title",h.emptyFolder),n.append(q),l.append('
    '+i.filename+"
    ")}}var n=a.undef(b.width,650),o=a.undef(b.height,510),p=a.undef(b.dirName,""),q=a.undef(b.viewType,"VIEW").toUpperCase(),r=b.clickFn,s=['
    ','
    ','
    ',' ',''+h.moveup+"","
    ",'
    ',h.viewType+' ",h.orderType+' ","
    ",'
    ',"
    ",'
    ',"
    "].join(""),t=d.createDialog({name:e,width:n,height:o,title:d.lang(e),body:s}),u=t.div,v=a(".ke-plugin-filemanager-body",u),w=(a('[name="moveupImg"]',u),a('[name="moveupLink"]',u)),x=(a('[name="viewServer"]',u),a('[name="viewType"]',u)),y=a('[name="orderType"]',u),z=[];return x.val(q),i("",y.val(),"VIEW"==q?m:l),t}}),KindEditor.plugin("flash",function(a){var b=this,c="flash",d=b.lang(c+"."),e=a.undef(b.allowFlashUpload,!0),f=a.undef(b.allowFileManager,!1),g=a.undef(b.formatUploadUrl,!0),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=a.undef(b.uploadJson,b.basePath+"php/upload_json.php");b.plugin.flash={edit:function(){var k=['
    ','
    ','",'  ','  ','','',"","
    ",'
    ','",' ',"
    ",'
    ','",' ',"
    ","
    "].join(""),l=b.createDialog({name:c,width:450,title:b.lang(c),body:k,yesBtn:{name:b.lang("yes"),click:function(){var c=a.trim(n.val()),d=p.val(),e=q.val();if("http://"==c||a.invalidUrl(c))return alert(b.lang("invalidUrl")),void n[0].focus();if(!/^\d*$/.test(d))return alert(b.lang("invalidWidth")),void p[0].focus();if(!/^\d*$/.test(e))return alert(b.lang("invalidHeight")),void q[0].focus();var f=a.mediaImg(b.themesPath+"common/blank.gif",{src:c,type:a.mediaType(".swf"),width:d,height:e,quality:"high"});b.insertHtml(f).hideDialog().focus()}}}),m=l.div,n=a('[name="url"]',m),o=a('[name="viewServer"]',m),p=a('[name="width"]',m),q=a('[name="height"]',m);if(n.val("http://"),e){var r=a.uploadbutton({button:a(".ke-upload-button",m)[0],fieldName:i,extraParams:h,url:a.addParam(j,"dir=flash"),afterUpload:function(d){if(l.hideLoading(),0===d.error){var e=d.url;g&&(e=a.formatUrl(e,"absolute")),n.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){l.hideLoading(),b.errorDialog(a)}});r.fileBox.change(function(){l.showLoading(b.lang("uploadLoading")),r.submit()})}else a(".ke-upload-button",m).hide();f?o.click(function(){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"flash",clickFn:function(c){b.dialogs.length>1&&(a('[name="url"]',m).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):o.hide();var s=b.plugin.getSelectedFlash();if(s){var t=a.mediaAttrs(s.attr("data-ke-tag"));n.val(t.src),p.val(a.removeUnit(s.css("width"))||t.width||0),q.val(a.removeUnit(s.css("height"))||t.height||0)}n[0].focus(),n[0].select()},"delete":function(){b.plugin.getSelectedFlash().remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.flash.edit)}),KindEditor.plugin("image",function(a){var b=this,c="image",d=a.undef(b.allowImageUpload,!0),e=a.undef(b.allowImageRemote,!0),f=a.undef(b.formatUploadUrl,!0),g=a.undef(b.allowFileManager,!1),h=a.undef(b.uploadJson,b.basePath+"php/upload_json.php"),i=a.undef(b.imageTabIndex,0),j=b.pluginsPath+"image/images/",k=a.undef(b.extraFileUploadParams,{}),l=a.undef(b.filePostName,"imgFile"),m=a.undef(b.fillDescAfterUploadImage,!1),n=b.lang(c+".");b.plugin.imageDialog=function(d){function e(a,b){D.val(a),E.val(b),J=a,K=b}var i=(d.imageUrl,a.undef(d.imageWidth,""),a.undef(d.imageHeight,""),a.undef(d.imageTitle,""),a.undef(d.imageAlign,""),a.undef(d.showRemote,!0)),o=a.undef(d.showLocal,!0),p=a.undef(d.tabIndex,0),q=d.clickFn,r="kindeditor_upload_iframe_"+(new Date).getTime(),s=[];for(var t in k)s.push('');var u,v=['
    ','
    ','",'","
    "].join(""),w=o||g?450:400,x=o&&i?300:250,y=b.createDialog({name:c,width:w,height:x,title:b.lang(c),body:v,yesBtn:{name:b.lang("yes"),click:function(){if(!y.isLoading){if(o&&i&&u&&1===u.selectedIndex||!i)return""==I.fileBox.val()?void alert(b.lang("pleaseSelectFile")):(y.showLoading(b.lang("uploadLoading")),I.submit(),void B.val(""));var c=a.trim(A.val()),d=D.val(),e=E.val(),f=G.val(),g="";return H.each(function(){return this.checked?(g=this.value,!1):void 0}),"http://"==c||a.invalidUrl(c)?(alert(b.lang("invalidUrl")),void A[0].focus()):/^\d*$/.test(d)?/^\d*$/.test(e)?void q.call(b,c,f,d,e,0,g):(alert(b.lang("invalidHeight")),void E[0].focus()):(alert(b.lang("invalidWidth")),void D[0].focus())}}},beforeRemove:function(){C.unbind(),D.unbind(),E.unbind(),F.unbind()}}),z=y.div,A=a('[name="url"]',z),B=a('[name="localUrl"]',z),C=a('[name="viewServer"]',z),D=a('.tab1 [name="width"]',z),E=a('.tab1 [name="height"]',z),F=a(".ke-refresh-btn",z),G=a('.tab1 [name="title"]',z),H=a('.tab1 [name="align"]',z);i&&o?(u=a.tabs({src:a(".tabs",z),afterSelect:function(){}}),u.add({title:n.remoteImage,panel:a(".tab1",z)}),u.add({title:n.localImage,panel:a(".tab2",z)}),u.select(p)):i?a(".tab1",z).show():o&&a(".tab2",z).show(); +var I=a.uploadbutton({button:a(".ke-upload-button",z)[0],fieldName:l,form:a(".ke-form",z),target:r,width:60,afterUpload:function(d){if(y.hideLoading(),0===d.error){var e=d.url;f&&(e=a.formatUrl(e,"absolute")),b.afterUpload&&b.afterUpload.call(b,e,d,c),m?(a(".ke-dialog-row #remoteUrl",z).val(e),a(".ke-tabs-li",z)[0].click(),a(".ke-refresh-btn",z).click()):q.call(b,e,d.title,d.width,d.height,d.border,d.align)}else alert(d.message)},afterError:function(a){y.hideLoading(),b.errorDialog(a)}});I.fileBox.change(function(){B.val(I.fileBox.val())}),g?C.click(function(){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"VIEW",dirName:"image",clickFn:function(c){b.dialogs.length>1&&(a('[name="url"]',z).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):C.hide();var J=0,K=0;return F.click(function(){var b=a('',document).css({position:"absolute",visibility:"hidden",top:0,left:"-1000px"});b.bind("load",function(){e(b.width(),b.height()),b.remove()}),a(document.body).append(b)}),D.change(function(){J>0&&E.val(Math.round(K/J*parseInt(this.value,10)))}),E.change(function(){K>0&&D.val(Math.round(J/K*parseInt(this.value,10)))}),A.val(d.imageUrl),e(d.imageWidth,d.imageHeight),G.val(d.imageTitle),H.each(function(){return this.value===d.imageAlign?(this.checked=!0,!1):void 0}),i&&0===p&&(A[0].focus(),A[0].select()),y},b.plugin.image={edit:function(){var a=b.plugin.getSelectedImage();b.plugin.imageDialog({imageUrl:a?a.attr("data-ke-src"):"http://",imageWidth:a?a.width():"",imageHeight:a?a.height():"",imageTitle:a?a.attr("title"):"",imageAlign:a?a.attr("align"):"",showRemote:e,showLocal:d,tabIndex:a?0:i,clickFn:function(c,d,e,f,g,h){a?(a.attr("src",c),a.attr("data-ke-src",c),a.attr("width",e),a.attr("height",f),a.attr("title",d),a.attr("align",h),a.attr("alt",d)):b.exec("insertimage",c,d,e,f,g,h),setTimeout(function(){b.hideDialog().focus()},0)}})},"delete":function(){var a=b.plugin.getSelectedImage();"a"==a.parent().name&&(a=a.parent()),a.remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.image.edit)}),KindEditor.plugin("insertfile",function(a){var b=this,c="insertfile",d=a.undef(b.allowFileUpload,!0),e=a.undef(b.allowFileManager,!1),f=a.undef(b.formatUploadUrl,!0),g=a.undef(b.uploadJson,b.basePath+"php/upload_json.php"),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=b.lang(c+".");b.plugin.fileDialog=function(k){var l=a.undef(k.fileUrl,"http://"),m=a.undef(k.fileTitle,""),n=k.clickFn,o=['
    ','
    ','",'  ','  ','','',"","
    ",'
    ','",'
    ',"
    ","",""].join(""),p=b.createDialog({name:c,width:450,title:b.lang(c),body:o,yesBtn:{name:b.lang("yes"),click:function(){var c=a.trim(r.val()),d=t.val();return"http://"==c||a.invalidUrl(c)?(alert(b.lang("invalidUrl")),void r[0].focus()):(""===a.trim(d)&&(d=c),void n.call(b,c,d))}}}),q=p.div,r=a('[name="url"]',q),s=a('[name="viewServer"]',q),t=a('[name="title"]',q);if(d){var u=a.uploadbutton({button:a(".ke-upload-button",q)[0],fieldName:i,url:a.addParam(g,"dir=file"),extraParams:h,afterUpload:function(d){if(p.hideLoading(),0===d.error){var e=d.url;f&&(e=a.formatUrl(e,"absolute")),r.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){p.hideLoading(),b.errorDialog(a)}});u.fileBox.change(function(){p.showLoading(b.lang("uploadLoading")),u.submit()})}else a(".ke-upload-button",q).hide();e?s.click(function(){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"file",clickFn:function(c){b.dialogs.length>1&&(a('[name="url"]',q).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):s.hide(),r.val(l),t.val(m),r[0].focus(),r[0].select()},b.clickToolbar(c,function(){b.plugin.fileDialog({clickFn:function(a,c){var d=''+c+"";b.insertHtml(d).hideDialog().focus()}})})}),KindEditor.plugin("lineheight",function(a){var b=this,c="lineheight",d=b.lang(c+".");b.clickToolbar(c,function(){var e="",f=b.cmd.commonNode({"*":".line-height"});f&&(e=f.css("line-height"));var g=b.createMenu({name:c,width:150});a.each(d.lineHeight,function(c,d){a.each(d,function(a,c){g.addItem({title:c,checked:e===a,click:function(){b.cmd.toggle('',{span:".line-height="+a}),b.updateState(),b.addBookmark(),b.hideMenu()}})})})})}),KindEditor.plugin("link",function(a){var b=this,c="link";b.plugin.link={edit:function(){var d=b.lang(c+"."),e='
    ',f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(){var c=a.trim(h.val());return"http://"==c||a.invalidUrl(c)?(alert(b.lang("invalidUrl")),void h[0].focus()):void b.exec("createlink",c,i.val()).hideDialog().focus()}}}),g=f.div,h=a('input[name="url"]',g),i=a('select[name="type"]',g);h.val("http://"),i[0].options[0]=new Option(d.newWindow,"_blank"),i[0].options[1]=new Option(d.selfWindow,""),b.cmd.selection();var j=b.plugin.getSelectedLink();j&&(b.cmd.range.selectNode(j[0]),b.cmd.select(),h.val(j.attr("data-ke-src")),i.val(j.attr("target"))),h[0].focus(),h[0].select()},"delete":function(){b.exec("unlink",null)}},b.clickToolbar(c,b.plugin.link.edit)}),KindEditor.plugin("media",function(a){var b=this,c="media",d=b.lang(c+"."),e=a.undef(b.allowMediaUpload,!0),f=a.undef(b.allowFileManager,!1),g=a.undef(b.formatUploadUrl,!0),h=a.undef(b.extraFileUploadParams,{}),i=a.undef(b.filePostName,"imgFile"),j=a.undef(b.uploadJson,b.basePath+"php/upload_json.php");b.plugin.media={edit:function(){var k=['
    ','
    ','",'  ','  ','','',"","
    ",'
    ','",'',"
    ",'
    ','",'',"
    ",'
    ','",' ',"
    ","
    "].join(""),l=b.createDialog({name:c,width:450,height:230,title:b.lang(c),body:k,yesBtn:{name:b.lang("yes"),click:function(){var c=a.trim(n.val()),d=p.val(),e=q.val();if("http://"==c||a.invalidUrl(c))return alert(b.lang("invalidUrl")),void n[0].focus();if(!/^\d*$/.test(d))return alert(b.lang("invalidWidth")),void p[0].focus();if(!/^\d*$/.test(e))return alert(b.lang("invalidHeight")),void q[0].focus();var f=a.mediaImg(b.themesPath+"common/blank.gif",{src:c,type:a.mediaType(c),width:d,height:e,autostart:r[0].checked?"true":"false",loop:"true"});b.insertHtml(f).hideDialog().focus()}}}),m=l.div,n=a('[name="url"]',m),o=a('[name="viewServer"]',m),p=a('[name="width"]',m),q=a('[name="height"]',m),r=a('[name="autostart"]',m);if(n.val("http://"),e){var s=a.uploadbutton({button:a(".ke-upload-button",m)[0],fieldName:i,extraParams:h,url:a.addParam(j,"dir=media"),afterUpload:function(d){if(l.hideLoading(),0===d.error){var e=d.url;g&&(e=a.formatUrl(e,"absolute")),n.val(e),b.afterUpload&&b.afterUpload.call(b,e,d,c),alert(b.lang("uploadSuccess"))}else alert(d.message)},afterError:function(a){l.hideLoading(),b.errorDialog(a)}});s.fileBox.change(function(){l.showLoading(b.lang("uploadLoading")),s.submit()})}else a(".ke-upload-button",m).hide();f?o.click(function(){b.loadPlugin("filemanager",function(){b.plugin.filemanagerDialog({viewType:"LIST",dirName:"media",clickFn:function(c){b.dialogs.length>1&&(a('[name="url"]',m).val(c),b.afterSelectFile&&b.afterSelectFile.call(b,c),b.hideDialog())}})})}):o.hide();var t=b.plugin.getSelectedMedia();if(t){var u=a.mediaAttrs(t.attr("data-ke-tag"));n.val(u.src),p.val(a.removeUnit(t.css("width"))||u.width||0),q.val(a.removeUnit(t.css("height"))||u.height||0),r[0].checked="true"===u.autostart}n[0].focus(),n[0].select()},"delete":function(){b.plugin.getSelectedMedia().remove(),b.addBookmark()}},b.clickToolbar(c,b.plugin.media.edit)}),function(a){function b(a){this.init(a)}a.extend(b,{init:function(b){function c(b,c){a(".ke-status > div",b).hide(),a(".ke-message",b).addClass("ke-error").show().html(a.escape(c))}var d=this;b.afterError=b.afterError||function(a){alert(a)},d.options=b,d.progressbars={},d.div=a(b.container).html(['
    ','
    ','
    ','',"
    ",'
    '+b.uploadDesc+"
    ",'','',"","
    ",'
    ',"
    "].join("")),d.bodyDiv=a(".ke-swfupload-body",d.div);var e={debug:!1,upload_url:b.uploadUrl,flash_url:b.flashUrl,file_post_name:b.filePostName,button_placeholder:a(".ke-swfupload-button > input",d.div)[0],button_image_url:b.buttonImageUrl,button_width:b.buttonWidth,button_height:b.buttonHeight,button_cursor:SWFUpload.CURSOR.HAND,file_types:b.fileTypes,file_types_description:b.fileTypesDesc,file_upload_limit:b.fileUploadLimit,file_size_limit:b.fileSizeLimit,post_params:b.postParams,file_queued_handler:function(a){a.url=d.options.fileIconUrl,d.appendFile(a)},file_queue_error_handler:function(c,d){var e="";switch(d){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:e=b.queueLimitExceeded;break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:e=b.fileExceedsSizeLimit;break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:e=b.zeroByteFile;break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:e=b.invalidFiletype;break;default:e=b.unknownError}a.DEBUG&&alert(e)},upload_start_handler:function(b){var c=this,d=a('div[data-id="'+b.id+'"]',c.bodyDiv);a(".ke-status > div",d).hide(),a(".ke-progressbar",d).show()},upload_progress_handler:function(a,b,c){var e=Math.round(100*b/c),f=d.progressbars[a.id];f.bar.css("width",Math.round(80*e/100)+"px"),f.percent.html(e+"%")},upload_error_handler:function(b){if(b&&b.filestatus==SWFUpload.FILE_STATUS.ERROR){var e=a('div[data-id="'+b.id+'"]',d.bodyDiv).eq(0);c(e,d.options.errorMessage)}},upload_success_handler:function(b,e){var f=a('div[data-id="'+b.id+'"]',d.bodyDiv).eq(0),g={};try{g=a.json(e)}catch(h){d.options.afterError.call(this,""+e+"")}return 0!==g.error?void c(f,a.DEBUG?g.message:d.options.errorMessage):(b.url=g.url,a(".ke-img",f).attr("src",b.url).attr("data-status",b.filestatus).data("data",g),void a(".ke-status > div",f).hide())}};d.swfu=new SWFUpload(e),a(".ke-swfupload-startupload input",d.div).click(function(){d.swfu.startUpload()})},getUrlList:function(){var b=[];return a(".ke-img",self.bodyDiv).each(function(){var c=a(this),d=c.attr("data-status");d==SWFUpload.FILE_STATUS.COMPLETE&&b.push(c.data("data"))}),b},removeFile:function(b){var c=this;c.swfu.cancelUpload(b);var d=a('div[data-id="'+b+'"]',c.bodyDiv);a(".ke-photo",d).unbind(),a(".ke-delete",d).unbind(),d.remove()},removeFiles:function(){var b=this;a(".ke-item",b.bodyDiv).each(function(){b.removeFile(a(this).attr("data-id"))})},appendFile:function(b){var c=this,d=a('
    ');c.bodyDiv.append(d);var e=a('
    ').mouseover(function(){a(this).addClass("ke-on")}).mouseout(function(){a(this).removeClass("ke-on")});d.append(e);var f=a(''+b.name+'');e.append(f),a('').appendTo(e).click(function(){c.removeFile(b.id)});var g=a('
    ').appendTo(e);a(['
    ','
    ','
    0%
    '].join("")).hide().appendTo(g),a('
    '+c.options.pendingMessage+"
    ").appendTo(g),d.append('
    '+b.name+"
    "),c.progressbars[b.id]={bar:a(".ke-progressbar-bar-inner",e),percent:a(".ke-progressbar-percent",e)}},remove:function(){this.removeFiles(),this.swfu.destroy(),this.div.html("")}}),a.swfupload=function(a,c){return new b(a,c)}}(KindEditor),KindEditor.plugin("multiimage",function(a){var b=this,c="multiimage",d=(a.undef(b.formatUploadUrl,!0),a.undef(b.uploadJson,b.basePath+"php/upload_json.php")),e=b.pluginsPath+"multiimage/images/",f=a.undef(b.imageSizeLimit,"1MB"),g=(a.undef(b.imageFileTypes,"*.jpg;*.gif;*.png"),a.undef(b.imageUploadLimit,20)),h=a.undef(b.filePostName,"imgFile"),i=b.lang(c+".");b.plugin.multiImageDialog=function(j){var k=j.clickFn,l=a.tmpl(i.uploadDesc,{uploadLimit:g,sizeLimit:f}),m=['
    ','
    ',"
    ","
    "].join(""),n=b.createDialog({name:c,width:650,height:510,title:b.lang(c),body:m,previewBtn:{name:i.insertAll,click:function(){k.call(b,p.getUrlList())}},yesBtn:{name:i.clearAll,click:function(){p.removeFiles()}},beforeRemove:function(){(!a.IE||a.V<=8)&&p.remove()}}),o=n.div,p=a.swfupload({container:a(".swfupload",o),buttonImageUrl:e+("zh-CN"==b.langType?"select-files-zh-CN.png":"select-files-en.png"),buttonWidth:"zh-CN"==b.langType?72:88,buttonHeight:23,fileIconUrl:e+"image.png",uploadDesc:l,startButtonValue:i.startUpload,uploadUrl:a.addParam(d,"dir=image"),flashUrl:e+"swfupload.swf",filePostName:h,fileTypes:"*.jpg;*.jpeg;*.gif;*.png;*.bmp",fileTypesDesc:"Image Files",fileUploadLimit:g,fileSizeLimit:f,postParams:a.undef(b.extraFileUploadParams,{}),queueLimitExceeded:i.queueLimitExceeded,fileExceedsSizeLimit:i.fileExceedsSizeLimit,zeroByteFile:i.zeroByteFile,invalidFiletype:i.invalidFiletype,unknownError:i.unknownError,pendingMessage:i.pending,errorMessage:i.uploadError,afterError:function(a){b.errorDialog(a)}});return n},b.clickToolbar(c,function(){b.plugin.multiImageDialog({clickFn:function(c){0!==c.length&&(a.each(c,function(a,c){b.afterUpload&&b.afterUpload.call(b,c.url,c,"multiimage"),b.exec("insertimage",c.url,c.title,c.width,c.height,c.border,c.align)}),setTimeout(function(){b.hideDialog().focus()},0))}})})}),function(){window.SWFUpload=function(a){this.initSWFUpload(a)},SWFUpload.prototype.initSWFUpload=function(a){try{this.customSettings={},this.settings=a,this.eventQueue=[],this.movieName="KindEditor_SWFUpload_"+SWFUpload.movieCount++,this.movieElement=null,SWFUpload.instances[this.movieName]=this,this.initSettings(),this.loadFlash(),this.displayDebugInfo()}catch(b){throw delete SWFUpload.instances[this.movieName],b}},SWFUpload.instances={},SWFUpload.movieCount=0,SWFUpload.version="2.2.0 2009-03-25",SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130},SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290},SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5},SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120},SWFUpload.CURSOR={ARROW:-1,HAND:-2},SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"},SWFUpload.completeURL=function(a){if("string"!=typeof a||a.match(/^https?:\/\//i)||a.match(/^\//))return a;var b=(window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),window.location.pathname.lastIndexOf("/"));return path=0>=b?"/":window.location.pathname.substr(0,b)+"/",path+a},SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(a,b){this.settings[a]=void 0==this.settings[a]?b:this.settings[a]},this.ensureDefault("upload_url",""),this.ensureDefault("preserve_relative_urls",!1),this.ensureDefault("file_post_name","Filedata"),this.ensureDefault("post_params",{}),this.ensureDefault("use_query_string",!1),this.ensureDefault("requeue_on_error",!1),this.ensureDefault("http_success",[]),this.ensureDefault("assume_success_timeout",0),this.ensureDefault("file_types","*.*"),this.ensureDefault("file_types_description","All Files"),this.ensureDefault("file_size_limit",0),this.ensureDefault("file_upload_limit",0),this.ensureDefault("file_queue_limit",0),this.ensureDefault("flash_url","swfupload.swf"),this.ensureDefault("prevent_swf_caching",!0),this.ensureDefault("button_image_url",""),this.ensureDefault("button_width",1),this.ensureDefault("button_height",1),this.ensureDefault("button_text",""),this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;"),this.ensureDefault("button_text_top_padding",0),this.ensureDefault("button_text_left_padding",0),this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES),this.ensureDefault("button_disabled",!1),this.ensureDefault("button_placeholder_id",""),this.ensureDefault("button_placeholder",null),this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW),this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW),this.ensureDefault("debug",!1),this.settings.debug_enabled=this.settings.debug,this.settings.return_upload_start_handler=this.returnUploadStart,this.ensureDefault("swfupload_loaded_handler",null),this.ensureDefault("file_dialog_start_handler",null),this.ensureDefault("file_queued_handler",null),this.ensureDefault("file_queue_error_handler",null),this.ensureDefault("file_dialog_complete_handler",null),this.ensureDefault("upload_start_handler",null),this.ensureDefault("upload_progress_handler",null),this.ensureDefault("upload_error_handler",null),this.ensureDefault("upload_success_handler",null),this.ensureDefault("upload_complete_handler",null),this.ensureDefault("debug_handler",this.debugMessage),this.ensureDefault("custom_settings",{}),this.customSettings=this.settings.custom_settings,this.settings.prevent_swf_caching&&(this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+(new Date).getTime()),this.settings.preserve_relative_urls||(this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url),this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)),delete this.ensureDefault},SWFUpload.prototype.loadFlash=function(){var a,b;if(null!==document.getElementById(this.movieName))throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";if(a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder,void 0==a)throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;b=document.createElement("div"),b.innerHTML=this.getFlashHTML(),a.parentNode.replaceChild(b.firstChild,a),void 0==window[this.movieName]&&(window[this.movieName]=this.getMovieElement())},SWFUpload.prototype.getFlashHTML=function(){var a="";return KindEditor.IE&&KindEditor.V>8&&(a=' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'),['','','','','','','',""].join("")},SWFUpload.prototype.getFlashVars=function(){var a=this.buildParamString(),b=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(b),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(a),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")},SWFUpload.prototype.getMovieElement=function(){if(void 0==this.movieElement&&(this.movieElement=document.getElementById(this.movieName)),null===this.movieElement)throw"Could not find Flash element";return this.movieElement},SWFUpload.prototype.buildParamString=function(){var a=this.settings.post_params,b=[];if("object"==typeof a)for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c.toString())+"="+encodeURIComponent(a[c].toString()));return b.join("&")},SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,!1);var a=null;if(a=this.getMovieElement(),a&&"unknown"==typeof a.CallFunction){for(var b in a)try{"function"==typeof a[b]&&(a[b]=null)}catch(c){}try{a.parentNode.removeChild(a)}catch(d){}}return window[this.movieName]=null,SWFUpload.instances[this.movieName]=null,delete SWFUpload.instances[this.movieName],this.movieElement=null,this.settings=null,this.customSettings=null,this.eventQueue=null,this.movieName=null,!0}catch(e){return!1}},SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n"," ","upload_url: ",this.settings.upload_url,"\n"," ","flash_url: ",this.settings.flash_url,"\n"," ","use_query_string: ",this.settings.use_query_string.toString(),"\n"," ","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n"," ","http_success: ",this.settings.http_success.join(", "),"\n"," ","assume_success_timeout: ",this.settings.assume_success_timeout,"\n"," ","file_post_name: ",this.settings.file_post_name,"\n"," ","post_params: ",this.settings.post_params.toString(),"\n"," ","file_types: ",this.settings.file_types,"\n"," ","file_types_description: ",this.settings.file_types_description,"\n"," ","file_size_limit: ",this.settings.file_size_limit,"\n"," ","file_upload_limit: ",this.settings.file_upload_limit,"\n"," ","file_queue_limit: ",this.settings.file_queue_limit,"\n"," ","debug: ",this.settings.debug.toString(),"\n"," ","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n"," ","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n"," ","button_placeholder: ",this.settings.button_placeholder?"Set":"Not Set","\n"," ","button_image_url: ",this.settings.button_image_url.toString(),"\n"," ","button_width: ",this.settings.button_width.toString(),"\n"," ","button_height: ",this.settings.button_height.toString(),"\n"," ","button_text: ",this.settings.button_text.toString(),"\n"," ","button_text_style: ",this.settings.button_text_style.toString(),"\n"," ","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n"," ","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n"," ","button_action: ",this.settings.button_action.toString(),"\n"," ","button_disabled: ",this.settings.button_disabled.toString(),"\n"," ","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n"," ","swfupload_loaded_handler assigned: ",("function"==typeof this.settings.swfupload_loaded_handler).toString(),"\n"," ","file_dialog_start_handler assigned: ",("function"==typeof this.settings.file_dialog_start_handler).toString(),"\n"," ","file_queued_handler assigned: ",("function"==typeof this.settings.file_queued_handler).toString(),"\n"," ","file_queue_error_handler assigned: ",("function"==typeof this.settings.file_queue_error_handler).toString(),"\n"," ","upload_start_handler assigned: ",("function"==typeof this.settings.upload_start_handler).toString(),"\n"," ","upload_progress_handler assigned: ",("function"==typeof this.settings.upload_progress_handler).toString(),"\n"," ","upload_error_handler assigned: ",("function"==typeof this.settings.upload_error_handler).toString(),"\n"," ","upload_success_handler assigned: ",("function"==typeof this.settings.upload_success_handler).toString(),"\n"," ","upload_complete_handler assigned: ",("function"==typeof this.settings.upload_complete_handler).toString(),"\n"," ","debug_handler assigned: ",("function"==typeof this.settings.debug_handler).toString(),"\n"].join(""))},SWFUpload.prototype.addSetting=function(a,b,c){return this.settings[a]=void 0==b?c:b},SWFUpload.prototype.getSetting=function(a){return void 0!=this.settings[a]?this.settings[a]:""},SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+""),returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}return void 0!=returnValue&&"object"==typeof returnValue.post&&(returnValue=this.unescapeFilePostParams(returnValue)),returnValue},SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")},SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")},SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])},SWFUpload.prototype.cancelUpload=function(a,b){b!==!1&&(b=!0),this.callFlash("CancelUpload",[a,b])},SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")},SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")},SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])},SWFUpload.prototype.getFile=function(a){return"number"==typeof a?this.callFlash("GetFileByIndex",[a]):this.callFlash("GetFile",[a])},SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])},SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])},SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString(),this.callFlash("SetUploadURL",[a])},SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a,this.callFlash("SetPostParams",[a])},SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b,this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a],this.callFlash("SetPostParams",[this.settings.post_params])},SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a,this.settings.file_types_description=b,this.callFlash("SetFileTypes",[a,b])},SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a,this.callFlash("SetFileSizeLimit",[a])},SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a,this.callFlash("SetFileUploadLimit",[a])},SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a,this.callFlash("SetFileQueueLimit",[a])},SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a,this.callFlash("SetFilePostName",[a])},SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a,this.callFlash("SetUseQueryString",[a])},SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a,this.callFlash("SetRequeueOnError",[a])},SWFUpload.prototype.setHTTPSuccess=function(a){"string"==typeof a&&(a=a.replace(" ","").split(",")),this.settings.http_success=a,this.callFlash("SetHTTPSuccess",[a])},SWFUpload.prototype.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a,this.callFlash("SetAssumeSuccessTimeout",[a])},SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a,this.callFlash("SetDebugEnabled",[a])},SWFUpload.prototype.setButtonImageURL=function(a){void 0==a&&(a=""),this.settings.button_image_url=a,this.callFlash("SetButtonImageURL",[a])},SWFUpload.prototype.setButtonDimensions=function(a,b){this.settings.button_width=a,this.settings.button_height=b;var c=this.getMovieElement();void 0!=c&&(c.style.width=a+"px",c.style.height=b+"px"),this.callFlash("SetButtonDimensions",[a,b])},SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a,this.callFlash("SetButtonText",[a])},SWFUpload.prototype.setButtonTextPadding=function(a,b){this.settings.button_text_top_padding=b,this.settings.button_text_left_padding=a,this.callFlash("SetButtonTextPadding",[a,b])},SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a,this.callFlash("SetButtonTextStyle",[a])},SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a,this.callFlash("SetButtonDisabled",[a])},SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a,this.callFlash("SetButtonAction",[a])},SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a,this.callFlash("SetButtonCursor",[a])},SWFUpload.prototype.queueEvent=function(a,b){void 0==b?b=[]:b instanceof Array||(b=[b]);var c=this;if("function"==typeof this.settings[a])this.eventQueue.push(function(){this.settings[a].apply(this,b) +}),setTimeout(function(){c.executeNextEvent()},0);else if(null!==this.settings[a])throw"Event handler "+a+" is unknown or is not a function"},SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;"function"==typeof a&&a.apply(this)},SWFUpload.prototype.unescapeFilePostParams=function(a){var b,c=/[$]([0-9a-f]{4})/i,d={};if(void 0!=a){for(var e in a.post)if(a.post.hasOwnProperty(e)){b=e;for(var f;null!==(f=c.exec(b));)b=b.replace(f[0],String.fromCharCode(parseInt("0x"+f[1],16)));d[b]=a.post[e]}a.post=d}return a},SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return!1}},SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();return a?(this.cleanUp(a),void this.queueEvent("swfupload_loaded_handler")):void this.debug("Flash called back ready but the flash movie can't be found.")},SWFUpload.prototype.cleanUp=function(a){try{if(this.movieElement&&"unknown"==typeof a.CallFunction){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var b in a)try{"function"==typeof a[b]&&(a[b]=null)}catch(c){}}}catch(d){}window.__flash__removeCallback=function(a,b){try{a&&(a[b]=null)}catch(c){}}},SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")},SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("file_queued_handler",a)},SWFUpload.prototype.fileQueueError=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("file_queue_error_handler",[a,b,c])},SWFUpload.prototype.fileDialogComplete=function(a,b,c){this.queueEvent("file_dialog_complete_handler",[a,b,c])},SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("return_upload_start_handler",a)},SWFUpload.prototype.returnUploadStart=function(a){var b;if("function"==typeof this.settings.upload_start_handler)a=this.unescapeFilePostParams(a),b=this.settings.upload_start_handler.call(this,a);else if(void 0!=this.settings.upload_start_handler)throw"upload_start_handler must be a function";void 0===b&&(b=!0),b=!!b,this.callFlash("ReturnUploadStart",[b])},SWFUpload.prototype.uploadProgress=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_progress_handler",[a,b,c])},SWFUpload.prototype.uploadError=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_error_handler",[a,b,c])},SWFUpload.prototype.uploadSuccess=function(a,b,c){a=this.unescapeFilePostParams(a),this.queueEvent("upload_success_handler",[a,b,c])},SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a),this.queueEvent("upload_complete_handler",a)},SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)},SWFUpload.prototype.debugMessage=function(a){if(this.settings.debug){var b,c=[];if("object"==typeof a&&"string"==typeof a.name&&"string"==typeof a.message){for(var d in a)a.hasOwnProperty(d)&&c.push(d+": "+a[d]);b=c.join("\n")||"",c=b.split("\n"),b="EXCEPTION: "+c.join("\nEXCEPTION: "),SWFUpload.Console.writeLine(b)}else SWFUpload.Console.writeLine(a)}},SWFUpload.Console={},SWFUpload.Console.writeLine=function(a){var b,c;try{b=document.getElementById("SWFUpload_Console"),b||(c=document.createElement("form"),document.getElementsByTagName("body")[0].appendChild(c),b=document.createElement("textarea"),b.id="SWFUpload_Console",b.style.fontFamily="monospace",b.setAttribute("wrap","off"),b.wrap="off",b.style.overflow="auto",b.style.width="700px",b.style.height="350px",b.style.margin="5px",c.appendChild(b)),b.value+=a+"\n",b.scrollTop=b.scrollHeight-b.clientHeight}catch(d){alert("Exception: "+d.name+" Message: "+d.message)}}}(),function(){"function"==typeof SWFUpload&&(SWFUpload.queue={},SWFUpload.prototype.initSettings=function(a){return function(){"function"==typeof a&&a.call(this),this.queueSettings={},this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0,this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler,this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler,this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler,this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler,this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}}(SWFUpload.prototype.initSettings),SWFUpload.prototype.startUpload=function(a){this.queueSettings.queue_cancelled_flag=!1,this.callFlash("StartUpload",[a])},SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=!0,this.stopUpload();for(var a=this.getStats();a.files_queued>0;)this.cancelUpload(),a=this.getStats()},SWFUpload.queue.uploadStartHandler=function(a){var b;return"function"==typeof this.queueSettings.user_upload_start_handler&&(b=this.queueSettings.user_upload_start_handler.call(this,a)),b=b===!1?!1:!0,this.queueSettings.queue_cancelled_flag=!b,b},SWFUpload.queue.uploadCompleteHandler=function(a){var b,c=this.queueSettings.user_upload_complete_handler;if(a.filestatus===SWFUpload.FILE_STATUS.COMPLETE&&this.queueSettings.queue_upload_count++,b="function"==typeof c?c.call(this,a)===!1?!1:!0:a.filestatus===SWFUpload.FILE_STATUS.QUEUED?!1:!0){var d=this.getStats();d.files_queued>0&&this.queueSettings.queue_cancelled_flag===!1?this.startUpload():this.queueSettings.queue_cancelled_flag===!1?(this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]),this.queueSettings.queue_upload_count=0):(this.queueSettings.queue_cancelled_flag=!1,this.queueSettings.queue_upload_count=0)}})}(),KindEditor.plugin("pagebreak",function(a){var b=this,c="pagebreak",d=a.undef(b.pagebreakHtml,'
    ');b.clickToolbar(c,function(){var c=b.cmd,e=c.range;b.focus();var f="br"==b.newlineTag||a.WEBKIT?"":'';if(b.insertHtml(d+f),""!==f){var g=a("#__kindeditor_tail_tag__",b.edit.doc);e.selectNodeContents(g[0]),g.removeAttr("id"),c.select()}})}),KindEditor.plugin("plainpaste",function(a){var b=this,c="plainpaste";b.clickToolbar(c,function(){var d=b.lang(c+"."),e='
    '+d.comment+'
    ',f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(){var c=g.val();c=a.escape(c),c=c.replace(/ {2}/g,"  "),c="p"==b.newlineTag?c.replace(/^/,"

    ").replace(/$/,"

    ").replace(/\n/g,"

    "):c.replace(/\n/g,"
    $&"),b.insertHtml(c).hideDialog().focus()}}}),g=a("textarea",f.div);g[0].focus()})}),KindEditor.plugin("preview",function(a){var b=this,c="preview";b.clickToolbar(c,function(){var d=(b.lang(c+"."),'

    '),e=b.createDialog({name:c,width:750,title:b.lang(c),body:d}),f=a("iframe",e.div),g=a.iframeDoc(f);g.open(),g.write(b.fullHtml()),g.close(),a(g.body).css("background-color","#FFF"),f[0].contentWindow.focus()})}),KindEditor.plugin("quickformat",function(a){function b(a){for(var b=a.first();b&&b.first();)b=b.first();return b}var c=this,d="quickformat",e=a.toMap("blockquote,center,div,h1,h2,h3,h4,h5,h6,p");c.clickToolbar(d,function(){c.focus();for(var d,f=c.edit.doc,g=c.cmd.range,h=a(f.body).first(),i=[],j=[],k=g.createBookmark(!0);h;){d=h.next();var l=b(h);l&&"img"==l.name||(e[h.name]?(h.html(h.html().replace(/^(\s| | )+/gi,"")),h.css("text-indent","2em")):j.push(h),(!d||e[d.name]||e[h.name]&&!e[d.name])&&(j.length>0&&i.push(j),j=[])),h=d}a.each(i,function(b,c){var d=a('

    ',f);c[0].before(d),a.each(c,function(a,b){d.append(b)})}),g.moveToBookmark(k),c.addBookmark()})}),KindEditor.plugin("table",function(a){function b(a,b){b=b.toUpperCase(),a.css("background-color",b),a.css("color","#000000"===b?"#FFFFFF":"#000000"),a.html(b)}function c(c,d){function f(){a.each(i,function(){this.remove()}),i=[],a(document).unbind("click,mousedown",f),c.unbind("click,mousedown",f)}d.bind("click,mousedown",function(a){a.stopPropagation()}),d.click(function(){f();var d=a(this),g=d.pos(),h=a.colorpicker({x:g.x,y:g.y+d.height(),z:811214,selectedColor:a(this).html(),colors:e.colorTable,noColor:e.lang("noColor"),shadowMode:e.shadowMode,click:function(a){b(d,a),f()}});i.push(h),a(document).bind("click,mousedown",f),c.bind("click,mousedown",f)})}function d(a,b,c){for(var d=0,e=0,f=b.cells.length;f>e&&b.cells[e]!=c;e++)d+=b.cells[e].rowSpan-1;return c.cellIndex-d}var e=this,f="table",g=e.lang(f+"."),h="ke-zeroborder",i=[];e.plugin.table={prop:function(d){var i=['
    ','
    ','",g.rows+'   ',g.cols+' ',"
    ",'
    ','",g.width+'   ','   ",g.height+'   ','","
    ",'
    ','",g.padding+'   ',g.spacing+' ',"
    ",'
    ','",'","
    ",'
    ','",g.borderWidth+'   ',g.borderColor+' ',"
    ",'
    ','",'',"
    ","
    "].join(""),j=e.cmd.range.createBookmark(),k=e.createDialog({name:f,width:500,title:e.lang(f),body:i,beforeRemove:function(){w.unbind()},yesBtn:{name:e.lang("yes"),click:function(){var b=m.val(),c=n.val(),d=o.val(),f=p.val(),g=q.val(),i=r.val(),k=s.val(),l=t.val(),y=u.val(),z=v.val(),A=a(w[0]).html()||"",B=a(w[1]).html()||"";if(0==b||!/^\d+$/.test(b))return alert(e.lang("invalidRows")),void m[0].focus();if(0==c||!/^\d+$/.test(c))return alert(e.lang("invalidRows")),void n[0].focus();if(!/^\d*$/.test(d))return alert(e.lang("invalidWidth")),void o[0].focus();if(!/^\d*$/.test(f))return alert(e.lang("invalidHeight")),void p[0].focus();if(!/^\d*$/.test(k))return alert(e.lang("invalidPadding")),void s[0].focus();if(!/^\d*$/.test(l))return alert(e.lang("invalidSpacing")),void t[0].focus();if(!/^\d*$/.test(z))return alert(e.lang("invalidBorder")),void v[0].focus();if(x)return""!==d?x.width(d+g):x.css("width",""),void 0!==x[0].width&&x.removeAttr("width"),""!==f?x.height(f+i):x.css("height",""),void 0!==x[0].height&&x.removeAttr("height"),x.css("background-color",B),void 0!==x[0].bgColor&&x.removeAttr("bgColor"),""!==k?x[0].cellPadding=k:x.removeAttr("cellPadding"),""!==l?x[0].cellSpacing=l:x.removeAttr("cellSpacing"),""!==y?x[0].align=y:x.removeAttr("align"),""!==z?x.attr("border",z):x.removeAttr("border"),""===z||"0"===z?x.addClass(h):x.removeClass(h),""!==A?x.attr("borderColor",A):x.removeAttr("borderColor"),e.hideDialog().focus(),e.cmd.range.moveToBookmark(j),e.cmd.select(),void e.addBookmark();var C="";""!==d&&(C+="width:"+d+g+";"),""!==f&&(C+="height:"+f+i+";"),""!==B&&(C+="background-color:"+B+";");var D="E;E++){D+="";for(var F=0;c>F;F++)D+=""+(a.IE?" ":"
    ")+"";D+=""}D+="",a.IE||(D+="
    "),e.insertHtml(D),e.select().hideDialog().focus(),e.addBookmark()}}}),l=k.div,m=a('[name="rows"]',l).val(3),n=a('[name="cols"]',l).val(2),o=a('[name="width"]',l).val(100),p=a('[name="height"]',l),q=a('[name="widthType"]',l),r=a('[name="heightType"]',l),s=a('[name="padding"]',l).val(2),t=a('[name="spacing"]',l).val(0),u=a('[name="align"]',l),v=a('[name="border"]',l).val(1),w=a(".ke-input-color",l);c(l,w.eq(0)),c(l,w.eq(1)),b(w.eq(0),"#000000"),b(w.eq(1),""),m[0].focus(),m[0].select();var x;if(!d&&(x=e.plugin.getSelectedTable())){m.val(x[0].rows.length),n.val(x[0].rows.length>0?x[0].rows[0].cells.length:0),m.attr("disabled",!0),n.attr("disabled",!0);var y,z=x[0].style.width||x[0].width,A=x[0].style.height||x[0].height;void 0!==z&&(y=/^(\d+)((?:px|%)*)$/.exec(z))?(o.val(y[1]),q.val(y[2])):o.val(""),void 0!==A&&(y=/^(\d+)((?:px|%)*)$/.exec(A))&&(p.val(y[1]),r.val(y[2])),s.val(x[0].cellPadding||""),t.val(x[0].cellSpacing||""),u.val(x[0].align||""),v.val(void 0===x[0].border?"":x[0].border),b(w.eq(0),a.toHex(x.attr("borderColor")||"")),b(w.eq(1),a.toHex(x[0].style.backgroundColor||x[0].bgColor||"")),o[0].focus(),o[0].select()}},cellprop:function(){var d=['
    ','
    ','",g.width+'   ','   ",g.height+'   ','","
    ",'
    ','",g.textAlign+' ",g.verticalAlign+' ","
    ",'
    ','",g.borderWidth+'   ',g.borderColor+' ',"
    ",'
    ','",'',"
    ","
    "].join(""),h=e.cmd.range.createBookmark(),i=e.createDialog({name:f,width:500,title:e.lang("tablecell"),body:d,beforeRemove:function(){t.unbind()},yesBtn:{name:e.lang("yes"),click:function(){var b=k.val(),c=l.val(),d=m.val(),f=n.val(),g=(o.val(),p.val(),q.val()),i=r.val(),j=s.val(),u=a(t[0]).html()||"",w=a(t[1]).html()||"";return/^\d*$/.test(b)?/^\d*$/.test(c)?/^\d*$/.test(j)?(v.css({width:""!==b?b+d:"",height:""!==c?c+f:"","background-color":w,"text-align":g,"vertical-align":i,"border-width":j,"border-style":""!==j?"solid":"","border-color":u}),e.hideDialog().focus(),e.cmd.range.moveToBookmark(h),e.cmd.select(),void e.addBookmark()):(alert(e.lang("invalidBorder")),void s[0].focus()):(alert(e.lang("invalidHeight")),void l[0].focus()):(alert(e.lang("invalidWidth")),void k[0].focus())}}}),j=i.div,k=a('[name="width"]',j).val(100),l=a('[name="height"]',j),m=a('[name="widthType"]',j),n=a('[name="heightType"]',j),o=a('[name="padding"]',j).val(2),p=a('[name="spacing"]',j).val(0),q=a('[name="textAlign"]',j),r=a('[name="verticalAlign"]',j),s=a('[name="border"]',j).val(1),t=a(".ke-input-color",j);c(j,t.eq(0)),c(j,t.eq(1)),b(t.eq(0),"#000000"),b(t.eq(1),""),k[0].focus(),k[0].select();var u,v=e.plugin.getSelectedCell(),w=v[0].style.width||v[0].width||"",x=v[0].style.height||v[0].height||"";(u=/^(\d+)((?:px|%)*)$/.exec(w))?(k.val(u[1]),m.val(u[2])):k.val(""),(u=/^(\d+)((?:px|%)*)$/.exec(x))&&(l.val(u[1]),n.val(u[2])),q.val(v[0].style.textAlign||""),r.val(v[0].style.verticalAlign||"");var y=v[0].style.borderWidth||"";y&&(y=parseInt(y)),s.val(y),b(t.eq(0),a.toHex(v[0].style.borderColor||"")),b(t.eq(1),a.toHex(v[0].style.backgroundColor||"")),k[0].focus(),k[0].select()},insert:function(){this.prop(!0)},"delete":function(){var a=e.plugin.getSelectedTable();e.cmd.range.setStartBefore(a[0]).collapse(!0),e.cmd.select(),a.remove(),e.addBookmark()},colinsert:function(b){var c=e.plugin.getSelectedTable()[0],f=e.plugin.getSelectedRow()[0],g=e.plugin.getSelectedCell()[0],h=g.cellIndex+b;h+=c.rows[0].cells.length-f.cells.length;for(var i=0,j=c.rows.length;j>i;i++){var k=c.rows[i],l=k.insertCell(h);l.innerHTML=a.IE?"":"
    ",h=d(c,k,l)}e.cmd.range.selectNodeContents(g).collapse(!0),e.cmd.select(),e.addBookmark()},colinsertleft:function(){this.colinsert(0)},colinsertright:function(){this.colinsert(1)},rowinsert:function(b){var c=e.plugin.getSelectedTable()[0],d=e.plugin.getSelectedRow()[0],f=e.plugin.getSelectedCell()[0],g=d.rowIndex;1===b&&(g=d.rowIndex+(f.rowSpan-1)+b);for(var h=c.insertRow(g),i=0,j=d.cells.length;j>i;i++){d.cells[i].rowSpan>1&&(j-=d.cells[i].rowSpan-1);var k=h.insertCell(i);1===b&&d.cells[i].colSpan>1&&(k.colSpan=d.cells[i].colSpan),k.innerHTML=a.IE?"":"
    "}for(var l=g;l>=0;l--){var m=c.rows[l].cells;if(m.length>i){for(var n=f.cellIndex;n>=0;n--)m[n].rowSpan>1&&(m[n].rowSpan+=1);break}}e.cmd.range.selectNodeContents(f).collapse(!0),e.cmd.select(),e.addBookmark()},rowinsertabove:function(){this.rowinsert(0)},rowinsertbelow:function(){this.rowinsert(1)},rowmerge:function(){var a=e.plugin.getSelectedTable()[0],b=e.plugin.getSelectedRow()[0],c=e.plugin.getSelectedCell()[0],d=b.rowIndex,f=d+c.rowSpan,g=a.rows[f];if(!(a.rows.length<=f)){var h=c.cellIndex;if(!(g.cells.length<=h)){var i=g.cells[h];c.colSpan===i.colSpan&&(c.rowSpan+=i.rowSpan,g.deleteCell(h),e.cmd.range.selectNodeContents(c).collapse(!0),e.cmd.select(),e.addBookmark())}}},colmerge:function(){var a=(e.plugin.getSelectedTable()[0],e.plugin.getSelectedRow()[0]),b=e.plugin.getSelectedCell()[0],c=(a.rowIndex,b.cellIndex),d=c+1;if(!(a.cells.length<=d)){var f=a.cells[d];b.rowSpan===f.rowSpan&&(b.colSpan+=f.colSpan,a.deleteCell(d),e.cmd.range.selectNodeContents(b).collapse(!0),e.cmd.select(),e.addBookmark())}},rowsplit:function(){var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],f=e.plugin.getSelectedCell()[0],g=c.rowIndex;if(1!==f.rowSpan){for(var h=d(b,c,f),i=1,j=f.rowSpan;j>i;i++){var k=b.rows[g+i],l=k.insertCell(h);f.colSpan>1&&(l.colSpan=f.colSpan),l.innerHTML=a.IE?"":"
    ",h=d(b,k,l)}a(f).removeAttr("rowSpan"),e.cmd.range.selectNodeContents(f).collapse(!0),e.cmd.select(),e.addBookmark()}},colsplit:function(){var b=(e.plugin.getSelectedTable()[0],e.plugin.getSelectedRow()[0]),c=e.plugin.getSelectedCell()[0],d=c.cellIndex;if(1!==c.colSpan){for(var f=1,g=c.colSpan;g>f;f++){var h=b.insertCell(d+f);c.rowSpan>1&&(h.rowSpan=c.rowSpan),h.innerHTML=a.IE?"":"
    "}a(c).removeAttr("colSpan"),e.cmd.range.selectNodeContents(c).collapse(!0),e.cmd.select(),e.addBookmark()}},coldelete:function(){for(var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],d=e.plugin.getSelectedCell()[0],f=d.cellIndex,g=0,h=b.rows.length;h>g;g++){var i=b.rows[g],j=i.cells[f];j.colSpan>1?(j.colSpan-=1,1===j.colSpan&&a(j).removeAttr("colSpan")):i.deleteCell(f),j.rowSpan>1&&(g+=j.rowSpan-1)}0===c.cells.length?(e.cmd.range.setStartBefore(b).collapse(!0),e.cmd.select(),a(b).remove()):e.cmd.selection(!0),e.addBookmark()},rowdelete:function(){for(var b=e.plugin.getSelectedTable()[0],c=e.plugin.getSelectedRow()[0],d=e.plugin.getSelectedCell()[0],f=c.rowIndex,g=d.rowSpan-1;g>=0;g--)b.deleteRow(f+g);0===b.rows.length?(e.cmd.range.setStartBefore(b).collapse(!0),e.cmd.select(),a(b).remove()):e.cmd.selection(!0),e.addBookmark()}},e.clickToolbar(f,e.plugin.table.prop)}),KindEditor.plugin("template",function(a){function b(b){return e+b+"?ver="+encodeURIComponent(a.DEBUG?a.TIME:a.VERSION)}var c=this,d="template",e=(c.lang(d+"."),c.pluginsPath+d+"/html/");c.clickToolbar(d,function(){var e=c.lang(d+"."),f=['
    ','
    ','
    ',e.selectTemplate+"
    ",'
    ',' ","
    ",'
    ',"
    ",'',"
    "].join("");var g=c.createDialog({name:d,width:500,title:c.lang(d),body:html,yesBtn:{name:c.lang("yes"),click:function(){var b=a.iframeDoc(j);c[i[0].checked?"html":"insertHtml"](b.body.innerHTML).hideDialog().focus()}}}),h=a("select",g.div),i=a('[name="replaceFlag"]',g.div),j=a("iframe",g.div);i[0].checked=!0,j.attr("src",b(h.val())),h.change(function(){j.attr("src",b(this.value))})})}),KindEditor.plugin("wordpaste",function(a){var b=this,c="wordpaste";b.clickToolbar(c,function(){var d=b.lang(c+"."),e='
    '+d.comment+'
    ',f=b.createDialog({name:c,width:450,title:b.lang(c),body:e,yesBtn:{name:b.lang("yes"),click:function(){var c=i.body.innerHTML;c=a.clearMsWord(c,b.filterMode?b.htmlTags:a.options.htmlTags),b.insertHtml(c).hideDialog().focus()}}}),g=f.div,h=a("iframe",g),i=a.iframeDoc(h);a.IE||(i.designMode="on"),i.open(),i.write("WordPaste"),i.write(''),a.IE||i.write("
    "),i.write(""),i.close(),a.IE&&(i.body.contentEditable="true"),h[0].contentWindow.focus()})}),KindEditor.plugin("fixtoolbar",function(a){function b(){var b=a(".ke-toolbar"),c=b.pos().y;a(window).bind("scroll",function(){"fixed"==b.css("position")?document.body.scrollTop-c<0&&(b.css("position","static"),b.css("top","auto")):b.pos().y-document.body.scrollTop<0&&(b.css("position","fixed"),b.css("top",0))})}var c=this;c.fixToolBar&&(c.isCreated?b():c.afterCreate(b))}); \ No newline at end of file diff --git a/public/kindeditor/kindeditor-all.js b/public/kindeditor/kindeditor-all.js new file mode 100644 index 0000000..3be7cff --- /dev/null +++ b/public/kindeditor/kindeditor-all.js @@ -0,0 +1,9901 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2016 kindsoft.net +* +* @author Roddy +* @website http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +* @version 4.1.11 (2016-03-31) +*******************************************************************************/ +(function (window, undefined) { + if (window.KindEditor) { + return; + } + + +if (!window.console) { + window.console = {}; +} +if (!console.log) { + console.log = function () {}; +} +var _VERSION = '4.1.11 (2016-03-31)', + _ua = navigator.userAgent.toLowerCase(), + _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1, + _NEWIE = _ua.indexOf('msie') == -1 && _ua.indexOf('trident') > -1, + _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1, + _WEBKIT = _ua.indexOf('applewebkit') > -1, + _OPERA = _ua.indexOf('opera') > -1, + _MOBILE = _ua.indexOf('mobile') > -1, + _IOS = /ipad|iphone|ipod/.test(_ua), + _QUIRKS = document.compatMode != 'CSS1Compat', + _IERANGE = !window.getSelection, + _matches = /(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua), + _V = _matches ? _matches[1] : '0', + _TIME = new Date().getTime(); +function _isArray(val) { + if (!val) { + return false; + } + return Object.prototype.toString.call(val) === '[object Array]'; +} +function _isFunction(val) { + if (!val) { + return false; + } + return Object.prototype.toString.call(val) === '[object Function]'; +} +function _inArray(val, arr) { + for (var i = 0, len = arr.length; i < len; i++) { + if (val === arr[i]) { + return i; + } + } + return -1; +} +function _each(obj, fn) { + if (_isArray(obj)) { + for (var i = 0, len = obj.length; i < len; i++) { + if (fn.call(obj[i], i, obj[i]) === false) { + break; + } + } + } else { + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + if (fn.call(obj[key], key, obj[key]) === false) { + break; + } + } + } + } +} +function _trim(str) { + return str.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, ''); +} +function _inString(val, str, delimiter) { + delimiter = delimiter === undefined ? ',' : delimiter; + return (delimiter + str + delimiter).indexOf(delimiter + val + delimiter) >= 0; +} +function _addUnit(val, unit) { + unit = unit || 'px'; + return val && /^-?\d+(?:\.\d+)?$/.test(val) ? val + unit : val; +} +function _removeUnit(val) { + var match; + return val && (match = /(\d+)/.exec(val)) ? parseInt(match[1], 10) : 0; +} +function _escape(val) { + return val.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); +} +function _unescape(val) { + return val.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&'); +} +function _toCamel(str) { + var arr = str.split('-'); + str = ''; + _each(arr, function(key, val) { + str += (key > 0) ? val.charAt(0).toUpperCase() + val.substr(1) : val; + }); + return str; +} +function _toHex(val) { + function hex(d) { + var s = parseInt(d, 10).toString(16).toUpperCase(); + return s.length > 1 ? s : '0' + s; + } + return val.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig, + function($0, $1, $2, $3) { + return '#' + hex($1) + hex($2) + hex($3); + } + ); +} +function _toMap(val, delimiter) { + delimiter = delimiter === undefined ? ',' : delimiter; + var map = {}, arr = _isArray(val) ? val : val.split(delimiter), match; + _each(arr, function(key, val) { + if ((match = /^(\d+)\.\.(\d+)$/.exec(val))) { + for (var i = parseInt(match[1], 10); i <= parseInt(match[2], 10); i++) { + map[i.toString()] = true; + } + } else { + map[val] = true; + } + }); + return map; +} +function _toArray(obj, offset) { + return Array.prototype.slice.call(obj, offset || 0); +} +function _undef(val, defaultVal) { + return val === undefined ? defaultVal : val; +} +function _invalidUrl(url) { + return !url || /[<>"]/.test(url); +} +function _addParam(url, param) { + return url.indexOf('?') >= 0 ? url + '&' + param : url + '?' + param; +} +function _extend(child, parent, proto) { + if (!proto) { + proto = parent; + parent = null; + } + var childProto; + if (parent) { + var fn = function () {}; + fn.prototype = parent.prototype; + childProto = new fn(); + _each(proto, function(key, val) { + childProto[key] = val; + }); + } else { + childProto = proto; + } + childProto.constructor = child; + child.prototype = childProto; + child.parent = parent ? parent.prototype : null; +} + + +function _json(text) { + var match; + if ((match = /\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))) { + text = match[0]; + } + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + if (/^[\],:{}\s]*$/. + test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). + replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). + replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + return eval('(' + text + ')'); + } + throw 'JSON parse error'; +} +var _round = Math.round; +var K = { + DEBUG : false, + VERSION : _VERSION, + IE : _IE, + GECKO : _GECKO, + WEBKIT : _WEBKIT, + OPERA : _OPERA, + V : _V, + TIME : _TIME, + each : _each, + isArray : _isArray, + isFunction : _isFunction, + inArray : _inArray, + inString : _inString, + trim : _trim, + addUnit : _addUnit, + removeUnit : _removeUnit, + escape : _escape, + unescape : _unescape, + toCamel : _toCamel, + toHex : _toHex, + toMap : _toMap, + toArray : _toArray, + undef : _undef, + invalidUrl : _invalidUrl, + addParam : _addParam, + extend : _extend, + json : _json +}; +var _INLINE_TAG_MAP = _toMap('a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'), + _BLOCK_TAG_MAP = _toMap('address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul'), + _SINGLE_TAG_MAP = _toMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'), + _STYLE_TAG_MAP = _toMap('b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u'), + _CONTROL_TAG_MAP = _toMap('img,table,input,textarea,button'), + _PRE_TAG_MAP = _toMap('pre,style,script'), + _NOSPLIT_TAG_MAP = _toMap('html,head,body,td,tr,table,ol,ul,li'), + _AUTOCLOSE_TAG_MAP = _toMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'), + _FILL_ATTR_MAP = _toMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'), + _VALUE_TAG_MAP = _toMap('input,button,textarea,select'); + + +function _getBasePath() { + var els = document.getElementsByTagName('script'), src; + for (var i = 0, len = els.length; i < len; i++) { + src = els[i].src || ''; + if (/kindeditor[\w\-\.]*\.js/.test(src)) { + return src.substring(0, src.lastIndexOf('/') + 1); + } + } + return ''; +} +K.basePath = _getBasePath(); +K.options = { + designMode : true, + fullscreenMode : false, + filterMode : true, + wellFormatMode : true, + shadowMode : true, + loadStyleMode : true, + basePath : K.basePath, + themesPath : K.basePath + 'themes/', + langPath : K.basePath + 'lang/', + pluginsPath : K.basePath + 'plugins/', + themeType : 'default', + langType : 'zh-CN', + urlType : '', + newlineTag : 'p', + resizeType : 2, + syncType : 'form', + pasteType : 2, + dialogAlignType : 'page', + useContextmenu : true, + fullscreenShortcut : false, + bodyClass : 'ke-content', + indentChar : '\t', + cssPath : '', + cssData : '', + minWidth : 650, + minHeight : 100, + minChangeSize : 50, + zIndex : 811213, + items : [ + 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', + 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', + 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', + 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', + 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', + 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage', + 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', + 'anchor', 'link', 'unlink', '|', 'about' + ], + noDisableItems : ['source', 'fullscreen'], + colorTable : [ + ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'], + ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'], + ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'], + ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000'] + ], + fontSizeTable : ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'], + htmlTags : { + font : ['id', 'class', 'color', 'size', 'face', '.background-color'], + span : [ + 'id', 'class', '.color', '.background-color', '.font-size', '.font-family', '.background', + '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height' + ], + div : [ + 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color', + '.background-color', '.font-size', '.font-family', '.font-weight', '.background', + '.font-style', '.text-decoration', '.vertical-align', '.margin-left' + ], + table: [ + 'id', 'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor', + '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color', + '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background', + '.width', '.height', '.border-collapse' + ], + 'td,th': [ + 'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', + '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', + '.font-style', '.text-decoration', '.vertical-align', '.background', '.border' + ], + a : ['id', 'class', 'href', 'target', 'name'], + embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess', 'wmode'], + img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'], + 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ + 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background', + '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left' + ], + pre : ['id', 'class'], + hr : ['id', 'class', '.page-break-after'], + 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'], + iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height'] + }, + layout : '
    ' +}; + + +var _useCapture = false; + + +var _INPUT_KEY_MAP = _toMap('8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222'); + +var _CURSORMOVE_KEY_MAP = _toMap('33..40'); + +var _CHANGE_KEY_MAP = {}; +_each(_INPUT_KEY_MAP, function(key, val) { + _CHANGE_KEY_MAP[key] = val; +}); +_each(_CURSORMOVE_KEY_MAP, function(key, val) { + _CHANGE_KEY_MAP[key] = val; +}); + + +function _bindEvent(el, type, fn) { + if (el.addEventListener){ + el.addEventListener(type, fn, _useCapture); + } else if (el.attachEvent){ + el.attachEvent('on' + type, fn); + } +} + +function _unbindEvent(el, type, fn) { + if (el.removeEventListener){ + el.removeEventListener(type, fn, _useCapture); + } else if (el.detachEvent){ + el.detachEvent('on' + type, fn); + } +} +var _EVENT_PROPS = ('altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,' + + 'data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,' + + 'pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which').split(','); + + +function KEvent(el, event) { + this.init(el, event); +} +_extend(KEvent, { + init : function(el, event) { + var self = this, doc = el.ownerDocument || el.document || el; + self.event = event; + _each(_EVENT_PROPS, function(key, val) { + self[val] = event[val]; + }); + if (!self.target) { + self.target = self.srcElement || doc; + } + if (self.target.nodeType === 3) { + self.target = self.target.parentNode; + } + if (!self.relatedTarget && self.fromElement) { + self.relatedTarget = self.fromElement === self.target ? self.toElement : self.fromElement; + } + if (self.pageX == null && self.clientX != null) { + var d = doc.documentElement, body = doc.body; + self.pageX = self.clientX + (d && d.scrollLeft || body && body.scrollLeft || 0) - (d && d.clientLeft || body && body.clientLeft || 0); + self.pageY = self.clientY + (d && d.scrollTop || body && body.scrollTop || 0) - (d && d.clientTop || body && body.clientTop || 0); + } + if (!self.which && ((self.charCode || self.charCode === 0) ? self.charCode : self.keyCode)) { + self.which = self.charCode || self.keyCode; + } + if (!self.metaKey && self.ctrlKey) { + self.metaKey = self.ctrlKey; + } + if (!self.which && self.button !== undefined) { + self.which = (self.button & 1 ? 1 : (self.button & 2 ? 3 : (self.button & 4 ? 2 : 0))); + } + switch (self.which) { + case 186 : + self.which = 59; + break; + case 187 : + case 107 : + case 43 : + self.which = 61; + break; + case 189 : + case 45 : + self.which = 109; + break; + case 42 : + self.which = 106; + break; + case 47 : + self.which = 111; + break; + case 78 : + self.which = 110; + break; + } + if (self.which >= 96 && self.which <= 105) { + self.which -= 48; + } + }, + preventDefault : function() { + var ev = this.event; + if (ev.preventDefault) { + ev.preventDefault(); + } else { + ev.returnValue = false; + } + }, + stopPropagation : function() { + var ev = this.event; + if (ev.stopPropagation) { + ev.stopPropagation(); + } else { + ev.cancelBubble = true; + } + }, + stop : function() { + this.preventDefault(); + this.stopPropagation(); + } +}); +var _eventExpendo = 'kindeditor_' + _TIME, _eventId = 0, _eventData = {}; +function _getId(el) { + return el[_eventExpendo] || null; +} +function _setId(el) { + el[_eventExpendo] = ++_eventId; + return _eventId; +} +function _removeId(el) { + try { + delete el[_eventExpendo]; + } catch(e) { + if (el.removeAttribute) { + el.removeAttribute(_eventExpendo); + } + } +} +function _bind(el, type, fn) { + if (type.indexOf(',') >= 0) { + _each(type.split(','), function() { + _bind(el, this, fn); + }); + return; + } + var id = _getId(el); + if (!id) { + id = _setId(el); + } + if (_eventData[id] === undefined) { + _eventData[id] = {}; + } + var events = _eventData[id][type]; + if (events && events.length > 0) { + _unbindEvent(el, type, events[0]); + } else { + _eventData[id][type] = []; + _eventData[id].el = el; + } + events = _eventData[id][type]; + if (events.length === 0) { + events[0] = function(e) { + var kevent = e ? new KEvent(el, e) : undefined; + _each(events, function(i, event) { + if (i > 0 && event) { + event.call(el, kevent); + } + }); + }; + } + if (_inArray(fn, events) < 0) { + events.push(fn); + } + _bindEvent(el, type, events[0]); +} +function _unbind(el, type, fn) { + if (type && type.indexOf(',') >= 0) { + _each(type.split(','), function() { + _unbind(el, this, fn); + }); + return; + } + var id = _getId(el); + if (!id) { + return; + } + if (type === undefined) { + if (id in _eventData) { + _each(_eventData[id], function(key, events) { + if (key != 'el' && events.length > 0) { + _unbindEvent(el, key, events[0]); + } + }); + delete _eventData[id]; + _removeId(el); + } + return; + } + if (!_eventData[id]) { + return; + } + var events = _eventData[id][type]; + if (events && events.length > 0) { + if (fn === undefined) { + _unbindEvent(el, type, events[0]); + delete _eventData[id][type]; + } else { + _each(events, function(i, event) { + if (i > 0 && event === fn) { + events.splice(i, 1); + } + }); + if (events.length == 1) { + _unbindEvent(el, type, events[0]); + delete _eventData[id][type]; + } + } + var count = 0; + _each(_eventData[id], function() { + count++; + }); + if (count < 2) { + delete _eventData[id]; + _removeId(el); + } + } +} +function _fire(el, type) { + if (type.indexOf(',') >= 0) { + _each(type.split(','), function() { + _fire(el, this); + }); + return; + } + var id = _getId(el); + if (!id) { + return; + } + var events = _eventData[id][type]; + if (_eventData[id] && events && events.length > 0) { + events[0](); + } +} +function _ctrl(el, key, fn) { + var self = this; + key = /^\d{2,}$/.test(key) ? key : key.toUpperCase().charCodeAt(0); + _bind(el, 'keydown', function(e) { + if (e.ctrlKey && e.which == key && !e.shiftKey && !e.altKey) { + fn.call(el); + e.stop(); + } + }); +} +var _readyFinished = false; +function _ready(fn) { + if (_readyFinished) { + fn(KindEditor); + return; + } + var loaded = false; + function readyFunc() { + if (!loaded) { + loaded = true; + fn(KindEditor); + _readyFinished = true; + } + } + function ieReadyFunc() { + if (!loaded) { + try { + document.documentElement.doScroll('left'); + } catch(e) { + setTimeout(ieReadyFunc, 100); + return; + } + readyFunc(); + } + } + function ieReadyStateFunc() { + if (document.readyState === 'complete') { + readyFunc(); + } + } + if (document.addEventListener) { + _bind(document, 'DOMContentLoaded', readyFunc); + } else if (document.attachEvent) { + _bind(document, 'readystatechange', ieReadyStateFunc); + var toplevel = false; + try { + toplevel = window.frameElement == null; + } catch(e) {} + if (document.documentElement.doScroll && toplevel) { + ieReadyFunc(); + } + } + _bind(window, 'load', readyFunc); +} +if (window.attachEvent) { + window.attachEvent('onunload', function() { + _each(_eventData, function(key, events) { + if (events.el) { + _unbind(events.el); + } + }); + }); +} +K.ctrl = _ctrl; +K.ready = _ready; + +function _getCssList(css) { + var list = {}, + reg = /\s*([\w\-]+)\s*:([^;]*)(;|$)/g, + match; + while ((match = reg.exec(css))) { + var key = _trim(match[1].toLowerCase()), + val = _trim(_toHex(match[2])); + list[key] = val; + } + return list; +} +function _getAttrList(tag) { + var list = {}, + reg = /\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g, + match; + while ((match = reg.exec(tag))) { + var key = (match[1] || match[2] || match[4] || match[6]).toLowerCase(), + val = (match[2] ? match[3] : (match[4] ? match[5] : match[7])) || ''; + list[key] = val; + } + return list; +} +function _addClassToTag(tag, className) { + if (/\s+class\s*=/.test(tag)) { + tag = tag.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) { + if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) { + return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3; + } else { + return $0; + } + }); + } else { + tag = tag.substr(0, tag.length - 1) + ' class="' + className + '">'; + } + return tag; +} +function _formatCss(css) { + var str = ''; + _each(_getCssList(css), function(key, val) { + str += key + ':' + val + ';'; + }); + return str; +} +function _formatUrl(url, mode, host, pathname) { + mode = _undef(mode, '').toLowerCase(); + if (url.substr(0, 5) != 'data:') { + url = url.replace(/([^:])\/\//g, '$1/'); + } + if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) { + return url; + } + host = host || location.protocol + '//' + location.host; + if (pathname === undefined) { + var m = location.pathname.match(/^(\/.*)\//); + pathname = m ? m[1] : ''; + } + var match; + if ((match = /^(\w+:\/\/[^\/]*)/.exec(url))) { + if (match[1] !== host) { + return url; + } + } else if (/^\w+:/.test(url)) { + return url; + } + function getRealPath(path) { + var parts = path.split('/'), paths = []; + for (var i = 0, len = parts.length; i < len; i++) { + var part = parts[i]; + if (part == '..') { + if (paths.length > 0) { + paths.pop(); + } + } else if (part !== '' && part != '.') { + paths.push(part); + } + } + return '/' + paths.join('/'); + } + if (/^\//.test(url)) { + url = host + getRealPath(url.substr(1)); + } else if (!/^\w+:\/\//.test(url)) { + url = host + getRealPath(pathname + '/' + url); + } + function getRelativePath(path, depth) { + if (url.substr(0, path.length) === path) { + var arr = []; + for (var i = 0; i < depth; i++) { + arr.push('..'); + } + var prefix = '.'; + if (arr.length > 0) { + prefix += '/' + arr.join('/'); + } + if (pathname == '/') { + prefix += '/'; + } + return prefix + url.substr(path.length); + } else { + if ((match = /^(.*)\//.exec(path))) { + return getRelativePath(match[1], ++depth); + } + } + } + if (mode === 'relative') { + url = getRelativePath(host + pathname, 0).substr(2); + } else if (mode === 'absolute') { + if (url.substr(0, host.length) === host) { + url = url.substr(host.length); + } + } + return url; +} +function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) { + if (html == null) { + html = ''; + } + urlType = urlType || ''; + wellFormatted = _undef(wellFormatted, false); + indentChar = _undef(indentChar, '\t'); + var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(','); + html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) { + return $1 + $2.replace(/<(?:br|br\s[^>]*)>/ig, '\n') + $3; + }); + html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '

    '); + html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1
    $2'); + html = html.replace(/\u200B/g, ''); + html = html.replace(/\u00A9/g, '©'); + html = html.replace(/\u00AE/g, '®'); + html = html.replace(/\u2003/g, ' '); + html = html.replace(/\u3000/g, ' '); + html = html.replace(/<[^>]+/g, function($0) { + return $0.replace(/\s+/g, ' '); + }); + var htmlTagMap = {}; + if (htmlTags) { + _each(htmlTags, function(key, val) { + var arr = key.split(','); + for (var i = 0, len = arr.length; i < len; i++) { + htmlTagMap[arr[i]] = _toMap(val); + } + }); + if (!htmlTagMap.script) { + html = html.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig, ''); + } + if (!htmlTagMap.style) { + html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, ''); + } + } + var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g; + var tagStack = []; + html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) { + var full = $0, + startNewline = $1 || '', + startSlash = $2 || '', + tagName = $3.toLowerCase(), + attr = $4 || '', + endSlash = $5 ? ' ' + $5 : '', + endNewline = $6 || ''; + if (htmlTags && !htmlTagMap[tagName]) { + return ''; + } + if (endSlash === '' && _SINGLE_TAG_MAP[tagName]) { + endSlash = ' /'; + } + if (_INLINE_TAG_MAP[tagName]) { + if (startNewline) { + startNewline = ' '; + } + if (endNewline) { + endNewline = ' '; + } + } + if (_PRE_TAG_MAP[tagName]) { + if (startSlash) { + endNewline = '\n'; + } else { + startNewline = '\n'; + } + } + if (wellFormatted && tagName == 'br') { + endNewline = '\n'; + } + if (_BLOCK_TAG_MAP[tagName] && !_PRE_TAG_MAP[tagName]) { + if (wellFormatted) { + if (startSlash && tagStack.length > 0 && tagStack[tagStack.length - 1] === tagName) { + tagStack.pop(); + } else { + tagStack.push(tagName); + } + startNewline = '\n'; + endNewline = '\n'; + for (var i = 0, len = startSlash ? tagStack.length : tagStack.length - 1; i < len; i++) { + startNewline += indentChar; + if (!startSlash) { + endNewline += indentChar; + } + } + if (endSlash) { + tagStack.pop(); + } else if (!startSlash) { + endNewline += indentChar; + } + } else { + startNewline = endNewline = ''; + } + } + if (attr !== '') { + var attrMap = _getAttrList(full); + if (tagName === 'font') { + var fontStyleMap = {}, fontStyle = ''; + _each(attrMap, function(key, val) { + if (key === 'color') { + fontStyleMap.color = val; + delete attrMap[key]; + } + if (key === 'size') { + fontStyleMap['font-size'] = fontSizeList[parseInt(val, 10) - 1] || ''; + delete attrMap[key]; + } + if (key === 'face') { + fontStyleMap['font-family'] = val; + delete attrMap[key]; + } + if (key === 'style') { + fontStyle = val; + } + }); + if (fontStyle && !/;$/.test(fontStyle)) { + fontStyle += ';'; + } + _each(fontStyleMap, function(key, val) { + if (val === '') { + return; + } + if (/\s/.test(val)) { + val = "'" + val + "'"; + } + fontStyle += key + ':' + val + ';'; + }); + attrMap.style = fontStyle; + } + _each(attrMap, function(key, val) { + if (_FILL_ATTR_MAP[key]) { + attrMap[key] = key; + } + if (_inArray(key, ['src', 'href']) >= 0) { + attrMap[key] = _formatUrl(val, urlType); + } + if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] || + tagName === 'body' && key === 'contenteditable' || + /^kindeditor_\d+$/.test(key)) { + delete attrMap[key]; + } + if (key === 'style' && val !== '') { + var styleMap = _getCssList(val); + _each(styleMap, function(k, v) { + if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) { + delete styleMap[k]; + } + }); + var style = ''; + _each(styleMap, function(k, v) { + style += k + ':' + v + ';'; + }); + attrMap.style = style; + } + }); + attr = ''; + _each(attrMap, function(key, val) { + if (key === 'style' && val === '') { + return; + } + val = val.replace(/"/g, '"'); + attr += ' ' + key + '="' + val + '"'; + }); + } + if (tagName === 'font') { + tagName = 'span'; + } + return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline; + }); + html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) { + return $1 + $2.replace(/\n/g, '\n') + $3; + }); + html = html.replace(/\n\s*\n/g, '\n'); + html = html.replace(/\n/g, '\n'); + return _trim(html); +} + +function _clearMsWord(html, htmlTags) { + html = html.replace(//ig, '') + .replace(//ig, '') + .replace(/]*>[\s\S]*?<\/style>/ig, '') + .replace(/]*>[\s\S]*?<\/script>/ig, '') + .replace(/]+>[\s\S]*?<\/w:[^>]+>/ig, '') + .replace(/]+>[\s\S]*?<\/o:[^>]+>/ig, '') + .replace(/[\s\S]*?<\/xml>/ig, '') + .replace(/<(?:table|td)[^>]*>/ig, function(full) { + return full.replace(/border-bottom:([#\w\s]+)/ig, 'border:$1'); + }); + return _formatHtml(html, htmlTags); +} + +function _mediaType(src) { + if (/\.(rm|rmvb)(\?|$)/i.test(src)) { + return 'audio/x-pn-realaudio-plugin'; + } + if (/\.(swf|flv)(\?|$)/i.test(src)) { + return 'application/x-shockwave-flash'; + } + return 'video/x-ms-asf-plugin'; +} + +function _mediaClass(type) { + if (/realaudio/i.test(type)) { + return 'ke-rm'; + } + if (/flash/i.test(type)) { + return 'ke-flash'; + } + return 'ke-media'; +} +function _mediaAttrs(srcTag) { + return _getAttrList(unescape(srcTag)); +} +function _mediaEmbed(attrs) { + var html = ' 0) { + style += 'width:' + width + 'px;'; + } + if (/\D/.test(height)) { + style += 'height:' + height + ';'; + } else if (height > 0) { + style += 'height:' + height + 'px;'; + } + var html = ''; + return html; +} + + + + +function _tmpl(str, data) { + var fn = new Function("obj", + "var p=[],print=function(){p.push.apply(p,arguments);};" + + "with(obj){p.push('" + + str.replace(/[\r\t\n]/g, " ") + .split("<%").join("\t") + .replace(/((^|%>)[^\t]*)'/g, "$1\r") + .replace(/\t=(.*?)%>/g, "',$1,'") + .split("\t").join("');") + .split("%>").join("p.push('") + .split("\r").join("\\'") + "');}return p.join('');"); + return data ? fn(data) : fn; +} +K.formatUrl = _formatUrl; +K.formatHtml = _formatHtml; +K.getCssList = _getCssList; +K.getAttrList = _getAttrList; +K.mediaType = _mediaType; +K.mediaAttrs = _mediaAttrs; +K.mediaEmbed = _mediaEmbed; +K.mediaImg = _mediaImg; +K.clearMsWord = _clearMsWord; +K.tmpl = _tmpl; + + +function _contains(nodeA, nodeB) { + if (nodeA.nodeType == 9 && nodeB.nodeType != 9) { + return true; + } + while ((nodeB = nodeB.parentNode)) { + if (nodeB == nodeA) { + return true; + } + } + return false; +} +var _getSetAttrDiv = document.createElement('div'); +_getSetAttrDiv.setAttribute('className', 't'); +var _GET_SET_ATTRIBUTE = _getSetAttrDiv.className !== 't'; +function _getAttr(el, key) { + key = key.toLowerCase(); + var val = null; + if (!_GET_SET_ATTRIBUTE && el.nodeName.toLowerCase() != 'script') { + var div = el.ownerDocument.createElement('div'); + div.appendChild(el.cloneNode(false)); + var list = _getAttrList(_unescape(div.innerHTML)); + if (key in list) { + val = list[key]; + } + } else { + try { + val = el.getAttribute(key, 2); + } catch(e) { + val = el.getAttribute(key, 1); + } + } + if (key === 'style' && val !== null) { + val = _formatCss(val); + } + return val; +} +function _queryAll(expr, root) { + var exprList = expr.split(','); + if (exprList.length > 1) { + var mergedResults = []; + _each(exprList, function() { + _each(_queryAll(this, root), function() { + if (_inArray(this, mergedResults) < 0) { + mergedResults.push(this); + } + }); + }); + return mergedResults; + } + root = root || document; + function escape(str) { + if (typeof str != 'string') { + return str; + } + return str.replace(/([^\w\-])/g, '\\$1'); + } + function stripslashes(str) { + return str.replace(/\\/g, ''); + } + function cmpTag(tagA, tagB) { + return tagA === '*' || tagA.toLowerCase() === escape(tagB.toLowerCase()); + } + function byId(id, tag, root) { + var arr = [], + doc = root.ownerDocument || root, + el = doc.getElementById(stripslashes(id)); + if (el) { + if (cmpTag(tag, el.nodeName) && _contains(root, el)) { + arr.push(el); + } + } + return arr; + } + function byClass(className, tag, root) { + var doc = root.ownerDocument || root, arr = [], els, i, len, el; + if (root.getElementsByClassName) { + els = root.getElementsByClassName(stripslashes(className)); + for (i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (cmpTag(tag, el.nodeName)) { + arr.push(el); + } + } + } else if (doc.querySelectorAll) { + els = doc.querySelectorAll((root.nodeName !== '#document' ? root.nodeName + ' ' : '') + tag + '.' + className); + for (i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (_contains(root, el)) { + arr.push(el); + } + } + } else { + els = root.getElementsByTagName(tag); + className = ' ' + className + ' '; + for (i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (el.nodeType == 1) { + var cls = el.className; + if (cls && (' ' + cls + ' ').indexOf(className) > -1) { + arr.push(el); + } + } + } + } + return arr; + } + function byName(name, tag, root) { + var arr = [], doc = root.ownerDocument || root, + els = doc.getElementsByName(stripslashes(name)), el; + for (var i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (cmpTag(tag, el.nodeName) && _contains(root, el)) { + if (el.getAttribute('name') !== null) { + arr.push(el); + } + } + } + return arr; + } + function byAttr(key, val, tag, root) { + var arr = [], els = root.getElementsByTagName(tag), el; + for (var i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (el.nodeType == 1) { + if (val === null) { + if (_getAttr(el, key) !== null) { + arr.push(el); + } + } else { + if (val === escape(_getAttr(el, key))) { + arr.push(el); + } + } + } + } + return arr; + } + function select(expr, root) { + var arr = [], matches; + matches = /^((?:\\.|[^.#\s\[<>])+)/.exec(expr); + var tag = matches ? matches[1] : '*'; + if ((matches = /#((?:[\w\-]|\\.)+)$/.exec(expr))) { + arr = byId(matches[1], tag, root); + } else if ((matches = /\.((?:[\w\-]|\\.)+)$/.exec(expr))) { + arr = byClass(matches[1], tag, root); + } else if ((matches = /\[((?:[\w\-]|\\.)+)\]/.exec(expr))) { + arr = byAttr(matches[1].toLowerCase(), null, tag, root); + } else if ((matches = /\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(expr))) { + var key = matches[1].toLowerCase(), val = matches[2]; + if (key === 'id') { + arr = byId(val, tag, root); + } else if (key === 'class') { + arr = byClass(val, tag, root); + } else if (key === 'name') { + arr = byName(val, tag, root); + } else { + arr = byAttr(key, val, tag, root); + } + } else { + var els = root.getElementsByTagName(tag), el; + for (var i = 0, len = els.length; i < len; i++) { + el = els[i]; + if (el.nodeType == 1) { + arr.push(el); + } + } + } + return arr; + } + var parts = [], arr, re = /((?:\\.|[^\s>])+|[\s>])/g; + while ((arr = re.exec(expr))) { + if (arr[1] !== ' ') { + parts.push(arr[1]); + } + } + var results = []; + if (parts.length == 1) { + return select(parts[0], root); + } + var isChild = false, part, els, subResults, val, v, i, j, k, length, len, l; + for (i = 0, lenth = parts.length; i < lenth; i++) { + part = parts[i]; + if (part === '>') { + isChild = true; + continue; + } + if (i > 0) { + els = []; + for (j = 0, len = results.length; j < len; j++) { + val = results[j]; + subResults = select(part, val); + for (k = 0, l = subResults.length; k < l; k++) { + v = subResults[k]; + if (isChild) { + if (val === v.parentNode) { + els.push(v); + } + } else { + els.push(v); + } + } + } + results = els; + } else { + results = select(part, root); + } + if (results.length === 0) { + return []; + } + } + return results; +} +function _query(expr, root) { + var arr = _queryAll(expr, root); + return arr.length > 0 ? arr[0] : null; +} +K.query = _query; +K.queryAll = _queryAll; + + +function _get(val) { + return K(val)[0]; +} +function _getDoc(node) { + if (!node) { + return document; + } + return node.ownerDocument || node.document || node; +} +function _getWin(node) { + if (!node) { + return window; + } + var doc = _getDoc(node); + return doc.parentWindow || doc.defaultView; +} +function _setHtml(el, html) { + if (el.nodeType != 1) { + return; + } + var doc = _getDoc(el); + try { + el.innerHTML = '' + html; + var temp = doc.getElementById('__kindeditor_temp_tag__'); + temp.parentNode.removeChild(temp); + } catch(e) { + K(el).empty(); + K('@' + html, doc).each(function() { + el.appendChild(this); + }); + } +} +function _hasClass(el, cls) { + return _inString(cls, el.className, ' '); +} +function _setAttr(el, key, val) { + if (_IE && _V < 8 && key.toLowerCase() == 'class') { + key = 'className'; + } + el.setAttribute(key, '' + val); +} +function _removeAttr(el, key) { + if (_IE && _V < 8 && key.toLowerCase() == 'class') { + key = 'className'; + } + _setAttr(el, key, ''); + el.removeAttribute(key); +} +function _getNodeName(node) { + if (!node || !node.nodeName) { + return ''; + } + return node.nodeName.toLowerCase(); +} +function _computedCss(el, key) { + var self = this, win = _getWin(el), camelKey = _toCamel(key), val = ''; + if (win.getComputedStyle) { + var style = win.getComputedStyle(el, null); + val = style[camelKey] || style.getPropertyValue(key) || el.style[camelKey]; + } else if (el.currentStyle) { + val = el.currentStyle[camelKey] || el.style[camelKey]; + } + return val; +} +function _hasVal(node) { + return !!_VALUE_TAG_MAP[_getNodeName(node)]; +} +function _docElement(doc) { + doc = doc || document; + return _QUIRKS ? doc.body : doc.documentElement; +} +function _docHeight(doc) { + var el = _docElement(doc); + return Math.max(el.scrollHeight, el.clientHeight); +} +function _docWidth(doc) { + var el = _docElement(doc); + return Math.max(el.scrollWidth, el.clientWidth); +} +function _getScrollPos(doc) { + doc = doc || document; + var x, y; + if (_IE || _NEWIE || _OPERA) { + x = _docElement(doc).scrollLeft; + y = _docElement(doc).scrollTop; + } else { + x = _getWin(doc).scrollX; + y = _getWin(doc).scrollY; + } + return {x : x, y : y}; +} + + +function KNode(node) { + this.init(node); +} +_extend(KNode, { + init : function(node) { + var self = this; + node = _isArray(node) ? node : [node]; + var length = 0; + for (var i = 0, len = node.length; i < len; i++) { + if (node[i]) { + self[i] = node[i].constructor === KNode ? node[i][0] : node[i]; + length++; + } + } + self.length = length; + self.doc = _getDoc(self[0]); + self.name = _getNodeName(self[0]); + self.type = self.length > 0 ? self[0].nodeType : null; + self.win = _getWin(self[0]); + }, + each : function(fn) { + var self = this; + for (var i = 0; i < self.length; i++) { + if (fn.call(self[i], i, self[i]) === false) { + return self; + } + } + return self; + }, + bind : function(type, fn) { + this.each(function() { + _bind(this, type, fn); + }); + return this; + }, + unbind : function(type, fn) { + this.each(function() { + _unbind(this, type, fn); + }); + return this; + }, + fire : function(type) { + if (this.length < 1) { + return this; + } + _fire(this[0], type); + return this; + }, + hasAttr : function(key) { + if (this.length < 1) { + return false; + } + return !!_getAttr(this[0], key); + }, + attr : function(key, val) { + var self = this; + if (key === undefined) { + return _getAttrList(self.outer()); + } + if (typeof key === 'object') { + _each(key, function(k, v) { + self.attr(k, v); + }); + return self; + } + if (val === undefined) { + val = self.length < 1 ? null : _getAttr(self[0], key); + return val === null ? '' : val; + } + self.each(function() { + _setAttr(this, key, val); + }); + return self; + }, + removeAttr : function(key) { + this.each(function() { + _removeAttr(this, key); + }); + return this; + }, + get : function(i) { + if (this.length < 1) { + return null; + } + return this[i || 0]; + }, + eq : function(i) { + if (this.length < 1) { + return null; + } + return this[i] ? new KNode(this[i]) : null; + }, + hasClass : function(cls) { + if (this.length < 1) { + return false; + } + return _hasClass(this[0], cls); + }, + addClass : function(cls) { + this.each(function() { + if (!_hasClass(this, cls)) { + this.className = _trim(this.className + ' ' + cls); + } + }); + return this; + }, + removeClass : function(cls) { + this.each(function() { + if (_hasClass(this, cls)) { + this.className = _trim(this.className.replace(new RegExp('(^|\\s)' + cls + '(\\s|$)'), ' ')); + } + }); + return this; + }, + html : function(val) { + var self = this; + if (val === undefined) { + if (self.length < 1 || self.type != 1) { + return ''; + } + return _formatHtml(self[0].innerHTML); + } + self.each(function() { + _setHtml(this, val); + }); + return self; + }, + text : function() { + var self = this; + if (self.length < 1) { + return ''; + } + return _IE ? self[0].innerText : self[0].textContent; + }, + hasVal : function() { + if (this.length < 1) { + return false; + } + return _hasVal(this[0]); + }, + val : function(val) { + var self = this; + if (val === undefined) { + if (self.length < 1) { + return ''; + } + return self.hasVal() ? self[0].value : self.attr('value'); + } else { + self.each(function() { + if (_hasVal(this)) { + this.value = val; + } else { + _setAttr(this, 'value' , val); + } + }); + return self; + } + }, + css : function(key, val) { + var self = this; + if (key === undefined) { + return _getCssList(self.attr('style')); + } + if (typeof key === 'object') { + _each(key, function(k, v) { + self.css(k, v); + }); + return self; + } + if (val === undefined) { + if (self.length < 1) { + return ''; + } + return self[0].style[_toCamel(key)] || _computedCss(self[0], key) || ''; + } + self.each(function() { + this.style[_toCamel(key)] = val; + }); + return self; + }, + width : function(val) { + var self = this; + if (val === undefined) { + if (self.length < 1) { + return 0; + } + return self[0].offsetWidth; + } + return self.css('width', _addUnit(val)); + }, + height : function(val) { + var self = this; + if (val === undefined) { + if (self.length < 1) { + return 0; + } + return self[0].offsetHeight; + } + return self.css('height', _addUnit(val)); + }, + opacity : function(val) { + this.each(function() { + if (this.style.opacity === undefined) { + this.style.filter = val == 1 ? '' : 'alpha(opacity=' + (val * 100) + ')'; + } else { + this.style.opacity = val == 1 ? '' : val; + } + }); + return this; + }, + data : function(key, val) { + var self = this; + key = 'kindeditor_data_' + key; + if (val === undefined) { + if (self.length < 1) { + return null; + } + return self[0][key]; + } + this.each(function() { + this[key] = val; + }); + return self; + }, + pos : function() { + var self = this, node = self[0], x = 0, y = 0; + if (node) { + if (node.getBoundingClientRect) { + var box = node.getBoundingClientRect(), + pos = _getScrollPos(self.doc); + x = box.left + pos.x; + y = box.top + pos.y; + } else { + while (node) { + x += node.offsetLeft; + y += node.offsetTop; + node = node.offsetParent; + } + } + } + return {x : _round(x), y : _round(y)}; + }, + clone : function(bool) { + if (this.length < 1) { + return new KNode([]); + } + return new KNode(this[0].cloneNode(bool)); + }, + append : function(expr) { + this.each(function() { + if (this.appendChild) { + this.appendChild(_get(expr)); + } + }); + return this; + }, + appendTo : function(expr) { + this.each(function() { + _get(expr).appendChild(this); + }); + return this; + }, + before : function(expr) { + this.each(function() { + this.parentNode.insertBefore(_get(expr), this); + }); + return this; + }, + after : function(expr) { + this.each(function() { + if (this.nextSibling) { + this.parentNode.insertBefore(_get(expr), this.nextSibling); + } else { + this.parentNode.appendChild(_get(expr)); + } + }); + return this; + }, + replaceWith : function(expr) { + var nodes = []; + this.each(function(i, node) { + _unbind(node); + var newNode = _get(expr); + node.parentNode.replaceChild(newNode, node); + nodes.push(newNode); + }); + return K(nodes); + }, + empty : function() { + var self = this; + self.each(function(i, node) { + var child = node.firstChild; + while (child) { + if (!node.parentNode) { + return; + } + var next = child.nextSibling; + child.parentNode.removeChild(child); + child = next; + } + }); + return self; + }, + remove : function(keepChilds) { + var self = this; + self.each(function(i, node) { + if (!node.parentNode) { + return; + } + _unbind(node); + if (keepChilds) { + var child = node.firstChild; + while (child) { + var next = child.nextSibling; + node.parentNode.insertBefore(child, node); + child = next; + } + } + node.parentNode.removeChild(node); + delete self[i]; + }); + self.length = 0; + return self; + }, + show : function(val) { + var self = this; + if (val === undefined) { + val = self._originDisplay || ''; + } + if (self.css('display') != 'none') { + return self; + } + return self.css('display', val); + }, + hide : function() { + var self = this; + if (self.length < 1) { + return self; + } + self._originDisplay = self[0].style.display; + return self.css('display', 'none'); + }, + outer : function() { + var self = this; + if (self.length < 1) { + return ''; + } + var div = self.doc.createElement('div'), html; + div.appendChild(self[0].cloneNode(true)); + html = _formatHtml(div.innerHTML); + div = null; + return html; + }, + isSingle : function() { + return !!_SINGLE_TAG_MAP[this.name]; + }, + isInline : function() { + return !!_INLINE_TAG_MAP[this.name]; + }, + isBlock : function() { + return !!_BLOCK_TAG_MAP[this.name]; + }, + isStyle : function() { + return !!_STYLE_TAG_MAP[this.name]; + }, + isControl : function() { + return !!_CONTROL_TAG_MAP[this.name]; + }, + contains : function(otherNode) { + if (this.length < 1) { + return false; + } + return _contains(this[0], _get(otherNode)); + }, + parent : function() { + if (this.length < 1) { + return null; + } + var node = this[0].parentNode; + return node ? new KNode(node) : null; + }, + children : function() { + if (this.length < 1) { + return new KNode([]); + } + var list = [], child = this[0].firstChild; + while (child) { + if (child.nodeType != 3 || _trim(child.nodeValue) !== '') { + list.push(child); + } + child = child.nextSibling; + } + return new KNode(list); + }, + first : function() { + var list = this.children(); + return list.length > 0 ? list.eq(0) : null; + }, + last : function() { + var list = this.children(); + return list.length > 0 ? list.eq(list.length - 1) : null; + }, + index : function() { + if (this.length < 1) { + return -1; + } + var i = -1, sibling = this[0]; + while (sibling) { + i++; + sibling = sibling.previousSibling; + } + return i; + }, + prev : function() { + if (this.length < 1) { + return null; + } + var node = this[0].previousSibling; + return node ? new KNode(node) : null; + }, + next : function() { + if (this.length < 1) { + return null; + } + var node = this[0].nextSibling; + return node ? new KNode(node) : null; + }, + scan : function(fn, order) { + if (this.length < 1) { + return; + } + order = (order === undefined) ? true : order; + function walk(node) { + var n = order ? node.firstChild : node.lastChild; + while (n) { + var next = order ? n.nextSibling : n.previousSibling; + if (fn(n) === false) { + return false; + } + if (walk(n) === false) { + return false; + } + n = next; + } + } + walk(this[0]); + return this; + } +}); +_each(('blur,focus,focusin,focusout,load,resize,scroll,unload,click,dblclick,' + + 'mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,' + + 'change,select,submit,keydown,keypress,keyup,error,contextmenu').split(','), function(i, type) { + KNode.prototype[type] = function(fn) { + return fn ? this.bind(type, fn) : this.fire(type); + }; +}); +var _K = K; +K = function(expr, root) { + if (expr === undefined || expr === null) { + return; + } + function newNode(node) { + if (!node[0]) { + node = []; + } + return new KNode(node); + } + if (typeof expr === 'string') { + if (root) { + root = _get(root); + } + var length = expr.length; + if (expr.charAt(0) === '@') { + expr = expr.substr(1); + } + if (expr.length !== length || /<.+>/.test(expr)) { + var doc = root ? root.ownerDocument || root : document, + div = doc.createElement('div'), list = []; + div.innerHTML = '' + expr; + for (var i = 0, len = div.childNodes.length; i < len; i++) { + var child = div.childNodes[i]; + if (child.id == '__kindeditor_temp_tag__') { + continue; + } + list.push(child); + } + return newNode(list); + } + return newNode(_queryAll(expr, root)); + } + if (expr && expr.constructor === KNode) { + return expr; + } + if (expr.toArray) { + expr = expr.toArray(); + } + if (_isArray(expr)) { + return newNode(expr); + } + return newNode(_toArray(arguments)); +}; +_each(_K, function(key, val) { + K[key] = val; +}); +K.NodeClass = KNode; +window.KindEditor = K; + + +var _START_TO_START = 0, + _START_TO_END = 1, + _END_TO_END = 2, + _END_TO_START = 3, + _BOOKMARK_ID = 0; +function _updateCollapsed(range) { + range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); + return range; +} +function _copyAndDelete(range, isCopy, isDelete) { + var doc = range.doc, nodeList = []; + function splitTextNode(node, startOffset, endOffset) { + var length = node.nodeValue.length, centerNode; + if (isCopy) { + var cloneNode = node.cloneNode(true); + if (startOffset > 0) { + centerNode = cloneNode.splitText(startOffset); + } else { + centerNode = cloneNode; + } + if (endOffset < length) { + centerNode.splitText(endOffset - startOffset); + } + } + if (isDelete) { + var center = node; + if (startOffset > 0) { + center = node.splitText(startOffset); + range.setStart(node, startOffset); + } + if (endOffset < length) { + var right = center.splitText(endOffset - startOffset); + range.setEnd(right, 0); + } + nodeList.push(center); + } + return centerNode; + } + function removeNodes() { + if (isDelete) { + range.up().collapse(true); + } + for (var i = 0, len = nodeList.length; i < len; i++) { + var node = nodeList[i]; + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + } + var copyRange = range.cloneRange().down(); + var start = -1, incStart = -1, incEnd = -1, end = -1, + ancestor = range.commonAncestor(), frag = doc.createDocumentFragment(); + if (ancestor.nodeType == 3) { + var textNode = splitTextNode(ancestor, range.startOffset, range.endOffset); + if (isCopy) { + frag.appendChild(textNode); + } + removeNodes(); + return isCopy ? frag : range; + } + function extractNodes(parent, frag) { + var node = parent.firstChild, nextNode; + while (node) { + var testRange = new KRange(doc).selectNode(node); + start = testRange.compareBoundaryPoints(_START_TO_END, range); + if (start >= 0 && incStart <= 0) { + incStart = testRange.compareBoundaryPoints(_START_TO_START, range); + } + if (incStart >= 0 && incEnd <= 0) { + incEnd = testRange.compareBoundaryPoints(_END_TO_END, range); + } + if (incEnd >= 0 && end <= 0) { + end = testRange.compareBoundaryPoints(_END_TO_START, range); + } + if (end >= 0) { + return false; + } + nextNode = node.nextSibling; + if (start > 0) { + if (node.nodeType == 1) { + if (incStart >= 0 && incEnd <= 0) { + if (isCopy) { + frag.appendChild(node.cloneNode(true)); + } + if (isDelete) { + nodeList.push(node); + } + } else { + var childFlag; + if (isCopy) { + childFlag = node.cloneNode(false); + frag.appendChild(childFlag); + } + if (extractNodes(node, childFlag) === false) { + return false; + } + } + } else if (node.nodeType == 3) { + var textNode; + if (node == copyRange.startContainer) { + textNode = splitTextNode(node, copyRange.startOffset, node.nodeValue.length); + } else if (node == copyRange.endContainer) { + textNode = splitTextNode(node, 0, copyRange.endOffset); + } else { + textNode = splitTextNode(node, 0, node.nodeValue.length); + } + if (isCopy) { + try { + frag.appendChild(textNode); + } catch(e) {} + } + } + } + node = nextNode; + } + } + extractNodes(ancestor, frag); + if (isDelete) { + range.up().collapse(true); + } + for (var i = 0, len = nodeList.length; i < len; i++) { + var node = nodeList[i]; + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + return isCopy ? frag : range; +} + +function _moveToElementText(range, el) { + var node = el; + while (node) { + var knode = K(node); + if (knode.name == 'marquee' || knode.name == 'select') { + return; + } + node = node.parentNode; + } + try { + range.moveToElementText(el); + } catch(e) {} +} + +function _getStartEnd(rng, isStart) { + var doc = rng.parentElement().ownerDocument, + pointRange = rng.duplicate(); + pointRange.collapse(isStart); + var parent = pointRange.parentElement(), + nodes = parent.childNodes; + if (nodes.length === 0) { + return {node: parent.parentNode, offset: K(parent).index()}; + } + var startNode = doc, startPos = 0, cmp = -1; + var testRange = rng.duplicate(); + _moveToElementText(testRange, parent); + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i]; + cmp = testRange.compareEndPoints('StartToStart', pointRange); + if (cmp === 0) { + return {node: node.parentNode, offset: i}; + } + if (node.nodeType == 1) { + var nodeRange = rng.duplicate(), dummy, knode = K(node), newNode = node; + if (knode.isControl()) { + dummy = doc.createElement('span'); + knode.after(dummy); + newNode = dummy; + startPos += knode.text().replace(/\r\n|\n|\r/g, '').length; + } + _moveToElementText(nodeRange, newNode); + testRange.setEndPoint('StartToEnd', nodeRange); + if (cmp > 0) { + startPos += nodeRange.text.replace(/\r\n|\n|\r/g, '').length; + } else { + startPos = 0; + } + if (dummy) { + K(dummy).remove(); + } + } else if (node.nodeType == 3) { + testRange.moveStart('character', node.nodeValue.length); + startPos += node.nodeValue.length; + } + if (cmp < 0) { + startNode = node; + } + } + if (cmp < 0 && startNode.nodeType == 1) { + return {node: parent, offset: K(parent.lastChild).index() + 1}; + } + if (cmp > 0) { + while (startNode.nextSibling && startNode.nodeType == 1) { + startNode = startNode.nextSibling; + } + } + testRange = rng.duplicate(); + _moveToElementText(testRange, parent); + testRange.setEndPoint('StartToEnd', pointRange); + startPos -= testRange.text.replace(/\r\n|\n|\r/g, '').length; + if (cmp > 0 && startNode.nodeType == 3) { + var prevNode = startNode.previousSibling; + while (prevNode && prevNode.nodeType == 3) { + startPos -= prevNode.nodeValue.length; + prevNode = prevNode.previousSibling; + } + } + return {node: startNode, offset: startPos}; +} + +function _getEndRange(node, offset) { + var doc = node.ownerDocument || node, + range = doc.body.createTextRange(); + if (doc == node) { + range.collapse(true); + return range; + } + if (node.nodeType == 1 && node.childNodes.length > 0) { + var children = node.childNodes, isStart, child; + if (offset === 0) { + child = children[0]; + isStart = true; + } else { + child = children[offset - 1]; + isStart = false; + } + if (!child) { + return range; + } + if (K(child).name === 'head') { + if (offset === 1) { + isStart = true; + } + if (offset === 2) { + isStart = false; + } + range.collapse(isStart); + return range; + } + if (child.nodeType == 1) { + var kchild = K(child), span; + if (kchild.isControl()) { + span = doc.createElement('span'); + if (isStart) { + kchild.before(span); + } else { + kchild.after(span); + } + child = span; + } + _moveToElementText(range, child); + range.collapse(isStart); + if (span) { + K(span).remove(); + } + return range; + } + node = child; + offset = isStart ? 0 : child.nodeValue.length; + } + var dummy = doc.createElement('span'); + K(node).before(dummy); + _moveToElementText(range, dummy); + range.moveStart('character', offset); + K(dummy).remove(); + return range; +} + +function _toRange(rng) { + var doc, range; + function tr2td(start) { + if (K(start.node).name == 'tr') { + start.node = start.node.cells[start.offset]; + start.offset = 0; + } + } + if (_IERANGE) { + if (rng.item) { + doc = _getDoc(rng.item(0)); + range = new KRange(doc); + range.selectNode(rng.item(0)); + return range; + } + doc = rng.parentElement().ownerDocument; + var start = _getStartEnd(rng, true), + end = _getStartEnd(rng, false); + tr2td(start); + tr2td(end); + range = new KRange(doc); + range.setStart(start.node, start.offset); + range.setEnd(end.node, end.offset); + return range; + } + var startContainer = rng.startContainer; + doc = startContainer.ownerDocument || startContainer; + range = new KRange(doc); + range.setStart(startContainer, rng.startOffset); + range.setEnd(rng.endContainer, rng.endOffset); + return range; +} + + +function KRange(doc) { + this.init(doc); +} +_extend(KRange, { + init : function(doc) { + var self = this; + self.startContainer = doc; + self.startOffset = 0; + self.endContainer = doc; + self.endOffset = 0; + self.collapsed = true; + self.doc = doc; + }, + commonAncestor : function() { + function getParents(node) { + var parents = []; + while (node) { + parents.push(node); + node = node.parentNode; + } + return parents; + } + var parentsA = getParents(this.startContainer), + parentsB = getParents(this.endContainer), + i = 0, lenA = parentsA.length, lenB = parentsB.length, parentA, parentB; + while (++i) { + parentA = parentsA[lenA - i]; + parentB = parentsB[lenB - i]; + if (!parentA || !parentB || parentA !== parentB) { + break; + } + } + return parentsA[lenA - i + 1]; + }, + setStart : function(node, offset) { + var self = this, doc = self.doc; + self.startContainer = node; + self.startOffset = offset; + if (self.endContainer === doc) { + self.endContainer = node; + self.endOffset = offset; + } + return _updateCollapsed(this); + }, + setEnd : function(node, offset) { + var self = this, doc = self.doc; + self.endContainer = node; + self.endOffset = offset; + if (self.startContainer === doc) { + self.startContainer = node; + self.startOffset = offset; + } + return _updateCollapsed(this); + }, + setStartBefore : function(node) { + return this.setStart(node.parentNode || this.doc, K(node).index()); + }, + setStartAfter : function(node) { + return this.setStart(node.parentNode || this.doc, K(node).index() + 1); + }, + setEndBefore : function(node) { + return this.setEnd(node.parentNode || this.doc, K(node).index()); + }, + setEndAfter : function(node) { + return this.setEnd(node.parentNode || this.doc, K(node).index() + 1); + }, + selectNode : function(node) { + return this.setStartBefore(node).setEndAfter(node); + }, + selectNodeContents : function(node) { + var knode = K(node); + if (knode.type == 3 || knode.isSingle()) { + return this.selectNode(node); + } + var children = knode.children(); + if (children.length > 0) { + return this.setStartBefore(children[0]).setEndAfter(children[children.length - 1]); + } + return this.setStart(node, 0).setEnd(node, 0); + }, + collapse : function(toStart) { + if (toStart) { + return this.setEnd(this.startContainer, this.startOffset); + } + return this.setStart(this.endContainer, this.endOffset); + }, + compareBoundaryPoints : function(how, range) { + var rangeA = this.get(), rangeB = range.get(); + if (_IERANGE) { + var arr = {}; + arr[_START_TO_START] = 'StartToStart'; + arr[_START_TO_END] = 'EndToStart'; + arr[_END_TO_END] = 'EndToEnd'; + arr[_END_TO_START] = 'StartToEnd'; + var cmp = rangeA.compareEndPoints(arr[how], rangeB); + if (cmp !== 0) { + return cmp; + } + var nodeA, nodeB, nodeC, posA, posB; + if (how === _START_TO_START || how === _END_TO_START) { + nodeA = this.startContainer; + posA = this.startOffset; + } + if (how === _START_TO_END || how === _END_TO_END) { + nodeA = this.endContainer; + posA = this.endOffset; + } + if (how === _START_TO_START || how === _START_TO_END) { + nodeB = range.startContainer; + posB = range.startOffset; + } + if (how === _END_TO_END || how === _END_TO_START) { + nodeB = range.endContainer; + posB = range.endOffset; + } + if (nodeA === nodeB) { + var diff = posA - posB; + return diff > 0 ? 1 : (diff < 0 ? -1 : 0); + } + nodeC = nodeB; + while (nodeC && nodeC.parentNode !== nodeA) { + nodeC = nodeC.parentNode; + } + if (nodeC) { + return K(nodeC).index() >= posA ? -1 : 1; + } + nodeC = nodeA; + while (nodeC && nodeC.parentNode !== nodeB) { + nodeC = nodeC.parentNode; + } + if (nodeC) { + return K(nodeC).index() >= posB ? 1 : -1; + } + nodeC = K(nodeB).next(); + if (nodeC && nodeC.contains(nodeA)) { + return 1; + } + nodeC = K(nodeA).next(); + if (nodeC && nodeC.contains(nodeB)) { + return -1; + } + } else { + return rangeA.compareBoundaryPoints(how, rangeB); + } + }, + cloneRange : function() { + return new KRange(this.doc).setStart(this.startContainer, this.startOffset).setEnd(this.endContainer, this.endOffset); + }, + toString : function() { + var rng = this.get(), str = _IERANGE ? rng.text : rng.toString(); + return str.replace(/\r\n|\n|\r/g, ''); + }, + cloneContents : function() { + return _copyAndDelete(this, true, false); + }, + deleteContents : function() { + return _copyAndDelete(this, false, true); + }, + extractContents : function() { + return _copyAndDelete(this, true, true); + }, + insertNode : function(node) { + var self = this, + sc = self.startContainer, so = self.startOffset, + ec = self.endContainer, eo = self.endOffset, + firstChild, lastChild, c, nodeCount = 1; + if (node.nodeName.toLowerCase() === '#document-fragment') { + firstChild = node.firstChild; + lastChild = node.lastChild; + nodeCount = node.childNodes.length; + } + if (sc.nodeType == 1) { + c = sc.childNodes[so]; + if (c) { + sc.insertBefore(node, c); + if (sc === ec) { + eo += nodeCount; + } + } else { + sc.appendChild(node); + } + } else if (sc.nodeType == 3) { + if (so === 0) { + sc.parentNode.insertBefore(node, sc); + if (sc.parentNode === ec) { + eo += nodeCount; + } + } else if (so >= sc.nodeValue.length) { + if (sc.nextSibling) { + sc.parentNode.insertBefore(node, sc.nextSibling); + } else { + sc.parentNode.appendChild(node); + } + } else { + if (so > 0) { + c = sc.splitText(so); + } else { + c = sc; + } + sc.parentNode.insertBefore(node, c); + if (sc === ec) { + ec = c; + eo -= so; + } + } + } + if (firstChild) { + self.setStartBefore(firstChild).setEndAfter(lastChild); + } else { + self.selectNode(node); + } + if (self.compareBoundaryPoints(_END_TO_END, self.cloneRange().setEnd(ec, eo)) >= 1) { + return self; + } + return self.setEnd(ec, eo); + }, + surroundContents : function(node) { + node.appendChild(this.extractContents()); + return this.insertNode(node).selectNode(node); + }, + isControl : function() { + var self = this, + sc = self.startContainer, so = self.startOffset, + ec = self.endContainer, eo = self.endOffset, rng; + return sc.nodeType == 1 && sc === ec && so + 1 === eo && K(sc.childNodes[so]).isControl(); + }, + get : function(hasControlRange) { + var self = this, doc = self.doc, node, rng; + if (!_IERANGE) { + rng = doc.createRange(); + try { + rng.setStart(self.startContainer, self.startOffset); + rng.setEnd(self.endContainer, self.endOffset); + } catch (e) {} + return rng; + } + if (hasControlRange && self.isControl()) { + rng = doc.body.createControlRange(); + rng.addElement(self.startContainer.childNodes[self.startOffset]); + return rng; + } + var range = self.cloneRange().down(); + rng = doc.body.createTextRange(); + rng.setEndPoint('StartToStart', _getEndRange(range.startContainer, range.startOffset)); + rng.setEndPoint('EndToStart', _getEndRange(range.endContainer, range.endOffset)); + return rng; + }, + html : function() { + return K(this.cloneContents()).outer(); + }, + down : function() { + var self = this; + function downPos(node, pos, isStart) { + if (node.nodeType != 1) { + return; + } + var children = K(node).children(); + if (children.length === 0) { + return; + } + var left, right, child, offset; + if (pos > 0) { + left = children.eq(pos - 1); + } + if (pos < children.length) { + right = children.eq(pos); + } + if (left && left.type == 3) { + child = left[0]; + offset = child.nodeValue.length; + } + if (right && right.type == 3) { + child = right[0]; + offset = 0; + } + if (!child) { + return; + } + if (isStart) { + self.setStart(child, offset); + } else { + self.setEnd(child, offset); + } + } + downPos(self.startContainer, self.startOffset, true); + downPos(self.endContainer, self.endOffset, false); + return self; + }, + up : function() { + var self = this; + function upPos(node, pos, isStart) { + if (node.nodeType != 3) { + return; + } + if (pos === 0) { + if (isStart) { + self.setStartBefore(node); + } else { + self.setEndBefore(node); + } + } else if (pos == node.nodeValue.length) { + if (isStart) { + self.setStartAfter(node); + } else { + self.setEndAfter(node); + } + } + } + upPos(self.startContainer, self.startOffset, true); + upPos(self.endContainer, self.endOffset, false); + return self; + }, + enlarge : function(toBlock) { + var self = this; + self.up(); + function enlargePos(node, pos, isStart) { + var knode = K(node), parent; + if (knode.type == 3 || _NOSPLIT_TAG_MAP[knode.name] || !toBlock && knode.isBlock()) { + return; + } + if (pos === 0) { + while (!knode.prev()) { + parent = knode.parent(); + if (!parent || _NOSPLIT_TAG_MAP[parent.name] || !toBlock && parent.isBlock()) { + break; + } + knode = parent; + } + if (isStart) { + self.setStartBefore(knode[0]); + } else { + self.setEndBefore(knode[0]); + } + } else if (pos == knode.children().length) { + while (!knode.next()) { + parent = knode.parent(); + if (!parent || _NOSPLIT_TAG_MAP[parent.name] || !toBlock && parent.isBlock()) { + break; + } + knode = parent; + } + if (isStart) { + self.setStartAfter(knode[0]); + } else { + self.setEndAfter(knode[0]); + } + } + } + enlargePos(self.startContainer, self.startOffset, true); + enlargePos(self.endContainer, self.endOffset, false); + return self; + }, + shrink : function() { + var self = this, child, collapsed = self.collapsed; + while (self.startContainer.nodeType == 1 && (child = self.startContainer.childNodes[self.startOffset]) && child.nodeType == 1 && !K(child).isSingle()) { + self.setStart(child, 0); + } + if (collapsed) { + return self.collapse(collapsed); + } + while (self.endContainer.nodeType == 1 && self.endOffset > 0 && (child = self.endContainer.childNodes[self.endOffset - 1]) && child.nodeType == 1 && !K(child).isSingle()) { + self.setEnd(child, child.childNodes.length); + } + return self; + }, + createBookmark : function(serialize) { + var self = this, doc = self.doc, endNode, + startNode = K('', doc)[0]; + startNode.id = '__kindeditor_bookmark_start_' + (_BOOKMARK_ID++) + '__'; + if (!self.collapsed) { + endNode = startNode.cloneNode(true); + endNode.id = '__kindeditor_bookmark_end_' + (_BOOKMARK_ID++) + '__'; + } + if (endNode) { + self.cloneRange().collapse(false).insertNode(endNode).setEndBefore(endNode); + } + self.insertNode(startNode).setStartAfter(startNode); + return { + start : serialize ? '#' + startNode.id : startNode, + end : endNode ? (serialize ? '#' + endNode.id : endNode) : null + }; + }, + moveToBookmark : function(bookmark) { + var self = this, doc = self.doc, + start = K(bookmark.start, doc), end = bookmark.end ? K(bookmark.end, doc) : null; + if (!start || start.length < 1) { + return self; + } + self.setStartBefore(start[0]); + start.remove(); + if (end && end.length > 0) { + self.setEndBefore(end[0]); + end.remove(); + } else { + self.collapse(true); + } + return self; + }, + dump : function() { + console.log('--------------------'); + console.log(this.startContainer.nodeType == 3 ? this.startContainer.nodeValue : this.startContainer, this.startOffset); + console.log(this.endContainer.nodeType == 3 ? this.endContainer.nodeValue : this.endContainer, this.endOffset); + } +}); +function _range(mixed) { + if (!mixed.nodeName) { + return mixed.constructor === KRange ? mixed : _toRange(mixed); + } + return new KRange(mixed); +} +K.RangeClass = KRange; +K.range = _range; +K.START_TO_START = _START_TO_START; +K.START_TO_END = _START_TO_END; +K.END_TO_END = _END_TO_END; +K.END_TO_START = _END_TO_START; + + + +function _nativeCommand(doc, key, val) { + try { + doc.execCommand(key, false, val); + } catch(e) {} +} + +function _nativeCommandValue(doc, key) { + var val = ''; + try { + val = doc.queryCommandValue(key); + } catch (e) {} + if (typeof val !== 'string') { + val = ''; + } + return val; +} + +function _getSel(doc) { + var win = _getWin(doc); + return _IERANGE ? doc.selection : win.getSelection(); +} + +function _getRng(doc) { + var sel = _getSel(doc), rng; + try { + if (sel.rangeCount > 0) { + rng = sel.getRangeAt(0); + } else { + rng = sel.createRange(); + } + } catch(e) {} + if (_IERANGE && (!rng || (!rng.item && rng.parentElement().ownerDocument !== doc))) { + return null; + } + return rng; +} + +function _singleKeyMap(map) { + var newMap = {}, arr, v; + _each(map, function(key, val) { + arr = key.split(','); + for (var i = 0, len = arr.length; i < len; i++) { + v = arr[i]; + newMap[v] = val; + } + }); + return newMap; +} + +function _hasAttrOrCss(knode, map) { + return _hasAttrOrCssByKey(knode, map, '*') || _hasAttrOrCssByKey(knode, map); +} +function _hasAttrOrCssByKey(knode, map, mapKey) { + mapKey = mapKey || knode.name; + if (knode.type !== 1) { + return false; + } + var newMap = _singleKeyMap(map); + if (!newMap[mapKey]) { + return false; + } + var arr = newMap[mapKey].split(','); + for (var i = 0, len = arr.length; i < len; i++) { + var key = arr[i]; + if (key === '*') { + return true; + } + var match = /^(\.?)([^=]+)(?:=([^=]*))?$/.exec(key); + var method = match[1] ? 'css' : 'attr'; + key = match[2]; + var val = match[3] || ''; + if (val === '' && knode[method](key) !== '') { + return true; + } + if (val !== '' && knode[method](key) === val) { + return true; + } + } + return false; +} + +function _removeAttrOrCss(knode, map) { + if (knode.type != 1) { + return; + } + _removeAttrOrCssByKey(knode, map, '*'); + _removeAttrOrCssByKey(knode, map); +} +function _removeAttrOrCssByKey(knode, map, mapKey) { + mapKey = mapKey || knode.name; + if (knode.type !== 1) { + return; + } + var newMap = _singleKeyMap(map); + if (!newMap[mapKey]) { + return; + } + var arr = newMap[mapKey].split(','), allFlag = false; + for (var i = 0, len = arr.length; i < len; i++) { + var key = arr[i]; + if (key === '*') { + allFlag = true; + break; + } + var match = /^(\.?)([^=]+)(?:=([^=]*))?$/.exec(key); + key = match[2]; + if (match[1]) { + key = _toCamel(key); + if (knode[0].style[key]) { + knode[0].style[key] = ''; + } + } else { + knode.removeAttr(key); + } + } + if (allFlag) { + knode.remove(true); + } +} + +function _getInnerNode(knode) { + var inner = knode; + while (inner.first()) { + inner = inner.first(); + } + return inner; +} + +function _isEmptyNode(knode) { + if (knode.type != 1 || knode.isSingle()) { + return false; + } + return knode.html().replace(/<[^>]+>/g, '') === ''; +} + + + + +function _mergeWrapper(a, b) { + a = a.clone(true); + var lastA = _getInnerNode(a), childA = a, merged = false; + while (b) { + while (childA) { + if (childA.name === b.name) { + _mergeAttrs(childA, b.attr(), b.css()); + merged = true; + } + childA = childA.first(); + } + if (!merged) { + lastA.append(b.clone(false)); + } + merged = false; + b = b.first(); + } + return a; +} + +function _wrapNode(knode, wrapper) { + wrapper = wrapper.clone(true); + if (knode.type == 3) { + _getInnerNode(wrapper).append(knode.clone(false)); + knode.replaceWith(wrapper); + return wrapper; + } + var nodeWrapper = knode, child; + while ((child = knode.first()) && child.children().length == 1) { + knode = child; + } + child = knode.first(); + var frag = knode.doc.createDocumentFragment(); + while (child) { + frag.appendChild(child[0]); + child = child.next(); + } + wrapper = _mergeWrapper(nodeWrapper, wrapper); + if (frag.firstChild) { + _getInnerNode(wrapper).append(frag); + } + nodeWrapper.replaceWith(wrapper); + return wrapper; +} + +function _mergeAttrs(knode, attrs, styles) { + _each(attrs, function(key, val) { + if (key !== 'style') { + knode.attr(key, val); + } + }); + _each(styles, function(key, val) { + knode.css(key, val); + }); +} + +function _inPreElement(knode) { + while (knode && knode.name != 'body') { + if (_PRE_TAG_MAP[knode.name] || knode.name == 'div' && knode.hasClass('ke-script')) { + return true; + } + knode = knode.parent(); + } + return false; +} + +function KCmd(range) { + this.init(range); +} +_extend(KCmd, { + init : function(range) { + var self = this, doc = range.doc; + self.doc = doc; + self.win = _getWin(doc); + self.sel = _getSel(doc); + self.range = range; + }, + selection : function(forceReset) { + var self = this, doc = self.doc, rng = _getRng(doc); + self.sel = _getSel(doc); + if (rng) { + self.range = _range(rng); + if (K(self.range.startContainer).name == 'html') { + self.range.selectNodeContents(doc.body).collapse(false); + } + return self; + } + if (forceReset) { + self.range.selectNodeContents(doc.body).collapse(false); + } + return self; + }, + select : function(hasDummy) { + hasDummy = _undef(hasDummy, true); + var self = this, sel = self.sel, range = self.range.cloneRange().shrink(), + sc = range.startContainer, so = range.startOffset, + ec = range.endContainer, eo = range.endOffset, + doc = _getDoc(sc), win = self.win, rng, hasU200b = false; + if (hasDummy && sc.nodeType == 1 && range.collapsed) { + if (_IERANGE) { + var dummy = K(' ', doc); + range.insertNode(dummy[0]); + rng = doc.body.createTextRange(); + try { + rng.moveToElementText(dummy[0]); + } catch(ex) {} + rng.collapse(false); + rng.select(); + dummy.remove(); + win.focus(); + return self; + } + if (_WEBKIT) { + var children = sc.childNodes; + if (K(sc).isInline() || so > 0 && K(children[so - 1]).isInline() || children[so] && K(children[so]).isInline()) { + range.insertNode(doc.createTextNode('\u200B')); + hasU200b = true; + } + } + } + if (_IERANGE) { + try { + rng = range.get(true); + rng.select(); + } catch(e) {} + } else { + if (hasU200b) { + range.collapse(false); + } + rng = range.get(true); + sel.removeAllRanges(); + sel.addRange(rng); + if (doc !== document) { + var pos = K(rng.endContainer).pos(); + win.scrollTo(pos.x, pos.y); + } + } + win.focus(); + return self; + }, + wrap : function(val) { + var self = this, doc = self.doc, range = self.range, wrapper; + wrapper = K(val, doc); + if (range.collapsed) { + range.shrink(); + range.insertNode(wrapper[0]).selectNodeContents(wrapper[0]); + return self; + } + if (wrapper.isBlock()) { + var copyWrapper = wrapper.clone(true), child = copyWrapper; + while (child.first()) { + child = child.first(); + } + child.append(range.extractContents()); + range.insertNode(copyWrapper[0]).selectNode(copyWrapper[0]); + return self; + } + range.enlarge(); + var bookmark = range.createBookmark(), ancestor = range.commonAncestor(), isStart = false; + K(ancestor).scan(function(node) { + if (!isStart && node == bookmark.start) { + isStart = true; + return; + } + if (isStart) { + if (node == bookmark.end) { + return false; + } + var knode = K(node); + if (_inPreElement(knode)) { + return; + } + if (knode.type == 3 && _trim(node.nodeValue).length > 0) { + var parent; + while ((parent = knode.parent()) && parent.isStyle() && parent.children().length == 1) { + knode = parent; + } + _wrapNode(knode, wrapper); + } + } + }); + range.moveToBookmark(bookmark); + return self; + }, + split : function(isStart, map) { + var range = this.range, doc = range.doc; + var tempRange = range.cloneRange().collapse(isStart); + var node = tempRange.startContainer, pos = tempRange.startOffset, + parent = node.nodeType == 3 ? node.parentNode : node, + needSplit = false, knode; + while (parent && parent.parentNode) { + knode = K(parent); + if (map) { + if (!knode.isStyle()) { + break; + } + if (!_hasAttrOrCss(knode, map)) { + break; + } + } else { + if (_NOSPLIT_TAG_MAP[knode.name]) { + break; + } + } + needSplit = true; + parent = parent.parentNode; + } + if (needSplit) { + var dummy = doc.createElement('span'); + range.cloneRange().collapse(!isStart).insertNode(dummy); + if (isStart) { + tempRange.setStartBefore(parent.firstChild).setEnd(node, pos); + } else { + tempRange.setStart(node, pos).setEndAfter(parent.lastChild); + } + var frag = tempRange.extractContents(), + first = frag.firstChild, last = frag.lastChild; + if (isStart) { + tempRange.insertNode(frag); + range.setStartAfter(last).setEndBefore(dummy); + } else { + parent.appendChild(frag); + range.setStartBefore(dummy).setEndBefore(first); + } + var dummyParent = dummy.parentNode; + if (dummyParent == range.endContainer) { + var prev = K(dummy).prev(), next = K(dummy).next(); + if (prev && next && prev.type == 3 && next.type == 3) { + range.setEnd(prev[0], prev[0].nodeValue.length); + } else if (!isStart) { + range.setEnd(range.endContainer, range.endOffset - 1); + } + } + dummyParent.removeChild(dummy); + } + return this; + }, + remove : function(map) { + var self = this, doc = self.doc, range = self.range; + range.enlarge(); + if (range.startOffset === 0) { + var ksc = K(range.startContainer), parent; + while ((parent = ksc.parent()) && parent.isStyle() && parent.children().length == 1) { + ksc = parent; + } + range.setStart(ksc[0], 0); + ksc = K(range.startContainer); + if (ksc.isBlock()) { + _removeAttrOrCss(ksc, map); + } + var kscp = ksc.parent(); + if (kscp && kscp.isBlock()) { + _removeAttrOrCss(kscp, map); + } + } + var sc, so; + if (range.collapsed) { + self.split(true, map); + sc = range.startContainer; + so = range.startOffset; + if (so > 0) { + var sb = K(sc.childNodes[so - 1]); + if (sb && _isEmptyNode(sb)) { + sb.remove(); + range.setStart(sc, so - 1); + } + } + var sa = K(sc.childNodes[so]); + if (sa && _isEmptyNode(sa)) { + sa.remove(); + } + if (_isEmptyNode(sc)) { + range.startBefore(sc); + sc.remove(); + } + range.collapse(true); + return self; + } + self.split(true, map); + self.split(false, map); + var startDummy = doc.createElement('span'), endDummy = doc.createElement('span'); + range.cloneRange().collapse(false).insertNode(endDummy); + range.cloneRange().collapse(true).insertNode(startDummy); + var nodeList = [], cmpStart = false; + K(range.commonAncestor()).scan(function(node) { + if (!cmpStart && node == startDummy) { + cmpStart = true; + return; + } + if (node == endDummy) { + return false; + } + if (cmpStart) { + nodeList.push(node); + } + }); + K(startDummy).remove(); + K(endDummy).remove(); + sc = range.startContainer; + so = range.startOffset; + var ec = range.endContainer, eo = range.endOffset; + if (so > 0) { + var startBefore = K(sc.childNodes[so - 1]); + if (startBefore && _isEmptyNode(startBefore)) { + startBefore.remove(); + range.setStart(sc, so - 1); + if (sc == ec) { + range.setEnd(ec, eo - 1); + } + } + var startAfter = K(sc.childNodes[so]); + if (startAfter && _isEmptyNode(startAfter)) { + startAfter.remove(); + if (sc == ec) { + range.setEnd(ec, eo - 1); + } + } + } + var endAfter = K(ec.childNodes[range.endOffset]); + if (endAfter && _isEmptyNode(endAfter)) { + endAfter.remove(); + } + var bookmark = range.createBookmark(true); + _each(nodeList, function(i, node) { + _removeAttrOrCss(K(node), map); + }); + range.moveToBookmark(bookmark); + return self; + }, + commonNode : function(map) { + var range = this.range; + var ec = range.endContainer, eo = range.endOffset, + node = (ec.nodeType == 3 || eo === 0) ? ec : ec.childNodes[eo - 1]; + function find(node) { + var child = node, parent = node; + while (parent) { + if (_hasAttrOrCss(K(parent), map)) { + return K(parent); + } + parent = parent.parentNode; + } + while (child && (child = child.lastChild)) { + if (_hasAttrOrCss(K(child), map)) { + return K(child); + } + } + return null; + } + var cNode = find(node); + if (cNode) { + return cNode; + } + if (node.nodeType == 1 || (ec.nodeType == 3 && eo === 0)) { + var prev = K(node).prev(); + if (prev) { + return find(prev); + } + } + return null; + }, + commonAncestor : function(tagName) { + var range = this.range, + sc = range.startContainer, so = range.startOffset, + ec = range.endContainer, eo = range.endOffset, + startNode = (sc.nodeType == 3 || so === 0) ? sc : sc.childNodes[so - 1], + endNode = (ec.nodeType == 3 || eo === 0) ? ec : ec.childNodes[eo - 1]; + function find(node) { + while (node) { + if (node.nodeType == 1) { + if (node.tagName.toLowerCase() === tagName) { + return node; + } + } + node = node.parentNode; + } + return null; + } + var start = find(startNode), end = find(endNode); + if (start && end && start === end) { + return K(start); + } + return null; + }, + state : function(key) { + var self = this, doc = self.doc, bool = false; + try { + bool = doc.queryCommandState(key); + } catch (e) {} + return bool; + }, + val : function(key) { + var self = this, doc = self.doc, range = self.range; + function lc(val) { + return val.toLowerCase(); + } + key = lc(key); + var val = '', knode; + if (key === 'fontfamily' || key === 'fontname') { + val = _nativeCommandValue(doc, 'fontname'); + val = val.replace(/['"]/g, ''); + return lc(val); + } + if (key === 'formatblock') { + val = _nativeCommandValue(doc, key); + if (val === '') { + knode = self.commonNode({'h1,h2,h3,h4,h5,h6,p,div,pre,address' : '*'}); + if (knode) { + val = knode.name; + } + } + if (val === 'Normal') { + val = 'p'; + } + return lc(val); + } + if (key === 'fontsize') { + knode = self.commonNode({'*' : '.font-size'}); + if (knode) { + val = knode.css('font-size'); + } + return lc(val); + } + if (key === 'forecolor') { + knode = self.commonNode({'*' : '.color'}); + if (knode) { + val = knode.css('color'); + } + val = _toHex(val); + if (val === '') { + val = 'default'; + } + return lc(val); + } + if (key === 'hilitecolor') { + knode = self.commonNode({'*' : '.background-color'}); + if (knode) { + val = knode.css('background-color'); + } + val = _toHex(val); + if (val === '') { + val = 'default'; + } + return lc(val); + } + return val; + }, + toggle : function(wrapper, map) { + var self = this; + if (self.commonNode(map)) { + self.remove(map); + } else { + self.wrap(wrapper); + } + return self.select(); + }, + bold : function() { + return this.toggle('', { + span : '.font-weight=bold', + strong : '*', + b : '*' + }); + }, + italic : function() { + return this.toggle('', { + span : '.font-style=italic', + em : '*', + i : '*' + }); + }, + underline : function() { + return this.toggle('', { + span : '.text-decoration=underline', + u : '*' + }); + }, + strikethrough : function() { + return this.toggle('', { + span : '.text-decoration=line-through', + s : '*' + }); + }, + forecolor : function(val) { + return this.wrap('').select(); + }, + hilitecolor : function(val) { + return this.wrap('').select(); + }, + fontsize : function(val) { + return this.wrap('').select(); + }, + fontname : function(val) { + return this.fontfamily(val); + }, + fontfamily : function(val) { + return this.wrap('').select(); + }, + removeformat : function() { + var map = { + '*' : '.font-weight,.font-style,.text-decoration,.color,.background-color,.font-size,.font-family,.text-indent' + }, + tags = _STYLE_TAG_MAP; + _each(tags, function(key, val) { + map[key] = '*'; + }); + this.remove(map); + return this.select(); + }, + inserthtml : function(val, quickMode) { + var self = this, range = self.range; + if (val === '') { + return self; + } + function pasteHtml(range, val) { + val = '' + val; + var rng = range.get(); + if (rng.item) { + rng.item(0).outerHTML = val; + } else { + rng.pasteHTML(val); + } + var temp = range.doc.getElementById('__kindeditor_temp_tag__'); + temp.parentNode.removeChild(temp); + var newRange = _toRange(rng); + range.setEnd(newRange.endContainer, newRange.endOffset); + range.collapse(false); + self.select(false); + } + function insertHtml(range, val) { + var doc = range.doc, + frag = doc.createDocumentFragment(); + K('@' + val, doc).each(function() { + frag.appendChild(this); + }); + range.deleteContents(); + range.insertNode(frag); + range.collapse(false); + self.select(false); + } + if (_IERANGE && quickMode) { + try { + pasteHtml(range, val); + } catch(e) { + insertHtml(range, val); + } + return self; + } + insertHtml(range, val); + return self; + }, + hr : function() { + return this.inserthtml('
    '); + }, + print : function() { + this.win.print(); + return this; + }, + insertimage : function(url, title, width, height, border, align) { + title = _undef(title, ''); + border = _undef(border, 0); + var html = ''; + return self.inserthtml(html); + } + if (range.isControl()) { + var node = K(range.startContainer.childNodes[range.startOffset]); + html += '>'; + node.after(K(html, doc)); + node.next().append(node); + range.selectNode(node[0]); + return self.select(); + } + function setAttr(node, url, type) { + K(node).attr('href', url).attr('data-ke-src', url); + if (type) { + K(node).attr('target', type); + } else { + K(node).removeAttr('target'); + } + } + var sc = range.startContainer, so = range.startOffset, + ec = range.endContainer, eo = range.endOffset; + if (sc.nodeType == 1 && sc === ec && so + 1 === eo) { + var child = sc.childNodes[so]; + if (child.nodeName.toLowerCase() == 'a') { + setAttr(child, url, type); + return self; + } + } + _nativeCommand(doc, 'createlink', '__kindeditor_temp_url__'); + K('a[href="__kindeditor_temp_url__"]', doc).each(function() { + setAttr(this, url, type); + }); + return self; + }, + unlink : function() { + var self = this, doc = self.doc, range = self.range; + self.select(); + if (range.collapsed) { + var a = self.commonNode({ a : '*' }); + if (a) { + range.selectNode(a.get()); + self.select(); + } + _nativeCommand(doc, 'unlink', null); + if (_WEBKIT && K(range.startContainer).name === 'img') { + var parent = K(range.startContainer).parent(); + if (parent.name === 'a') { + parent.remove(true); + } + } + } else { + _nativeCommand(doc, 'unlink', null); + } + return self; + } +}); +_each(('formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,' + + 'insertunorderedlist,indent,outdent,subscript,superscript').split(','), function(i, name) { + KCmd.prototype[name] = function(val) { + var self = this; + self.select(); + _nativeCommand(self.doc, name, val); + if (_IERANGE && _inArray(name, 'justifyleft,justifycenter,justifyright,justifyfull'.split(',')) >= 0) { + self.selection(); + } + if (!_IERANGE || _inArray(name, 'formatblock,selectall,insertorderedlist,insertunorderedlist'.split(',')) >= 0) { + self.selection(); + } + return self; + }; +}); +_each('cut,copy,paste'.split(','), function(i, name) { + KCmd.prototype[name] = function() { + var self = this; + if (!self.doc.queryCommandSupported(name)) { + throw 'not supported'; + } + self.select(); + _nativeCommand(self.doc, name, null); + return self; + }; +}); +function _cmd(mixed) { + if (mixed.nodeName) { + var doc = _getDoc(mixed); + mixed = _range(doc).selectNodeContents(doc.body).collapse(false); + } + return new KCmd(mixed); +} +K.CmdClass = KCmd; +K.cmd = _cmd; + + +function _drag(options) { + var moveEl = options.moveEl, + moveFn = options.moveFn, + clickEl = options.clickEl || moveEl, + beforeDrag = options.beforeDrag, + iframeFix = options.iframeFix === undefined ? true : options.iframeFix; + var docs = [document]; + if (iframeFix) { + K('iframe').each(function() { + var src = _formatUrl(this.src || '', 'absolute'); + if (/^https?:\/\//.test(src)) { + return; + } + var doc; + try { + doc = _iframeDoc(this); + } catch(e) {} + if (doc) { + var pos = K(this).pos(); + K(doc).data('pos-x', pos.x); + K(doc).data('pos-y', pos.y); + docs.push(doc); + } + }); + } + clickEl.mousedown(function(e) { + if(e.button !== 0 && e.button !== 1) { + return; + } + e.stopPropagation(); + var self = clickEl.get(), + x = _removeUnit(moveEl.css('left')), + y = _removeUnit(moveEl.css('top')), + width = moveEl.width(), + height = moveEl.height(), + pageX = e.pageX, + pageY = e.pageY; + if (beforeDrag) { + beforeDrag(); + } + function moveListener(e) { + e.preventDefault(); + var kdoc = K(_getDoc(e.target)); + var diffX = _round((kdoc.data('pos-x') || 0) + e.pageX - pageX); + var diffY = _round((kdoc.data('pos-y') || 0) + e.pageY - pageY); + moveFn.call(clickEl, x, y, width, height, diffX, diffY); + } + function selectListener(e) { + e.preventDefault(); + } + function upListener(e) { + e.preventDefault(); + K(docs).unbind('mousemove', moveListener) + .unbind('mouseup', upListener) + .unbind('selectstart', selectListener); + if (self.releaseCapture) { + self.releaseCapture(); + } + } + K(docs).mousemove(moveListener) + .mouseup(upListener) + .bind('selectstart', selectListener); + if (self.setCapture) { + self.setCapture(); + } + }); +} + + +function KWidget(options) { + this.init(options); +} +_extend(KWidget, { + init : function(options) { + var self = this; + self.name = options.name || ''; + self.doc = options.doc || document; + self.win = _getWin(self.doc); + self.x = _addUnit(options.x); + self.y = _addUnit(options.y); + self.z = options.z; + self.width = _addUnit(options.width); + self.height = _addUnit(options.height); + self.div = K('
    '); + self.options = options; + self._alignEl = options.alignEl; + if (self.width) { + self.div.css('width', self.width); + } + if (self.height) { + self.div.css('height', self.height); + } + if (self.z) { + self.div.css({ + position : 'absolute', + left : self.x, + top : self.y, + 'z-index' : self.z + }); + } + if (self.z && (self.x === undefined || self.y === undefined)) { + self.autoPos(self.width, self.height); + } + if (options.cls) { + self.div.addClass(options.cls); + } + if (options.shadowMode) { + self.div.addClass('ke-shadow'); + } + if (options.css) { + self.div.css(options.css); + } + if (options.src) { + K(options.src).replaceWith(self.div); + } else { + K(self.doc.body).append(self.div); + } + if (options.html) { + self.div.html(options.html); + } + if (options.autoScroll) { + if (_IE && _V < 7 || _QUIRKS) { + var scrollPos = _getScrollPos(); + K(self.win).bind('scroll', function(e) { + var pos = _getScrollPos(), + diffX = pos.x - scrollPos.x, + diffY = pos.y - scrollPos.y; + self.pos(_removeUnit(self.x) + diffX, _removeUnit(self.y) + diffY, false); + }); + } else { + self.div.css('position', 'fixed'); + } + } + }, + pos : function(x, y, updateProp) { + var self = this; + updateProp = _undef(updateProp, true); + if (x !== null) { + x = x < 0 ? 0 : _addUnit(x); + self.div.css('left', x); + if (updateProp) { + self.x = x; + } + } + if (y !== null) { + y = y < 0 ? 0 : _addUnit(y); + self.div.css('top', y); + if (updateProp) { + self.y = y; + } + } + return self; + }, + autoPos : function(width, height) { + var self = this, + w = _removeUnit(width) || 0, + h = _removeUnit(height) || 0, + scrollPos = _getScrollPos(); + if (self._alignEl) { + var knode = K(self._alignEl), + pos = knode.pos(), + diffX = _round(knode[0].clientWidth / 2 - w / 2), + diffY = _round(knode[0].clientHeight / 2 - h / 2); + x = diffX < 0 ? pos.x : pos.x + diffX; + y = diffY < 0 ? pos.y : pos.y + diffY; + } else { + var docEl = _docElement(self.doc); + x = _round(scrollPos.x + (docEl.clientWidth - w) / 2); + y = _round(scrollPos.y + (docEl.clientHeight - h) / 2); + } + if (!(_IE && _V < 7 || _QUIRKS)) { + x -= scrollPos.x; + y -= scrollPos.y; + } + return self.pos(x, y); + }, + remove : function() { + var self = this; + if (_IE && _V < 7 || _QUIRKS) { + K(self.win).unbind('scroll'); + } + self.div.remove(); + _each(self, function(i) { + self[i] = null; + }); + return this; + }, + show : function() { + this.div.show(); + return this; + }, + hide : function() { + this.div.hide(); + return this; + }, + draggable : function(options) { + var self = this; + options = options || {}; + options.moveEl = self.div; + options.moveFn = function(x, y, width, height, diffX, diffY) { + if ((x = x + diffX) < 0) { + x = 0; + } + if ((y = y + diffY) < 0) { + y = 0; + } + self.pos(x, y); + }; + _drag(options); + return self; + } +}); +function _widget(options) { + return new KWidget(options); +} +K.WidgetClass = KWidget; +K.widget = _widget; + + +function _iframeDoc(iframe) { + iframe = _get(iframe); + return iframe.contentDocument || iframe.contentWindow.document; +} +var html, _direction = ''; +if ((html = document.getElementsByTagName('html'))) { + _direction = html[0].dir; +} +function _getInitHtml(themesPath, bodyClass, cssPath, cssData) { + var arr = [ + (_direction === '' ? '' : ''), + '', + '' + ]; + if (!_isArray(cssPath)) { + cssPath = [cssPath]; + } + _each(cssPath, function(i, path) { + if (path) { + arr.push(''); + } + }); + if (cssData) { + arr.push(''); + } + arr.push(''); + return arr.join('\n'); +} +function _elementVal(knode, val) { + if (knode.hasVal()) { + if (val === undefined) { + var html = knode.val(); + html = html.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/ig, ''); + return html; + } + return knode.val(val); + } + return knode.html(val); +} + + +function KEdit(options) { + this.init(options); +} +_extend(KEdit, KWidget, { + init : function(options) { + var self = this; + KEdit.parent.init.call(self, options); + self.srcElement = K(options.srcElement); + self.div.addClass('ke-edit'); + self.designMode = _undef(options.designMode, true); + self.beforeGetHtml = options.beforeGetHtml; + self.beforeSetHtml = options.beforeSetHtml; + self.afterSetHtml = options.afterSetHtml; + var themesPath = _undef(options.themesPath, ''), + bodyClass = options.bodyClass, + cssPath = options.cssPath, + cssData = options.cssData, + isDocumentDomain = location.protocol != 'res:' && location.host.replace(/:\d+/, '') !== document.domain, + srcScript = ('document.open();' + + (isDocumentDomain ? 'document.domain="' + document.domain + '";' : '') + + 'document.close();'), + iframeSrc = _IE ? ' src="javascript:void(function(){' + encodeURIComponent(srcScript) + '}())"' : ''; + self.iframe = K('').css('width', '100%'); + self.textarea = K('').css('width', '100%'); + self.tabIndex = isNaN(parseInt(options.tabIndex, 10)) ? self.srcElement.attr('tabindex') : parseInt(options.tabIndex, 10); + self.iframe.attr('tabindex', self.tabIndex); + self.textarea.attr('tabindex', self.tabIndex); + if (self.width) { + self.setWidth(self.width); + } + if (self.height) { + self.setHeight(self.height); + } + if (self.designMode) { + self.textarea.hide(); + } else { + self.iframe.hide(); + } + function ready() { + var doc = _iframeDoc(self.iframe); + doc.open(); + if (isDocumentDomain) { + doc.domain = document.domain; + } + doc.write(_getInitHtml(themesPath, bodyClass, cssPath, cssData)); + doc.close(); + self.win = self.iframe[0].contentWindow; + self.doc = doc; + var cmd = _cmd(doc); + self.afterChange(function(e) { + cmd.selection(); + }); + if (_WEBKIT) { + K(doc).click(function(e) { + if (K(e.target).name === 'img') { + cmd.selection(true); + cmd.range.selectNode(e.target); + cmd.select(); + } + }); + } + if (_IE) { + self._mousedownHandler = function() { + var newRange = cmd.range.cloneRange(); + newRange.shrink(); + if (newRange.isControl()) { + self.blur(); + } + }; + K(document).mousedown(self._mousedownHandler); + K(doc).keydown(function(e) { + if (e.which == 8) { + cmd.selection(); + var rng = cmd.range; + if (rng.isControl()) { + rng.collapse(true); + K(rng.startContainer.childNodes[rng.startOffset]).remove(); + e.preventDefault(); + } + } + }); + } + self.cmd = cmd; + self.html(_elementVal(self.srcElement)); + if (_IE) { + doc.body.disabled = true; + doc.body.contentEditable = true; + doc.body.removeAttribute('disabled'); + } else { + doc.designMode = 'on'; + } + if (options.afterCreate) { + options.afterCreate.call(self); + } + } + if (isDocumentDomain) { + self.iframe.bind('load', function(e) { + self.iframe.unbind('load'); + if (_IE) { + ready(); + } else { + setTimeout(ready, 0); + } + }); + } + self.div.append(self.iframe); + self.div.append(self.textarea); + self.srcElement.hide(); + !isDocumentDomain && ready(); + }, + setWidth : function(val) { + var self = this; + val = _addUnit(val); + self.width = val; + self.div.css('width', val); + return self; + }, + setHeight : function(val) { + var self = this; + val = _addUnit(val); + self.height = val; + self.div.css('height', val); + self.iframe.css('height', val); + if ((_IE && _V < 8) || _QUIRKS) { + val = _addUnit(_removeUnit(val) - 2); + } + self.textarea.css('height', val); + return self; + }, + remove : function() { + var self = this, doc = self.doc; + K(doc.body).unbind(); + K(doc).unbind(); + K(self.win).unbind(); + if (self._mousedownHandler) { + K(document).unbind('mousedown', self._mousedownHandler); + } + _elementVal(self.srcElement, self.html()); + self.srcElement.show(); + self.iframe.unbind(); + self.textarea.unbind(); + KEdit.parent.remove.call(self); + }, + html : function(val, isFull) { + var self = this, doc = self.doc; + if (self.designMode) { + var body = doc.body; + if (val === undefined) { + if (isFull) { + val = '' + body.parentNode.innerHTML + ''; + } else { + val = body.innerHTML; + } + if (self.beforeGetHtml) { + val = self.beforeGetHtml(val); + } + if (_GECKO && val == '
    ') { + val = ''; + } + return val; + } + if (self.beforeSetHtml) { + val = self.beforeSetHtml(val); + } + if (_IE && _V >= 9) { + val = val.replace(/(<.*?checked=")checked(".*>)/ig, '$1$2'); + } + K(body).html(val); + if (self.afterSetHtml) { + self.afterSetHtml(); + } + return self; + } + if (val === undefined) { + return self.textarea.val(); + } + self.textarea.val(val); + return self; + }, + design : function(bool) { + var self = this, val; + if (bool === undefined ? !self.designMode : bool) { + if (!self.designMode) { + val = self.html(); + self.designMode = true; + self.textarea.hide(); + self.html(val); + var iframe = self.iframe; + var height = _removeUnit(self.height); + iframe.height(height - 2); + iframe.show(); + setTimeout(function() { + iframe.height(height); + }, 0); + } + } else { + if (self.designMode) { + val = self.html(); + self.designMode = false; + self.html(val); + self.iframe.hide(); + self.textarea.show(); + } + } + return self.focus(); + }, + focus : function() { + var self = this; + self.designMode ? self.win.focus() : self.textarea[0].focus(); + return self; + }, + blur : function() { + var self = this; + if (_IE) { + var input = K('', self.div); + self.div.append(input); + input[0].focus(); + input.remove(); + } else { + self.designMode ? self.win.blur() : self.textarea[0].blur(); + } + return self; + }, + afterChange : function(fn) { + var self = this, doc = self.doc, body = doc.body; + K(doc).keyup(function(e) { + if (!e.ctrlKey && !e.altKey && _CHANGE_KEY_MAP[e.which]) { + fn(e); + } + }); + K(doc).mouseup(fn).contextmenu(fn); + K(self.win).blur(fn); + function timeoutHandler(e) { + setTimeout(function() { + fn(e); + }, 1); + } + K(body).bind('paste', timeoutHandler); + K(body).bind('cut', timeoutHandler); + return self; + } +}); +function _edit(options) { + return new KEdit(options); +} +K.EditClass = KEdit; +K.edit = _edit; +K.iframeDoc = _iframeDoc; + + +function _selectToolbar(name, fn) { + var self = this, + knode = self.get(name); + if (knode) { + if (knode.hasClass('ke-disabled')) { + return; + } + fn(knode); + } +} + + +function KToolbar(options) { + this.init(options); +} +_extend(KToolbar, KWidget, { + init : function(options) { + var self = this; + KToolbar.parent.init.call(self, options); + self.disableMode = _undef(options.disableMode, false); + self.noDisableItemMap = _toMap(_undef(options.noDisableItems, [])); + self._itemMap = {}; + self.div.addClass('ke-toolbar').bind('contextmenu,mousedown,mousemove', function(e) { + e.preventDefault(); + }).attr('unselectable', 'on'); + function find(target) { + var knode = K(target); + if (knode.hasClass('ke-outline')) { + return knode; + } + if (knode.hasClass('ke-toolbar-icon')) { + return knode.parent(); + } + } + function hover(e, method) { + var knode = find(e.target); + if (knode) { + if (knode.hasClass('ke-disabled')) { + return; + } + if (knode.hasClass('ke-selected')) { + return; + } + knode[method]('ke-on'); + } + } + self.div.mouseover(function(e) { + hover(e, 'addClass'); + }) + .mouseout(function(e) { + hover(e, 'removeClass'); + }) + .click(function(e) { + var knode = find(e.target); + if (knode) { + if (knode.hasClass('ke-disabled')) { + return; + } + self.options.click.call(this, e, knode.attr('data-name')); + } + }); + }, + get : function(name) { + if (this._itemMap[name]) { + return this._itemMap[name]; + } + return (this._itemMap[name] = K('span.ke-icon-' + name, this.div).parent()); + }, + select : function(name) { + _selectToolbar.call(this, name, function(knode) { + knode.addClass('ke-selected'); + }); + return self; + }, + unselect : function(name) { + _selectToolbar.call(this, name, function(knode) { + knode.removeClass('ke-selected').removeClass('ke-on'); + }); + return self; + }, + enable : function(name) { + var self = this, + knode = name.get ? name : self.get(name); + if (knode) { + knode.removeClass('ke-disabled'); + knode.opacity(1); + } + return self; + }, + disable : function(name) { + var self = this, + knode = name.get ? name : self.get(name); + if (knode) { + knode.removeClass('ke-selected').addClass('ke-disabled'); + knode.opacity(0.5); + } + return self; + }, + disableAll : function(bool, noDisableItems) { + var self = this, map = self.noDisableItemMap, item; + if (noDisableItems) { + map = _toMap(noDisableItems); + } + if (bool === undefined ? !self.disableMode : bool) { + K('span.ke-outline', self.div).each(function() { + var knode = K(this), + name = knode[0].getAttribute('data-name', 2); + if (!map[name]) { + self.disable(knode); + } + }); + self.disableMode = true; + } else { + K('span.ke-outline', self.div).each(function() { + var knode = K(this), + name = knode[0].getAttribute('data-name', 2); + if (!map[name]) { + self.enable(knode); + } + }); + self.disableMode = false; + } + return self; + } +}); +function _toolbar(options) { + return new KToolbar(options); +} +K.ToolbarClass = KToolbar; +K.toolbar = _toolbar; + + + +function KMenu(options) { + this.init(options); +} +_extend(KMenu, KWidget, { + init : function(options) { + var self = this; + options.z = options.z || 811213; + KMenu.parent.init.call(self, options); + self.centerLineMode = _undef(options.centerLineMode, true); + self.div.addClass('ke-menu').bind('click,mousedown', function(e){ + e.stopPropagation(); + }).attr('unselectable', 'on'); + }, + addItem : function(item) { + var self = this; + if (item.title === '-') { + self.div.append(K('
    ')); + return; + } + var itemDiv = K('
    '), + leftDiv = K('
    '), + rightDiv = K('
    '), + height = _addUnit(item.height), + iconClass = _undef(item.iconClass, ''); + self.div.append(itemDiv); + if (height) { + itemDiv.css('height', height); + rightDiv.css('line-height', height); + } + var centerDiv; + if (self.centerLineMode) { + centerDiv = K('
    '); + if (height) { + centerDiv.css('height', height); + } + } + itemDiv.mouseover(function(e) { + K(this).addClass('ke-menu-item-on'); + if (centerDiv) { + centerDiv.addClass('ke-menu-item-center-on'); + } + }) + .mouseout(function(e) { + K(this).removeClass('ke-menu-item-on'); + if (centerDiv) { + centerDiv.removeClass('ke-menu-item-center-on'); + } + }) + .click(function(e) { + item.click.call(K(this)); + e.stopPropagation(); + }) + .append(leftDiv); + if (centerDiv) { + itemDiv.append(centerDiv); + } + itemDiv.append(rightDiv); + if (item.checked) { + iconClass = 'ke-icon-checked'; + } + if (iconClass !== '') { + leftDiv.html(''); + } + rightDiv.html(item.title); + return self; + }, + remove : function() { + var self = this; + if (self.options.beforeRemove) { + self.options.beforeRemove.call(self); + } + K('.ke-menu-item', self.div[0]).unbind(); + KMenu.parent.remove.call(self); + return self; + } +}); +function _menu(options) { + return new KMenu(options); +} +K.MenuClass = KMenu; +K.menu = _menu; + + + +function KColorPicker(options) { + this.init(options); +} +_extend(KColorPicker, KWidget, { + init : function(options) { + var self = this; + options.z = options.z || 811213; + KColorPicker.parent.init.call(self, options); + var colors = options.colors || [ + ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'], + ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'], + ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'], + ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000'] + ]; + self.selectedColor = (options.selectedColor || '').toLowerCase(); + self._cells = []; + self.div.addClass('ke-colorpicker').bind('click,mousedown', function(e){ + e.stopPropagation(); + }).attr('unselectable', 'on'); + var table = self.doc.createElement('table'); + self.div.append(table); + table.className = 'ke-colorpicker-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var row = table.insertRow(0), cell = row.insertCell(0); + cell.colSpan = colors[0].length; + self._addAttr(cell, '', 'ke-colorpicker-cell-top'); + for (var i = 0; i < colors.length; i++) { + row = table.insertRow(i + 1); + for (var j = 0; j < colors[i].length; j++) { + cell = row.insertCell(j); + self._addAttr(cell, colors[i][j], 'ke-colorpicker-cell'); + } + } + }, + _addAttr : function(cell, color, cls) { + var self = this; + cell = K(cell).addClass(cls); + if (self.selectedColor === color.toLowerCase()) { + cell.addClass('ke-colorpicker-cell-selected'); + } + cell.attr('title', color || self.options.noColor); + cell.mouseover(function(e) { + K(this).addClass('ke-colorpicker-cell-on'); + }); + cell.mouseout(function(e) { + K(this).removeClass('ke-colorpicker-cell-on'); + }); + cell.click(function(e) { + e.stop(); + self.options.click.call(K(this), color); + }); + if (color) { + cell.append(K('
    ').css('background-color', color)); + } else { + cell.html(self.options.noColor); + } + K(cell).attr('unselectable', 'on'); + self._cells.push(cell); + }, + remove : function() { + var self = this; + _each(self._cells, function() { + this.unbind(); + }); + KColorPicker.parent.remove.call(self); + return self; + } +}); +function _colorpicker(options) { + return new KColorPicker(options); +} +K.ColorPickerClass = KColorPicker; +K.colorpicker = _colorpicker; + + +function KUploadButton(options) { + this.init(options); +} +_extend(KUploadButton, { + init : function(options) { + var self = this, + button = K(options.button), + fieldName = options.fieldName || 'file', + url = options.url || '', + title = button.val(), + extraParams = options.extraParams || {}, + cls = button[0].className || '', + target = options.target || 'kindeditor_upload_iframe_' + new Date().getTime(); + options.afterError = options.afterError || function(str) { + alert(str); + }; + var hiddenElements = []; + for(var k in extraParams){ + hiddenElements.push(''); + } + var html = [ + '
    ', + (options.target ? '' : ''), + (options.form ? '
    ' : '
    '), + '', + hiddenElements.join(''), + '', + '', + '', + (options.form ? '
    ' : ''), + '
    '].join(''); + var div = K(html, button.doc); + button.hide(); + button.before(div); + self.div = div; + self.button = button; + self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div); + self.form = options.form ? K(options.form) : K('form', div); + self.fileBox = K('.ke-upload-file', div); + var width = options.width || K('.ke-button-common', div).width(); + K('.ke-upload-area', div).width(width); + self.options = options; + }, + submit : function() { + var self = this, + iframe = self.iframe; + iframe.bind('load', function() { + iframe.unbind(); + var tempForm = document.createElement('form'); + self.fileBox.before(tempForm); + K(tempForm).append(self.fileBox); + tempForm.reset(); + K(tempForm).remove(true); + var doc = K.iframeDoc(iframe), + pre = doc.getElementsByTagName('pre')[0], + str = '', data; + if (pre) { + str = pre.innerHTML; + } else { + str = doc.body.innerHTML; + } + str = _unescape(str); + iframe[0].src = 'javascript:false'; + try { + data = K.json(str); + } catch (e) { + self.options.afterError.call(self, '' + doc.body.parentNode.innerHTML + ''); + } + if (data) { + self.options.afterUpload.call(self, data); + } + }); + self.form[0].submit(); + return self; + }, + remove : function() { + var self = this; + if (self.fileBox) { + self.fileBox.unbind(); + } + self.iframe.remove(); + self.div.remove(); + self.button.show(); + return self; + } +}); +function _uploadbutton(options) { + return new KUploadButton(options); +} +K.UploadButtonClass = KUploadButton; +K.uploadbutton = _uploadbutton; + + +function _createButton(arg) { + arg = arg || {}; + var name = arg.name || '', + span = K(''), + btn = K(''); + if (arg.click) { + btn.click(arg.click); + } + span.append(btn); + return span; +} + + +function KDialog(options) { + this.init(options); +} +_extend(KDialog, KWidget, { + init : function(options) { + var self = this; + var shadowMode = _undef(options.shadowMode, true); + options.z = options.z || 811213; + options.shadowMode = false; + options.autoScroll = _undef(options.autoScroll, true); + KDialog.parent.init.call(self, options); + var title = options.title, + body = K(options.body, self.doc), + previewBtn = options.previewBtn, + yesBtn = options.yesBtn, + noBtn = options.noBtn, + closeBtn = options.closeBtn, + showMask = _undef(options.showMask, true); + self.div.addClass('ke-dialog').bind('click,mousedown', function(e){ + e.stopPropagation(); + }); + var contentDiv = K('
    ').appendTo(self.div); + if (_IE && _V < 7) { + self.iframeMask = K('').appendTo(self.div); + } else if (shadowMode) { + K('
    ').appendTo(self.div); + } + var headerDiv = K('
    '); + contentDiv.append(headerDiv); + headerDiv.html(title); + self.closeIcon = K('').click(closeBtn.click); + headerDiv.append(self.closeIcon); + self.draggable({ + clickEl : headerDiv, + beforeDrag : options.beforeDrag + }); + var bodyDiv = K('
    '); + contentDiv.append(bodyDiv); + bodyDiv.append(body); + var footerDiv = K(''); + if (previewBtn || yesBtn || noBtn) { + contentDiv.append(footerDiv); + } + _each([ + { btn : previewBtn, name : 'preview' }, + { btn : yesBtn, name : 'yes' }, + { btn : noBtn, name : 'no' } + ], function() { + if (this.btn) { + var button = _createButton(this.btn); + button.addClass('ke-dialog-' + this.name); + footerDiv.append(button); + } + }); + if (self.height) { + bodyDiv.height(_removeUnit(self.height) - headerDiv.height() - footerDiv.height()); + } + self.div.width(self.div.width()); + self.div.height(self.div.height()); + self.mask = null; + if (showMask) { + var docEl = _docElement(self.doc), + docWidth = Math.max(docEl.scrollWidth, docEl.clientWidth), + docHeight = Math.max(docEl.scrollHeight, docEl.clientHeight); + self.mask = _widget({ + x : 0, + y : 0, + z : self.z - 1, + cls : 'ke-dialog-mask', + width : docWidth, + height : docHeight + }); + } + self.autoPos(self.div.width(), self.div.height()); + self.footerDiv = footerDiv; + self.bodyDiv = bodyDiv; + self.headerDiv = headerDiv; + self.isLoading = false; + }, + setMaskIndex : function(z) { + var self = this; + self.mask.div.css('z-index', z); + }, + showLoading : function(msg) { + msg = _undef(msg, ''); + var self = this, body = self.bodyDiv; + self.loading = K('
    ' + msg + '
    ') + .width(body.width()).height(body.height()) + .css('top', self.headerDiv.height() + 'px'); + body.css('visibility', 'hidden').after(self.loading); + self.isLoading = true; + return self; + }, + hideLoading : function() { + this.loading && this.loading.remove(); + this.bodyDiv.css('visibility', 'visible'); + this.isLoading = false; + return this; + }, + remove : function() { + var self = this; + if (self.options.beforeRemove) { + self.options.beforeRemove.call(self); + } + self.mask && self.mask.remove(); + self.iframeMask && self.iframeMask.remove(); + self.closeIcon.unbind(); + K('input', self.div).unbind(); + K('button', self.div).unbind(); + self.footerDiv.unbind(); + self.bodyDiv.unbind(); + self.headerDiv.unbind(); + K('iframe', self.div).each(function() { + K(this).remove(); + }); + KDialog.parent.remove.call(self); + return self; + } +}); +function _dialog(options) { + return new KDialog(options); +} +K.DialogClass = KDialog; +K.dialog = _dialog; + + +function _tabs(options) { + var self = _widget(options), + remove = self.remove, + afterSelect = options.afterSelect, + div = self.div, + liList = []; + div.addClass('ke-tabs') + .bind('contextmenu,mousedown,mousemove', function(e) { + e.preventDefault(); + }); + var ul = K('
      '); + div.append(ul); + self.add = function(tab) { + var li = K('
    • ' + tab.title + '
    • '); + li.data('tab', tab); + liList.push(li); + ul.append(li); + }; + self.selectedIndex = 0; + self.select = function(index) { + self.selectedIndex = index; + _each(liList, function(i, li) { + li.unbind(); + if (i === index) { + li.addClass('ke-tabs-li-selected'); + K(li.data('tab').panel).show(''); + } else { + li.removeClass('ke-tabs-li-selected').removeClass('ke-tabs-li-on') + .mouseover(function() { + K(this).addClass('ke-tabs-li-on'); + }) + .mouseout(function() { + K(this).removeClass('ke-tabs-li-on'); + }) + .click(function() { + self.select(i); + }); + K(li.data('tab').panel).hide(); + } + }); + if (afterSelect) { + afterSelect.call(self, index); + } + }; + self.remove = function() { + _each(liList, function() { + this.remove(); + }); + ul.remove(); + remove.call(self); + }; + return self; +} +K.tabs = _tabs; + + +function _loadScript(url, fn) { + var head = document.getElementsByTagName('head')[0] || (_QUIRKS ? document.body : document.documentElement), + script = document.createElement('script'); + head.appendChild(script); + script.src = url; + script.charset = 'utf-8'; + script.onload = script.onreadystatechange = function() { + if (!this.readyState || this.readyState === 'loaded') { + if (fn) { + fn(); + } + script.onload = script.onreadystatechange = null; + head.removeChild(script); + } + }; +} + + +function _chopQuery(url) { + var index = url.indexOf('?'); + return index > 0 ? url.substr(0, index) : url; +} +function _loadStyle(url) { + var head = document.getElementsByTagName('head')[0] || (_QUIRKS ? document.body : document.documentElement), + link = document.createElement('link'), + absoluteUrl = _chopQuery(_formatUrl(url, 'absolute')); + var links = K('link[rel="stylesheet"]', head); + for (var i = 0, len = links.length; i < len; i++) { + if (_chopQuery(_formatUrl(links[i].href, 'absolute')) === absoluteUrl) { + return; + } + } + head.appendChild(link); + link.href = url; + link.rel = 'stylesheet'; +} +function _ajax(url, fn, method, param, dataType) { + method = method || 'GET'; + dataType = dataType || 'json'; + var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); + xhr.open(method, url, true); + xhr.onreadystatechange = function () { + if (xhr.readyState == 4 && xhr.status == 200) { + if (fn) { + var data = _trim(xhr.responseText); + if (dataType == 'json') { + data = _json(data); + } + fn(data); + } + } + }; + if (method == 'POST') { + var params = []; + _each(param, function(key, val) { + params.push(encodeURIComponent(key) + '=' + encodeURIComponent(val)); + }); + try { + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + } catch (e) {} + xhr.send(params.join('&')); + } else { + xhr.send(null); + } +} +K.loadScript = _loadScript; +K.loadStyle = _loadStyle; +K.ajax = _ajax; + + +var _plugins = {}; +function _plugin(name, fn) { + if (name === undefined) { + return _plugins; + } + if (!fn) { + return _plugins[name]; + } + _plugins[name] = fn; +} +var _language = {}; +function _parseLangKey(key) { + var match, ns = 'core'; + if ((match = /^(\w+)\.(\w+)$/.exec(key))) { + ns = match[1]; + key = match[2]; + } + return { ns : ns, key : key }; +} +function _lang(mixed, langType) { + langType = langType === undefined ? K.options.langType : langType; + if (typeof mixed === 'string') { + if (!_language[langType]) { + return 'no language'; + } + var pos = mixed.length - 1; + if (mixed.substr(pos) === '.') { + return _language[langType][mixed.substr(0, pos)]; + } + var obj = _parseLangKey(mixed); + return _language[langType][obj.ns][obj.key]; + } + _each(mixed, function(key, val) { + var obj = _parseLangKey(key); + if (!_language[langType]) { + _language[langType] = {}; + } + if (!_language[langType][obj.ns]) { + _language[langType][obj.ns] = {}; + } + _language[langType][obj.ns][obj.key] = val; + }); +} + + +function _getImageFromRange(range, fn) { + if (range.collapsed) { + return; + } + range = range.cloneRange().up(); + var sc = range.startContainer, so = range.startOffset; + if (!_WEBKIT && !range.isControl()) { + return; + } + var img = K(sc.childNodes[so]); + if (!img || img.name != 'img') { + return; + } + if (fn(img)) { + return img; + } +} +function _bindContextmenuEvent() { + var self = this, doc = self.edit.doc; + K(doc).contextmenu(function(e) { + if (self.menu) { + self.hideMenu(); + } + if (!self.useContextmenu) { + e.preventDefault(); + return; + } + if (self._contextmenus.length === 0) { + return; + } + var maxWidth = 0, items = []; + _each(self._contextmenus, function() { + if (this.title == '-') { + items.push(this); + return; + } + if (this.cond && this.cond()) { + items.push(this); + if (this.width && this.width > maxWidth) { + maxWidth = this.width; + } + } + }); + while (items.length > 0 && items[0].title == '-') { + items.shift(); + } + while (items.length > 0 && items[items.length - 1].title == '-') { + items.pop(); + } + var prevItem = null; + _each(items, function(i) { + if (this.title == '-' && prevItem.title == '-') { + delete items[i]; + } + prevItem = this; + }); + if (items.length > 0) { + e.preventDefault(); + var pos = K(self.edit.iframe).pos(), + menu = _menu({ + x : pos.x + e.clientX, + y : pos.y + e.clientY, + width : maxWidth, + css : { visibility: 'hidden' }, + shadowMode : self.shadowMode + }); + _each(items, function() { + if (this.title) { + menu.addItem(this); + } + }); + var docEl = _docElement(menu.doc), + menuHeight = menu.div.height(); + if (e.clientY + menuHeight >= docEl.clientHeight - 100) { + menu.pos(menu.x, _removeUnit(menu.y) - menuHeight); + } + menu.div.css('visibility', 'visible'); + self.menu = menu; + } + }); +} +function _bindNewlineEvent() { + var self = this, doc = self.edit.doc, newlineTag = self.newlineTag; + if (_IE && newlineTag !== 'br') { + return; + } + if (_GECKO && _V < 3 && newlineTag !== 'p') { + return; + } + if (_OPERA && _V < 9) { + return; + } + var brSkipTagMap = _toMap('h1,h2,h3,h4,h5,h6,pre,li'), + pSkipTagMap = _toMap('p,h1,h2,h3,h4,h5,h6,pre,li,blockquote'); + function getAncestorTagName(range) { + var ancestor = K(range.commonAncestor()); + while (ancestor) { + if (ancestor.type == 1 && !ancestor.isStyle()) { + break; + } + ancestor = ancestor.parent(); + } + return ancestor.name; + } + K(doc).keydown(function(e) { + if (e.which != 13 || e.shiftKey || e.ctrlKey || e.altKey) { + return; + } + self.cmd.selection(); + var tagName = getAncestorTagName(self.cmd.range); + if (tagName == 'marquee' || tagName == 'select') { + return; + } + if (newlineTag === 'br' && !brSkipTagMap[tagName]) { + e.preventDefault(); + self.insertHtml('
      ' + (_IE && _V < 9 ? '' : '\u200B')); + return; + } + if (!pSkipTagMap[tagName]) { + _nativeCommand(doc, 'formatblock', '

      '); + } + }); + K(doc).keyup(function(e) { + if (e.which != 13 || e.shiftKey || e.ctrlKey || e.altKey) { + return; + } + if (newlineTag == 'br') { + return; + } + if (_GECKO) { + var root = self.cmd.commonAncestor('p'); + var a = self.cmd.commonAncestor('a'); + if (a && a.text() == '') { + a.remove(true); + self.cmd.range.selectNodeContents(root[0]).collapse(true); + self.cmd.select(); + } + return; + } + self.cmd.selection(); + var tagName = getAncestorTagName(self.cmd.range); + if (tagName == 'marquee' || tagName == 'select') { + return; + } + if (!pSkipTagMap[tagName]) { + _nativeCommand(doc, 'formatblock', '

      '); + } + var div = self.cmd.commonAncestor('div'); + if (div) { + var p = K('

      '), + child = div[0].firstChild; + while (child) { + var next = child.nextSibling; + p.append(child); + child = next; + } + div.before(p); + div.remove(); + self.cmd.range.selectNodeContents(p[0]); + self.cmd.select(); + } + }); +} +function _bindTabEvent() { + var self = this, doc = self.edit.doc; + K(doc).keydown(function(e) { + if (e.which == 9) { + e.preventDefault(); + if (self.afterTab) { + self.afterTab.call(self, e); + return; + } + var cmd = self.cmd, range = cmd.range; + range.shrink(); + if (range.collapsed && range.startContainer.nodeType == 1) { + range.insertNode(K('@ ', doc)[0]); + cmd.select(); + } + self.insertHtml('    '); + } + }); +} +function _bindFocusEvent() { + var self = this; + K(self.edit.textarea[0], self.edit.win).focus(function(e) { + if (self.afterFocus) { + self.afterFocus.call(self, e); + } + }).blur(function(e) { + if (self.afterBlur) { + self.afterBlur.call(self, e); + } + }); +} +function _removeBookmarkTag(html) { + return _trim(html.replace(/]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/ig, '')); +} +function _removeTempTag(html) { + return html.replace(/]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/ig, ''); +} +function _addBookmarkToStack(stack, bookmark) { + if (stack.length === 0) { + stack.push(bookmark); + return; + } + var prev = stack[stack.length - 1]; + if (_removeBookmarkTag(bookmark.html) !== _removeBookmarkTag(prev.html)) { + stack.push(bookmark); + } +} + + + +function _undoToRedo(fromStack, toStack) { + var self = this, edit = self.edit, + body = edit.doc.body, + range, bookmark; + if (fromStack.length === 0) { + return self; + } + if (edit.designMode) { + range = self.cmd.range; + bookmark = range.createBookmark(true); + bookmark.html = body.innerHTML; + } else { + bookmark = { + html : body.innerHTML + }; + } + _addBookmarkToStack(toStack, bookmark); + var prev = fromStack.pop(); + if (_removeBookmarkTag(bookmark.html) === _removeBookmarkTag(prev.html) && fromStack.length > 0) { + prev = fromStack.pop(); + } + if (edit.designMode) { + edit.html(prev.html); + if (prev.start) { + range.moveToBookmark(prev); + self.select(); + } + } else { + K(body).html(_removeBookmarkTag(prev.html)); + } + return self; +} +function KEditor(options) { + var self = this; + self.options = {}; + function setOption(key, val) { + if (KEditor.prototype[key] === undefined) { + self[key] = val; + } + self.options[key] = val; + } + _each(options, function(key, val) { + setOption(key, options[key]); + }); + _each(K.options, function(key, val) { + if (self[key] === undefined) { + setOption(key, val); + } + }); + var se = K(self.srcElement || '', + ''].join(''), + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var type = K('.ke-code-type', dialog.div).val(), + code = textarea.val(), + cls = type === '' ? '' : ' lang-' + type, + html = '
      \n' + K.escape(code) + '
      '; + if (K.trim(code) === '') { + alert(lang.pleaseInput); + textarea[0].focus(); + return; + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('emoticons', function(K) { + var self = this, name = 'emoticons', + path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'), + allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons, + currentPageNum = 1; + self.clickToolbar(name, function() { + var rows = 5, cols = 9, total = 135, startNum = 0, + cells = rows * cols, pages = Math.ceil(total / cells), + colsHalf = Math.floor(cols / 2), + wrapperDiv = K('
      '), + elements = [], + menu = self.createMenu({ + name : name, + beforeRemove : function() { + removeEvent(); + } + }); + menu.div.append(wrapperDiv); + var previewDiv, previewImg; + if (allowPreview) { + previewDiv = K('
      ').css('right', 0); + previewImg = K(''); + wrapperDiv.append(previewDiv); + previewDiv.append(previewImg); + } + function bindCellEvent(cell, j, num) { + if (previewDiv) { + cell.mouseover(function() { + if (j > colsHalf) { + previewDiv.css('left', 0); + previewDiv.css('right', ''); + } else { + previewDiv.css('left', ''); + previewDiv.css('right', 0); + } + previewImg.attr('src', path + num + '.gif'); + K(this).addClass('ke-on'); + }); + } else { + cell.mouseover(function() { + K(this).addClass('ke-on'); + }); + } + cell.mouseout(function() { + K(this).removeClass('ke-on'); + }); + cell.click(function(e) { + self.insertHtml('').hideMenu().focus(); + e.stop(); + }); + } + function createEmoticonsTable(pageNum, parentDiv) { + var table = document.createElement('table'); + parentDiv.append(table); + if (previewDiv) { + K(table).mouseover(function() { + previewDiv.show('block'); + }); + K(table).mouseout(function() { + previewDiv.hide(); + }); + elements.push(K(table)); + } + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var num = (pageNum - 1) * cells + startNum; + for (var i = 0; i < rows; i++) { + var row = table.insertRow(i); + for (var j = 0; j < cols; j++) { + var cell = K(row.insertCell(j)); + cell.addClass('ke-cell'); + bindCellEvent(cell, j, num); + var span = K('') + .css('background-position', '-' + (24 * num) + 'px 0px') + .css('background-image', 'url(' + path + 'static.gif)'); + cell.append(span); + elements.push(cell); + num++; + } + } + return table; + } + var table = createEmoticonsTable(currentPageNum, wrapperDiv); + function removeEvent() { + K.each(elements, function() { + this.unbind(); + }); + } + var pageDiv; + function bindPageEvent(el, pageNum) { + el.click(function(e) { + removeEvent(); + table.parentNode.removeChild(table); + pageDiv.remove(); + table = createEmoticonsTable(pageNum, wrapperDiv); + createPageTable(pageNum); + currentPageNum = pageNum; + e.stop(); + }); + } + function createPageTable(currentPageNum) { + pageDiv = K('
      '); + wrapperDiv.append(pageDiv); + for (var pageNum = 1; pageNum <= pages; pageNum++) { + if (currentPageNum !== pageNum) { + var a = K('[' + pageNum + ']'); + bindPageEvent(a, pageNum); + pageDiv.append(a); + elements.push(a); + } else { + pageDiv.append(K('@[' + pageNum + ']')); + } + pageDiv.append(K('@ ')); + } + } + createPageTable(currentPageNum); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('filemanager', function(K) { + var self = this, name = 'filemanager', + fileManagerJson = K.undef(self.fileManagerJson, self.basePath + 'php/file_manager_json.php'), + imgPath = self.pluginsPath + name + '/images/', + lang = self.lang(name + '.'); + function makeFileTitle(filename, filesize, datetime) { + return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')'; + } + function bindTitle(el, data) { + if (data.is_dir) { + el.attr('title', data.filename); + } else { + el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime)); + } + } + self.plugin.filemanagerDialog = function(options) { + var width = K.undef(options.width, 650), + height = K.undef(options.height, 510), + dirName = K.undef(options.dirName, ''), + viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), + clickFn = options.clickFn; + var html = [ + '
      ', + '
      ', + '
      ', + ' ', + '' + lang.moveup + '', + '
      ', + '
      ', + lang.viewType + ' ', + lang.orderType + ' ', + '
      ', + '
      ', + '
      ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : width, + height : height, + title : self.lang(name), + body : html + }), + div = dialog.div, + bodyDiv = K('.ke-plugin-filemanager-body', div), + moveupImg = K('[name="moveupImg"]', div), + moveupLink = K('[name="moveupLink"]', div), + viewServerBtn = K('[name="viewServer"]', div), + viewTypeBox = K('[name="viewType"]', div), + orderTypeBox = K('[name="orderType"]', div); + function reloadPage(path, order, func) { + var param = 'path=' + path + '&order=' + order + '&dir=' + dirName; + dialog.showLoading(self.lang('ajaxLoading')); + K.ajax(K.addParam(fileManagerJson, param + '&' + new Date().getTime()), function(data) { + dialog.hideLoading(); + func(data); + }); + } + var elList = []; + function bindEvent(el, result, data, createFunc) { + var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'), + dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/'); + if (data.is_dir) { + el.click(function(e) { + reloadPage(dirPath, orderTypeBox.val(), createFunc); + }); + } else if (data.is_photo) { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } else { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } + elList.push(el); + } + function createCommon(result, createFunc) { + K.each(elList, function() { + this.unbind(); + }); + moveupLink.unbind(); + viewTypeBox.unbind(); + orderTypeBox.unbind(); + if (result.current_dir_path) { + moveupLink.click(function(e) { + reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc); + }); + } + function changeFunc() { + if (viewTypeBox.val() == 'VIEW') { + reloadPage(result.current_dir_path, orderTypeBox.val(), createView); + } else { + reloadPage(result.current_dir_path, orderTypeBox.val(), createList); + } + } + viewTypeBox.change(changeFunc); + orderTypeBox.change(changeFunc); + bodyDiv.html(''); + } + function createList(result) { + createCommon(result, createList); + var table = document.createElement('table'); + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + bodyDiv.append(table); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], row = K(table.insertRow(i)); + row.mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'), + img = K('' + data.filename + ''), + cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename)); + if (!data.is_dir || data.has_file) { + row.css('cursor', 'pointer'); + cell0.attr('title', data.filename); + bindEvent(cell0, result, data, createList); + } else { + cell0.attr('title', lang.emptyFolder); + } + K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB'); + K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime); + } + } + function createView(result) { + createCommon(result, createView); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], + div = K('
      '); + bodyDiv.append(div); + var photoDiv = K('
      ') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + div.append(photoDiv); + var fileUrl = result.current_url + data.filename, + iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif'); + var img = K('' + data.filename + ''); + if (!data.is_dir || data.has_file) { + photoDiv.css('cursor', 'pointer'); + bindTitle(photoDiv, data); + bindEvent(photoDiv, result, data, createView); + } else { + photoDiv.attr('title', lang.emptyFolder); + } + photoDiv.append(img); + div.append('
      ' + data.filename + '
      '); + } + } + viewTypeBox.val(viewType); + reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList); + return dialog; + } +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('flash', function(K) { + var self = this, name = 'flash', lang = self.lang(name + '.'), + allowFlashUpload = K.undef(self.allowFlashUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.flash = { + edit : function() { + var html = [ + '
      ', + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + '
      ', + '', + ' ', + '
      ', + '
      ', + '', + ' ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType('.swf'), + width : width, + height : height, + quality : 'high' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div); + urlBox.val('http://'); + if (allowFlashUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + extraParams : extraParams, + url : K.addParam(uploadJson, 'dir=flash'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'flash', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + var img = self.plugin.getSelectedFlash(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedFlash().remove(); + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.flash.edit); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('image', function(K) { + var self = this, name = 'image', + allowImageUpload = K.undef(self.allowImageUpload, true), + allowImageRemote = K.undef(self.allowImageRemote, true), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imageTabIndex = K.undef(self.imageTabIndex, 0), + imgPath = self.pluginsPath + 'image/images/', + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + fillDescAfterUploadImage = K.undef(self.fillDescAfterUploadImage, false), + lang = self.lang(name + '.'); + self.plugin.imageDialog = function(options) { + var imageUrl = options.imageUrl, + imageWidth = K.undef(options.imageWidth, ''), + imageHeight = K.undef(options.imageHeight, ''), + imageTitle = K.undef(options.imageTitle, ''), + imageAlign = K.undef(options.imageAlign, ''), + showRemote = K.undef(options.showRemote, true), + showLocal = K.undef(options.showLocal, true), + tabIndex = K.undef(options.tabIndex, 0), + clickFn = options.clickFn; + var target = 'kindeditor_upload_iframe_' + new Date().getTime(); + var hiddenElements = []; + for(var k in extraParams){ + hiddenElements.push(''); + } + var html = [ + '
      ', + '
      ', + '', + '', + '
      ' + ].join(''); + var dialogWidth = showLocal || allowFileManager ? 450 : 400, + dialogHeight = showLocal && showRemote ? 300 : 250; + var dialog = self.createDialog({ + name : name, + width : dialogWidth, + height : dialogHeight, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + if (dialog.isLoading) { + return; + } + if (showLocal && showRemote && tabs && tabs.selectedIndex === 1 || !showRemote) { + if (uploadbutton.fileBox.val() == '') { + alert(self.lang('pleaseSelectFile')); + return; + } + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + localUrlBox.val(''); + return; + } + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(), + title = titleBox.val(), + align = ''; + alignBox.each(function() { + if (this.checked) { + align = this.value; + return false; + } + }); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + clickFn.call(self, url, title, width, height, 0, align); + } + }, + beforeRemove : function() { + viewServerBtn.unbind(); + widthBox.unbind(); + heightBox.unbind(); + refreshBtn.unbind(); + } + }), + div = dialog.div; + var urlBox = K('[name="url"]', div), + localUrlBox = K('[name="localUrl"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('.tab1 [name="width"]', div), + heightBox = K('.tab1 [name="height"]', div), + refreshBtn = K('.ke-refresh-btn', div), + titleBox = K('.tab1 [name="title"]', div), + alignBox = K('.tab1 [name="align"]', div); + var tabs; + if (showRemote && showLocal) { + tabs = K.tabs({ + src : K('.tabs', div), + afterSelect : function(i) {} + }); + tabs.add({ + title : lang.remoteImage, + panel : K('.tab1', div) + }); + tabs.add({ + title : lang.localImage, + panel : K('.tab2', div) + }); + tabs.select(tabIndex); + } else if (showRemote) { + K('.tab1', div).show(); + } else if (showLocal) { + K('.tab2', div).show(); + } + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + form : K('.ke-form', div), + target : target, + width: 60, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + if (!fillDescAfterUploadImage) { + clickFn.call(self, url, data.title, data.width, data.height, data.border, data.align); + } else { + K(".ke-dialog-row #remoteUrl", div).val(url); + K(".ke-tabs-li", div)[0].click(); + K(".ke-refresh-btn", div).click(); + } + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + localUrlBox.val(uploadbutton.fileBox.val()); + }); + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'VIEW', + dirName : 'image', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + var originalWidth = 0, originalHeight = 0; + function setSize(width, height) { + widthBox.val(width); + heightBox.val(height); + originalWidth = width; + originalHeight = height; + } + refreshBtn.click(function(e) { + var tempImg = K('', document).css({ + position : 'absolute', + visibility : 'hidden', + top : 0, + left : '-1000px' + }); + tempImg.bind('load', function() { + setSize(tempImg.width(), tempImg.height()); + tempImg.remove(); + }); + K(document.body).append(tempImg); + }); + widthBox.change(function(e) { + if (originalWidth > 0) { + heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10))); + } + }); + heightBox.change(function(e) { + if (originalHeight > 0) { + widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10))); + } + }); + urlBox.val(options.imageUrl); + setSize(options.imageWidth, options.imageHeight); + titleBox.val(options.imageTitle); + alignBox.each(function() { + if (this.value === options.imageAlign) { + this.checked = true; + return false; + } + }); + if (showRemote && tabIndex === 0) { + urlBox[0].focus(); + urlBox[0].select(); + } + return dialog; + }; + self.plugin.image = { + edit : function() { + var img = self.plugin.getSelectedImage(); + self.plugin.imageDialog({ + imageUrl : img ? img.attr('data-ke-src') : 'http://', + imageWidth : img ? img.width() : '', + imageHeight : img ? img.height() : '', + imageTitle : img ? img.attr('title') : '', + imageAlign : img ? img.attr('align') : '', + showRemote : allowImageRemote, + showLocal : allowImageUpload, + tabIndex: img ? 0 : imageTabIndex, + clickFn : function(url, title, width, height, border, align) { + if (img) { + img.attr('src', url); + img.attr('data-ke-src', url); + img.attr('width', width); + img.attr('height', height); + img.attr('title', title); + img.attr('align', align); + img.attr('alt', title); + } else { + self.exec('insertimage', url, title, width, height, border, align); + } + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }, + 'delete' : function() { + var target = self.plugin.getSelectedImage(); + if (target.parent().name == 'a') { + target = target.parent(); + } + target.remove(); + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.image.edit); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('insertfile', function(K) { + var self = this, name = 'insertfile', + allowFileUpload = K.undef(self.allowFileUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + lang = self.lang(name + '.'); + self.plugin.fileDialog = function(options) { + var fileUrl = K.undef(options.fileUrl, 'http://'), + fileTitle = K.undef(options.fileTitle, ''), + clickFn = options.clickFn; + var html = [ + '
      ', + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + '
      ', + '', + '
      ', + '
      ', + '', + '' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + title = titleBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (K.trim(title) === '') { + title = url; + } + clickFn.call(self, url, title); + } + } + }), + div = dialog.div; + var urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + titleBox = K('[name="title"]', div); + if (allowFileUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + url : K.addParam(uploadJson, 'dir=file'), + extraParams : extraParams, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'file', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + urlBox.val(fileUrl); + titleBox.val(fileTitle); + urlBox[0].focus(); + urlBox[0].select(); + }; + self.clickToolbar(name, function() { + self.plugin.fileDialog({ + clickFn : function(url, title) { + var html = '' + title + ''; + self.insertHtml(html).hideDialog().focus(); + } + }); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('lineheight', function(K) { + var self = this, name = 'lineheight', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); + if (commonNode) { + curVal = commonNode.css('line-height'); + } + var menu = self.createMenu({ + name : name, + width : 150 + }); + K.each(lang.lineHeight, function(i, row) { + K.each(row, function(key, val) { + menu.addItem({ + title : val, + checked : curVal === key, + click : function() { + self.cmd.toggle('', { + span : '.line-height=' + key + }); + self.updateState(); + self.addBookmark(); + self.hideMenu(); + } + }); + }); + }); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('link', function(K) { + var self = this, name = 'link'; + self.plugin.link = { + edit : function() { + var lang = self.lang(name + '.'), + html = '
      ' + + '
      ' + + '' + + '
      ' + + '
      ' + + '' + + '' + + '
      ' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + self.exec('createlink', url, typeBox.val()).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('input[name="url"]', div), + typeBox = K('select[name="type"]', div); + urlBox.val('http://'); + typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); + typeBox[0].options[1] = new Option(lang.selfWindow, ''); + self.cmd.selection(); + var a = self.plugin.getSelectedLink(); + if (a) { + self.cmd.range.selectNode(a[0]); + self.cmd.select(); + urlBox.val(a.attr('data-ke-src')); + typeBox.val(a.attr('target')); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.exec('unlink', null); + } + }; + self.clickToolbar(name, self.plugin.link.edit); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('media', function(K) { + var self = this, name = 'media', lang = self.lang(name + '.'), + allowMediaUpload = K.undef(self.allowMediaUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.media = { + edit : function() { + var html = [ + '
      ', + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + '
      ', + '', + '', + '
      ', + '
      ', + '', + '', + '
      ', + '
      ', + '', + ' ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 230, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType(url), + width : width, + height : height, + autostart : autostartBox[0].checked ? 'true' : 'false', + loop : 'true' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div), + autostartBox = K('[name="autostart"]', div); + urlBox.val('http://'); + if (allowMediaUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + extraParams : extraParams, + url : K.addParam(uploadJson, 'dir=media'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'media', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + var img = self.plugin.getSelectedMedia(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + autostartBox[0].checked = (attrs.autostart === 'true'); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedMedia().remove(); + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.media.edit); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +(function(K) { +function KSWFUpload(options) { + this.init(options); +} +K.extend(KSWFUpload, { + init : function(options) { + var self = this; + options.afterError = options.afterError || function(str) { + alert(str); + }; + self.options = options; + self.progressbars = {}; + self.div = K(options.container).html([ + '
      ', + '
      ', + '
      ', + '', + '
      ', + '
      ' + options.uploadDesc + '
      ', + '', + '', + '', + '
      ', + '
      ', + '
      ' + ].join('')); + self.bodyDiv = K('.ke-swfupload-body', self.div); + function showError(itemDiv, msg) { + K('.ke-status > div', itemDiv).hide(); + K('.ke-message', itemDiv).addClass('ke-error').show().html(K.escape(msg)); + } + var settings = { + debug : false, + upload_url : options.uploadUrl, + flash_url : options.flashUrl, + file_post_name : options.filePostName, + button_placeholder : K('.ke-swfupload-button > input', self.div)[0], + button_image_url: options.buttonImageUrl, + button_width: options.buttonWidth, + button_height: options.buttonHeight, + button_cursor : SWFUpload.CURSOR.HAND, + file_types : options.fileTypes, + file_types_description : options.fileTypesDesc, + file_upload_limit : options.fileUploadLimit, + file_size_limit : options.fileSizeLimit, + post_params : options.postParams, + file_queued_handler : function(file) { + file.url = self.options.fileIconUrl; + self.appendFile(file); + }, + file_queue_error_handler : function(file, errorCode, message) { + var errorName = ''; + switch (errorCode) { + case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: + errorName = options.queueLimitExceeded; + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + errorName = options.fileExceedsSizeLimit; + break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + errorName = options.zeroByteFile; + break; + case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: + errorName = options.invalidFiletype; + break; + default: + errorName = options.unknownError; + break; + } + K.DEBUG && alert(errorName); + }, + upload_start_handler : function(file) { + var self = this; + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv); + K('.ke-status > div', itemDiv).hide(); + K('.ke-progressbar', itemDiv).show(); + }, + upload_progress_handler : function(file, bytesLoaded, bytesTotal) { + var percent = Math.round(bytesLoaded * 100 / bytesTotal); + var progressbar = self.progressbars[file.id]; + progressbar.bar.css('width', Math.round(percent * 80 / 100) + 'px'); + progressbar.percent.html(percent + '%'); + }, + upload_error_handler : function(file, errorCode, message) { + if (file && file.filestatus == SWFUpload.FILE_STATUS.ERROR) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + showError(itemDiv, self.options.errorMessage); + } + }, + upload_success_handler : function(file, serverData) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + var data = {}; + try { + data = K.json(serverData); + } catch (e) { + self.options.afterError.call(this, '' + serverData + ''); + } + if (data.error !== 0) { + showError(itemDiv, K.DEBUG ? data.message : self.options.errorMessage); + return; + } + file.url = data.url; + K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus).data('data', data); + K('.ke-status > div', itemDiv).hide(); + } + }; + self.swfu = new SWFUpload(settings); + K('.ke-swfupload-startupload input', self.div).click(function() { + self.swfu.startUpload(); + }); + }, + getUrlList : function() { + var list = []; + K('.ke-img', self.bodyDiv).each(function() { + var img = K(this); + var status = img.attr('data-status'); + if (status == SWFUpload.FILE_STATUS.COMPLETE) { + list.push(img.data('data')); + } + }); + return list; + }, + removeFile : function(fileId) { + var self = this; + self.swfu.cancelUpload(fileId); + var itemDiv = K('div[data-id="' + fileId + '"]', self.bodyDiv); + K('.ke-photo', itemDiv).unbind(); + K('.ke-delete', itemDiv).unbind(); + itemDiv.remove(); + }, + removeFiles : function() { + var self = this; + K('.ke-item', self.bodyDiv).each(function() { + self.removeFile(K(this).attr('data-id')); + }); + }, + appendFile : function(file) { + var self = this; + var itemDiv = K('
      '); + self.bodyDiv.append(itemDiv); + var photoDiv = K('
      ') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + itemDiv.append(photoDiv); + var img = K('' + file.name + ''); + photoDiv.append(img); + K('').appendTo(photoDiv).click(function() { + self.removeFile(file.id); + }); + var statusDiv = K('
      ').appendTo(photoDiv); + K(['
      ', + '
      ', + '
      0%
      '].join('')).hide().appendTo(statusDiv); + K('
      ' + self.options.pendingMessage + '
      ').appendTo(statusDiv); + itemDiv.append('
      ' + file.name + '
      '); + self.progressbars[file.id] = { + bar : K('.ke-progressbar-bar-inner', photoDiv), + percent : K('.ke-progressbar-percent', photoDiv) + }; + }, + remove : function() { + this.removeFiles(); + this.swfu.destroy(); + this.div.html(''); + } +}); +K.swfupload = function(element, options) { + return new KSWFUpload(element, options); +}; +})(KindEditor); +KindEditor.plugin('multiimage', function(K) { + var self = this, name = 'multiimage', + formatUploadUrl = K.undef(self.formatUploadUrl, true), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imgPath = self.pluginsPath + 'multiimage/images/', + imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'), + imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'), + imageUploadLimit = K.undef(self.imageUploadLimit, 20), + filePostName = K.undef(self.filePostName, 'imgFile'), + lang = self.lang(name + '.'); + self.plugin.multiImageDialog = function(options) { + var clickFn = options.clickFn, + uploadDesc = K.tmpl(lang.uploadDesc, {uploadLimit : imageUploadLimit, sizeLimit : imageSizeLimit}); + var html = [ + '
      ', + '
      ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 650, + height : 510, + title : self.lang(name), + body : html, + previewBtn : { + name : lang.insertAll, + click : function(e) { + clickFn.call(self, swfupload.getUrlList()); + } + }, + yesBtn : { + name : lang.clearAll, + click : function(e) { + swfupload.removeFiles(); + } + }, + beforeRemove : function() { + if (!K.IE || K.V <= 8) { + swfupload.remove(); + } + } + }), + div = dialog.div; + var swfupload = K.swfupload({ + container : K('.swfupload', div), + buttonImageUrl : imgPath + (self.langType == 'zh-CN' ? 'select-files-zh-CN.png' : 'select-files-en.png'), + buttonWidth : self.langType == 'zh-CN' ? 72 : 88, + buttonHeight : 23, + fileIconUrl : imgPath + 'image.png', + uploadDesc : uploadDesc, + startButtonValue : lang.startUpload, + uploadUrl : K.addParam(uploadJson, 'dir=image'), + flashUrl : imgPath + 'swfupload.swf', + filePostName : filePostName, + fileTypes : '*.jpg;*.jpeg;*.gif;*.png;*.bmp', + fileTypesDesc : 'Image Files', + fileUploadLimit : imageUploadLimit, + fileSizeLimit : imageSizeLimit, + postParams : K.undef(self.extraFileUploadParams, {}), + queueLimitExceeded : lang.queueLimitExceeded, + fileExceedsSizeLimit : lang.fileExceedsSizeLimit, + zeroByteFile : lang.zeroByteFile, + invalidFiletype : lang.invalidFiletype, + unknownError : lang.unknownError, + pendingMessage : lang.pending, + errorMessage : lang.uploadError, + afterError : function(html) { + self.errorDialog(html); + } + }); + return dialog; + }; + self.clickToolbar(name, function() { + self.plugin.multiImageDialog({ + clickFn : function (urlList) { + if (urlList.length === 0) { + return; + } + K.each(urlList, function(i, data) { + if (self.afterUpload) { + self.afterUpload.call(self, data.url, data, 'multiimage'); + } + self.exec('insertimage', data.url, data.title, data.width, data.height, data.border, data.align); + }); + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }); +}); +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ +(function() { +window.SWFUpload = function (settings) { + this.initSWFUpload(settings); +}; +SWFUpload.prototype.initSWFUpload = function (settings) { + try { + this.customSettings = {}; + this.settings = settings; + this.eventQueue = []; + this.movieName = "KindEditor_SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + SWFUpload.instances[this.movieName] = this; + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (ex) { + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; +SWFUpload.completeURL = function(url) { + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { + return url; + } + var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + var indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + return /*currentURL +*/ path + url; +}; +/* ******************** */ +/* Instance Members */ +/* ******************** */ +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + this.ensureDefault("debug_handler", this.debugMessage); + this.ensureDefault("custom_settings", {}); + this.customSettings = this.settings.custom_settings; + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + if (!this.settings.preserve_relative_urls) { + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + delete this.ensureDefault; +}; +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent; + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + if (targetElement == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + tempParent = document.createElement("div"); + tempParent.innerHTML = this.getFlashHTML(); + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } +}; +SWFUpload.prototype.getFlashHTML = function () { + var classid = ''; + if (KindEditor.IE && KindEditor.V > 8) { + classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'; + } + return ['', + '', + '', + '', + '', + '', + '', + ''].join(""); +}; +SWFUpload.prototype.getFlashVars = function () { + var paramString = this.buildParamString(); + var httpSuccessString = this.settings.http_success.join(","); + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + return this.movieElement; +}; +SWFUpload.prototype.buildParamString = function () { + var postParams = this.settings.post_params; + var paramStringPairs = []; + if (typeof(postParams) === "object") { + for (var name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + return paramStringPairs.join("&"); +}; +SWFUpload.prototype.destroy = function () { + try { + this.cancelUpload(null, false); + var movieElement = null; + movieElement = this.getMovieElement(); + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { + for (var i in movieElement) { + try { + if (typeof(movieElement[i]) === "function") { + movieElement[i] = null; + } + } catch (ex1) {} + } + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + window[this.movieName] = null; + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + return true; + } catch (ex2) { + return false; + } +}; +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" + ].join("") + ); +}; +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + return ""; +}; +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + var movieElement = this.getMovieElement(); + var returnValue, returnString; + try { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + return returnValue; +}; +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + this.callFlash("SetButtonDimensions", [width, height]); +}; +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + All these functions a Private. + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + var self = this; + if (typeof this.settings[handlerName] === "function") { + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + setTimeout(function () { + self.executeNextEvent(); + }, 0); + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; +SWFUpload.prototype.executeNextEvent = function () { + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i; + var unescapedPost = {}; + var uk; + if (file != undefined) { + for (var k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + var match; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + file.post = unescapedPost; + } + return file; +}; +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (ex) { + return false; + } +}; +SWFUpload.prototype.flashReady = function () { + var movieElement = this.getMovieElement(); + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + this.cleanUp(movieElement); + this.queueEvent("swfupload_loaded_handler"); +}; +SWFUpload.prototype.cleanUp = function (movieElement) { + try { + if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + } + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + } + }; +}; +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + if (returnValue === undefined) { + returnValue = true; + } + returnValue = !!returnValue; + this.callFlash("ReturnUploadStart", [returnValue]); +}; +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + The console is automatically scrolled as messages appear. + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ +SWFUpload.prototype.debugMessage = function (message) { + if (this.settings.debug) { + var exceptionMessage, exceptionValues = []; + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (var key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + try { + console = document.getElementById("SWFUpload_Console"); + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + console.value += message + "\n"; + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; +})(); +(function() { +/* + Queue Plug-in + Features: + *Adds a cancelQueue() method for cancelling the entire queue. + *All queued files are uploaded when startUpload() is called. + *If false is returned from uploadComplete then the queue upload is stopped. + If false is not returned (strict comparison) then the queue upload is continued. + *Adds a QueueComplete event that is fired when all the queued files have finished uploading. + Set the event handler with the queue_complete_handler setting. + */ +if (typeof(SWFUpload) === "function") { + SWFUpload.queue = {}; + SWFUpload.prototype.initSettings = (function (oldInitSettings) { + return function () { + if (typeof(oldInitSettings) === "function") { + oldInitSettings.call(this); + } + this.queueSettings = {}; + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler; + this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler; + this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler; + this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler; + this.settings.queue_complete_handler = this.settings.queue_complete_handler || null; + }; + })(SWFUpload.prototype.initSettings); + SWFUpload.prototype.startUpload = function (fileID) { + this.queueSettings.queue_cancelled_flag = false; + this.callFlash("StartUpload", [fileID]); + }; + SWFUpload.prototype.cancelQueue = function () { + this.queueSettings.queue_cancelled_flag = true; + this.stopUpload(); + var stats = this.getStats(); + while (stats.files_queued > 0) { + this.cancelUpload(); + stats = this.getStats(); + } + }; + SWFUpload.queue.uploadStartHandler = function (file) { + var returnValue; + if (typeof(this.queueSettings.user_upload_start_handler) === "function") { + returnValue = this.queueSettings.user_upload_start_handler.call(this, file); + } + returnValue = (returnValue === false) ? false : true; + this.queueSettings.queue_cancelled_flag = !returnValue; + return returnValue; + }; + SWFUpload.queue.uploadCompleteHandler = function (file) { + var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; + var continueUpload; + if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { + this.queueSettings.queue_upload_count++; + } + if (typeof(user_upload_complete_handler) === "function") { + continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; + } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { + continueUpload = false; + } else { + continueUpload = true; + } + if (continueUpload) { + var stats = this.getStats(); + if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { + this.startUpload(); + } else if (this.queueSettings.queue_cancelled_flag === false) { + this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); + this.queueSettings.queue_upload_count = 0; + } else { + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + } + } + }; +} +})(); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('pagebreak', function(K) { + var self = this; + var name = 'pagebreak'; + var pagebreakHtml = K.undef(self.pagebreakHtml, '
      '); + self.clickToolbar(name, function() { + var cmd = self.cmd, range = cmd.range; + self.focus(); + var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : ''; + self.insertHtml(pagebreakHtml + tail); + if (tail !== '') { + var p = K('#__kindeditor_tail_tag__', self.edit.doc); + range.selectNodeContents(p[0]); + p.removeAttr('id'); + cmd.select(); + } + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('plainpaste', function(K) { + var self = this, name = 'plainpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
      ' + + '
      ' + lang.comment + '
      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var html = textarea.val(); + html = K.escape(html); + html = html.replace(/ {2}/g, '  '); + if (self.newlineTag == 'p') { + html = html.replace(/^/, '

      ').replace(/$/, '

      ').replace(/\n/g, '

      '); + } else { + html = html.replace(/\n/g, '
      $&'); + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('preview', function(K) { + var self = this, name = 'preview', undefined; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '

      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 750, + title : self.lang(name), + body : html + }), + iframe = K('iframe', dialog.div), + doc = K.iframeDoc(iframe); + doc.open(); + doc.write(self.fullHtml()); + doc.close(); + K(doc.body).css('background-color', '#FFF'); + iframe[0].contentWindow.focus(); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('quickformat', function(K) { + var self = this, name = 'quickformat', + blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p'); + function getFirstChild(knode) { + var child = knode.first(); + while (child && child.first()) { + child = child.first(); + } + return child; + } + self.clickToolbar(name, function() { + self.focus(); + var doc = self.edit.doc, + range = self.cmd.range, + child = K(doc.body).first(), next, + nodeList = [], subList = [], + bookmark = range.createBookmark(true); + while(child) { + next = child.next(); + var firstChild = getFirstChild(child); + if (!firstChild || firstChild.name != 'img') { + if (blockMap[child.name]) { + child.html(child.html().replace(/^(\s| | )+/ig, '')); + child.css('text-indent', '2em'); + } else { + subList.push(child); + } + if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) { + if (subList.length > 0) { + nodeList.push(subList); + } + subList = []; + } + } + child = next; + } + K.each(nodeList, function(i, subList) { + var wrapper = K('

      ', doc); + subList[0].before(wrapper); + K.each(subList, function(i, knode) { + wrapper.append(knode); + }); + }); + range.moveToBookmark(bookmark); + self.addBookmark(); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('table', function(K) { + var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; + function _setColor(box, color) { + color = color.toUpperCase(); + box.css('background-color', color); + box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); + box.html(color); + } + var pickerList = []; + function _initColorPicker(dialogDiv, colorBox) { + colorBox.bind('click,mousedown', function(e){ + e.stopPropagation(); + }); + function removePicker() { + K.each(pickerList, function() { + this.remove(); + }); + pickerList = []; + K(document).unbind('click,mousedown', removePicker); + dialogDiv.unbind('click,mousedown', removePicker); + } + colorBox.click(function(e) { + removePicker(); + var box = K(this), + pos = box.pos(); + var picker = K.colorpicker({ + x : pos.x, + y : pos.y + box.height(), + z : 811214, + selectedColor : K(this).html(), + colors : self.colorTable, + noColor : self.lang('noColor'), + shadowMode : self.shadowMode, + click : function(color) { + _setColor(box, color); + removePicker(); + } + }); + pickerList.push(picker); + K(document).bind('click,mousedown', removePicker); + dialogDiv.bind('click,mousedown', removePicker); + }); + } + function _getCellIndex(table, row, cell) { + var rowSpanCount = 0; + for (var i = 0, len = row.cells.length; i < len; i++) { + if (row.cells[i] == cell) { + break; + } + rowSpanCount += row.cells[i].rowSpan - 1; + } + return cell.cellIndex - rowSpanCount; + } + self.plugin.table = { + prop : function(isInsert) { + var html = [ + '
      ', + '
      ', + '', + lang.rows + '   ', + lang.cols + ' ', + '
      ', + '
      ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
      ', + '
      ', + '', + lang.padding + '   ', + lang.spacing + ' ', + '
      ', + '
      ', + '', + '', + '
      ', + '
      ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
      ', + '
      ', + '', + '', + '
      ', + '
      ' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var rows = rowsBox.val(), + cols = colsBox.val(), + width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + align = alignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (rows == 0 || !/^\d+$/.test(rows)) { + alert(self.lang('invalidRows')); + rowsBox[0].focus(); + return; + } + if (cols == 0 || !/^\d+$/.test(cols)) { + alert(self.lang('invalidRows')); + colsBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(padding)) { + alert(self.lang('invalidPadding')); + paddingBox[0].focus(); + return; + } + if (!/^\d*$/.test(spacing)) { + alert(self.lang('invalidSpacing')); + spacingBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + if (table) { + if (width !== '') { + table.width(width + widthType); + } else { + table.css('width', ''); + } + if (table[0].width !== undefined) { + table.removeAttr('width'); + } + if (height !== '') { + table.height(height + heightType); + } else { + table.css('height', ''); + } + if (table[0].height !== undefined) { + table.removeAttr('height'); + } + table.css('background-color', bgColor); + if (table[0].bgColor !== undefined) { + table.removeAttr('bgColor'); + } + if (padding !== '') { + table[0].cellPadding = padding; + } else { + table.removeAttr('cellPadding'); + } + if (spacing !== '') { + table[0].cellSpacing = spacing; + } else { + table.removeAttr('cellSpacing'); + } + if (align !== '') { + table[0].align = align; + } else { + table.removeAttr('align'); + } + if (border !== '') { + table.attr('border', border); + } else { + table.removeAttr('border'); + } + if (border === '' || border === '0') { + table.addClass(zeroborder); + } else { + table.removeClass(zeroborder); + } + if (borderColor !== '') { + table.attr('borderColor', borderColor); + } else { + table.removeAttr('borderColor'); + } + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + return; + } + var style = ''; + if (width !== '') { + style += 'width:' + width + widthType + ';'; + } + if (height !== '') { + style += 'height:' + height + heightType + ';'; + } + if (bgColor !== '') { + style += 'background-color:' + bgColor + ';'; + } + var html = '') + ''; + } + html += ''; + } + html += ''; + if (!K.IE) { + html += '
      '; + } + self.insertHtml(html); + self.select().hideDialog().focus(); + self.addBookmark(); + } + } + }), + div = dialog.div, + rowsBox = K('[name="rows"]', div).val(3), + colsBox = K('[name="cols"]', div).val(2), + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + alignBox = K('[name="align"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + rowsBox[0].focus(); + rowsBox[0].select(); + var table; + if (isInsert) { + return; + } + table = self.plugin.getSelectedTable(); + if (table) { + rowsBox.val(table[0].rows.length); + colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); + rowsBox.attr('disabled', true); + colsBox.attr('disabled', true); + var match, + tableWidth = table[0].style.width || table[0].width, + tableHeight = table[0].style.height || table[0].height; + if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + paddingBox.val(table[0].cellPadding || ''); + spacingBox.val(table[0].cellSpacing || ''); + alignBox.val(table[0].align || ''); + borderBox.val(table[0].border === undefined ? '' : table[0].border); + _setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || '')); + _setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + } + }, + cellprop : function() { + var html = [ + '
      ', + '
      ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
      ', + '
      ', + '', + lang.textAlign + ' ', + lang.verticalAlign + ' ', + '
      ', + '
      ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
      ', + '
      ', + '', + '', + '
      ', + '
      ' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang('tablecell'), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + textAlign = textAlignBox.val(), + verticalAlign = verticalAlignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + cell.css({ + width : width !== '' ? (width + widthType) : '', + height : height !== '' ? (height + heightType) : '', + 'background-color' : bgColor, + 'text-align' : textAlign, + 'vertical-align' : verticalAlign, + 'border-width' : border, + 'border-style' : border !== '' ? 'solid' : '', + 'border-color' : borderColor + }); + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + } + } + }), + div = dialog.div, + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + textAlignBox = K('[name="textAlign"]', div), + verticalAlignBox = K('[name="verticalAlign"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + widthBox[0].focus(); + widthBox[0].select(); + var cell = self.plugin.getSelectedCell(); + var match, + cellWidth = cell[0].style.width || cell[0].width || '', + cellHeight = cell[0].style.height || cell[0].height || ''; + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + textAlignBox.val(cell[0].style.textAlign || ''); + verticalAlignBox.val(cell[0].style.verticalAlign || ''); + var border = cell[0].style.borderWidth || ''; + if (border) { + border = parseInt(border); + } + borderBox.val(border); + _setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || '')); + _setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + }, + insert : function() { + this.prop(true); + }, + 'delete' : function() { + var table = self.plugin.getSelectedTable(); + self.cmd.range.setStartBefore(table[0]).collapse(true); + self.cmd.select(); + table.remove(); + self.addBookmark(); + }, + colinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex + offset; + index += table.rows[0].cells.length - row.cells.length; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.insertCell(index); + newCell.innerHTML = K.IE ? '' : '
      '; + index = _getCellIndex(table, newRow, newCell); + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colinsertleft : function() { + this.colinsert(0); + }, + colinsertright : function() { + this.colinsert(1); + }, + rowinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0]; + var rowIndex = row.rowIndex; + if (offset === 1) { + rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset; + } + var newRow = table.insertRow(rowIndex); + for (var i = 0, len = row.cells.length; i < len; i++) { + if (row.cells[i].rowSpan > 1) { + len -= row.cells[i].rowSpan - 1; + } + var newCell = newRow.insertCell(i); + if (offset === 1 && row.cells[i].colSpan > 1) { + newCell.colSpan = row.cells[i].colSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + } + for (var j = rowIndex; j >= 0; j--) { + var cells = table.rows[j].cells; + if (cells.length > i) { + for (var k = cell.cellIndex; k >= 0; k--) { + if (cells[k].rowSpan > 1) { + cells[k].rowSpan += 1; + } + } + break; + } + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowinsertabove : function() { + this.rowinsert(0); + }, + rowinsertbelow : function() { + this.rowinsert(1); + }, + rowmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, + nextRowIndex = rowIndex + cell.rowSpan, + nextRow = table.rows[nextRowIndex]; + if (table.rows.length <= nextRowIndex) { + return; + } + var cellIndex = cell.cellIndex; + if (nextRow.cells.length <= cellIndex) { + return; + } + var nextCell = nextRow.cells[cellIndex]; + if (cell.colSpan !== nextCell.colSpan) { + return; + } + cell.rowSpan += nextCell.rowSpan; + nextRow.deleteCell(cellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, + cellIndex = cell.cellIndex, + nextCellIndex = cellIndex + 1; + if (row.cells.length <= nextCellIndex) { + return; + } + var nextCell = row.cells[nextCellIndex]; + if (cell.rowSpan !== nextCell.rowSpan) { + return; + } + cell.colSpan += nextCell.colSpan; + row.deleteCell(nextCellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + if (cell.rowSpan === 1) { + return; + } + var cellIndex = _getCellIndex(table, row, cell); + for (var i = 1, len = cell.rowSpan; i < len; i++) { + var newRow = table.rows[rowIndex + i], + newCell = newRow.insertCell(cellIndex); + if (cell.colSpan > 1) { + newCell.colSpan = cell.colSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + cellIndex = _getCellIndex(table, newRow, newCell); + } + K(cell).removeAttr('rowSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + cellIndex = cell.cellIndex; + if (cell.colSpan === 1) { + return; + } + for (var i = 1, len = cell.colSpan; i < len; i++) { + var newCell = row.insertCell(cellIndex + i); + if (cell.rowSpan > 1) { + newCell.rowSpan = cell.rowSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + } + K(cell).removeAttr('colSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + coldelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.cells[index]; + if (newCell.colSpan > 1) { + newCell.colSpan -= 1; + if (newCell.colSpan === 1) { + K(newCell).removeAttr('colSpan'); + } + } else { + newRow.deleteCell(index); + } + if (newCell.rowSpan > 1) { + i += newCell.rowSpan - 1; + } + } + if (row.cells.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + }, + rowdelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + for (var i = cell.rowSpan - 1; i >= 0; i--) { + table.deleteRow(rowIndex + i); + } + if (table.rows.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.table.prop); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('template', function(K) { + var self = this, name = 'template', lang = self.lang(name + '.'), + htmlPath = self.pluginsPath + name + '/html/'; + function getFilePath(fileName) { + return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); + } + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + arr = ['
      ', + '
      ', + '
      ', + lang. selectTemplate + '
      ', + '
      ', + ' ', + '
      ', + '
      ', + '
      ', + '', + '
      '].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var doc = K.iframeDoc(iframe); + self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); + } + } + }); + var selectBox = K('select', dialog.div), + checkbox = K('[name="replaceFlag"]', dialog.div), + iframe = K('iframe', dialog.div); + checkbox[0].checked = true; + iframe.attr('src', getFilePath(selectBox.val())); + selectBox.change(function() { + iframe.attr('src', getFilePath(this.value)); + }); + }); +}); + +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ +KindEditor.plugin('wordpaste', function(K) { + var self = this, name = 'wordpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
      ' + + '
      ' + lang.comment + '
      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var str = doc.body.innerHTML; + str = K.clearMsWord(str, self.filterMode ? self.htmlTags : K.options.htmlTags); + self.insertHtml(str).hideDialog().focus(); + } + } + }), + div = dialog.div, + iframe = K('iframe', div), + doc = K.iframeDoc(iframe); + if (!K.IE) { + doc.designMode = 'on'; + } + doc.open(); + doc.write('WordPaste'); + doc.write(''); + if (!K.IE) { + doc.write('
      '); + } + doc.write(''); + doc.close(); + if (K.IE) { + doc.body.contentEditable = 'true'; + } + iframe[0].contentWindow.focus(); + }); +}); + + +KindEditor.plugin('fixtoolbar', function (K) { + var self = this; + if (!self.fixToolBar) { + return; + } + function init() { + var toolbar = K('.ke-toolbar'); + var originY = toolbar.pos().y; + K(window).bind('scroll', function () { + if (toolbar.css('position') == 'fixed') { + if(document.body.scrollTop - originY < 0){ + toolbar.css('position', 'static'); + toolbar.css('top', 'auto'); + } + } else { + if (toolbar.pos().y - document.body.scrollTop < 0) { + toolbar.css('position', 'fixed'); + toolbar.css('top', 0); + } + } + }); + } + if (self.isCreated) { + init(); + } else { + self.afterCreate(init); + } +}); + diff --git a/public/kindeditor/lang/ar.js b/public/kindeditor/lang/ar.js new file mode 100644 index 0000000..6eb4b7e --- /dev/null +++ b/public/kindeditor/lang/ar.js @@ -0,0 +1,242 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +* Arabic Translation By daif alotaibi (http://daif.net/) +*******************************************************************************/ + +KindEditor.lang({ + source : 'عرض المصدر', + preview : 'معاينة الصفحة', + undo : 'تراجع(Ctrl+Z)', + redo : 'إعادة التراجع(Ctrl+Y)', + cut : 'قص(Ctrl+X)', + copy : 'نسخ(Ctrl+C)', + paste : 'لصق(Ctrl+V)', + plainpaste : 'لصق كنص عادي', + wordpaste : 'لصق من مايكروسفت ورد', + selectall : 'تحديد الكل', + justifyleft : 'محاذاه لليسار', + justifycenter : 'محاذاه للوسط', + justifyright : 'محاذاه لليمين', + justifyfull : 'محاذاه تلقائية', + insertorderedlist : 'قائمة مرقمه', + insertunorderedlist : 'قائمة نقطية', + indent : 'إزاحه النص', + outdent : 'إلغاء الازاحة', + subscript : 'أسفل النص', + superscript : 'أعلى النص', + formatblock : 'Paragraph format', + fontname : 'نوع الخط', + fontsize : 'حجم الخط', + forecolor : 'لون النص', + hilitecolor : 'لون خلفية النص', + bold : 'عريض(Ctrl+B)', + italic : 'مائل(Ctrl+I)', + underline : 'خط تحت النص(Ctrl+U)', + strikethrough : 'خط على النص', + removeformat : 'إزالة التنسيق', + image : 'إدراج صورة', + multiimage : 'Multi image', + flash : 'إدراج فلاش', + media : 'إدراج وسائط متعددة', + table : 'إدراج جدول', + tablecell : 'خلية', + hr : 'إدراج خط أفقي', + emoticons : 'إدراج وجه ضاحك', + link : 'رابط', + unlink : 'إزالة الرابط', + fullscreen : 'محرر ملئ الشاشة', + about : 'حول', + print : 'طباعة', + filemanager : 'مدير الملفات', + code : 'إدراج نص برمجي', + map : 'خرائط قووقل', + baidumap : 'خرائط قووقل', + lineheight : 'إرتفاع السطر', + clearhtml : 'مسح كود HTML', + pagebreak : 'إدراج فاصل صفحات', + quickformat : 'تنسيق سريع', + insertfile : 'إدراج ملف', + template : 'إدراج قالب', + anchor : 'رابط', + yes : 'موافق', + no : 'إلغاء', + close : 'إغلاق', + editImage : 'خصائص الصورة', + deleteImage : 'حذفالصورة', + editFlash : 'خصائص الفلاش', + deleteFlash : 'حذف الفلاش', + editMedia : 'خصائص الوسائط', + deleteMedia : 'حذف الوسائط', + editLink : 'خصائص الرابط', + deleteLink : 'إزالة الرابط', + editAnchor : 'Anchor properties', + deleteAnchor : 'Delete Anchor', + tableprop : 'خصائص الجدول', + tablecellprop : 'خصائص الخلية', + tableinsert : 'إدراج جدول', + tabledelete : 'حذف جدول', + tablecolinsertleft : 'إدراج عمود لليسار', + tablecolinsertright : 'إدراج عمود لليسار', + tablerowinsertabove : 'إدراج صف للأعلى', + tablerowinsertbelow : 'إدراج صف للأسفل', + tablerowmerge : 'دمج للأسفل', + tablecolmerge : 'دمج لليمين', + tablerowsplit : 'تقسم الصف', + tablecolsplit : 'تقسيم العمود', + tablecoldelete : 'حذف العمود', + tablerowdelete : 'حذف الصف', + noColor : 'إفتراضي', + pleaseSelectFile : 'Please select file.', + invalidImg : "الرجاء إدخال رابط صحيح.\nالملفات المسموح بها: jpg,gif,bmp,png", + invalidMedia : "الرجاء إدخال رابط صحيح.\nالملفات المسموح بها: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb", + invalidWidth : "العرض يجب أن يكون رقم.", + invalidHeight : "الإرتفاع يجب أن يكون رقم.", + invalidBorder : "عرض الحد يجب أن يكون رقم.", + invalidUrl : "الرجاء إدخال رابط حيح.", + invalidRows : 'صفوف غير صحيح.', + invalidCols : 'أعمدة غير صحيحة.', + invalidPadding : 'The padding must be number.', + invalidSpacing : 'The spacing must be number.', + invalidJson : 'Invalid JSON string.', + uploadSuccess : 'تم رفع الملف بنجاح.', + cutError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+X).', + copyError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+C).', + pasteError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+V).', + ajaxLoading : 'Loading ...', + uploadLoading : 'Uploading ...', + uploadError : 'Upload Error', + 'plainpaste.comment' : 'إستخدم إختصار لوحة المفاتيح (Ctrl+V) للصق داخل النافذة.', + 'wordpaste.comment' : 'إستخدم إختصار لوحة المفاتيح (Ctrl+V) للصق داخل النافذة.', + 'code.pleaseInput' : 'Please input code.', + 'link.url' : 'الرابط', + 'link.linkType' : 'الهدف', + 'link.newWindow' : 'نافذة جديدة', + 'link.selfWindow' : 'نفس النافذة', + 'flash.url' : 'الرابط', + 'flash.width' : 'العرض', + 'flash.height' : 'الإرتفاع', + 'flash.upload' : 'رفع', + 'flash.viewServer' : 'أستعراض', + 'media.url' : 'الرابط', + 'media.width' : 'العرض', + 'media.height' : 'الإرتفاع', + 'media.autostart' : 'تشغيل تلقائي', + 'media.upload' : 'رفع', + 'media.viewServer' : 'أستعراض', + 'image.remoteImage' : 'إدراج الرابط', + 'image.localImage' : 'رفع', + 'image.remoteUrl' : 'الرابط', + 'image.localUrl' : 'الملف', + 'image.size' : 'الحجم', + 'image.width' : 'العرض', + 'image.height' : 'الإرتفاع', + 'image.resetSize' : 'إستعادة الأبعاد', + 'image.align' : 'محاذاة', + 'image.defaultAlign' : 'الإفتراضي', + 'image.leftAlign' : 'اليسار', + 'image.rightAlign' : 'اليمين', + 'image.imgTitle' : 'العنوان', + 'image.upload' : 'أستعراض', + 'image.viewServer' : 'أستعراض', + 'multiimage.uploadDesc' : 'Allows users to upload <%=uploadLimit%> images, single image size not exceeding <%=sizeLimit%>', + 'multiimage.startUpload' : 'Start upload', + 'multiimage.clearAll' : 'Clear all', + 'multiimage.insertAll' : 'Insert all', + 'multiimage.queueLimitExceeded' : 'Queue limit exceeded.', + 'multiimage.fileExceedsSizeLimit' : 'File exceeds size limit.', + 'multiimage.zeroByteFile' : 'Zero byte file.', + 'multiimage.invalidFiletype' : 'Invalid file type.', + 'multiimage.unknownError' : 'Unknown upload error.', + 'multiimage.pending' : 'Pending ...', + 'multiimage.uploadError' : 'Upload error', + 'filemanager.emptyFolder' : 'فارغ', + 'filemanager.moveup' : 'المجلد الأب', + 'filemanager.viewType' : 'العرض: ', + 'filemanager.viewImage' : 'مصغرات', + 'filemanager.listImage' : 'قائمة', + 'filemanager.orderType' : 'الترتيب: ', + 'filemanager.fileName' : 'بالإسم', + 'filemanager.fileSize' : 'بالحجم', + 'filemanager.fileType' : 'بالنوع', + 'insertfile.url' : 'الرابط', + 'insertfile.title' : 'العنوان', + 'insertfile.upload' : 'رفع', + 'insertfile.viewServer' : 'أستعراض', + 'table.cells' : 'خلايا', + 'table.rows' : 'صفوف', + 'table.cols' : 'أعمدة', + 'table.size' : 'الأبعاد', + 'table.width' : 'العرض', + 'table.height' : 'الإرتفاع', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : 'الخارج', + 'table.padding' : 'الداخل', + 'table.spacing' : 'الفراغات', + 'table.align' : 'محاذاه', + 'table.textAlign' : 'افقى', + 'table.verticalAlign' : 'رأسي', + 'table.alignDefault' : 'إفتراضي', + 'table.alignLeft' : 'يسار', + 'table.alignCenter' : 'وسط', + 'table.alignRight' : 'يمين', + 'table.alignTop' : 'أعلى', + 'table.alignMiddle' : 'منتصف', + 'table.alignBottom' : 'أسفل', + 'table.alignBaseline' : 'Baseline', + 'table.border' : 'الحدود', + 'table.borderWidth' : 'العرض', + 'table.borderColor' : 'اللون', + 'table.backgroundColor' : 'الخلفية', + 'map.address' : 'العنوان: ', + 'map.search' : 'بحث', + 'baidumap.address' : 'العنوان: ', + 'baidumap.search' : 'بحث', + 'baidumap.insertDynamicMap' : 'Dynamic Map', + 'anchor.name' : 'إسم الرابط', + 'formatblock.formatBlock' : { + h1 : 'عنوان 1', + h2 : 'عنوان 2', + h3 : 'عنوان 3', + h4 : 'عنوان 4', + p : 'عادي' + }, + 'fontname.fontName' : { + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Comic Sans MS' : 'Comic Sans MS', + 'Courier New' : 'Courier New', + 'Garamond' : 'Garamond', + 'Georgia' : 'Georgia', + 'Tahoma' : 'Tahoma', + 'Times New Roman' : 'Times New Roman', + 'Trebuchet MS' : 'Trebuchet MS', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : 'إرتفاع السطر 1'}, + {'1.5' : 'إرتفاع السطر 1.5'}, + {'2' : 'إرتفاع السطر 2'}, + {'2.5' : 'إرتفاع السطر 2.5'}, + {'3' : 'إرتفاع السطر 3'} + ], + 'template.selectTemplate' : 'قالب', + 'template.replaceContent' : 'إستبدال المحتوى الحالي', + 'template.fileList' : { + '1.html' : 'صورة ونص', + '2.html' : 'جدول', + '3.html' : 'قائمة' + } +}, 'ar'); + +KindEditor.each(KindEditor.options.items, function(i, name) { + if (name == 'baidumap') { + KindEditor.options.items[i] = 'map'; + } +}); +KindEditor.options.langType = 'ar'; \ No newline at end of file diff --git a/public/kindeditor/lang/en.js b/public/kindeditor/lang/en.js new file mode 100644 index 0000000..86639d2 --- /dev/null +++ b/public/kindeditor/lang/en.js @@ -0,0 +1,241 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.lang({ + source : 'Source', + preview : 'Preview', + undo : 'Undo(Ctrl+Z)', + redo : 'Redo(Ctrl+Y)', + cut : 'Cut(Ctrl+X)', + copy : 'Copy(Ctrl+C)', + paste : 'Paste(Ctrl+V)', + plainpaste : 'Paste as plain text', + wordpaste : 'Paste from Word', + selectall : 'Select all', + justifyleft : 'Align left', + justifycenter : 'Align center', + justifyright : 'Align right', + justifyfull : 'Align full', + insertorderedlist : 'Ordered list', + insertunorderedlist : 'Unordered list', + indent : 'Increase indent', + outdent : 'Decrease indent', + subscript : 'Subscript', + superscript : 'Superscript', + formatblock : 'Paragraph format', + fontname : 'Font family', + fontsize : 'Font size', + forecolor : 'Text color', + hilitecolor : 'Highlight color', + bold : 'Bold(Ctrl+B)', + italic : 'Italic(Ctrl+I)', + underline : 'Underline(Ctrl+U)', + strikethrough : 'Strikethrough', + removeformat : 'Remove format', + image : 'Image', + multiimage : 'Multi image', + flash : 'Flash', + media : 'Embeded media', + table : 'Table', + tablecell : 'Cell', + hr : 'Insert horizontal line', + emoticons : 'Insert emoticon', + link : 'Link', + unlink : 'Unlink', + fullscreen : 'Toggle fullscreen mode', + about : 'About', + print : 'Print', + filemanager : 'File Manager', + code : 'Insert code', + map : 'Google Maps', + baidumap : 'Baidu Maps', + lineheight : 'Line height', + clearhtml : 'Clear HTML code', + pagebreak : 'Insert Page Break', + quickformat : 'Quick Format', + insertfile : 'Insert file', + template : 'Insert Template', + anchor : 'Anchor', + yes : 'OK', + no : 'Cancel', + close : 'Close', + editImage : 'Image properties', + deleteImage : 'Delete image', + editFlash : 'Flash properties', + deleteFlash : 'Delete flash', + editMedia : 'Media properties', + deleteMedia : 'Delete media', + editLink : 'Link properties', + deleteLink : 'Unlink', + editAnchor : 'Anchor properties', + deleteAnchor : 'Delete Anchor', + tableprop : 'Table properties', + tablecellprop : 'Cell properties', + tableinsert : 'Insert table', + tabledelete : 'Delete table', + tablecolinsertleft : 'Insert column left', + tablecolinsertright : 'Insert column right', + tablerowinsertabove : 'Insert row above', + tablerowinsertbelow : 'Insert row below', + tablerowmerge : 'Merge down', + tablecolmerge : 'Merge right', + tablerowsplit : 'Split row', + tablecolsplit : 'Split column', + tablecoldelete : 'Delete column', + tablerowdelete : 'Delete row', + noColor : 'Default', + pleaseSelectFile : 'Please select file.', + invalidImg : "Please type valid URL.\nAllowed file extension: jpg,gif,bmp,png", + invalidMedia : "Please type valid URL.\nAllowed file extension: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb", + invalidWidth : "The width must be number.", + invalidHeight : "The height must be number.", + invalidBorder : "The border must be number.", + invalidUrl : "Please type valid URL.", + invalidRows : 'Invalid rows.', + invalidCols : 'Invalid columns.', + invalidPadding : 'The padding must be number.', + invalidSpacing : 'The spacing must be number.', + invalidJson : 'Invalid JSON string.', + uploadSuccess : 'Upload success.', + cutError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+X) instead.', + copyError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+C) instead.', + pasteError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+V) instead.', + ajaxLoading : 'Loading ...', + uploadLoading : 'Uploading ...', + uploadError : 'Upload Error', + 'plainpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.', + 'wordpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.', + 'code.pleaseInput' : 'Please input code.', + 'link.url' : 'URL', + 'link.linkType' : 'Target', + 'link.newWindow' : 'New window', + 'link.selfWindow' : 'Same window', + 'flash.url' : 'URL', + 'flash.width' : 'Width', + 'flash.height' : 'Height', + 'flash.upload' : 'Upload', + 'flash.viewServer' : 'Browse', + 'media.url' : 'URL', + 'media.width' : 'Width', + 'media.height' : 'Height', + 'media.autostart' : 'Auto start', + 'media.upload' : 'Upload', + 'media.viewServer' : 'Browse', + 'image.remoteImage' : 'Insert URL', + 'image.localImage' : 'Upload', + 'image.remoteUrl' : 'URL', + 'image.localUrl' : 'File', + 'image.size' : 'Size', + 'image.width' : 'Width', + 'image.height' : 'Height', + 'image.resetSize' : 'Reset dimensions', + 'image.align' : 'Align', + 'image.defaultAlign' : 'Default', + 'image.leftAlign' : 'Left', + 'image.rightAlign' : 'Right', + 'image.imgTitle' : 'Title', + 'image.upload' : 'Browse', + 'image.viewServer' : 'Browse', + 'multiimage.uploadDesc' : 'Allows users to upload <%=uploadLimit%> images, single image size not exceeding <%=sizeLimit%>', + 'multiimage.startUpload' : 'Start upload', + 'multiimage.clearAll' : 'Clear all', + 'multiimage.insertAll' : 'Insert all', + 'multiimage.queueLimitExceeded' : 'Queue limit exceeded.', + 'multiimage.fileExceedsSizeLimit' : 'File exceeds size limit.', + 'multiimage.zeroByteFile' : 'Zero byte file.', + 'multiimage.invalidFiletype' : 'Invalid file type.', + 'multiimage.unknownError' : 'Unknown upload error.', + 'multiimage.pending' : 'Pending ...', + 'multiimage.uploadError' : 'Upload error', + 'filemanager.emptyFolder' : 'Blank', + 'filemanager.moveup' : 'Parent folder', + 'filemanager.viewType' : 'Display: ', + 'filemanager.viewImage' : 'Thumbnails', + 'filemanager.listImage' : 'List', + 'filemanager.orderType' : 'Sorting: ', + 'filemanager.fileName' : 'By name', + 'filemanager.fileSize' : 'By size', + 'filemanager.fileType' : 'By type', + 'insertfile.url' : 'URL', + 'insertfile.title' : 'Title', + 'insertfile.upload' : 'Upload', + 'insertfile.viewServer' : 'Browse', + 'table.cells' : 'Cells', + 'table.rows' : 'Rows', + 'table.cols' : 'Columns', + 'table.size' : 'Dimensions', + 'table.width' : 'Width', + 'table.height' : 'Height', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : 'Space', + 'table.padding' : 'Padding', + 'table.spacing' : 'Spacing', + 'table.align' : 'Align', + 'table.textAlign' : 'Horizontal', + 'table.verticalAlign' : 'Vertical', + 'table.alignDefault' : 'Default', + 'table.alignLeft' : 'Left', + 'table.alignCenter' : 'Center', + 'table.alignRight' : 'Right', + 'table.alignTop' : 'Top', + 'table.alignMiddle' : 'Middle', + 'table.alignBottom' : 'Bottom', + 'table.alignBaseline' : 'Baseline', + 'table.border' : 'Border', + 'table.borderWidth' : 'Width', + 'table.borderColor' : 'Color', + 'table.backgroundColor' : 'Background', + 'map.address' : 'Address: ', + 'map.search' : 'Search', + 'baidumap.address' : 'Address: ', + 'baidumap.search' : 'Search', + 'baidumap.insertDynamicMap' : 'Dynamic Map', + 'anchor.name' : 'Anchor name', + 'formatblock.formatBlock' : { + h1 : 'Heading 1', + h2 : 'Heading 2', + h3 : 'Heading 3', + h4 : 'Heading 4', + p : 'Normal' + }, + 'fontname.fontName' : { + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Comic Sans MS' : 'Comic Sans MS', + 'Courier New' : 'Courier New', + 'Garamond' : 'Garamond', + 'Georgia' : 'Georgia', + 'Tahoma' : 'Tahoma', + 'Times New Roman' : 'Times New Roman', + 'Trebuchet MS' : 'Trebuchet MS', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : 'Line height 1'}, + {'1.5' : 'Line height 1.5'}, + {'2' : 'Line height 2'}, + {'2.5' : 'Line height 2.5'}, + {'3' : 'Line height 3'} + ], + 'template.selectTemplate' : 'Template', + 'template.replaceContent' : 'Replace current content', + 'template.fileList' : { + '1.html' : 'Image and Text', + '2.html' : 'Table', + '3.html' : 'List' + } +}, 'en'); + +KindEditor.each(KindEditor.options.items, function(i, name) { + if (name == 'baidumap') { + KindEditor.options.items[i] = 'map'; + } +}); +KindEditor.options.langType = 'en'; diff --git a/public/kindeditor/lang/ko.js b/public/kindeditor/lang/ko.js new file mode 100644 index 0000000..bf5eb22 --- /dev/null +++ b/public/kindeditor/lang/ko.js @@ -0,0 +1,246 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Composite +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.lang({ + source : '소스', + preview : '미리보기', + undo : '작업취소(Ctrl+Z)', + redo : '작업재개(Ctrl+Y)', + cut : '잘라내기(Ctrl+X)', + copy : '복사(Ctrl+C)', + paste : '붙여넣기(Ctrl+V)', + plainpaste : '일반 텍스트로 붙여넣기', + wordpaste : '워드 문서로 붙여넣기', + selectall : '전체 선택', + justifyleft : '왼쪽 정렬', + justifycenter : '가운데 정렬', + justifyright : '오른쪽 정렬', + justifyfull : '양쪽 정렬', + insertorderedlist : '순서 목록', + insertunorderedlist : '비순서 목록', + indent : '들여쓰기', + outdent : '내어쓰기', + subscript : '아랫첨자', + superscript : '윗첨자', + formatblock : '문단 형식', + fontname : '글꼴', + fontsize : '글자 크기', + forecolor : '글자색', + hilitecolor : '강조색', + bold : '굵게(Ctrl+B)', + italic : '이텔릭(Ctrl+I)', + underline : '빝줄(Ctrl+U)', + strikethrough : '취소선', + removeformat : '형식 제거', + image : '이미지 추가', + multiimage : '여러 이미지 추가', + flash : '플래시 추가', + media : '미디어 추가', + table : '표', + tablecell : '열', + hr : '구분선 추가', + emoticons : '이모티콘 추가', + link : '링크', + unlink : '링크 제거', + fullscreen : '전체 화면 모드', + about : '이 에디터는...', + print : '인쇄', + filemanager : '파일 관리자', + code : '코드 추가', + map : '구글 맵 추가', + baidumap : '바이두 맵 추가', + lineheight : '행 간격', + clearhtml : 'HTML 코드 정리', + pagebreak : '페이지 구분 추가', + quickformat : '빠른 형식', + insertfile : '파일 추가', + template : '템플릿 추가', + anchor : '책갈피', + yes : '확인', + no : '취소', + close : '닫기', + editImage : '이미지 속성', + deleteImage : '이미지 삭제', + editFlash : '플래시 속성', + deleteFlash : '플래시 삭제', + editMedia : '미디어 속성', + deleteMedia : '미디어 삭제', + editLink : '링크 속성', + deleteLink : '링크 삭제', + editAnchor : 'Anchor properties', + deleteAnchor : 'Delete Anchor', + tableprop : '표 속성', + tablecellprop : '열 속성', + tableinsert : '표 추가', + tabledelete : '표 삭제', + tablecolinsertleft : '왼쪽으로 열 추가', + tablecolinsertright : '오른쪽으로 열 추가', + tablerowinsertabove : '위쪽으로 열 추가', + tablerowinsertbelow : '아래쪽으로 열 추가', + tablerowmerge : '아래로 병합', + tablecolmerge : '오른쪽으로 병합', + tablerowsplit : '행 나누기', + tablecolsplit : '열 나누기', + tablecoldelete : '열 삭제', + tablerowdelete : '행 삭제', + noColor : '기본색', + pleaseSelectFile : '파일 선택', + invalidImg : "올바른 주소를 입력하세요.\njpg,gif,bmp,png 형식이 가능합니다.", + invalidMedia : "올바른 주소를 입력하세요.\nswf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb 형식이 가능합니다.", + invalidWidth : "넓이 값은 숫자여야 합니다.", + invalidHeight : "높이 값은 숫자여야 합니다.", + invalidBorder : "굵기 값은 숫자여야 합니다.", + invalidUrl : "올바른 주소를 입력하세요.", + invalidRows : '올바른 행이 아닙니다.', + invalidCols : '올바른 열이 아닙니다.', + invalidPadding : '안쪽 여백 값은 숫자여야 합니다.', + invalidSpacing : '간격 길이 값은 숫자여야 합니다.', + invalidJson : '올바른 JSON 형식이 아닙니다.', + uploadSuccess : '업로드가 완료되었습니다.', + cutError : '브라우저가 잘라내기 기능을 지원하지 않습니다, 단축키로 대신 사용하세요. (Ctrl+X)', + copyError : '브라우저가 복사 기능을 지원하지 않습니다, 단축키로 대신 사용하세요. (Ctrl+X)', + pasteError : '브라우저가 붙여넣기 기능을 지원하지 않습니다, 단축키로 대신 사용하세요. (Ctrl+X)', + ajaxLoading : '불러오는 중 ...', + uploadLoading : '업로드 중 ...', + uploadError : '업로드 오류', + 'plainpaste.comment' : '단축키(Ctrl+V)를 통하여 여기에 텍스트를 붙여넣으세요.', + 'wordpaste.comment' : '단축키(Ctrl+V)를 통하여 여기에 워드 텍스트를 붙여넣으세요.', + 'code.pleaseInput' : 'Please input code.', + 'link.url' : '주소', + 'link.linkType' : '창', + 'link.newWindow' : '새 창', + 'link.selfWindow' : '현재 창', + 'flash.url' : '주소', + 'flash.width' : '넓이', + 'flash.height' : '높이', + 'flash.upload' : '업로드', + 'flash.viewServer' : '찾아보기', + 'media.url' : '주소', + 'media.width' : '넓이', + 'media.height' : '높이', + 'media.autostart' : '자동 시작', + 'media.upload' : '업로드', + 'media.viewServer' : '찾아보기', + 'image.remoteImage' : '외부 이미지', + 'image.localImage' : '내부 이미지', + 'image.remoteUrl' : '주소', + 'image.localUrl' : '파일', + 'image.size' : '크기', + 'image.width' : '넓이', + 'image.height' : '높이', + 'image.resetSize' : '기본 크기로', + 'image.align' : '정렬', + 'image.defaultAlign' : '기본', + 'image.leftAlign' : '왼쪽', + 'image.rightAlign' : '오른쪽', + 'image.imgTitle' : '제목', + 'image.upload' : '찾아보기', + 'image.viewServer' : '찾아보기', + 'multiimage.uploadDesc' : '최대 이미지 개수: <%=uploadLimit%>개, 개당 이미지 크기: <%=sizeLimit%>', + 'multiimage.startUpload' : '업로드 시작', + 'multiimage.clearAll' : '모두 삭제', + 'multiimage.insertAll' : '모두 삽입', + 'multiimage.queueLimitExceeded' : '업로드 개수가 초과되었습니다.', + 'multiimage.fileExceedsSizeLimit' : '업로드 크기가 초과되었습니다.', + 'multiimage.zeroByteFile' : '파일 크기가 없습니다.', + 'multiimage.invalidFiletype' : '올바른 이미지가 아닙니다.', + 'multiimage.unknownError' : '알 수 없는 업로드 오류가 발생하였습니다.', + 'multiimage.pending' : '처리 중 ...', + 'multiimage.uploadError' : '업로드 오류', + 'filemanager.emptyFolder' : '빈 폴더', + 'filemanager.moveup' : '위로', + 'filemanager.viewType' : '보기 방식: ', + 'filemanager.viewImage' : '미리 보기', + 'filemanager.listImage' : '목록', + 'filemanager.orderType' : '정렬 방식: ', + 'filemanager.fileName' : '이름별', + 'filemanager.fileSize' : '크기별', + 'filemanager.fileType' : '종류별', + 'insertfile.url' : '주소', + 'insertfile.title' : '제목', + 'insertfile.upload' : '업로드', + 'insertfile.viewServer' : '찾아보기', + 'table.cells' : '열', + 'table.rows' : '행', + 'table.cols' : '열', + 'table.size' : '표 크기', + 'table.width' : '넓이', + 'table.height' : '높이', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : '간격', + 'table.padding' : '안쪽여백', + 'table.spacing' : '간격', + 'table.align' : '정렬', + 'table.textAlign' : '수직', + 'table.verticalAlign' : '수평', + 'table.alignDefault' : '기본', + 'table.alignLeft' : '왼쪽', + 'table.alignCenter' : '가운데', + 'table.alignRight' : '오른쪽', + 'table.alignTop' : '위쪽', + 'table.alignMiddle' : '중간', + 'table.alignBottom' : '아래쪽', + 'table.alignBaseline' : '글자기준', + 'table.border' : '테두리', + 'table.borderWidth' : '크기', + 'table.borderColor' : '색상', + 'table.backgroundColor' : '배경', + 'map.address' : '주소: ', + 'map.search' : '검색', + 'baidumap.address' : '주소: ', + 'baidumap.search' : '검색', + 'baidumap.insertDynamicMap' : '동적 지도', + 'anchor.name' : '책갈피명', + 'formatblock.formatBlock' : { + h1 : '제목 1', + h2 : '제목 2', + h3 : '제목 3', + h4 : '제목 4', + p : '본문' + }, + 'fontname.fontName' : { + 'Gulim' : '굴림', + 'Dotum' : '돋움', + 'Batang' : '바탕', + 'Gungsuh' : '궁서', + 'Malgun Gothic' : '맑은 고딕', + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Comic Sans MS' : 'Comic Sans MS', + 'Courier New' : 'Courier New', + 'Garamond' : 'Garamond', + 'Georgia' : 'Georgia', + 'Tahoma' : 'Tahoma', + 'Times New Roman' : 'Times New Roman', + 'Trebuchet MS' : 'Trebuchet MS', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : '행간 1'}, + {'1.5' : '행간 1.5'}, + {'2' : '행간 2'}, + {'2.5' : '행간 2.5'}, + {'3' : '행간 3'} + ], + 'template.selectTemplate' : '템플릿', + 'template.replaceContent' : '내용 바꾸기', + 'template.fileList' : { + '1.html' : '이미지와 텍스트', + '2.html' : '표', + '3.html' : '목록' + } +}, 'ko'); + +KindEditor.each(KindEditor.options.items, function(i, name) { + if (name == 'baidumap') { + KindEditor.options.items[i] = 'map'; + } +}); +KindEditor.options.langType = 'ko'; diff --git a/public/kindeditor/lang/ru.js b/public/kindeditor/lang/ru.js new file mode 100644 index 0000000..dda10bf --- /dev/null +++ b/public/kindeditor/lang/ru.js @@ -0,0 +1,242 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +* Translated to Russian by Valery Votintsev (http://codersclub.org/) +*******************************************************************************/ + +KindEditor.lang({ + source : 'Source', + preview : 'Preview', + undo : 'Отмена(Ctrl+Z)', + redo : 'Повтор(Ctrl+Y)', + cut : 'Вырезать(Ctrl+X)', + copy : 'Копировать(Ctrl+C)', + paste : 'Вставить(Ctrl+V)', + plainpaste : 'Вставить как простой текст', + wordpaste : 'Вставить из Word', + selectall : 'Выбрать все', + justifyleft : 'Выравнивание влево', + justifycenter : 'Выравнивание по центру', + justifyright : 'Выравнивание вправо', + justifyfull : 'Выравнивание по обеим сторонам', + insertorderedlist : 'Нумерованый список', + insertunorderedlist : 'Ненумерованый список', + indent : 'Добавить отступ', + outdent : 'Убрать отступ', + subscript : 'Надстрочный', + superscript : 'Подстрочный', + formatblock : 'Формат параграфа', + fontname : 'Шрифт', + fontsize : 'Размер', + forecolor : 'Цвет текста', + hilitecolor : 'Цвет фона', + bold : 'Жирный(Ctrl+B)', + italic : 'Наклонный(Ctrl+I)', + underline : 'Подчёркнутый(Ctrl+U)', + strikethrough : 'Перечёркнутый', + removeformat : 'Удалить формат', + image : 'Изображение', + multiimage : 'Мульти-загрузка', + flash : 'Flash', + media : 'Встроенные данные', + table : 'Таблица', + tablecell : 'Ячейка', + hr : 'Горизонтальный разделитель', + emoticons : 'Смайл', + link : 'Ссылка', + unlink : 'Убрать ссылку', + fullscreen : 'На весь экран', + about : 'О программе', + print : 'Печать', + filemanager : 'Файлы', + code : 'Код', + map : 'Карта Google', + baidumap : 'Карта Baidu', + lineheight : 'Межстрочный интервал', + clearhtml : 'Очистить HTML код', + pagebreak : 'Разрыв страницы', + quickformat : 'Быстрый формат', + insertfile : 'Вставить файл', + template : 'Вставить шаблон', + anchor : 'Якорь', + yes : 'OK', + no : 'Отмена', + close : 'Закрыть', + editImage : 'Свойства изображения', + deleteImage : 'Удалить изображение', + editFlash : 'Свойства Flash', + deleteFlash : 'Удалить Flash', + editMedia : 'Свойства Media', + deleteMedia : 'Удалить Media', + editLink : 'Свойства ссылки', + deleteLink : 'Удалить ссылку', + editAnchor : 'Anchor properties', + deleteAnchor : 'Delete Anchor', + tableprop : 'Свойства таблицы', + tablecellprop : 'Свойства ячейки', + tableinsert : 'Вставить таблицу', + tabledelete : 'Удалить таблицу', + tablecolinsertleft : 'Добавить столбец слева', + tablecolinsertright : 'Добавить столбец справа', + tablerowinsertabove : 'Добавить строку выше', + tablerowinsertbelow : 'Добавить строку ниже', + tablerowmerge : 'Объединить вниз', + tablecolmerge : 'Объединить вправо', + tablerowsplit : 'Разделить строку', + tablecolsplit : 'Разделить столбец', + tablecoldelete : 'Удалить столбец', + tablerowdelete : 'Удалить строку', + noColor : 'По умолчанию', + pleaseSelectFile : 'Выберите файл.', + invalidImg : "Укажите корректный URL изображения.\nРазрешённые форматы: jpg,gif,bmp,png", + invalidMedia : "Укажите корректный тип медиа-объекта.\nРазрешённые типы: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb", + invalidWidth : "Ширина должна быть числом.", + invalidHeight : "Высота должна быть числом.", + invalidBorder : "Ширина рамки должна быть числом.", + invalidUrl : "Укажите корректный URL.", + invalidRows : 'Неверные строки.', + invalidCols : 'Неверные столбцы.', + invalidPadding : 'padding должен быть числом.', + invalidSpacing : 'spacing должен быть числом.', + invalidJson : 'Неверная JSON строка.', + uploadSuccess : 'Загрузка завершена.', + cutError : 'Данная опция не поддерживается вашим браузером, воспользуйтесь комбинацией клавиш (Ctrl+X).', + copyError : 'Данная опция не поддерживается вашим браузером, воспользуйтесь комбинацией клавиш (Ctrl+C).', + pasteError : 'Данная опция не поддерживается вашим браузером, воспользуйтесь комбинацией клавиш (Ctrl+V).', + ajaxLoading : 'Загрузка ...', + uploadLoading : 'Загрузка ...', + uploadError : 'Сбой загрузки', + 'plainpaste.comment' : 'Для вставки скопированного текста воспользуйтесь комбинацией клавиш (Ctrl+V).', + 'wordpaste.comment' : 'Для вставки скопированного текста воспользуйтесь комбинацией клавиш (Ctrl+V).', + 'code.pleaseInput' : 'Введите код.', + 'link.url' : 'URL', + 'link.linkType' : 'Открывать ссылку', + 'link.newWindow' : 'в новом окне', + 'link.selfWindow' : 'в том же окне', + 'flash.url' : 'URL', + 'flash.width' : 'Ширина', + 'flash.height' : 'Высота', + 'flash.upload' : 'Загрузить', + 'flash.viewServer' : 'Выбрать', + 'media.url' : 'URL', + 'media.width' : 'Ширина', + 'media.height' : 'Высота', + 'media.autostart' : 'Автостарт', + 'media.upload' : 'Загрузить', + 'media.viewServer' : 'Выбрать', + 'image.remoteImage' : 'Вставить URL изображения', + 'image.localImage' : 'Загрузить', + 'image.remoteUrl' : 'URL', + 'image.localUrl' : 'Файл', + 'image.size' : 'Размер', + 'image.width' : 'Ширина', + 'image.height' : 'Высота', + 'image.resetSize' : 'Сбросить размеры', + 'image.align' : 'Выравнивание', + 'image.defaultAlign' : 'По умолчанию', + 'image.leftAlign' : 'Влево', + 'image.rightAlign' : 'Вправо', + 'image.imgTitle' : 'Название', + 'image.upload' : 'Загрузить', + 'image.viewServer' : 'Выбрать', + 'multiimage.uploadDesc' : 'Максимальное кол-во изображений: <%=uploadLimit%>, Максимальный размер одного изображения: <%=sizeLimit%>', + 'multiimage.startUpload' : 'Начать загрузку', + 'multiimage.clearAll' : 'Очистить все', + 'multiimage.insertAll' : 'Вставить все', + 'multiimage.queueLimitExceeded' : 'Превышен лимит очереди.', + 'multiimage.fileExceedsSizeLimit' : 'Превышен максимальный размер файла.', + 'multiimage.zeroByteFile' : 'Файл нулевой длины.', + 'multiimage.invalidFiletype' : 'Недопустимый тип файла.', + 'multiimage.unknownError' : 'Непредвиденная ошибка загрузки.', + 'multiimage.pending' : 'Ожидает ...', + 'multiimage.uploadError' : 'Ошибка загрузки', + 'filemanager.emptyFolder' : 'Папка пуста', + 'filemanager.moveup' : 'Наверх', + 'filemanager.viewType' : 'Тип показа: ', + 'filemanager.viewImage' : 'Превьюшки', + 'filemanager.listImage' : 'Список', + 'filemanager.orderType' : 'Сортировка: ', + 'filemanager.fileName' : 'По имени', + 'filemanager.fileSize' : 'По размеру', + 'filemanager.fileType' : 'По типу', + 'insertfile.url' : 'URL', + 'insertfile.title' : 'Название', + 'insertfile.upload' : 'Загрузить', + 'insertfile.viewServer' : 'Выбрать', + 'table.cells' : 'Ячейки', + 'table.rows' : 'Строки', + 'table.cols' : 'Столбцы', + 'table.size' : 'Размеры', + 'table.width' : 'Ширина', + 'table.height' : 'Высота', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : 'Space', + 'table.padding' : 'Padding', + 'table.spacing' : 'Spacing', + 'table.align' : 'Выравнивание', + 'table.textAlign' : 'По горизонтали', + 'table.verticalAlign' : 'По вертикали', + 'table.alignDefault' : 'По умолчанию', + 'table.alignLeft' : 'Влево', + 'table.alignCenter' : 'По центру', + 'table.alignRight' : 'Вправо', + 'table.alignTop' : 'Вверх', + 'table.alignMiddle' : 'Посередине', + 'table.alignBottom' : 'Вниз', + 'table.alignBaseline' : 'По базовой линии', + 'table.border' : 'Рамка', + 'table.borderWidth' : 'Ширина', + 'table.borderColor' : 'Цвет', + 'table.backgroundColor' : 'Цвет фона', + 'map.address' : 'Адрес: ', + 'map.search' : 'Поиск', + 'baidumap.address' : 'Адрес: ', + 'baidumap.search' : 'Поиск', + 'baidumap.insertDynamicMap' : 'Динамическая карта', + 'anchor.name' : 'Имя якоря', + 'formatblock.formatBlock' : { + h1 : 'Заголовок 1', + h2 : 'Заголовок 2', + h3 : 'Заголовок 3', + h4 : 'Заголовок 4', + p : 'Обычный текст' + }, + 'fontname.fontName' : { + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Comic Sans MS' : 'Comic Sans MS', + 'Courier New' : 'Courier New', + 'Garamond' : 'Garamond', + 'Georgia' : 'Georgia', + 'Tahoma' : 'Tahoma', + 'Times New Roman' : 'Times New Roman', + 'Trebuchet MS' : 'Trebuchet MS', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : '1'}, + {'1.5' : '1.5'}, + {'2' : '2'}, + {'2.5' : '2.5'}, + {'3' : '3'} + ], + 'template.selectTemplate' : 'Шаблон', + 'template.replaceContent' : 'Заменить текущий шаблон', + 'template.fileList' : { + '1.html' : 'Текст и изображения', + '2.html' : 'Таблица', + '3.html' : 'Список' + } +}, 'en'); + +KindEditor.each(KindEditor.options.items, function(i, name) { + if (name == 'baidumap') { + KindEditor.options.items[i] = 'map'; + } +}); +KindEditor.options.langType = 'ru'; diff --git a/public/kindeditor/lang/zh-CN.js b/public/kindeditor/lang/zh-CN.js new file mode 100644 index 0000000..be6527c --- /dev/null +++ b/public/kindeditor/lang/zh-CN.js @@ -0,0 +1,238 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.lang({ + source : 'HTML代码', + preview : '预览', + undo : '后退(Ctrl+Z)', + redo : '前进(Ctrl+Y)', + cut : '剪切(Ctrl+X)', + copy : '复制(Ctrl+C)', + paste : '粘贴(Ctrl+V)', + plainpaste : '粘贴为无格式文本', + wordpaste : '从Word粘贴', + selectall : '全选(Ctrl+A)', + justifyleft : '左对齐', + justifycenter : '居中', + justifyright : '右对齐', + justifyfull : '两端对齐', + insertorderedlist : '编号', + insertunorderedlist : '项目符号', + indent : '增加缩进', + outdent : '减少缩进', + subscript : '下标', + superscript : '上标', + formatblock : '段落', + fontname : '字体', + fontsize : '文字大小', + forecolor : '文字颜色', + hilitecolor : '文字背景', + bold : '粗体(Ctrl+B)', + italic : '斜体(Ctrl+I)', + underline : '下划线(Ctrl+U)', + strikethrough : '删除线', + removeformat : '删除格式', + image : '图片', + multiimage : '批量图片上传', + flash : 'Flash', + media : '视音频', + table : '表格', + tablecell : '单元格', + hr : '插入横线', + emoticons : '插入表情', + link : '超级链接', + unlink : '取消超级链接', + fullscreen : '全屏显示', + about : '关于', + print : '打印(Ctrl+P)', + filemanager : '文件空间', + code : '插入程序代码', + map : 'Google地图', + baidumap : '百度地图', + lineheight : '行距', + clearhtml : '清理HTML代码', + pagebreak : '插入分页符', + quickformat : '一键排版', + insertfile : '插入文件', + template : '插入模板', + anchor : '锚点', + yes : '确定', + no : '取消', + close : '关闭', + editImage : '图片属性', + deleteImage : '删除图片', + editFlash : 'Flash属性', + deleteFlash : '删除Flash', + editMedia : '视音频属性', + deleteMedia : '删除视音频', + editLink : '超级链接属性', + deleteLink : '取消超级链接', + editAnchor : '锚点属性', + deleteAnchor : '删除锚点', + tableprop : '表格属性', + tablecellprop : '单元格属性', + tableinsert : '插入表格', + tabledelete : '删除表格', + tablecolinsertleft : '左侧插入列', + tablecolinsertright : '右侧插入列', + tablerowinsertabove : '上方插入行', + tablerowinsertbelow : '下方插入行', + tablerowmerge : '向下合并单元格', + tablecolmerge : '向右合并单元格', + tablerowsplit : '拆分行', + tablecolsplit : '拆分列', + tablecoldelete : '删除列', + tablerowdelete : '删除行', + noColor : '无颜色', + pleaseSelectFile : '请选择文件。', + invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。", + invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", + invalidWidth : "宽度必须为数字。", + invalidHeight : "高度必须为数字。", + invalidBorder : "边框必须为数字。", + invalidUrl : "请输入有效的URL地址。", + invalidRows : '行数为必选项,只允许输入大于0的数字。', + invalidCols : '列数为必选项,只允许输入大于0的数字。', + invalidPadding : '边距必须为数字。', + invalidSpacing : '间距必须为数字。', + invalidJson : '服务器发生故障。', + uploadSuccess : '上传成功。', + cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。', + copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。', + pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。', + ajaxLoading : '加载中,请稍候 ...', + uploadLoading : '上传中,请稍候 ...', + uploadError : '上传错误', + 'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', + 'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', + 'code.pleaseInput' : '请输入程序代码。', + 'link.url' : 'URL', + 'link.linkType' : '打开类型', + 'link.newWindow' : '新窗口', + 'link.selfWindow' : '当前窗口', + 'flash.url' : 'URL', + 'flash.width' : '宽度', + 'flash.height' : '高度', + 'flash.upload' : '上传', + 'flash.viewServer' : '文件空间', + 'media.url' : 'URL', + 'media.width' : '宽度', + 'media.height' : '高度', + 'media.autostart' : '自动播放', + 'media.upload' : '上传', + 'media.viewServer' : '文件空间', + 'image.remoteImage' : '网络图片', + 'image.localImage' : '本地上传', + 'image.remoteUrl' : '图片地址', + 'image.localUrl' : '上传文件', + 'image.size' : '图片大小', + 'image.width' : '宽', + 'image.height' : '高', + 'image.resetSize' : '重置大小', + 'image.align' : '对齐方式', + 'image.defaultAlign' : '默认方式', + 'image.leftAlign' : '左对齐', + 'image.rightAlign' : '右对齐', + 'image.imgTitle' : '图片说明', + 'image.upload' : '浏览...', + 'image.viewServer' : '图片空间', + 'multiimage.uploadDesc' : '允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>', + 'multiimage.startUpload' : '开始上传', + 'multiimage.clearAll' : '全部清空', + 'multiimage.insertAll' : '全部插入', + 'multiimage.queueLimitExceeded' : '文件数量超过限制。', + 'multiimage.fileExceedsSizeLimit' : '文件大小超过限制。', + 'multiimage.zeroByteFile' : '无法上传空文件。', + 'multiimage.invalidFiletype' : '文件类型不正确。', + 'multiimage.unknownError' : '发生异常,无法上传。', + 'multiimage.pending' : '等待上传', + 'multiimage.uploadError' : '上传失败', + 'filemanager.emptyFolder' : '空文件夹', + 'filemanager.moveup' : '移到上一级文件夹', + 'filemanager.viewType' : '显示方式:', + 'filemanager.viewImage' : '缩略图', + 'filemanager.listImage' : '详细信息', + 'filemanager.orderType' : '排序方式:', + 'filemanager.fileName' : '名称', + 'filemanager.fileSize' : '大小', + 'filemanager.fileType' : '类型', + 'insertfile.url' : 'URL', + 'insertfile.title' : '文件说明', + 'insertfile.upload' : '上传', + 'insertfile.viewServer' : '文件空间', + 'table.cells' : '单元格数', + 'table.rows' : '行数', + 'table.cols' : '列数', + 'table.size' : '大小', + 'table.width' : '宽度', + 'table.height' : '高度', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : '边距间距', + 'table.padding' : '边距', + 'table.spacing' : '间距', + 'table.align' : '对齐方式', + 'table.textAlign' : '水平对齐', + 'table.verticalAlign' : '垂直对齐', + 'table.alignDefault' : '默认', + 'table.alignLeft' : '左对齐', + 'table.alignCenter' : '居中', + 'table.alignRight' : '右对齐', + 'table.alignTop' : '顶部', + 'table.alignMiddle' : '中部', + 'table.alignBottom' : '底部', + 'table.alignBaseline' : '基线', + 'table.border' : '边框', + 'table.borderWidth' : '边框', + 'table.borderColor' : '颜色', + 'table.backgroundColor' : '背景颜色', + 'map.address' : '地址: ', + 'map.search' : '搜索', + 'baidumap.address' : '地址: ', + 'baidumap.search' : '搜索', + 'baidumap.insertDynamicMap' : '插入动态地图', + 'anchor.name' : '锚点名称', + 'formatblock.formatBlock' : { + h1 : '标题 1', + h2 : '标题 2', + h3 : '标题 3', + h4 : '标题 4', + p : '正 文' + }, + 'fontname.fontName' : { + 'SimSun' : '宋体', + 'NSimSun' : '新宋体', + 'FangSong_GB2312' : '仿宋_GB2312', + 'KaiTi_GB2312' : '楷体_GB2312', + 'SimHei' : '黑体', + 'Microsoft YaHei' : '微软雅黑', + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Times New Roman' : 'Times New Roman', + 'Courier New' : 'Courier New', + 'Tahoma' : 'Tahoma', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : '单倍行距'}, + {'1.5' : '1.5倍行距'}, + {'2' : '2倍行距'}, + {'2.5' : '2.5倍行距'}, + {'3' : '3倍行距'} + ], + 'template.selectTemplate' : '可选模板', + 'template.replaceContent' : '替换当前内容', + 'template.fileList' : { + '1.html' : '图片和文字', + '2.html' : '表格', + '3.html' : '项目编号' + } +}, 'zh-CN'); + +KindEditor.options.langType = 'zh-CN'; \ No newline at end of file diff --git a/public/kindeditor/lang/zh-TW.js b/public/kindeditor/lang/zh-TW.js new file mode 100644 index 0000000..4946898 --- /dev/null +++ b/public/kindeditor/lang/zh-TW.js @@ -0,0 +1,243 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.lang({ + source : '原始碼', + preview : '預覽', + undo : '復原(Ctrl+Z)', + redo : '重複(Ctrl+Y)', + cut : '剪下(Ctrl+X)', + copy : '複製(Ctrl+C)', + paste : '貼上(Ctrl+V)', + plainpaste : '貼為純文字格式', + wordpaste : '自Word貼上', + selectall : '全選(Ctrl+A)', + justifyleft : '靠左對齊', + justifycenter : '置中', + justifyright : '靠右對齊', + justifyfull : '左右對齊', + insertorderedlist : '編號清單', + insertunorderedlist : '項目清單', + indent : '增加縮排', + outdent : '減少縮排', + subscript : '下標', + superscript : '上標', + formatblock : '標題', + fontname : '字體', + fontsize : '文字大小', + forecolor : '文字顏色', + hilitecolor : '背景顏色', + bold : '粗體(Ctrl+B)', + italic : '斜體(Ctrl+I)', + underline : '底線(Ctrl+U)', + strikethrough : '刪除線', + removeformat : '清除格式', + image : '影像', + multiimage : '批量影像上傳', + flash : 'Flash', + media : '多媒體', + table : '表格', + tablecell : '儲存格', + hr : '插入水平線', + emoticons : '插入表情', + link : '超連結', + unlink : '移除超連結', + fullscreen : '最大化', + about : '關於', + print : '列印(Ctrl+P)', + filemanager : '瀏覽伺服器', + code : '插入程式代碼', + map : 'Google地圖', + baidumap : 'Baidu地圖', + lineheight : '行距', + clearhtml : '清理HTML代碼', + pagebreak : '插入分頁符號', + quickformat : '快速排版', + insertfile : '插入文件', + template : '插入樣板', + anchor : '錨點', + yes : '確定', + no : '取消', + close : '關閉', + editImage : '影像屬性', + deleteImage : '刪除影像', + editFlash : 'Flash屬性', + deleteFlash : '删除Flash', + editMedia : '多媒體屬性', + deleteMedia : '删除多媒體', + editLink : '超連結屬性', + deleteLink : '移除超連結', + editAnchor : '锚点属性', + deleteAnchor : '删除锚点', + tableprop : '表格屬性', + tablecellprop : '儲存格屬性', + tableinsert : '插入表格', + tabledelete : '刪除表格', + tablecolinsertleft : '向左插入列', + tablecolinsertright : '向右插入列', + tablerowinsertabove : '向上插入欄', + tablerowinsertbelow : '下方插入欄', + tablerowmerge : '向下合併單元格', + tablecolmerge : '向右合併單元格', + tablerowsplit : '分割欄', + tablecolsplit : '分割列', + tablecoldelete : '删除列', + tablerowdelete : '删除欄', + noColor : '自動', + pleaseSelectFile : '請選擇文件。', + invalidImg : "請輸入有效的URL。\n只允許jpg,gif,bmp,png格式。", + invalidMedia : "請輸入有效的URL。\n只允許swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", + invalidWidth : "寬度必須是數字。", + invalidHeight : "高度必須是數字。", + invalidBorder : "邊框必須是數字。", + invalidUrl : "請輸入有效的URL。", + invalidRows : '欄數是必須輸入項目,只允許輸入大於0的數字。', + invalidCols : '列數是必須輸入項目,只允許輸入大於0的數字。', + invalidPadding : '內距必須是數字。', + invalidSpacing : '間距必須是數字。', + invalidJson : '伺服器發生故障。', + uploadSuccess : '上傳成功。', + cutError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+X)完成。', + copyError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+C)完成。', + pasteError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+V)完成。', + ajaxLoading : '加載中,請稍候 ...', + uploadLoading : '上傳中,請稍候 ...', + uploadError : '上傳錯誤', + 'plainpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。', + 'wordpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。', + 'code.pleaseInput' : 'Please input code.', + 'link.url' : 'URL', + 'link.linkType' : '打開類型', + 'link.newWindow' : '新窗口', + 'link.selfWindow' : '本頁窗口', + 'flash.url' : 'URL', + 'flash.width' : '寬度', + 'flash.height' : '高度', + 'flash.upload' : '上傳', + 'flash.viewServer' : '瀏覽', + 'media.url' : 'URL', + 'media.width' : '寬度', + 'media.height' : '高度', + 'media.autostart' : '自動播放', + 'media.upload' : '上傳', + 'media.viewServer' : '瀏覽', + 'image.remoteImage' : '網絡影像', + 'image.localImage' : '上傳影像', + 'image.remoteUrl' : '影像URL', + 'image.localUrl' : '影像URL', + 'image.size' : '影像大小', + 'image.width' : '寬度', + 'image.height' : '高度', + 'image.resetSize' : '原始大小', + 'image.align' : '對齊方式', + 'image.defaultAlign' : '未設定', + 'image.leftAlign' : '向左對齊', + 'image.rightAlign' : '向右對齊', + 'image.imgTitle' : '影像說明', + 'image.upload' : '瀏覽...', + 'image.viewServer' : '瀏覽...', + 'multiimage.uploadDesc' : 'Allows users to upload <%=uploadLimit%> images, single image size not exceeding <%=sizeLimit%>', + 'multiimage.startUpload' : 'Start upload', + 'multiimage.clearAll' : 'Clear all', + 'multiimage.insertAll' : 'Insert all', + 'multiimage.queueLimitExceeded' : 'Queue limit exceeded.', + 'multiimage.fileExceedsSizeLimit' : 'File exceeds size limit.', + 'multiimage.zeroByteFile' : 'Zero byte file.', + 'multiimage.invalidFiletype' : 'Invalid file type.', + 'multiimage.unknownError' : 'Unknown upload error.', + 'multiimage.pending' : 'Pending ...', + 'multiimage.uploadError' : 'Upload error', + 'filemanager.emptyFolder' : '空文件夾', + 'filemanager.moveup' : '至上一級文件夾', + 'filemanager.viewType' : '顯示方式:', + 'filemanager.viewImage' : '縮略圖', + 'filemanager.listImage' : '詳細信息', + 'filemanager.orderType' : '排序方式:', + 'filemanager.fileName' : '名稱', + 'filemanager.fileSize' : '大小', + 'filemanager.fileType' : '類型', + 'insertfile.url' : 'URL', + 'insertfile.title' : '文件說明', + 'insertfile.upload' : '上傳', + 'insertfile.viewServer' : '瀏覽', + 'table.cells' : '儲存格數', + 'table.rows' : '欄數', + 'table.cols' : '列數', + 'table.size' : '表格大小', + 'table.width' : '寬度', + 'table.height' : '高度', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : '內距間距', + 'table.padding' : '內距', + 'table.spacing' : '間距', + 'table.align' : '對齊方式', + 'table.textAlign' : '水平對齊', + 'table.verticalAlign' : '垂直對齊', + 'table.alignDefault' : '未設定', + 'table.alignLeft' : '向左對齊', + 'table.alignCenter' : '置中', + 'table.alignRight' : '向右對齊', + 'table.alignTop' : '靠上', + 'table.alignMiddle' : '置中', + 'table.alignBottom' : '靠下', + 'table.alignBaseline' : '基線', + 'table.border' : '表格邊框', + 'table.borderWidth' : '邊框', + 'table.borderColor' : '顏色', + 'table.backgroundColor' : '背景顏色', + 'map.address' : '住所: ', + 'map.search' : '尋找', + 'baidumap.address' : '住所: ', + 'baidumap.search' : '尋找', + 'baidumap.insertDynamicMap' : '插入動態地圖', + 'anchor.name' : '錨點名稱', + 'formatblock.formatBlock' : { + h1 : '標題 1', + h2 : '標題 2', + h3 : '標題 3', + h4 : '標題 4', + p : '一般' + }, + 'fontname.fontName' : { + 'MingLiU' : '細明體', + 'PMingLiU' : '新細明體', + 'DFKai-SB' : '標楷體', + 'SimSun' : '宋體', + 'NSimSun' : '新宋體', + 'FangSong' : '仿宋體', + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Times New Roman' : 'Times New Roman', + 'Courier New' : 'Courier New', + 'Tahoma' : 'Tahoma', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : '单倍行距'}, + {'1.5' : '1.5倍行距'}, + {'2' : '2倍行距'}, + {'2.5' : '2.5倍行距'}, + {'3' : '3倍行距'} + ], + 'template.selectTemplate' : '可選樣板', + 'template.replaceContent' : '取代當前內容', + 'template.fileList' : { + '1.html' : '影像和文字', + '2.html' : '表格', + '3.html' : '项目清單' + } +}, 'zh-TW'); + +KindEditor.each(KindEditor.options.items, function(i, name) { + if (name == 'baidumap') { + KindEditor.options.items[i] = 'map'; + } +}); +KindEditor.options.langType = 'zh-TW'; \ No newline at end of file diff --git a/public/kindeditor/license.txt b/public/kindeditor/license.txt new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/public/kindeditor/license.txt @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/public/kindeditor/php/JSON.php b/public/kindeditor/php/JSON.php new file mode 100644 index 0000000..0cddbdd --- /dev/null +++ b/public/kindeditor/php/JSON.php @@ -0,0 +1,806 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} + +?> diff --git a/public/kindeditor/php/demo.php b/public/kindeditor/php/demo.php new file mode 100644 index 0000000..7ccb2d9 --- /dev/null +++ b/public/kindeditor/php/demo.php @@ -0,0 +1,53 @@ + + + + + + KindEditor PHP + + + + + + + + + +
      + +
      + (提交快捷键: Ctrl + Enter) +
      + + + diff --git a/public/kindeditor/php/file_manager_json.php b/public/kindeditor/php/file_manager_json.php new file mode 100644 index 0000000..2c6c1f3 --- /dev/null +++ b/public/kindeditor/php/file_manager_json.php @@ -0,0 +1,137 @@ + 2); //文件夹是否包含文件 + $file_list[$i]['filesize'] = 0; //文件大小 + $file_list[$i]['is_photo'] = false; //是否图片 + $file_list[$i]['filetype'] = ''; //文件类别,用扩展名判断 + } else { + $file_list[$i]['is_dir'] = false; + $file_list[$i]['has_file'] = false; + $file_list[$i]['filesize'] = filesize($file); + $file_list[$i]['dir_path'] = ''; + $file_ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + $file_list[$i]['is_photo'] = in_array($file_ext, $ext_arr); + $file_list[$i]['filetype'] = $file_ext; + } + $file_list[$i]['filename'] = $filename; //文件名,包含扩展名 + $file_list[$i]['datetime'] = date('Y-m-d H:i:s', filemtime($file)); //文件最后修改时间 + $i++; + } + closedir($handle); +} + +//排序 +function cmp_func($a, $b) { + global $order; + if ($a['is_dir'] && !$b['is_dir']) { + return -1; + } else if (!$a['is_dir'] && $b['is_dir']) { + return 1; + } else { + if ($order == 'size') { + if ($a['filesize'] > $b['filesize']) { + return 1; + } else if ($a['filesize'] < $b['filesize']) { + return -1; + } else { + return 0; + } + } else if ($order == 'type') { + return strcmp($a['filetype'], $b['filetype']); + } else { + return strcmp($a['filename'], $b['filename']); + } + } +} +usort($file_list, 'cmp_func'); + +$result = array(); +//相对于根目录的上一级目录 +$result['moveup_dir_path'] = $moveup_dir_path; +//相对于根目录的当前目录 +$result['current_dir_path'] = $current_dir_path; +//当前目录的URL +$result['current_url'] = $current_url; +//文件数 +$result['total_count'] = count($file_list); +//文件列表数组 +$result['file_list'] = $file_list; + +//输出JSON字符串 +header('Content-type: application/json; charset=UTF-8'); +$json = new Services_JSON(); +echo $json->encode($result); diff --git a/public/kindeditor/php/upload_json.php b/public/kindeditor/php/upload_json.php new file mode 100644 index 0000000..9fa5631 --- /dev/null +++ b/public/kindeditor/php/upload_json.php @@ -0,0 +1,139 @@ + array('gif', 'jpg', 'jpeg', 'png', 'bmp'), + 'flash' => array('swf', 'flv'), + 'media' => array('swf', 'flv', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'), + 'file' => array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'), +); +//最大文件大小 +$max_size = 1000000; + +$save_path = realpath($save_path) . '/'; + +//PHP上传失败 +if (!empty($_FILES['imgFile']['error'])) { + switch($_FILES['imgFile']['error']){ + case '1': + $error = '超过php.ini允许的大小。'; + break; + case '2': + $error = '超过表单允许的大小。'; + break; + case '3': + $error = '图片只有部分被上传。'; + break; + case '4': + $error = '请选择图片。'; + break; + case '6': + $error = '找不到临时目录。'; + break; + case '7': + $error = '写文件到硬盘出错。'; + break; + case '8': + $error = 'File upload stopped by extension。'; + break; + case '999': + default: + $error = '未知错误。'; + } + alert($error); +} + +//有上传文件时 +if (empty($_FILES) === false) { + //原文件名 + $file_name = $_FILES['imgFile']['name']; + //服务器上临时文件名 + $tmp_name = $_FILES['imgFile']['tmp_name']; + //文件大小 + $file_size = $_FILES['imgFile']['size']; + //检查文件名 + if (!$file_name) { + alert("请选择文件。"); + } + //检查目录 + if (@is_dir($save_path) === false) { + alert("上传目录不存在。"); + } + //检查目录写权限 + if (@is_writable($save_path) === false) { + alert("上传目录没有写权限。"); + } + //检查是否已上传 + if (@is_uploaded_file($tmp_name) === false) { + alert("上传失败。"); + } + //检查文件大小 + if ($file_size > $max_size) { + alert("上传文件大小超过限制。"); + } + //检查目录名 + $dir_name = empty($_GET['dir']) ? 'image' : trim($_GET['dir']); + if (empty($ext_arr[$dir_name])) { + alert("目录名不正确。"); + } + //获得文件扩展名 + $temp_arr = explode(".", $file_name); + $file_ext = array_pop($temp_arr); + $file_ext = trim($file_ext); + $file_ext = strtolower($file_ext); + //检查扩展名 + if (in_array($file_ext, $ext_arr[$dir_name]) === false) { + alert("上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $ext_arr[$dir_name]) . "格式。"); + } + //创建文件夹 + if ($dir_name !== '') { + $save_path .= $dir_name . "/"; + $save_url .= $dir_name . "/"; + if (!file_exists($save_path)) { + mkdir($save_path); + } + } + $ymd = date("Ymd"); + $save_path .= $ymd . "/"; + $save_url .= $ymd . "/"; + if (!file_exists($save_path)) { + mkdir($save_path); + } + //新文件名 + $new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext; + //移动文件 + $file_path = $save_path . $new_file_name; + if (move_uploaded_file($tmp_name, $file_path) === false) { + alert("上传文件失败。"); + } + @chmod($file_path, 0644); + $file_url = $save_url . $new_file_name; + + header('Content-type: text/html; charset=UTF-8'); + $json = new Services_JSON(); + echo $json->encode(array('error' => 0, 'url' => $file_url)); + exit; +} + +function alert($msg) { + header('Content-type: text/html; charset=UTF-8'); + $json = new Services_JSON(); + echo $json->encode(array('error' => 1, 'message' => $msg)); + exit; +} diff --git a/public/kindeditor/plugins/anchor/anchor.js b/public/kindeditor/plugins/anchor/anchor.js new file mode 100644 index 0000000..55ab894 --- /dev/null +++ b/public/kindeditor/plugins/anchor/anchor.js @@ -0,0 +1,46 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('anchor', function(K) { + var self = this, name = 'anchor', lang = self.lang(name + '.'); + self.plugin.anchor = { + edit : function() { + var html = ['
      ', + '
      ', + '', + '', + '
      ', + '
      '].join(''); + var dialog = self.createDialog({ + name : name, + width : 300, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + self.insertHtml('').hideDialog().focus(); + } + } + }); + var div = dialog.div, + nameBox = K('input[name="name"]', div); + var img = self.plugin.getSelectedAnchor(); + if (img) { + nameBox.val(unescape(img.attr('data-ke-name'))); + } + nameBox[0].focus(); + nameBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedAnchor().remove(); + } + }; + self.clickToolbar(name, self.plugin.anchor.edit); +}); diff --git a/public/kindeditor/plugins/autoheight/autoheight.js b/public/kindeditor/plugins/autoheight/autoheight.js new file mode 100644 index 0000000..546578b --- /dev/null +++ b/public/kindeditor/plugins/autoheight/autoheight.js @@ -0,0 +1,54 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('autoheight', function(K) { + var self = this; + + if (!self.autoHeightMode) { + return; + } + + var minHeight; + + function hideScroll() { + var edit = self.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + } + + function resetHeight() { + var edit = self.edit; + var body = edit.doc.body; + edit.iframe.height(minHeight); + self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight)); + } + + function init() { + minHeight = K.removeUnit(self.height); + + self.edit.afterChange(resetHeight); + hideScroll(); + resetHeight(); + } + + if (self.isCreated) { + init(); + } else { + self.afterCreate(init); + } +}); + +/* +* 如何实现真正的自动高度? +* 修改编辑器高度之后,再次获取body内容高度时,最小值只会是当前iframe的设置高度,这样就导致高度只增不减。 +* 所以每次获取body内容高度之前,先将iframe的高度重置为最小高度,这样就能获取body的实际高度。 +* 由此就实现了真正的自动高度 +* 测试:chrome、firefox、IE9、IE8 +* */ diff --git a/public/kindeditor/plugins/baidumap/baidumap.js b/public/kindeditor/plugins/baidumap/baidumap.js new file mode 100644 index 0000000..12751c4 --- /dev/null +++ b/public/kindeditor/plugins/baidumap/baidumap.js @@ -0,0 +1,93 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// Baidu Maps: http://dev.baidu.com/wiki/map/index.php?title=%E9%A6%96%E9%A1%B5 + +KindEditor.plugin('baidumap', function(K) { + var self = this, name = 'baidumap', lang = self.lang(name + '.'); + var mapWidth = K.undef(self.mapWidth, 558); + var mapHeight = K.undef(self.mapHeight, 360); + self.clickToolbar(name, function() { + var html = ['
      ', + '
      ', + // left start + '
      ', + lang.address + ' ', + '', + '', + '', + '
      ', + // right start + '
      ', + ' ', + '
      ', + '
      ', + '
      ', + '
      ', + '
      '].join(''); + var dialog = self.createDialog({ + name : name, + width : mapWidth + 42, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var map = win.map; + var centerObj = map.getCenter(); + var center = centerObj.lng + ',' + centerObj.lat; + var zoom = map.getZoom(); + var url = [checkbox[0].checked ? self.pluginsPath + 'baidumap/index.html' : 'http://api.map.baidu.com/staticimage', + '?center=' + encodeURIComponent(center), + '&zoom=' + encodeURIComponent(zoom), + '&width=' + mapWidth, + '&height=' + mapHeight, + '&markers=' + encodeURIComponent(center), + '&markerStyles=' + encodeURIComponent('l,A')].join(''); + if (checkbox[0].checked) { + self.insertHtml(''); + } else { + self.exec('insertimage', url); + } + self.hideDialog().focus(); + } + }, + beforeRemove : function() { + searchBtn.remove(); + if (doc) { + doc.write(''); + } + iframe.remove(); + } + }); + var div = dialog.div, + addressBox = K('[name="address"]', div), + searchBtn = K('[name="searchBtn"]', div), + checkbox = K('[name="insertDynamicMap"]', dialog.div), + win, doc; + var iframe = K(''); + function ready() { + win = iframe[0].contentWindow; + doc = K.iframeDoc(iframe); + } + iframe.bind('load', function() { + iframe.unbind('load'); + if (K.IE) { + ready(); + } else { + setTimeout(ready, 0); + } + }); + K('.ke-map', div).replaceWith(iframe); + // search map + searchBtn.click(function() { + win.search(addressBox.val()); + }); + }); +}); diff --git a/public/kindeditor/plugins/baidumap/index.html b/public/kindeditor/plugins/baidumap/index.html new file mode 100644 index 0000000..e106d1a --- /dev/null +++ b/public/kindeditor/plugins/baidumap/index.html @@ -0,0 +1,83 @@ + + + + + + +百度地图API自定义地图 + + + + + + + +
      + + + \ No newline at end of file diff --git a/public/kindeditor/plugins/baidumap/map.html b/public/kindeditor/plugins/baidumap/map.html new file mode 100644 index 0000000..b65ea1d --- /dev/null +++ b/public/kindeditor/plugins/baidumap/map.html @@ -0,0 +1,43 @@ + + + + + Baidu Maps + + + + + +
      + + diff --git a/public/kindeditor/plugins/clearhtml/clearhtml.js b/public/kindeditor/plugins/clearhtml/clearhtml.js new file mode 100644 index 0000000..1bf0e5d --- /dev/null +++ b/public/kindeditor/plugins/clearhtml/clearhtml.js @@ -0,0 +1,29 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('clearhtml', function(K) { + var self = this, name = 'clearhtml'; + self.clickToolbar(name, function() { + self.focus(); + var html = self.html(); + html = html.replace(/(]*>)([\s\S]*?)(<\/script>)/ig, ''); + html = html.replace(/(]*>)([\s\S]*?)(<\/style>)/ig, ''); + html = K.formatHtml(html, { + a : ['href', 'target'], + embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], + img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'], + table : ['border'], + 'td,th' : ['rowspan', 'colspan'], + 'div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [] + }); + self.html(html); + self.cmd.selection(true); + self.addBookmark(); + }); +}); diff --git a/public/kindeditor/plugins/code/code.js b/public/kindeditor/plugins/code/code.js new file mode 100644 index 0000000..85e4225 --- /dev/null +++ b/public/kindeditor/plugins/code/code.js @@ -0,0 +1,62 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// google code prettify: http://google-code-prettify.googlecode.com/ +// http://google-code-prettify.googlecode.com/ + +KindEditor.plugin('code', function(K) { + var self = this, name = 'code'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = ['
      ', + '
      ', + '', + '
      ', + '', + '
      '].join(''), + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var type = K('.ke-code-type', dialog.div).val(), + code = textarea.val(), + cls = type === '' ? '' : ' lang-' + type, + html = '
      \n' + K.escape(code) + '
      '; + if (K.trim(code) === '') { + alert(lang.pleaseInput); + textarea[0].focus(); + return; + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); diff --git a/public/kindeditor/plugins/code/prettify.css b/public/kindeditor/plugins/code/prettify.css new file mode 100644 index 0000000..b8287e5 --- /dev/null +++ b/public/kindeditor/plugins/code/prettify.css @@ -0,0 +1,13 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} + +pre.prettyprint { + border: 0; + border-left: 3px solid rgb(204, 204, 204); + margin-left: 2em; + padding: 0.5em; + font-size: 110%; + display: block; + font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; + margin: 1em 0px; + white-space: pre; +} diff --git a/public/kindeditor/plugins/code/prettify.js b/public/kindeditor/plugins/code/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/public/kindeditor/plugins/code/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('emoticons', function(K) { + var self = this, name = 'emoticons', + path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'), + allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons, + currentPageNum = 1; + self.clickToolbar(name, function() { + var rows = 5, cols = 9, total = 135, startNum = 0, + cells = rows * cols, pages = Math.ceil(total / cells), + colsHalf = Math.floor(cols / 2), + wrapperDiv = K('
      '), + elements = [], + menu = self.createMenu({ + name : name, + beforeRemove : function() { + removeEvent(); + } + }); + menu.div.append(wrapperDiv); + var previewDiv, previewImg; + if (allowPreview) { + previewDiv = K('
      ').css('right', 0); + previewImg = K(''); + wrapperDiv.append(previewDiv); + previewDiv.append(previewImg); + } + function bindCellEvent(cell, j, num) { + if (previewDiv) { + cell.mouseover(function() { + if (j > colsHalf) { + previewDiv.css('left', 0); + previewDiv.css('right', ''); + } else { + previewDiv.css('left', ''); + previewDiv.css('right', 0); + } + previewImg.attr('src', path + num + '.gif'); + K(this).addClass('ke-on'); + }); + } else { + cell.mouseover(function() { + K(this).addClass('ke-on'); + }); + } + cell.mouseout(function() { + K(this).removeClass('ke-on'); + }); + cell.click(function(e) { + self.insertHtml('').hideMenu().focus(); + e.stop(); + }); + } + function createEmoticonsTable(pageNum, parentDiv) { + var table = document.createElement('table'); + parentDiv.append(table); + if (previewDiv) { + K(table).mouseover(function() { + previewDiv.show('block'); + }); + K(table).mouseout(function() { + previewDiv.hide(); + }); + elements.push(K(table)); + } + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var num = (pageNum - 1) * cells + startNum; + for (var i = 0; i < rows; i++) { + var row = table.insertRow(i); + for (var j = 0; j < cols; j++) { + var cell = K(row.insertCell(j)); + cell.addClass('ke-cell'); + bindCellEvent(cell, j, num); + var span = K('') + .css('background-position', '-' + (24 * num) + 'px 0px') + .css('background-image', 'url(' + path + 'static.gif)'); + cell.append(span); + elements.push(cell); + num++; + } + } + return table; + } + var table = createEmoticonsTable(currentPageNum, wrapperDiv); + function removeEvent() { + K.each(elements, function() { + this.unbind(); + }); + } + var pageDiv; + function bindPageEvent(el, pageNum) { + el.click(function(e) { + removeEvent(); + table.parentNode.removeChild(table); + pageDiv.remove(); + table = createEmoticonsTable(pageNum, wrapperDiv); + createPageTable(pageNum); + currentPageNum = pageNum; + e.stop(); + }); + } + function createPageTable(currentPageNum) { + pageDiv = K('
      '); + wrapperDiv.append(pageDiv); + for (var pageNum = 1; pageNum <= pages; pageNum++) { + if (currentPageNum !== pageNum) { + var a = K('
      [' + pageNum + ']'); + bindPageEvent(a, pageNum); + pageDiv.append(a); + elements.push(a); + } else { + pageDiv.append(K('@[' + pageNum + ']')); + } + pageDiv.append(K('@ ')); + } + } + createPageTable(currentPageNum); + }); +}); diff --git a/public/kindeditor/plugins/emoticons/images/0.gif b/public/kindeditor/plugins/emoticons/images/0.gif new file mode 100644 index 0000000..5be27cb Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/0.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/1.gif b/public/kindeditor/plugins/emoticons/images/1.gif new file mode 100644 index 0000000..a2644a9 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/1.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/10.gif b/public/kindeditor/plugins/emoticons/images/10.gif new file mode 100644 index 0000000..905c15b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/10.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/100.gif b/public/kindeditor/plugins/emoticons/images/100.gif new file mode 100644 index 0000000..92ad35d Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/100.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/101.gif b/public/kindeditor/plugins/emoticons/images/101.gif new file mode 100644 index 0000000..1f27663 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/101.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/102.gif b/public/kindeditor/plugins/emoticons/images/102.gif new file mode 100644 index 0000000..748ded1 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/102.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/103.gif b/public/kindeditor/plugins/emoticons/images/103.gif new file mode 100644 index 0000000..be9eaa0 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/103.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/104.gif b/public/kindeditor/plugins/emoticons/images/104.gif new file mode 100644 index 0000000..d7c2066 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/104.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/105.gif b/public/kindeditor/plugins/emoticons/images/105.gif new file mode 100644 index 0000000..2f353ca Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/105.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/106.gif b/public/kindeditor/plugins/emoticons/images/106.gif new file mode 100644 index 0000000..5193534 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/106.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/107.gif b/public/kindeditor/plugins/emoticons/images/107.gif new file mode 100644 index 0000000..70d38d3 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/107.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/108.gif b/public/kindeditor/plugins/emoticons/images/108.gif new file mode 100644 index 0000000..749d500 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/108.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/109.gif b/public/kindeditor/plugins/emoticons/images/109.gif new file mode 100644 index 0000000..6f57d56 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/109.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/11.gif b/public/kindeditor/plugins/emoticons/images/11.gif new file mode 100644 index 0000000..b512dd5 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/11.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/110.gif b/public/kindeditor/plugins/emoticons/images/110.gif new file mode 100644 index 0000000..e253abc Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/110.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/111.gif b/public/kindeditor/plugins/emoticons/images/111.gif new file mode 100644 index 0000000..0c56723 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/111.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/112.gif b/public/kindeditor/plugins/emoticons/images/112.gif new file mode 100644 index 0000000..c8ddce8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/112.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/113.gif b/public/kindeditor/plugins/emoticons/images/113.gif new file mode 100644 index 0000000..2727104 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/113.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/114.gif b/public/kindeditor/plugins/emoticons/images/114.gif new file mode 100644 index 0000000..53918e2 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/114.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/115.gif b/public/kindeditor/plugins/emoticons/images/115.gif new file mode 100644 index 0000000..4db3369 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/115.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/116.gif b/public/kindeditor/plugins/emoticons/images/116.gif new file mode 100644 index 0000000..57326bd Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/116.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/117.gif b/public/kindeditor/plugins/emoticons/images/117.gif new file mode 100644 index 0000000..14611b6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/117.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/118.gif b/public/kindeditor/plugins/emoticons/images/118.gif new file mode 100644 index 0000000..8c25500 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/118.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/119.gif b/public/kindeditor/plugins/emoticons/images/119.gif new file mode 100644 index 0000000..65bb468 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/119.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/12.gif b/public/kindeditor/plugins/emoticons/images/12.gif new file mode 100644 index 0000000..547529c Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/12.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/120.gif b/public/kindeditor/plugins/emoticons/images/120.gif new file mode 100644 index 0000000..5ce77c0 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/120.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/121.gif b/public/kindeditor/plugins/emoticons/images/121.gif new file mode 100644 index 0000000..a021aba Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/121.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/122.gif b/public/kindeditor/plugins/emoticons/images/122.gif new file mode 100644 index 0000000..9a79e11 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/122.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/123.gif b/public/kindeditor/plugins/emoticons/images/123.gif new file mode 100644 index 0000000..b9480be Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/123.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/124.gif b/public/kindeditor/plugins/emoticons/images/124.gif new file mode 100644 index 0000000..7fed477 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/124.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/125.gif b/public/kindeditor/plugins/emoticons/images/125.gif new file mode 100644 index 0000000..e2c3c11 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/125.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/126.gif b/public/kindeditor/plugins/emoticons/images/126.gif new file mode 100644 index 0000000..24105c9 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/126.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/127.gif b/public/kindeditor/plugins/emoticons/images/127.gif new file mode 100644 index 0000000..0cead36 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/127.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/128.gif b/public/kindeditor/plugins/emoticons/images/128.gif new file mode 100644 index 0000000..3185861 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/128.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/129.gif b/public/kindeditor/plugins/emoticons/images/129.gif new file mode 100644 index 0000000..ffd7c6b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/129.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/13.gif b/public/kindeditor/plugins/emoticons/images/13.gif new file mode 100644 index 0000000..3475300 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/13.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/130.gif b/public/kindeditor/plugins/emoticons/images/130.gif new file mode 100644 index 0000000..d828e3d Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/130.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/131.gif b/public/kindeditor/plugins/emoticons/images/131.gif new file mode 100644 index 0000000..dcb096f Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/131.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/132.gif b/public/kindeditor/plugins/emoticons/images/132.gif new file mode 100644 index 0000000..1b272a6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/132.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/133.gif b/public/kindeditor/plugins/emoticons/images/133.gif new file mode 100644 index 0000000..0d0e864 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/133.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/134.gif b/public/kindeditor/plugins/emoticons/images/134.gif new file mode 100644 index 0000000..cf48356 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/134.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/14.gif b/public/kindeditor/plugins/emoticons/images/14.gif new file mode 100644 index 0000000..6a788f8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/14.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/15.gif b/public/kindeditor/plugins/emoticons/images/15.gif new file mode 100644 index 0000000..debab8e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/15.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/16.gif b/public/kindeditor/plugins/emoticons/images/16.gif new file mode 100644 index 0000000..ed5d29f Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/16.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/17.gif b/public/kindeditor/plugins/emoticons/images/17.gif new file mode 100644 index 0000000..85886fe Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/17.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/18.gif b/public/kindeditor/plugins/emoticons/images/18.gif new file mode 100644 index 0000000..b6af218 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/18.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/19.gif b/public/kindeditor/plugins/emoticons/images/19.gif new file mode 100644 index 0000000..e045ff2 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/19.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/2.gif b/public/kindeditor/plugins/emoticons/images/2.gif new file mode 100644 index 0000000..40cfda4 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/2.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/20.gif b/public/kindeditor/plugins/emoticons/images/20.gif new file mode 100644 index 0000000..efd650f Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/20.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/21.gif b/public/kindeditor/plugins/emoticons/images/21.gif new file mode 100644 index 0000000..cb8cf6d Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/21.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/22.gif b/public/kindeditor/plugins/emoticons/images/22.gif new file mode 100644 index 0000000..96b04df Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/22.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/23.gif b/public/kindeditor/plugins/emoticons/images/23.gif new file mode 100644 index 0000000..96516b8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/23.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/24.gif b/public/kindeditor/plugins/emoticons/images/24.gif new file mode 100644 index 0000000..5f925c7 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/24.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/25.gif b/public/kindeditor/plugins/emoticons/images/25.gif new file mode 100644 index 0000000..97f8b1a Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/25.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/26.gif b/public/kindeditor/plugins/emoticons/images/26.gif new file mode 100644 index 0000000..a7cded7 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/26.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/27.gif b/public/kindeditor/plugins/emoticons/images/27.gif new file mode 100644 index 0000000..bb46890 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/27.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/28.gif b/public/kindeditor/plugins/emoticons/images/28.gif new file mode 100644 index 0000000..f59dd58 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/28.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/29.gif b/public/kindeditor/plugins/emoticons/images/29.gif new file mode 100644 index 0000000..3c5227e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/29.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/3.gif b/public/kindeditor/plugins/emoticons/images/3.gif new file mode 100644 index 0000000..6d6f762 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/3.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/30.gif b/public/kindeditor/plugins/emoticons/images/30.gif new file mode 100644 index 0000000..e24a180 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/30.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/31.gif b/public/kindeditor/plugins/emoticons/images/31.gif new file mode 100644 index 0000000..073e743 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/31.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/32.gif b/public/kindeditor/plugins/emoticons/images/32.gif new file mode 100644 index 0000000..772eff2 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/32.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/33.gif b/public/kindeditor/plugins/emoticons/images/33.gif new file mode 100644 index 0000000..217c1c5 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/33.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/34.gif b/public/kindeditor/plugins/emoticons/images/34.gif new file mode 100644 index 0000000..e9d4213 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/34.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/35.gif b/public/kindeditor/plugins/emoticons/images/35.gif new file mode 100644 index 0000000..d6da2c3 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/35.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/36.gif b/public/kindeditor/plugins/emoticons/images/36.gif new file mode 100644 index 0000000..c1e6ac9 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/36.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/37.gif b/public/kindeditor/plugins/emoticons/images/37.gif new file mode 100644 index 0000000..92efec6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/37.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/38.gif b/public/kindeditor/plugins/emoticons/images/38.gif new file mode 100644 index 0000000..489f0f9 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/38.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/39.gif b/public/kindeditor/plugins/emoticons/images/39.gif new file mode 100644 index 0000000..734f6d8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/39.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/4.gif b/public/kindeditor/plugins/emoticons/images/4.gif new file mode 100644 index 0000000..6ccdaa2 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/4.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/40.gif b/public/kindeditor/plugins/emoticons/images/40.gif new file mode 100644 index 0000000..24a8eb6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/40.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/41.gif b/public/kindeditor/plugins/emoticons/images/41.gif new file mode 100644 index 0000000..99139e1 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/41.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/42.gif b/public/kindeditor/plugins/emoticons/images/42.gif new file mode 100644 index 0000000..f60897e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/42.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/43.gif b/public/kindeditor/plugins/emoticons/images/43.gif new file mode 100644 index 0000000..4350491 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/43.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/44.gif b/public/kindeditor/plugins/emoticons/images/44.gif new file mode 100644 index 0000000..650d3dd Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/44.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/45.gif b/public/kindeditor/plugins/emoticons/images/45.gif new file mode 100644 index 0000000..5c8e071 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/45.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/46.gif b/public/kindeditor/plugins/emoticons/images/46.gif new file mode 100644 index 0000000..f3cb074 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/46.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/47.gif b/public/kindeditor/plugins/emoticons/images/47.gif new file mode 100644 index 0000000..5b3057a Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/47.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/48.gif b/public/kindeditor/plugins/emoticons/images/48.gif new file mode 100644 index 0000000..27a30c1 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/48.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/49.gif b/public/kindeditor/plugins/emoticons/images/49.gif new file mode 100644 index 0000000..dcfa48a Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/49.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/5.gif b/public/kindeditor/plugins/emoticons/images/5.gif new file mode 100644 index 0000000..ab0b81b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/5.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/50.gif b/public/kindeditor/plugins/emoticons/images/50.gif new file mode 100644 index 0000000..029cf0f Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/50.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/51.gif b/public/kindeditor/plugins/emoticons/images/51.gif new file mode 100644 index 0000000..69f183f Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/51.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/52.gif b/public/kindeditor/plugins/emoticons/images/52.gif new file mode 100644 index 0000000..d41e8aa Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/52.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/53.gif b/public/kindeditor/plugins/emoticons/images/53.gif new file mode 100644 index 0000000..56352dd Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/53.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/54.gif b/public/kindeditor/plugins/emoticons/images/54.gif new file mode 100644 index 0000000..b28d848 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/54.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/55.gif b/public/kindeditor/plugins/emoticons/images/55.gif new file mode 100644 index 0000000..e18da84 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/55.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/56.gif b/public/kindeditor/plugins/emoticons/images/56.gif new file mode 100644 index 0000000..edf96f0 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/56.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/57.gif b/public/kindeditor/plugins/emoticons/images/57.gif new file mode 100644 index 0000000..3f0e2b9 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/57.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/58.gif b/public/kindeditor/plugins/emoticons/images/58.gif new file mode 100644 index 0000000..47b1aaa Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/58.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/59.gif b/public/kindeditor/plugins/emoticons/images/59.gif new file mode 100644 index 0000000..918288b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/59.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/6.gif b/public/kindeditor/plugins/emoticons/images/6.gif new file mode 100644 index 0000000..ceab122 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/6.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/60.gif b/public/kindeditor/plugins/emoticons/images/60.gif new file mode 100644 index 0000000..66d2113 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/60.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/61.gif b/public/kindeditor/plugins/emoticons/images/61.gif new file mode 100644 index 0000000..034933e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/61.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/62.gif b/public/kindeditor/plugins/emoticons/images/62.gif new file mode 100644 index 0000000..8d5c4fd Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/62.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/63.gif b/public/kindeditor/plugins/emoticons/images/63.gif new file mode 100644 index 0000000..d58fcf6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/63.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/64.gif b/public/kindeditor/plugins/emoticons/images/64.gif new file mode 100644 index 0000000..c4e00bd Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/64.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/65.gif b/public/kindeditor/plugins/emoticons/images/65.gif new file mode 100644 index 0000000..da23bfa Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/65.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/66.gif b/public/kindeditor/plugins/emoticons/images/66.gif new file mode 100644 index 0000000..310ec65 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/66.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/67.gif b/public/kindeditor/plugins/emoticons/images/67.gif new file mode 100644 index 0000000..51761ba Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/67.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/68.gif b/public/kindeditor/plugins/emoticons/images/68.gif new file mode 100644 index 0000000..345cb43 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/68.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/69.gif b/public/kindeditor/plugins/emoticons/images/69.gif new file mode 100644 index 0000000..e0f28a0 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/69.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/7.gif b/public/kindeditor/plugins/emoticons/images/7.gif new file mode 100644 index 0000000..2f45399 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/7.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/70.gif b/public/kindeditor/plugins/emoticons/images/70.gif new file mode 100644 index 0000000..24284cf Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/70.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/71.gif b/public/kindeditor/plugins/emoticons/images/71.gif new file mode 100644 index 0000000..a0ccf2e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/71.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/72.gif b/public/kindeditor/plugins/emoticons/images/72.gif new file mode 100644 index 0000000..7e113ee Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/72.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/73.gif b/public/kindeditor/plugins/emoticons/images/73.gif new file mode 100644 index 0000000..c0293c3 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/73.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/74.gif b/public/kindeditor/plugins/emoticons/images/74.gif new file mode 100644 index 0000000..1c52bde Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/74.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/75.gif b/public/kindeditor/plugins/emoticons/images/75.gif new file mode 100644 index 0000000..9cb9aa7 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/75.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/76.gif b/public/kindeditor/plugins/emoticons/images/76.gif new file mode 100644 index 0000000..27019f8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/76.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/77.gif b/public/kindeditor/plugins/emoticons/images/77.gif new file mode 100644 index 0000000..8f882f5 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/77.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/78.gif b/public/kindeditor/plugins/emoticons/images/78.gif new file mode 100644 index 0000000..d0d0856 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/78.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/79.gif b/public/kindeditor/plugins/emoticons/images/79.gif new file mode 100644 index 0000000..61652a7 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/79.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/8.gif b/public/kindeditor/plugins/emoticons/images/8.gif new file mode 100644 index 0000000..f6c8834 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/8.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/80.gif b/public/kindeditor/plugins/emoticons/images/80.gif new file mode 100644 index 0000000..9a77936 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/80.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/81.gif b/public/kindeditor/plugins/emoticons/images/81.gif new file mode 100644 index 0000000..2329101 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/81.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/82.gif b/public/kindeditor/plugins/emoticons/images/82.gif new file mode 100644 index 0000000..644748a Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/82.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/83.gif b/public/kindeditor/plugins/emoticons/images/83.gif new file mode 100644 index 0000000..fbf275b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/83.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/84.gif b/public/kindeditor/plugins/emoticons/images/84.gif new file mode 100644 index 0000000..076f0c6 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/84.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/85.gif b/public/kindeditor/plugins/emoticons/images/85.gif new file mode 100644 index 0000000..d254af4 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/85.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/86.gif b/public/kindeditor/plugins/emoticons/images/86.gif new file mode 100644 index 0000000..8f09d33 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/86.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/87.gif b/public/kindeditor/plugins/emoticons/images/87.gif new file mode 100644 index 0000000..df70756 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/87.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/88.gif b/public/kindeditor/plugins/emoticons/images/88.gif new file mode 100644 index 0000000..4d8b15e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/88.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/89.gif b/public/kindeditor/plugins/emoticons/images/89.gif new file mode 100644 index 0000000..05726dc Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/89.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/9.gif b/public/kindeditor/plugins/emoticons/images/9.gif new file mode 100644 index 0000000..c2d8450 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/9.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/90.gif b/public/kindeditor/plugins/emoticons/images/90.gif new file mode 100644 index 0000000..adaf20e Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/90.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/91.gif b/public/kindeditor/plugins/emoticons/images/91.gif new file mode 100644 index 0000000..608d0ad Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/91.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/92.gif b/public/kindeditor/plugins/emoticons/images/92.gif new file mode 100644 index 0000000..b909e16 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/92.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/93.gif b/public/kindeditor/plugins/emoticons/images/93.gif new file mode 100644 index 0000000..7f71a8c Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/93.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/94.gif b/public/kindeditor/plugins/emoticons/images/94.gif new file mode 100644 index 0000000..4f26d7d Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/94.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/95.gif b/public/kindeditor/plugins/emoticons/images/95.gif new file mode 100644 index 0000000..5ef6d38 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/95.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/96.gif b/public/kindeditor/plugins/emoticons/images/96.gif new file mode 100644 index 0000000..2b709e1 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/96.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/97.gif b/public/kindeditor/plugins/emoticons/images/97.gif new file mode 100644 index 0000000..cf29be8 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/97.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/98.gif b/public/kindeditor/plugins/emoticons/images/98.gif new file mode 100644 index 0000000..c70e7d3 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/98.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/99.gif b/public/kindeditor/plugins/emoticons/images/99.gif new file mode 100644 index 0000000..05c1863 Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/99.gif differ diff --git a/public/kindeditor/plugins/emoticons/images/static.gif b/public/kindeditor/plugins/emoticons/images/static.gif new file mode 100644 index 0000000..b8c444b Binary files /dev/null and b/public/kindeditor/plugins/emoticons/images/static.gif differ diff --git a/public/kindeditor/plugins/filemanager/filemanager.js b/public/kindeditor/plugins/filemanager/filemanager.js new file mode 100644 index 0000000..fd899af --- /dev/null +++ b/public/kindeditor/plugins/filemanager/filemanager.js @@ -0,0 +1,189 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('filemanager', function(K) { + var self = this, name = 'filemanager', + fileManagerJson = K.undef(self.fileManagerJson, self.basePath + 'php/file_manager_json.php'), + imgPath = self.pluginsPath + name + '/images/', + lang = self.lang(name + '.'); + function makeFileTitle(filename, filesize, datetime) { + return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')'; + } + function bindTitle(el, data) { + if (data.is_dir) { + el.attr('title', data.filename); + } else { + el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime)); + } + } + self.plugin.filemanagerDialog = function(options) { + var width = K.undef(options.width, 650), + height = K.undef(options.height, 510), + dirName = K.undef(options.dirName, ''), + viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), // "LIST" or "VIEW" + clickFn = options.clickFn; + var html = [ + '
      ', + // header start + '
      ', + // left start + '
      ', + ' ', + '' + lang.moveup + '', + '
      ', + // right start + '
      ', + lang.viewType + ' ', + lang.orderType + ' ', + '
      ', + '
      ', + '
      ', + // body start + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : width, + height : height, + title : self.lang(name), + body : html + }), + div = dialog.div, + bodyDiv = K('.ke-plugin-filemanager-body', div), + moveupImg = K('[name="moveupImg"]', div), + moveupLink = K('[name="moveupLink"]', div), + viewServerBtn = K('[name="viewServer"]', div), + viewTypeBox = K('[name="viewType"]', div), + orderTypeBox = K('[name="orderType"]', div); + function reloadPage(path, order, func) { + var param = 'path=' + path + '&order=' + order + '&dir=' + dirName; + dialog.showLoading(self.lang('ajaxLoading')); + K.ajax(K.addParam(fileManagerJson, param + '&' + new Date().getTime()), function(data) { + dialog.hideLoading(); + func(data); + }); + } + var elList = []; + function bindEvent(el, result, data, createFunc) { + var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'), + dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/'); + if (data.is_dir) { + el.click(function(e) { + reloadPage(dirPath, orderTypeBox.val(), createFunc); + }); + } else if (data.is_photo) { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } else { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } + elList.push(el); + } + function createCommon(result, createFunc) { + // remove events + K.each(elList, function() { + this.unbind(); + }); + moveupLink.unbind(); + viewTypeBox.unbind(); + orderTypeBox.unbind(); + // add events + if (result.current_dir_path) { + moveupLink.click(function(e) { + reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc); + }); + } + function changeFunc() { + if (viewTypeBox.val() == 'VIEW') { + reloadPage(result.current_dir_path, orderTypeBox.val(), createView); + } else { + reloadPage(result.current_dir_path, orderTypeBox.val(), createList); + } + } + viewTypeBox.change(changeFunc); + orderTypeBox.change(changeFunc); + bodyDiv.html(''); + } + function createList(result) { + createCommon(result, createList); + var table = document.createElement('table'); + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + bodyDiv.append(table); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], row = K(table.insertRow(i)); + row.mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'), + img = K('' + data.filename + ''), + cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename)); + if (!data.is_dir || data.has_file) { + row.css('cursor', 'pointer'); + cell0.attr('title', data.filename); + bindEvent(cell0, result, data, createList); + } else { + cell0.attr('title', lang.emptyFolder); + } + K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB'); + K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime); + } + } + function createView(result) { + createCommon(result, createView); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], + div = K('
      '); + bodyDiv.append(div); + var photoDiv = K('
      ') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + div.append(photoDiv); + var fileUrl = result.current_url + data.filename, + iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif'); + var img = K('' + data.filename + ''); + if (!data.is_dir || data.has_file) { + photoDiv.css('cursor', 'pointer'); + bindTitle(photoDiv, data); + bindEvent(photoDiv, result, data, createView); + } else { + photoDiv.attr('title', lang.emptyFolder); + } + photoDiv.append(img); + div.append('
      ' + data.filename + '
      '); + } + } + viewTypeBox.val(viewType); + reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList); + return dialog; + } + +}); diff --git a/public/kindeditor/plugins/filemanager/images/file-16.gif b/public/kindeditor/plugins/filemanager/images/file-16.gif new file mode 100644 index 0000000..2cf6e47 Binary files /dev/null and b/public/kindeditor/plugins/filemanager/images/file-16.gif differ diff --git a/public/kindeditor/plugins/filemanager/images/file-64.gif b/public/kindeditor/plugins/filemanager/images/file-64.gif new file mode 100644 index 0000000..2e211da Binary files /dev/null and b/public/kindeditor/plugins/filemanager/images/file-64.gif differ diff --git a/public/kindeditor/plugins/filemanager/images/folder-16.gif b/public/kindeditor/plugins/filemanager/images/folder-16.gif new file mode 100644 index 0000000..850b5a3 Binary files /dev/null and b/public/kindeditor/plugins/filemanager/images/folder-16.gif differ diff --git a/public/kindeditor/plugins/filemanager/images/folder-64.gif b/public/kindeditor/plugins/filemanager/images/folder-64.gif new file mode 100644 index 0000000..e8a1b09 Binary files /dev/null and b/public/kindeditor/plugins/filemanager/images/folder-64.gif differ diff --git a/public/kindeditor/plugins/filemanager/images/go-up.gif b/public/kindeditor/plugins/filemanager/images/go-up.gif new file mode 100644 index 0000000..92ae23d Binary files /dev/null and b/public/kindeditor/plugins/filemanager/images/go-up.gif differ diff --git a/public/kindeditor/plugins/fixtoolbar/fixtoolbar.js b/public/kindeditor/plugins/fixtoolbar/fixtoolbar.js new file mode 100644 index 0000000..7a16fca --- /dev/null +++ b/public/kindeditor/plugins/fixtoolbar/fixtoolbar.js @@ -0,0 +1,35 @@ +/** + * Created by chenyihong on 14/12/4. + */ + +KindEditor.plugin('fixtoolbar', function (K) { + var self = this; + if (!self.fixToolBar) { + return; + } + + function init() { + var toolbar = K('.ke-toolbar'); + var originY = toolbar.pos().y; + K(window).bind('scroll', function () { + if (toolbar.css('position') == 'fixed') { + if(document.body.scrollTop - originY < 0){ + toolbar.css('position', 'static'); + toolbar.css('top', 'auto'); + } + } else { + if (toolbar.pos().y - document.body.scrollTop < 0) { + toolbar.css('position', 'fixed'); + toolbar.css('top', 0); + } + } + }); + } + + if (self.isCreated) { + init(); + } else { + self.afterCreate(init); + } + +}); diff --git a/public/kindeditor/plugins/flash/flash.js b/public/kindeditor/plugins/flash/flash.js new file mode 100644 index 0000000..d5d465e --- /dev/null +++ b/public/kindeditor/plugins/flash/flash.js @@ -0,0 +1,161 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('flash', function(K) { + var self = this, name = 'flash', lang = self.lang(name + '.'), + allowFlashUpload = K.undef(self.allowFlashUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.flash = { + edit : function() { + var html = [ + '
      ', + //url + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + //width + '
      ', + '', + ' ', + '
      ', + //height + '
      ', + '', + ' ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType('.swf'), + width : width, + height : height, + quality : 'high' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div); + urlBox.val('http://'); + + if (allowFlashUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + extraParams : extraParams, + url : K.addParam(uploadJson, 'dir=flash'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'flash', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + + var img = self.plugin.getSelectedFlash(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedFlash().remove(); + // [IE] 删除图片后立即点击图片按钮出错 + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.flash.edit); +}); diff --git a/public/kindeditor/plugins/image/image.js b/public/kindeditor/plugins/image/image.js new file mode 100644 index 0000000..69029ed --- /dev/null +++ b/public/kindeditor/plugins/image/image.js @@ -0,0 +1,328 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('image', function(K) { + var self = this, name = 'image', + allowImageUpload = K.undef(self.allowImageUpload, true), + allowImageRemote = K.undef(self.allowImageRemote, true), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imageTabIndex = K.undef(self.imageTabIndex, 0), + imgPath = self.pluginsPath + 'image/images/', + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + fillDescAfterUploadImage = K.undef(self.fillDescAfterUploadImage, false), + lang = self.lang(name + '.'); + + self.plugin.imageDialog = function(options) { + var imageUrl = options.imageUrl, + imageWidth = K.undef(options.imageWidth, ''), + imageHeight = K.undef(options.imageHeight, ''), + imageTitle = K.undef(options.imageTitle, ''), + imageAlign = K.undef(options.imageAlign, ''), + showRemote = K.undef(options.showRemote, true), + showLocal = K.undef(options.showLocal, true), + tabIndex = K.undef(options.tabIndex, 0), + clickFn = options.clickFn; + var target = 'kindeditor_upload_iframe_' + new Date().getTime(); + var hiddenElements = []; + for(var k in extraParams){ + hiddenElements.push(''); + } + var html = [ + '
      ', + //tabs + '
      ', + //remote image - start + '', + //remote image - end + //local upload - start + '', + //local upload - end + '
      ' + ].join(''); + var dialogWidth = showLocal || allowFileManager ? 450 : 400, + dialogHeight = showLocal && showRemote ? 300 : 250; + var dialog = self.createDialog({ + name : name, + width : dialogWidth, + height : dialogHeight, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + // Bugfix: http://code.google.com/p/kindeditor/issues/detail?id=319 + if (dialog.isLoading) { + return; + } + // insert local image + if (showLocal && showRemote && tabs && tabs.selectedIndex === 1 || !showRemote) { + if (uploadbutton.fileBox.val() == '') { + alert(self.lang('pleaseSelectFile')); + return; + } + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + localUrlBox.val(''); + return; + } + // insert remote image + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(), + title = titleBox.val(), + align = ''; + alignBox.each(function() { + if (this.checked) { + align = this.value; + return false; + } + }); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + clickFn.call(self, url, title, width, height, 0, align); + } + }, + beforeRemove : function() { + viewServerBtn.unbind(); + widthBox.unbind(); + heightBox.unbind(); + refreshBtn.unbind(); + } + }), + div = dialog.div; + + var urlBox = K('[name="url"]', div), + localUrlBox = K('[name="localUrl"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('.tab1 [name="width"]', div), + heightBox = K('.tab1 [name="height"]', div), + refreshBtn = K('.ke-refresh-btn', div), + titleBox = K('.tab1 [name="title"]', div), + alignBox = K('.tab1 [name="align"]', div); + + var tabs; + if (showRemote && showLocal) { + tabs = K.tabs({ + src : K('.tabs', div), + afterSelect : function(i) {} + }); + tabs.add({ + title : lang.remoteImage, + panel : K('.tab1', div) + }); + tabs.add({ + title : lang.localImage, + panel : K('.tab2', div) + }); + tabs.select(tabIndex); + } else if (showRemote) { + K('.tab1', div).show(); + } else if (showLocal) { + K('.tab2', div).show(); + } + + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + form : K('.ke-form', div), + target : target, + width: 60, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + if (!fillDescAfterUploadImage) { + clickFn.call(self, url, data.title, data.width, data.height, data.border, data.align); + } else { + K(".ke-dialog-row #remoteUrl", div).val(url); + K(".ke-tabs-li", div)[0].click(); + K(".ke-refresh-btn", div).click(); + } + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + localUrlBox.val(uploadbutton.fileBox.val()); + }); + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'VIEW', + dirName : 'image', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + var originalWidth = 0, originalHeight = 0; + function setSize(width, height) { + widthBox.val(width); + heightBox.val(height); + originalWidth = width; + originalHeight = height; + } + refreshBtn.click(function(e) { + var tempImg = K('', document).css({ + position : 'absolute', + visibility : 'hidden', + top : 0, + left : '-1000px' + }); + tempImg.bind('load', function() { + setSize(tempImg.width(), tempImg.height()); + tempImg.remove(); + }); + K(document.body).append(tempImg); + }); + widthBox.change(function(e) { + if (originalWidth > 0) { + heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10))); + } + }); + heightBox.change(function(e) { + if (originalHeight > 0) { + widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10))); + } + }); + urlBox.val(options.imageUrl); + setSize(options.imageWidth, options.imageHeight); + titleBox.val(options.imageTitle); + alignBox.each(function() { + if (this.value === options.imageAlign) { + this.checked = true; + return false; + } + }); + if (showRemote && tabIndex === 0) { + urlBox[0].focus(); + urlBox[0].select(); + } + return dialog; + }; + self.plugin.image = { + edit : function() { + var img = self.plugin.getSelectedImage(); + self.plugin.imageDialog({ + imageUrl : img ? img.attr('data-ke-src') : 'http://', + imageWidth : img ? img.width() : '', + imageHeight : img ? img.height() : '', + imageTitle : img ? img.attr('title') : '', + imageAlign : img ? img.attr('align') : '', + showRemote : allowImageRemote, + showLocal : allowImageUpload, + tabIndex: img ? 0 : imageTabIndex, + clickFn : function(url, title, width, height, border, align) { + if (img) { + img.attr('src', url); + img.attr('data-ke-src', url); + img.attr('width', width); + img.attr('height', height); + img.attr('title', title); + img.attr('align', align); + img.attr('alt', title); + } else { + self.exec('insertimage', url, title, width, height, border, align); + } + // Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }, + 'delete' : function() { + var target = self.plugin.getSelectedImage(); + if (target.parent().name == 'a') { + target = target.parent(); + } + target.remove(); + // [IE] 删除图片后立即点击图片按钮出错 + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.image.edit); +}); diff --git a/public/kindeditor/plugins/image/images/align_left.gif b/public/kindeditor/plugins/image/images/align_left.gif new file mode 100644 index 0000000..ab17f56 Binary files /dev/null and b/public/kindeditor/plugins/image/images/align_left.gif differ diff --git a/public/kindeditor/plugins/image/images/align_right.gif b/public/kindeditor/plugins/image/images/align_right.gif new file mode 100644 index 0000000..e8ebe6a Binary files /dev/null and b/public/kindeditor/plugins/image/images/align_right.gif differ diff --git a/public/kindeditor/plugins/image/images/align_top.gif b/public/kindeditor/plugins/image/images/align_top.gif new file mode 100644 index 0000000..d8826a5 Binary files /dev/null and b/public/kindeditor/plugins/image/images/align_top.gif differ diff --git a/public/kindeditor/plugins/image/images/refresh.png b/public/kindeditor/plugins/image/images/refresh.png new file mode 100644 index 0000000..77e12d1 Binary files /dev/null and b/public/kindeditor/plugins/image/images/refresh.png differ diff --git a/public/kindeditor/plugins/insertfile/insertfile.js b/public/kindeditor/plugins/insertfile/insertfile.js new file mode 100644 index 0000000..b8c523e --- /dev/null +++ b/public/kindeditor/plugins/insertfile/insertfile.js @@ -0,0 +1,138 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('insertfile', function(K) { + var self = this, name = 'insertfile', + allowFileUpload = K.undef(self.allowFileUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + lang = self.lang(name + '.'); + self.plugin.fileDialog = function(options) { + var fileUrl = K.undef(options.fileUrl, 'http://'), + fileTitle = K.undef(options.fileTitle, ''), + clickFn = options.clickFn; + var html = [ + '
      ', + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + //title + '
      ', + '', + '
      ', + '
      ', + //form end + '', + '' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + title = titleBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (K.trim(title) === '') { + title = url; + } + clickFn.call(self, url, title); + } + } + }), + div = dialog.div; + + var urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + titleBox = K('[name="title"]', div); + + if (allowFileUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + url : K.addParam(uploadJson, 'dir=file'), + extraParams : extraParams, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'file', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + urlBox.val(fileUrl); + titleBox.val(fileTitle); + urlBox[0].focus(); + urlBox[0].select(); + }; + self.clickToolbar(name, function() { + self.plugin.fileDialog({ + clickFn : function(url, title) { + var html = '' + title + ''; + self.insertHtml(html).hideDialog().focus(); + } + }); + }); +}); diff --git a/public/kindeditor/plugins/lineheight/lineheight.js b/public/kindeditor/plugins/lineheight/lineheight.js new file mode 100644 index 0000000..ae679d7 --- /dev/null +++ b/public/kindeditor/plugins/lineheight/lineheight.js @@ -0,0 +1,38 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('lineheight', function(K) { + var self = this, name = 'lineheight', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); + if (commonNode) { + curVal = commonNode.css('line-height'); + } + var menu = self.createMenu({ + name : name, + width : 150 + }); + K.each(lang.lineHeight, function(i, row) { + K.each(row, function(key, val) { + menu.addItem({ + title : val, + checked : curVal === key, + click : function() { + self.cmd.toggle('', { + span : '.line-height=' + key + }); + self.updateState(); + self.addBookmark(); + self.hideMenu(); + } + }); + }); + }); + }); +}); diff --git a/public/kindeditor/plugins/link/link.js b/public/kindeditor/plugins/link/link.js new file mode 100644 index 0000000..352fa3c --- /dev/null +++ b/public/kindeditor/plugins/link/link.js @@ -0,0 +1,66 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('link', function(K) { + var self = this, name = 'link'; + self.plugin.link = { + edit : function() { + var lang = self.lang(name + '.'), + html = '
      ' + + //url + '
      ' + + '' + + '
      ' + + //type + '
      ' + + '' + + '' + + '
      ' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + self.exec('createlink', url, typeBox.val()).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('input[name="url"]', div), + typeBox = K('select[name="type"]', div); + urlBox.val('http://'); + typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); + typeBox[0].options[1] = new Option(lang.selfWindow, ''); + self.cmd.selection(); + var a = self.plugin.getSelectedLink(); + if (a) { + self.cmd.range.selectNode(a[0]); + self.cmd.select(); + urlBox.val(a.attr('data-ke-src')); + typeBox.val(a.attr('target')); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.exec('unlink', null); + } + }; + self.clickToolbar(name, self.plugin.link.edit); +}); diff --git a/public/kindeditor/plugins/map/map.html b/public/kindeditor/plugins/map/map.html new file mode 100644 index 0000000..fb27555 --- /dev/null +++ b/public/kindeditor/plugins/map/map.html @@ -0,0 +1,57 @@ + + + + + + + + + +
      + + \ No newline at end of file diff --git a/public/kindeditor/plugins/map/map.js b/public/kindeditor/plugins/map/map.js new file mode 100644 index 0000000..5290875 --- /dev/null +++ b/public/kindeditor/plugins/map/map.js @@ -0,0 +1,137 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// Google Maps: http://code.google.com/apis/maps/index.html + +KindEditor.plugin('map', function(K) { + var self = this, name = 'map', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var html = ['
      ', + '
      ', + lang.address + ' ', + '', + '', + '', + '
      ', + '
      ', + '
      '].join(''); + var dialog = self.createDialog({ + name : name, + width : 600, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var geocoder = win.geocoder, + map = win.map, + center = map.getCenter().lat() + ',' + map.getCenter().lng(), + zoom = map.getZoom(), + maptype = map.getMapTypeId(), + url = 'http://maps.googleapis.com/maps/api/staticmap'; + url += '?center=' + encodeURIComponent(center); + url += '&zoom=' + encodeURIComponent(zoom); + url += '&size=558x360'; + url += '&maptype=' + encodeURIComponent(maptype); + url += '&markers=' + encodeURIComponent(center); + url += '&language=' + self.langType; + url += '&sensor=false'; + self.exec('insertimage', url).hideDialog().focus(); + } + }, + beforeRemove : function() { + searchBtn.remove(); + if (doc) { + doc.write(''); + } + iframe.remove(); + } + }); + var div = dialog.div, + addressBox = K('[name="address"]', div), + searchBtn = K('[name="searchBtn"]', div), + win, doc; + var iframeHtml = ['', + '', + '', + '', + '', + '', + '', + '
      ', + ''].join('\n'); + // TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式 + var iframe = K(''); + function ready() { + win = iframe[0].contentWindow; + doc = K.iframeDoc(iframe); + //doc.open(); + //doc.write(iframeHtml); + //doc.close(); + } + iframe.bind('load', function() { + iframe.unbind('load'); + if (K.IE) { + ready(); + } else { + setTimeout(ready, 0); + } + }); + K('.ke-map', div).replaceWith(iframe); + // search map + searchBtn.click(function() { + win.search(addressBox.val()); + }); + }); +}); diff --git a/public/kindeditor/plugins/media/media.js b/public/kindeditor/plugins/media/media.js new file mode 100644 index 0000000..5803466 --- /dev/null +++ b/public/kindeditor/plugins/media/media.js @@ -0,0 +1,170 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('media', function(K) { + var self = this, name = 'media', lang = self.lang(name + '.'), + allowMediaUpload = K.undef(self.allowMediaUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.media = { + edit : function() { + var html = [ + '
      ', + //url + '
      ', + '', + '  ', + '  ', + '', + '', + '', + '
      ', + //width + '
      ', + '', + '', + '
      ', + //height + '
      ', + '', + '', + '
      ', + //autostart + '
      ', + '', + ' ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 230, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType(url), + width : width, + height : height, + autostart : autostartBox[0].checked ? 'true' : 'false', + loop : 'true' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div), + autostartBox = K('[name="autostart"]', div); + urlBox.val('http://'); + + if (allowMediaUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + extraParams : extraParams, + url : K.addParam(uploadJson, 'dir=media'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'media', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + + var img = self.plugin.getSelectedMedia(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + autostartBox[0].checked = (attrs.autostart === 'true'); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedMedia().remove(); + // [IE] 删除图片后立即点击图片按钮出错 + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.media.edit); +}); diff --git a/public/kindeditor/plugins/multiimage/images/image.png b/public/kindeditor/plugins/multiimage/images/image.png new file mode 100644 index 0000000..fe79cf0 Binary files /dev/null and b/public/kindeditor/plugins/multiimage/images/image.png differ diff --git a/public/kindeditor/plugins/multiimage/images/select-files-en.png b/public/kindeditor/plugins/multiimage/images/select-files-en.png new file mode 100644 index 0000000..a926a6e Binary files /dev/null and b/public/kindeditor/plugins/multiimage/images/select-files-en.png differ diff --git a/public/kindeditor/plugins/multiimage/images/select-files-zh-CN.png b/public/kindeditor/plugins/multiimage/images/select-files-zh-CN.png new file mode 100644 index 0000000..5a31d36 Binary files /dev/null and b/public/kindeditor/plugins/multiimage/images/select-files-zh-CN.png differ diff --git a/public/kindeditor/plugins/multiimage/images/swfupload.swf b/public/kindeditor/plugins/multiimage/images/swfupload.swf new file mode 100644 index 0000000..e3f7670 Binary files /dev/null and b/public/kindeditor/plugins/multiimage/images/swfupload.swf differ diff --git a/public/kindeditor/plugins/multiimage/multiimage.js b/public/kindeditor/plugins/multiimage/multiimage.js new file mode 100644 index 0000000..bb629c8 --- /dev/null +++ b/public/kindeditor/plugins/multiimage/multiimage.js @@ -0,0 +1,1384 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + + +(function(K) { + +function KSWFUpload(options) { + this.init(options); +} +K.extend(KSWFUpload, { + init : function(options) { + var self = this; + options.afterError = options.afterError || function(str) { + alert(str); + }; + self.options = options; + self.progressbars = {}; + // template + self.div = K(options.container).html([ + '
      ', + '
      ', + '
      ', + '', + '
      ', + '
      ' + options.uploadDesc + '
      ', + '', + '', + '', + '
      ', + '
      ', + '
      ' + ].join('')); + self.bodyDiv = K('.ke-swfupload-body', self.div); + + function showError(itemDiv, msg) { + K('.ke-status > div', itemDiv).hide(); + K('.ke-message', itemDiv).addClass('ke-error').show().html(K.escape(msg)); + } + + var settings = { + debug : false, + upload_url : options.uploadUrl, + flash_url : options.flashUrl, + file_post_name : options.filePostName, + button_placeholder : K('.ke-swfupload-button > input', self.div)[0], + button_image_url: options.buttonImageUrl, + button_width: options.buttonWidth, + button_height: options.buttonHeight, + button_cursor : SWFUpload.CURSOR.HAND, + file_types : options.fileTypes, + file_types_description : options.fileTypesDesc, + file_upload_limit : options.fileUploadLimit, + file_size_limit : options.fileSizeLimit, + post_params : options.postParams, + file_queued_handler : function(file) { + file.url = self.options.fileIconUrl; + self.appendFile(file); + }, + file_queue_error_handler : function(file, errorCode, message) { + var errorName = ''; + switch (errorCode) { + case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: + errorName = options.queueLimitExceeded; + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + errorName = options.fileExceedsSizeLimit; + break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + errorName = options.zeroByteFile; + break; + case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: + errorName = options.invalidFiletype; + break; + default: + errorName = options.unknownError; + break; + } + K.DEBUG && alert(errorName); + }, + upload_start_handler : function(file) { + var self = this; + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv); + K('.ke-status > div', itemDiv).hide(); + K('.ke-progressbar', itemDiv).show(); + }, + upload_progress_handler : function(file, bytesLoaded, bytesTotal) { + var percent = Math.round(bytesLoaded * 100 / bytesTotal); + var progressbar = self.progressbars[file.id]; + progressbar.bar.css('width', Math.round(percent * 80 / 100) + 'px'); + progressbar.percent.html(percent + '%'); + }, + upload_error_handler : function(file, errorCode, message) { + if (file && file.filestatus == SWFUpload.FILE_STATUS.ERROR) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + showError(itemDiv, self.options.errorMessage); + } + }, + upload_success_handler : function(file, serverData) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + var data = {}; + try { + data = K.json(serverData); + } catch (e) { + self.options.afterError.call(this, '' + serverData + ''); + } + if (data.error !== 0) { + showError(itemDiv, K.DEBUG ? data.message : self.options.errorMessage); + return; + } + file.url = data.url; + K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus).data('data', data); + K('.ke-status > div', itemDiv).hide(); + } + }; + self.swfu = new SWFUpload(settings); + + K('.ke-swfupload-startupload input', self.div).click(function() { + self.swfu.startUpload(); + }); + }, + getUrlList : function() { + var list = []; + K('.ke-img', self.bodyDiv).each(function() { + var img = K(this); + var status = img.attr('data-status'); + if (status == SWFUpload.FILE_STATUS.COMPLETE) { + list.push(img.data('data')); + } + }); + return list; + }, + removeFile : function(fileId) { + var self = this; + self.swfu.cancelUpload(fileId); + var itemDiv = K('div[data-id="' + fileId + '"]', self.bodyDiv); + K('.ke-photo', itemDiv).unbind(); + K('.ke-delete', itemDiv).unbind(); + itemDiv.remove(); + }, + removeFiles : function() { + var self = this; + K('.ke-item', self.bodyDiv).each(function() { + self.removeFile(K(this).attr('data-id')); + }); + }, + appendFile : function(file) { + var self = this; + var itemDiv = K('
      '); + self.bodyDiv.append(itemDiv); + var photoDiv = K('
      ') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + itemDiv.append(photoDiv); + + var img = K('' + file.name + ''); + photoDiv.append(img); + K('').appendTo(photoDiv).click(function() { + self.removeFile(file.id); + }); + var statusDiv = K('
      ').appendTo(photoDiv); + // progressbar + K(['
      ', + '
      ', + '
      0%
      '].join('')).hide().appendTo(statusDiv); + // message + K('
      ' + self.options.pendingMessage + '
      ').appendTo(statusDiv); + + itemDiv.append('
      ' + file.name + '
      '); + + self.progressbars[file.id] = { + bar : K('.ke-progressbar-bar-inner', photoDiv), + percent : K('.ke-progressbar-percent', photoDiv) + }; + }, + remove : function() { + this.removeFiles(); + this.swfu.destroy(); + this.div.html(''); + } +}); + +K.swfupload = function(element, options) { + return new KSWFUpload(element, options); +}; + +})(KindEditor); + +KindEditor.plugin('multiimage', function(K) { + var self = this, name = 'multiimage', + formatUploadUrl = K.undef(self.formatUploadUrl, true), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imgPath = self.pluginsPath + 'multiimage/images/', + imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'), + imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'), + imageUploadLimit = K.undef(self.imageUploadLimit, 20), + filePostName = K.undef(self.filePostName, 'imgFile'), + lang = self.lang(name + '.'); + + self.plugin.multiImageDialog = function(options) { + var clickFn = options.clickFn, + uploadDesc = K.tmpl(lang.uploadDesc, {uploadLimit : imageUploadLimit, sizeLimit : imageSizeLimit}); + var html = [ + '
      ', + '
      ', + '
      ', + '
      ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 650, + height : 510, + title : self.lang(name), + body : html, + previewBtn : { + name : lang.insertAll, + click : function(e) { + clickFn.call(self, swfupload.getUrlList()); + } + }, + yesBtn : { + name : lang.clearAll, + click : function(e) { + swfupload.removeFiles(); + } + }, + beforeRemove : function() { + // IE9 bugfix: https://github.com/kindsoft/kindeditor/issues/72 + if (!K.IE || K.V <= 8) { + swfupload.remove(); + } + } + }), + div = dialog.div; + + var swfupload = K.swfupload({ + container : K('.swfupload', div), + buttonImageUrl : imgPath + (self.langType == 'zh-CN' ? 'select-files-zh-CN.png' : 'select-files-en.png'), + buttonWidth : self.langType == 'zh-CN' ? 72 : 88, + buttonHeight : 23, + fileIconUrl : imgPath + 'image.png', + uploadDesc : uploadDesc, + startButtonValue : lang.startUpload, + uploadUrl : K.addParam(uploadJson, 'dir=image'), + flashUrl : imgPath + 'swfupload.swf', + filePostName : filePostName, + fileTypes : '*.jpg;*.jpeg;*.gif;*.png;*.bmp', + fileTypesDesc : 'Image Files', + fileUploadLimit : imageUploadLimit, + fileSizeLimit : imageSizeLimit, + postParams : K.undef(self.extraFileUploadParams, {}), + queueLimitExceeded : lang.queueLimitExceeded, + fileExceedsSizeLimit : lang.fileExceedsSizeLimit, + zeroByteFile : lang.zeroByteFile, + invalidFiletype : lang.invalidFiletype, + unknownError : lang.unknownError, + pendingMessage : lang.pending, + errorMessage : lang.uploadError, + afterError : function(html) { + self.errorDialog(html); + } + }); + + return dialog; + }; + self.clickToolbar(name, function() { + self.plugin.multiImageDialog({ + clickFn : function (urlList) { + if (urlList.length === 0) { + return; + } + K.each(urlList, function(i, data) { + if (self.afterUpload) { + self.afterUpload.call(self, data.url, data, 'multiimage'); + } + self.exec('insertimage', data.url, data.title, data.width, data.height, data.border, data.align); + }); + // Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }); +}); + + +/** + * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com + * + * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ + * + * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz閚 and Mammon Media and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ + + +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ + +(function() { + +window.SWFUpload = function (settings) { + this.initSWFUpload(settings); +}; + +SWFUpload.prototype.initSWFUpload = function (settings) { + try { + this.customSettings = {}; // A container where developers can place their own settings associated with this instance. + this.settings = settings; + this.eventQueue = []; + this.movieName = "KindEditor_SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + + + // Setup global control tracking + SWFUpload.instances[this.movieName] = this; + + // Load the settings. Load the Flash movie. + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (ex) { + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; + +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; + +// Private: takes a URL, determines if it is relative and converts to an absolute URL +// using the current site. Only processes the URL if it can, otherwise returns the URL untouched +SWFUpload.completeURL = function(url) { + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { + return url; + } + + var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + + var indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + + return /*currentURL +*/ path + url; + +}; + + +/* ******************** */ +/* Instance Members */ +/* ******************** */ + +// Private: initSettings ensures that all the +// settings are set, getting a default value if one was not assigned. +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + + // Upload backend settings + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + + // File Settings + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + + // Flash Settings + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + + // Button Settings + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + + // Debug Settings + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API + + // Event Handlers + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + + this.ensureDefault("debug_handler", this.debugMessage); + + this.ensureDefault("custom_settings", {}); + + // Other settings + this.customSettings = this.settings.custom_settings; + + // Update the flash url if needed + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + + if (!this.settings.preserve_relative_urls) { + //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + + delete this.ensureDefault; +}; + +// Private: loadFlash replaces the button_placeholder element with the flash movie. +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent; + + // Make sure an element with the ID we are going to use doesn't already exist + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + + // Get the element where we will be placing the flash movie + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + + if (targetElement == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + + // Append the container and load the flash + tempParent = document.createElement("div"); + tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + + // Fix IE Flash/Form bug + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } + +}; + +// Private: getFlashHTML generates the object tag needed to embed the flash in to the document +SWFUpload.prototype.getFlashHTML = function () { + // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay + // Fix bug for IE9 + // http://www.kindsoft.net/view.php?bbsid=7&postid=5825&pagenum=1 + var classid = ''; + if (KindEditor.IE && KindEditor.V > 8) { + classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'; + } + return ['', + '', + '', + '', + '', + '', + '', + ''].join(""); +}; + +// Private: getFlashVars builds the parameter string that will be passed +// to flash in the flashvars param. +SWFUpload.prototype.getFlashVars = function () { + // Build a string from the post param object + var paramString = this.buildParamString(); + var httpSuccessString = this.settings.http_success.join(","); + + // Build the parameter string + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; + +// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload +// The element is cached after the first lookup +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + + return this.movieElement; +}; + +// Private: buildParamString takes the name/value pairs in the post_params setting object +// and joins them up in to a string formatted "name=value&name=value" +SWFUpload.prototype.buildParamString = function () { + var postParams = this.settings.post_params; + var paramStringPairs = []; + + if (typeof(postParams) === "object") { + for (var name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + + return paramStringPairs.join("&"); +}; + +// Public: Used to remove a SWFUpload instance from the page. This method strives to remove +// all references to the SWF, and other objects so memory is properly freed. +// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. +// Credits: Major improvements provided by steffen +SWFUpload.prototype.destroy = function () { + try { + // Make sure Flash is done before we try to remove it + this.cancelUpload(null, false); + + + // Remove the SWFUpload DOM nodes + var movieElement = null; + movieElement = this.getMovieElement(); + + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) + for (var i in movieElement) { + try { + if (typeof(movieElement[i]) === "function") { + movieElement[i] = null; + } + } catch (ex1) {} + } + + // Remove the Movie Element from the page + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + + // Remove IE form fix reference + window[this.movieName] = null; + + // Destroy other references + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + + + return true; + } catch (ex2) { + return false; + } +}; + + +// Public: displayDebugInfo prints out settings and configuration +// information about this SWFUpload instance. +// This function (and any references to it) can be deleted when placing +// SWFUpload in production. +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" + ].join("") + ); +}; + +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; + +// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + + return ""; +}; + + + +// Private: callFlash handles function calls made to the Flash element. +// Calls are made with a setTimeout for some functions to work around +// bugs in the ExternalInterface library. +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + + var movieElement = this.getMovieElement(); + var returnValue, returnString; + + // Flash's method if calling ExternalInterface methods (code adapted from MooTools). + try { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + + // Unescape file post param values + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + + return returnValue; +}; + +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFile causes a File Selection Dialog window to appear. This +// dialog only allows 1 file to be selected. +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFiles causes a File Selection Dialog window to appear/ This +// dialog allows the user to select any number of files +// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. +// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around +// for this bug. +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; + + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; + +// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. +// If you do not specify a fileID the current uploading file or first file in the queue is cancelled. +// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; + +// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. +// If nothing is currently uploading then nothing happens. +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; + +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ + +// Public: getStats gets the file statistics object. +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; + +// Public: setStats changes the SWFUpload statistics. You shouldn't need to +// change the statistics but you can. Changing the statistics does not +// affect SWFUpload accept for the successful_uploads count which is used +// by the upload_limit setting to determine how many files the user may upload. +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; + +// Public: getFile retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + +// Public: addFileParam sets a name/value pair that will be posted with the +// file specified by the Files ID. If the name already exists then the +// exiting value will be overwritten. +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; + +// Public: removeFileParam removes a previously set (by addFileParam) name/value +// pair from the specified file. +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; + +// Public: setUploadUrl changes the upload_url setting. +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; + +// Public: setPostParams changes the post_params setting +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; + +// Public: addPostParam adds post name/value pair. Each name can have only one value. +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: removePostParam deletes post name/value pair. +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: setFileTypes changes the file_types setting and the file_types_description setting +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; + +// Public: setFileSizeLimit changes the file_size_limit setting +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; + +// Public: setFileUploadLimit changes the file_upload_limit setting +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; + +// Public: setFileQueueLimit changes the file_queue_limit setting +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; + +// Public: setFilePostName changes the file_post_name setting +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; + +// Public: setUseQueryString changes the use_query_string setting +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; + +// Public: setRequeueOnError changes the requeue_on_error setting +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; + +// Public: setDebugEnabled changes the debug_enabled setting +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; + +// Public: setButtonImageURL loads a button image sprite +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; + +// Public: setButtonDimensions resizes the Flash Movie and button +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + + this.callFlash("SetButtonDimensions", [width, height]); +}; +// Public: setButtonText Changes the text overlaid on the button +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +// Public: setButtonTextPadding changes the top and left padding of the text overlay +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; + +// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +// Public: setButtonDisabled disables/enables the button +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +// Public: setButtonAction sets the action that occurs when the button is clicked +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; + +// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; + +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + + All these functions a Private. + + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ + +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + + var self = this; + if (typeof this.settings[handlerName] === "function") { + // Queue the event + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + + // Execute the next queued event + setTimeout(function () { + self.executeNextEvent(); + }, 0); + + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; + +// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout +// we must queue them in order to garentee that they are executed in order. +SWFUpload.prototype.executeNextEvent = function () { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; + +// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have +// properties that contain characters that are not valid for JavaScript identifiers. To work around this +// the Flash Component escapes the parameter names and we must unescape again before passing them along. +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i; + var unescapedPost = {}; + var uk; + + if (file != undefined) { + for (var k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + var match; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + + file.post = unescapedPost; + } + + return file; +}; + +// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (ex) { + return false; + } +}; + +// Private: This event is called by Flash when it has finished loading. Don't modify this. +// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. +SWFUpload.prototype.flashReady = function () { + // Check that the movie element is loaded correctly with its ExternalInterface methods defined + var movieElement = this.getMovieElement(); + + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + + this.cleanUp(movieElement); + + this.queueEvent("swfupload_loaded_handler"); +}; + +// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. +// This function is called by Flash each time the ExternalInterface functions are created. +SWFUpload.prototype.cleanUp = function (movieElement) { + // Pro-actively unhook all the Flash functions + try { + if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + + } + + // Fix Flashes own cleanup code so if the SWFMovie was removed from the page + // it doesn't display errors. + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + + } + }; + +}; + + +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; + + +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; + + +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; + +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; + +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; + +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + returnValue = !!returnValue; + + this.callFlash("ReturnUploadStart", [returnValue]); +}; + + + +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; + +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; + +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; + +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; + +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; + + +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + + The console is automatically scrolled as messages appear. + + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ + +// Private: debugMessage is the default debug_handler. If you want to print debug messages +// call the debug() function. When overriding the function your own function should +// check to see if the debug setting is true before outputting debug information. +SWFUpload.prototype.debugMessage = function (message) { + if (this.settings.debug) { + var exceptionMessage, exceptionValues = []; + + // Check for an exception object and print it nicely + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (var key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; + +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + + try { + console = document.getElementById("SWFUpload_Console"); + + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + + console.value += message + "\n"; + + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; + +})(); + +(function() { +/* + Queue Plug-in + + Features: + *Adds a cancelQueue() method for cancelling the entire queue. + *All queued files are uploaded when startUpload() is called. + *If false is returned from uploadComplete then the queue upload is stopped. + If false is not returned (strict comparison) then the queue upload is continued. + *Adds a QueueComplete event that is fired when all the queued files have finished uploading. + Set the event handler with the queue_complete_handler setting. + + */ + +if (typeof(SWFUpload) === "function") { + SWFUpload.queue = {}; + + SWFUpload.prototype.initSettings = (function (oldInitSettings) { + return function () { + if (typeof(oldInitSettings) === "function") { + oldInitSettings.call(this); + } + + this.queueSettings = {}; + + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + + this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler; + this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler; + this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler; + this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler; + + this.settings.queue_complete_handler = this.settings.queue_complete_handler || null; + }; + })(SWFUpload.prototype.initSettings); + + SWFUpload.prototype.startUpload = function (fileID) { + this.queueSettings.queue_cancelled_flag = false; + this.callFlash("StartUpload", [fileID]); + }; + + SWFUpload.prototype.cancelQueue = function () { + this.queueSettings.queue_cancelled_flag = true; + this.stopUpload(); + + var stats = this.getStats(); + while (stats.files_queued > 0) { + this.cancelUpload(); + stats = this.getStats(); + } + }; + + SWFUpload.queue.uploadStartHandler = function (file) { + var returnValue; + if (typeof(this.queueSettings.user_upload_start_handler) === "function") { + returnValue = this.queueSettings.user_upload_start_handler.call(this, file); + } + + // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value. + returnValue = (returnValue === false) ? false : true; + + this.queueSettings.queue_cancelled_flag = !returnValue; + + return returnValue; + }; + + SWFUpload.queue.uploadCompleteHandler = function (file) { + var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; + var continueUpload; + + if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { + this.queueSettings.queue_upload_count++; + } + + if (typeof(user_upload_complete_handler) === "function") { + continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; + } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { + // If the file was stopped and re-queued don't restart the upload + continueUpload = false; + } else { + continueUpload = true; + } + + if (continueUpload) { + var stats = this.getStats(); + if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { + this.startUpload(); + } else if (this.queueSettings.queue_cancelled_flag === false) { + this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); + this.queueSettings.queue_upload_count = 0; + } else { + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + } + } + }; +} + +})(); diff --git a/public/kindeditor/plugins/pagebreak/pagebreak.js b/public/kindeditor/plugins/pagebreak/pagebreak.js new file mode 100644 index 0000000..dfa883a --- /dev/null +++ b/public/kindeditor/plugins/pagebreak/pagebreak.js @@ -0,0 +1,27 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('pagebreak', function(K) { + var self = this; + var name = 'pagebreak'; + var pagebreakHtml = K.undef(self.pagebreakHtml, '
      '); + + self.clickToolbar(name, function() { + var cmd = self.cmd, range = cmd.range; + self.focus(); + var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : ''; + self.insertHtml(pagebreakHtml + tail); + if (tail !== '') { + var p = K('#__kindeditor_tail_tag__', self.edit.doc); + range.selectNodeContents(p[0]); + p.removeAttr('id'); + cmd.select(); + } + }); +}); diff --git a/public/kindeditor/plugins/plainpaste/plainpaste.js b/public/kindeditor/plugins/plainpaste/plainpaste.js new file mode 100644 index 0000000..8f7bed8 --- /dev/null +++ b/public/kindeditor/plugins/plainpaste/plainpaste.js @@ -0,0 +1,41 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('plainpaste', function(K) { + var self = this, name = 'plainpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
      ' + + '
      ' + lang.comment + '
      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var html = textarea.val(); + html = K.escape(html); + html = html.replace(/ {2}/g, '  '); + if (self.newlineTag == 'p') { + html = html.replace(/^/, '

      ').replace(/$/, '

      ').replace(/\n/g, '

      '); + } else { + html = html.replace(/\n/g, '
      $&'); + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); diff --git a/public/kindeditor/plugins/preview/preview.js b/public/kindeditor/plugins/preview/preview.js new file mode 100644 index 0000000..ef6e2cf --- /dev/null +++ b/public/kindeditor/plugins/preview/preview.js @@ -0,0 +1,31 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('preview', function(K) { + var self = this, name = 'preview', undefined; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '

      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 750, + title : self.lang(name), + body : html + }), + iframe = K('iframe', dialog.div), + doc = K.iframeDoc(iframe); + doc.open(); + doc.write(self.fullHtml()); + doc.close(); + K(doc.body).css('background-color', '#FFF'); + iframe[0].contentWindow.focus(); + }); +}); diff --git a/public/kindeditor/plugins/quickformat/quickformat.js b/public/kindeditor/plugins/quickformat/quickformat.js new file mode 100644 index 0000000..5b98c72 --- /dev/null +++ b/public/kindeditor/plugins/quickformat/quickformat.js @@ -0,0 +1,81 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('quickformat', function(K) { + var self = this, name = 'quickformat', + blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p'); + function getFirstChild(knode) { + var child = knode.first(); + while (child && child.first()) { + child = child.first(); + } + return child; + } + self.clickToolbar(name, function() { + self.focus(); + var doc = self.edit.doc, + range = self.cmd.range, + child = K(doc.body).first(), next, + nodeList = [], subList = [], + bookmark = range.createBookmark(true); + while(child) { + next = child.next(); + var firstChild = getFirstChild(child); + if (!firstChild || firstChild.name != 'img') { + if (blockMap[child.name]) { + child.html(child.html().replace(/^(\s| | )+/ig, '')); + child.css('text-indent', '2em'); + } else { + subList.push(child); + } + if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) { + if (subList.length > 0) { + nodeList.push(subList); + } + subList = []; + } + } + child = next; + } + K.each(nodeList, function(i, subList) { + var wrapper = K('

      ', doc); + subList[0].before(wrapper); + K.each(subList, function(i, knode) { + wrapper.append(knode); + }); + }); + range.moveToBookmark(bookmark); + self.addBookmark(); + }); +}); + +/** +-------------------------- +abcd
      +1234
      + +to + +

      + abcd
      + 1234
      +

      + +-------------------------- + +  abcd1233 +

      1234

      + +to + +

      abcd1233

      +

      1234

      + +-------------------------- +*/ \ No newline at end of file diff --git a/public/kindeditor/plugins/table/table.js b/public/kindeditor/plugins/table/table.js new file mode 100644 index 0000000..4033b6a --- /dev/null +++ b/public/kindeditor/plugins/table/table.js @@ -0,0 +1,712 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('table', function(K) { + var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; + // 设置颜色 + function _setColor(box, color) { + color = color.toUpperCase(); + box.css('background-color', color); + box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); + box.html(color); + } + // 初始化取色器 + var pickerList = []; + function _initColorPicker(dialogDiv, colorBox) { + colorBox.bind('click,mousedown', function(e){ + e.stopPropagation(); + }); + function removePicker() { + K.each(pickerList, function() { + this.remove(); + }); + pickerList = []; + K(document).unbind('click,mousedown', removePicker); + dialogDiv.unbind('click,mousedown', removePicker); + } + colorBox.click(function(e) { + removePicker(); + var box = K(this), + pos = box.pos(); + var picker = K.colorpicker({ + x : pos.x, + y : pos.y + box.height(), + z : 811214, + selectedColor : K(this).html(), + colors : self.colorTable, + noColor : self.lang('noColor'), + shadowMode : self.shadowMode, + click : function(color) { + _setColor(box, color); + removePicker(); + } + }); + pickerList.push(picker); + K(document).bind('click,mousedown', removePicker); + dialogDiv.bind('click,mousedown', removePicker); + }); + } + // 取得下一行cell的index + function _getCellIndex(table, row, cell) { + var rowSpanCount = 0; + for (var i = 0, len = row.cells.length; i < len; i++) { + if (row.cells[i] == cell) { + break; + } + rowSpanCount += row.cells[i].rowSpan - 1; + } + return cell.cellIndex - rowSpanCount; + } + self.plugin.table = { + //insert or modify table + prop : function(isInsert) { + var html = [ + '
      ', + //rows, cols + '
      ', + '', + lang.rows + '   ', + lang.cols + ' ', + '
      ', + //width, height + '
      ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
      ', + //space, padding + '
      ', + '', + lang.padding + '   ', + lang.spacing + ' ', + '
      ', + //align + '
      ', + '', + '', + '
      ', + //border + '
      ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
      ', + //background color + '
      ', + '', + '', + '
      ', + '
      ' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var rows = rowsBox.val(), + cols = colsBox.val(), + width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + align = alignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (rows == 0 || !/^\d+$/.test(rows)) { + alert(self.lang('invalidRows')); + rowsBox[0].focus(); + return; + } + if (cols == 0 || !/^\d+$/.test(cols)) { + alert(self.lang('invalidRows')); + colsBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(padding)) { + alert(self.lang('invalidPadding')); + paddingBox[0].focus(); + return; + } + if (!/^\d*$/.test(spacing)) { + alert(self.lang('invalidSpacing')); + spacingBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + //modify table + if (table) { + if (width !== '') { + table.width(width + widthType); + } else { + table.css('width', ''); + } + if (table[0].width !== undefined) { + table.removeAttr('width'); + } + if (height !== '') { + table.height(height + heightType); + } else { + table.css('height', ''); + } + if (table[0].height !== undefined) { + table.removeAttr('height'); + } + table.css('background-color', bgColor); + if (table[0].bgColor !== undefined) { + table.removeAttr('bgColor'); + } + if (padding !== '') { + table[0].cellPadding = padding; + } else { + table.removeAttr('cellPadding'); + } + if (spacing !== '') { + table[0].cellSpacing = spacing; + } else { + table.removeAttr('cellSpacing'); + } + if (align !== '') { + table[0].align = align; + } else { + table.removeAttr('align'); + } + if (border !== '') { + table.attr('border', border); + } else { + table.removeAttr('border'); + } + if (border === '' || border === '0') { + table.addClass(zeroborder); + } else { + table.removeClass(zeroborder); + } + if (borderColor !== '') { + table.attr('borderColor', borderColor); + } else { + table.removeAttr('borderColor'); + } + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + return; + } + //insert new table + var style = ''; + if (width !== '') { + style += 'width:' + width + widthType + ';'; + } + if (height !== '') { + style += 'height:' + height + heightType + ';'; + } + if (bgColor !== '') { + style += 'background-color:' + bgColor + ';'; + } + var html = '') + ''; + } + html += ''; + } + html += ''; + if (!K.IE) { + html += '
      '; + } + self.insertHtml(html); + self.select().hideDialog().focus(); + self.addBookmark(); + } + } + }), + div = dialog.div, + rowsBox = K('[name="rows"]', div).val(3), + colsBox = K('[name="cols"]', div).val(2), + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + alignBox = K('[name="align"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + rowsBox[0].focus(); + rowsBox[0].select(); + var table; + if (isInsert) { + return; + } + //get selected table node + table = self.plugin.getSelectedTable(); + if (table) { + rowsBox.val(table[0].rows.length); + colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); + rowsBox.attr('disabled', true); + colsBox.attr('disabled', true); + var match, + tableWidth = table[0].style.width || table[0].width, + tableHeight = table[0].style.height || table[0].height; + if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + paddingBox.val(table[0].cellPadding || ''); + spacingBox.val(table[0].cellSpacing || ''); + alignBox.val(table[0].align || ''); + borderBox.val(table[0].border === undefined ? '' : table[0].border); + _setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || '')); + _setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + } + }, + //modify cell + cellprop : function() { + var html = [ + '
      ', + //width, height + '
      ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
      ', + //align + '
      ', + '', + lang.textAlign + ' ', + lang.verticalAlign + ' ', + '
      ', + //border + '
      ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
      ', + //background color + '
      ', + '', + '', + '
      ', + '
      ' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang('tablecell'), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + textAlign = textAlignBox.val(), + verticalAlign = verticalAlignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + cell.css({ + width : width !== '' ? (width + widthType) : '', + height : height !== '' ? (height + heightType) : '', + 'background-color' : bgColor, + 'text-align' : textAlign, + 'vertical-align' : verticalAlign, + 'border-width' : border, + 'border-style' : border !== '' ? 'solid' : '', + 'border-color' : borderColor + }); + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + } + } + }), + div = dialog.div, + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + textAlignBox = K('[name="textAlign"]', div), + verticalAlignBox = K('[name="verticalAlign"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + widthBox[0].focus(); + widthBox[0].select(); + // get selected cell + var cell = self.plugin.getSelectedCell(); + var match, + cellWidth = cell[0].style.width || cell[0].width || '', + cellHeight = cell[0].style.height || cell[0].height || ''; + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + textAlignBox.val(cell[0].style.textAlign || ''); + verticalAlignBox.val(cell[0].style.verticalAlign || ''); + var border = cell[0].style.borderWidth || ''; + if (border) { + border = parseInt(border); + } + borderBox.val(border); + _setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || '')); + _setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + }, + insert : function() { + this.prop(true); + }, + 'delete' : function() { + var table = self.plugin.getSelectedTable(); + self.cmd.range.setStartBefore(table[0]).collapse(true); + self.cmd.select(); + table.remove(); + self.addBookmark(); + }, + colinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex + offset; + // 取得第一行的index + index += table.rows[0].cells.length - row.cells.length; + + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.insertCell(index); + newCell.innerHTML = K.IE ? '' : '
      '; + // 调整下一行的单元格index + index = _getCellIndex(table, newRow, newCell); + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colinsertleft : function() { + this.colinsert(0); + }, + colinsertright : function() { + this.colinsert(1); + }, + rowinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0]; + var rowIndex = row.rowIndex; + if (offset === 1) { + rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset; + } + var newRow = table.insertRow(rowIndex); + + for (var i = 0, len = row.cells.length; i < len; i++) { + // 调整cell个数 + if (row.cells[i].rowSpan > 1) { + len -= row.cells[i].rowSpan - 1; + } + var newCell = newRow.insertCell(i); + // copy colspan + if (offset === 1 && row.cells[i].colSpan > 1) { + newCell.colSpan = row.cells[i].colSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + } + // 调整rowspan + for (var j = rowIndex; j >= 0; j--) { + var cells = table.rows[j].cells; + if (cells.length > i) { + for (var k = cell.cellIndex; k >= 0; k--) { + if (cells[k].rowSpan > 1) { + cells[k].rowSpan += 1; + } + } + break; + } + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowinsertabove : function() { + this.rowinsert(0); + }, + rowinsertbelow : function() { + this.rowinsert(1); + }, + rowmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index + nextRow = table.rows[nextRowIndex]; // 下一行 + // 最后一行不能合并 + if (table.rows.length <= nextRowIndex) { + return; + } + var cellIndex = cell.cellIndex; // 下一行单元格的index + if (nextRow.cells.length <= cellIndex) { + return; + } + var nextCell = nextRow.cells[cellIndex]; // 下一行单元格 + // 上下行的colspan不一致时不能合并 + if (cell.colSpan !== nextCell.colSpan) { + return; + } + cell.rowSpan += nextCell.rowSpan; + nextRow.deleteCell(cellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + cellIndex = cell.cellIndex, + nextCellIndex = cellIndex + 1; + // 最后一列不能合并 + if (row.cells.length <= nextCellIndex) { + return; + } + var nextCell = row.cells[nextCellIndex]; + // 左右列的rowspan不一致时不能合并 + if (cell.rowSpan !== nextCell.rowSpan) { + return; + } + cell.colSpan += nextCell.colSpan; + row.deleteCell(nextCellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 不是可分割单元格 + if (cell.rowSpan === 1) { + return; + } + var cellIndex = _getCellIndex(table, row, cell); + for (var i = 1, len = cell.rowSpan; i < len; i++) { + var newRow = table.rows[rowIndex + i], + newCell = newRow.insertCell(cellIndex); + if (cell.colSpan > 1) { + newCell.colSpan = cell.colSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + // 调整下一行的单元格index + cellIndex = _getCellIndex(table, newRow, newCell); + } + K(cell).removeAttr('rowSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + cellIndex = cell.cellIndex; + // 不是可分割单元格 + if (cell.colSpan === 1) { + return; + } + for (var i = 1, len = cell.colSpan; i < len; i++) { + var newCell = row.insertCell(cellIndex + i); + if (cell.rowSpan > 1) { + newCell.rowSpan = cell.rowSpan; + } + newCell.innerHTML = K.IE ? '' : '
      '; + } + K(cell).removeAttr('colSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + coldelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.cells[index]; + if (newCell.colSpan > 1) { + newCell.colSpan -= 1; + if (newCell.colSpan === 1) { + K(newCell).removeAttr('colSpan'); + } + } else { + newRow.deleteCell(index); + } + // 跳过不需要删除的行 + if (newCell.rowSpan > 1) { + i += newCell.rowSpan - 1; + } + } + if (row.cells.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + }, + rowdelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 从下到上删除 + for (var i = cell.rowSpan - 1; i >= 0; i--) { + table.deleteRow(rowIndex + i); + } + if (table.rows.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.table.prop); +}); diff --git a/public/kindeditor/plugins/template/html/1.html b/public/kindeditor/plugins/template/html/1.html new file mode 100644 index 0000000..034126b --- /dev/null +++ b/public/kindeditor/plugins/template/html/1.html @@ -0,0 +1,14 @@ + + + + + + +

      + 在此处输入标题 +

      +

      + 在此处输入内容 +

      + + \ No newline at end of file diff --git a/public/kindeditor/plugins/template/html/2.html b/public/kindeditor/plugins/template/html/2.html new file mode 100644 index 0000000..dc2584a --- /dev/null +++ b/public/kindeditor/plugins/template/html/2.html @@ -0,0 +1,42 @@ + + + + + + +

      + 标题 +

      + + + + + + + + + + + + + + + +
      +

      标题1

      +
      +

      标题1

      +
      + 内容1 + + 内容2 +
      + 内容3 + + 内容4 +
      +

      + 表格说明 +

      + + \ No newline at end of file diff --git a/public/kindeditor/plugins/template/html/3.html b/public/kindeditor/plugins/template/html/3.html new file mode 100644 index 0000000..873f0c6 --- /dev/null +++ b/public/kindeditor/plugins/template/html/3.html @@ -0,0 +1,36 @@ + + + + + + +

      + 在此处输入内容 +

      +
        +
      1. + 描述1 +
      2. +
      3. + 描述2 +
      4. +
      5. + 描述3 +
      6. +
      +

      + 在此处输入内容 +

      +
        +
      • + 描述1 +
      • +
      • + 描述2 +
      • +
      • + 描述3 +
      • +
      + + \ No newline at end of file diff --git a/public/kindeditor/plugins/template/template.js b/public/kindeditor/plugins/template/template.js new file mode 100644 index 0000000..4029e87 --- /dev/null +++ b/public/kindeditor/plugins/template/template.js @@ -0,0 +1,58 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('template', function(K) { + var self = this, name = 'template', lang = self.lang(name + '.'), + htmlPath = self.pluginsPath + name + '/html/'; + function getFilePath(fileName) { + return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); + } + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + arr = ['
      ', + '
      ', + // left start + '
      ', + lang. selectTemplate + '
      ', + // right start + '
      ', + ' ', + '
      ', + '
      ', + '
      ', + '', + '
      '].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var doc = K.iframeDoc(iframe); + self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); + } + } + }); + var selectBox = K('select', dialog.div), + checkbox = K('[name="replaceFlag"]', dialog.div), + iframe = K('iframe', dialog.div); + checkbox[0].checked = true; + iframe.attr('src', getFilePath(selectBox.val())); + selectBox.change(function() { + iframe.attr('src', getFilePath(this.value)); + }); + }); +}); diff --git a/public/kindeditor/plugins/wordpaste/wordpaste.js b/public/kindeditor/plugins/wordpaste/wordpaste.js new file mode 100644 index 0000000..22061e1 --- /dev/null +++ b/public/kindeditor/plugins/wordpaste/wordpaste.js @@ -0,0 +1,51 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('wordpaste', function(K) { + var self = this, name = 'wordpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
      ' + + '
      ' + lang.comment + '
      ' + + '' + + '
      ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var str = doc.body.innerHTML; + str = K.clearMsWord(str, self.filterMode ? self.htmlTags : K.options.htmlTags); + self.insertHtml(str).hideDialog().focus(); + } + } + }), + div = dialog.div, + iframe = K('iframe', div), + doc = K.iframeDoc(iframe); + if (!K.IE) { + doc.designMode = 'on'; + } + doc.open(); + doc.write('WordPaste'); + doc.write(''); + if (!K.IE) { + doc.write('
      '); + } + doc.write(''); + doc.close(); + if (K.IE) { + doc.body.contentEditable = 'true'; + } + iframe[0].contentWindow.focus(); + }); +}); diff --git a/public/kindeditor/themes/common/anchor.gif b/public/kindeditor/themes/common/anchor.gif new file mode 100644 index 0000000..61145ea Binary files /dev/null and b/public/kindeditor/themes/common/anchor.gif differ diff --git a/public/kindeditor/themes/common/blank.gif b/public/kindeditor/themes/common/blank.gif new file mode 100644 index 0000000..5bfd67a Binary files /dev/null and b/public/kindeditor/themes/common/blank.gif differ diff --git a/public/kindeditor/themes/common/flash.gif b/public/kindeditor/themes/common/flash.gif new file mode 100644 index 0000000..2cb12b2 Binary files /dev/null and b/public/kindeditor/themes/common/flash.gif differ diff --git a/public/kindeditor/themes/common/loading.gif b/public/kindeditor/themes/common/loading.gif new file mode 100644 index 0000000..c69e937 Binary files /dev/null and b/public/kindeditor/themes/common/loading.gif differ diff --git a/public/kindeditor/themes/common/media.gif b/public/kindeditor/themes/common/media.gif new file mode 100644 index 0000000..e1c0e30 Binary files /dev/null and b/public/kindeditor/themes/common/media.gif differ diff --git a/public/kindeditor/themes/common/rm.gif b/public/kindeditor/themes/common/rm.gif new file mode 100644 index 0000000..d013d55 Binary files /dev/null and b/public/kindeditor/themes/common/rm.gif differ diff --git a/public/kindeditor/themes/default/background.png b/public/kindeditor/themes/default/background.png new file mode 100644 index 0000000..e59bd68 Binary files /dev/null and b/public/kindeditor/themes/default/background.png differ diff --git a/public/kindeditor/themes/default/default.css b/public/kindeditor/themes/default/default.css new file mode 100644 index 0000000..3f72660 --- /dev/null +++ b/public/kindeditor/themes/default/default.css @@ -0,0 +1,1147 @@ +/* common */ +.ke-inline-block { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-clearfix { + zoom: 1; +} +.ke-clearfix:after { + content: "."; + display: block; + clear: both; + font-size: 0; + height: 0; + line-height: 0; + visibility: hidden; +} +.ke-shadow { + box-shadow: 1px 1px 3px #A0A0A0; + -moz-box-shadow: 1px 1px 3px #A0A0A0; + -webkit-box-shadow: 1px 1px 3px #A0A0A0; + filter: progid:DXImageTransform.Microsoft.Shadow(color='#A0A0A0', Direction=135, Strength=3); + background-color: #F0F0EE; +} +.ke-menu a, +.ke-menu a:hover, +.ke-dialog a, +.ke-dialog a:hover { + color: #337FE5; + text-decoration: none; +} +/* icons */ +.ke-icon-source { + background-position: 0px 0px; + width: 16px; + height: 16px; +} +.ke-icon-preview { + background-position: 0px -16px; + width: 16px; + height: 16px; +} +.ke-icon-print { + background-position: 0px -32px; + width: 16px; + height: 16px; +} +.ke-icon-undo { + background-position: 0px -48px; + width: 16px; + height: 16px; +} +.ke-icon-redo { + background-position: 0px -64px; + width: 16px; + height: 16px; +} +.ke-icon-cut { + background-position: 0px -80px; + width: 16px; + height: 16px; +} +.ke-icon-copy { + background-position: 0px -96px; + width: 16px; + height: 16px; +} +.ke-icon-paste { + background-position: 0px -112px; + width: 16px; + height: 16px; +} +.ke-icon-selectall { + background-position: 0px -128px; + width: 16px; + height: 16px; +} +.ke-icon-justifyleft { + background-position: 0px -144px; + width: 16px; + height: 16px; +} +.ke-icon-justifycenter { + background-position: 0px -160px; + width: 16px; + height: 16px; +} +.ke-icon-justifyright { + background-position: 0px -176px; + width: 16px; + height: 16px; +} +.ke-icon-justifyfull { + background-position: 0px -192px; + width: 16px; + height: 16px; +} +.ke-icon-insertorderedlist { + background-position: 0px -208px; + width: 16px; + height: 16px; +} +.ke-icon-insertunorderedlist { + background-position: 0px -224px; + width: 16px; + height: 16px; +} +.ke-icon-indent { + background-position: 0px -240px; + width: 16px; + height: 16px; +} +.ke-icon-outdent { + background-position: 0px -256px; + width: 16px; + height: 16px; +} +.ke-icon-subscript { + background-position: 0px -272px; + width: 16px; + height: 16px; +} +.ke-icon-superscript { + background-position: 0px -288px; + width: 16px; + height: 16px; +} +.ke-icon-date { + background-position: 0px -304px; + width: 25px; + height: 16px; +} +.ke-icon-time { + background-position: 0px -320px; + width: 25px; + height: 16px; +} +.ke-icon-formatblock { + background-position: 0px -336px; + width: 25px; + height: 16px; +} +.ke-icon-fontname { + background-position: 0px -352px; + width: 21px; + height: 16px; +} +.ke-icon-fontsize { + background-position: 0px -368px; + width: 23px; + height: 16px; +} +.ke-icon-forecolor { + background-position: 0px -384px; + width: 20px; + height: 16px; +} +.ke-icon-hilitecolor { + background-position: 0px -400px; + width: 23px; + height: 16px; +} +.ke-icon-bold { + background-position: 0px -416px; + width: 16px; + height: 16px; +} +.ke-icon-italic { + background-position: 0px -432px; + width: 16px; + height: 16px; +} +.ke-icon-underline { + background-position: 0px -448px; + width: 16px; + height: 16px; +} +.ke-icon-strikethrough { + background-position: 0px -464px; + width: 16px; + height: 16px; +} +.ke-icon-removeformat { + background-position: 0px -480px; + width: 16px; + height: 16px; +} +.ke-icon-image { + background-position: 0px -496px; + width: 16px; + height: 16px; +} +.ke-icon-flash { + background-position: 0px -512px; + width: 16px; + height: 16px; +} +.ke-icon-media { + background-position: 0px -528px; + width: 16px; + height: 16px; +} +.ke-icon-div { + background-position: 0px -544px; + width: 16px; + height: 16px; +} +.ke-icon-formula { + background-position: 0px -576px; + width: 16px; + height: 16px; +} +.ke-icon-hr { + background-position: 0px -592px; + width: 16px; + height: 16px; +} +.ke-icon-emoticons { + background-position: 0px -608px; + width: 16px; + height: 16px; +} +.ke-icon-link { + background-position: 0px -624px; + width: 16px; + height: 16px; +} +.ke-icon-unlink { + background-position: 0px -640px; + width: 16px; + height: 16px; +} +.ke-icon-fullscreen { + background-position: 0px -656px; + width: 16px; + height: 16px; +} +.ke-icon-about { + background-position: 0px -672px; + width: 16px; + height: 16px; +} +.ke-icon-plainpaste { + background-position: 0px -704px; + width: 16px; + height: 16px; +} +.ke-icon-wordpaste { + background-position: 0px -720px; + width: 16px; + height: 16px; +} +.ke-icon-table { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tablemenu { + background-position: 0px -768px; + width: 16px; + height: 16px; +} +.ke-icon-tableinsert { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tabledelete { + background-position: 0px -800px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertleft { + background-position: 0px -816px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertright { + background-position: 0px -832px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertabove { + background-position: 0px -848px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertbelow { + background-position: 0px -864px; + width: 16px; + height: 16px; +} +.ke-icon-tablecoldelete { + background-position: 0px -880px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowdelete { + background-position: 0px -896px; + width: 16px; + height: 16px; +} +.ke-icon-tablecellprop { + background-position: 0px -912px; + width: 16px; + height: 16px; +} +.ke-icon-tableprop { + background-position: 0px -928px; + width: 16px; + height: 16px; +} +.ke-icon-checked { + background-position: 0px -944px; + width: 16px; + height: 16px; +} +.ke-icon-code { + background-position: 0px -960px; + width: 16px; + height: 16px; +} +.ke-icon-map { + background-position: 0px -976px; + width: 16px; + height: 16px; +} +.ke-icon-baidumap { + background-position: 0px -976px; + width: 16px; + height: 16px; +} +.ke-icon-lineheight { + background-position: 0px -992px; + width: 16px; + height: 16px; +} +.ke-icon-clearhtml { + background-position: 0px -1008px; + width: 16px; + height: 16px; +} +.ke-icon-pagebreak { + background-position: 0px -1024px; + width: 16px; + height: 16px; +} +.ke-icon-insertfile { + background-position: 0px -1040px; + width: 16px; + height: 16px; +} +.ke-icon-quickformat { + background-position: 0px -1056px; + width: 16px; + height: 16px; +} +.ke-icon-template { + background-position: 0px -1072px; + width: 16px; + height: 16px; +} +.ke-icon-tablecellsplit { + background-position: 0px -1088px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowmerge { + background-position: 0px -1104px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowsplit { + background-position: 0px -1120px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolmerge { + background-position: 0px -1136px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolsplit { + background-position: 0px -1152px; + width: 16px; + height: 16px; +} +.ke-icon-anchor { + background-position: 0px -1168px; + width: 16px; + height: 16px; +} +.ke-icon-search { + background-position: 0px -1184px; + width: 16px; + height: 16px; +} +.ke-icon-new { + background-position: 0px -1200px; + width: 16px; + height: 16px; +} +.ke-icon-specialchar { + background-position: 0px -1216px; + width: 16px; + height: 16px; +} +.ke-icon-multiimage { + background-position: 0px -1232px; + width: 16px; + height: 16px; +} +/* container */ +.ke-container { + display: block; + border: 1px solid #CCCCCC; + background-color: #FFF; + overflow: hidden; + margin: 0; + padding: 0; +} +/* toolbar */ +.ke-toolbar { + border-bottom: 1px solid #CCC; + background-color: #F0F0EE; + padding: 2px 5px; + text-align: left; + overflow: hidden; + zoom: 1; +} +.ke-toolbar-icon { + background-repeat: no-repeat; + font-size: 0; + line-height: 0; + overflow: hidden; + display: block; +} +.ke-toolbar-icon-url { + background-image: url(default.png); +} +.ke-toolbar .ke-outline { + border: 1px solid #F0F0EE; + margin: 1px; + padding: 1px 2px; + font-size: 0; + line-height: 0; + overflow: hidden; + cursor: pointer; + display: block; + float: left; +} +.ke-toolbar .ke-on { + border: 1px solid #5690D2; +} +.ke-toolbar .ke-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-toolbar .ke-disabled { + cursor: default; +} +.ke-toolbar .ke-separator { + height: 16px; + margin: 2px 3px; + border-left: 1px solid #A0A0A0; + border-right: 1px solid #FFFFFF; + border-top:0; + border-bottom:0; + width: 0; + font-size: 0; + line-height: 0; + overflow: hidden; + display: block; + float: left; +} +.ke-toolbar .ke-hr { + overflow: hidden; + height: 1px; + clear: both; +} +/* edit */ +.ke-edit { + padding: 0; +} +.ke-edit-iframe, +.ke-edit-textarea { + border: 0; + margin: 0; + padding: 0; + overflow: auto; +} +.ke-edit-textarea { + font: 12px/1.5 "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; + color: #000; + overflow: auto; + resize: none; +} +.ke-edit-textarea:focus { + outline: none; +} +/* statusbar */ +.ke-statusbar { + position: relative; + background-color: #F0F0EE; + border-top: 1px solid #CCCCCC; + font-size: 0; + line-height: 0; + *height: 12px; + overflow: hidden; + text-align: center; + cursor: s-resize; +} +.ke-statusbar-center-icon { + background-position: -0px -754px; + width: 15px; + height: 11px; + background-image: url(default.png); +} +.ke-statusbar-right-icon { + position: absolute; + right: 0; + bottom: 0; + cursor: se-resize; + background-position: -5px -741px; + width: 11px; + height: 11px; + background-image: url(default.png); +} +/* menu */ +.ke-menu { + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + overflow: hidden; +} +.ke-menu-item { + border: 1px solid #F1F1F1; + background-color: #F1F1F1; + color: #222222; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-menu-item-left { + width: 27px; + text-align: center; + overflow: hidden; +} +.ke-menu-item-center { + width: 0; + height: 24px; + border-left: 1px solid #E3E3E3; + border-right: 1px solid #FFFFFF; + border-top: 0; + border-bottom: 0; +} +.ke-menu-item-center-on { + border-left: 1px solid #E9EFF6; + border-right: 1px solid #E9EFF6; +} +.ke-menu-item-right { + border: 0; + padding: 0 0 0 5px; + line-height: 24px; + text-align: left; + overflow: hidden; +} +.ke-menu-separator { + margin: 2px 0; + height: 0; + overflow: hidden; + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #FFFFFF; + border-left: 0; + border-right: 0; +} +/* colorpicker */ +.ke-colorpicker { + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; +} +.ke-colorpicker-table { + border:0; + margin:0; + padding:0; + border-collapse: separate; +} +.ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} +.ke-colorpicker-cell-color { + width: 14px; + height: 14px; + margin: 3px; + padding: 0; + border: 0; +} +/* dialog */ +.ke-dialog { + position: absolute; + margin: 0; + padding: 0; +} +.ke-dialog .ke-header { + width: 100%; + margin-bottom: 10px; +} +.ke-dialog .ke-header .ke-left { + float: left; +} +.ke-dialog .ke-header .ke-right { + float: right; +} +.ke-dialog .ke-header label { + margin-right: 0; + cursor: pointer; + font-weight: normal; + display: inline; + vertical-align: top; +} +.ke-dialog-content { + background-color: #FFF; + width: 100%; + height: 100%; + color: #333; + border: 1px solid #A0A0A0; +} +.ke-dialog-shadow { + position: absolute; + z-index: -1; + top: 0; + left: 0; + width: 100%; + height: 100%; + box-shadow: 3px 3px 7px #999; + -moz-box-shadow: 3px 3px 7px #999; + -webkit-box-shadow: 3px 3px 7px #999; + filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.4'); + background-color: #F0F0EE; +} +.ke-dialog-header { + border:0; + margin:0; + padding: 0 10px; + background: url(background.png) repeat scroll 0 0 #F0F0EE; + border-bottom: 1px solid #CFCFCF; + height: 24px; + font: 12px/24px "sans serif",tahoma,verdana,helvetica; + text-align: left; + color: #222; + cursor: move; +} +.ke-dialog-icon-close { + display: block; + background: url(default.png) no-repeat scroll 0px -688px; + width: 16px; + height: 16px; + position: absolute; + right: 6px; + top: 6px; + cursor: pointer; +} +.ke-dialog-body { + font: 12px/1.5 "sans serif",tahoma,verdana,helvetica; + text-align: left; + overflow: hidden; + width: 100%; +} +.ke-dialog-body textarea { + display: block; + overflow: auto; + padding: 0; + resize: none; +} +.ke-dialog-body textarea:focus, +.ke-dialog-body input:focus, +.ke-dialog-body select:focus { + outline: none; +} +.ke-dialog-body label { + margin-right: 10px; + cursor: pointer; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-dialog-body img { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-dialog-body select { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; + width: auto; +} +.ke-dialog-body .ke-textarea { + display: block; + width: 408px; + height: 260px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; +} +.ke-dialog-body .ke-form { + margin: 0; + padding: 0; +} +.ke-dialog-loading { + position: absolute; + top: 0; + left: 1px; + z-index: 1; + text-align: center; +} +.ke-dialog-loading-content { + background: url("../common/loading.gif") no-repeat; + color: #666; + font-size: 14px; + font-weight: bold; + height: 31px; + line-height: 31px; + padding-left: 36px; +} +.ke-dialog-row { + margin-bottom: 10px; +} +.ke-dialog-footer { + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + text-align: right; + padding:0 0 5px 0; + background-color: #FFF; + width: 100%; +} +.ke-dialog-preview, +.ke-dialog-yes { + margin: 5px; +} +.ke-dialog-no { + margin: 5px 10px 5px 5px; +} +.ke-dialog-mask { + background-color:#FFF; + filter:alpha(opacity=50); + opacity:0.5; +} +.ke-button-common { + background: url(background.png) no-repeat; + cursor: pointer; + height: 23px; + line-height: 23px; + overflow: visible; + display: inline-block; + vertical-align: top; + cursor: pointer; +} +.ke-button-outer { + background-position: 0 -25px; + padding: 0; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-button { + background-position: right -25px; + padding: 0 14px 0 12px; + margin: 0 0 0 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + border: 0 none; + color: #333; + font-size: 12px; + text-decoration: none; +} +/* inputbox */ +.ke-input-text { + background-color:#FFFFFF; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 17px; + height: 17px; + padding: 2px 4px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-input-number { + width: 50px; +} +.ke-input-color { + border: 1px solid #A0A0A0; + background-color: #FFFFFF; + font-size: 12px; + width: 60px; + height: 20px; + line-height: 20px; + padding-left: 5px; + overflow: hidden; + cursor: pointer; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-upload-button { + position: relative; +} +.ke-upload-area { + position: relative; + overflow: hidden; + margin: 0; + padding: 0; + *height: 25px; +} +.ke-upload-area .ke-upload-file { + position: absolute; + font-size: 60px; + top: 0; + right: 0; + padding: 0; + margin: 0; + z-index: 811212; + border: 0 none; + opacity: 0; + filter: alpha(opacity=0); +} +/* tabs */ +.ke-tabs { + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + border-bottom:1px solid #A0A0A0; + padding-left:5px; + margin-bottom:20px; +} +.ke-tabs-ul { + list-style-image:none; + list-style-position:outside; + list-style-type:none; + margin:0; + padding:0; +} +.ke-tabs-li { + position: relative; + border: 1px solid #A0A0A0; + background-color: #F0F0EE; + margin: 0 2px -1px 0; + padding: 0 20px; + float: left; + line-height: 25px; + text-align: center; + color: #555555; + cursor: pointer; +} +.ke-tabs-li-selected { + background-color: #FFF; + border-bottom: 1px solid #FFF; + color: #000; + cursor: default; +} +.ke-tabs-li-on { + background-color: #FFF; + color: #000; +} +/* progressbar */ +.ke-progressbar { + position: relative; + margin: 0; + padding: 0; +} +.ke-progressbar-bar { + border: 1px solid #6FA5DB; + width: 80px; + height: 5px; + margin: 10px 10px 0 10px; + padding: 0; +} +.ke-progressbar-bar-inner { + width: 0; + height: 5px; + background-color: #6FA5DB; + overflow: hidden; + margin: 0; + padding: 0; +} +.ke-progressbar-percent { + position: absolute; + top: 0; + left: 40%; + display: none; +} +/* swfupload */ +.ke-swfupload-top { + position: relative; + margin-bottom: 10px; + _width: 608px; +} +.ke-swfupload-button { + height: 23px; + line-height: 23px; +} +.ke-swfupload-desc { + padding: 0 10px; + height: 23px; + line-height: 23px; +} +.ke-swfupload-startupload { + position: absolute; + top: 0; + right: 0; +} +.ke-swfupload-body { + overflow: scroll; + background-color:#FFFFFF; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; + width: auto; + height: 370px; + padding: 5px; +} +.ke-swfupload-body .ke-item { + width: 100px; + margin: 5px; +} +.ke-swfupload-body .ke-photo { + position: relative; + border: 1px solid #DDDDDD; + background-color:#FFFFFF; + padding: 10px; +} +.ke-swfupload-body .ke-delete { + display: block; + background: url(default.png) no-repeat scroll 0px -688px; + width: 16px; + height: 16px; + position: absolute; + right: 0; + top: 0; + cursor: pointer; +} +.ke-swfupload-body .ke-status { + position: absolute; + left: 0; + bottom: 5px; + width: 100px; + height: 17px; +} +.ke-swfupload-body .ke-message { + width: 100px; + text-align: center; + overflow: hidden; + height:17px; +} +.ke-swfupload-body .ke-error { + color: red; +} +.ke-swfupload-body .ke-name { + width: 100px; + text-align: center; + overflow: hidden; + height:16px; +} +.ke-swfupload-body .ke-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} + +/* emoticons */ +.ke-plugin-emoticons { + position: relative; +} +.ke-plugin-emoticons .ke-preview { + position: absolute; + text-align: center; + margin: 2px; + padding: 10px; + top: 0; + border: 1px solid #A0A0A0; + background-color: #FFFFFF; + display: none; +} +.ke-plugin-emoticons .ke-preview-img { + border:0; + margin:0; + padding:0; +} +.ke-plugin-emoticons .ke-table { + border:0; + margin:0; + padding:0; + border-collapse:separate; +} +.ke-plugin-emoticons .ke-cell { + margin:0; + padding:1px; + border:1px solid #F0F0EE; + cursor:pointer; +} +.ke-plugin-emoticons .ke-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-plugin-emoticons .ke-img { + display:block; + background-repeat:no-repeat; + overflow:hidden; + margin:2px; + width:24px; + height:24px; + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-emoticons .ke-page { + text-align: right; + margin: 5px; + padding: 0; + border: 0; + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + color: #333; + text-decoration: none; +} +.ke-plugin-plainpaste-textarea, +.ke-plugin-wordpaste-iframe { + display: block; + width: 408px; + height: 260px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; +} +/* filemanager */ +.ke-plugin-filemanager-header { + width: 100%; + margin-bottom: 10px; +} +.ke-plugin-filemanager-header .ke-left { + float: left; +} +.ke-plugin-filemanager-header .ke-right { + float: right; +} +.ke-plugin-filemanager-body { + overflow: scroll; + background-color:#FFFFFF; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; + width: auto; + height: 370px; + padding: 5px; +} +.ke-plugin-filemanager-body .ke-item { + width: 100px; + margin: 5px; +} +.ke-plugin-filemanager-body .ke-photo { + border: 1px solid #DDDDDD; + background-color:#FFFFFF; + padding: 10px; +} +.ke-plugin-filemanager-body .ke-name { + width: 100px; + text-align: center; + overflow: hidden; + height:16px; +} +.ke-plugin-filemanager-body .ke-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-plugin-filemanager-body .ke-table { + width: 95%; + border: 0; + margin: 0; + padding: 0; + border-collapse: separate; +} +.ke-plugin-filemanager-body .ke-table .ke-cell { + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-filemanager-body .ke-table .ke-name { + width: 55%; + text-align: left; +} +.ke-plugin-filemanager-body .ke-table .ke-size { + width: 15%; + text-align: left; +} +.ke-plugin-filemanager-body .ke-table .ke-datetime { + width: 30%; + text-align: center; +} + diff --git a/public/kindeditor/themes/default/default.png b/public/kindeditor/themes/default/default.png new file mode 100644 index 0000000..cc9e72d Binary files /dev/null and b/public/kindeditor/themes/default/default.png differ diff --git a/public/kindeditor/themes/qq/editor.gif b/public/kindeditor/themes/qq/editor.gif new file mode 100644 index 0000000..b256841 Binary files /dev/null and b/public/kindeditor/themes/qq/editor.gif differ diff --git a/public/kindeditor/themes/qq/qq.css b/public/kindeditor/themes/qq/qq.css new file mode 100644 index 0000000..a45e08c --- /dev/null +++ b/public/kindeditor/themes/qq/qq.css @@ -0,0 +1,143 @@ +/* container */ +.ke-container-qq { + display: block; + border: 1px solid #c3c3c3; + background-color: #FFF; + overflow: hidden; + margin: 0; + padding: 0; +} +/* toolbar */ +.ke-container-qq .ke-toolbar { + border-bottom: 1px solid #c3c3c3; + background-color: #FFFFFF; + padding: 2px 5px; + text-align: left; + overflow: hidden; + zoom: 1; +} +.ke-toolbar-icon-url { + background-image: url(editor.gif); + width:18px; + *xwidth:20px; + height:18px; + *xheight:20px; +} +.ke-icon-checked{ + background-image: url(../default/default.png); + width:16px; + height:16px; +} +.ke-container-qq .ke-icon-bold{ + background-position: 4px 1px; +} +.ke-container-qq .ke-icon-italic{ + background-position: -27px 1px; +} +.ke-container-qq .ke-icon-italic{ + background-position: -28px 1px; +} +.ke-container-qq .ke-icon-underline{ + background-position: -60px 1px; +} +.ke-container-qq .ke-icon-fontname{ + background-position: -95px 1px; +} +.ke-container-qq .ke-icon-fontsize{ + background-position: -128px 1px; +} +.ke-container-qq .ke-icon-forecolor{ + background-position: -159px 1px; +} +.ke-container-qq .ke-icon-hilitecolor{ + background-position: -190px 1px; +} +.ke-container-qq .ke-icon-plug-align{ + background-position: -223px 1px; +} +.plug-align-justifyleft{ + background-position: -350px 1px; +} +.plug-align-justifycenter{ + background-position: -382px 1px; +} +.plug-align-justifyright{ + background-position: -414px 1px; +} +.plug-order-insertorderedlist{ + background-position: -446px 1px; +} +.plug-order-insertunorderedlist{ + background-position: -477px 1px; +} +.plug-indent-indent{ + background-position: -513px 1px; +} +.plug-indent-outdent{ + background-position: -545px 1px; +} +.ke-container-qq .ke-icon-plug-order{ + background-position: -255px 1px; +} +.ke-container-qq .ke-icon-plug-indent{ + background-position: -287px 1px; +} +.ke-container-qq .ke-icon-link{ + background-position: -319px 1px; +} + +.ke-container-qq .ke-toolbar .ke-outline { + cursor: default; + padding:0px; + border:1px solid #fff; +} +.ke-container-qq .ke-toolbar .ke-on { + border-left:1px solid white; + border-top:1px solid white; + border-right:1px solid gray; + border-bottom:1px solid gray; + background-color: #FFFFFF; +} +.ke-container-qq .ke-toolbar .ke-selected { + border-left:1px solid gray; + border-top:1px solid gray; + border-right:1px solid white; + border-bottom:1px solid white; + background-color: #FFFFFF; +} +.ke-container-qq .ke-toolbar .ke-disabled { + cursor: default; +} + +.ke-colorpicker-qq{ + background:#fff; +} +/* statusbar */ +.ke-container-qq .ke-statusbar { + display:none; +} +/* menu */ +.ke-menu-qq { + border:1px solid #a6a6a6; + position:absolute; + background:#fff; + -moz-box-shadow:2px 2px 4px #DDDDDD; + z-index:999; + left:-400px; + top:-386px; + right:218px; + width:130px; +} +.ke-menu-qq .ke-menu-item { + padding:0px; + background:#fff; +} +.ke-menu-qq .ke-menu-item-on { + border:1px solid #000080;background:#FFEEC2;color:#036; +} +.ke-menu-qq .ke-toolbar .ke-selected { + border:1px solid #9a9afb; +} +.ke-menu-qq .ke-menu-item-left{ + width:auto; +} diff --git a/public/kindeditor/themes/simple/simple.css b/public/kindeditor/themes/simple/simple.css new file mode 100644 index 0000000..4c76cf9 --- /dev/null +++ b/public/kindeditor/themes/simple/simple.css @@ -0,0 +1,100 @@ +/* container */ +.ke-container-simple { + display: block; + border: 1px solid #CCC; + background-color: #FFF; + overflow: hidden; +} +/* toolbar */ +.ke-container-simple .ke-toolbar { + border-bottom: 1px solid #CCC; + background-color: #FFF; + padding: 2px 5px; + overflow: hidden; +} +.ke-container-simple .ke-toolbar .ke-outline { + border: 1px solid #FFF; + background-color: transparent; + margin: 1px; + padding: 1px 2px; + font-size: 0; + line-height: 0; + overflow: hidden; + cursor: pointer; +} +.ke-container-simple .ke-toolbar .ke-on { + border: 1px solid #5690D2; +} +.ke-container-simple .ke-toolbar .ke-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-container-simple .ke-toolbar .ke-disabled { + cursor: default; +} +/* statusbar */ +.ke-container-simple .ke-statusbar { + position: relative; + background-color: #FFF; + border-top: 1px solid #CCCCCC; + font-size: 0; + line-height: 0; + *height: 12px; + overflow: hidden; + text-align: center; + cursor: s-resize; +} +/* menu */ +.ke-menu-simple { + border: 1px solid #A0A0A0; + background-color: #FFF; + color: #222222; + padding: 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + overflow: hidden; +} +.ke-menu-simple .ke-menu-item { + border: 1px solid #FFF; + background-color: #FFF; + color: #222222; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-simple .ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #FFF; +} +/* colorpicker */ +.ke-colorpicker-simple { + border: 1px solid #A0A0A0; + background-color: #FEFEFE; + color: #222222; + padding: 2px; +} +.ke-colorpicker-simple .ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-simple .ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-simple .ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-simple .ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} diff --git a/root/.svn/entries b/root/.svn/entries new file mode 100644 index 0000000..0b2e934 --- /dev/null +++ b/root/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/root +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +sqltool.aspx +file + + + + +2011-04-01T02:51:03.961702Z +8973cbfd2fb7b8b4433a0a8d410f3ed5 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +675 + +setup.aspx +file + + + + +2011-04-01T02:51:03.977327Z +dff58c2d5f2dcfa73fc6bfdcd6abef5b +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +586 + +sqltool.aspx.cs +file + + + + +2011-04-01T02:51:03.992953Z +9c175756895a2430447ddf95a188d32d +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +404 + +setup.aspx.cs +file + + + + +2011-04-01T02:51:04.117953Z +28f4d18b99036aec5ba5875872acb5b7 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +518 + diff --git a/root/.svn/text-base/setup.aspx.cs.svn-base b/root/.svn/text-base/setup.aspx.cs.svn-base new file mode 100644 index 0000000..c50dc4d --- /dev/null +++ b/root/.svn/text-base/setup.aspx.cs.svn-base @@ -0,0 +1,24 @@ +using System; +using ZhangPu.Gov.Data.Model; + +public partial class setup : PageBase +{ + private Setup _obj; + protected void Page_Load(object sender, EventArgs e) + { + _obj = new Setup(); + } + + protected void btnCleanProjects_Click(object sender, EventArgs e) + { + + _obj.initializingProjects(); + } + protected void btndeleteNews_Click(object sender, EventArgs e) + { + RoleEmpExt obj = new RoleEmpExt(); + _obj.initializingNews(); + } + + +} diff --git a/root/.svn/text-base/setup.aspx.svn-base b/root/.svn/text-base/setup.aspx.svn-base new file mode 100644 index 0000000..7cdb59c --- /dev/null +++ b/root/.svn/text-base/setup.aspx.svn-base @@ -0,0 +1,11 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="setup.aspx.cs" Inherits="setup" Title="Setup" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + diff --git a/root/.svn/text-base/sqltool.aspx.cs.svn-base b/root/.svn/text-base/sqltool.aspx.cs.svn-base new file mode 100644 index 0000000..8021f7e --- /dev/null +++ b/root/.svn/text-base/sqltool.aspx.cs.svn-base @@ -0,0 +1,17 @@ +using System; +using ZhangPu.Gov.Data.Model; + +public partial class root_sqltool : PageBase +{ + private Setup _obj; + protected void Page_Load(object sender, EventArgs e) + { + _obj = new Setup(); + } + + protected void btnExe_Click(object sender, EventArgs e) + { + GridView1.DataSource = _obj.exeSql(txtsql.Text.Trim()); + GridView1.DataBind(); + } +} diff --git a/root/.svn/text-base/sqltool.aspx.svn-base b/root/.svn/text-base/sqltool.aspx.svn-base new file mode 100644 index 0000000..bec97ed --- /dev/null +++ b/root/.svn/text-base/sqltool.aspx.svn-base @@ -0,0 +1,38 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="sqltool.aspx.cs" Inherits="root_sqltool" Title="Untitled Page" %> + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      + + +
      + + + + + +
      + diff --git a/root/setup.aspx b/root/setup.aspx new file mode 100644 index 0000000..7cdb59c --- /dev/null +++ b/root/setup.aspx @@ -0,0 +1,11 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="setup.aspx.cs" Inherits="setup" Title="Setup" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + diff --git a/root/setup.aspx.cs b/root/setup.aspx.cs new file mode 100644 index 0000000..53847c5 --- /dev/null +++ b/root/setup.aspx.cs @@ -0,0 +1,24 @@ +using System; +using DeiNiu.wms.Data.Model; + +public partial class setup : PageBase +{ + private Setup _obj; + protected void Page_Load(object sender, EventArgs e) + { + _obj = new Setup(); + } + + protected void btnCleanProjects_Click(object sender, EventArgs e) + { + + _obj.initializingProjects(); + } + protected void btndeleteNews_Click(object sender, EventArgs e) + { + RoleEmp obj = new RoleEmp(); + _obj.initializingNews(); + } + + +} diff --git a/root/sqltool.aspx b/root/sqltool.aspx new file mode 100644 index 0000000..bec97ed --- /dev/null +++ b/root/sqltool.aspx @@ -0,0 +1,38 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="sqltool.aspx.cs" Inherits="root_sqltool" Title="Untitled Page" %> + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      + + +
      + + + + + +
      + diff --git a/root/sqltool.aspx.cs b/root/sqltool.aspx.cs new file mode 100644 index 0000000..4d800b1 --- /dev/null +++ b/root/sqltool.aspx.cs @@ -0,0 +1,17 @@ +using System; +using DeiNiu.wms.Data.Model; + +public partial class root_sqltool : PageBase +{ + private Setup _obj; + protected void Page_Load(object sender, EventArgs e) + { + _obj = new Setup(); + } + + protected void btnExe_Click(object sender, EventArgs e) + { + GridView1.DataSource = _obj.exeSql(txtsql.Text.Trim()); + GridView1.DataBind(); + } +} diff --git a/showImage.aspx b/showImage.aspx new file mode 100644 index 0000000..d8fdf74 --- /dev/null +++ b/showImage.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="showImage.aspx.cs" Inherits="utils_showImage" %> + + + + + + 无标题页 + + +
      +
      + +
      +
      + + diff --git a/showImage.aspx.cs b/showImage.aspx.cs new file mode 100644 index 0000000..50a6094 --- /dev/null +++ b/showImage.aspx.cs @@ -0,0 +1,98 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Drawing; +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; + +public partial class utils_showImage : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + // 创建一个包含随机内容的验证码文本 + System.Random rand = new Random(); + int len = rand.Next(2,4); + char[] chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); + System.Text.StringBuilder myStr = new System.Text.StringBuilder(); + for (int iCount = 0; iCount < len; iCount++) + { + myStr.Append(chars[rand.Next(chars.Length)]); + } + string text = myStr.ToString(); + // 保存验证码到 session 中以便其他模块使用 + this.Session["checkcode"] = text; + Size ImageSize = Size.Empty; + Font myFont = new Font("MS Sans Serif", 18); + // 计算验证码图片大小 + using (Bitmap bmp = new Bitmap(10, 10)) + { + using (Graphics g = Graphics.FromImage(bmp)) + { + SizeF size = g.MeasureString(text, myFont, 10000); + ImageSize.Width = (int)size.Width + 8; + ImageSize.Height = (int)size.Height + 8; + } + } + // 创建验证码图片 + using (Bitmap bmp = new Bitmap(ImageSize.Width, ImageSize.Height)) + { + // 绘制验证码文本 + using (Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.White); + using (StringFormat f = new StringFormat()) + { + f.Alignment = StringAlignment.Near; + f.LineAlignment = StringAlignment.Center; + f.FormatFlags = StringFormatFlags.NoWrap; + g.DrawString( + text, + myFont, + Brushes.Black, + new RectangleF( + 0, + 0, + ImageSize.Width, + ImageSize.Height), + f); + }//using + }//using + // 制造噪声 杂点面积占图片面积的 30% + int num = ImageSize.Width * ImageSize.Height * 30 / 100; + for (int iCount = 0; iCount < num; iCount++) + { + // 在随机的位置使用随机的颜色设置图片的像素 + int x = rand.Next(ImageSize.Width); + int y = rand.Next(ImageSize.Height); + int r = rand.Next(255); + int g = rand.Next(255); + int b = rand.Next(255); + Color c = Color.FromArgb(r, g, b); + bmp.SetPixel(x, y, c); + }//for + // 输出图片 + System.IO.MemoryStream ms = new System.IO.MemoryStream(); + bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + this.Response.ContentType = "image/png"; + ms.WriteTo(this.Response.OutputStream); + ms.Close(); + }//using + myFont.Dispose(); + } + + /// + /// 检查指定的文本是否匹配验证码 + /// + /// 要判断的文本 + /// 是否匹配 + public static bool CheckCode(string text) + { + string txt = System.Web.HttpContext.Current.Session["checkcode"] as string; + return text == txt; + } +} diff --git a/test.aspx b/test.aspx new file mode 100644 index 0000000..6729c4b --- /dev/null +++ b/test.aspx @@ -0,0 +1,5 @@ +<%@ Page Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" Title="Untitled Page" %> + + + + diff --git a/test.aspx.cs b/test.aspx.cs new file mode 100644 index 0000000..098a275 --- /dev/null +++ b/test.aspx.cs @@ -0,0 +1,32 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +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; + +public partial class test : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + Button1.Text="test close ie"; + } + protected void Button1_Click(object sender, EventArgs e) + { + if ((Session["CurrentUser"] != null)) + { + + if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") + if (Session["CurrentUserId"] != null) + { + // ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); + DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); + logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); + } + } + } +} diff --git a/ug/.svn/entries b/ug/.svn/entries new file mode 100644 index 0000000..8ed9316 --- /dev/null +++ b/ug/.svn/entries @@ -0,0 +1,139 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/ug +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +Dict +dir + +Project +dir + +training +dir + +login.html +file + + + + +2011-04-01T02:51:11.821128Z +f3b8f1cb6cd225ca0c08d19b12ac596b +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +920 + +desktop.html +file + + + + +2011-04-01T02:51:11.836753Z +bb99be830a12624fd79d7eb141dee8b5 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1186 + +nohelpdoc.html +file + + + + +2011-04-01T02:51:11.836753Z +eccdd2f415d749b357941ccb65d46799 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +466 + diff --git a/ug/.svn/text-base/desktop.html.svn-base b/ug/.svn/text-base/desktop.html.svn-base new file mode 100644 index 0000000..e8adb7d --- /dev/null +++ b/ug/.svn/text-base/desktop.html.svn-base @@ -0,0 +1,36 @@ + + + + +ϵͳ + + + +˵

      + + +ҳû¼ϵͳҳ棬ڼʾ͵¼ûصϢ +֮¹֣ +
        +
      • ϵͳʾ ϸչʾûĿͿγϢ +
      • ־ƻ ʾûƶ¼ĵԺĹƻ־ +
      • ϢϵͳϢ Ϣṩ޸ĵĹܡϵͳϢṩ˵ǰԱб +
      +
      +
      ˵

      +
      ޸ +
        +
      • Ϣ->޸ +
      • ԭ롢 +
      • ޸İť롣 +
      • ȡť޸ģԭ뽫Ч +
      +
      +رʾ

      +
        +
      • ޸ԭʧЧӰ쵱ǰỰ´ε¼ʱʹ趨롣 +
      • +ҳΪ֣ΪûȨбҲΪϵͳ¼йҳ涼Ǵ˲֣ҳ治ἰ +
      + + diff --git a/ug/.svn/text-base/login.html.svn-base b/ug/.svn/text-base/login.html.svn-base new file mode 100644 index 0000000..5e9e851 --- /dev/null +++ b/ug/.svn/text-base/login.html.svn-base @@ -0,0 +1,30 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      +ҳϵͳĵ¼ҳ棬ϵͳûĵ¼Ϣ֤ʶûݵĺϷԣ֤ͨû¼ϵͳкȨƥҵ

      +
      + ˵
      +
      +
      + +
    • +û뼰֤룬¼ť +
    • ֤ͨûҳ档 +
    • ֤ʧ + ʾ û¼Ϣ롱 +
    • ȡťϵͳҳ + +
      +رʾ

      +
    • û֤벻ִСдϸִСд +
    • ֤ͼƬ˫ͼƬϵͳ漴µ֤롣 + + diff --git a/ug/.svn/text-base/nohelpdoc.html.svn-base b/ug/.svn/text-base/nohelpdoc.html.svn-base new file mode 100644 index 0000000..9a99317 --- /dev/null +++ b/ug/.svn/text-base/nohelpdoc.html.svn-base @@ -0,0 +1,20 @@ + + + + +ϵͳ + + + + +ûҵӦİļ + + + diff --git a/ug/Dict/.svn/entries b/ug/Dict/.svn/entries new file mode 100644 index 0000000..a77f634 --- /dev/null +++ b/ug/Dict/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/ug/Dict +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +DeptEmp.html +file + + + + +2011-04-01T02:51:10.758621Z +9952d108f4b9dcbf53a91be90a114e80 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1412 + +DeptMain.html +file + + + + +2011-04-01T02:51:10.758621Z +ca495b138ac4016bf46a5f7cce006006 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1863 + +RoleAuth.html +file + + + + +2011-04-01T02:51:10.774246Z +6543cda2a4456bba4bb8149451cbe8e1 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1453 + +RoleEmp.html +file + + + + +2011-04-01T02:51:10.774246Z +2251e78f2f9d75666e29df92c67d2110 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1461 + +EmployeeMain.html +file + + + + +2011-04-01T02:51:10.789871Z +0f99543ad761717aaf268630841fc78f +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1955 + +RoleMain.html +file + + + + +2011-04-01T02:51:10.789871Z +aab67f96e399b95e68929e5ea3b9a37c +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1774 + diff --git a/ug/Dict/.svn/text-base/DeptEmp.html.svn-base b/ug/Dict/.svn/text-base/DeptEmp.html.svn-base new file mode 100644 index 0000000..00682cf --- /dev/null +++ b/ug/Dict/.svn/text-base/DeptEmp.html.svn-base @@ -0,0 +1,41 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳԶûܹ֯ٷ䡣

      +

      ҳҷΪ鹦

      +
        +
      • ûûڵԴֱʾ
      • +
      • +
      • ûб
      • +
      +
      + ˵

      + 1.û
      +
        +
      • ѡûڵ㣨֣
      • +
      • ѡеûIJŽҲֱбʽչ֡
      • +
      • мĽڵǰĸѡѡлȡѡûڵIJš
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • ҲûбԶûڸòŵְб༭ +
          +
        • +
        • ıְ
        • +
        • ޸ģ޸ġ
        • +
        +
      + + diff --git a/ug/Dict/.svn/text-base/DeptMain.html.svn-base b/ug/Dict/.svn/text-base/DeptMain.html.svn-base new file mode 100644 index 0000000..53a9e15 --- /dev/null +++ b/ug/Dict/.svn/text-base/DeptMain.html.svn-base @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûܹ֯

      +

      ҳҷΪ鹦

      +
        +
      • ܹ֯״ͼ
      • +
      • +
      +
      + ˵

      + 1.
      +
        +
      • ಿڵ㣬ýڵµIJŽҲбʾ
      • +
      • Ҳⲿŵı༭λť
      • +
      • ҲಿбչʾòŵϸϢ
      • +

      • +
      • +
      +
      +2.
      +
        +
      • Ҳಿбµ ¼ ť
      • +
      • ҪIJϢΪ
      • +
      • ť
      • +
      • ŽĬϱڵǰѡ֮¡
        +
      • +
      + +
      +2.޸
      +
        +
      • òڱ༭״̬
      • +
      • ڱ༭ԸòϢҪı༭עⲿƲΪա
      • +
      • ť
        +
      • +
      + +
      +2.ɾ
      +
        +
      • ɾҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/Dict/.svn/text-base/EmployeeMain.html.svn-base b/ug/Dict/.svn/text-base/EmployeeMain.html.svn-base new file mode 100644 index 0000000..bb63c2f --- /dev/null +++ b/ug/Dict/.svn/text-base/EmployeeMain.html.svn-base @@ -0,0 +1,61 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûϢ

      +

      ҳҷΪ鹦

      +
        +
      • ܹ֯״ͼ
      • +
      • ûʾ༭
      • +
      +
      + ˵

      + 1.û
      +
        +
      • ಿڵ㣬òŽڵµûҲбʾ
      • +
      • Ҳûı༭λť
      • +
      • ҲûбչʾûϸϢ
        +
      • +
      +
      +2.û
      +
        +
      • ѡвӵûIJ
      • +
      • ûбµ ¼ ť
      • +
      • ûϢû˺Ϊ
      • +
      • ť
      • +
      • ԱĬϱڵǰѡ֮¡
        +
      • +
      + +
      +2.û޸
      +
        +
      • ޸ûڱ༭״̬
      • +
      • ڱ༭ԸûϢҪı༭û˺ŲΪա
      • +
      • ť
        +
      • +
      + +
      +2.ûɾ
      +
        +
      • ɾûҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ûʱһҪȷIJš +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/Dict/.svn/text-base/RoleAuth.html.svn-base b/ug/Dict/.svn/text-base/RoleAuth.html.svn-base new file mode 100644 index 0000000..34c42b0 --- /dev/null +++ b/ug/Dict/.svn/text-base/RoleAuth.html.svn-base @@ -0,0 +1,45 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڶԽɫȨ޷䡣

      +

      ҳҷΪ鹦

      +
        +
      • ɫб
      • +
      • Ȩб
      • +
      • ȨޡɫԱ ϵͼ
      • +
      +
      + ˵

      + 1.ɫ
      +
        +
      • ѡɫбеҪĽɫ
      • +
      • Ȩбѡ/ѡ Ҫ/ȡȨޡ
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +
      +2.鿴
      ɫԱȨ޵ ϵͼ +
        +
      • ѡɫбеĽɫɫԱ嵥 ʾӵиýɫԱ嵥
      • +
      • ȨбеϸֵȨƣȨ޽ɫ嵥 ȨԱ嵥 ʾӵѡȨ޵ĽɫԱб
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • +
      +, + + diff --git a/ug/Dict/.svn/text-base/RoleEmp.html.svn-base b/ug/Dict/.svn/text-base/RoleEmp.html.svn-base new file mode 100644 index 0000000..689eae4 --- /dev/null +++ b/ug/Dict/.svn/text-base/RoleEmp.html.svn-base @@ -0,0 +1,45 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڶԱнɫ䡣

      +

      ҳҷΪ鹦

      +
        +
      • ɫб
      • +
      • Ա
      • +
      • ɫԱȨ ϵͼ
      • +
      +
      + ˵

      + 1.ɫ
      +
        +
      • ѡɫбеҪĽɫ
      • +
      • ڲԱѡ/ѡ Ҫ/ȡ ѡɫԱ
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +
      +2.鿴
      ɫԱȨ޵ ϵͼ +
        +
      • ѡɫбеĽɫɫԱ嵥 ʾӵиýɫԱ嵥
      • +
      • ڲԱеԱƣԱɫ嵥 ԱȨ嵥 ʾѡԱĽɫȨб
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • +
      +, + + diff --git a/ug/Dict/.svn/text-base/RoleMain.html.svn-base b/ug/Dict/.svn/text-base/RoleMain.html.svn-base new file mode 100644 index 0000000..78baf78 --- /dev/null +++ b/ug/Dict/.svn/text-base/RoleMain.html.svn-base @@ -0,0 +1,58 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûܹ֯

      +

      ҳ϶·Ϊ鹦

      +
        +
      • ɫб
      • +
      • +
      +
      + ˵

      + 1.ɫ
        +
      • Ҳɫı༭λť
      • +
      • ҲɫбչʾýɫϸϢ
      • +

      • +
      • +
      +
      +2.ɫ
      +
        +
      • Ҳɫбµ ¼ ť
      • +
      • ҪĽɫϢɫƺΪ
      • +
      • ť
        +
      • +
      + +
      +2.ɫ޸
      +
        +
      • ڱ༭״̬
      • +
      • ڱ༭ԸϢҪı༭עɫƺΪΪա
      • +
      • ť
        +
      • +
      + +
      +2.ɫɾ
      +
        +
      • ɾҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      • ˽ɫʾýɫΪרá +
      + + diff --git a/ug/Dict/DeptEmp.html b/ug/Dict/DeptEmp.html new file mode 100644 index 0000000..00682cf --- /dev/null +++ b/ug/Dict/DeptEmp.html @@ -0,0 +1,41 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳԶûܹ֯ٷ䡣

      +

      ҳҷΪ鹦

      +
        +
      • ûûڵԴֱʾ
      • +
      • +
      • ûб
      • +
      +
      + ˵

      + 1.û
      +
        +
      • ѡûڵ㣨֣
      • +
      • ѡеûIJŽҲֱбʽչ֡
      • +
      • мĽڵǰĸѡѡлȡѡûڵIJš
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • ҲûбԶûڸòŵְб༭ +
          +
        • +
        • ıְ
        • +
        • ޸ģ޸ġ
        • +
        +
      + + diff --git a/ug/Dict/DeptMain.html b/ug/Dict/DeptMain.html new file mode 100644 index 0000000..53a9e15 --- /dev/null +++ b/ug/Dict/DeptMain.html @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûܹ֯

      +

      ҳҷΪ鹦

      +
        +
      • ܹ֯״ͼ
      • +
      • +
      +
      + ˵

      + 1.
      +
        +
      • ಿڵ㣬ýڵµIJŽҲбʾ
      • +
      • Ҳⲿŵı༭λť
      • +
      • ҲಿбչʾòŵϸϢ
      • +

      • +
      • +
      +
      +2.
      +
        +
      • Ҳಿбµ ¼ ť
      • +
      • ҪIJϢΪ
      • +
      • ť
      • +
      • ŽĬϱڵǰѡ֮¡
        +
      • +
      + +
      +2.޸
      +
        +
      • òڱ༭״̬
      • +
      • ڱ༭ԸòϢҪı༭עⲿƲΪա
      • +
      • ť
        +
      • +
      + +
      +2.ɾ
      +
        +
      • ɾҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/Dict/EmployeeMain.html b/ug/Dict/EmployeeMain.html new file mode 100644 index 0000000..bb63c2f --- /dev/null +++ b/ug/Dict/EmployeeMain.html @@ -0,0 +1,61 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûϢ

      +

      ҳҷΪ鹦

      +
        +
      • ܹ֯״ͼ
      • +
      • ûʾ༭
      • +
      +
      + ˵

      + 1.û
      +
        +
      • ಿڵ㣬òŽڵµûҲбʾ
      • +
      • Ҳûı༭λť
      • +
      • ҲûбչʾûϸϢ
        +
      • +
      +
      +2.û
      +
        +
      • ѡвӵûIJ
      • +
      • ûбµ ¼ ť
      • +
      • ûϢû˺Ϊ
      • +
      • ť
      • +
      • ԱĬϱڵǰѡ֮¡
        +
      • +
      + +
      +2.û޸
      +
        +
      • ޸ûڱ༭״̬
      • +
      • ڱ༭ԸûϢҪı༭û˺ŲΪա
      • +
      • ť
        +
      • +
      + +
      +2.ûɾ
      +
        +
      • ɾûҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ûʱһҪȷIJš +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/Dict/RoleAuth.html b/ug/Dict/RoleAuth.html new file mode 100644 index 0000000..34c42b0 --- /dev/null +++ b/ug/Dict/RoleAuth.html @@ -0,0 +1,45 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڶԽɫȨ޷䡣

      +

      ҳҷΪ鹦

      +
        +
      • ɫб
      • +
      • Ȩб
      • +
      • ȨޡɫԱ ϵͼ
      • +
      +
      + ˵

      + 1.ɫ
      +
        +
      • ѡɫбеҪĽɫ
      • +
      • Ȩбѡ/ѡ Ҫ/ȡȨޡ
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +
      +2.鿴
      ɫԱȨ޵ ϵͼ +
        +
      • ѡɫбеĽɫɫԱ嵥 ʾӵиýɫԱ嵥
      • +
      • ȨбеϸֵȨƣȨ޽ɫ嵥 ȨԱ嵥 ʾӵѡȨ޵ĽɫԱб
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • +
      +, + + diff --git a/ug/Dict/RoleEmp.html b/ug/Dict/RoleEmp.html new file mode 100644 index 0000000..689eae4 --- /dev/null +++ b/ug/Dict/RoleEmp.html @@ -0,0 +1,45 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڶԱнɫ䡣

      +

      ҳҷΪ鹦

      +
        +
      • ɫб
      • +
      • Ա
      • +
      • ɫԱȨ ϵͼ
      • +
      +
      + ˵

      + 1.ɫ
      +
        +
      • ѡɫбеҪĽɫ
      • +
      • ڲԱѡ/ѡ Ҫ/ȡ ѡɫԱ
      • +
      • ť޸ġ
        +
        +
      • +
      +
      +
      +2.鿴
      ɫԱȨ޵ ϵͼ +
        +
      • ѡɫбеĽɫɫԱ嵥 ʾӵиýɫԱ嵥
      • +
      • ڲԱеԱƣԱɫ嵥 ԱȨ嵥 ʾѡԱĽɫȨб
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • +
      +, + + diff --git a/ug/Dict/RoleMain.html b/ug/Dict/RoleMain.html new file mode 100644 index 0000000..78baf78 --- /dev/null +++ b/ug/Dict/RoleMain.html @@ -0,0 +1,58 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳάϵͳûܹ֯

      +

      ҳ϶·Ϊ鹦

      +
        +
      • ɫб
      • +
      • +
      +
      + ˵

      + 1.ɫ
        +
      • Ҳɫı༭λť
      • +
      • ҲɫбչʾýɫϸϢ
      • +

      • +
      • +
      +
      +2.ɫ
      +
        +
      • Ҳɫбµ ¼ ť
      • +
      • ҪĽɫϢɫƺΪ
      • +
      • ť
        +
      • +
      + +
      +2.ɫ޸
      +
        +
      • ڱ༭״̬
      • +
      • ڱ༭ԸϢҪı༭עɫƺΪΪա
      • +
      • ť
        +
      • +
      + +
      +2.ɫɾ
      +
        +
      • ɾҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      • ˽ɫʾýɫΪרá +
      + + diff --git a/ug/Project/.svn/entries b/ug/Project/.svn/entries new file mode 100644 index 0000000..c0b4444 --- /dev/null +++ b/ug/Project/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/ug/Project +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +WorkReport.html +file + + + + +2011-04-01T02:51:11.305499Z +48034c22783b283b77a13a3ac206313f +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1806 + +ProjectsQuery.html +file + + + + +2011-04-01T02:51:11.321124Z +0c82ae96e32884ccc95280ef54f4ce59 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1356 + +WorkPlanMain.html +file + + + + +2011-04-01T02:51:11.336750Z +c2c46a3d7ba821e8dac3728896c8987a +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1735 + +ProjectApprove.html +file + + + + +2011-04-01T02:51:11.336750Z +52fa44439479b1b54a2dd02d2cf89a68 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +2708 + +ProjectCenter.html +file + + + + +2011-04-01T02:51:11.352375Z +6c5e7b974e86f22857e8320ced2f2998 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +2112 + +ProjectMain.html +file + + + + +2011-04-01T02:51:11.368000Z +36d46f898e5360aaf09196928a9b070d +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +3958 + diff --git a/ug/Project/.svn/text-base/ProjectApprove.html.svn-base b/ug/Project/.svn/text-base/ProjectApprove.html.svn-base new file mode 100644 index 0000000..630f4fa --- /dev/null +++ b/ug/Project/.svn/text-base/ProjectApprove.html.svn-base @@ -0,0 +1,63 @@ + + + + + +ϵͳ + + +

      ˵
      +
      +
      ҳûĿҳ棬ɽĿ׼

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • Ŀб
      • +
      • Ŀϸ༭
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾĿб½ʾǰҳ
        +
      • +
      +
      +2.
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ༭ťĿڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿȵϸϢ
        +
      • +
      • ͨ ťĿͨ ťĿδͨ
        +
      • +
      + +
      +2.ɾĿ
      +
        +
      • ĿҲ༭λť
      • +
      • Ŀڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
      • +
      • +
      • Ŀͨ ͨ ťĿδͨ ť
        +
      • +
      + +
      +2.Ŀ
      +
        +
      • ĿҲ༭λť
      • +
      • Ŀڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
      • +
      • +
      • Ŀͨ ͨ ťĿδͨ ť
        +
      • +
      +
      + رʾ
      +
        + +
      • Ϊ +
      • ûͨģĿظĿˡ +
      + + diff --git a/ug/Project/.svn/text-base/ProjectCenter.html.svn-base b/ug/Project/.svn/text-base/ProjectCenter.html.svn-base new file mode 100644 index 0000000..62cb6e3 --- /dev/null +++ b/ug/Project/.svn/text-base/ProjectCenter.html.svn-base @@ -0,0 +1,52 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳĿϢϴĿ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • ĿĿˡԱŵĿбĿϸ
      • +
      • Ŀϴ
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • ʾIJżԱбԶĿбԱŵԱԴʾûʾҲ޷ʹĿܡ
      • +
      • Ŀѯ޶Ŀƽвѯ
      • +
      • Ĭÿҳʾ20ĿϢ20ҳʾĿб½ʾǰҳ
      • +

      • +
      • +
      +
      + 2.鿴Ŀϸ
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ťĿѡ״̬ҳϳʸʾ״̬ҳ²ָĿȵϸϢ
        +
      • +
      • ԶĿб༭
      • +
      +
      +
      +3.Ŀϴ

      +

      +
        +
      • Ŀϴ򣬵ťѡϴExcelļȷ
      • +
      • ϴĿťϴ
      • +
      +
      +
      + رʾ
      +
        +
      • ĿϴExcelĵغʵ
      • +
      + + diff --git a/ug/Project/.svn/text-base/ProjectMain.html.svn-base b/ug/Project/.svn/text-base/ProjectMain.html.svn-base new file mode 100644 index 0000000..dc0ee21 --- /dev/null +++ b/ug/Project/.svn/text-base/ProjectMain.html.svn-base @@ -0,0 +1,103 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûĿҳ棬ɽĿ¡롢ɾ롢¶ύȲ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • Ŀб
      • +
      • Ŀϸ༭
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾĿб½ʾǰҳ
        +
      • +
      +
      + 2.Ŀ༭
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ༭ťĿڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
        +
      • +
      • Ŀδύ״̬£ԶĿ޸ġɾĿ¶δύ״̬¿ԶĿϸб༭
      • +
      • 水ťԱ޸
      • +
      +
      +
      +3.Ŀ

      +
      +  ûڵǰѡĿ

      +
      +
        +
      • ѡҳʱĿ ȫ ѡ
      • +
      • ť
      • +
      • ҳ²Ŀϸ + ĿϢĿơȨΪ
      • +
      • ť
      • +
      +
      +
      + 4.ɾĿ + +
      +
      +  ûɾ״̬Ŀ + +
        +
      • ѡҳʱĿ ȫ ѡ
      • +
      • ҪɾĿı༭ť
      • +
      • +
      • ҳ²Ŀϸ + ĿɾɣɾΪ
      • +
      • ɾ ť
      • +
      • ɾͨ δύ״̬Ŀɾ״̬Ŀ־Ϊɾδύ״̬
      • +
      +
      +
      + 5.ɾĿύ + +
      +
      +  ûԶ δύ ɾδύ ״̬Ŀύ + +
        +
      • ĿбһеĸѡѡĿбδύ ɾδύ ״̬ĴύĿ
      • +
      • Ŀб±ߵĿύť
      • +
      • ѡеĿ״̬Ϊύ״̬
      • +
      • +
      + +
      +
      + 6.Ŀύ + +
      +
      +  ûԶ Ŀѷ䡢ͨ δͨ ״̬Ŀύ + +
        +
      • ༭ĿĽȱ༭ť
      • +
      • ĿϢɰٷֱִ˵ϴҪĵ
      • +
      • ť޸ĵϢ
      • +
      • ¶ύťύĿȡ
      • +
      • ҲύĿȣĿбһеĸѡѡҪύĿĿб±ߵĿύť
      • +
      • ύĿ¶״̬ıΪ¶ύ
      • +
      + +
      + رʾ
      +
      +
      +
    • + + diff --git a/ug/Project/.svn/text-base/ProjectsQuery.html.svn-base b/ug/Project/.svn/text-base/ProjectsQuery.html.svn-base new file mode 100644 index 0000000..d15f9b8 --- /dev/null +++ b/ug/Project/.svn/text-base/ProjectsQuery.html.svn-base @@ -0,0 +1,34 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûЧ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • ЧԱŵĿбĿϸ
      • +
      +
      + ˵

      + Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • ʾżԱбԶĿбԱŵвԴʾ
      • +
      • ҲĿб֣沿ʾǰѡʱڵĿ÷ֻܡбťĿϸб沿ʾ
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾѷҳĿб½ʾֵҳϢ
        +
      • +
      +
      +
      + رʾ
      +
        +
      • +
      + + diff --git a/ug/Project/.svn/text-base/WorkPlanMain.html.svn-base b/ug/Project/.svn/text-base/WorkPlanMain.html.svn-base new file mode 100644 index 0000000..bafac70 --- /dev/null +++ b/ug/Project/.svn/text-base/WorkPlanMain.html.svn-base @@ -0,0 +1,63 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûԼ¼ճδ칤š˵ȡ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • +
      • ־б
      • +
      • ־༭
      • +
      +
      +

      ˵

      +
      + + 1.Ŀ +
        +
      • ѡĿڡ +
      • ±Զʾ־Ŀ +
      + + 2.Ŀ +
        +
      • ѡо +
      • ¼ ť +
      • ڱ༭־Ŀı;ˡ +
      • +
      + + + 3.ɾĿ +
        +
      • ҪɾĿť +
      • ϵͳȷǷҪɾȷĿɾ +
      + + + 4.༭Ŀ +
        +
      • Ҫ༭Ŀť
      • +
      • Ŀϸʾڱ༭
      • +
      • ༭ɺ󣬵 ťɶԸĿ޸ġ +
      + +
      + رʾ +
      +
      +
        +
      • ͺĿбڸ +ʾ +
      • +
      • ĿɾҲһɾµĿʹһ +
      • +
      + + diff --git a/ug/Project/.svn/text-base/WorkReport.html.svn-base b/ug/Project/.svn/text-base/WorkReport.html.svn-base new file mode 100644 index 0000000..65d86f9 --- /dev/null +++ b/ug/Project/.svn/text-base/WorkReport.html.svn-base @@ -0,0 +1,53 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳùܽϴֱԱĹܽ鿴

      +

      ҳ϶·Ϊ鹦

      +
        +
      • ܽϴѯ
      • +
      • ܽб
      • +
      +
      + ˵

      + 1.ܽϴ
      +
        +
      • ѡIJšܽͣϴĵļҪ˵
      • +
      • ťѡҪϴļϴťϴ
        +
      • +
      +
      + 2.ܽѯ
      +
        +
      • ѡIJšܽ
      • +
      • ѯť
        +
      • +
      • ѯԼϴĹܽἰѡŵֱĹܽᡣ
      • +
      +
      + 3.ܽ༭
      +
        +
      • ĿбҲı༭λ༭ťťɾϴĹܽᣬҲťڲ鿴ܽᡣ
      • +
      +
      +
      +4.Ŀϴ

      +

      +
        +
      • Ŀϴ򣬵ťѡϴExcelļȷ
      • +
      • ϴĿťϴ
      • +
      +
      +
      + رʾ
      +
        +
      • ɾֻɾԼϴĹܽᡣ
      • +
      + + diff --git a/ug/Project/ProjectApprove.html b/ug/Project/ProjectApprove.html new file mode 100644 index 0000000..630f4fa --- /dev/null +++ b/ug/Project/ProjectApprove.html @@ -0,0 +1,63 @@ + + + + + +ϵͳ + + +

      ˵
      +
      +
      ҳûĿҳ棬ɽĿ׼

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • Ŀб
      • +
      • Ŀϸ༭
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾĿб½ʾǰҳ
        +
      • +
      +
      +2.
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ༭ťĿڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿȵϸϢ
        +
      • +
      • ͨ ťĿͨ ťĿδͨ
        +
      • +
      + +
      +2.ɾĿ
      +
        +
      • ĿҲ༭λť
      • +
      • Ŀڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
      • +
      • +
      • Ŀͨ ͨ ťĿδͨ ť
        +
      • +
      + +
      +2.Ŀ
      +
        +
      • ĿҲ༭λť
      • +
      • Ŀڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
      • +
      • +
      • Ŀͨ ͨ ťĿδͨ ť
        +
      • +
      +
      + رʾ
      +
        + +
      • Ϊ +
      • ûͨģĿظĿˡ +
      + + diff --git a/ug/Project/ProjectCenter.html b/ug/Project/ProjectCenter.html new file mode 100644 index 0000000..62cb6e3 --- /dev/null +++ b/ug/Project/ProjectCenter.html @@ -0,0 +1,52 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳĿϢϴĿ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • ĿĿˡԱŵĿбĿϸ
      • +
      • Ŀϴ
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • ʾIJżԱбԶĿбԱŵԱԴʾûʾҲ޷ʹĿܡ
      • +
      • Ŀѯ޶Ŀƽвѯ
      • +
      • Ĭÿҳʾ20ĿϢ20ҳʾĿб½ʾǰҳ
      • +

      • +
      • +
      +
      + 2.鿴Ŀϸ
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ťĿѡ״̬ҳϳʸʾ״̬ҳ²ָĿȵϸϢ
        +
      • +
      • ԶĿб༭
      • +
      +
      +
      +3.Ŀϴ

      +

      +
        +
      • Ŀϴ򣬵ťѡϴExcelļȷ
      • +
      • ϴĿťϴ
      • +
      +
      +
      + رʾ
      +
        +
      • ĿϴExcelĵغʵ
      • +
      + + diff --git a/ug/Project/ProjectMain.html b/ug/Project/ProjectMain.html new file mode 100644 index 0000000..dc0ee21 --- /dev/null +++ b/ug/Project/ProjectMain.html @@ -0,0 +1,103 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûĿҳ棬ɽĿ¡롢ɾ롢¶ύȲ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • Ŀб
      • +
      • Ŀϸ༭
      • +
      +
      + ˵

      + 1.Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾĿб½ʾǰҳ
        +
      • +
      +
      + 2.Ŀ༭
      +
        +
      • ĿбҲı༭λ༭ťťʾǰĿĻϢҲťʾĿϢ
      • +
      • ༭ťĿڱ༭״̬ҳϳʸʾ״̬ҳ²ָĿϸϢ
        +
      • +
      • Ŀδύ״̬£ԶĿ޸ġɾĿ¶δύ״̬¿ԶĿϸб༭
      • +
      • 水ťԱ޸
      • +
      +
      +
      +3.Ŀ

      +
      +  ûڵǰѡĿ

      +
      +
        +
      • ѡҳʱĿ ȫ ѡ
      • +
      • ť
      • +
      • ҳ²Ŀϸ + ĿϢĿơȨΪ
      • +
      • ť
      • +
      +
      +
      + 4.ɾĿ + +
      +
      +  ûɾ״̬Ŀ + +
        +
      • ѡҳʱĿ ȫ ѡ
      • +
      • ҪɾĿı༭ť
      • +
      • +
      • ҳ²Ŀϸ + ĿɾɣɾΪ
      • +
      • ɾ ť
      • +
      • ɾͨ δύ״̬Ŀɾ״̬Ŀ־Ϊɾδύ״̬
      • +
      +
      +
      + 5.ɾĿύ + +
      +
      +  ûԶ δύ ɾδύ ״̬Ŀύ + +
        +
      • ĿбһеĸѡѡĿбδύ ɾδύ ״̬ĴύĿ
      • +
      • Ŀб±ߵĿύť
      • +
      • ѡеĿ״̬Ϊύ״̬
      • +
      • +
      + +
      +
      + 6.Ŀύ + +
      +
      +  ûԶ Ŀѷ䡢ͨ δͨ ״̬Ŀύ + +
        +
      • ༭ĿĽȱ༭ť
      • +
      • ĿϢɰٷֱִ˵ϴҪĵ
      • +
      • ť޸ĵϢ
      • +
      • ¶ύťύĿȡ
      • +
      • ҲύĿȣĿбһеĸѡѡҪύĿĿб±ߵĿύť
      • +
      • ύĿ¶״̬ıΪ¶ύ
      • +
      + +
      + رʾ
      +
      +
      +
    • + + diff --git a/ug/Project/ProjectsQuery.html b/ug/Project/ProjectsQuery.html new file mode 100644 index 0000000..d15f9b8 --- /dev/null +++ b/ug/Project/ProjectsQuery.html @@ -0,0 +1,34 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûЧ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • Ŀʱ䷶Χ
      • +
      • ЧԱŵĿбĿϸ
      • +
      +
      + ˵

      + Ŀ
      +
        +
      • ҳ϶˵ĿʱĿĬֵΪǰꡢ¡ұߵ°ťԸıݵֵ·ݿԸı·ݵֵĿбӦʾ趨ꡢµĿб
      • +
      • ʾżԱбԶĿбԱŵвԴʾ
      • +
      • ҲĿб֣沿ʾǰѡʱڵĿ÷ֻܡбťĿϸб沿ʾ
      • +
      • Ĭÿҳʾ10ĿϢ10ҳʾѷҳĿб½ʾֵҳϢ
        +
      • +
      +
      +
      + رʾ
      +
        +
      • +
      + + diff --git a/ug/Project/WorkPlanMain.html b/ug/Project/WorkPlanMain.html new file mode 100644 index 0000000..bafac70 --- /dev/null +++ b/ug/Project/WorkPlanMain.html @@ -0,0 +1,63 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳûԼ¼ճδ칤š˵ȡ

      +

      ҳ϶·Ϊ鹦

      +
        +
      • +
      • ־б
      • +
      • ־༭
      • +
      +
      +

      ˵

      +
      + + 1.Ŀ +
        +
      • ѡĿڡ +
      • ±Զʾ־Ŀ +
      + + 2.Ŀ +
        +
      • ѡо +
      • ¼ ť +
      • ڱ༭־Ŀı;ˡ +
      • +
      + + + 3.ɾĿ +
        +
      • ҪɾĿť +
      • ϵͳȷǷҪɾȷĿɾ +
      + + + 4.༭Ŀ +
        +
      • Ҫ༭Ŀť
      • +
      • Ŀϸʾڱ༭
      • +
      • ༭ɺ󣬵 ťɶԸĿ޸ġ +
      + +
      + رʾ +
      +
      +
        +
      • ͺĿбڸ +ʾ +
      • +
      • ĿɾҲһɾµĿʹһ +
      • +
      + + diff --git a/ug/Project/WorkReport.html b/ug/Project/WorkReport.html new file mode 100644 index 0000000..65d86f9 --- /dev/null +++ b/ug/Project/WorkReport.html @@ -0,0 +1,53 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳùܽϴֱԱĹܽ鿴

      +

      ҳ϶·Ϊ鹦

      +
        +
      • ܽϴѯ
      • +
      • ܽб
      • +
      +
      + ˵

      + 1.ܽϴ
      +
        +
      • ѡIJšܽͣϴĵļҪ˵
      • +
      • ťѡҪϴļϴťϴ
        +
      • +
      +
      + 2.ܽѯ
      +
        +
      • ѡIJšܽ
      • +
      • ѯť
        +
      • +
      • ѯԼϴĹܽἰѡŵֱĹܽᡣ
      • +
      +
      + 3.ܽ༭
      +
        +
      • ĿбҲı༭λ༭ťťɾϴĹܽᣬҲťڲ鿴ܽᡣ
      • +
      +
      +
      +4.Ŀϴ

      +

      +
        +
      • Ŀϴ򣬵ťѡϴExcelļȷ
      • +
      • ϴĿťϴ
      • +
      +
      +
      + رʾ
      +
        +
      • ɾֻɾԼϴĹܽᡣ
      • +
      + + diff --git a/ug/desktop.html b/ug/desktop.html new file mode 100644 index 0000000..e8adb7d --- /dev/null +++ b/ug/desktop.html @@ -0,0 +1,36 @@ + + + + +ϵͳ + + + +˵

      + + +ҳû¼ϵͳҳ棬ڼʾ͵¼ûصϢ +֮¹֣ +
        +
      • ϵͳʾ ϸչʾûĿͿγϢ +
      • ־ƻ ʾûƶ¼ĵԺĹƻ־ +
      • ϢϵͳϢ Ϣṩ޸ĵĹܡϵͳϢṩ˵ǰԱб +
      +
      +
      ˵

      +
      ޸ +
        +
      • Ϣ->޸ +
      • ԭ롢 +
      • ޸İť롣 +
      • ȡť޸ģԭ뽫Ч +
      +
      +رʾ

      +
        +
      • ޸ԭʧЧӰ쵱ǰỰ´ε¼ʱʹ趨롣 +
      • +ҳΪ֣ΪûȨбҲΪϵͳ¼йҳ涼Ǵ˲֣ҳ治ἰ +
      + + diff --git a/ug/login.html b/ug/login.html new file mode 100644 index 0000000..5e9e851 --- /dev/null +++ b/ug/login.html @@ -0,0 +1,30 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      +ҳϵͳĵ¼ҳ棬ϵͳûĵ¼Ϣ֤ʶûݵĺϷԣ֤ͨû¼ϵͳкȨƥҵ

      +
      + ˵
      +
      +
      + +
    • +û뼰֤룬¼ť +
    • ֤ͨûҳ档 +
    • ֤ʧ + ʾ û¼Ϣ롱 +
    • ȡťϵͳҳ + +
      +رʾ

      +
    • û֤벻ִСдϸִСд +
    • ֤ͼƬ˫ͼƬϵͳ漴µ֤롣 + + diff --git a/ug/nohelpdoc.html b/ug/nohelpdoc.html new file mode 100644 index 0000000..9a99317 --- /dev/null +++ b/ug/nohelpdoc.html @@ -0,0 +1,20 @@ + + + + +ϵͳ + + + + +ûҵӦİļ + + + diff --git a/ug/training/.svn/entries b/ug/training/.svn/entries new file mode 100644 index 0000000..dcb41e8 --- /dev/null +++ b/ug/training/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/ug/training +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +LessonView.html +file + + + + +2011-04-01T02:51:11.696127Z +7660e544ba7aa03c3f2f95d95eb00ec5 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +961 + +LessonCategory.html +file + + + + +2011-04-01T02:51:11.696127Z +3afcafed30ddda694abbe1abf15dadcd +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1893 + +Lesson.html +file + + + + +2011-04-01T02:51:11.711752Z +279e4a5315bf2909a44f82807f734e3e +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1878 + +LessonEmp.html +file + + + + +2011-04-01T02:51:11.727377Z +609986555c202cd2865f0a5f650ca089 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +1890 + diff --git a/ug/training/.svn/text-base/Lesson.html.svn-base b/ug/training/.svn/text-base/Lesson.html.svn-base new file mode 100644 index 0000000..b9cdf0a --- /dev/null +++ b/ug/training/.svn/text-base/Lesson.html.svn-base @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳѵγ̵ά

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµĿγ̽Ҳбʾ
      • +
      • Ҳγ̵ı༭λť
      • +
      • Ҳγбչʾÿγ̵ϸϢ
      • +

      • +
      • +
      +
      +2.γ
      +
        +
      • Ҳγбµ ¼ ť
      • +
      • ҪĿγϢγƣѧΪ
      • +
      • ť
      • +
      • γ̽Ĭϱڵǰѡγ֮¡
        +
      • +
      + +
      +2.γ޸
      +
        +
      • ÿγڱ༭״̬
      • +
      • ڱ༭ԸÿγϢҪı༭עγƲΪգγѧΪǸ
      • +
      • ť
        +
      • +
      + +
      +2.γɾ
      +
        +
      • ɾγҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/training/.svn/text-base/LessonCategory.html.svn-base b/ug/training/.svn/text-base/LessonCategory.html.svn-base new file mode 100644 index 0000000..064c5d9 --- /dev/null +++ b/ug/training/.svn/text-base/LessonCategory.html.svn-base @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳѵγά

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµ¼γҲбʾ
      • +
      • Ҳγı༭λť
      • +
      • ҲγбչʾÿγϸϢ
      • +

      • +
      • +
      +
      +2.γ
      +
        +
      • Ҳγбµ ¼ ť
      • +
      • ҪĿγϢ Ϊ
      • +
      • ť
      • +
      • γĬϱڵǰѡγ֮¡
        +
      • +
      + +
      +2.γ޸
      +
        +
      • ÿγڱ༭״̬
      • +
      • ڱ༭ԸÿγϢҪı༭ע𲻿Ϊա
      • +
      • ť
        +
      • +
      + +
      +2.γɾ
      +
        +
      • ɾγҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/training/.svn/text-base/LessonEmp.html.svn-base b/ug/training/.svn/text-base/LessonEmp.html.svn-base new file mode 100644 index 0000000..05cf91d --- /dev/null +++ b/ug/training/.svn/text-base/LessonEmp.html.svn-base @@ -0,0 +1,55 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڿγѧԱķ䡣

      +

      ҳҷΪ鹦

      +
        +
      • γб
      • +
      • Աб
      • +
      • γ̡Աϵͼ
      • +
      +
      +
      +
      + 1.ѧԱ
      +
        +
      • ѡγҪĿγ̽ڵ㣨֣
      • +
      • ѡ/ѡԱڵǰĸѡ򣬽ѡлȡѡѧԱ
      • +
      • ť޸ġ
        +
        +
      • +
      +2.γ̡Ա ϵͼ +
        +
      • ѡγбеĿγ̽ڵ㣬γԱ嵥 ʾӵиÿγ̵Ա嵥
      • +
      • ԱбеֵԱƣԱγ嵥 ʾԱĿγб
        +
        +
      • +
      +3.༭ѧԱĿγͨ +
        +
      • γԱ嵥ԶѧԱijɼб༭ +
          +
        • +
        • ѡ/ѡλĸѡ 趨ѧԱ/δɸÿγ
        • +
        • ޸ģ޸ġ
        • +
        +
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • ijγ̵ѧԱڸÿγ̵ѧԱ嵥ォѧԱƳ +
      + + diff --git a/ug/training/.svn/text-base/LessonView.html.svn-base b/ug/training/.svn/text-base/LessonView.html.svn-base new file mode 100644 index 0000000..5e1be4c --- /dev/null +++ b/ug/training/.svn/text-base/LessonView.html.svn-base @@ -0,0 +1,33 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳγб

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • γбϸ
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµĿγ̽Ҳбʾ
      • +
      • Ҳγ̵ı༭λť
      • +
      • Ҳγбչʾÿγ̵ϸϢ
        +
      • +
      +
      + رʾ
      +
        + +
      • +
      + + diff --git a/ug/training/Lesson.html b/ug/training/Lesson.html new file mode 100644 index 0000000..b9cdf0a --- /dev/null +++ b/ug/training/Lesson.html @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳѵγ̵ά

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµĿγ̽Ҳбʾ
      • +
      • Ҳγ̵ı༭λť
      • +
      • Ҳγбչʾÿγ̵ϸϢ
      • +

      • +
      • +
      +
      +2.γ
      +
        +
      • Ҳγбµ ¼ ť
      • +
      • ҪĿγϢγƣѧΪ
      • +
      • ť
      • +
      • γ̽Ĭϱڵǰѡγ֮¡
        +
      • +
      + +
      +2.γ޸
      +
        +
      • ÿγڱ༭״̬
      • +
      • ڱ༭ԸÿγϢҪı༭עγƲΪգγѧΪǸ
      • +
      • ť
        +
      • +
      + +
      +2.γɾ
      +
        +
      • ɾγҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/training/LessonCategory.html b/ug/training/LessonCategory.html new file mode 100644 index 0000000..064c5d9 --- /dev/null +++ b/ug/training/LessonCategory.html @@ -0,0 +1,60 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳѵγά

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµ¼γҲбʾ
      • +
      • Ҳγı༭λť
      • +
      • ҲγбչʾÿγϸϢ
      • +

      • +
      • +
      +
      +2.γ
      +
        +
      • Ҳγбµ ¼ ť
      • +
      • ҪĿγϢ Ϊ
      • +
      • ť
      • +
      • γĬϱڵǰѡγ֮¡
        +
      • +
      + +
      +2.γ޸
      +
        +
      • ÿγڱ༭״̬
      • +
      • ڱ༭ԸÿγϢҪı༭ע𲻿Ϊա
      • +
      • ť
        +
      • +
      + +
      +2.γɾ
      +
        +
      • ɾγҲ༭λť
      • +
      • ϵͳȷǷɾĶԻȷɾɾ
        +
      • +
      +
      + رʾ
      +
        + +
      • ɾһҪأɾݡ +
      + + diff --git a/ug/training/LessonEmp.html b/ug/training/LessonEmp.html new file mode 100644 index 0000000..05cf91d --- /dev/null +++ b/ug/training/LessonEmp.html @@ -0,0 +1,55 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳڿγѧԱķ䡣

      +

      ҳҷΪ鹦

      +
        +
      • γб
      • +
      • Աб
      • +
      • γ̡Աϵͼ
      • +
      +
      +
      +
      + 1.ѧԱ
      +
        +
      • ѡγҪĿγ̽ڵ㣨֣
      • +
      • ѡ/ѡԱڵǰĸѡ򣬽ѡлȡѡѧԱ
      • +
      • ť޸ġ
        +
        +
      • +
      +2.γ̡Ա ϵͼ +
        +
      • ѡγбеĿγ̽ڵ㣬γԱ嵥 ʾӵиÿγ̵Ա嵥
      • +
      • ԱбеֵԱƣԱγ嵥 ʾԱĿγб
        +
        +
      • +
      +3.༭ѧԱĿγͨ +
        +
      • γԱ嵥ԶѧԱijɼб༭ +
          +
        • +
        • ѡ/ѡλĸѡ 趨ѧԱ/δɸÿγ
        • +
        • ޸ģ޸ġ
        • +
        +
        +
        +
      • +
      +
      +رʾ
      +
        + +
      • ijγ̵ѧԱڸÿγ̵ѧԱ嵥ォѧԱƳ +
      + + diff --git a/ug/training/LessonView.html b/ug/training/LessonView.html new file mode 100644 index 0000000..5e1be4c --- /dev/null +++ b/ug/training/LessonView.html @@ -0,0 +1,33 @@ + + + + +ϵͳ + + + +

      ˵
      +
      +
      ҳγб

      +

      ҳҷΪ鹦

      +
        +
      • γ״ͼ
      • +
      • γбϸ
      • +
      +
      + ˵

      + 1.γ
      +
        +
      • γڵ㣬ýڵµĿγ̽Ҳбʾ
      • +
      • Ҳγ̵ı༭λť
      • +
      • Ҳγбչʾÿγ̵ϸϢ
        +
      • +
      +
      + رʾ
      +
        + +
      • +
      + + diff --git a/upload/.svn/entries b/upload/.svn/entries new file mode 100644 index 0000000..18480af --- /dev/null +++ b/upload/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +8 +file:///D:/Repositories/ZhangPu/trunk/view/upload +file:///D:/Repositories/ZhangPu + + + +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + +69712cd5-45d9-e244-acd6-b3e9c1159652 + +fileUpload.aspx.cs +file + + + + +2011-04-01T02:51:01.430436Z +35013f8b22e2207ba2aa9ae45c149c85 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +3543 + +projects +dir + +fileUpload.aspx +file + + + + +2011-04-01T02:51:01.430436Z +27868df699c4201e78fd79558f5db0d8 +2011-03-31T02:53:16.230701Z +2 +mwang + + + + + + + + + + + + + + + + + + + + + +3154 + diff --git a/upload/.svn/text-base/fileUpload.aspx.cs.svn-base b/upload/.svn/text-base/fileUpload.aspx.cs.svn-base new file mode 100644 index 0000000..23269c1 --- /dev/null +++ b/upload/.svn/text-base/fileUpload.aspx.cs.svn-base @@ -0,0 +1,101 @@ +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.IO; +using System.Text; +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 ZhangPu.Gov.Logical; + +public partial class upload_fileUpload : PagePublic +{ + private string fileType =""; + private string fileCode = ""; + private string fileInfo = ""; + private string empid=""; + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void btnSubmit_Click(object sender, EventArgs e) + { + getParameters(); + try + { + if (fileUpload1.FileName.Length == 0) return; + lbuploadmessage.Text = ""; + string fileName = fileUpload1.FileName; + + System.Random rand = new Random(); + int len = rand.Next(); + fileName = empid + "T" + fileType + len + + fileName.Substring(fileName.LastIndexOf(".")); + DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/upload/"+fileType )); + if (!dir.Exists) + dir.Create(); + string fileSavePath = Server.MapPath("~/upload/" + fileType+"/" + fileName); + fileUpload1.SaveAs(fileSavePath); + lbuploadmessage.Text = "上传成功!"; + + LFile _logic = new LFile(); + _logic.Initialize(); + _logic.GetFilesmgrExt.File_type = Convert.ToInt32(fileType); + _logic.GetFilesmgrExt.file_dest = fileName; + _logic.GetFilesmgrExt.File_Desc = txtFileDesc.Text; + _logic.GetFilesmgrExt.File_Emp = Convert.ToInt32(empid);   + if (fileType.Equals(((int)Tracen.Utils.FileType.Project).ToString())) + _logic.GetFilesmgrExt.File_Project = Convert.ToInt32(fileInfo); + if (fileType.Equals(((int)Tracen.Utils.FileType.ProjectDetail).ToString())) + _logic.GetFilesmgrExt.File_ProjectDetail = Convert.ToInt32(fileInfo); + _logic.GetFilesmgrExt.Add(); + + closewindow(); + + } + catch (Exception er) + { + + lbuploadmessage.Text = "上传失败!"; + } + } + + void closewindow() + { + StringBuilder strResponse = new StringBuilder(); + strResponse.Append(" + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + 辣得叫库房任务看板 +

      + + + +   + + + + + + +
      + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + + + + + + + +
      + + +
      + +
      +
      + + + +
      + + + + diff --git a/wms/Charts - 副本 (3).aspx.exclude b/wms/Charts - 副本 (3).aspx.exclude new file mode 100644 index 0000000..909f848 --- /dev/null +++ b/wms/Charts - 副本 (3).aspx.exclude @@ -0,0 +1,652 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Charts.aspx.cs" Inherits="wms_Charts" %> + +<%@ Register assembly="DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dx" %> +<%@ Register assembly="DevExpress.XtraCharts.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + +
      + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + 辣得叫库房任务看板 +
      +
      +

      + + + +   + + + + + + + + + +
      + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + +   + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      +
      + + + + + + + + +
      + + +
      + +
      +
      + + + +
      +
      + + + diff --git a/wms/Charts - 副本 (4).aspx.exclude b/wms/Charts - 副本 (4).aspx.exclude new file mode 100644 index 0000000..a50e432 --- /dev/null +++ b/wms/Charts - 副本 (4).aspx.exclude @@ -0,0 +1,727 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Charts.aspx.cs" Inherits="wms_Charts" %> + +<%@ Register assembly="DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dx" %> +<%@ Register assembly="DevExpress.XtraCharts.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + +
      + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + 辣得叫库房任务看板 +
      +
      +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + +   + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      +
      + + + + + + + + +
      + + +
      + +
      +
      + + + +
      +
      + + + diff --git a/wms/Charts - 副本.aspx.exclude b/wms/Charts - 副本.aspx.exclude new file mode 100644 index 0000000..990a37b --- /dev/null +++ b/wms/Charts - 副本.aspx.exclude @@ -0,0 +1,389 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Charts.aspx.cs" Inherits="wms_Charts" %> + +<%@ Register assembly="DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dx" %> +<%@ Register assembly="DevExpress.XtraCharts.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + +
      + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + +
      + + +

      + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + + + + + + + +
      + + +
      + +
      +
      + + + +
      +
      + + + diff --git a/wms/Charts.aspx b/wms/Charts.aspx new file mode 100644 index 0000000..b85a779 --- /dev/null +++ b/wms/Charts.aspx @@ -0,0 +1,751 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Charts.aspx.cs" Inherits="wms_Charts" %> + +<%@ Register assembly="DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dx" %> +<%@ Register assembly="DevExpress.XtraCharts.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + +
      + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + +
      +
      + 得牛WMS任务看板 + +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + +
      +
      + + + diff --git a/wms/Charts.aspx - 副本.cs b/wms/Charts.aspx - 副本.cs new file mode 100644 index 0000000..1f9d4cd --- /dev/null +++ b/wms/Charts.aspx - 副本.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.Security; + +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using DeiNiu.Utils; +using DeiNiu.wms.Logical; +using DevExpress.XtraCharts; +using System.Data; + + +public partial class wms_Charts : System.Web.UI.Page +{ + DataSet ds; + lCharts lchart = new lCharts(); + protected void Page_Load(object sender, EventArgs e) + { + loadData(); + } + + void loadData() + { + ds = lchart.getDailyKanBanData(); + setTasks(); + setLocs(); + setUserTasks(); + } + + + void setLocs() + { + + + DataTable dt = ds.Tables[2]; + + Series taskSeries = this.webChartLocs.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["totalCnt"].ToString()))); + + } + Series finishedSeries = webChartLocs.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["usedCnt"].ToString()))); + + } + + } + void setUserTasks() + { + + DataTable dt = ds.Tables[1]; + + Series taskSeries = this.webChartEmpTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["emName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + + } + void setTasks() + { + DataTable dt = ds.Tables[0]; + + Series taskSeries = this.WebChartTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + Series finishedSeries = WebChartTasks.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString()))); + + } + + + + } + protected void btnSubmit_Click(object sender, EventArgs e) + { + // loadData();// Page_Load(sender, e); + } +} \ No newline at end of file diff --git a/wms/Charts.aspx.cs b/wms/Charts.aspx.cs new file mode 100644 index 0000000..e188ed1 --- /dev/null +++ b/wms/Charts.aspx.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.Security; + +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using DeiNiu.Utils; +using DeiNiu.wms.Logical; +using DevExpress.XtraCharts; +using System.Data; + + +public partial class wms_Charts : System.Web.UI.Page +{ + DataSet dsDaily; + DataSet dsErpOrders; + lCharts lchart = new lCharts(); + protected void Page_Load(object sender, EventArgs e) + { + loadDailyData(); + + loadErpData(); + } + + private void loadErpData() + { + dsErpOrders = lchart.getErpOderData(); + + //set erp in orders pie + + DataTable dt = dsErpOrders.Tables[0]; + + Series taskSeries = WebChartInOrders.SeriesSerializable[0]; + + //Series taskSeries2 = this.WebChartErpOrders.SeriesSerializable[0]; + //taskSeries2.Points.Clear(); + + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + // taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + + } + //set erp out orders pie + dt = dsErpOrders.Tables[1]; + + taskSeries = WebChartOutOrders.SeriesSerializable[0]; + // taskSeries2 = this.WebChartErpOrders.SeriesSerializable[1]; + taskSeries.Points.Clear(); + //taskSeries2.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + // taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + } + + + + + // in out line counts + + string day = ""; + dt = dsErpOrders.Tables[2]; + + taskSeries = WebChartInOutLines.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString()); + taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString()))); + + } + + + + dt = dsErpOrders.Tables[3]; + + taskSeries = WebChartInOutLines.SeriesSerializable[1]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString()); + taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString()))); + + } + + + + } + + void loadDailyData() + { + dsDaily = lchart.getDailyKanBanData(); + setTasks(); + setLocs(); + setUserTasks(); + setTasksSumByStatePie(); + setPartTasks(); + } + + private void setTasksSumByStatePie() + { + + + DataTable dt = dsDaily.Tables[3]; + + Series taskSeries = WebChartStatePie.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + } + + + void setLocs() + { + + + DataTable dt = dsDaily.Tables[2]; + + Series taskSeries = WebChartLocs.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + // taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["totalCnt"].ToString()))); + taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), dr["usedPercent"].ToString()) ); + + } + /* + Series finishedSeries = this.WebChartLocs.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["usedCnt"].ToString()))); + + } + */ + + + } + void setUserTasks() + { + + DataTable dt = dsDaily.Tables[1]; + + Series taskSeries = WebChartEmpTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["emName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + + } + void setTasks() + { + DataTable dt = dsDaily.Tables[0]; + + Series taskSeries = this.WebChartTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + Series finishedSeries = WebChartTasks.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString()))); + + } + + + + } + void setPartTasks() + { + DataTable dt = dsDaily.Tables[4]; + + Series taskSeries = this.WebChartPartTasks .SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + Series finishedSeries = WebChartPartTasks.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString()))); + + } + + + + } + protected void btnSubmit_Click(object sender, EventArgs e) + { + // loadData();// Page_Load(sender, e); + } + protected void WebChartEmpTasks_ObjectSelected(object sender, HotTrackEventArgs e) + { + + } + protected void Button1_Click(object sender, EventArgs e) + { + + loadDailyData(); + + loadErpData(); + } +} \ No newline at end of file diff --git a/wms/ChartsNew.aspx b/wms/ChartsNew.aspx new file mode 100644 index 0000000..65dd6b3 --- /dev/null +++ b/wms/ChartsNew.aspx @@ -0,0 +1,749 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ChartsNew.aspx.cs" Inherits="wms_Charts" %> + +<%@ Register assembly="DevExpress.XtraCharts.v16.2.Web, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dx" %> +<%@ Register assembly="DevExpress.XtraCharts.v16.2, Version=16.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> + + + + + + + + + +
      + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + +
      +
      + 得牛WMS任务看板 + +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <Margins Bottom="0" Left="0" Right="0" Top="0" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + +
      +
      + + + diff --git a/wms/ChartsNew.aspx.cs b/wms/ChartsNew.aspx.cs new file mode 100644 index 0000000..c2b44f2 --- /dev/null +++ b/wms/ChartsNew.aspx.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.Security; + +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using DeiNiu.Utils; +using DeiNiu.wms.Logical; +using DevExpress.XtraCharts; +using System.Data; + + +public partial class wms_Charts : System.Web.UI.Page +{ + DataSet dsDaily; + DataSet dsErpOrders; + lCharts lchart = new lCharts(); + protected void Page_Load(object sender, EventArgs e) + { + loadDailyData(); + + loadErpData(); + } + + private void loadErpData() + { + dsErpOrders = lchart.getErpOderData(); + + //set erp in orders pie + + DataTable dt = dsErpOrders.Tables[0]; + + Series taskSeries = WebChartInOrders.SeriesSerializable[0]; + + //Series taskSeries2 = this.WebChartErpOrders.SeriesSerializable[0]; + //taskSeries2.Points.Clear(); + + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + // taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + + } + //set erp out orders pie + dt = dsErpOrders.Tables[1]; + + taskSeries = WebChartOutOrders.SeriesSerializable[0]; + // taskSeries2 = this.WebChartErpOrders.SeriesSerializable[1]; + taskSeries.Points.Clear(); + //taskSeries2.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + // taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString()))); + } + + + + + // in out line counts + + string day = ""; + dt = dsErpOrders.Tables[2]; + + taskSeries = WebChartInOutLines.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString()); + taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString()))); + + } + + + + dt = dsErpOrders.Tables[3]; + + taskSeries = WebChartInOutLines.SeriesSerializable[1]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString()); + taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString()))); + + } + + + + } + + void loadDailyData() + { + dsDaily = lchart.getDailyKanBanData(); + setTasks(); + setLocs(); + setUserTasks(); + setTasksSumByStatePie(); + setPartTasks(); + } + + private void setTasksSumByStatePie() + { + + + DataTable dt = dsDaily.Tables[3]; + + Series taskSeries = WebChartStatePie.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + } + + + void setLocs() + { + + + DataTable dt = dsDaily.Tables[2]; + + Series taskSeries = WebChartLocs.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + // taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["totalCnt"].ToString()))); + taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), dr["usedPercent"].ToString()) ); + + } + /* + Series finishedSeries = this.WebChartLocs.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["usedCnt"].ToString()))); + + } + */ + + + } + void setUserTasks() + { + + DataTable dt = dsDaily.Tables[1]; + + Series taskSeries = WebChartEmpTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["emName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + + } + void setTasks() + { + DataTable dt = dsDaily.Tables[0]; + + Series taskSeries = this.WebChartTasks.SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + Series finishedSeries = WebChartTasks.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString()))); + + } + + + + } + void setPartTasks() + { + DataTable dt = dsDaily.Tables[4]; + + Series taskSeries = this.WebChartPartTasks .SeriesSerializable[0]; + + taskSeries.Points.Clear(); + + foreach (DataRow dr in dt.Rows) + { + taskSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString()))); + + } + + Series finishedSeries = WebChartPartTasks.SeriesSerializable[1]; + + finishedSeries.Points.Clear(); + foreach (DataRow dr in dt.Rows) + { + finishedSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString()))); + + } + + + + } + protected void btnSubmit_Click(object sender, EventArgs e) + { + // loadData();// Page_Load(sender, e); + } + protected void WebChartEmpTasks_ObjectSelected(object sender, HotTrackEventArgs e) + { + + } +} \ No newline at end of file diff --git a/wms/GoodIn.aspx b/wms/GoodIn.aspx new file mode 100644 index 0000000..5e6247e --- /dev/null +++ b/wms/GoodIn.aspx @@ -0,0 +1,16 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/masterPage.master" AutoEventWireup="true" CodeFile="GoodIn.aspx.cs" Inherits="wms_GoodIn" %> + + + + + + + + + + + + + + + diff --git a/wms/GoodIn.aspx.cs b/wms/GoodIn.aspx.cs new file mode 100644 index 0000000..24bed7b --- /dev/null +++ b/wms/GoodIn.aspx.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class wms_GoodIn : PageBase +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} \ No newline at end of file