[v2,5/5] services.cgi: add link to addon config if ui exists for it

Message ID 20221006175958.11036-6-robin.roevens@disroot.org
State Superseded
Headers
Series Fix Bug#12935 + cosmetic changes/enhancements |

Commit Message

Robin Roevens Oct. 6, 2022, 5:59 p.m. UTC
  * If a cgi file exists with the same name as an addon, the
  displayed service will be a link to that cgi file.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
 html/cgi-bin/services.cgi | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Bernhard Bitsch Oct. 6, 2022, 6:48 p.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>

Am 06.10.2022 um 19:59 schrieb Robin Roevens:
> * If a cgi file exists with the same name as an addon, the
>    displayed service will be a link to that cgi file.
> 
> Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
> ---
>   html/cgi-bin/services.cgi | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi
> index 4b379251e..14ed01c50 100644
> --- a/html/cgi-bin/services.cgi
> +++ b/html/cgi-bin/services.cgi
> @@ -192,6 +192,10 @@ END
>   
>   				# Add addon name to displayname of service if servicename differs from addon
>   				my $displayname = ($pak ne $service) ? "$service ($pak)" : $service;
> +				if ( -e "/srv/web/ipfire/cgi-bin/$pak.cgi" ) {
> +					$displayname = ($pak ne $service) ? "$service (<a href=\'$pak.cgi\'>$pak</a>)" : "<a href=\'$pak.cgi\'>$service</a>";
> +				}
> +
>   				print "<td align='left' $col width='31%'>$displayname</td> ";
>   
>   				my $status = isautorun($pak,$service,$col);
  

Patch

diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi
index 4b379251e..14ed01c50 100644
--- a/html/cgi-bin/services.cgi
+++ b/html/cgi-bin/services.cgi
@@ -192,6 +192,10 @@  END
 
 				# Add addon name to displayname of service if servicename differs from addon
 				my $displayname = ($pak ne $service) ? "$service ($pak)" : $service;
+				if ( -e "/srv/web/ipfire/cgi-bin/$pak.cgi" ) {
+					$displayname = ($pak ne $service) ? "$service (<a href=\'$pak.cgi\'>$pak</a>)" : "<a href=\'$pak.cgi\'>$service</a>";
+				} 
+
 				print "<td align='left' $col width='31%'>$displayname</td> ";
 
 				my $status = isautorun($pak,$service,$col);