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

    supportware
    Copyright (C) 2001-2008 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 <dditemtrval.h>
#include <dditemset.h>
#include <ddiourl.h>
#include <ddwebpage.h>
#include <dduserid.h>
#include <ddbasetime.h>
#include <ddusermanager.h>
#include <ddwebsite.h>


int dditemtrval::_thecount = 0;

/**
	
*/

dditemtrval::dditemtrval()
{

}


/**
	
*/

dditemtrval::dditemtrval( const ddstring& name )
:	dditem( name )
{

}


/**

*/

dditemtrval::dditemtrval( const ddstring& name, const ddstring& value, const ddstring& call, size_t access )
:	dditem( name, value, call, access )
{

}



/**
	
*/

dditemtrval::~dditemtrval()
{

}

/**

*/

dd_result dditemtrval::flush_content( ddwebpage& pagelet )
{
  // check accessrights
  //??
  //if( !( get_access() & pagelet.get_user_id().get_access_rights() ) )
	//	return 1;

  // create content depending on call key
  _value = pagelet.get_site().get_translation( get_param() );
	pagelet.get_buffer().append( to_string() ); // ex: 
  return rs_ok;

}


/**
	Create a unique namestat
*/

void dditemtrval::set_name( const ddstring& name )
{
 	_name = name + ddstrutil::from_int( _thecount++ );
}


/**
	
*/

dditem* dditemtrval::clone() const
{
  return new dditemtrval( _name, _value, _param, _access );
}

