# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: stepstone_save.php,v 1.3 2005/02/19 16:53:34 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$stepstone = null;
if (isset($_POST['id'])) {
    $stepstone = $db->selectObject("codemap_stepstone", "id=" . $_POST['id']);
}
if ($stepstone) {
    $loc = unserialize($stepstone->location_data);
}
if (pathos_permissions_check("manage_steps", $loc)) {
    $stepstone = codemap_stepstone::update($_POST, $stepstone);
    $stepstone->milestone_id = $_POST['milestone_id'];
    $stepstone->location_data = serialize($loc);
    if (isset($stepstone->id)) {
        $db->updateObject($stepstone, "codemap_stepstone");
    } else {
        $db->insertObject($stepstone, "codemap_stepstone");
    }
    pathos_flow_redirect();
}