<?PHP
#
#   FILE:  AddFolder.php
#
#   Part of the Collection Workflow Integration System (CWIS)
#   Copyright 2012 Internet Scout Project
#   http://scout.wisc.edu/
#

# ----- MAIN -----------------------------------------------------------------

# check authorization and setup HTML suppression and page redirection
if (!Folders_Common::ApiPageCompletion("P_Folders_ManageFolders")) return;

$FolderName = GetArrayValue($_GET, "FolderName");

# can't do anything if there isn't a folder name to work with
if (!strlen($FolderName))
{
    return;
}

$FolderFactory = new Folders_FolderFactory($User->Id());
$ResourceFolder = $FolderFactory->GetResourceFolder();

$NewFolder = $FolderFactory->CreateFolder("Resource", $FolderName);
$ResourceFolder->AppendItem($NewFolder);
