Scottish News Links

From All n One's bxp software Wixi

Jump to: navigation, search

It can be useful to background research on a company for sales purposes. To this end bxp software can save a lot of time in research. The newspaper button links are simple JavaScript which reads the name of the company and then searches the relevant site for related articles. In this way you can scan a news paper for company related articles to further the background research of the company.

The first part is to put in a section header to hold the buttons. The following has three rows of buttons. The first are national news agencies.

<input type=button name=btnScotNewsTools1 id=btnScotNewsTools1 class='Master_Button' style='width:19%;' value='The Herald' />
<input type=button name=btnScotNewsTools2 id=btnScotNewsTools2 class='Master_Button' style='width:19%;' value='The Daily Telegraph' />
<input type=button name=btnScotNewsTools3 id=btnScotNewsTools3 class='Master_Button' style='width:19%;' value='The Courier' />
<input type=button name=btnScotNewsTools4 id=btnScotNewsTools4 class='Master_Button' style='width:19%;' value='The Press and Journal' />
<input type=button name=btnScotNewsTools5 id=btnScotNewsTools5 class='Master_Button' style='width:19%;' value='The Daily Record' />

So this adds the button, now we need to add some JavaScript to the onload of the page to add the functionality to the buttons. The first line looks up the field with the company name to do the searching on.

var strNewsKeyword = document.getElementById('strCDA_41_field_0_4').value;

//onLoad function to set up links if existing record
function fn_InitialiseScotsNewsLinks() {

	//If the values have been initialised
	if (strNewsKeyword != '') {
	
		//Add the onclick event to allow window.open
		addEvent( document.getElementById('btnScotNewsTools1'), 'click', strURL_Scots_Herald );
		addEvent( document.getElementById('btnScotNewsTools2'), 'click', strURL_Scots_Telegraph );
		addEvent( document.getElementById('btnScotNewsTools3'), 'click', strURL_Scots_Courier );
		addEvent( document.getElementById('btnScotNewsTools4'), 'click', strURL_Scots_PressAndJournal );
		addEvent( document.getElementById('btnScotNewsTools5'), 'click', strURL_Scots_DailyRecord );
	}
}

//Daniels add event function
function addEvent( obj, type, fn ) {
	if ( obj.attachEvent ) {
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
		obj.attachEvent( 'on'+type, obj[type+fn] );
	} else
	obj.addEventListener( type, fn, false );
}

//The News Sites
function strURL_Scots_Herald(){
	window.open("http://www.heraldscotland.com/search?s=" + strNewsKeyword + "");
}
function strURL_Scots_Telegraph(){
	window.open("http://www.telegraph.co.uk/search/?queryText=" + strNewsKeyword + "");
}
function strURL_Scots_Courier(){
	window.open("http://www.thecourier.co.uk/search?q=" + strNewsKeyword + "");
}
function strURL_Scots_PressAndJournal(){
	window.open("http://www.pressandjournal.co.uk/Search.aspx?q=" + strNewsKeyword + "");
}
function strURL_Scots_DailyRecord(){
	window.open("http://www.dailyrecord.co.uk/search/simple.do?destinationSectionId=3156&publicationName=dailyrecord&sortString=publishdate&sortOrder=desc&sectionId=3151&articleTypes=news+opinion+advice&pageNumber=1&pageLength=20&searchString=" + strNewsKeyword + "");
}

//OnLoad fire it all off
fn_InitialiseScotsNewsLinks();