コード例 #1
0
 private void InitSocialNetworking()
 {
     // Sharing
     lnkMyFlights.Text = HttpUtility.HtmlEncode(m_pf.PublicFlightsURL(Request.Url.Host).AbsoluteUri);
     ClientScript.RegisterClientScriptInclude("copytoClip", ResolveClientUrl("~/public/Scripts/CopyClipboard.js"));
     imgCopyMyFlights.OnClientClick = String.Format(CultureInfo.InvariantCulture, "javascript:copyClipboard(null, '{0}', true, '{1}');return false;", lnkMyFlights.ClientID, lblMyFlightsCopied.ClientID);
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            string path       = PageHelper.GetRelativeLevel();
            string scriptPath = path + "Platform/script";

            ClientScript.RegisterClientScriptInclude("common", scriptPath + "/common.js");
            ClientScript.RegisterClientScriptInclude("popMessage", scriptPath + "/PopMessage.js");
            ClientScript.RegisterClientScriptInclude("message", scriptPath + "/Message.js");

            string sc = string.Empty;

            switch (this.BrowserVersion)
            {
            case 6:
                sc = "/ModalWindow_ie6.js";
                break;

            case 7:
                sc = "/ModalWindow_ie7.js";
                break;

            default:
                sc = "/ModalWindow_ie6.js";
                break;
            }
            CheckLogin();
            ClientScript.RegisterClientScriptInclude("modalWindow", scriptPath + sc);
        }
コード例 #3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            SystemConfig = new CMS_Config();

            CurrentAdmin = CMS_AdminUser.CurrentAdmin;

            //判断是否登录了
            if (CurrentAdmin == null)
            {
                Response.Redirect("Login.aspx?t='exit'");
            }

            //动态加入CSS文件
            HtmlLink link = new HtmlLink();

            link.Attributes.Add("href", "../Css/ManageCss/STYLE.CSS");
            link.Attributes.Add("type", "text/css");
            link.Attributes.Add("rel", "Stylesheet");
            this.Page.Header.Controls.Add(link);

            //动态加入JS文件
            ClientScript.RegisterClientScriptInclude("jquery", "../Scripts/jquery-1.2.6.min.js");
            ClientScript.RegisterClientScriptInclude("jquery.validate", "../Scripts/jquery.validate.js");
        }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SiteSettings.init(Server);
     Core.checkIfLogin(this);
     try
     {
         List <SignupUserItem> list;
         Core.getSignupList(out list);
         int countSignedUp = list.FindAll((SignupUserItem item) =>
         {
             return(item.SignupSequence.Length > 0);
         }).Count;
         lblRecordInfo.Text        = String.Format("导入名单 {0} 人,已签到 {1} 人", list.Count, countSignedUp);
         gridSignupList.DataSource = list;
         gridSignupList.DataBind();
     }
     catch (Exception ex)
     {
         Misc.doPageJump(this, Request.UrlReferrer.PathAndQuery, ex.Message);
     }
     gridSignupList.Sorting     += gridSignupList_Sorting;
     gridSignupList.RowEditing  += gridSignupList_RowEditing;
     gridSignupList.RowDeleting += gridSignupList_RowDeleting;
     String[] scriptFiles = { "jquery-1.7.1.min.js", "signuplist.js" };
     Array.ForEach <String>(scriptFiles, delegate(String elem)
     {
         ClientScript.RegisterClientScriptInclude(this.GetType(), elem, "Scripts/" + elem);
     });
     ClientScript.RegisterStartupScript(this.GetType(), "", "init();", true);
 }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["LoaiNguoiDung"] != "QuanTri")
     {
         Response.Redirect("ErrorPage.aspx");
     }
     Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", GetJavaScript());
     ClientScript.RegisterClientScriptInclude("quang cao", "He Khach/XL_QuangCao.js");
 }
コード例 #6
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (Toolkit.IsNonWindowsOS)
     {
         ClientScript.RegisterClientScriptInclude("jquery.ui", Page.ResolveClientUrl("/gringlobal/scripts/jquery-ui-1.7.2.custom.min.js"));
     }
     else
     {
         ScriptManager.RegisterClientScriptInclude(this, typeof(string), "jquery.ui", Page.ResolveClientUrl("~/scripts/jquery-ui-1.7.2.custom.min.js"));
     }
 }
コード例 #7
0
        protected override void OnPreRender(EventArgs e)
        {
            Context.Trace.Warn("Page", "Begin OnPreRender");

            base.OnPreRender(e);

            if (Response.ContentType == "text/html" && String.IsNullOrEmpty(Request["HTTP_X_MICROSOFTAJAX"]) &&
                !Convert.ToBoolean(Request["PinJs"]))
            {
                Response.Filter = new ScriptDeferFilter(Response);
            }

            //
            // Client Scripts
            //
            if (_mapFunctionKeys)
            {
                ClientScript.RegisterClientScriptResource(typeof(Page), "InfoControl.Web.UI.Resources.MapFunctionKeys.js");
            }

            if (_blockContextMenu)
            {
                ClientScript.RegisterClientScriptResource(typeof(Page), "InfoControl.Web.UI.Resources.BlockContextMenu.js");
            }

            //if (!ClientCache)
            //{
            //    // Evita o cahce seguramente no protocolo HTTP/1.1 ,
            //    // como browsers antigos não aceitam essa validação se faz necessário os próximos dois.
            //    Response.AddHeader("cache-control", "private, no-store, no-cache, must-revalidate");

            //    // Evita o cache em conexões seguras (SSL)
            //    Response.AddHeader("pragma", "no-cache");
            //}

            string clientScriptFile = Server.MapPath(Request.CurrentExecutionFilePath) + ".js";

            if (File.Exists(clientScriptFile))
            {
                ScriptManager manager = ScriptManager.GetCurrent(this);
                if (manager != null)
                {
                    manager.Scripts.Add(new ScriptReference(Request.Url.AbsolutePath + ".js"));
                }
                else
                {
                    ClientScript.RegisterClientScriptInclude(Request.Url.AbsolutePath, Request.Url.AbsolutePath + ".js");
                }
            }

            Context.Trace.Warn("Page", "End OnPreRender");
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //ClientScript.RegisterClientScriptInclude("bloque", "../publico/script/modulos.js");
            string scriptJQuery = "../publico/script/modulos.js";

            ClientScript.RegisterClientScriptInclude("bloque", Page.ResolveClientUrl(scriptJQuery));

            ////Se llama a un javascript cuando la página carga

            //string mensaje = "Este mensaje se genera desde c#";

            //ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript:mostrarMensaje('" + mensaje + "');</script>");
        }
コード例 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ClientScript.RegisterClientScriptInclude("core", "/js/core.js");
        ClientScript.RegisterClientScriptInclude("submit-page", "/js/submit-page.js");

        if (IsPostBack)
        {
            return;
        }

        BindRegion();
        BindClubCategories();
    }
コード例 #10
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //在IE6环境中,弹出页面时,是否显示水平滚动条
            this.RemoveHorizontalScrollbar(this.ShowHorizontalScrollbar);

            string path       = PageHelper.GetRelativeLevel();
            string scriptPath = path + "Platform/script";

            ClientScript.RegisterClientScriptInclude("common", scriptPath + "/common.js");
            ClientScript.RegisterClientScriptInclude("popMessage", scriptPath + "/PopMessage.js");
            ClientScript.RegisterClientScriptInclude("message", scriptPath + "/Message.js");

            StringBuilder scri = new StringBuilder();

            scri.AppendLine("setPageFirstFocus();");
            if (this.AllowSetPageFirstFocus)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "setFocus", scri.ToString(), true);
            }

            string sc = string.Empty;

            switch (this.BrowserVersion)
            {
            case 6:
                sc = "/ModalWindow_ie6.js";
                break;

            case 7:
                sc = "/ModalWindow_ie7.js";
                break;

            default:
                sc = "/ModalWindow_ie6.js";
                break;
            }
            ClientScript.RegisterClientScriptInclude("modalWindow", scriptPath + sc);

            ClientScript.RegisterHiddenField("_lockDropdownlist", "");

            CheckLogin();

            //Toolbar载入样式,校验权限
            RecursionLoadToolbar(this.Form.Controls);
            //UltraWebToolbar载入样式,校验权限 为老项目保留兼容性,新项目不用UltraWebToolbar控件
            RecursionLoadUltraWebToolbar(this.Form.Controls);

            if (!this.IsPostBack)
            {
            }
        }
コード例 #11
0
    private void InitSocialNetworking()
    {
        // Sharing
        lnkMyFlights.Text = HttpUtility.HtmlEncode(m_pf.PublicFlightsURL(Request.Url.Host).AbsoluteUri);
        ClientScript.RegisterClientScriptInclude("copytoClip", ResolveClientUrl("~/public/Scripts/CopyClipboard.js"));
        imgCopyMyFlights.OnClientClick = String.Format(CultureInfo.InvariantCulture, "javascript:copyClipboard(null, '{0}', true, '{1}');return false;", lnkMyFlights.ClientID, lblMyFlightsCopied.ClientID);

        lblGPhotosDesc.Text    = Branding.ReBrand(Resources.LocalizedText.PrefSharingGooglePhotosDesc);
        lnkAuthGPhotos.Text    = Branding.ReBrand(Resources.LocalizedText.PrefSharingGooglePhotosAuthorize);
        lblGPhotosEnabled.Text = Branding.ReBrand(Resources.LocalizedText.PrefSharingGooglePhotosEnabled);
        lnkDeAuthGPhotos.Text  = Branding.ReBrand(Resources.LocalizedText.PrefSharingGooglePhotosDisable);

        mvGPhotos.SetActiveView(m_pf.PreferenceExists(GooglePhoto.PrefKeyAuthToken) ? vwGPhotosEnabled : vwGPhotosDisabled);
    }
コード例 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RegisterOEMSkins("form.css");
     RegisterOEMSkins("page.css");
     RegisterOEMSkins("booking.css");
     if (!IsPostBack)
     {
         bindUpdateLog();
         BindAnnouncement();
         BindHeader();
         BindDefaultAirPort();
         ClientScript.RegisterClientScriptInclude(GetType(), "annoucement", ResolveClientUrl("/Scripts/EmergencyAnnounce.js"));
         ServiceTelephone.Text = CurrenContract.ServicePhone;
     }
 }
コード例 #13
0
        private void RegisterJavaScriptApi()
        {
            var javaScriptApi = ConfigurationManager.AppSettings[WebConfigSettings.JavaScriptApi];

            if (string.IsNullOrEmpty(javaScriptApi))
            {
                throw new MvcReportViewerException("MvcReportViewer.js location is not found. Make sure you have MvcReportViewer.AspxViewerJavaScript in your Web.config.");
            }

            if (javaScriptApi.StartsWith("~"))
            {
                javaScriptApi = VirtualPathUtility.ToAbsolute(javaScriptApi);
            }

            ClientScript.RegisterClientScriptInclude("JavaScriptAPI", javaScriptApi);
        }
コード例 #14
0
ファイル: ViewPage.cs プロジェクト: zhangwxyc/BPM
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                //register print css
                HtmlLink link = new HtmlLink();
                link.Attributes.Add("type", "text/css");
                link.Attributes.Add("rel", "stylesheet");
                link.Attributes.Add("media", "print");
                link.Attributes.Add("href", "../css/print.css");
                Header.Controls.Add(link);

                //register view process script
                ClientScript.RegisterClientScriptInclude(this.GetType(), "", "../../JavaScript/ViewProcess.js");
            }
            base.OnLoad(e);
        }
コード例 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.SelectedTab = tabID.instAchievements;
        if (!IsPostBack)
        {
            lblAchievementsHeader.Text = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.AchievementsForUserHeader, MyFlightbook.Profile.GetUser(Page.User.Identity.Name).UserFullName);
            if (util.GetIntParam(Request, "f", 0) != 0)
            {
                ForceRefresh();
            }

            RefreshPage();
            Master.ShowSponsoredAd = false;
        }
        ClientScript.RegisterClientScriptInclude("copytoClip", ResolveClientUrl("~/public/Scripts/CopyClipboard.js"));
        imgCopy.OnClientClick = String.Format(CultureInfo.InvariantCulture, "javascript:copyClipboard('{0}', 'raContainer', false, '{1}');return false;", lblRecentAchievementsTitle.ClientID, lblCopied.ClientID);
    }
コード例 #16
0
        private void RegisterScripts()
        {
            string dhtmlPath = EpmLivePath + "DHTML/";

            ClientScript.RegisterStartupScript(GetType(), "EPMScript2", string.Format("<script>_css_prefix = '{0}xgrid/';_js_prefix = '{0}xgrid/'; </script>", dhtmlPath));
            string[] dhtmlrefs = new string[]
            {
                "xgrid/dhtmlxcommon.js",
                "xgrid/dhtmlxgrid.js",
                "xgrid/dhtmlxgridcell.js",
                "xgrid/dhtmlxgrid_post.js",
                "xtreegrid/dhtmlxtreegrid.js",
                "xtreegrid/ext/dhtmlxtreegrid_filter.js",
                "xgrid/ext/dhtmlxgrid_nxml.js",
                "xgrid/ext/dhtmlxgrid_filter.js",
                "xgrid/ext/dhtmlxgrid_math.js",
                "xgrid/ext/dhtmlxgrid_srnd.js",
                "xcombo/dhtmlxcombo.js",
                "xmenu/dhtmlxprotobar.js",
                "xmenu/dhtmlxmenubar.js",
                "xmenu/dhtmlxmenubar_cp.js"
            };
            int count = 1;

            foreach (string jsRef in dhtmlrefs)
            {
                ClientScript.RegisterClientScriptInclude(GetType(), "EPMInclude" + count++.ToString("d2"), dhtmlPath + jsRef);
            }

            ClientScript.RegisterClientScriptInclude(GetType(), "EPMInclude", EpmLivePath + "resPlanning.js");
            ClientScript.RegisterStartupScript(GetType(), "EPMScript3",
                                               @"
    <script language='javascript'>
        function chk(chkid, ddlid) {
            var chk = document.getElementById(chkid);
            var divDDL = document.getElementById(ddlid);
            if (chk.checked)
                divDDL.style.display = '';
            else
                divDDL.style.display = 'none';
        }
    </script>"
                                               );
        }
コード例 #17
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // .css
            if (!Page.ClientScript.IsClientScriptBlockRegistered("objectDD_css"))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "objectDD_css",
                                                            String.Format("<link type='text/css' rel='stylesheet' href='{0}' />", ResolveClientUrl("~/styles/IbnFramework/objectDD.css")), false);
            }

            // .js
            ClientScript.RegisterClientScriptInclude(this.Page, this.Page.GetType(),
                                                     "MultiSelectControl_js", ResolveClientUrl("~/Apps/ClioSoft/scripts/MultiSelectControl.js"));

            // javascript object
            string registerControl = String.Format("msc_Collection['{0}'] = new msc_Object(\"{0}\", \"{1}\", \"{2}\", \"{3}\");",
                                                   this.ClientID,
                                                   MainTable.ClientID,
                                                   DropDownDiv.ClientID,
                                                   AllItemsCheckBox.ClientID);

            ClientScript.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(),
                                               registerControl, true);

            // onclick
            MainTable.Attributes.Add("onclick", String.Format("msc_Collection['{0}'].msc_ShowHideDropDown(event);", this.ClientID));
            AllItemsCheckBox.Attributes.Add("onclick", String.Format("msc_Collection['{0}'].msc_CheckAll(event);", this.ClientID));

            foreach (DataGridItem dgi in MainGrid.Items)
            {
                CheckBox cb = (CheckBox)dgi.FindControl("chkItem");
                if (cb != null)
                {
                    cb.Attributes.Add("onclick", String.Format("msc_Collection['{0}'].msc_UncheckAllIfNeed(this, event);", this.ClientID));
                }
            }

            // Selected Label text
            if (String.IsNullOrEmpty(SelectedLabel.Text))
            {
                SelectedLabel.Text = NotSetText;
            }
        }
コード例 #18
0
ファイル: editQA.aspx.cs プロジェクト: freebr/signup-sys
 protected void Page_Load(object sender, EventArgs e)
 {
     SiteSettings.init(Server);
     Core.checkIfLogin(this);
     gridQuestions.SelectedIndexChanged += gridQuestions_SelectedIndexChanged;
     SqlDataSourceQuestion.Inserting    += SqlDataSourceQuestion_Inserting;
     SqlDataSourceAnswer.Inserting      += SqlDataSourceAnswer_Inserting;
     SqlDataSourceQuestion.InsertCommand = "INSERT INTO Questions (Question) VALUES (@Question)";
     SqlDataSourceQuestion.UpdateCommand = "UPDATE Questions SET Question=@Question WHERE ID=@ID";
     SqlDataSourceQuestion.DeleteCommand = "DELETE FROM Questions WHERE ID=@ID";
     SqlDataSourceAnswer.InsertCommand   = "INSERT INTO Answers (QuestionID,Answer) VALUES (@QuestionID,@Answer)";
     SqlDataSourceAnswer.UpdateCommand   = "UPDATE Answers SET Answer=@Answer WHERE ID=@ID";
     SqlDataSourceAnswer.DeleteCommand   = "DELETE FROM Answers WHERE ID=@ID";
     String[] scriptFiles = { "jquery-1.7.1.min.js", "editqa.js" };
     Array.ForEach <String>(scriptFiles, (String elem) =>
     {
         ClientScript.RegisterClientScriptInclude(this.GetType(), elem, "Scripts/" + elem);
     });
     ClientScript.RegisterStartupScript(this.GetType(), "", "init();", true);
 }
コード例 #19
0
        private void RegisterJavaScriptApi(ReportViewerParameters parameters)
        {
            if (parameters.ControlSettings.AsyncPostBackTimeout != null)
            {
                ScriptManager.AsyncPostBackTimeout = (int)parameters.ControlSettings.AsyncPostBackTimeout;
            }

            var javaScriptApi = _config.AspxViewerJavaScript;

            if (string.IsNullOrEmpty(javaScriptApi))
            {
                throw new MvcReportViewerException("MvcReportViewer.js location is not found. Make sure you have MvcReportViewer.AspxViewerJavaScript in your Web.config.");
            }

            if (javaScriptApi.StartsWith("~"))
            {
                javaScriptApi = VirtualPathUtility.ToAbsolute(javaScriptApi);
            }

            ClientScript.RegisterClientScriptInclude("JavaScriptAPI", javaScriptApi);
        }
コード例 #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Global.AddCommonJavaScript(this);
        Global.AddTooltipJavaScript(this);
        ClientScript.RegisterClientScriptInclude("interactiveReport", "Script.js");

        _db     = Global.GetDbConnection();
        _userId = (Guid)Membership.GetUser().ProviderUserKey;

        setUpTabs();

        //dgDatasources.ItemCommand += new DataGridCommandEventHandler(dgDatasources_ItemCommand);
        chartViewer.ClickHotSpot += chartViewer_ClickHotSpot;
        PreRender += Members_Interactive_Report_Default_PreRender;

        savedReportTab.SettingsLoaded      += savedReportTab_SettingsLoaded;
        savedReportTab.ChartRefreshRequest += savedReportTab_ChartRefreshRequest;

        if (!Page.IsPostBack)
        {
            loadQueryParameters();
        }
    }
コード例 #21
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string entryId;
            string usrId;

            // Put user code to initialize the page here
            Global.AuthenticateUser();

            //Register .js
            ClientScript.RegisterClientScriptInclude(this.GetType(), "bh", @"include\bh.js");

            //Disable File Uploads
            File1.Disabled = true;
            File2.Disabled = true;

            //entryId = Request.QueryString["BlogId"];
            entryId = Request.QueryString["iD"].ToString();

            // Put user code to initialize the page here
            lnkSignIn.Text = Global.SetLnkSignIn();
            lnkSignUp.Text = Global.SetLnkSignUp();

            if (!(Page.IsPostBack))
            {
                //default all pics to a clear gif
                img1.ImageUrl = @"\images\s1x1.gif";
                img2.ImageUrl = @"\images\s1x1.gif";

                //TODO: remove dead code
                //Init delete img flag to false
                //delImgs = false;

                txtDetails.Visible = false;

                BindItemData(entryId);
            }
        }
コード例 #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SiteSettings.init(Server);
     if (!IsPostBack)
     {
         try
         {
             String htmlPageSignup, content;
             Misc.getSignupPage(out htmlPageSignup);
             // 获取签到页内容
             Match match = Regex.Match(htmlPageSignup, "(?<=<div class=\"personal-info\">).*?(?=</div>)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
             if (match.Success)
             {
                 content = match.Value;
             }
             else
             {
                 content = htmlPageSignup;
             }
             ftbPage.DesignModeCss = Misc.url(SiteSettings.SITE_ROOT, "App_Themes/user/page.css");
             ftbPage.Text          = content;
             // 获取签到页标题
             match = Regex.Match(htmlPageSignup, "(?<=<title>).*(?=</title>)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
             if (match.Success)
             {
                 txtTitle.Text = match.Value;
             }
             ClientScript.RegisterClientScriptInclude(this.GetType(), "", "Scripts/jquery-1.7.1.min.js");
             ClientScript.RegisterClientScriptInclude(this.GetType(), "", "Scripts/signup.js");
         }
         catch (Exception ex)
         {
             Misc.showError(this, ex.Message);
         }
     }
 }
コード例 #23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Contains the functionality to populate the Root aspx page with controls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// - obtain PortalSettings from Current Context
        /// - set global page settings.
        /// - initialise reference paths to load the cascading style sheets
        /// - add skin control placeholder.  This holds all the modules and content of the page.
        /// </remarks>
        /// <history>
        ///     [sun1]	1/19/2004	Created
        ///		[jhenning] 8/24/2005 Added logic to look for post originating from a ClientCallback
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //set global page settings
            InitializePage();

            //load skin control and register UI js
            UI.Skins.Skin ctlSkin;
            if (PortalSettings.EnablePopUps)
            {
                ctlSkin = IsPopUp ? UI.Skins.Skin.GetPopUpSkin(this) : UI.Skins.Skin.GetSkin(this);

                //register popup js
                jQuery.RegisterJQueryUI(Page);

                if (HttpContext.Current.IsDebuggingEnabled)
                {
                    ClientScript.RegisterClientScriptInclude("modalPopUp", ResolveUrl("~/js/Debug/dnn.modalpopup.js"));
                }
                else
                {
                    ClientScript.RegisterClientScriptInclude("modalPopUp", ResolveUrl("~/js/dnn.modalpopup.js"));
                }
            }
            else
            {
                ctlSkin = UI.Skins.Skin.GetSkin(this);
            }

            //check for and read skin package level doctype
            SetSkinDoctype();

            //Manage disabled pages
            if (PortalSettings.ActiveTab.DisableLink)
            {
                if (TabPermissionController.CanAdminPage())
                {
                    var heading = Localization.GetString("PageDisabled.Header");
                    var message = Localization.GetString("PageDisabled.Text");
                    UI.Skins.Skin.AddPageMessage(ctlSkin, heading, message,
                                                 ModuleMessage.ModuleMessageType.YellowWarning);
                }
                else
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }
            //Manage canonical urls
            if (PortalSettings.PortalAliasMappingMode == PortalSettings.PortalAliasMapping.CanonicalUrl && PortalSettings.PortalAlias.HTTPAlias != PortalSettings.DefaultPortalAlias)
            {
                var originalurl = Context.Items["UrlRewrite:OriginalUrl"].ToString();

                //Add Canonical <link>
                var canonicalLink = new HtmlLink();
                canonicalLink.Href = originalurl.Replace(PortalSettings.PortalAlias.HTTPAlias, PortalSettings.DefaultPortalAlias);
                canonicalLink.Attributes.Add("rel", "canonical");

                // Add the HtmlLink to the Head section of the page.
                Page.Header.Controls.Add(canonicalLink);
            }

            //check if running with known account defaults
            var messageText = "";

            if (Request.IsAuthenticated && string.IsNullOrEmpty(Request.QueryString["runningDefault"]) == false)
            {
                var userInfo = HttpContext.Current.Items["UserInfo"] as UserInfo;
                //only show message to default users
                if ((userInfo.Username.ToLower() == "admin") || (userInfo.Username.ToLower() == "host"))
                {
                    messageText = RenderDefaultsWarning();
                    var messageTitle = Localization.GetString("InsecureDefaults.Title", Localization.GlobalResourceFile);
                    UI.Skins.Skin.AddPageMessage(ctlSkin, messageTitle, messageText, ModuleMessage.ModuleMessageType.RedError);
                }
            }

            //add CSS links
            RegisterStyleSheet(this, Globals.HostPath + "default.css");
            RegisterStyleSheet(this, ctlSkin.SkinPath + "skin.css");
            RegisterStyleSheet(this, ctlSkin.SkinSrc.Replace(".ascx", ".css"));

            //add skin to page
            SkinPlaceHolder.Controls.Add(ctlSkin);

            RegisterStyleSheet(this, PortalSettings.HomeDirectory + "portal.css");

            //add Favicon
            ManageFavicon();

            //ClientCallback Logic
            ClientAPI.HandleClientAPICallbackEvent(this);

            //add viewstateuserkey to protect against CSRF attacks
            if (User.Identity.IsAuthenticated)
            {
                ViewStateUserKey = User.Identity.Name;
            }
        }
コード例 #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ClientScript.RegisterClientScriptInclude("PrivacyPolicy", "javascript/privacypolicy.js");
 }
コード例 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (((BasePage)Page).UserId == -1)
            {
                this.btnSendMail.Visible   = false;
                this.lblSeparator2.Visible = false;
            }

            if (!string.IsNullOrEmpty(this.Request["menuId"]))
            {
                this.MenuId = int.Parse(this.Request["menuId"]);
                int?userId = BusinessFacade.Instance.GetMenuUserId(this.MenuId);

                if (userId.HasValue)
                {
                    if ((userId.Value == int.Parse(ConfigurationManager.AppSettings["anonymous"])) || (userId.Value == ((BasePage)Page).UserId))
                    {
                        MenuType menuType = BusinessFacade.Instance.GetMenuType(this.MenuId);

                        if (menuType != null)
                        {
                            this.MenuTypeId = menuType.MenuTypeId;
                            this.Master.SetLeftBackgroundImage(menuType.MenuTypeId);

                            if (menuType.MenuTypeId == (int)MenuTypeEnum.OneMeal ||
                                menuType.MenuTypeId == (int)MenuTypeEnum.QuickMenu)
                            {
                                this.ucMealMenu.Visible = true;
                            }
                            else
                            {
                                this.ucWeeklyMenu.Visible    = true;
                                this.ucWeeklyMenu.MenuTypeId = menuType.MenuTypeId;
                                this.pnlMenuRecipes.Height   = new Unit(802);
                                this.Master.ChangeTopNotePos();
                            }
                        }

                        this.rptMenuRecipes.DataSource = BusinessFacade.Instance.GetMenuRecipes(this.MenuId);
                        this.rptMenuRecipes.DataBind();

                        btnPrintMenuMeals.NavigateUrl = "~/PrintMenu.aspx?menuId=" + this.MenuId.ToString();


                        _menuId = this.MenuId;
                    }
                    else
                    {
                        AppEnv.MoveToDefaultPage();
                    }
                }
                else
                {
                    AppEnv.MoveToDefaultPage();
                }
            }
            else
            {
                AppEnv.MoveToDefaultPage();
            }
        }


        ClientScript.RegisterClientScriptInclude("MyScript", "Scripts/MenuMealsDnD.js");
    }
コード例 #26
0
ファイル: CreditCard.aspx.cs プロジェクト: sma5802/protech
    protected void Page_Load(object sender, EventArgs e)
    {
        //---------Master page section
        if (!IsPostBack)
        {
            if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://peptechcorp.com") || HttpContext.Current.Request.Url.ToString().ToLower().Contains("https://peptechcorp.com"))
            {
                HttpContext.Current.Response.Status = "301 Moved Permanently";
                HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://peptechcorp.com", "http://www.peptechcorp.com").Replace("https://peptechcorp.com", "https://www.peptechcorp.com"));
            }
            //else
            //{
            //    if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("/creditcard.aspx"))
            //    {
            //        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://"))
            //            Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
            //    }
            //    else
            //    {
            //        if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("https://"))
            //            Response.Redirect(Request.Url.ToString().Replace("https://", "http://"));
            //    }
            //}
        }

        Session["UserID"] = Session["SessionID"];

        if (Session["mainuserid"] != null && Session["title"] != null)
        {
            s3.Visible           = false;
            lnkmyaccount.Visible = true;
            lblUser.Text         = "Welcome&nbsp;" + Session["title"].ToString();
            lnkstatus.Text       = "Sign Out";
            hypsignin.Visible    = false;
        }
        else
        {
            s1.Visible     = false;
            s2.Visible     = false;
            hypsignin.Text = "<a href='Login.aspx' class='blueheading' style='font-weight:bold'>Sign In!</a>";
            lnkstatus.Text = "New Account";
        }

        try
        {
            string    SqlStrItem  = "select total from " + customUtility.DBPrefix + "shoppingBagTmp where Userid='" + Session["UserID"] + "' ";
            DataTable dtitemcount = customUtility.GetTableData(SqlStrItem).Tables[0];
            int       itemcount   = dtitemcount.Rows.Count;
            int       i           = 0;
            float     totalitem   = 0;
            int       ss;
            for (i = 0; i < itemcount; i++)
            {
                totalitem += float.Parse(dtitemcount.Rows[i]["Total"].ToString());
            }
            float     chrg   = 0F;
            DataTable dtchrg = customUtility.GetTableData("select shippingcharge from " + customUtility.DBPrefix + "shippingtmp where userid='" + Session["userid"] + "'").Tables[0];
            if (dtchrg.Rows.Count > 0)
            {
                chrg = float.Parse(dtchrg.Rows[0]["shippingcharge"].ToString());
            }


            if (Request.Url.ToString().Contains("CreditCard.aspx"))
            {
                lnkbasket.Visible = true;
                lnkbasket.Text    = "My Cart &nbsp;" + itemcount.ToString() + " items " + "-" + string.Format("{0:C}", totalitem + chrg);
            }
            else
            {
                lnkbasket.Visible = true;
                lnkbasket.Text    = "My Cart &nbsp;" + itemcount.ToString() + " items " + "-" + string.Format("{0:C}", totalitem);
            }
        }
        catch { }

        //--------Credit Card  Section
        if (Session["mainuserid"] == null || Session["mainuserid"] == "")
        {
            Response.Redirect(ConfigurationManager.AppSettings["websitepath1"] + "login.aspx");
        }

        string scriptBlock = "<script type=\"text/javascript\">\n";

        scriptBlock += "var ClientID, CardNumber, CardType, ExpMon, ExpYear, CVVNo;\n";
        scriptBlock += "window.onload = function(){\n";
        // scriptBlock += "ClientID = \"" + ((ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1")).ClientID + "\";\n";
        scriptBlock += "CardNumber = document.getElementById(ClientID + \"_txtCreditCardNumber\");\n";
        scriptBlock += "CardType = document.getElementById(ClientID + \"_cboCardType\");\n";
        scriptBlock += "ExpMon = document.getElementById(ClientID + \"_cboExpMonth\");\n";
        scriptBlock += "ExpYear = document.getElementById(ClientID + \"_cboExpYear\");\n";
        scriptBlock += "CVVNo = document.getElementById(ClientID + \"_txtCSVNumber\");\n";
        scriptBlock += "Terms = document.getElementById(ClientID + \"_chkTerms\");\n";
        scriptBlock += "}</script>";

        if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "CreditCardInit"))
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "CreditCardInit", scriptBlock);
        }

        string scriptUrl = "js/creditcard_validation.js";

        if (!ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "CreditCardValidator"))
        {
            ClientScript.RegisterClientScriptInclude(this.GetType(), "CreditCardValidator", scriptUrl);
        }

        if (Session["UserID"] != null)
        {
            if (Session["UserID"].ToString().Length != 0)
            {
                UserId = Session["UserID"].ToString();
            }
        }

        if (!Page.IsPostBack)
        {
            DataTable dtcheck = customUtility.GetTableData("select orderid from " + customUtility.DBPrefix + "order where UserID='" + Session["UserID"].ToString().Replace("'", "''") + "'").Tables[0];
            if (dtcheck.Rows.Count <= 0)
            {
                Response.Redirect(ConfigurationManager.AppSettings["websitepath1"] + "emptyshopbag.aspx");
            }
            if (Session["orderno"] != null)
            {
                hidorderno.Value = Session["orderno"].ToString();
            }

            rblorder.Items.FindByValue("0").Selected = true;
            for (int i = 1; i <= 12; i++)
            {
                cboExpMonth.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0')));
            }

            for (int i = DateTime.Today.Year; i <= (DateTime.Today.Year + 20); i++)
            {
                cboExpYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            Session["shipp"]    = shipp;
            stotal              = shipp;
            ViewState["stotal"] = stotal;
            fillgridview();

            if (Session["mainuserid"] != null || Session["mainuserid"] != "")
            {
                string    strpostatus = "select PurchaseOrderNo from " + customUtility.DBPrefix + "Memberlist where id=" + Session["mainuserid"];
                DataTable dtpostatus  = customUtility.GetTableData(strpostatus).Tables[0];
                if (dtpostatus.Rows.Count > 0)
                {
                    if (dtpostatus.Rows[0]["PurchaseOrderNo"].ToString().ToLower().Equals("true"))
                    {
                        rblorder.Enabled = true;
                    }
                    else
                    {
                        rblorder.Enabled = false;
                    }
                }
            }
        }
    }