<?php

    include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
    include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );

    include_once( PLOG_CLASS_PATH."plugins/shoutbox/class/dao/shoutbox.class.php" );

    /**
     * shows a form with the current configuration
    */
    class PluginShoutboxConfigAction extends AdminAction {
        
        function PluginShoutboxConfigAction( $actionInfo, $request ) {
            $this->AdminAction( $actionInfo, $request );
        }
        
        function perform() {
        
            // load some configuration settings
            $blogSettings = $this->_blogInfo->getSettings();

            // Get the shoutbox entries
            $s = new Shoutbox($this->_blogInfo->getId(), $blogSettings);
            
            // create a view and export the settings to the template
            $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "shoutbox", "shoutboxConfig" );
            
            if($s->mail_alert)
                $mail_alert_checked = "checked";
            
            $this->_view->setValue( "mail_alert_checked", $mail_alert_checked);
            $this->_view->setValue( "max_length", $s->max_length);
            $this->_view->setValue( "shouts_per_view", $s->shouts_per_view);
            $this->_view->setValue( "default_nick", $s->default_nick);
            $this->_view->setValue( "default_shout", $s->default_shout);
            $this->_view->setValue( "protected_nicks", $s->protected_nicks);
            $this->_view->setValue( "protection_password", $s->protection_password);
            $this->_view->setValue( "current_page", $s->current_page);
                    
            $this->setCommonData();
            
            return true;
        }
}
?>