/***************************************************************************

    supportware
    Copyright (C) 2001-2010 by c.holzheuer
    c.holzheuer@sourceworx.org

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


#include <sxpagenews.h>

sxpagenews::sxpagenews( const ddstring& name, ddwebsite* site, const ddstring& title ) 
: sxpagecontentbase( name, site, "news", title )
{	
		
	init_requests();
	_use_overlay_image = site->get_config()["main"].get_bool( "use_news_overlay_images", false );
	_use_overlay_links = site->get_config()["main"].get_bool( "use_news_overlay_links", false );

	add_inner_call( "sn_box_jump", 									(ddmemptr) &sxpagenews::create_box_jump );
 
} 




/**
	Rendert die 'Nächster/Vorheriger Eintrag' Links eines Dossiers.
*/

dd_result sxpagenews::create_box_jump( dditem& item )
{

	return rs_ok;

	ddstring idnxt, idlst;
	ddwebview& table = get_view();
	table.execute( "get_previous_entry", context.id, DDADMFILTER ).read( idlst );
	table.execute( "get_next_entry", 		 context.id, DDADMFILTER ).read( idnxt );
	
	//??
	item.clear_children();
	item.clear_value();
	ddstring result;
	
	item["sn_nxt"]["id"].from_string( idnxt );
	item["sn_lst"]["id"].from_string( idlst );
	
	item["sn_lst"]["sn_pagetype"].from_string( "news" );
	item["sn_nxt"]["sn_pagetype"].from_string( "news" );			
			
	item["sn_nxt"].set_visible( !idnxt.empty() );
	item["sn_lst"].set_visible( !idlst.empty() );
	
	get_buffer().append( item.to_string() );
	
	return rs_ok;
	
}
