Leared from CR - Double Click

 

Requirements - Double Click

 

1.       CASLoginHeader.jsp

Remove the include for CASTopBannerAdhocTextPortlet.jsp

 

Add the script into this JSP, refer to the excel sheet.

 

Ø       If current channel is non-classified channel and search channel, passing “search” to the script

Ø       If current channel is non-calssified channel and not search channel, passing “index” to the script.

Ø       If current channel is classified channel, do the following check:

Get the parameter “vgnextchannel”

If it is null or empty, using current channel to get category (X).

Else, using the passing to find the Channel, if Channel found is not null, get the channel’s category (X).

If X’s parent channel is not classified channel, passing X to the script.

Else, get parent channel’s category (Y) and format it as Y.X

For Y.X, format it again using this format

LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(LOWER(B11)),"","_"),"_&_","_"),",",""),20)

The result of the format will be passed to the script.

 

1.       get classified values from Channel

selectedChannel.getAttribute("channelOption2").getValue()

 

2.       distinguish non-classified channel

            private String categoryTypeValues[] = {

        "", "P", "V", "G"

            };

If selectedChannel.getAttribute("channelOption2").getValue() is null or blank, it is non-classified

 

3.       Search channel

Advance Search”.equals(selectedChannel.getData().getName());

Or "Simple Search".equals(selectedChannel.getData().getName());

 

4.       get vgnextchannel parameter

request.getParameter(“vgnextchannel”);

 

5.       Using vgnextchannel to get Channel

ManagedObjectVCMRef extVCMRef   = new ManagedObjectVCMRef(vgnextchannel);

Channel extChannel = (Channel)Channel.findByContentManagementId(extVCMRef);

 

6.       How to get category of Channel?

It is the channel’s aliasName, if channel’s aliasName is empty, get the channel name.

String chnName = (String)extChannel.getAttribute("channelAliasName").getValue();

If(chnName == null || chnName.trim().length == 0) {

    chnName = extChannel.getData().getName();

}

 

7.       How to get Parent Channel?

Channel parentChannel = extChannel.getParentChannelRef().getChannel();

 

8.       Format category Y.X

    xStr = xStr.trim()

                 .toLowerCase()

                 .replaceAll(" ", "_")

                 .replaceAll("_&_", "_");

 

9.       Parsing Y.X to script

<!-- begin ad tag (tile=1) -->

<script language="JavaScript" type="text/javascript">

category = <%=categoryYX%>

ord=Math.random()*10000000000000000;

document.write('<script language="JavaScript" src="http://ad.hk.doubleclick.net/adj/mc.mocca.com/category;tile=1;dcopt=ist;sz=728x90;ord=' + ord + '?" type="text/javascript"></scr' + 'ipt>');

</script><noscript><a href="http://ad.hk.doubleclick.net/jump/mc.mocca.com/category;tile=1;sz=728x90;ord=123456789?" target="_blank"><img src="http://ad.hk.doubleclick.net/ad/mc.mocca.com/category;tile=1;sz=728x90;ord=123456789?" width="728" height="90" border="0" alt=""></a></noscript><!-- End ad tag -->

 

你可能感兴趣的:(JavaScript,String,null,search,Parsing)