How to have FancyBox Dialog if action redirect for signing in

I have a CGridView listing resources, which can be accessed by selecting the hyper-linked cell of a row (‘Enrol’ in the image attached below). Since the corresponding action is allowed for ‘@’ users, the logged-in users get the view immediately, and the guest users is redirected to the login page. So far so good (this is how things are done in Yii, right?).

6268

categorylist.png

Since my resource view is very low on content and the user must return to the starting view, I decided to pop-it-up using fancybox. The pop-up works only if the user is logged in. Otherwise, the pop-up comes up with the message - "The requested content cannot be loaded…".

The code for the CGridView column is -




array('name'=>'Action',

	'type'=> 'raw',

	'value' => 'CHtml::link("Enrol", "javascript: jsEnrol($data->id)")',

	'htmlOptions' => array('style' => 'text-align:center'),

	'visible' => $allowEnrol,)




The corresponding javascript action is -




<script>

function jsEnrol(id){

	var cHref = $('a#fb_enrol').attr("href");

	$('a#fb_enrol').attr("href", cHref + "/create/cid/" + id);//append the ID of the row before invoking the pop-up

	$('a#fb_enrol').click();

	$('a#fb_enrol').attr("href", cHref);//reset the link-href so that the subsequent actions do not keep adding up	

}

</script>


<?php 

echo CHtml::link("Am I hidden",

	array("//participant/enrol"),

	array('title'=>'Enrol for the Tournament',

		'style'=>'display:none',

		'id'=>'fb_enrol'));


$this->widget(

	'application.extensions.fancybox.EFancyBox',

	array('target'=> '#fb_enrol',

		'config'=>array('scrolling' => 'no',

			  'titleShow' => true,

			  'padding'=>40,

	)));

?>




Do you have a way where the login view appears first and, on success returns to grid view with the intended pop-up? For the sake of consistency across the application, I may not want the login itself to appear as a pop-up.