In Velocity Widget, attached file GetExecutedUrl method not working

We are working to create makeover on Activity Story Stream velocity widget.

So we have modified

  1. Top level UL & LI tags in markup
  2. Modified the ui.js as per the changed markup
  3. Changed the configuration to remove the filter tabs

Note: Base Activity Story Stream widget is take from Telligent Connector for Sitecore. Therefore Configuration and other files are not same as found in Activity Story Stream widget provided in Telligent Community Site. When we have not modified the velocity script

 

However the register method is having a basic flaw that is below line gives incomplete URL for 'stream.vm' attached file

streamUrl: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('stream.vm'))',

Full register method in JavaScript

jQuery(function(){
	jQuery.telligent.evolution.widgets.NewActivityStoryStream.register({
		wrapper: '#$core_v2_widget.WrapperElementId',
		loader: '#$core_v2_encoding.JavascriptEncode($loadingId)',
		pager: '#$core_v2_encoding.JavascriptEncode($pagerId)',
		container: '#$core_v2_encoding.JavascriptEncode($containerId)',
		filterType: '$core_v2_encoding.JavascriptEncode($filterType)',
		tabs: '#$core_v2_encoding.JavascriptEncode($tabsId)',
		pageSize: $pageSize,
		streamUrl: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('stream.vm'))',
		messageId: '$core_v2_encoding.JavascriptEncode($messageId)',
	moreCommentsUrl: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('morecomments.vm'))',
	accessingUserId: $core_v2_user.Accessing.Id,
	userId: #if($user)$user.Id#else-1#end,
	groupId: #if($goupr)$group.Id#else-1#end,
	maxReplyLength: $core_v2_configuration.ActivityMessageReplyMaxLength,
	todayText: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('today'))',
	endlessScroll: #if($endlessScroll && $messageId.length == 0) true #else false #end,
	hideOriginalPost: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('hideOriginalPost'))',
	showOriginalPost: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('showOriginalPost'))',
	hideHistory: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('hideHistory'))',
	showHistory: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('showHistory'))',
	deleteActivityMessage: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('deleteActivityMessage'))',
	deleteCommentMessage: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('deleteCommentMessage'))',
	commentModeratedMessaage: '$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('CF_Comment_ModeratedMessaage'))'
});
});

 

Expected URL ( for stream.vm ) : /utility/scripted-file.ashx?_cf=stream.vm&_fid=10243&_ct=page&_cp=common-home&_ctt=294234b2950540a9a67993162fd50c1c&_ctc=46564&_ctn=7e987e474b714b01ba29b4336720c446&_cc=0&AppType=Unknown&w_filterIndex=0&w_filterType=&w_endDate=&w_pageSize=15&w_userId=46564&w_group=10&_=1389094373379

Current URL ( for stream.vm ) : /utility/scripted-file.ashx?_cf=stream.vm&_fid=10242&_ct=page&_cp=common-home&_ctt=294234b2950540a9a67993162fd50c1c&_ctc=46564&_ctn=7e987e474b714b01ba29b4336720c446&_cc=0&AppType=Unknown

 

 

Question: What could be wrongly done for such incorrect output ?

  • If you just put this in the body of the widget, does it render the proper URL?

    $core_v2_widget.GetExecutedFileUrl('stream.vm')

  • Your expected output is invalid.  The w_ prefixed parameters are generally added by the ui.js file and added to the request to the stream URL.  These are not known at the time that the URL is generated for general use.

  • In reply to Ben Tiedt:

     and Yes you were right, printing the extension output gives same URL structure both the widgets.

    So in 'ui.js' which part of code should I check ?

  • In reply to Harsh Baid:

    ok I got this working.

    When placed in Sitecore site widget works and data is received as expected.

    However the widget is not working in Telligent site as I was developing using Widget Studio to reduce the hassle for changing code and base64 encode & decode and doing IIS reset frequently to see the changes, when directly developing in Sitecore.

Related