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.58 1997/08/12 22:28:10 peter Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.59 1997/08/12 23:09:15 per 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:48:    {    changed += i;    if(up) up->change(i);    }       private string show_me(string s)    {    string name=path(1);    if(folded)    return ("<a name=\""+name+"\" href=\"/(unfold)" + name + "?"+(bar++)+ -  "\">\n<img border=0 align=bottom src=\"/auto/unfold" -  +(changed?"2":"")+"\" alt=\""+(changed?"*-":"--")+"\">" +  "\">\n<img border=0 align=baseline src=/auto/unfold" +  +(changed?"2":"")+" alt=\""+(changed?"*-":"--")+"\">"    "</a>\n "+s+"\n");    else -  return ("<a name=\""+name+"\" 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:88:    PUSH(tmp[0] + "<dt>" + (i?tmp[i]:show_me(tmp[1])) + "\n");    else if(stringp(tmp) && strlen(tmp))    PUSH("<dt>"+(i?tmp:show_me(tmp)) + "\n");    else if(!tmp)    return "";       if(!folded)    {    PUSH("<dl><dd>\n");    node = down; +  array node_desc = ({});    while(node)    {    if(!objectp(node)) // ERROR! Destructed node in tree!    {    if(objectp(prevnode))    prevnode->next=0;    node=0;    break;    }    prevnode = node;    node = node->next; -  PUSH(prevnode->describe()); +  node_desc += ({ prevnode->describe() });    } -  +  PUSH(node_desc*"\n");    PUSH("</dl>\n\n");    }    return res*"";    }          object config()    {    object node;    node=this_object();
Roxen.git/server/base_server/mainconfig.pike:158:      #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\">\n" +  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;    if(!sizeof(tmp)) return root;    for(o=root; sizeof(tmp) && (o=o->descend(tmp[0],1)); tmp=tmp[1..1000]);    if(!o) return 0;
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\">" -  "<form action=/(initial)/Globals/>" +  "<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>");       return stores(res);
Roxen.git/server/base_server/mainconfig.pike:1126:    {    i+=nfoldedr(node);    node=node->next;    }    return i;   }      string dn(object node)   {    if(!node) return "???"; -  string s = sizeof(node->_path)?node->_path[-1]:"."; +  string s = sizeof(node->_path)?node->_path[-1]:" ";    if(((string)((int)s))==s)    return "Instance "+s;    switch(s)    {    case "Globals":    return "Global Variables";    case "Configurations":    return "Servers";    case "Errors":    return "Events";
Roxen.git/server/base_server/mainconfig.pike:1151:   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+"\">"+ -  dn(find_node(http_decode_string(q[..strlen(q)-2])))+"</a></font></b> -&gt; "; +  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"
Roxen.git/server/base_server/mainconfig.pike:1369:    * 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 "+    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 "    " 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)+ -  "><input type=submit value=\"Go ahead\"></form></td></tr> " +  "</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    * function-pointers in the nodes.
Roxen.git/server/base_server/mainconfig.pike:1609:    }    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\">"); -  } +    // BUTTON(restart, "Restart", left);   // BUTTON(shutdown,"Shutdown", left);       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("</table>");    PUSH("</body>\n");    return stores(res*"");   }