<?PHP
#
#   FILE:  EditBlogComplete.php
#
#   Part of the Collection Workflow Integration System (CWIS)
#   Copyright 2015 Edward Almasy and Internet Scout Research Group
#   http://scout.wisc.edu/cwis/
#

CheckAuthorization(PRIV_SYSADMIN);

if (isset($_POST["Submit"]) && $_POST["Submit"] == "Save Changes" &&
    isset($_POST["F_BlogId"]) )
{

    $BlogPlugin = $GLOBALS["G_PluginManager"]->GetPluginForCurrentPage();

    $BlogId = ($_POST["F_BlogId"]=="NEW") ?
        $BlogPlugin->CreateBlog($_POST["F_BlogName"]) :
        intval($_POST["F_BlogId"]);

    $ConfigUI = new ConfigSettingsUI(
        $BlogPlugin->GetBlogConfigOptions(),
        $BlogPlugin->BlogSettings($BlogId) );

    $BlogPlugin->BlogSettings(
        $BlogId,
        $ConfigUI->GetNewSettingsFromForm() );
}

$GLOBALS["AF"]->SetJumpToPage("index.php?P=P_Blog_ListBlogs");
