Roxen.git / server / config_interface / sites / add_module.pike

version» Context lines:

Roxen.git/server/config_interface/sites/add_module.pike:1: - // $Id: add_module.pike,v 1.91 2011/10/27 16:38:32 jonasw Exp $ + // $Id$      #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" )) +  while(!(< "", "/" >)[d] && !Stdio.is_file( d+"/INFO" ))    d = dirname(d);    if((< "", "/" >)[d])    return ({"Local modules", "" });       string n = Stdio.read_bytes( d+"/INFO" );    sscanf( n, "<"+id->misc->config_locale+">%s"    "</"+id->misc->config_locale+">", n );    sscanf( n, "%*s<name>%s</name>", name );    sscanf( n, "%*s<doc>%s</doc>", doc );    if( search(n, "<noshow/>" ) != -1 )
Roxen.git/server/config_interface/sites/add_module.pike:91:    string search_form =    "<script language='javascript' src='find_module.js'></script>"    "<script language='javascript'>"    " query_config = '&form.config;';\n"    " query_method = '" + method + "';\n"    "</script>"    "<table cellspacing='2' cellpadding='0' border='0'>"    "<tr><td>Find:&nbsp;</td>"    "<td>"    "<form style='margin: 0' onsubmit='return false'>" +  "<roxen-wizard-id-variable />"    "<input type='search' size='30' name='mod_query' id='mod_query' "    " onkeydown='return query_update_results(event);'"    " onkeypress='return query_update_results(event);'>"    "</form>"    "</td>"    "<td><img src='/internal-roxen-spinner-white'"    " id='mod_spinner' style='visibility: hidden'></td>"    "</tr>"    "</table>";   
Roxen.git/server/config_interface/sites/add_module.pike:114:    "<content><cv-split>"    "<subtablist width='100%%'>"    "<st-tabs></st-tabs>"    "<st-page>"    "<h2>Site: '&form.config;'</h2>"    "<if not='1' variable='form.initial'>"    "<table width='100%%' border='0' cellspacing='4' "    " cellpadding='0'>"    "<tr><td nowrap='nowrap'>%s:</td><td>"    "<form action='' style='margin: 0'>" +  "<roxen-wizard-id-variable />"    "<input type='hidden' name='config' value='&form.config;'>"    "<default variable='form.method' value='%s'>"    "<select name='method' onchange='submit()'>"    "<option value='normal'>%s</option>"    // "<option value='fast'>%s</option>"    "<option value='faster'>%s</option>"    "<option value='compact'>%s</option>"    "<option value='really_compact'>%s</option>"    "</select>"    "</default>"    "</form>"    "</td>"    "<td>&nbsp;&nbsp;</td>"    "<td width='100%%' nowrap='nowrap'>%s</td>" // search form    "<td>&nbsp;&nbsp;</td>"    "<td align='right'>"    "<gbutton href='add_module.pike?config=&form.config:http;" -  "&reload_module_list=yes&method=%s' " +  "&amp;reload_module_list=yes&amp;method=%s&amp;&usr.set-wiz-id;' "    "> %s </gbutton>"    "</td><td>"    "<gbutton href='site.html/&form.config;/' "    "> %s </gbutton>"    "</td></tr></table>"    "<p>\n</if>%s\n</p>\n"    "</st-page></subtablist></td></tr></table>"    "</cv-split></content></tmpl>",    LOCALE(251,"Add Module"),    noform?" noform='noform'":"",
Roxen.git/server/config_interface/sites/add_module.pike:242:       string trim_name( string what )    {    array q = (what / "/");    return q[sizeof(q)-2..]*"/";    };      #define RELOAD(X) sprintf("<gbutton " \    "img-align='middle' " \    "href='add_module.pike?config=&form.config:http;" \ -  "&method=&form.method;" \ -  "&random=%d&only=%s&reload_module_list=yes" \ +  "&amp;method=&form.method;" \ +  "&amp;random=%d&amp;only=%s" \ +  "&amp;reload_module_list=yes" \ +  "&amp;&usr.set-wiz-id;" \    "#errors_and_warnings'> %s </gbutton>", \    random(4711111), \    (X), \    LOCALE(253, "Reload"))       if( !header_added++ )    da_string +=    "<p><a name='errors_and_warnings'></a><br />"    "<font size='+2'><b><font color='&usr.warncolor;'>"    "Compile errors and warnings</font></b><br />"
Roxen.git/server/config_interface/sites/add_module.pike:429:    <td align='right'><span class='dimtext'>(%s)</span> %s</td>    </tr>    </table>    </td>    </tr>    <tr>    <td valign='top'>    <form method='post' action='add_module.pike'    style='margin: 0 10px 0 0'>    <roxen-automatic-charset-variable/> +  <roxen-wizard-id-variable />    <input type='hidden' name='module_to_add' value='%s'>    <input type='hidden' name='config' value='&form.config;'>    <submit-gbutton preparse='1'>%s</submit-gbutton>    </form>    </td>    <td valign='top'>    %s    <p class='dimtext'>%s</p>    </td>    </tr>
Roxen.git/server/config_interface/sites/add_module.pike:472:    string header = ("<tr><td colspan='2'><table width='100%' "    "cellspacing='0' border='0' cellpadding='3' "    "bgcolor='&usr.content-titlebg;'><tr><td valign='top'>");       if (id->variables->mod_query) {    x = 1;    } else if( id->variables->unfolded == c) {    header+=("<a name='"+Roxen.html_encode_string(c)+    "'></a><gbutton hspace='5' vspace='5' "    "href='add_module.pike?config=&form.config;" -  "&method=" + method + "#"+Roxen.http_encode_url(c)+"' > "+ +  "&amp;method=" + method + "&amp;&usr.set-wiz-id;#"+ +  Roxen.http_encode_url(c)+"' > "+    LOCALE(168, "Hide")+" </gbutton>");    x=1;    } else {    header+=("<a name='"+Roxen.html_encode_string(c)+    "'></a><gbutton hspace='5' vspace='5' "    "href='add_module.pike?config=&form.config;" -  "&method=" + method + -  "&unfolded="+Roxen.http_encode_url(c)+ -  "#"+Roxen.http_encode_url(c)+"' > "+ +  "&amp;method=" + method + +  "&amp;unfolded="+Roxen.http_encode_url(c)+ +  "&amp;&usr.set-wiz-id;#"+Roxen.http_encode_url(c)+"' > "+    LOCALE(267, "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 });   }   
Roxen.git/server/config_interface/sites/add_module.pike:590:    "'></a><gbutton hspace='5' vspace='5' dim='1'> "+LOCALE(267, "View")+    " </gbutton><br>"    "<submit-gbutton hspace='5' vspace='2'> "+LOCALE(200, "Add Modules")+    " </submit-gbutton>");    x=1;    }    else    header+=("<a name='"+Roxen.html_encode_string(c)+    "'></a><gbutton hspace='5' vspace='5' "    "href='add_module.pike?config=&form.config;" -  "&method=" + method + -  "&unfolded="+Roxen.http_encode_url(c)+ -  "#"+Roxen.http_encode_url(c)+"' > "+ +  "&amp;method=" + method + +  "&amp;unfolded="+Roxen.http_encode_url(c)+ +  "&amp;&usr.set-wiz-id;#"+Roxen.http_encode_url(c)+"' > "+    LOCALE(267, "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_low(RequestID id)   {    string desc, err;    [desc,err] = get_module_list( describe_module_faster,    class_visible_faster, id );    return    "<form method='post' action='add_module.pike'>"    "<input type='hidden' name='config' value='&form.config;'>" -  +  "<roxen-wizard-id-variable />"    "<table cellspacing='3' cellpadding='0' border='0' width='100%'>" +    desc +    "</table>"    "</form>" +    err;   }      string page_faster_search(RequestID id)   {    return
Roxen.git/server/config_interface/sites/add_module.pike:674:   }      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'>" +  "<roxen-wizard-id-variable />"    "<input type='hidden' name='config' value='&form.config;'>"+    desc+"</select><br /><submit-gbutton vspace='3'> "    +LOCALE(200, "Add Modules")+" </submit-gbutton><p>"    +err+"</form>",    );   }      string page_really_compact( RequestID id )   {    first=0;
Roxen.git/server/config_interface/sites/add_module.pike:743:    res += describe_module_compact( q, b );    }    } else {    res += r[1];    }       master()->set_inhibit_compile_errors( 0 );       return page_base(id,    "<form action=\"add_module.pike\" method=\"post\">" +  "<roxen-wizard-id-variable />"    "<input type=\"hidden\" name=\"config\" value=\"&form.config;\" />"+    res+"</select><br /><submit-gbutton> "    +LOCALE(200, "Add Modules")+" </submit-gbutton><br />"    +pafeaw(ec->get(),ec->get_warnings(),    locked_modules)+"</form>",    );   }      string decode_site_name( string what )   {
Roxen.git/server/config_interface/sites/add_module.pike:889:    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");    -  if( id->variables->module_to_add && -  id->variables->config ) +  if (!id->variables->config) { +  return Roxen.http_redirect("/sites/", id); +  } +  +  if( id->variables->module_to_add )    return do_it( id );       Configuration conf;    foreach(id->variables->config/"\0", string config) {    if (conf = roxen.find_configuration(config)) {    id->variables->config = config;    break;    }    }