How to use Yahoo YUI in SuiteCRM - yui

I am learning SuiteCRM and have a longway to go. I have never used Yahoo's YUI library.
I am wanting to create a popup dialog in the AOS_Quotes Edit View page with some ajax calls and noticed in some examples that SuiteCRM makes use of Yahoo's YUI. I searched the documentation and after several search engine searches, I was not able to find anything that tells me how I include the YUI library.
Can someone direct me to how I make use of YUI in SuiteCRM and some direction on how popup's and ajax calls are made?
Thank you.
Still Learning...

SuiteCRM deprecated and totally removed YUI library with version 7.11.16
You can use existing SuiteCRM backend methods to save data using ajax and create your own popups with jQuery (latest version have an updated jQuery version)
For example, saving a field could be done with QuickEdit calls Sending these params in the call:
module: Home
action: saveHTMLField
field: phone_office
current_module: Accounts
id: 123-123-123-123
value: 563-1231-3355
view: DetailView
parent_type:
to_pdf: true
Again, don't use YUI, and if you don't need to tweak an existing popup create your own popup and use existing AJAX calls, just pay attention to the developer console (network tab) while using the CRM.

Related

Chrome Extension Disappears while clicking outside of its resolution

Is there anyway that I can make Chrome Extension's window stick in window even while clicking outside of its resolution?
I'm trying to make it Sticky on the window for one simple google login so that I don't need to go back again to click extension to open it.
By using tabs API you could retrieve windowId of the window you want to focus on. You could do it only if needed e.g. by using query method from that API. You could pass url for example.
If you created a window that you want to be still focused then you have its id already in the hand.
After that, you could use window API update method in order to draw attention or focus. Take a look at updateInfo params - focus and drawAttention.
The same could be done by using tabs API. You could pass tabId and the URL you want to redirect someone.
Now in order to make it work you have a couple of options:
You can use setInterval which would be used to check if the tabId and windowId you want are active and focus the window/tab you want in another case.
Because in the MV3 extensions using setInterval is not recommended you could use alarms. Please take a look at AlarmCreateInfo, when param should help you instead of triggering the alarm periodically.
You could also use event listeners from both windows and tabs API to listen on tab / window focus change. Then you will be able block the change (from user perspective) by methods I described before.
You should play with all approaches and pick on that suits you, because all of them have some drawback. But don't want to make that comment very long.

API to get the list of all search providers/engines?

I am developing an Opera extension. At some moment it allows the user to perform search. Now I use chrome.tabs.update with { url: `https://google.com/search?q=${encodeURIComponent(query)}`}. This is not user friendly. The better approach is to maintain a user-editable list of URLs like https://google.com/search?q= or https://ca.search.yahoo.com/search?p= in the extension's options page and allow the user to choose between them, but I really don't want to reinvent the wheel.
Chromium-based browsers all have user-configurable search engines/providers, and I want to allow the user to choose between them or just use the default. To make that possible, I basically need two API functions:
a function to get the list of all configured search engines;
a function to get the default engine.
I didn't find anything similar to my problem in the API docs.
BTW, Opera also has an undocumented chrome.search function (Chromium has none), but it always searches via Google regardless of the user's default search engine setting.
Thanks.
PS. If there is a more appropriate place to ask this question, please tell me.
I didn't find anything similar to my problem in the API docs.
Because there isn't one, unfortunately.
There is a relevant old feature request with no real activity.

Method to autoupdate Chrome Extension badge

I'm building a Chrome extension that makes the badge show a number returned from an API. I have the code working fine, but I have it listening for DOMContentLoaded, so it only updates when the user opens up the extension.
I would like the extension to check the API every time the browser loads a page. I do not need to change anything in the page, I just want to use it for timing.
I'm not sure what I should be using, should I be using background pages, event pages, or something else? What would be the best way to go about this?
Thanks in advance!
The api you want for “every time the browser loads a page” is chrome.tabs.onUpdated. You’d have:
chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab) {
chrome.browserAction.setBadgeText({"text":"ABCD","tabId":tabId});
});
An easy approach for development is to use a background page, get it working, and then figure out what changes you need to convert it to an event page. With this stub however, nothing is stopping you from making it an event page.

Google Chrome Extension - prevent cookie on jquery ajax request or Use a chome.extension

I have a great working chrome extension now.
It basically loops over a list of HTML of a web auction site, if a user has not paid for to have the image shown in the main list. A default image is shown.
My plugin use a jQuery Ajax request to load the auction page and find the main image to display as a thumbnail for any missing images. WORKS GREAT.
The plugin finds the correct image url and update the HTML Dom to the new image and sets a new width.
The issue is, that the auction site tracks all pages views and saves it to a "recently viewed" section of the site "users can see any auctions they have clicked on"
ISSUE
- My plugin uses ajax and the cookies are sent via the jQuery ajax request. I am pretty sure I cannot modify the cookies in this request so the auction site tracks the request and for any listing that has a missing image this listing is now shown in my "recently viewed" even though I have not actually navigated to it.
Can I remove cookies for ajax request (I dont think I can)
Can chrome remove the cookie (only for the ajax requests)
Could I get chrome to make the request (eg curl, with no cookie?)
Just for the curious.
Here is a page with missing images on this auction site
http://www.trademe.co.nz/Browse/SearchResults.aspx?searchType=all&searchString=toaster&type=Search&generalSearch_keypresses=9&generalSearch_suggested=0
Thanks for any input, John.
You can use the webRequest API to intercept and modify requests (including blanking headers). It cannot be used to modify requests which are created within the context of a Chrome extension though. If you want to use this API for cookie-blanking purposes, you have to load the page in a non-extension context. Either by creating a new tab, or use an off-screen tab (using the experimental offscreenTabs API.
Another option is to use the chrome.cookie API, and bind a onChanged event. Then, you can intercept cookie modifications, and revert the changes using chrome.cookies.set.
The last option is to create a new window+tab in Incognito mode. This method is not reliable, and should not be used:
The user can disallow access to the Incognito mode
The user could have navigated to the page in incognito mode, causing cookie fields to be populated.
It's disruptive: A new window is created.
Presumably this AJAX interaction is being run from a content script? Could you run it from the background page instead and pass the data to the content script? I belive the background page operates in a different context and shouldn't send the normal cookies.

UpdatePanel in SharePoint throws an error

I get the following when I click on a custom made webpart in the Web Part Gallery: The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it. If I use the webpart, ie perform a search, I get a pop-up error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The Status code returned from the server was: 500.
This webpart takes a search string from a textbox, passes it to BL/DAL and returns a data from DB. I've integrated an UpdatePanel for partial postbacks - used this blog as guide but it is not working.
I've added the scriptManager to the default.master page using MSSP Designer as the blog suggests but curiously, the script manager causes an error (red underline) In Internet Explorer 6.0 the tag <asp:ScriptManager> is not permitted.
I'm not totally sure what's up with that but here's an alternative. Dont use MS Ajax - EVER. jQuery is simpler, faster, better, stronger, sexier!
This is how I normally do this stuff:
add jQuery to your master page head
create a user control that implements your web part ui. This should use Page.ScriptManager.RegistryScriptInclude or .RegistryScriptBlock to insert script for the control. Eg, methods to do your callback using jQuery.Ajax.
create a web part wrapper for the user control
create an aspx in _layouts that acts as the 'service' for your callback. The page load can use the parameters passed from the ajax call to return some json or text
Instead of #4 you could create a web service but this is a lot harder with SharePoint - an apx will work well enough.
HTH
Cheers

Resources