Crafter CMS 2.5.x Looking for client user agent - crafter-cms

I need to change the rendering of a page depending if it is a desktop client or a mobile device.
Is there any way to get the user agent in a page controller so I set a flag and use it in the template.

If you wish to use this approach and control the template use yourself you would use the controller to look at
def agent = request.getHeader("User-Agent")

Related

How should I add multiple buttons using custom payload in the Default Response Tab (Not any other platform)?

My experience with dialog flow is minimal. I want to add clickable button responses that an end-user can select from. I do not want to use any other platform except for Default. I will be implementing this on my website. I have not enabled webhook and fulfillment yet. I just want to write the code to add buttons, test it, and then publish my agent on the website.
I have bad news for you. From the default features the only option you have for implementing it on your website is using Web Demo which does not support rich responses(button, image, etc..). That means if you want to implement a bot with rich response on your website, you will have to enable Fulfillment and use webhook.

Signature Capture on SO Invoice

We currently have a requirement where an end user can perform a signature capture inside the SO Invoice screen.
End user would click a button or execute an action from the Actions Menu. A touch screen graphical editor would come up allowing the user to use their finger or any hardware supported to create a signature image. Upon clicking Accept, the image would be stored against the document Files attachment.
We are looking for something possibly already developed, or if necessary, a control we might be able to spawn that could then write the image attachment back.
Please advise.
If I'm not mistaken, at this point the functionality to create user signatures and attach the signature image file to an Acumatica ERP form that supports file attachments is exclusively available only in Acumatica mobile applications. I wish there were an Aspx control inside the framework, which could be used as is for that purpose, but unfortunately, there is not any to my knowledge.
An alternative approach is to create a custom PXSmartPanel embedding a custom HTML webpage (via the InnerPageUrl property). The custom HTML page can be used only to capture the signature and attach it to the current record inside Acumatica.
Since RuslanDev noted the mobile application for this, I'll share the MSDL code from the new T400 class on Customization of the Mobile Application. I don't think this is what you were asking, but I'm adding as an answer to preserve formatting for those that may be looking for how to do this in Mobile.
To add to the mobile application on 2018 R2, use the new Mobile Applications section of the Customization Project. Simply add the - add recordAction "SignReport" - section as shown below.
update screen SO301000 {
update container "OrderSummary" {
add recordAction "SignReport" {
behavior = SignReport
displayName = "Sign"
}
}
}

Custom subscribe button

I would like to customize the subscribe button and add it to my website, how can I do that?
Currently users can subscribe to push notifications using this link:
https://pushpad.xyz/p/3898
You have different options.
Option 1 - Use Pushpad Express with ui=false
I think that the easiest way is to create a button on your website and use the ui=false option as described here:
https://pushpad.xyz/docs/pushpad_express_without_ui
For example create a button with this link on your website:
https://pushpad.xyz/p/YOUR_PROJECT_ID?ui=false
NOTE: I've noticed that you use a legacy version of Pushpad, which unfortunately doesn't support the ui=false option. In order to use the ui=false option you need to create a new sender (and select Pushpad Express) and then create a new project associated to the new sender.
Option 2 - Use Pushpad Pro
Otherwise, if you don't want to redirect the user to a Pushpad subdomain, you can use Pushpad Pro:
https://pushpad.xyz/docs/pushpad_pro_getting_started
Also see the "Button" example on this page: https://pushpad.xyz/docs/javascript_sdk_examples

Enable sharing Spotify listening activity on Facebook via API?

Is it possible to enable sharing listening activity with Facebook from the Spotify API?
SPSession seems to have functions around scrobbling:
-(void)setScrobblingState:(sp_scrobbling_state)state forService:(sp_social_provider)service callback:(SPErrorableOperationCallback)block;
If not, is it possible to know if a user has enabled sharing to Facebook?
Edit: Thanks for the answer! Looks like there's an enum sp_social_provider that has a possible value SP_SOCIAL_PROVIDER_FACEBOOK for use with the following functions:
setScrobblingUserName:password:forService:callback:
setScrobblingState:forService:callback:
You can use SPSession's fetchScrobblingStateForService:callback: to find out if scrobbling to a particular service is enabled.
To enable scribbling if it isn't enabled, you need to call setScrobblingUserName:password:forService:callback: to set credentials for the service, then setScrobblingState:forService:callback: to enable it.
Set the state to SP_SCROBBLING_STATE_USE_GLOBAL_SETTING to keep the user's global preferences in your session (which is preferred).

set cutom user agent in web browser control when navigating to a single page

How can I set a custom user agent for a webbrowser control? The control is loading a page where I need to spoof it. I am using c sharp.
This has been asked many times on here. I suggest searching for a solution next time before posting a new question, but you can easily do this by using the WebBrowser control's Navigate() method. Just note that this will only work when you use this method, after you navigate to another page, it will "reset".
webBrowser1.Navigate("http://yoursite.com", "_self", null, "User-Agent: Custom User Agent string");
Also, other header information can be included in the header parameter as well. More information can be found here.
Microsoft's official way to customize the User Agent is to implement the IOleControl::OnAmbientPropertyChange event to respond to DISPID_AMBIENT_USERAGENT requests (but does not affect Navigate() or a page's DOM), or use UrlMkSetSessionOption(URLMON_OPTION_USERAGENT).

Resources