protected override void OnPreInit(EventArgs e) { if (AppServiceStartAction.state != DataBaseService.PingDbState.NoError) { SessionServices.StartSession(HttpContext.Current); return; } if (MobileHelper.IsMobileEnabled()) { MasterPageFile = VirtualPathUtility.ToAbsolute(("~/Templates/Mobile/MasterPage.master")); } else { if (SettingsDesign.Template != TemplateService.DefaultTemplateId && File.Exists(Server.MapPath("~/Templates/" + SettingsDesign.Template + "/MasterPage.master")) && !Request.RawUrl.Contains("social") && MasterPageFile != null) { MasterPageFile = VirtualPathUtility.ToAbsolute(("~/Templates/")) + SettingsDesign.Template + "/MasterPage.master"; } } base.OnPreInit(e); }
public virtual ActionResult Approve() { LogI("Styles, HTTP_USER_AGENT=" + Request.ServerVariables["HTTP_USER_AGENT"]); LogI("IsMobileDeviceCustom=" + MobileHelper.IsMobileDeviceCustom() + ", IsMobileDevice=" + Request.Browser.IsMobileDevice); return(View("Approve")); }
protected void Page_Load(object sender, System.EventArgs e) { Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; MobileHelper.RedirectPageWhenMobileIsDisabled("~/googleindex.aspx", ThisCustomer); Response.ContentType = "text/xml"; Response.ContentEncoding = new System.Text.UTF8Encoding(); Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); Response.Write("<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"); Response.Write("<sitemap>"); Response.Write("<loc>" + AppLogic.GetStoreHTTPLocation(false) + "mobilegoogletopics.aspx</loc>"); Response.Write("</sitemap>\n"); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.CategoryStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Category"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.SectionStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Section"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.ManufacturerStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Manufacturer"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.DistributorStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Distributor"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.GenreStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Genre"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.VectorStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Vector"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.LibraryStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Library"), 0, MobilePlatform.MobileLocaleDefault, true, true)); Response.Write("</sitemapindex>"); }
/// <summary> /// Creates the lava template from the list of fields. /// </summary> /// <returns></returns> private string CreateLavaTemplate() { var fields = GetAttributeValue(AttributeKeys.AdditionalFields).FromJsonOrNull <List <FieldSetting> >() ?? new List <FieldSetting>(); var properties = new Dictionary <string, string> { { "Id", "Id" }, { "Guid", "Guid" }, { "PersonId", "PersonId" }, { "FullName", "Person.FullName" }, { "FirstName", "Person.FirstName" }, { "NickName", "Person.NickName" }, { "LastName", "Person.LastName" }, { "GroupRole", "GroupRole.Name" }, { "PhotoId", "Person.PhotoId" } }; // // Add a custom field for the PhotoUrl since it needs to be custom formatted. // fields.Add(new FieldSetting { Key = "PhotoUrl", FieldFormat = FieldFormat.String, Value = "{{ 'Global' | Attribute:'PublicApplicationRoot' | Append:item.Person.PhotoUrl }}" }); return(MobileHelper.CreateItemLavaTemplate(properties, fields)); }
public IHttpActionResult Login([FromBody] LoginParameters loginParameters) { var authController = new AuthController(); var site = MobileHelper.GetCurrentApplicationSite(); if (site == null) { return(StatusCode(System.Net.HttpStatusCode.Unauthorized)); } // // Chain to the existing login method for actual authorization check. // Throws exception if not authorized. // authController.Login(loginParameters); // // Find the user and translate to a mobile person. // var userLoginService = new UserLoginService(new Rock.Data.RockContext()); var userLogin = userLoginService.GetByUserName(loginParameters.Username); var mobilePerson = MobileHelper.GetMobilePerson(userLogin.Person, site); mobilePerson.AuthToken = MobileHelper.GetAuthenticationToken(loginParameters.Username); return(Ok(mobilePerson)); }
protected void Page_Load(object sender, System.EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/googletopics.aspx", ThisCustomer); string errorCode = Security.HtmlEncode(CommonLogic.QueryStringCanBeDangerousContent("errorCode")); if (errorCode.Length == 0) { divErrorCode.Visible = false; } else { divErrorCode.Visible = true; lblErrorCode.Text = errorCode; } if (ThisCustomer.IsAdminUser) { divAdminMessage.Visible = true; } else { divAdminMessage.Visible = false; } ltErrorTopic.Text = new Topic("InvalidRequest", ThisCustomer.LocaleSetting, 1).Contents; }
public async Task <HttpResponseMessage> GetMobileClientZip(string platformString, string templateName) { var resourceManager = await ResourcesManager.GetInstanceAsync(); var resourceGroup = await resourceManager.GetResourceGroup(HttpContext.Current.User.Identity.Name); MobileClientPlatform platform; if (resourceGroup.AppService != AppService.Mobile) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.Server.Error_InvalidAppServiceType)); } if (!Enum.TryParse <MobileClientPlatform>(platformString, out platform)) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.Server.Error_UnsupportedPlatform)); } var response = Request.CreateResponse(); var replacement = new Dictionary <string, string> { { "ZUMOAPPURL", resourceGroup.Sites.Where(s => s.IsSimpleWAWSOriginalSite).First().Url }, { "{siteurl}", resourceGroup.Sites.Where(s => s.IsSimpleWAWSOriginalSite).First().Url.Trim('/') }, { "ZUMOAPPNAME", "TryMobileApp" }, { "{sitename}", "TryMobileApp" }, { "ZUMOGATEWAYURL", resourceGroup.Sites.Where(s => s.IsSimpleWAWSOriginalSite).First().Url }, { "{gateway_url}", resourceGroup.Sites.Where(s => s.IsSimpleWAWSOriginalSite).First().Url.Trim('/') }, { "ZUMONETRUNTIMESERVERPORT", "44300" } }; response.Content = MobileHelper.CreateClientZip(platform, templateName, replacement); return(response); }
private PacketContent PlaceAction(SerializedInfo request, Token token) { var args = ArgumentsParser.Parse(request.Content); if (token != null && token.AppType == iExchange.Common.AppType.Mobile) { ICollection <Mobile.Server.Transaction> transactions = Mobile.Manager.ConvertPlacingRequest(token, args[0].ToXmlNode()); XElement element = new XElement("Result"); if (transactions != null) { foreach (Mobile.Server.Transaction transaction in transactions) { ICollection <XElement> errorCodes = MobileHelper.GetPlaceResultForMobile(transaction, token); foreach (XElement orderErrorElement in errorCodes) { element.Add(orderErrorElement); } } } XElement changes = Mobile.Manager.GetChanges(request.ClientInfo.Session.ToString(), false); element.Add(changes); return(element.ToPacketContent()); } return(TransactionService.Place(request.ClientInfo.Session, args[0].ToXmlNode()).ToPacketContent()); }
/*public ActionResult Directory() * { * return View(UsersCollection.All()); * }*/ public ActionResult About() { if (MobileHelper.IsMobileDevice(Request.UserAgent)) { return(RedirectToAction("about", "mobile")); } return(View(UsersCollection.PrimaryUser())); }
public ActionResult Index() { if (MobileHelper.IsMobileDevice(Request.UserAgent)) { return(RedirectToAction("index", "mobile")); } return(View(TwitterModel.Instance.Tweets(UsersCollection.PrimaryUser().TwitterScreenName))); }
protected void btn_ContinueButtonClick(object sender, EventArgs e) { Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; MobileHelper.setForceDesktopCookie(ThisCustomer); string TargetPage = CommonLogic.QueryStringCanBeDangerousContent("targetpage"); Response.Redirect(TargetPage); }
public ActionResult Welcome() { //判斷裝置 if (!MobileHelper.IsMobileDevice(Request.UserAgent)) { return(Redirect("https://github.com/DakHarry/WorkDaily")); } return(RedirectToAction("Index")); }
protected override void OnResume() { base.OnResume(); var userSelectedCulture = CultureInfo.CreateSpecificCulture("en-US"); userSelectedCulture.NumberFormat.CurrencyNegativePattern = 1; Thread.CurrentThread.CurrentCulture = userSelectedCulture; mobileHelper = new MobileHelper(); }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/", ThisCustomer); int productid = CommonLogic.QueryStringNativeInt("productid"); XmlPackage2 xp = new XmlPackage2("mobile.vortxmultiimage", ThisCustomer, ThisCustomer.SkinID, "", "productid=" + productid); XMLPackagePlaceHolder.Text = AppLogic.RunXmlPackage(xp, null, ThisCustomer, ThisCustomer.SkinID, true, false); }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/checkoutgiftcard.aspx", ThisCustomer); Response.CacheControl = "private"; Response.Expires = -1; Response.AddHeader("pragma", "no-cache"); RequireSecurePage(); SectionTitle = AppLogic.GetString("checkoutpayment.aspx.1", SkinID, ThisCustomer.LocaleSetting); cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); // ----------------------------------------------------------------------------------------------- // NOTE ON PAGE LOAD LOGIC: // We are checking here for required elements to allowing the customer to stay on this page. // Many of these checks may be redundant, and they DO add a bit of overhead in terms of db calls, but ANYTHING really // could have changed since the customer was on the last page. Remember, the web is completely stateless. Assume this // page was executed by ANYONE at ANYTIME (even someone trying to break the cart). // It could have been yesterday, or 1 second ago, and other customers could have purchased limitied inventory products, // coupons may no longer be valid, etc, etc, etc... // ----------------------------------------------------------------------------------------------- ErrorMessage err; if (!ThisCustomer.IsRegistered && !AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") || cart.HasRecurringComponents()) { Response.Redirect("createaccount.aspx?checkout=true"); } if (ThisCustomer.PrimaryBillingAddressID == 0 || ThisCustomer.PrimaryShippingAddressID == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("checkoutpayment.aspx.2", SkinID, ThisCustomer.LocaleSetting))); Response.Redirect("shoppingcart.aspx?resetlinkback=1&errormsg=" + err.MessageId); } // re-validate all shipping info, as ANYTHING could have changed since last page: if (!cart.ShippingIsAllValid()) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("shoppingcart.cs.95", ThisCustomer.SkinID, ThisCustomer.LocaleSetting))); HttpContext.Current.Response.Redirect("shoppingcart.aspx?resetlinkback=1&errormsg=" + err.MessageId); } if (!IsPostBack) { CreateGiftCards(cart); InitializePageContent(); if (!ContainsEmailGiftCards) { Response.Redirect("checkoutpayment.aspx"); } } #region vortx init xmlpackage CheckoutHeader.Text = Vortx.MobileFramework.MobileXSLTExtensionBase.GetCheckoutHeader("shopping"); #endregion }
protected override void OnInit(EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/address.aspx", ThisCustomer); if (ThisCustomer.IsRegistered == false) { Response.Redirect("~/signin.aspx"); } InitializePageContent(); base.OnInit(e); }
protected override void OnInit(EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/googletopics.aspx", ThisCustomer); Topic pageNotFoundTopic = new Topic("PageNotFound"); litTopicNotFound.Text = pageNotFoundTopic.Contents; DetermineIntendedPage(); base.OnInit(e); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { // value == RdlActor if (value == null) { return(null); } var actor = value as RdlActor; return(MobileHelper.IsQuestGiver(actor) ? Visibility.Visible : Visibility.Collapsed); }
public async Task <Person> GetItemAsync(string id) { Person retorno = null; var resposta = await MobileHelper.CallApi(HttpMethod.Get, $"{API_PESSOAS}/{id}"); if (resposta.IsSuccessStatusCode) { var content = await resposta.Content.ReadAsStringAsync(); retorno = JsonConvert.DeserializeObject <Person>(content); } return(retorno); }
private void SetDetails() { if (this.Actor != null) { MainImage.Source = this.GetImageSource(); bool isProperName = this.Actor.Properties.GetValue <bool>("HasProperName"); // TODO: Display some type of icon when a dead avatar is displayed. // TODO: Also, if the avatar is dead then display the LOOT icon, if the target id of the dead // avatar equals the current player. if (this.Actor.Properties.GetValue <bool>("IsDead")) { NameLabel.Text = String.Concat(this.Actor.Name.AUpper(isProperName), " (DEAD)"); // Hide the "Set Target" button and display the LOOT button. btnAttack.Visibility = Visibility.Collapsed; btnTell.Visibility = Visibility.Collapsed; // Can't talk to something that is dead. btnLoot.Visibility = Visibility.Visible; } else { NameLabel.Text = this.Actor.Name.A(isProperName); } if (!this.Actor.Properties.GetValue <bool>("CanAttack")) { btnAttack.Visibility = Visibility.Collapsed; } if (MobileHelper.IsGoodsAndServicesSeller(this.Actor)) { btnCommerce.Visibility = Visibility.Visible; } else { btnCommerce.Visibility = Visibility.Collapsed; } if (MobileHelper.IsQuestGiver(this.Actor)) { btnQuests.Visibility = Visibility.Visible; } else { btnQuests.Visibility = Visibility.Collapsed; } } }
public ActionResult Tweet(string Tweet) { if (MobileHelper.IsMobileDevice(Request.UserAgent)) { return(RedirectToAction("tweet", "mobile")); } if (!string.IsNullOrEmpty(Tweet)) { TwitterModel.Instance.UpdateStatus(Tweet, User.Identity.Name); } return(RedirectToAction("Index")); }
public ActionResult Retweet(string id) { if (MobileHelper.IsMobileDevice(Request.UserAgent)) { return(RedirectToAction("retweet", "mobile")); } if (!string.IsNullOrEmpty(id)) { TwitterModel.Instance.Retweet(id, User.Identity.Name); } return(RedirectToAction("Index")); }
public async Task <IEnumerable <Person> > GetItemsAsync() { List <Person> lista = new List <Person>(); var resposta = await MobileHelper.CallApi(HttpMethod.Get, API_PESSOAS); if (resposta.IsSuccessStatusCode) { var content = await resposta.Content.ReadAsStringAsync(); var retorno = JsonConvert.DeserializeObject <List <Person> >(content); lista.AddRange(retorno); } return(lista); }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/kitproduct.aspx", ThisCustomer); if (this.IsPostBack) { ResolveTemplateGroupsSelection(); } if (!AppLogic.AppConfigBool("ShowBuyButtons") || !KitData.ShowBuyButton || AppLogic.HideForWholesaleSite(ThisCustomer.CustomerLevelID)) { pnlAddToCart.Visible = false; } }
/// <summary> /// Creates the lava template from the list of fields. /// </summary> /// <returns></returns> private string CreateLavaTemplate() { var properties = new Dictionary <string, string> { { "Id", "Id" }, { "Guid", "Guid" }, { "Name", "Name" }, { "StartDateTime", "DateTime" }, { "EndDateTime", "EndDateTime" }, { "Campus", "Campus" }, { "Audiences", "Audiences" } }; return(MobileHelper.CreateItemLavaTemplate(properties, null)); }
/// <summary> /// Gets the response to send for a valid login on mobile. /// </summary> /// <param name="userLogin">The user login.</param> /// <param name="rememberMe">if set to <c>true</c> then the login should persist beyond this session.</param> /// <returns>The result of the action.</returns> private BlockActionResult GetMobileResponse(UserLogin userLogin, bool rememberMe) { var site = PageCache.Layout.Site; var authCookie = Rock.Security.Authorization.GetSimpleAuthCookie(userLogin.UserName, rememberMe, false); var mobilePerson = MobileHelper.GetMobilePerson(userLogin.Person, site); mobilePerson.AuthToken = authCookie.Value; return(ActionOk(new { Person = mobilePerson })); }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.setForceMobileCookie(ThisCustomer); string ReturnURL = CommonLogic.QueryStringCanBeDangerousContent("returnurl"); AppLogic.CheckForScriptTag(ReturnURL); if (ReturnURL.Length > 3) { Response.Redirect(ReturnURL); } else { Response.Redirect("default.aspx"); } }
private MobileAppendix BuildPlayer(ScriptingImplementation backend, AndroidArchitecture architecture, bool buildAab) { PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, backend); EditorUserBuildSettings.buildAppBundle = buildAab; PlayerSettings.Android.targetArchitectures = architecture; var buildName = "test" + (buildAab ? ".aab" : string.Empty); var options = new BuildPlayerOptions { target = BuildTarget.Android, locationPathName = Path.Combine(m_BuildPath, buildName), }; var report = BuildPipeline.BuildPlayer(options); return(MobileHelper.LoadMobileAppendix(report.summary.guid.ToString())); }
public IHttpActionResult Login([FromBody] LoginParameters loginParameters, Guid?personalDeviceGuid = null) { var site = MobileHelper.GetCurrentApplicationSite(); if (site == null) { return(StatusCode(System.Net.HttpStatusCode.Unauthorized)); } // // Use the existing AuthController.IsLoginValid method for actual authorization check. Throws exception if not authorized. // if (!AuthController.IsLoginValid(loginParameters, out var errorMessage, out var userName)) { var errorResponse = ControllerContext.Request.CreateErrorResponse(System.Net.HttpStatusCode.Unauthorized, errorMessage); throw new HttpResponseException(errorResponse); } // // Find the user and translate to a mobile person. // using (var rockContext = new Rock.Data.RockContext()) { var userLoginService = new UserLoginService(rockContext); var userLogin = userLoginService.GetByUserName(loginParameters.Username); if (personalDeviceGuid.HasValue) { var personalDevice = new PersonalDeviceService(rockContext).Get(personalDeviceGuid.Value); if (personalDevice != null && personalDevice.PersonAliasId != userLogin.Person.PrimaryAliasId) { personalDevice.PersonAliasId = userLogin.Person.PrimaryAliasId; } } userLogin.LastLoginDateTime = RockDateTime.Now; rockContext.SaveChanges(); var mobilePerson = MobileHelper.GetMobilePerson(userLogin.Person, site); mobilePerson.AuthToken = MobileHelper.GetAuthenticationToken(loginParameters.Username); return(Ok(mobilePerson)); } }
/// <summary> /// Builds the common fields. /// </summary> /// <param name="member">The group.</param> /// <param name="parameters">The parameters.</param> /// <returns>A string containing the XAML that represents the common Group fields.</returns> private string BuildCommonFields(GroupMember member, Dictionary <string, string> parameters) { var sb = new StringBuilder(); sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Name", member.Person.FullName)); if (AllowRoleChange) { var items = GroupTypeCache.Get(member.Group.GroupTypeId) .Roles .Select(a => new KeyValuePair <string, string>(a.Id.ToString(), a.Name)); sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetDropDownFieldXaml("role", "Role", member.GroupRoleId.ToString(), true, items))); parameters.Add("role", "SelectedValue"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Role", member.GroupRole.Name)); } if (AllowMemberStatusChange) { var items = Enum.GetNames(typeof(GroupMemberStatus)) .Select(a => new KeyValuePair <string, string>(a, a)); sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetDropDownFieldXaml("memberstatus", "Member Status", member.GroupMemberStatus.ToString(), true, items))); parameters.Add("memberstatus", "SelectedValue"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Member Status", member.GroupMemberStatus.ToString())); } if (AllowNoteEdit) { sb.AppendLine(MobileHelper.GetSingleFieldXaml(MobileHelper.GetTextEditFieldXaml("note", "Note", member.Note, false, true))); parameters.Add("note", "Text"); } else { sb.AppendLine(MobileHelper.GetReadOnlyFieldXaml("Note", member.Note)); } return(sb.ToString()); }