Roxen.git
/
server
/
base_server
/
mainconfig.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/base_server/mainconfig.pike:1:
inherit "config/builders";
-
string cvs_version = "$Id: mainconfig.pike,v 1.
46
1997/08/
04
07
:
52
:
30
grubba
Exp $";
+
string cvs_version = "$Id: mainconfig.pike,v 1.
47
1997/08/
12
06
:
31
:
59
per
Exp $";
inherit "roxenlib"; inherit "config/draw_things"; import Array; import Stdio; /* Work-around for Simulate.perror */ #define perror roxen_perror #include <confignode.h> #include <module.h>
-
#define dR "
00
"
-
#define dG "
06
"
-
#define dB "
30
"
+
#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=
#ffffff
link=
#ffffaa
vlink=
#ffffaa
alink=
#f0e0f0
>"
+
#define BODY "<body "+(roxen->QUERY(BG)?"
--
background=/image/background.gif ":"")+"bgcolor=#"+dR+dG+dB+" text=
black
link=
0x000044
vlink=
0x000044
alink=
red
>"
#define TABLEP(x, y) (id->supports->tables ? x : y) #define PUSH(X) do{res+=({(X)});}while(0) int bar=time(1); class Node { inherit "struct/node"; import Simulate;
Roxen.git/server/base_server/mainconfig.pike:129:
while(node) { if(node->changed) node->save(); node=node->next; } if(saver) saver(this_object()); } } object root=Node();
-
int expert_mode;
+
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)
Roxen.git/server/base_server/mainconfig.pike:520:
roxen->current_configuration = 0; werror("CONFIG: Done.\n"); } a=roxen->allmodules; mods=sort_array(indices(a), lambda(string a, string b, mapping m) { return m[a][0] > m[b][0]; }, a); res = ({default_head("Add a module")+"\n\n"+
-
"<h2>Select a module to add from the list below</h2>" });
+
"<
table><tr><td> <td><
h2>Select a module to add from the list below</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] +
Roxen.git/server/base_server/mainconfig.pike:544:
"\">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>"+ (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>")+ "</a><blockquote><br>"+a[q][1]+"<p><br><p></blockquote>"}); } }
-
return res*"";
+
return res*""
+"</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];
Roxen.git/server/base_server/mainconfig.pike:889:
"Configurations", "Globals", "Status", "Errors", }); array tab_names = ({ " Virtual servers ", " Global variables ", " Status info ",
-
"
Error
log ",
+
"
Event
log ",
}); string display_tabular_header(object node) { string p, s; array links = ({ selected_nodes[tabs[0]]+"?"+(bar++), selected_nodes[tabs[1]]+"?"+(bar++),
Roxen.git/server/base_server/mainconfig.pike:985:
i=draw_selected_button(value,button_font); break; case "unselected": i=draw_unselected_button(value,button_font); break; } if(i) { object o = open("roxen-images/"+img_key,"wct");
-
e=i->map_closest(i->select_colors(
64
)+({trans}))->togif(@trans);
+
e=i->map_closest(i->select_colors(
62
)+({trans}))->togif(@trans);
i=0; if(o) { o->write(e); o=0; } #ifdef DEBUG else {perror("Cannot open file for "+in+"\n");} #endif return http_string_answer(e,"image/gif"); } return 0; }
Roxen.git/server/base_server/mainconfig.pike:1025:
i = o->folded; node=o->down; while(node) { i+=nfoldedr(node); node=node->next; } return i; }
+
string dn(object node)
+
{
+
if(!node) return "???";
+
string s = node->_path[-1];
+
if(((string)((int)s))==s)
+
return "Instance "+s;
+
return s;
+
}
-
+
string describe_node_path(object node)
+
{
+
string q="", res="";
+
int cnt;
+
foreach(node->path(1)/"/", string p)
+
{
+
q+=p+"/";
+
if(cnt>=2)
+
{
+
// werror("q="+q+"\n");
+
res += "<font size=+1><a href="+q+">"+
+
dn(find_node(http_decode_string(q[..strlen(q)-2])))+"</a></font> -> ";
+
}
+
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 align=left><a href=$docurl><img border=0 "
+
"src=/image/roxen-small.gif></a></td><td align=right valign=top>"+
+
describe_node_path(node)+"</td></tr></table><br>");
+
}
+
+
mapping configuration_parse(object id) { array (string) res=({}); string tmp; // Is it an image? if(sscanf(id->not_query, "/image/%s", tmp)) return file_image(tmp) || (["data":"No such image"]); object o; int i;
Roxen.git/server/base_server/mainconfig.pike:1090:
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;
+
// 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": o->map(lambda(object o) { o->folded=1; });
Roxen.git/server/base_server/mainconfig.pike:1303:
o->dest(); if(!objectp(n)) { o=root; // Error, really, no parent module for this module class. } else { if(!sizeof(n->data->copies)) { // No more instances in this module, let's zap the whole class.
-
/*
-
object hmm=n->config();
-
if(!hmm) error("Cannot find configuration node for module.\n");
-
*/
-
-
// The configuration node. n->config() seems to be
-
// n->up->data...
+
o=n->up; n->change(-n->changed); n->dest(); build_configuration(o); return std_redirect(o, 0);
-
// Bugs and returns to the top if id is set...
+
} else o = n; } break; case NODE_MODULE_MASTER_COPY: case NODE_MODULE:
-
// A 'one of a kind' module.
+
if(o->data->copies) { if(sizeof(o->data->copies)) { int i; array a,b; a=indices(o->data->copies); b=values(o->data->copies); name=o->config()->otomod[b[0]]; i=sizeof(a);
Roxen.git/server/base_server/mainconfig.pike:1427:
if(equal(o->original, tmp)) o->change(-1); else if(!o->changed) o->change(1); } break; } return std_redirect(o, id); }
-
PUSH(default_head("Roxen server configuration"
,
root-
>
changed?o-
>
path(1):0))
;
+
PUSH(default_head("Roxen server configuration"
));
+
//
PUSH("<table
>
<tr
>
<td> 
;
<td>"
PUSH("<dl>\n");
-
PUSH("\n"+display_tabular_header( o )+"\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"); if(i=o->folded) o->folded=0; string tmp = o->describe(1); if(!id->supports->font) tmp = parse_html(tmp, ([]),(["font":remove_font, ])); PUSH(tmp);
Roxen.git/server/base_server/mainconfig.pike:1481:
if(nunfolded(o)) BUTTON(foldall, "Fold all",left); 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(!more_mode)
+
BUTTON(morevars, "More settings", left);
+
else
+
BUTTON(nomorevars, "Less settings", left);
if(!lm) { PUSH("<img border=0 alt=\"\" hspacing=0 vspacing=0 src=/auto/button/rm/%20>"); PUSH("</nobr><br clear=all>"); lm=1; } 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*""); }