<?php
/*
 * content/widget/setting/Save.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Auther: Masanori Nakashima
 * Last Update: 2010-08-23
 */
require_once( dirname(dirname(dirname(dirname(__FILE__))))
	.DIRECTORY_SEPARATOR.'system'
	.DIRECTORY_SEPARATOR.'login'
	.DIRECTORY_SEPARATOR.'ModuleBase.class.php');
require_once( dirname(dirname(dirname(__FILE__)))
	.DIRECTORY_SEPARATOR.'DaoWidget.class.php');
class content_widget_setting_Save extends system_login_ModuleBase {
	function content_widget_setting_Save() {
	}
	function execute( & $request ) {
		$widgetFileName			= strtolower(trim(stripslashes($_GET['wfile'])));
		if( strlen(trim($widgetFileName)) == 0 ) {
			$request->addError('HTMLパーツファイル名を指定してください');
		}
		
		if( !$request->isError() ) {
			$widgetObject		= new content_DaoWidget($widgetFileName);
			$widgetObject->load( $request );
			$widgetObject->file_name	= stripslashes($_POST['file_name']);
			$widgetObject->widget_name	= stripslashes($_POST['widget_name']);
			$widgetObject->description	= stripslashes($_POST['description']);
			$widgetObject->save($request);
			$request->setAttribute('content.widget.widgetObject',$widgetObject );
		}
	}
}
?>