<?php
include('../../includes/checkSession.php');
$date = date('Y-m-d H:i:s');

 if (isset($_REQUEST['postComment'])) {

    $revisionID = $_REQUEST['postComment'];
    $expand_id = $_POST['expand_id'.$revisionID];

    $commentType = $_POST['commentType'.$revisionID];
    $discipline = $_POST['discipline'.$revisionID];
    $actionType = $_POST['actionType'.$revisionID];
    $subject = $_POST['subject'.$revisionID];
    $details = $_POST['details'.$revisionID];


    if (mysql_query("INSERT INTO scope_dwg_comments (dwg_id, revision_id, comment_type, discipline, action_type, subject, details, creation_date, status, companyID, created_by)
                                                      VALUES( '$expand_id', '$revisionID', '$commentType', '$discipline', '$actionType', '$subject', '$details', '$date', '1', '$id', '$ipusername') ")) {
        header("location: 03-06Scope-02Drawings02.php?expand_id=$expand_id&msg=COMMENT POSTED");
    } else {
        header("location: 03-06Scope-02Drawings02.php?expand_id=$expand_id&msg=COMMENT NOT POSTED");
    }
}else if (isset($_REQUEST['deleteComment'])) {

    $revisionID = $_REQUEST['deleteComment'];
     $expand_id = $_REQUEST['expand_id'];
    if (mysql_query("UPDATE scope_dwg_comments SET status = 0 WHERE comment_id = '$revisionID' AND companyID='$id' AND created_by = '$ipusername'")) {
        header("location: 03-06Scope-02Drawings02.php?expand_id=$expand_id&msg=COMMENT DELETED");
    } else {
        header("location: 03-06Scope-02Drawings02.php?expand_id=$expand_id&msg=COMMENT NOT DELETED");
    }
}
/*else if (isset($_REQUEST['RemoveRange'])) {
    $rangeID = $_REQUEST['RemoveRange'];

    if (mysql_query("UPDATE scope_dwg_range SET status = '2' WHERE rangeID = '$rangeID'")) {
        header("location: 03-06Scope-02Drawings02?msg=RANGE REMOVED");
    } else {
        header("location: 03-06Scope-02Drawings02?msg=RANGE NOT REMOVED");
    }
}*/

?>