Roxen.git / server / base_server / mainconfig.pike

version» Context lines:

Roxen.git/server/base_server/mainconfig.pike:1:   inherit "config/builders"; - string cvs_version = "$Id: mainconfig.pike,v 1.64 1997/08/13 06:51:37 neotron Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.65 1997/08/13 21:37:32 per Exp $";   inherit "roxenlib";   inherit "config/draw_things";      import Array;   import Stdio;   string status_row(object node);   string display_tabular_header(object node);   object get_template(string t);      /* Work-around for Simulate.perror */
Roxen.git/server/base_server/mainconfig.pike:141:    }    if(changed && type == NODE_MODULE_COPY_VARIABLE &&    data[VAR_TYPE] == TYPE_PORTS) {    roxen->configuration_interface_obj->changed_port_servers[config()] = 1;    // A port was changed in the current server...    }    if(saver) saver(this_object());    }   }    + int restore_more_mode() + { +  return !!file_stat(".more_mode"); + } +    object root=Node(); - int expert_mode, more_mode; + int expert_mode, more_mode=restore_more_mode();    -  + void save_more_mode() + { +  if(more_mode) +  open(".more_mode", "wct"); +  else +  rm(".more_mode"); + }    -  +    void create()   {    build_root(root);    init_ip_list();    call_out(init_ip_list, 0);   }      #define BUTTON(ACTION,TEXT,ALIGN) do{PUSH("<a href=\"/(ACTION)"+(o?o->path(1):"/")+"?"+(bar++)+"\"><img border=0 hspacing=0 vspacing=0 src=\"/auto/button/"+(lm?"lm/":"")+replace(TEXT," ","%20")+"\" alt=\""+(lm?"/ ":" ")+TEXT+" /\""+(("ALIGN"-" ")=="left"?"":" align="+("ALIGN"-" "))+"></a>");lm=0;}while(0)    - inline string shutdown_restart(string save, int compact,void|object o) - { -  return /*"<br clear=all>"*/""; - } -  +    string default_head(string h, string|void save)   {    return ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Draft//EN\">"    "<head><title>"+h+"</title></head>\n"+ BODY+"\n");   }      object find_node(string l)   {    array tmp = l/"/"-({""});    object o;
Roxen.git/server/base_server/mainconfig.pike:540:    {    sscanf(mod, "%s#", mod);    if(!roxen->allmodules[mod]) res += "<li>The unknown modules '"+mod+"'";    else res += "<li>"+roxen->allmodules[mod][0]+"\n";    }    return res+"</ul>";   }      string configuration_docs()   { -  string res; +  string res="";    foreach(get_dir("server_templates"), string c)    {    catch {    if(c[-1]=='e' || c[0]!='#')    res += ("<dt><b>"+get_template(c)->name+"</b>"+    "<dd>"+get_template(c)->desc+"<br>"+    describe_config_modules(get_template(c)->modules));    };    }    return res;
Roxen.git/server/base_server/mainconfig.pike:812:    }    }    }    return 1;   }      mapping new_configuration(object id)   {    if(!sizeof(id->variables))    return stores(new_configuration_form()); +  if(id->variables->no) +  return http_redirect(roxen->config_url()+id->not_query[1..]+"?"+bar++);       if(!id->variables->name)    return stores(default_head("Bad luck")+    "<blockquote><h1>No configuration name?</h1>"    "Either you entered no name, or your WWW-browser "    "failed to include it in the request</blockquote>");       id->variables->name=(replace(id->variables->name,"\000"," ")/" "-({""}))*" ";    if(!low_enable_configuration(id->variables->name, id->variables->type))    return stores(default_head("Bad luck") +
Roxen.git/server/base_server/mainconfig.pike:1135:   string describe_node_path(object node)   {    string q="", res="";    int cnt;    foreach(node->path(1)/"/", string p)    {    q+=p+"/";    if(cnt>0)    {   // werror("q="+q+"\n"); -  res += ("<b><font size=+1><a href=\""+q+"\">"+ +  res += ("<b><font size=+1><a href=\""+q+"?"+bar+++"\">"+    dn(find_node(http_decode_string(q[..strlen(q)-2])))+    "</a></font></b> -&gt; ");    }    else    cnt++;    }    return res[0..strlen(res)-8];   }      string status_row(object node)
Roxen.git/server/base_server/mainconfig.pike:1229:    if(sizeof(id->prestate))    {    switch(indices(id->prestate)[0])    {    // It is possible to mark variables as 'VAR_EXPERT', this    // will make it impossible to configure them whithout the    // 'expert' mode. It can be useful.    case "expert": expert_mode = 1; break;    case "noexpert": expert_mode = 0; break;    -  case "morevars": more_mode = 1; break; -  case "nomorevars": more_mode = 0; break; +  case "morevars": more_mode = 1; save_more_mode(); break; +  case "nomorevars": more_mode = 0; save_more_mode(); break;       // Fold and unfold nodes, this is _very_ simple, once all the    // supporting code was writte.    case "fold": o->folded=1; break;    case "unfold": o->folded=0; break;       case "moredocs": o->moredocs=1; break;    case "lessdocs": o->moredocs=0; break;       case "foldall":
Roxen.git/server/base_server/mainconfig.pike:1633:    BUTTON(delete, "Delete module", left);    if(o->data->copies)    BUTTON(newmodulecopy, "Copy module", left);    }       i=0;    if(o->type == NODE_MODULE_MASTER_COPY || o->type == NODE_MODULE_COPY    || o->type == NODE_MODULE_COPY_VARIABLES)    {    BUTTON(delete, "Delete module", left); +  if(more_mode)    BUTTON(refresh, "Reload module", left);    }       if(o->type == NODE_CONFIGURATION)    BUTTON(delete,"Delete this server", left);       if(nunfolded(o))    BUTTON(foldall, "Fold all",left);    if(o->changed)    BUTTON(unfoldmodified, "Unfold modified", left);
Roxen.git/server/base_server/mainconfig.pike:1668:    BUTTON(morevars, "More options", left);    else    BUTTON(nomorevars, "Fewer options", left);       if((o->changed||root->changed))    BUTTON(save, "Save", left);   // BUTTON(restart, "Restart", left);   // BUTTON(shutdown,"Shutdown", left);       PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=\"/auto/button/rm/%20\">"); -  PUSH("<br clear=all>"); + // PUSH("<br clear=all>");   // PUSH("<p align=right><font size=-1 color=blue><a href=\"$docurl\"><font color=blue>"+roxen->real_version +"</font></a></font></p>");   // PUSH("</table>");    PUSH("</body>\n");    return stores(res*"");   }