Branch: Tag:

1999-05-14

1999-05-14 02:42:33 by David Hedbor <david@hedbor.org>

Added a compact "Add Module" page. Choose layout from GlobVars->Config Interface.

Rev: server/base_server/config/draw_things.pike:1.41
Rev: server/base_server/config/low_describers.pike:1.30
Rev: server/base_server/mainconfig.pike:1.122
Rev: server/base_server/roxen.pike:1.276

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";
793:    mixed a,b;    string q;    array mods; -  array (string) res; +  string res, doubles="";       if(!roxen->allmodules || sizeof(id->pragma))    {
807:    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);   }