<% BEGIN { push @INC, "$ENV{ZEUSHOME}/webadmin/etc/"; } use ZeusOS; use WebAdmin; Z::set_settings( "title" => "Edit Server" ); $::f{back} = "/apps/web"; if( defined $ENV{HTTP_COOKIE} ) { if( $ENV{HTTP_COOKIE} =~ /ZEUSAPPROOT=([^;]*)/ ) { $::f{back} = $1 } } %> <% Z::parse( "etc/editheader.ahtml" ) %>

General
Configuration

SSL
Configuration

Module
Configuration

Delete
server <%= $::f{server} %>

Module Configurables

<% ## Now we need to work out which modules that are active have useful ## configuration so we can give them a button my( $zc ) = new ZConf(); $zc->ZConf::load( "$ENV{ZEUSHOME}/webadmin/conf/sites/$::f{server}" ); foreach $item (sort $zc->ZConf::list( "modules" ) ) { next if( ($zc->ZConf::get( "modules!$item!enabled" )||"") ne "yes" ); open IN, "$ENV{DOCUMENT_ROOT}/apps/web/modules/$item/link" or next; $/ = "\n"; my( $flags, $href, $desc ) = ; defined $desc or next; # Now lets see if it has a link file that has LINK_HAVECONFIG set (bit 1) # # Format for a link file # 1st line: 32bit int comprising of flags defined below # 2nd line: href to module configuration page # 3rd line: Long description # # Flags are: # Have a useful configuration page : bit 1 # Am an inportant module that you don't want to turn off! : bit 2 next if (!($flags&1)); $href .= ($href =~ /\?/)?"&":"?"; $href .= "server=$::f{server}&back=/apps/web/edit.ahtml?$ENV{QUERY_STRING}"; Z::write( <$desc HERE } ## ## Now check if the modified flag is set, and if so, provide a link to ## restart the website (if the webserver is running) ## $file1 = "$ENV{ZEUSHOME}/webadmin/conf/sites/$::f{server}"; $file2 = "$ENV{ZEUSHOME}/webadmin/conf/runningsites/$::f{server}"; $modified = 0; if( -f $file1 and -f $file2 ) { $modified = 1 if ( -M $file1 <= -M $file2 ); } # Finally - are any webservers running? If so, and $modified, offer # to restart this website $webservers = 0; if( $modified ) { my( @hosts ) = (); if( open IN, "$ENV{ZEUSHOME}/webadmin/conf/hosts" ) { $/ = "\n"; @hosts = ; close IN; } foreach ( @hosts ) { next unless /:/; ($host, $port) = split ':'; if( $port ) { my $ret = WebAdmin::command( $host, $port, "info", $error, 2 ); if( $ret ) { $webservers++; last; } } } } if( $webservers ) { # $modified is implicitly set Z::write( <Configuration changes have been made. Click here to (re)start server '$::f{server}'. HERE } %>
<% Z::parse( "etc/footer.ahtml" ) %>