Created
April 1, 2013 08:41
-
-
Save cmourizard/5283857 to your computer and use it in GitHub Desktop.
Getting main module for a SugarCRM page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( typeof(MyCustomJs) == 'undefined' ) MyCustomJs = {}; | |
if ( typeof(MyCustomJs.Helper) == 'undefined' ) MyCustomJs.Helper = {}; | |
MyCustomJs.Helper.getCurrentModuleName = function() { | |
if (typeof module_sugar_grp1 != "undefined") { | |
return module_sugar_grp1; | |
} | |
var url = YAHOO.util.History.getBookmarkedState('ajaxUILoc'); | |
if (url == null) { | |
url = wwindows.location; | |
} | |
if (url != null) { | |
var mRegex = /module=([^&#]*)/.exec(url); | |
var module = mRegex ? mRegex[1] : false; | |
if (module != false) { | |
return module; | |
} | |
} | |
return false; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment