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.121 1999/05/14 00:56:14 neotron Exp $"; + string cvs_version = "$Id: mainconfig.pike,v 1.122 1999/05/14 02:42:29 neotron 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);
Roxen.git/server/base_server/mainconfig.pike:786:   {    return new_module_copy(node, node->data->sname, id);   }      string new_module_form(object id, object node)   {    int i;    mixed a,b;    string q;    array mods; -  array (string) res; +  string res, doubles="";       if(!roxen->allmodules || sizeof(id->pragma))    {    roxen_perror("CONFIG: Rescanning modules.\n");    roxen->rescan_modules();    roxen_perror("CONFIG: Done.\n");    }       a=roxen->allmodules;    mods=Array.sort_array(indices(a), lambda(string a, string b, mapping m) {    return m[a][0] > m[b][0];    }, a);    -  res = ({default_head(LOCALE->add_module())+"\n\n"+ +  // FIXME: Localize the module name, and description. +  // Also make it possible to add more than one module +  // at once in compact mode. +  switch(roxen->query("ModuleListType")) { +  case "Compact": +  res = (default_head(LOCALE->add_module())+"\n\n"+    status_row(node)+ -  +  "<table cellpadding=10><tr><td colspan=2>" +  "<h2>" + LOCALE->select_compact_module() + "</h2>\n" +  "</td></tr><tr valign=top><td>" +  "<form method=get action=\"/(addmodule)"+node->path(1)+"\">" +  "<select multiple size=10 name=_add_new_modules>"); +  +  foreach(mods, q) +  { +  if(b = module_nomore(q, a[q][2], node->config())) +  { +  if(b->sname != q) +  doubles += +  ("<p><dt><b>"+a[q][0]+"</b><dd>" + +  "<i>" + LOCALE->module_type_enabled(b->name) + +  LOCALE->disable_that_module("<a href=\"/(delete)" + +  node->descend(b->name, 1)->path(1) + +  "?" + (bar++) +"\">", "</a>") + +  "</i>\n"); +  } else { +  res += ("<option value=\""+q+"\">"+a[q][0]+"\n"); +  } +  } +  if(strlen(doubles)) +  doubles = "<dl>"+doubles+"</dl>"; +  else doubles = "&nbsp;"; +  res += ("</select>\n" +  "<p><input type=submit value=\""+LOCALE->add_compact_module()+ +  "\"></form></td><td>" + doubles); +  break; +  +  default: +  res = (default_head(LOCALE->add_module())+"\n\n"+ +  status_row(node)+    // display_tabular_header(node)+    "<table><tr><td>&nbsp;<td>" -  "<h2>" + LOCALE->select_module() + "</h2>" }); +  "<h2>" + LOCALE->select_module() + "</h2>");    -  // FIXME: Localize the module name, and description. +     foreach(mods, q)    {    if(b = module_nomore(q, a[q][2], node->config()))    {    if(b->sname != q) -  res += ({("<p><img alt=\""+a[q][0]+"\" src=\"/auto/module/" + a[q][2] + +  res += ("<p><img alt=\""+a[q][0]+"\" src=\"/auto/module/" + a[q][2] +    "/"+ q+"\" height=24 width=500><br><blockquote>" + a[q][1] +    "<p><i>" + LOCALE->module_type_enabled(b->name) +    LOCALE->disable_that_module("<a href=\"/(delete)" +    node->descend(b->name, 1)->path(1) + "?" + (bar++) + -  "\">", "</a>") + "</i>\n<p><br><p></blockquote>")}); +  "\">", "</a>") + +  "</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\">"    "<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>"}); +  "</a><blockquote><br>"+a[q][1]+"<p><br><p></blockquote>");    }    } -  return res*""+"</table>"; +     } -  +  return res+"</td></tr></table>"; + }      mapping new_module(object id, object node)   {    string varname; -  +     if(!sizeof(id->variables))    return stores(new_module_form(id, node)); -  -  varname=indices(id->variables)[0]; -  +  if(id->variables->_add_new_modules) { +  // Compact mode. +  array toadd = id->variables->_add_new_modules/"\0" - ({""}); +  foreach(toadd[1..], varname) +  new_module_copy(node, varname, id); +  varname = toadd[0]; +  } else +  varname = id->variables->_newmodule;    return new_module_copy(node, varname, id);   }      string ot;   object oT;   object get_template(string t)   {    t-=".pike";    if(ot==t) return oT; ot=t;    return (oT = compile_file("server_templates/"+t+".pike")());