require "include/header.inc";
require "include/milestoneslib.inc";
require "include/decisionslib.inc";
$bx = new box("100%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
start_content();
$page = "milestones";
if (check_permission($proid, $page)) {
    top_bar($proid, $page);
    print $t->translate('Milestone suggestions and agreement') . ".\n";
    print "<p align=right>[ <b>" . html_link("step3_edit.php", array("proid" => $proid), "<b>" . $t->translate('Propose Milestones') . "</b>") . "</b> ]";
    $db->query("SELECT DISTINCT(devid) FROM milestones WHERE proid='{$proid}'");
    while ($db->next_record()) {
        if (is_set_and_not_empty($auth)) {
            $who = $auth->auth["uname"];
        } else {
            $who = "";
        }
        show_milestones($proid, $db->f("devid"), $who);
    }
    print "<p><b>" . $t->translate('About what you can see and what not') . "</b>\n";
    print "<ul><li>" . $t->translate('Non-involved (registered and unregistered) users can see only the accepted milestones') . ".\n";
    print "<li>" . $t->translate('Project owners can see all milestones (proposed and accepted ones)') . ".\n";
    print "<li>" . $t->translate('Involved developers can see their own milestones and the accepted milestones from other developers') . ".\n";
    print "</ul>\n";
    if (is_accepted_sponsor($proid)) {
        create_decision_link($proid);
    }
}
end_content();
require "include/footer.inc";
page_close();
if (isset($auth) && !empty($auth->auth["perm"])) {
    page_close();
    page_open(array("sess" => "SourceAgency_Session", "auth" => "SourceAgency_Auth", "perm" => "SourceAgency_Perm"));
}
require "include/header.inc";
require "include/milestoneslib.inc";
$bx = new box("100%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
start_content();
$page = "step3_edit";
if (check_permission($proid, $page)) {
    top_bar($proid, $page);
    print $t->translate("The main developer can propose the milestone planning");
    print ".\n<br><p>\n";
    if (is_not_set_or_empty($devid)) {
        $db->query("SELECT devid FROM developing WHERE proid='{$proid}' " . "AND developer='" . $auth->auth["uname"] . "'");
        $db->next_record();
        $devid = $db->f("devid");
    }
    if (is_not_set_or_empty($submit)) {
        if (is_set_and_not_empty($preview)) {
            milestones_preview($proid, $devid);
        }
        form_milestones($proid, $devid);
    } else {
        milestones_insert($proid, $devid, $number, $goals, $release_day, $release_month, $release_year, $product, $payment);
        show_milestones($proid, $devid, $auth->auth["uname"]);
    }
}
end_content();
require "include/footer.inc";
@page_close();