This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "FusionForge".
The branch, 6.1 has been updated via ccc3d40aae7919467831370ff5524a0e732951d1 (commit) from a3b5eb4d1d11d5b1c43715215a98db5c377b6a33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ccc3d40aae7919467831370ff5524a0e732951d1 commit ccc3d40aae7919467831370ff5524a0e732951d1 Author: Franck Villaume <franck.villa...@trivialdev.com> Date: Thu Feb 15 21:26:45 2018 +0100 scmhg: more multirepo support: scmsvn, scmcvs diff --git a/src/plugins/scmhook/common/scmhookPlugin.class.php b/src/plugins/scmhook/common/scmhookPlugin.class.php index 8ccc279..b120806 100644 --- a/src/plugins/scmhook/common/scmhookPlugin.class.php +++ b/src/plugins/scmhook/common/scmhookPlugin.class.php @@ -320,61 +320,64 @@ project independently."); $repositories = $scm_plugin->getRepositories($groupObject); // Group available hooks by type $hooks_by_type = array(); - foreach ($hooksAvailable as $hook) + $hookCount = 0; + foreach ($hooksAvailable as $hook) { if ($hook->label == 'scmsvn') { $hooks_by_type[$hook->getHookType()][] = $hook; + $hookCount++; } - // Display available hooks, in specific order - foreach (array('pre-commit', 'pre-revprop-change', 'post-commit') as $hooktype) { - $hooks = $hooks_by_type[$hooktype]; - if (count($hooks)) { - echo html_e('h3', array(), sprintf(_('%s Hooks'), $hooktype), false); - $tabletop = array('', _('Hook Name'), _('Description')); - $classth = array('unsortable', '', ''); - echo $HTML->listTableTop($tabletop, array(), "sortable_scmhook_$hooktype", 'sortable', $classth); + } + if (count($hookCount)) { + $tabletop = array(_('Repository')); + $classth = array(''); + $titleArr = array(''); + + foreach (array('pre-commit', 'pre-revprop-change', 'post-commit') as $hooktype) { + $hooks = $hooks_by_type[$hooktype]; foreach ($hooks as $hook) { - if (! empty($hook->onlyGlobalAdmin) && ! Permission::isGlobalAdmin()) { - echo '<tr class="hide" ><td>'; - } - else { - echo '<tr><td>'; - } - echo '<input type="checkbox" '; - echo 'name="'.$hook->getLabel().'_'.$hook->getClassname().'" '; - if (in_array($hook->getClassname(), $hooksEnabled)) - echo ' checked="checked"'; - - if (!$hook->isAvailable()) - echo ' disabled="disabled"'; - - echo ' />'; - echo '</td><td'; - if (!$hook->isAvailable()) - echo ' title="'.$hook->getDisabledMessage().'"'; - - echo ' >'; - echo $hook->getName(); - echo '</td><td>'; - echo $hook->getDescription(); - echo '</td></tr>'; - $table = 'plugin_scmhook_scmsvn_'.strtolower($hook->getClassname()); - if (db_check_table_exists($table)) { - $res = db_query_params('SELECT * FROM '.$table.' WHERE group_id=$1', array($group_id)); - $values = db_fetch_array($res); - foreach ($hook->getParams() as $pname => $pconf) { - echo "<tr><td></td><td>{$pconf['description']}</td><td>"; - $val = ($values[$pname] != null) ? $values[$pname] : $pconf['default']; - switch($pconf['type']) { - case 'emails': - print "<input type='text' name='scmsvn_{$hook->getClassname()}_$pname' value='$val' size=40/>"; - break; + $tabletop[] = $hook->getName(); + $classth[] = 'unsortable'; + $titleArr[] = $hook->getDescription().' ('.$hooktype.')'; + } + } + + echo $HTML->listTableTop($tabletop, '', 'sortable_scmhook_scmgit', 'sortable', $classth, $titleArr); + foreach($repositories as $repository) { + $cells = array(); + $cells[][] = $repository; + foreach (array('pre-commit', 'pre-revprop-change', 'post-commit') as $hooktype) { + $hooks = $hooks_by_type[$hooktype]; + foreach ($hooks as $hook) { + $attr = array('type' => 'checkbox'); + if ((!empty($hook->onlyGlobalAdmin) && !Permission::isGlobalAdmin()) || !$hook->isAvailable()) { + $attr = array_merge($attr, array('disabled' => 'disabled')); + if (!$hook->isAvailable()) { + $attr = array_merge($attr, array('title' => $hook->getDisabledMessage())); + } + } + if (in_array($hook->getName(), $hooksEnabled[$repository])) { + $attr = array_merge($attr, array('checked' => 'checked')); + } + $content = ''; + $table = 'plugin_scmhook_scmsvn_'.strtolower($hook->getClassname()); + if (db_check_table_exists($table)) { + $res = db_query_params('SELECT * FROM '.$table.' WHERE group_id = $1 and repository_name = $2', array($group_id, $repository)); + $values = db_fetch_array($res); + foreach ($hook->getParams() as $pname => $pconf) { + $val = ($values[$pname] != null) ? $values[$pname] : $pconf['default']; + switch($pconf['type']) { + case 'emails': + $content = html_e('input', array('type' => 'text','title' => $pconf['description'], 'name' => 'scmsvn_{'.$hook->getClassname().'}_'.$pname, 'value' => $val, 'size' => 40)); + break; + } } - echo '</td></tr>'; } + $cells[][] = html_e('input', array('type' => 'checkbox', 'name' => $hook->getLabel().'_'.$hook->getClassname(), 'value' => $repository)).$content; } } - echo $HTML->listTableBottom(); + echo $HTML->multiTableRow(array(), $cells); } + echo $HTML->listTableBottom(); } } @@ -460,7 +463,7 @@ project independently."); $classth[] = 'unsortable'; $titleArr[] = $hookPostReceive->getDescription(); } - + echo $HTML->listTableTop($tabletop, '', 'sortable_scmhook_scmgit', 'sortable', $classth, $titleArr); foreach($repositories as $repository) { $cells = array(); @@ -486,6 +489,9 @@ project independently."); function displayScmCVSHook($hooksAvailable, $hooksEnabled, $group_id) { global $HTML; + $scm_plugin = plugin_get_object('scmcvs'); + $groupObject = group_get_object($group_id); + $repositories = $scm_plugin->getRepositories($groupObject); $hooksPostCommit = array(); foreach ($hooksAvailable as $hook) { if ($hook->label == 'scmcvs') { @@ -502,39 +508,33 @@ project independently."); } } if (count($hooksPostCommit)) { - echo html_e('h3', array(), _('post-commit Hooks')); - $tabletop = array('', _('Hook Name'), _('Description')); - $classth = array('unsortable', '', ''); - echo $HTML->listTableTop($tabletop, false, 'sortable_scmhook_postcommit', 'sortable', $classth); + $tabletop = array(_('Repository')); + $classth = array(''); + $titleArr = array(''); foreach ($hooksPostCommit as $hookPostCommit) { - if (! empty($hookPostCommit->onlyGlobalAdmin) && ! Permission::isGlobalAdmin()) { - echo '<tr style="display: none;" ><td>'; - } else { - echo '<tr><td>'; - } - echo '<input type="checkbox" '; - echo 'name="'.$hookPostCommit->getLabel().'_'.$hookPostCommit->getClassname().'" '; - if (in_array($hookPostCommit->getClassname(), $hooksEnabled)) - echo ' checked="checked"'; - - if (!$hookPostCommit->isAvailable()) - echo ' disabled="disabled"'; - - echo ' />'; - if (in_array($hookPostCommit->getClassname(), $hooksEnabled)) { - echo '<input type="hidden" '; - echo 'name="'.$hookPostCommit->getLabel().'_'.$hookPostCommit->getClassname().'" '; - echo 'value="on" />'; + $tabletop[] = $hookPostCommit->getName(); + $classth[] = 'unsortable'; + $titleArr[] = $hookPostCommit->getDescription(); + } + + echo $HTML->listTableTop($tabletop, '', 'sortable_scmhook_scmgit', 'sortable', $classth, $titleArr); + foreach($repositories as $repository) { + $cells = array(); + $cells[][] = $repository; + foreach ($hooksPostCommit as $hookPostCommit) { + $attr = array('type' => 'checkbox'); + if ((!empty($hookPostCommit->onlyGlobalAdmin) && !Permission::isGlobalAdmin()) || !$hookPostCommit->isAvailable()) { + $attr = array_merge($attr, array('disabled' => 'disabled')); + if (!$hookPostCommit->isAvailable()) { + $attr = array_merge($attr, array('title' => $hookPostCommit->getDisabledMessage())); + } + } + if (in_array($hookPostCommit->getName(), $hooksEnabled[$repository])) { + $attr = array_merge($attr, array('checked' => 'checked')); + } + $cells[][] = html_e('input', array('type' => 'checkbox', 'name' => $hookPostCommit->getLabel().'_'.$hookPostCommit->getClassname(), 'value' => $repository)); } - echo '</td><td'; - if (!$hookPostCommit->isAvailable()) - echo ' class="tabtitle-w" title="'.$hookPostCommit->getDisabledMessage().'"'; - - echo ' >'; - echo $hookPostCommit->getName(); - echo '</td><td>'; - echo $hookPostCommit->getDescription(); - echo '</td></tr>'; + echo $HTML->multiTableRow(array(), $cells); } echo $HTML->listTableBottom(); } diff --git a/src/plugins/scmhook/db/20180215-plugin_scmhook_multirepo_support.sql b/src/plugins/scmhook/db/20180215-plugin_scmhook_multirepo_support.sql index 89c1490..4f01588 100644 --- a/src/plugins/scmhook/db/20180215-plugin_scmhook_multirepo_support.sql +++ b/src/plugins/scmhook/db/20180215-plugin_scmhook_multirepo_support.sql @@ -1,2 +1,4 @@ ALTER TABLE plugin_scmhook ADD COLUMN repository_name text; UPDATE plugin_scmhook SET repository_name = (SELECT unix_group_name FROM groups,plugin_scmhook WHERE groups.group_id = plugin_scmhook.id_group); +ALTER TABLE plugin_scmhook_scmsvn_commitemail ADD COLUMN repository_name text; +UPDATE plugin_scmhook_scmsvn_commitemail SET repository_name = (SELECT unix_group_name FROM groups,plugin_scmhook_scmsvn_commitemail WHERE groups.group_id = plugin_scmhook_scmsvn_commitemail.group_id); ----------------------------------------------------------------------- Summary of changes: src/plugins/scmhook/common/scmhookPlugin.class.php | 156 ++++++++++----------- .../20180215-plugin_scmhook_multirepo_support.sql | 2 + 2 files changed, 80 insertions(+), 78 deletions(-) hooks/post-receive -- FusionForge _______________________________________________ Fusionforge-commits mailing list Fusionforge-commits@lists.fusionforge.org http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits