1aaaa700cdfda9c1e0bd92741205d07d8e0132de
bernd First draft of gitolite-mod...

bernd authored 12 years ago

1) <?php
2) require_role(ROLE_SYSTEMUSER);
3) 
4) include("git.php");
5) 
6) $section = 'git_git';
7) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

8) $repos = list_repos();
9) $users = list_users();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

10) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

11) $action = '';
12) $form = '';
13) 
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

14) html_header("<script type=\"text/javascript\">
15)   function showDescription( ) {
16)     var do_it = (document.getElementById('gitweb').checked == false);
17)     var inputfield = document.getElementById('description');
18)     inputfield.disabled = do_it;
19)     }
20) </script>
21) ");
22) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

23) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
24)   $action = 'editrepo';
25)   title("Zugriff auf GIT-Repository ändern");
26)   output("<p>Legen Sie hier fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
27)   $form .= '<table><tr><td>Name des Repository</td><td><input type="hidden" name="repo" value="'.filter_input_general($_GET['repo']).'" />'.filter_input_general($_GET['repo']).'</td></tr>';
28) } else {
29)   $action = 'newrepo';
30)   title("Neues GIT-Repository anlegen");
31)   output("<p>Geben Sie einen Namen für das neue Repository an und legen Sie fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
32)   $form .= '<table><tr><td><label for="repo">Name des Repository</label></td><td><input type="text" id="repo" name="repo" /></td></tr>';
33) }
34) 
35) $form .= '<tr><td>Berechtigungen</td><td>';
36) foreach ($users as $user) {
37)   $r = $rw = $rwplus = '';
38)   if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

39)     $permissions = $repos[$_GET['repo']]['users'];
40)     if (isset($permissions[$user])) {
41)       switch ($permissions[$user]) {
bernd Fürs erste feature-complete

bernd authored 12 years ago

42)         case 'RW+': $rwplus = ' selected="selected"';
43)                     break;
44)         case 'RW': $rw = ' selected="selected"';
45)                    break;
46)         case 'R': $r = ' selected="selected"';
47)                   break;
48)       }
49)     }
50)   }
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

51)   $form .= '<p>'.$user.': <select name="'.$user.'"><option value="-">Zugriff verweigern</option><option value="r"'.$r.'>Lesezugriff erlauben</option><option value="rw"'.$rw.'>Lese- und Schreibzugriff</option><option value="rwplus"'.$rwplus.'>erweiterter Lese- und Schreibzugriff (inkl. &quot;rewind&quot;)</option></select></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

52) }
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

53) $checked = (isset($_GET['repo']) && isset($repos[$_GET['repo']]) && isset($repos[$_GET['repo']]['users']['gitweb']) && $repos[$_GET['repo']]['users']['gitweb'] == 'R') ? ' checked="checked"' : '';
54) $description = (isset($_GET['repo']) && isset($repos[$_GET['repo']])) ? $repos[$_GET['repo']]['description'] : '';
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

55) $disabled = $checked ? '' : ' disabled="disabled"';
56) $form .= '<p><input type="checkbox" name="gitweb" id="gitweb" value="r"'.$checked.' onclick="showDescription()" /> <label for="gitweb">Öffentlicher Lesezugriff via gitweb</label><br />
57) <label for="description">Beschreibung des Repository:</label> <input type="text" name="description" id="description" value="'.$description.'"'.$disabled.' /></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

58) $form .= '</td></tr></table>';
59) $form .= '<p><input type="submit" value="Speichern" /></p>';
60) 
61) output(html_form('git_edit', 'save', 'action='.$action, $form));