#include #include "virtual.h" #include "virtual.m" static HELP_FILE help_virtual ("virtual","virtual"); static void vhost_edit(const char *name) { DIALOG dia; SSTRING domain(name); dia.newf_str (MSG_U(F_VHOST,"Virtual domain"),domain); dia.set_lastreadonly(); USERACCT_COMNGS comngs; comngs.set_str ("vdomain",name); comngs.getall ("virtual"); comngs.setupdia (dia); if (dia.getnb()==1){ xconf_error (MSG_U(E_NOVSERV,"There are no virtual service\n" "installed on this computer, or the corresponding\n" "Linuxconf modules are not installed/enabled")); }else{ int nof = 0; while (1){ MENU_STATUS code = dia.edit (MSG_U(T_VHOST,"Defining a new virtual host") ,MSG_U(I_VHOST ,"You can define a new virtual host/domain\n" "and immediatly do the basic configuration\n" "of the various services.") ,help_virtual ,nof); if (code == MENU_CANCEL || code == MENU_ESCAPE){ break; }else{ if (comngs.validate (dia,nof)!=-1){ comngs.save(NULL); break; } } } } } void vhost_menu() { static const char *add = MSG_U(M_ADD,"Add a new domain"); static const char *edit = MSG_U(M_EDIT,"Modify an existing domain"); static const char *menuopt[]={ "", add, "", edit, NULL }; DIALOG_MENU dia; dia.new_menuitems (menuopt); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_GLOBALVHOST,"Virtual host config") ,MSG_U(I_GLOBALVHOST ,"You can configured all virtual services for a\n" "given domain from here") ,help_virtual ,nof,0); if (code == MENU_QUIT || code == MENU_ESCAPE){ break; }else{ const char *s = dia.getmenustr(nof); if (s == edit){ xconf_notice ("not done, sorry!"); }else if (s == add){ DIALOG dia; SSTRING domain; dia.newf_str (MSG_R(F_VHOST),domain); dia.last_noempty(); if (dia.edit (MSG_U(T_NEWVDOM,"New domain") ,MSG_U(I_NEWVDOM ,"Enter the name of the new domain\n" "you want to created. You will be allowed later\n" "to configure one by one the virtual services\n" "for this domain") ,help_virtual ,nof)==MENU_ACCEPT){ vhost_edit(domain.get()); } } } } }