#cgi.HTTP_ACCEPT#
#cgi.HTTP_USER_AGENT#
#session.ptMobile.mDetect.mobileBrowserType#
--->
var mblStruct = StructNew();
var isMblBrowser = false; // set mobile browser as false
var mblBrowserType = "";
var useragent = cgi.HTTP_USER_AGENT; // get the user agent value
var httpaccept = cgi.HTTP_ACCEPT; // get the content accept value
var mblOverride = TRIM(arguments.mobileOverride);
if ( LEN(TRIM(mblOverride)) AND NOT isBoolean(mblOverride) ) {
useragent = mblOverride;
}
if ( LEN(TRIM(mblOverride)) AND isBoolean(mblOverride) ) {
isMblBrowser = mblOverride;
mblBrowserType = "mobile - " & mblOverride;
} else if ( (reFindNoCase('(iphone|ipod)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "iphone/ipod";
} else if ( (reFindNoCase('(windows ce; ppc|windows ce; smartphone|windows ce; iemobile|windows phone|msiemobile|iemobile)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "windows mobile";
} else if ( (reFindNoCase('(android)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "android";
} else if ( (reFindNoCase('(opera mini|opera_mini)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "opera mini";
} else if ( (reFindNoCase('(blackberry|blackberry[0-9]+)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "blackberry";
} else if ( (reFindNoCase('(palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "palm";
} else if ( (reFindNoCase('(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|psp|treo)',useragent)) ) {
isMblBrowser = true;
mblBrowserType = "undetermined";
} else if ( (httpaccept contains "text/vnd.wap.wml") OR
(httpaccept contains 'application/vnd.wap.xhtml+xml') OR
(structKeyExists(cgi,"HTTP_X_WAP_PROFILE")) OR
( structKeyExists(cgi,"HTTP__ACCEPT") AND reFind("/wap\.|\.wap/i",httpaccept)) ) {
isMblBrowser = true;
mblBrowserType = "undetermined";
} else {
isMblBrowser = false;
mblBrowserType = "none";
}
mblStruct["isMobileBrowser"] = isMblBrowser;
mblStruct["mobileBrowserType"] = TRIM(mblBrowserType);
mblStruct["useragent"] = TRIM(useragent);
mblStruct["httpaccept"] = TRIM(httpaccept);
var XSLPath = getXSLPath();
var pageOutput = "";
var pageContent = "";
var transformOnClient = 1;
if ( (request.ptMobile.mDetect.DeviceType IS "blackberry")
OR (request.ptMobile.mDetect.DeviceType IS "android")
) {
transformOnClient = 0;
}
// pull the content out of the page
pageOutput = getPageContext().getCFOutput();
pageContent = pageOutput.getString();
// clear and close the buffer
pageOutput.clear();
pageOutput.close();
#pageContent#
var XSLPath = "#request.site.csAppsWebURL#pt_mobile/style/home.xsl";
// ** DO CONDITIONAL CHECKS BY SUBSITE, BROWSER TYPE, VARIABLES ETC... ** //
//if ( StructKeyExists(request, "page") and request.page.fileName eq "index.cfm" and request.ptMobile.mDetect.DeviceType IS NOT "blackberry" )
// XSLPath = "#request.site.csAppsWebURL#pt_mobile/style/mobile-sample2.xsl";
/*
if (StructKeyExists(application,"ADF") and (StructKeyExists(application.ADF,"data"))) {
// Set XSL path for HOME. //
homePageID = 10001;
if ( (StructKeyExists(request, "Page")) AND (StructKeyExists(request.page, "ID")) AND (ListLen(application.ADF.data.ListInCommon(request.Page.ID, homePageID))) )
{
XSLPath = "#request.site.csAppsWebURL#pt_mobile/style/home.xsl";
}
// Set XSL path for NEWS. //
newsCenterSubsiteID = 101;
if ( ListLen(application.ADF.data.ListInCommon(request.subsite.subsiteinheritance, newsCenterSubsite) ))
{
XSLPath = "#request.site.csAppsWebURL#pt_mobile/style/news.xsl";
}
}
*/
// find
if( xmlPos > 0)
{
// find the end of the ", arguments.pageContent, xmlPos + 1);
// add the xsl into the page content
if( xmlEndPos > 0 )
arguments.pageContent = insert(xslDeclaration, arguments.pageContent, xmlEndPos);
}
var XSLStr = "";
var MIMEType = "text/xml; charset=utf-8";
if( request.ptMobile.mDetect.DeviceType IS "blackberry" )
MIMEType = "application/xhtml+xml; charset=utf-8";
else if ( request.ptMobile.mDetect.DeviceType IS "android" )
MIMEType = "text/HTML;";