--- /eprints/home/latest_news-1.0/perl_lib/EPrints/Plugin/Screen/News.pm	2007-02-14 03:25:54.000000000 +0000
+++ archives/liverpool/cfg/plugins/EPrints/Plugin/Screen/News.pm	2009-04-02 15:08:35.000000000 +0100
@@ -55,7 +55,7 @@
 	my $session = $self->{session};
 	my $usertype = $session->current_user->get_value( "usertype" );
 	
-	return 1 if( $usertype eq "admin" || $usertype eq "editor" );
+	return 1 if( $session->current_user->has_role( "admin" ) || $session->current_user->has_role( "editor" ) );
 		
 	return 0;
 }
@@ -83,7 +83,7 @@
 	my $page = $session->make_doc_fragment();
 	
 	my $where = "";
-	if( $usertype ne "admin") {
+	if( !$session->current_user->has_role( "admin" ) ) {
 		$where = "WHERE createdby = '$username'";
 	}
 	
@@ -105,7 +105,7 @@
 	my $news_div = $session->make_element( "div", class=>"news" );
 	
 	my $rows = $dbh->selectall_arrayref( <<SQL );
-SELECT newsid,news,created,createdby,updated,updatedby
+SELECT newsid,news,created,createdby,updated,updatedby,title,url
 	FROM news 
 	$where
 	ORDER BY updated desc
@@ -119,7 +119,7 @@
 	}
 	
 	foreach my $row ( @$rows ) {
-		if( $usertype eq "admin" || $username eq @$row[3] ) {
+		if( $session->current_user->has_role( "admin" ) || $username eq @$row[3] ) {
 			my $news_form = $session->render_form( "GET" );
 			
 			$news_form->appendChild(
@@ -132,7 +132,18 @@
 				$session->render_hidden_field ( "newsid", @$row[0] ) );
 			
 			my $news_item = $session->make_element( "div", class=>"news-item" );
-			$news_item->appendChild( $session->make_text( @$row[1] ) );	
+
+			my $headline = $session->make_element( "b" );
+			$headline->appendChild( $session->make_text( @$row[6] ) );	
+			$news_item->appendChild( $headline );
+			$news_item->appendChild( $session->make_element( "br" ) );
+
+			$news_item->appendChild( EPrints::Extras::render_paragraphs( $session, undef, @$row[1] ) );	
+			$news_item->appendChild( $session->make_element( "br" ) );
+
+			$news_item->appendChild( EPrints::Extras::render_url_truncate_end( $session, undef, @$row[7] ) );
+			$news_item->appendChild( $session->make_element( "br" ) );
+
 			$news_form->appendChild( $news_item );
 			
 
--- /eprints/home/latest_news-1.0/perl_lib/EPrints/Plugin/Screen/News/Edit.pm	2007-02-14 03:25:54.000000000 +0000
+++ archives/liverpool/cfg/plugins/EPrints/Plugin/Screen/News/Edit.pm	2009-04-02 14:01:36.000000000 +0100
@@ -50,7 +50,7 @@
 	
 	my $usertype = $session->current_user->get_value( "usertype" );
 
-	if( $usertype ne "admin" ) {	
+	if( !$session->current_user->has_role( "admin" ) ) {	
 		my $username = $session->current_user->get_value( "username" );
 		my $newsid = $session->param( "newsid" );
 	
@@ -82,7 +82,7 @@
 	my $page = $session->make_doc_fragment();
 
 	my $news_div = $session->make_element( "div", class=>"news" );
-	my $sql = sprintf "SELECT news FROM news WHERE newsid = %d", 
+	my $sql = sprintf "SELECT news, title, url FROM news WHERE newsid = %d", 
 			$newsid;
 	my @row = $dbh->selectrow_array( $sql );
 	
@@ -98,6 +98,32 @@
 		$session->render_hidden_field ( "newsid", $newsid ) );
 		
 	my $news_item = $session->make_element( "div", class=>"news-item" );
+
+	$news_form->appendChild( $session->make_text( "Headline: " ) );
+	$news_form->appendChild( $session->make_element( "br" ) );
+	$news_form->appendChild(
+		$session->render_input_field (
+			class => "ep_form_text",
+			type => "text",
+			name => "title",
+			size => 70,
+			value => $row[1] ) );
+	$news_form->appendChild( $session->make_element( "br" ) );
+
+	$news_form->appendChild( $session->make_text( "Link: " ) );
+	$news_form->appendChild( $session->make_element( "br" ) );
+	$news_form->appendChild(
+		$session->render_input_field (
+			class => "ep_form_text",
+			type => "text",
+			name => "url",
+			size => 70,
+			value => $row[2] ) );
+	$news_form->appendChild( $session->make_element( "br" ) );
+
+	$news_form->appendChild( $session->make_text( "Story: " ) );
+	$news_form->appendChild( $session->make_element( "br" ) );
+
 	my $textarea = $session->make_element( "textarea", 
 		name=>"news", rows=>"20", cols=>"80" );
 
@@ -138,6 +164,9 @@
 	
 	my $newsid = $session->param( "newsid" );
 	my $news = $session->param( "news" );
+
+	my $title = $session->param( "title" );
+	my $url = $session->param( "url" );
 	
 	my $db = $session->get_database;
 	my $dbh = $db->{dbh};
@@ -145,11 +174,13 @@
 	my $sql;
 	
 	if( $newsid eq undef ) {
-		$sql = sprintf "INSERT INTO news (news,created,createdby,updated,updatedby) VALUES(%s,NOW(),%s,NOW(),%s)", 
-			$dbh->quote( $news ), $dbh->quote( $username ), $dbh->quote( $username );
+		$sql = sprintf "INSERT INTO news (news,title,url,created,createdby,updated,updatedby) VALUES(%s,%s,%s,NOW(),%s,NOW(),%s)", 
+			$dbh->quote( $news ), $dbh->quote( $title ), $dbh->quote( $url ),
+			$dbh->quote( $username ), $dbh->quote( $username );
 	} else {
-		$sql = sprintf "UPDATE news SET news = %s, updated = NOW(), updatedby = %s WHERE newsid = %d", 
-			$dbh->quote( $news ), $dbh->quote( $username ), $newsid;
+		$sql = sprintf "UPDATE news SET news = %s, title = %s, url = %s, updated = NOW(), updatedby = %s WHERE newsid = %d", 
+			$dbh->quote( $news ), $dbh->quote( $title ), $dbh->quote( $url ),
+			$dbh->quote( $username ), $newsid;
 	}
 		
 	$dbh->do( $sql );
--- /eprints/home/latest_news-1.0/cgi/news	2007-02-14 03:25:54.000000000 +0000
+++ cgi/news	2009-04-02 14:41:40.000000000 +0100
@@ -70,7 +70,7 @@
 }
 
 my $rows = $dbh->selectall_arrayref(<<SQL);
-SELECT newsid,news,updated,updatedby
+SELECT newsid,news,updated,updatedby,title,url
 	FROM news
 	ORDER BY updated desc
 	LIMIT $offset, $items_per_page
@@ -86,7 +86,18 @@
 	my $news_div = $session->make_element( "div", class=>"news" );
 	
 	my $news_item = $session->make_element( "div", class=>"news-item" );
-	$news_item->appendChild( $session->make_text( @$row[1] ) );
+
+	my $headline = $session->make_element( "b" );
+	$headline->appendChild( $session->make_text( @$row[4] ) );	
+	$news_item->appendChild( $headline );
+	$news_item->appendChild( $session->make_element( "br" ) );
+
+	$news_item->appendChild( EPrints::Extras::render_paragraphs( $session, undef, @$row[1] ) );	
+	$news_item->appendChild( $session->make_element( "br" ) );
+
+	$news_item->appendChild( EPrints::Extras::render_url_truncate_end( $session, undef, @$row[5] ) );
+	$news_item->appendChild( $session->make_element( "br" ) );
+
 	$news_div->appendChild( $news_item );
 	
 	my $updatedby = EPrints::DataObj::User::user_with_username( $session, @$row[3] );
