<?php
class guestbooklistAction extends security_normal {
	
	function action(){	
		$FormId=ceil($this->_getParamId(1));
		if($FormId<1)	$FormId=1;
		
		if(is_numeric($FormId)){
			global $conn;
			//查找
			$form=new model_Form();
			$form->setSubsection('WHERE type=\'guestbook\' AND isopen=1 AND form_id='.$FormId);
			$FormRS=$form->doSelectOne();

			if($FormRS){
				
			}else{
				$jsstring='Dialog.alert(\'对不起,您查看的留言不存在或已经被删除\',function(){window.location.href="'.MICE_URL.'";window.event.returnValue = false;},300,100,"提示信息");';
				MessageBox($jsstring);
				exit;
			}
		}else{
			$jsstring='Dialog.alert(\'参数错误\',function(){window.location.href="'.MICE_URL.'";window.event.returnValue = false;},300,100,"提示信息");';
			MessageBox($jsstring);
			exit;
		}

		$form2=new model_Form();
		$form2->setSubsection(' WHERE type=\'guestbook\' AND isopen=1 order by createdat DESC');
		$form2->setNrows(0);
		$form2->setOffset(20);
		$FormRS2=$form2->doSelectLimit();

		$smarty = new Smarty();
		$smarty->load_filter('pre','micePreCompileIndex');
		$smarty->assign('FormRS',$FormRS);
		$smarty->assign('FormRS2',$FormRS2);

		$filename = new getTPLFileName(__CLASS__);
		$tpl=$filename->TPLFileName;
		$smarty->display($tpl);
	}	
}
?>