/** * validate that some build exists (for Test Plan related features). * If no valid build is found give feedback to user and exit. * * @author Martin Havlat * 20060809 - franciscom - check if user can create builds, * then put a link on the message page * to create link feature * **/ function validateBuildAvailability(&$db, $tpID, $tpName, $prodName) { $tp = new testplan($db); if (!$tp->getNumberOfBuilds($tpID)) { $message = '<p>' . lang_get('no_build_warning_part1') . "<b> " . htmlspecialchars($tpName) . "</b>"; $link_to_op = ''; $hint_text = ''; if (has_rights($db, "testplan_create_build") == 'yes') { // final url will be composed adding to $basehref // (one TL variable available on smarty templates) to $link_to_op $link_to_op = "lib/plan/buildEdit.php?do_action=create"; $hint_text = lang_get('create_a_build'); } else { $message .= '</p><p>' . lang_get('no_build_warning_part2') . '</p>'; } // show info and exit $smarty = new TLSmarty(); $smarty->assign('content', $message); $smarty->assign('link_to_op', $link_to_op); $smarty->assign('hint_text', $hint_text); $smarty->display('workAreaSimple.tpl'); exit; } }
/** * validate that some build exists (for Test Plan related features). * If no valid build is found give feedback to user and exit. * * @author Martin Havlat **/ function validateBuildAvailability(&$db, $tplanID, $tprojectID, $open) { $tplanMrg = new testplan($db); if (!$tplanMrg->getNumberOfBuilds($tplanID, $open, $open)) { $info = $tplanMrg->get_by_id($tplanID); $gui = new stdClass(); $gui->link_to_op = "login.php"; $gui->content = '<p>' . lang_get('no_build_warning_part1') . "<b> " . htmlspecialchars($info['name']) . "</b>"; $gui->link_to_op = ''; $gui->hint_text = ''; if ($_SESSION['currentUser']->hasRight($db, "testplan_create_build", $tprojectID, $tplanID) == 'yes') { // final url will be composed adding to $basehref // (one TL variable available on smarty templates) to $link_to_op $gui->link_to_op = "lib/plan/buildEdit.php?tproject_id={$tprojectID}&tplan_id={$tplanID}&do_action=create"; $gui->hint_text = lang_get('create_a_build'); } else { $gui->content .= '</p><p>' . lang_get('no_build_warning_part2') . '</p>'; } // show info and exit $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display('workAreaSimple.tpl'); exit; } }