$form_preamble = $request->get('form_preamble'); $form_mandatory_ref = $request->get('form_mandatory_ref'); $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref); if ($ret) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success')); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail')); } } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail')); } } // Note: no need to purify the output since the svn preamble is stored // htmlcharized and displayed with the entities. // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_general_settings', 'gen_settings'), 'help' => 'SubversionAdministrationInterface.html#SubversionGeneralSettings')); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $svn_tracked = $project->isSVNTracked(); $svn_mandatory_ref = $project->isSVNMandatoryRef(); $svn_preamble = $project->getSVNPreamble(); echo ' <H2>' . $Language->getText('svn_admin_general_settings', 'gen_settings') . '</H2> <FORM ACTION="" METHOD="post"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="general_settings"> <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y"> <h3>' . $Language->getText('svn_admin_general_settings', 'tracking') . '</H3><I> <p>' . $Language->getText('svn_admin_general_settings', 'tracking_comment', $GLOBALS['sys_name']) . '</I> <p><b>' . $Language->getText('svn_admin_general_settings', 'tracking') . '</b> <SELECT name="form_tracked"> <OPTION VALUE="1"' . ($svn_tracked == '1' ? ' SELECTED' : '') . '>' . $Language->getText('global', 'on') . '</OPTION>
$version_id = $request->get('version_selected'); $dao->updateAccessFileVersionInProject($group_id, $version_id); } $buffer = svn_utils_read_svn_access_file_defaults($project_svnroot); $buffer .= $form_accessfile; $ret = svn_utils_write_svn_access_file($project_svnroot, $buffer); if ($ret) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_access_control', 'upd_success')); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_access_control', 'upd_fail')); } } $GLOBALS['Response']->redirect('/svn/admin/?func=access_control&group_id=' . $group_id); } // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_access_control', 'access_ctrl'), 'help' => 'svn.html#subversion-access-control')); if (svn_utils_svn_repo_exists($project_svnroot)) { $select_options = array(); foreach ($dao->getAllVersions($group_id) as $row) { $select_options[] = array('id' => $row['id'], 'version' => $row['version_number'], 'date' => format_date("Y-m-d", (double) $row['version_date'], '')); } $version_number = $dao->getCurrentVersionNumber($group_id); $current_version_title = ''; if ($version_number != $dao->getLastVersionNumber($group_id)) { $current_version_title = $GLOBALS['Language']->getText('svn_admin_access_control', 'previous_version', array($version_number)); } else { $current_version_title = $GLOBALS['Language']->getText('svn_admin_access_control', 'last_version', array($version_number)); } $renderer->renderToPage('access-file-form', new SVN_AccessFile_Presenter($project, svn_utils_read_svn_access_file($project_svnroot), svn_utils_read_svn_access_file_defaults($project_svnroot, true), $select_options, $version_number, $current_version_title)); } else { $renderer->renderToPage('access-file-nofile', new SVN_AccessFile_NoFilePresenter());
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ $immutable_tags_handler = new SVN_Immutable_Tags_Handler(new SVN_Immutable_Tags_DAO()); $request->valid(new Valid_String('post_changes')); $request->valid(new Valid_String('SUBMIT')); if ($request->isPost() && $request->existAndNonEmpty('post_changes')) { $vImmutableTagsWhitelist = new Valid_Text('immutable-tags-whitelist'); $vImmutableTagsPath = new Valid_Text('immutable-tags-path'); if ($request->valid($vImmutableTagsWhitelist) && $request->valid($vImmutableTagsPath)) { $immutable_tags_whitelist = trim($request->get('immutable-tags-whitelist')); $immutable_tags_path = trim($request->get('immutable-tags-path')); $immutable_tags_handler->saveImmutableTagsForProject($group_id, $immutable_tags_whitelist, $immutable_tags_path); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail')); } $GLOBALS['Response']->redirect('/svn/admin/?func=immutable_tags&group_id=' . $group_id); } // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_immutable_tags', 'title'), 'help' => 'svn.html#subversion-administration-interface')); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $template_dir = ForgeConfig::get('codendi_dir') . '/src/templates/svn/'; $renderer = TemplateRendererFactory::build()->getRenderer($template_dir); $svnlook = new SVN_Svnlook(); $presenter = new SVN_ImmutableTagsPresenter($project, $immutable_tags_handler->getImmutableTagsWhitelistForProject($group_id), $immutable_tags_handler->getImmutableTagsPathForProject($group_id), $svnlook->getTree($project)); $renderer->renderToPage('immutable-tags', $presenter); svn_footer(array());
break; } // Redirect to the same page just to refresh it ! header("Location: " . $_SERVER['SCRIPT_URI'] . "?" . $_SERVER['QUERY_STRING']); exit; } $hp = Codendi_HTMLPurifier::instance(); $project = $pm->getProject($group_id); $svn_mailing_header = $project->getSVNMailingHeader(); // testing SVN tracking if (!$project->isSVNTracked()) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_notification', 'svn_tracking_comment')); $disabled = "disabled"; } // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_general_settings', 'gen_settings'), 'help' => 'svn.html#subversion-email-notification')); // Mail header echo ' <h2>' . $Language->getText('svn_admin_notification', 'email') . '</h2> ' . $Language->getText('svn_admin_notification', 'mail_comment') . ' <p><i>' . $Language->getText('svn_admin_notification', 'star_operator') . '</i></p> <form action="" method="post"> <input type="hidden" name="group_id" value="' . $group_id . '"> <input type="hidden" name="post_changes" value="subject_header"> <label>' . $Language->getText('svn_admin_notification', 'header') . '</label> <input type="text" name="form_mailing_header" value="' . $hp->purify($svn_mailing_header) . '" ' . $disabled . '> <br/> <input type="submit" name="submit" value="' . $Language->getText('global', 'btn_submit') . '" class="btn" ' . $disabled . '> </form>'; // List of paths & mail addresses (+delete) $svnNotificationsDetails = $svnNotification->getSvnEventNotificationDetails($group_id);
$vCanChangeSVNLog = new Valid_WhiteList('form_can_change_svn_log', array('0', '1')); $vCanChangeSVNLog->required(); if ($request->valid($vTracked) && $request->valid($vPreamble) && $request->valid($vMandatoryRef) && $request->valid($vCanChangeSVNLog)) { // group_id was validated in index. $form_tracked = $request->get('form_tracked'); $form_preamble = $request->get('form_preamble'); $form_mandatory_ref = $request->get('form_mandatory_ref'); $form_can_change_svn_log = $request->get('form_can_change_svn_log'); $ret = svn_data_update_general_settings($group_id, $form_tracked, $form_preamble, $form_mandatory_ref, $form_can_change_svn_log); if ($ret) { EventManager::instance()->processEvent(Event::SVN_UPDATE_HOOKS, array('group_id' => $group_id)); $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_general_settings', 'upd_success')); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail')); } } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_general_settings', 'upd_fail')); } $GLOBALS['Response']->redirect('/svn/admin/?func=general_settings&group_id=' . $group_id); } // Note: no need to purify the output since the svn preamble is stored // htmlcharized and displayed with the entities. // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_general_settings', 'gen_settings'), 'help' => 'svn.html#general-settings')); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $template_dir = ForgeConfig::get('codendi_dir') . '/src/templates/svn/'; $renderer = TemplateRendererFactory::build()->getRenderer($template_dir); $presenter = new SVN_GeneralSettingsPresenter($project); $renderer->renderToPage('general-settings', $presenter); svn_footer(array());
$vFunc->required(); if ($request->valid($vFunc)) { $func = $request->get('func'); switch ($func) { case 'general_settings': require './general_settings.php'; break; case 'access_control': require './access_control.php'; break; case 'notification': require './notification.php'; break; } } else { // get project object $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); if (!$project || !is_object($project) || $project->isError()) { exit_no_group(); } svn_header_admin(array('title' => $Language->getText('svn_admin_index', 'admin'), 'help' => 'SubversionAdministrationInterface.html')); echo '<H2>' . $Language->getText('svn_admin_index', 'admin') . '</H2>'; echo '<H3><a href="/svn/admin/?func=general_settings&group_id=' . $group_id . '">' . $Language->getText('svn_admin_index', 'gen_sett') . '</a></H3>'; echo '<p>' . $Language->getText('svn_admin_index', 'welcome') . '</p>'; echo '<H3><a href="/svn/admin/?func=access_control&group_id=' . $group_id . '">' . $Language->getText('svn_admin_index', 'access') . '</a></H3>'; echo '<P>' . $Language->getText('svn_admin_index', 'access_comment') . '</P>'; echo '<H3><a href="/svn/admin/?func=notification&group_id=' . $group_id . '">' . $Language->getText('svn_admin_index', 'email_sett') . '</a></H3>'; echo '<p>' . $Language->getText('svn_admin_index', 'email_comment') . '</P>'; svn_footer(array()); }
//store the custom access file in db $sql = "UPDATE groups\n SET svn_accessfile = '" . db_es($form_accessfile) . "'\n WHERE group_id = " . db_ei($group_id); db_query($sql); $buffer = svn_utils_read_svn_access_file_defaults($gname); $buffer .= $form_accessfile; $ret = svn_utils_write_svn_access_file($gname, $buffer); if ($ret) { $GLOBALS['Response']->addFeedback('info', $Language->getText('svn_admin_access_control', 'upd_success')); } else { $GLOBALS['Response']->addFeedback('error', $Language->getText('svn_admin_access_control', 'upd_fail')); } } } $hp =& Codendi_HTMLPurifier::instance(); // Display the form svn_header_admin(array('title' => $Language->getText('svn_admin_access_control', 'access_ctrl'), 'help' => 'SubversionAdministrationInterface.html#SubversionAccessControl')); echo ' <H2>' . $Language->getText('svn_admin_access_control', 'access_ctrl') . '</H2>'; if (svn_utils_svn_repo_exists($gname)) { $svn_accessfile = svn_utils_read_svn_access_file($gname); echo ' <FORM ACTION="" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="access_control"> <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y"> <p>' . $Language->getText('svn_admin_access_control', 'def_policy', $GLOBALS['sys_name']) . ' <h3>' . $Language->getText('svn_admin_access_control', 'access_ctrl_file') . ' ' . help_button('SubversionAdministrationInterface.html#SubversionAccessControl') . ':</h3> <p>' . str_replace("\n", "<br>", svn_utils_read_svn_access_file_defaults($gname, true)) . ' <TEXTAREA cols="70" rows="20" wrap="virtual" name="form_accessfile">' . $hp->purify($svn_accessfile) . '</TEXTAREA> </p> <p><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('global', 'btn_submit') . '"></p></FORM>';