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.57 1997/08/12 19:45:38 per Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.58 1997/08/12 22:28:10 peter Exp $";   inherit "roxenlib";   inherit "config/draw_things";      import Array;   import Stdio;   string status_row(object node);   string display_tabular_header(object node);      /* Work-around for Simulate.perror */   #define perror roxen_perror
Roxen.git/server/base_server/mainconfig.pike:16:      #define dR "ff"   #define dG "ff"   #define dB "ff"      #define bdR "00"   #define bdG "50"   #define bdB "90"       - #define BODY "<body "+(roxen->QUERY(BG)?"--background=/image/background.gif ":"")+"bgcolor=#"+dR+dG+dB+" text=black link=0x000044 vlink=0x000044 alink=red>" + #define BODY "<body bgcolor=white text=black link=black vlink=black alink=red>"      #define TABLEP(x, y) (id->supports->tables ? x : y)   #define PUSH(X) do{res+=({(X)});}while(0)      int bar=time(1);   multiset changed_port_servers;      class Node {    inherit "struct/node";   
Roxen.git/server/base_server/mainconfig.pike:47:    void change(int i)    {    changed += i;    if(up) up->change(i);    }       private string show_me(string s)    {    string name=path(1);    if(folded) -  return ("<a name=\""+name+"\">\n" -  "<a href=\"/(unfold)" + name + "?"+(bar++)+ -  "\">\n<img border=0 align=baseline src=/auto/unfold" -  +(changed?"2":"")+" alt=\""+(changed?"*-":"--")+"\">" +  return ("<a name=\""+name+"\" href=\"/(unfold)" + name + "?"+(bar++)+ +  "\">\n<img border=0 align=bottom src=\"/auto/unfold" +  +(changed?"2":"")+"\" alt=\""+(changed?"*-":"--")+"\">"    "</a>\n "+s+"\n");    else -  return ("<a name=\""+name+"\">\n" -  "<a href=\"/(fold)" + name + "?"+(bar++)+ -  "\">\n<img border=0 src=/auto/fold"+(changed?"2":"") -  +" alt="+(changed?"**":"\"\\/\"")+">" +  return ("<a name=\""+name+"\" href=\"/(fold)" + name + "?"+(bar++)+ +  "\">\n<img border=0 src=\"/auto/fold"+(changed?"2":"") +  +"\" alt="+(changed?"**":"\"\\/\"")+">"    "</a>\n "+s+"\n");    }       mixed describe(int i, object id)    {    array (string) res=({""});    object node,prevnode;    mixed tmp;       if(describer)
Roxen.git/server/base_server/mainconfig.pike:151:   int expert_mode, 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) + #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 ("<head><title>"+h+"</title></head>\n"+ BODY+"\n"); +  return ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Draft//EN\">\n" +  "<head><title>"+h+"</title></head>\n"+ BODY+"\n");   }      object find_node(string l)   {    array tmp = l/"/"-({""});    object o;    if(!sizeof(tmp)) return root;    for(o=root; sizeof(tmp) && (o=o->descend(tmp[0],1)); tmp=tmp[1..1000]);    if(!o) return 0;    return o;
Roxen.git/server/base_server/mainconfig.pike:624:    "<table><tr><td>&nbsp;<td><h2>Select a module to add"    " from the list below, click on it's header to add it.</h2>" });       foreach(mods, q)    {    if(b = module_nomore(q, a[q][2], node->config()))    {    if(b->sname != q)    res += ({("<p>"+    (roxen->QUERY(BS)?"<h2>"+a[q][0]+"</h2>": -  "<img alt=\""+a[q][0]+"\" src=/auto/module/" +a[q][2]+"/"+ -  q+" height=24 width=500>")+ "<br><blockquote>" + a[q][1] + +  "<img alt=\""+a[q][0]+"\" src=\"/auto/module/" +a[q][2]+"/"+ +  q+"\" height=24 width=500>")+ "<br><blockquote>" + a[q][1] +    "<p><i>A module of the same type is already enabled (" +    b->name + "). <a href=\"/(delete)" +    node->descend(b->name, 1)->path(1) + "?" + (bar++) +    "\">Disable that module</a> if you want this one instead</i>"    "\n<p><br><p></blockquote>")});    } else { -  res += ({"<p><a href=/(addmodule)"+node->path(1)+"?"+q+"=1>"+ +  res += ({"<p><a href=\"/(addmodule)"+node->path(1)+"?"+q+"=1\">"+    (roxen->QUERY(BS)?"<h2>"+a[q][0]+"</h2>": -  "<img border=0 alt=\""+a[q][0]+"\" src=/auto/module/" -  +a[q][2]+"/"+q+" height=24 width=500>")+ +  "<img border=0 alt=\""+a[q][0]+"\" src=\"/auto/module/" +  +a[q][2]+"/"+q+"\" height=24 width=500>")+    "</a><blockquote><br>"+a[q][1]+"<p><br><p></blockquote>"});    }    }    return res*""+"</table>";   }      mapping new_module(object id, object node)   {    string varname;   
Roxen.git/server/base_server/mainconfig.pike:911:    }    }       res = default_head("Welcome to Roxen Challenger");       res += read_bytes("etc/welcome.html");    if(error && strlen(error))    res += "<blockquote>\n<p><b>"+error+"</b>";       res += ("<pre>" -  "<font size=+1>" +  "<font size=\"+1\">"    "<form action=/(initial)/Globals/>"    " User name <input name=user type=string>\n"    " Password <input name=pass type=password>\n"    " Again <input name=pass2 type=password>\n"   // Avoid this trap for people who like to shoot themselves in the foot.   // /Peter   // "IP-pattern <input name=pattern type=string>\n"    " <input type=submit value=\"Use these values\">\n"    "</form></font></pre></blockquote>");   
Roxen.git/server/base_server/mainconfig.pike:955:               string tablist(array(string) nodes, array(string) links, int selected)   {    array res = ({});    for(int i=0; i<sizeof(nodes); i++)    if(i!=selected)    PUSH("<a href=\""+links[i]+"\"><img alt=\"_/"+ -  nodes[i][0..strlen(nodes[i])-1]+"\\__\" src=/auto/unselected/"+ -  replace(nodes[i]," ","%20")+" border=0></a>"); +  nodes[i][0..strlen(nodes[i])-1]+"\\__\" src=\"/auto/unselected/"+ +  replace(nodes[i]," ","%20")+"\" border=0></a>");    else    PUSH("<a href=\""+links[i]+"\"><b><img alt=\"_/"+ -  nodes[i][0..strlen(nodes[i])-1]+"\\__\" src=/auto/selected/"+ -  replace(nodes[i]," ","%20")+" border=0></b></a>"); +  nodes[i][0..strlen(nodes[i])-1]+"\\__\" src=\"/auto/selected/"+ +  replace(nodes[i]," ","%20")+"\" border=0></b></a>");   //PUSH("<br>");    return res*"";   }      mapping (string:string) selected_nodes =   ([    "Configurations":"/Configurations",    "Globals":"/Globals",    "Status":"/Status",    "Errors":"/Errors",
Roxen.git/server/base_server/mainconfig.pike:1152:   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+"\">"+    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)   { -  return ("<table width=100% bgcolor=#dddddd border=0 cellpadding=0" -  " cellspacing=0><tr><td valign=center align=left><a href=$docurl>" -  "<img border=0 src=/image/roxen-small.gif alt=\"Roxen\"></a></td>" -  "<td align=right valign=top>"+ +  return ("<table width=\"100%\" bgcolor=\"#dddddd\" border=0 cellpadding=0" +  " cellspacing=0><tr><td valign=middle align=left><a " +  "href=\"$docurl\"><img border=0 src=\"/image/roxen-small.gif\" " +  "alt=\"Roxen\"></a></td><td align=right valign=top>"+    describe_node_path(node)+"</td><td>&nbsp;</td></tr></table><br>");   }      mapping logged = ([ ]);      void check_login(object id)   {    if(logged[id->remoteaddr]+1000<time())    report_notice("Administrator logged on from "+    roxen->blocking_ip_to_host(id->remoteaddr)+".");
Roxen.git/server/base_server/mainconfig.pike:1370:    * the node */       case "delete":    PUSH(default_head("Roxen Configuration")+    status_row(o));   // PUSH("<hr noshade>");       switch(o->type)    {    case NODE_CONFIGURATION: -  PUSH("<font size=+2>Do you really want to delete the configuration "+ -  o->data->name + ", all its modules and their copies?" -  "\n\n<p></font>"); +  PUSH("<font size=\"+2\">Do you really want to delete the" +  " configuration "+ o->data->name+ +  ", all its modules and their copies?\n\n<p></font>");    break;       case NODE_MODULE_MASTER_COPY:    case NODE_MODULE: -  PUSH("<font size=+2>Do you really want to delete the module "+ +  PUSH("<font size=\"+2\">Do you really want to delete the module "+    o->data->name + ", and its copies?\n\n<p></font>");    break;       case NODE_MODULE_COPY_VARIABLES:       case NODE_MODULE_COPY: -  PUSH("<font size=+2>Do you really want to delete this copy " +  PUSH("<font size=\"+2\">Do you really want to delete this copy "    " of the module "+ o->up->data->name + "?\n\n<p></font>");    break;       case NODE_CONFIGURATIONS:    return stores("You don't want to do that...\n");    } -  PUSH("<blockquote><font size=+2><i>This action cannot be undone.\n\n<p></font>"+ -  TABLEP("<table>", "") +"<tr><td><form action="+ -  o->path(1)+">" +  PUSH("<blockquote><font size=\"+2\"><i>This action cannot be" +  " undone.\n\n<p></font>"+ TABLEP("<table>", "")+ +  "<tr><td><form action="+ o->path(1)+">"    "<input type=submit value=\"No, I do not want to delete it\"> " -  "</form></td><td><form action=/(really_delete)"+o->path(1)+ +  "</form></td><td><form action=/(really_delete)"+ o->path(1)+    "><input type=submit value=\"Go ahead\"></form></td></tr> "    "</table></blockquote>");       return stores(res*"");    break;       /* When this has been called, the node will be * _very_ deleted    * The amount of work needed to delete a node does vary    * depending on the node, since there is no 'zap' function in    * the nodes at the moment. I will probably move this code into
Roxen.git/server/base_server/mainconfig.pike:1610:    }    break;    }    return std_redirect(o, id);    }       check_login(id);       PUSH(default_head("Roxen server configuration"));   // PUSH("<table><tr><td>&nbsp;<td>" -  PUSH("<dl>\n"); + // PUSH("<dl>\n");    PUSH("\n"+status_row(o)+"\n"+display_tabular_header( o )+"\n");    PUSH("<p>");    if(o->up != root && o->up)    PUSH("<a href=\""+ o->up->path(1)+"?"+(bar++)+"\">" -  "<img src=/auto/back alt='[Up]' align=left hspace=0 border=0></a>\n"); +  "<img src=\"/auto/back\" alt=\"[Up]\" align=left hspace=0" +  " border=0></a>\n");       if(i=o->folded) o->folded=0;    mixed tmp = o->describe(1,id);    if(mappingp(tmp)) return tmp;    if(!id->supports->font)    tmp = parse_html(tmp, ([]),(["font":remove_font, ]));    PUSH(tmp);    o->folded=i;       PUSH("</dl>");
Roxen.git/server/base_server/mainconfig.pike:1666:    if(o->changed)    BUTTON(unfoldmodified, "Unfold modified", left);       if(nfolded(o))    BUTTON(unfoldlevel, "Unfold level", left);   // else if(nfoldedr(o))   // BUTTON(unfoldall, "Unfold all", left);       if(!lm)    { -  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=/auto/button/rm/%20>"); +  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0" +  " src=\"/auto/button/rm/%20\">");    PUSH("</nobr><br clear=all>");    lm=1;    }       if(!more_mode)    BUTTON(morevars, "More options", left);    else    BUTTON(nomorevars, "Fewer options", left);       if((o->changed||root->changed))    {    BUTTON(save, "Save", left); -  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=/auto/button/%20%20%20%20%20%20>"); +  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=\"/auto/button/%20%20%20%20%20%20\">");    }   // BUTTON(restart, "Restart", left);   // BUTTON(shutdown,"Shutdown", left);    -  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=/auto/button/rm/%20>"); +  PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=\"/auto/button/rm/%20\">");    PUSH("</nobr><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("<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*"");   }