Roxen.git
/
server
/
config_interface
/
sites
/
add_module.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/config_interface/sites/add_module.pike:1:
#include <config_interface.h> #include <module.h> #include <module_constants.h>
-
#include <roxen.h>
+
int no_reload() { if( sizeof( already_added ) ) return 1; // Reloading this script now would destroy state. }
-
//<locale-token project="roxen_config">LOCALE</locale-token>
-
#define LOCALE(X,Y) _STR_LOCALE("roxen_config",X,Y)
-
+
// Class is the name of the directory. array(string) class_description( string d, RequestID id ) { string name, doc; while(!(< "", "/" >)[d] && !file_stat( d+"/INFO" )) d = dirname(d); if((< "", "/" >)[d]) return ({"Local modules", "" }); string n = Stdio.read_bytes( d+"/INFO" );
Roxen.git/server/config_interface/sites/add_module.pike:76:
"<subtablist width='100%%'>" "<st-tabs></st-tabs>" "<st-page>" "<if not='1' variable='form.initial'>" "<gbutton href='add_module.pike?config=&form.config:http;" "&reload_module_list=yes' > %s </gbutton> " "<gbutton href='site.html/&form.config;'> %s </gbutton>" "<p>\n</if>%s\n</p>\n" "</st-page></subtablist></td></tr></table>" "</cv-split></content></tmpl>",
-
LOCALE(258,
"Add module"
)
,
+
"Add module",
noform?" noform='noform'":"",
-
LOCALE(272,
"Reload module list"
)
,
-
LOCALE(202,
"Cancel"
)
, content );
+
"Reload module list",
+
"Cancel", content );
} string module_name_from_file( string file ) { string data, name; catch(data = Stdio.read_bytes( file ));
Roxen.git/server/config_interface/sites/add_module.pike:171:
array q = (what / "/"); return q[sizeof(q)-2..]*"/"; }; #define RELOAD(X) sprintf("<gbutton " \ "href='add_module.pike?config=&form.config:http;" \ "&random=%d&only=%s&reload_module_list=yes#" \ "errors_and_warnings'> %s </gbutton>", \ random(4711111), \ (X), \
-
LOCALE(253,
"Reload")
)
+
"Reload")
if( !header_added++ ) da_string += "<p><a name='errors_and_warnings'><br />" "<font size='+2'><b><font color='&usr.warncolor;'>" "Compile errors and warnings</font></b><br />" "<table width=100% cellpadding='3' cellspacing='0' border='0'>"; da_string += "<tr><td></td>" "<td colspan='3' bgcolor='&usr.content-titlebg;'>"
Roxen.git/server/config_interface/sites/add_module.pike:342:
%s </p> </td> </tr> ", //Roxen.html_encode_string(strip_leading(module->get_name())), Roxen.html_encode_string(module->get_name()), Roxen.html_encode_string (module->sname), (image?module_image(module->type):""), module->sname,
-
LOCALE(251,
"Add Module"
)
,
+
"Add Module",
module->get_description(),
-
LOCALE(266,
"Will be loaded from: "
)
+module->filename
+
"Will be loaded from: "+module->filename
); } else { if( block == module ) return ""; return ""; } }; } array(int|string) class_visible_normal( string c, string d, RequestID id ) { int x; string header = ("<tr><td colspan='2'><table width='100%' " "cellspacing='0' border='0' cellpadding='3' " "bgcolor='&usr.content-titlebg;'><tr><td>"); if( id->variables->unfolded == c ) { header+=("<a name="+Roxen.http_encode_string(c)+ "></a><gbutton " "href='add_module.pike?config=&form.config;"
-
"#"+Roxen.http_encode_string(c)+"' >
"+
-
LOCALE(168, "
Hide
")+"
</gbutton>");
+
"#"+Roxen.http_encode_string(c)+"' > Hide </gbutton>");
x=1; } else header+=("<a name="+Roxen.http_encode_string(c)+ "></a><gbutton " "href='add_module.pike?config=&form.config;" "&unfolded="+Roxen.http_encode_string(c)+
-
"#"+Roxen.http_encode_string(c)+"' >
"+
-
LOCALE(267, "
View
")+"
</gbutton>");
+
"#"+Roxen.http_encode_string(c)+"' > View </gbutton>");
header+=("</td><td width='100%'>" "<font color='&usr.content-titlefg;' size='+2'>"+c+"</font>" "<br />"+d+"</td></tr></table></td></tr>\n"); return ({ x, header }); } string page_normal( RequestID id, int|void noimage ) {
Roxen.git/server/config_interface/sites/add_module.pike:422:
</tr> ", //Roxen.html_encode_string(strip_leading(module->get_name())), Roxen.html_encode_string(module->get_name()), Roxen.html_encode_string (module->sname), module_image(module->type), module->sname, //Roxen.html_encode_string(strip_leading(module->get_name())), Roxen.html_encode_string(module->get_name()), module->get_description(),
-
LOCALE(266,
"Will be loaded from: "
)
+module->filename
+
"Will be loaded from: "+module->filename
); } else { if( block == module ) return ""; return ""; } } array(int|string) class_visible_faster( string c, string d, RequestID id ) { int x; string header = ("<tr><td colspan='2'><table width='100%' cellspacing='0' " "border='0' cellpadding='3' bgcolor='&usr.content-titlebg;'>" "<tr><td>"); if( id->variables->unfolded == c ) { header+=("<a name="+Roxen.http_encode_string(c)+
-
"></a><gbutton dim='1'>
"+LOCALE(267, "
View
")+"
</gbutton>"
-
"<tr><td><submit-gbutton>
"+LOCALE(251, "
Add Module"
)+
+
"></a><gbutton dim='1'> View </gbutton>"
+
"<tr><td><submit-gbutton> Add Module"
" </submit-gbutton></td></tr>"); x=1; } else header+=("<a name="+Roxen.http_encode_string(c)+ "></a><gbutton " "href='add_module.pike?config=&form.config;" "&unfolded="+Roxen.http_encode_string(c)+
-
"#"+Roxen.http_encode_string(c)+"' >
"+
-
LOCALE(267, "
View
")+"
</gbutton>");
+
"#"+Roxen.http_encode_string(c)+"' > View </gbutton>");
header+=("</td><td width='100%'>" "<font color='&usr.content-titlefg;' size='+2'>"+c+"</font>" "<br />"+d+"</td></tr></table></td></tr>\n"); return ({ x, header }); } string page_faster( RequestID id ) {
Roxen.git/server/config_interface/sites/add_module.pike:479:
content += (desc+"</table></form>"+err); return page_base( id, content ); } int first; array(int|string) class_visible_compact( string c, string d, RequestID id ) { string res=""; if(first++)
-
res = "</select><br /><submit-gbutton>
"+LOCALE(251, "
Add Module
")+"
</submit-gbutton> ";
+
res = "</select><br /><submit-gbutton> Add Module </submit-gbutton> ";
res += "<p><a name="+Roxen.http_encode_string(c)+ "></a><font size='+2'>"+c+"</font><br />"+d+"<p><select multiple name='module_to_add'>"; return ({ 1, res }); } string describe_module_compact( object module, object block ) { if(!block) { //string modname = strip_leading (module->get_name()); string modname = module->get_name();
Roxen.git/server/config_interface/sites/add_module.pike:509:
string page_compact( RequestID id ) { first=0; string desc, err; [desc,err] = get_module_list( describe_module_compact, class_visible_compact, id ); return page_base(id, "<form action='add_module.pike' method='POST'>" "<input type='hidden' name='config' value='&form.config;'>"+ desc+"</select><br /><submit-gbutton> "
-
+LOCALE(251,
"Add Module
")+"
</submit-gbutton><p>"
+
"Add Module </submit-gbutton><p>"
+err+"</form>", ); } string page_really_compact( RequestID id ) { first=0; object conf = roxen.find_configuration( id->variables->config ); object ec = roxenloader.LowErrorContainer();
Roxen.git/server/config_interface/sites/add_module.pike:550:
in = lower_case((string)in); //sscanf(in, "%*s: %s", in); return in; }), mods); string res = ""; mixed r; License.Key license_key = conf->getvar("license")->get_key(); array(RoxenModule) locked_modules = ({});
-
if( (r = class_visible_compact(
LOCALE(258,
"Add module"
)
,
-
LOCALE(273,
"Select one or several modules to add."
)
+
if( (r = class_visible_compact( "Add module",
+
"Select one or several modules to add."
, id )) && r[0] ) { res += r[1]; foreach(mods, object q) { if( (!q->get_description() || (q->get_description() == "Undocumented")) && q->type == 0 ) continue; object b = module_nomore(q->sname, q, conf); if( !b && q->locked && (!license_key || !q->unlocked(license_key)) ) {
Roxen.git/server/config_interface/sites/add_module.pike:576:
} } else res += r[1]; master()->set_inhibit_compile_errors( 0 ); return page_base(id, "<form action=\"add_module.pike\" method=\"post\">" "<input type=\"hidden\" name=\"config\" value=\"&form.config;\" />"+ res+"</select><br /><submit-gbutton> "
-
+LOCALE(251,
"Add Module
")+"
</submit-gbutton><br />"
+
"Add Module </submit-gbutton><br />"
+pafeaw(ec->get(),ec->get_warnings(), locked_modules)+"</form>", ); } string decode_site_name( string what ) { if( (int)what ) return (string)((array(int))(what/","-({""}))); return what;
Roxen.git/server/config_interface/sites/add_module.pike:610:
foreach( modules, string mod ) { ModuleInfo mi = roxen.find_module( (mod/"!")[0] ); RoxenModule moo = conf->find_module( replace(mod,"!","#") ); foreach( indices(moo->query()), string v ) { if( moo->getvar( v )->get_flags() & VAR_INITIAL ) { num++; res += "<tr><td colspan='3'><h2>"
-
+LOCALE(1,
"Initial variables for "
)
+
+
"Initial variables for "+
//Roxen.html_encode_string(strip_leading(mi->get_name())) Roxen.html_encode_string(mi->get_name()) +"</h2></td></tr>" "<emit source='module-variables' " " configuration=\""+conf->name+"\"" " module=\""+mod+#"\"/> <emit noset='1' source='module-variables' " " configuration=\""+conf->name+"\"" " module=\""+mod+#"\"> <tr>
Roxen.git/server/config_interface/sites/add_module.pike:649:
id->misc->do_not_goto = 1; foreach( modules, string mod ) { if( already_added[mod] ) mod = already_added[ mod ]; if( !has_value(mod, "!") || !conf->find_module( replace(mod,"!","#") ) ) { RoxenModule mm = conf->enable_module( mod,0,0,1 ); if( !mm || !conf->otomod[mm] ) {
-
report_error(
LOCALE(382,
"Failed to enable %
s
")
+"\n")
;
+
report_error("Failed to enable %
s\n
"
, mod
);
return Roxen.http_redirect( site_url(id,conf->name), id ); } conf->call_low_start_callbacks( mm, roxen.find_module( (mod/"!")[0] ), conf->modules[ mod ] ); modules = replace( modules, mod, (already_added[mod]=(mod/"!")[0]+"!"+ (conf->otomod[mm]/"#")[-1]) ); } remove_call_out( roxen.really_save_it );
Roxen.git/server/config_interface/sites/add_module.pike:713:
array modules = (id->variables->module_to_add/"\0")-({""}); if( !sizeof( modules ) ) return Roxen.http_redirect( site_url(id,conf->name ), id ); return do_it_pass_2( modules, conf, id ); } mixed parse( RequestID id ) { if( !config_perm( "Add Module" ) )
-
return
LOCALE(226,
"Permission denied"
)
;
+
return "Permission denied";
if( id->variables->module_to_add ) return do_it( id ); Configuration conf; foreach(id->variables->config/"\0", string config) { if (conf = roxen.find_configuration( id->variables->config )) { id->variables->config = config; break; } } if( !config_perm( "Site:"+conf->name ) )
-
return
LOCALE(226,
"Permission denied"
)
;
+
return "Permission denied";
if( !conf->inited ) conf->enable_all_modules(); return this_object()["page_"+replace(config_setting( "addmodulemethod" )," ","_")]( id ); }