Last active
November 19, 2024 22:54
-
-
Save jsmpros/99a98f0d2afaef00d6aef2a62e02f689 to your computer and use it in GitHub Desktop.
App Class to help generate Activity Guide dynamic URLs
This file contains hidden or 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
class ActivityGuideURL | |
/** &id is the Activity Guide ID from the PeopleTools Activity Guide component */ | |
method ActivityGuideURL(&id As string); | |
/** Optional online; Required if called from IB or AE; defaults to %Portal */ | |
method setPortal(&portal As string); | |
/** Optional online; Required if called from IB or AE; defaults to %Node */ | |
method setNode(&node As string); | |
/** For adding CONTEXTIDPARAMS to a URL */ | |
method addContextItem(&key As string, &value As string); | |
/** The method you will call to get the Activity Guide URL */ | |
method generateFluidURL() Returns string; | |
/** Use the following method to generate the PeopleSoft Generic URL you would place in a CREF */ | |
method generateGenericPeopleSoftFluidURL() Returns string; | |
method getPortal() Returns string; | |
method getNode() Returns string; | |
private | |
instance array of string &m_context; | |
instance string &m_id; | |
instance string &m_node; | |
instance string &m_portal; | |
method getContextString() Returns string; | |
end-class; | |
method ActivityGuideURL | |
/+ &id as String +/ | |
&m_id = &id; | |
&m_context = CreateArrayRept("", 0); | |
end-method; | |
method addContextItem | |
/+ &key as String, +/ | |
/+ &value as String +/ | |
REM ** Keys are usually field names, so those should be safe without escaping; | |
Local string &safeKey = EncodeURLForQueryString(&key); | |
REM ** Values could be anything, so escaping, just in case; | |
Local string &safeValue = EncodeURLForQueryString(&value); | |
&m_context.Push(&safeKey | ":" | &safeValue); | |
end-method; | |
method setPortal | |
/+ &portal as String +/ | |
&m_portal = &portal; | |
end-method; | |
method setNode | |
/+ &node as String +/ | |
&m_node = &node; | |
end-method; | |
method getPortal | |
/+ Returns String +/ | |
Local string &temp = &m_portal; | |
If (None(&temp)) Then | |
Return %Portal; | |
Else | |
Return &m_portal; | |
End-If; | |
end-method; | |
method getNode | |
/+ Returns String +/ | |
Local string &temp = &m_node; | |
If (None(&temp)) Then | |
Return %Node; | |
Else | |
Return &m_node; | |
End-If; | |
end-method; | |
method generateFluidURL | |
/+ Returns String +/ | |
Local string &url; | |
&url = GenerateComponentPortalURL(%This.getPortal(), %This.getNode(), MenuName.NUI_FRAMEWORK, "GBL", Component.PT_AGSTARTPAGE_NUI, Page.PT_AGSTARTPAGE_NUI, "U"); | |
Return &url | "&" | %This.getContextString(); | |
end-method; | |
method generateGenericPeopleSoftFluidURL | |
/+ Returns String +/ | |
Local string &url = "c/" | MenuName.NUI_FRAMEWORK | "." | Component.PT_AGSTARTPAGE_NUI | ".GBL"; | |
Return &url | "?" | %This.getContextString(); | |
end-method; | |
method getContextString | |
/+ Returns String +/ | |
Local string &context = "CONTEXTIDPARAMS=TEMPLATE_ID:" | &m_id; | |
If (&m_context.Len > 0) Then | |
&context = &context | "&CONTEXTIDPARAMS=" | &m_context.Join("&CONTEXTIDPARAMS=", "", ""); | |
End-If; | |
Return &context; | |
end-method; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment