Bernd Wurst commited on 2018-02-19 18:33:22
Zeige 2 geänderte Dateien mit 23 Einfügungen und 4 Löschungen.
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+function setup_copy_buttons() { |
|
2 |
+ $('button.copyurl').each( |
|
3 |
+ function (i, obj) { |
|
4 |
+ $(obj).click(function () { |
|
5 |
+ var id=this.id; |
|
6 |
+ input = $('#'+id+'_url')[0]; |
|
7 |
+ input.focus(); |
|
8 |
+ input.select(); |
|
9 |
+ document.execCommand("copy"); |
|
10 |
+ }); |
|
11 |
+ } |
|
12 |
+ ); |
|
13 |
+} |
|
14 |
+ |
|
15 |
+$(function () { |
|
16 |
+ setup_copy_buttons(); |
|
17 |
+}); |
... | ... |
@@ -15,6 +15,8 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r |
15 | 15 |
*/ |
16 | 16 |
|
17 | 17 |
require_once('inc/icons.php'); |
18 |
+require_once('inc/jquery.php'); |
|
19 |
+javascript(); |
|
18 | 20 |
|
19 | 21 |
include('git.php'); |
20 | 22 |
require_role(ROLE_SYSTEMUSER); |
... | ... |
@@ -41,11 +43,11 @@ foreach ($repos as $repo => $settings) { |
41 | 43 |
$public = isset($settings['users']['gitweb']) && $settings['users']['gitweb'] == 'R'; |
42 | 44 |
$public_string = ''; |
43 | 45 |
if ($public) { |
44 |
- $public_url = 'https://'.config('gitserver').'/'.$repo.'.git'; |
|
45 |
- $git_url = 'https://'.config('gitserver').'/git/'.$repo.'.git'; |
|
46 |
- $public_string = '<br />(Öffentlicher Lesezugriff über <a href="'.$public_url.'">'.$public_url.'</a>, Clone-URL '.$git_url.')'; |
|
46 |
+ $public_viewer = 'https://'.config('gitserver').'/'.$repo.'.git'; |
|
47 |
+ $public_clone = 'https://'.config('gitserver').'/git/'.$repo.'.git'; |
|
48 |
+ $public_string = '<br />(Öffentlich einsehbar über <a href="'.$public_viewer.'">'.$public_viewer.'</a>, öffentliche clone-URL <input id="public_'.$repo.'_url" type="text" readonly="readonly" value="'.$public_clone.'"><button class="copyurl" id="public_'.$repo.'">Copy!</button>)'; |
|
47 | 49 |
} |
48 |
- output("<div><p><strong>{$repo}</strong> ".internal_link('edit', icon_edit('Zugriffsrechte bearbeiten'), 'repo='.$repo)." ".internal_link('delete', icon_delete('Repository löschen'), 'repo='.$repo)."{$description}<br />push-Adresse: {$url} {$public_string}</p><ul>"); |
|
50 |
+ output("<div><p><strong>{$repo}</strong> ".internal_link('edit', icon_edit('Zugriffsrechte bearbeiten'), 'repo='.$repo)." ".internal_link('delete', icon_delete('Repository löschen'), 'repo='.$repo)."{$description}<br />SSH-Clone/Push-URL: <input type=\"text\" id=\"private_{$repo}_url\" readonly=\"readonly\" value=\"{$url}\"><button class=\"copyurl\" id=\"private_{$repo}\">Copy!</button> {$public_string}</p><ul>"); |
|
49 | 51 |
foreach ($settings['users'] as $user => $rights) { |
50 | 52 |
if ($user == 'gitweb' || $user == 'daemon') { |
51 | 53 |
continue; |
52 | 54 |