<?php

    include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
    include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
    
    /**
     * Plugin offers you to integrate JUpload with pLog.
     */
    class PluginJUpload extends PluginBase
    {
        var $resourceCenterEnabled;
        var $pluginEnabled;
        var $maxFilesPerRequest;
        var $maxTotalRequestSize;
           
        function PluginJUpload()
        {
            $this->PluginBase();
  
            $this->id = "jupload";
            $this->author = "Mark Wu";
            $this->desc = "This plugin offers you to integrate JUpload with pLog.";
  
            $config =& Config::getConfig();
            $this->resourceCenterEnabled = $config->getValue( "resources_enabled" );
            $this->pluginEnabled = $config->getValue( "plugin_jupload_enabled" );
            $this->maxFilesPerRequest = $config->getValue( "plugin_jupload_maxfilesperrequest" );
            $this->maxTotalRequestSize = $config->getValue( "maximum_file_upload_size" );
            
            $this->locales = Array();
            
            $this->init();            
        }

		function init()
		{
            $this->registerAdminAction( "juploadConfig", "PluginJUploadConfigAction" );
			$this->registerAdminAction( "juploadUpdateConfig", "PluginJUploadUpdateConfigAction" );
            $this->registerAdminAction( "juploadNewResource", "PluginJUploadNewResourceAction" );
			$this->registerAdminAction( "juploadAddResource", "PluginJUploadAddResourceAction" );
			
			$this->addMenuEntry( "/menu/adminSettings/GlobalSettings", "juploadConfig", "?op=juploadConfig","" );			
            if ( $this->resourceCenterEnabled && $this->pluginEnabled )
            {
                $this->addMenuEntry( "/menu/ResourcesGroup/resourceCenter", "juploadNewResource", "?op=juploadNewResource", "" );
            }
		}

	    function isEnabled()
	    {
	        return $this->pluginEnabled;
	    }
	    
	    function getMaxFilesPerRequest()
	    {
	        return $this->maxFilesPerRequest;
	    }
	    
	    function getMaxTotalRequestSize()
	    {
	        return $this->maxTotalRequestSize;
	    }
    }
?>