<?php
	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
	include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );

	class PluginGuestbook extends PluginBase
	{
		var $_pluginEnabled;
		var $_postPerPage;

		function PluginGuestbook()
		{
			$this->PluginBase();

			$this->id = "guestbook";
			$this->desc = "Provide guestbook for LifeType.";
			$this->author = "Minstrel Chiu";
			$this->locales = Array( "en_UK" , "zh_TW", "zh_CN" );

			$this->init();
		}

		function init()
		{
			$this->registerBlogAction("Guestbook", "GuestbookAction");
			$this->registerBlogAction("DeleteGuestbookPost", "GuestbookAction");
			$this->registerBlogAction("AddGuestbookPost", "GuestbookAction");
			$this->registerBlogAction("ReplyGuestbookPost", "GuestbookAction");
			$this->registerBlogAction("GuestbookForm", "UpdateGuestbookAction");

			$this->registerAdminAction("guestbook", "AdminGuestbookAction");
			$this->registerAdminAction("updateGuestbook", "AdminUpdateGuestbookAction");

			$menu =& Menu::getMenu();

			if(!$menu->entryExists( "/menu/controlCenter/manageGuestbook"))
				$this->addMenuEntry("/menu/controlCenter", "manageGuestbook", "", "", true, false);

			$this->addMenuEntry("/menu/controlCenter/manageGuestbook", "Guestbook", "?op=guestbook", "");
		}

		function register()
		{
			$blogSettings = $this->blogInfo->getSettings();

			$this->_pluginEnabled = $blogSettings->getValue("plugin_guestbook_enabled");
			$this->_postPerPage = $blogSettings->getValue("plugin_guestbook_postperpage");
		}

		function isEnabled()
		{
			return $this->_pluginEnabled;
		}

        function pluginTemplatePage()
        {
 			$rg = new RawRequestGenerator($this->blogInfo);
            
        	$rg->addParameter( "op", "Guestbook" );
            $rg->addParameter( "blogId", $this->blogInfo->getId());

            $templatePage = $rg->getIndexUrl().$rg->getRequest();

            return $templatePage;
        }		
	}
?>