Thursday, 13 December 2012
Long title, yes. Easy solution? No. This bugger of a script takes a dash of re-engineering and a sprinkle of bravery. Community Builder’s plugin called ComProfiler Pro is a great add-on to make your joomla site have a beautiful directory of people (or employees) but it has an evil side where it will not agree well with hacks to it’s structure.

Recently I had to change this extension so that it would meet the Law Society of Canada’s requirement to have a disclaimer before emailing a law professional, basically stating that just because they emailed them, that it does not mean they are a client. We had to rush this before, so we added a simple old-fashion alert box to accomplish this. It was hard at first because you have to work around the built-in email cloaking of Community Builder, which is not related to the one built into Joomla.

So, to summarise I did this simple injection of code

$legal = "\'";
$legal .= "Please note that communication with the firm via email does not necessarily mean that you are a client of the firm. You are not a client of the firm until you have received a written agreement from the firm to perform legal services on your behalf. Accordingly, you should not send confidential information to the firm via email until such a written agreement is in place and the firm is under a duty to keep this information confidential. In rare cases, our e-mail filtering software may eliminate legitimate email from clients unnoticed. Therefore, if your email contains important instructions, please make sure that we acknowledge receipt of those instructions. ";
$legal .= "\'";
$replacement = '...';

$js = ' {'

. "\n var prefix='ma'+'il'+'to';"
. "\n var path = 'onclick=\"alert(" . $legal . ")\" hr'+ 'ef'+'=';"
. "\n var addy". $rand ."= '". @$mail[0] ."'+ '@' +'". implode( "' + '.' + '", $mail_parts ) ."';"
;

This did the job perfectly and gave us the simple dialogue box with-out any styling.


 

Now, I am a perfectionist and I did not like this at all and I needed to do better, so I went on a hunt for the best idea I could. I fell in love with a script called Noty, which uses JQuery to display elegant animated notification boxes. But it ran into a problem, it was not impacting enough. As much as I enjoyed adding it to the site, It needed to make sure people understood and did not miss the message. So the hunt continued.

Then I found an older but more impacting formula called Easy Confirm Dialog, again using the all powerful JQuery. Implementing it was Easy as it’s title says, and all I needed to do was add the Class to the same spot I did the alert and the cloaking picked it up perfectly. The I needed to make sure I was carrying over the url of the link, using the attr(‘href’) function after the window.open



$("#yesno").easyconfirm({locale: { title: 'Please note that communication with the firm via email does not necessarily mean that you are a client of the firm. You are not a client of the firm until you have received a written agreement from the firm to perform legal services on your behalf. Accordingly, you should not send confidential information to the firm via email until such a written agreement is in place and the firm is under a duty to keep this information confidential. In rare cases, our e-mail filtering software may eliminate legitimate email from clients unnoticed. Therefore, if your email contains important instructions, please make sure that we acknowledge receipt of those instructions.', button: ['No','Yes']}});
$("#yesno").click(function() {
window.open($(this).attr('href'),"_self")
});




js = ‘{'


. "\n var prefix='ma'+'il'+'to';"
. "\n var path = 'id=\"yesno\" hr'+ 'ef'+'=';"
. "\n var addy". $rand ."= '". @$mail[0] ."'+ '@' +'". implode( "' + '.' + '", $mail_parts ) ."';"


Without adding any CSS for this, the Default template worked perfectly, sizes with the window and you can’t miss it.
 

 

 

0 comments: