<div class="historique"> <dl> <dt> The branches: </dt> <dd> <table> <thead> <tr> <th class="short"> Branch </th> <th class="short"> Last version </th> <th> Release date </th><?php ?> </tr> </thead> <tbody><?php foreach ($branches as $branch_id) { $branch = branch_get_by_id($branch_id); if (!$branch) { continue; } $last_id = $branch->get_last_release(); $last = $last_id ? release_get_by_id($last_id) : 0; ?> <tr> <td> <a href="/project/view.php?id_branch=<?php echo $branch->get_id_branch(); ?> "><?php echo $branch->get_name_branch(); ?> </a> </td> <td> <?php
} $id_prj = empty($_GET['id_prj']) ? 0 : $_GET['id_prj']; if (!$id_prj) { append_error_exit('You have to specify a project.'); } $prj = project_get_by_id($id_prj); if (!$prj) { append_error_exit('Invalid project number #' . $id_prj . '.'); } if (!$prj->is_admin($me->get_id_user())) { append_error_exit('Sorry, you are not an admin for this project.'); } // ADDING A BRANCH if (!empty($_GET['name_branch'])) { $id_branch = branch_new($_GET['name_branch'], $prj->get_id_prj()); $branch = branch_get_by_id($id_branch); if (!$branch) { append_error('Unable to create a new branch'); } if (!errors()) { http_redir('/project/view.php?id_branch=' . $branch->get_id_branch()); } } ?> <?php // OUTPUT header_box("Igoan :: Adding a new branch to a project"); flush_errors();
if (!$login) { append_error('Login "' . $_GET['login'] . '" doesn\'t exist.'); } else { $branch->add_maintainer($login->get_id_user()); http_redir('/project/view.php?id_branch=' . $branch->get_id_branch()); } } } else { if (isset($_GET['id_rel'])) { # we add an author $id_rel = $_GET['id_rel']; $rel = release_get_by_id($id_rel); if (!$rel) { append_error_exit('Invalid release number #' . $id_release . '.'); } $branch = branch_get_by_id($rel->get_id_branch()); if (!$branch) { append_error_exit('Unable to fetch branch infos.'); } $prj = project_get_by_id($branch->get_id_prj()); if (!$prj) { append_error_exit('Unable to fetch project informations.'); } if (!$branch->is_maintainer($me->get_id_user()) && !$prj->is_admin($me->get_id_user())) { append_error_exit('Sorry, you are not a maintainer for this project.'); } // ACTION if (isset($login)) { if (!$login) { append_error('Login "' . $_GET['login'] . '" doesn\'t exist.'); } else {
$d_mybranches .= '<tr><td><a href="/project/view.php?id_branch=' . $tmp->get_id_branch() . '">' . $prj->get_name_prj() . '</a></td><td><a href="/project/view.php?id_branch=' . $tmp->get_id_branch() . '">' . $tmp->get_name_branch() . '</a></td><td>' . $version . '</td><td>' . $date . '</td></tr>'; } } } $d_mybranches = '<div class="historique"><dl><dt> Branches maintained by ' . $requested->get_name_user() . ': </dt>' . '<dd><table><thead><tr><th class="short"> Project name </th><th class="short"> Branch name </th>' . '<th class="short"> Last version </th><th class="short"> Last update </th></tr></thead><tbody>' . $d_mybranches . '</tbody></table></dd></dl></div>'; } // LIST OF CONTRIBUTED RELEASES (those the user appears as an author) $d_myrel = ''; $list = $requested->list_releases(); if ($list) { foreach ($list as $tmpid) { $rel = release_get_by_id($tmpid); if ($rel) { $version = $rel->get_name_rel(); $date = $rel->get_date_rel(); $b = branch_get_by_id($tmp->get_id_branch()); if ($b) { $prj = project_get_by_id($b->get_id_prj()); if ($prj) { $d_myrel .= '<tr><td><a href="/project/view.php?id_rel=' . $rel->get_id_rel() . '">' . $prj->get_name_prj() . ' (' . $b->get_name_branch() . ') ' . $version . '</a></td><td>' . $date . '</td></tr>'; } } } } $d_myrel = '<div class="historique"><dl><dt> Releases contributed by ' . $requested->get_name_user() . ': </dt>' . '<dd><table><thead><tr><th class="short"> Complete release name </th>' . '<th class="short"> Release date </th></tr></thead><tbody>' . $d_myrel . '</tbody></table></dd></dl></div>'; } // Apres les entetes, on affiche les erreurs if (errors()) { flush_errors_exit(); } // un chti flag