1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
#include <config_interface.h> 
#include <module.h> 
#include <roxen.h> 
 
//<locale-token project="roxen_config">LOCALE</locale-token> 
#define LOCALE(X,Y)   _STR_LOCALE("roxen_config",X,Y) 
 
string site_url( RequestID id, string site ) 
{ 
  return "/sites/site.html/"+site+"/"; 
} 
 
string page_base( RequestID id, string content ) 
{ 
  return sprintf( "<use file=/template />" 
                  "<tmpl title=''>" 
                  "<topmenu base='&cf.num-dotdots;' selected='sites' />" 
                  "<content><cv-split>" 
                  "<subtablist width='100%%'>" 
                  "<st-tabs></st-tabs>" 
                  "<st-page>" 
                  "\n%s\n" 
                  "</st-page></subtablist></td></tr></table>" 
                  "</cv-split></content></tmpl>", content ); 
} 
 
mapping|string parse( RequestID id ) 
{ 
  if( !config_perm( "Add Module" ) ) 
    return LOCALE(226, "Permission denied"); 
 
  Configuration c = roxen.find_configuration( id->variables->config ); 
 
  if( !config_perm( "Site:"+c->name ) ) 
    return LOCALE(226,"Permission denied"); 
 
  if( id->variables->drop ) 
  { 
    c->disable_module( replace(id->variables->drop,"!","#") ); 
    c->save( ); 
    c->save_me( ); 
    c->forcibly_added = ([]); 
    return Roxen.http_redirect( site_url( id, id->variables->config ),id ); 
  } 
  string res =""; 
  array mods = map( indices( c->otomod )-({0}), 
                    lambda(mixed q){ return c->otomod[q]; }); 
 
  array pos = map( mods, 
                   lambda(string q) { 
                     return roxen.find_module( (q/"#")[0] )->get_name()+q; 
                   } ); 
 
  sort(pos, mods); 
  foreach( mods, string q ) 
  { 
    RoxenModule m = roxen.find_module( (q/"#")[0] ); 
    int c = (int)((q/"#")[-1]); 
    res += ("<p><gbutton href='drop_module.pike?config=&form.config;&amp;" 
            "drop="+replace(q,"#","!")+"&amp;&usr.set-wiz-id;'> "+ 
            LOCALE(252, "Drop Module")+ 
            " </gbutton>"+"&nbsp; <font size='+2'>&nbsp;"+m->get_name()+"</font> "+(c?" #"+(c+1):"")+"</p>" ); 
  } 
  return page_base( id, res ); 
}