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

    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.

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


#ifndef SXPAGE_H
#define SXPAGE_H

#include <ddwebpage.h>
#include <dddataconnection.h>
#include <ddwebsite.h>
#include <ddwebview.h>


/// sxpage ist eine ddwebpage mit verwaltungsfunktionen auf datentypen.
/**
	
	sxpage ist eine ddwebpage mit verwaltungsfunktionen auf datentypen.
	Damit ist der adapter-kram gegessen: das wäre das selbe in grün, bloss das die
	ganze infrastruktur an den adapter gereicht werden müsste etc.
*/

class sxpage : public ddwebpage
{

public:
    
	sxpage( const ddstring& name, ddwebsite* site, const ddstring& type="(none)", const ddstring& title=""  );
	~sxpage();
	
	virtual dd_result on_redirect( dditem& item );
	
	virtual dd_result on_overview( dditem& item ); 
	
	virtual dd_result on_user_create( dditem& item ); 
	virtual dd_result on_user_update( dditem& item ); 
	virtual dd_result on_user_publish( dditem& item ); 
	
	virtual dd_result on_create( dditem& item ); 	
	virtual dd_result on_edit( dditem& item ); 
	virtual dd_result on_update( dditem& item ); 
	virtual dd_result on_publish( dditem& item );
	virtual dd_result on_preview( dditem& item ); 
	virtual dd_result on_show( dditem& item ); 
	virtual dd_result on_show_entry( dditem& item ); 
	virtual dd_result on_set_state( dditem& item ); 
	virtual dd_result on_set_solved( dditem& item ); 
	virtual dd_result on_remove( dditem& item ); 
	virtual dd_result on_bookmark( dditem& item ); 
	virtual dd_result on_listen( dditem& item ); 
	
	virtual dd_result on_alert( dditem& item ); 
	virtual dd_result on_alert_send( dditem& item ); 
	virtual dd_result on_drop_subscription( dditem& item ); 
	
	virtual dd_result on_show_replies( dditem& item ); 
	
	virtual dd_result on_reply_create( dditem& item ); 
	virtual dd_result on_reply_update( dditem& item );
	virtual dd_result on_reply_edit( dditem& item ); 
	virtual dd_result on_reply_remove( dditem& item ); 	
 	virtual dd_result on_reply_vote( dditem& item ); 
 	
 	virtual dd_result on_close_sysmessage( dditem& item );
	
	virtual dd_result on_image_vote( dditem& item ); 
 	virtual dd_result on_image_preview( dditem& item ); 
 	virtual dd_result on_image_upload( dditem& item ); 
	virtual dd_result on_image_list( dditem& item ); 	
	
protected:
	
	virtual void init_requests();
		
	dd_result create_hint_box( dditem& item, const ddstring& hint, bool showhint=true );
	// popups	
	dd_result create_system_message( const ddstring& sysmessage1, const ddstring& sysmessage2="", const ddstring& syslink="", const ddstring& path=""  );
	dd_result create_login_message( const ddstring& msg1=DDHINTLREGISTER1, const ddstring& msg2=DDHINTLREGISTER2, const ddstring& lnk="" );

	void      create_header_entries( ddwebview& table, dditem& item );
	void      create_categories();
	
	dditem*						_hintbox;
	bool							_use_overlay_image;
	bool							_use_overlay_links;	
	ddstringmap				_typemapper;
	ddstring					_vgworttag;
	
};

#endif
