Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            if (this.IsRestore)
            {
                ArrayList modifiedControls = new ArrayList();
                foreach (string key in PostData.AllKeys)
                {
                    System.Web.UI.Control control = FindControl(key);
                    if (control is IPostBackDataHandler)
                    {
                        if (((IPostBackDataHandler)control).LoadPostData(key, PostData))
                        {
                            modifiedControls.Add(control);
                        }
                    }
                }
                // 发生 PostDataChanged 事件在所有已变动的控件上:
                foreach (IPostBackDataHandler control in modifiedControls)
                {
                    control.RaisePostDataChangedEvent();
                }
            }
            base.OnLoad(e);
            string headerStr = "<script type=\"text/javascript\" src=\"../js/AjaxHelper.js\"></script><script type='text/javascript'>\nfunction ResetShortcutMenu(){window.parent.LoadShortcutMenu();}\nfunction FavoriteFunction(url){\nAjaxHelper.Updater('../UserControls/favoritefunction','resultmessage','url='+url,ResetShortcutMenu);\n}\n</script>\n";

            headerStr += "<div align='right' style=''>";
            //获取当前页面在收藏夹中的状态
            FavoriteStatus status = GetFavoriteStatus();

            //根据当前页面收藏夹状态生成收藏快捷操作的链接
            if (status != FavoriteStatus.Hidden)
            {
                if (status == FavoriteStatus.Exist)
                {
                    headerStr += headerStr += "<span id='resultmessage' title='已经将该页面加入到快捷操作菜单中'><img src='../images/existmenu.gif' style='vertical-align:middle' /> 已经收藏</span>";
                }
                else if (status == FavoriteStatus.Full)
                {
                    headerStr += headerStr += "<span id='resultmessage' title='快捷操作菜单最大收藏数为" + MaxShortcutMenuCount + "项'><img src='../images/fullmenu.gif' style='vertical-align:middle' /> 收藏已满</span>\n</b>";
                }
                else if (status == FavoriteStatus.Show)
                {
                    headerStr += "<span align='right' id='resultmessage'>\n<a href='javascript:void(0);' title='将该页面加入快捷操作菜单' onclick='FavoriteFunction(window.location.pathname.toLowerCase().replace(\"" + BaseConfigs.GetForumPath + "admin/\",\"\") + window.location.search.toLowerCase());' style='text-decoration:none;color:#333;' onfocus=\"this.blur();\"><img src='../images/addmenu.gif' align='absmiddle' /> 加入常用功能</a>\n</span>";
                }
            }
            if (AllowShowNavigation)
            {
                headerStr += "<span><a href='javascript:void(0);' onclick='window.parent.showNavigation()' title='按ESC键或点击链接显示导航菜单' style='text-decoration:none;color:#333;'><img src='../images/navigation.gif' style='vertical-align:middle'> 管理导航</a></span>";
            }
            headerStr += "</div>";
#if NET1
            this.RegisterClientScriptBlock("Form1", headerStr);
#else
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Form1", headerStr);
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Navigation", "<script type='text/javascript'>if(document.documentElement.addEventListener){document.documentElement.addEventListener('keydown', window.parent.resetEscAndF5, false);}else if(document.documentElement.attachEvent){document.documentElement.attachEvent('onkeydown', window.parent.resetEscAndF5);}</script>");
#endif
        }
Beispiel #2
0
        protected override void OnLoad(EventArgs e)
        {
            if (this.IsRestore)
            {
                ArrayList arrayList = new ArrayList();
                string[]  allKeys   = this.PostData.AllKeys;
                for (int i = 0; i < allKeys.Length; i++)
                {
                    string text    = allKeys[i];
                    var    control = this.FindControl(text);
                    if (control is IPostBackDataHandler && ((IPostBackDataHandler)control).LoadPostData(text, this.PostData))
                    {
                        arrayList.Add(control);
                    }
                }
                foreach (IPostBackDataHandler postBackDataHandler in arrayList)
                {
                    postBackDataHandler.RaisePostDataChangedEvent();
                }
            }
            base.OnLoad(e);
            string text2 = "<script type=\"text/javascript\" src=\"../js/AjaxHelper.js\"></script><script type='text/javascript'>\nfunction ResetShortcutMenu(){window.parent.LoadShortcutMenu();}\nfunction FavoriteFunction(url){\nAjaxHelper.Updater('../UserControls/favoritefunction','resultmessage','url='+url,ResetShortcutMenu);\n}\n</script>\n";

            text2 += "<div align='right' style=''>";
            FavoriteStatus favoriteStatus = this.GetFavoriteStatus();

            if (favoriteStatus != FavoriteStatus.Hidden)
            {
                if (favoriteStatus == FavoriteStatus.Exist)
                {
                    text2 += text2 + "<span id='resultmessage' title='已经将该页面加入到快捷操作菜单中'><img src='../images/existmenu.gif' style='vertical-align:middle' /> 已经收藏</span>";
                }
                else
                {
                    if (favoriteStatus == FavoriteStatus.Full)
                    {
                        string arg_12B_0 = text2;
                        object obj       = text2;
                        text2 = arg_12B_0 + obj + "<span id='resultmessage' title='快捷操作菜单最大收藏数为" + 15 + "项'><img src='../images/fullmenu.gif' style='vertical-align:middle' /> 收藏已满</span>\n</b>";
                    }
                    else
                    {
                        if (favoriteStatus == FavoriteStatus.Show)
                        {
                            text2 = text2 + "<span align='right' id='resultmessage'>\n<a href='javascript:void(0);' title='将该页面加入快捷操作菜单' onclick='FavoriteFunction(window.location.pathname.toLowerCase().replace(\"" + BaseConfigs.GetForumPath + "admin/\",\"\") + window.location.search.toLowerCase());' style='text-decoration:none;color:#333;' onfocus=\"this.blur();\"><img src='../images/addmenu.gif' align='absmiddle' /> 加入常用功能</a>\n</span>";
                        }
                    }
                }
            }
            if (this.AllowShowNavigation)
            {
                text2 += "<span><a href='javascript:void(0);' onclick='window.parent.showNavigation()' title='按ESC键或点击链接显示导航菜单' style='text-decoration:none;color:#333;'><img src='../images/navigation.gif' style='vertical-align:middle'> 管理导航</a></span>";
            }
            text2 += "</div>";
            base.ClientScript.RegisterClientScriptBlock(base.GetType(), "Form1", text2);
            base.ClientScript.RegisterClientScriptBlock(base.GetType(), "Navigation", "<script type='text/javascript'>if(document.documentElement.addEventListener){document.documentElement.addEventListener('keydown', window.parent.resetEscAndF5, false);}else if(document.documentElement.attachEvent){document.documentElement.attachEvent('onkeydown', window.parent.resetEscAndF5);}</script>");
        }
Beispiel #3
0
        private FavoriteStatus GetFavoriteStatus()
        {
            var mapPath = Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "admin/xml/navmenu.config");
            var url     = Request.Url.ToString().ToLower();

            url = url.Substring(url.LastIndexOf('/') + 1);

            var doc = new XmlDocument();

            doc.Load(mapPath);
            var  xmlNodeList = doc.SelectNodes("/dataset/submain");
            bool flag        = false;

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                if (xmlNode.SelectSingleNode("link").InnerText.IndexOf('/') != -1 && xmlNode.SelectSingleNode("link").InnerText.Split('/')[1].ToLower() == url)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                return(FavoriteStatus.Hidden);
            }
            var xmlNodeList2 = doc.SelectNodes("/dataset/shortcut");

            foreach (XmlNode xmlNode2 in xmlNodeList2)
            {
                if (xmlNode2.SelectSingleNode("link").InnerText.IndexOf(url) != -1)
                {
                    FavoriteStatus result = FavoriteStatus.Exist;
                    return(result);
                }
            }
            if (xmlNodeList2.Count >= 15)
            {
                return(FavoriteStatus.Full);
            }
            return(FavoriteStatus.Show);
        }