Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.CheckFlags();

            //update the flag links to point to the current page with a new language setting
            lnkLangEnglish.NavigateUrl    = this.Request.Url.AbsolutePath + "?lang=en";
            lnkLangSpanish.NavigateUrl    = this.Request.Url.AbsolutePath + "?lang=es";
            lnkLangPortuguese.NavigateUrl = this.Request.Url.AbsolutePath + "?lang=pt";
            lnkLangJapanese.NavigateUrl   = this.Request.Url.AbsolutePath + "?lang=ja";


            if (((WebPage)this.Page).Locale == Locales.Japan)
            {
                //turn on sans-serif for japanese
                divMaster.Attributes["class"] = "Master Japanese";
            }
            else
            {
                divMaster.Attributes["class"] = "Master";
            }
            //TODO: show warning if cookies not enabled
            //(Must be done via reload)


            //Show editing info if admin is logged in
            if (AdminUtil.IsAdminLoggedIn())
            {
                plhAdmin.Visible = true;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //toggle admin panel if logged in
            if (AdminUtil.IsAdminLoggedIn())
            {
                plhAdmin.Visible = true;
            }

            //toggle link buttons if they aren't used
            switch (((TradingWebPage)this.Page).PageName)
            {
            case TradingPages.Contact:
                divLnkContact.Attributes["class"] = divLnkContact.Attributes["class"] + " Deactive";
                lnkContact.NavigateUrl            = "";
                break;

            case TradingPages.Home:
                divLnkHome.Attributes["class"] = divLnkHome.Attributes["class"] + " Deactive";
                lnkHome.NavigateUrl            = "";
                break;
            }

            //handle any flag clicks
            this.CheckFlags();


            //update the flag links to point to the current page with a new language setting
            lnkLangEnglish.NavigateUrl    = this.Request.Url.AbsolutePath + "?lang=en";
            lnkLangPortuguese.NavigateUrl = this.Request.Url.AbsolutePath + "?lang=pt";
            lnkLangJapanese.NavigateUrl   = this.Request.Url.AbsolutePath + "?lang=ja";
        }
Ejemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //NOTE: the following is too tightly bound to be generic

            //--> probably should occur as an extension or something
            //the solution would be to have some delegate be called in the base
            //webpage that does some action in this initialise

            //bind this event to the base page event handler
            this.OnSubmit += new EventHandler(((WebPage)this.Page).DynamicEdit_Submit);

            this.EditingActive = AdminUtil.IsAdminLoggedIn();

            //this is required for a UserControl (handled by custom control though)
            if (!_hasFirst)
            {
                //set this as the first instance of the control in the page
                _isFirst  = true;
                _hasFirst = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //5es" element for this page
            string filename = ResourceManager.GetCurrentFilename();

            Document = new XmlDocument();
            Document.PreserveWhitespace = true;

            Document.Load(filename);

            XmlNodeList list = Document.SelectNodes("Resource/pages[@name='" + this.Key + "']/page");



            if (!EditingActive)
            {
                if (AdminUtil.IsAdminLoggedIn())
                {
                    pnlEditInfo.Visible = true;
                }

                plhPlain.Visible  = true;
                pnlEditor.Visible = false;

                rptBookmarks.DataSource = list;

                rptBookmarks.DataBind();

                //bind to rptPages also

                rptPages.DataSource = list;

                rptPages.DataBind();
            }
            else
            {
                //toggle the viewing panels for editing
                plhPlain.Visible  = false;
                pnlEditor.Visible = true;


                //work out what the next index should be
                XmlNodeList tmp   = Document.SelectNodes("Resource/pages[@name='" + this.Key + "']/page[@index]");
                int         index = -1;

                //loop through the found pages to calculate the next index
                foreach (XmlNode x in tmp)
                {
                    if (int.Parse(x.Attributes["index"].Value) > index)
                    {
                        index = int.Parse(x.Attributes["index"].Value);
                    }
                }

                this.NewIndex = index + 1;

                //bind to rptPagesForEdit
                rptPagesForEdit.DataSource = list;

                rptPagesForEdit.DataBind();


                //here we are editing a particular page
                if (Request.QueryString[PageIndexQueryVariable] != null)
                {
                    IsEdit = true;

                    EditingIndex = int.Parse(Request.QueryString[PageIndexQueryVariable]);

                    if (Request.QueryString["d"] == "1")
                    {
                        //do delete of this item then return
                        OnDelete(sender, e);

                        return;
                    }

                    if (!IsPostBack)
                    {
                        XmlElement element = (XmlElement)Document.SelectSingleNode("Resource/pages[@name='" + this.Key + "']/page[@index='" + EditingIndex + "']");

                        txtTitle.Text = element.SelectSingleNode("title").InnerXml;

                        txtTeaser.Text = element.SelectSingleNode("teaser").InnerXml;

                        txtText.Text = element.SelectSingleNode("text").InnerXml;
                    }

                    litTitle.Key = "pagesEditingTitle";
                }
                else
                {
                    litTitle.Key = "pagesAddingTitle";
                }
            }
        }