Branch: Tag:

2002-02-26

2002-02-26 13:23:08 by Marcus Wellhardh <wellhard@roxen.com>

Added license support. Made locked modules unselectable.

Rev: server/config_interface/sites/add_module.pike:1.66

103:    return Roxen.html_encode_string(((file/"/")[-1]/".")[0]);   }    - string pafeaw( string errors, string warnings ) - // Parse And Format Errors And Warnings. + string pafeaw( string errors, string warnings, array(ModuleInfo) locked_modules) + // Parse And Format Errors And Warnings (and locked modules).   // Your ordinary prettyprinting function.   {    mapping by_module = ([]);
208:    if( strlen( da_string ) )    da_string += "</table>";   // "<pre>"+Roxen.html_encode_string( sprintf( "%O", by_module ) )+"</pre>"; -  return da_string; +  +  return da_string + format_locked_modules(locked_modules);   }    -  + string format_locked_modules(array(ModuleInfo) locked_modules) + { +  if(!sizeof(locked_modules)) +  return ""; +  +  return +  "<font size='+1'>Locked modules</font><br />\n" +  "These modules are locked and can not be enabled because they are " +  "not part of the license key for this configuration.<br />\n" +  "<blockquote><font color='darkred'>"+ +  (locked_modules->get_name()*"<br />\n")+"</font></blockquote>"; + } +    array(string) get_module_list( function describe_module,    function class_visible,    RequestID id )
247:    classes[r[0]]->modules += ({ mods[i] });    }    +  License.Key license_key = conf->getvar("license")->get_key(); +  array(RoxenModule) locked_modules = ({}); +     foreach( sort(indices(classes)), string c )    {    mixed r;
264:    q->type == 0 )    continue;    object b = module_nomore(q->sname, q, conf); +  if( !b && q->locked && (!license_key || !q->unlocked(license_key)) ) +  { +  locked_modules += ({ q }); +  continue; +  }    res += describe_module( q, b );    }    } else    res += r[1];    }    master()->set_inhibit_compile_errors( 0 ); -  return ({ res, pafeaw( ec->get(), ec->get_warnings() ) }); +  return ({ res, pafeaw( ec->get(), ec->get_warnings(), locked_modules) });   }      string module_image( int type )
530:    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.")    , id )) && r[0] ) {
540:    q->type == 0 )    continue;    object b = module_nomore(q->sname, q, conf); +  if( !b && q->locked && (!license_key || !q->unlocked(license_key)) ) +  { +  locked_modules += ({ q }); +  continue; +  }    res += describe_module_compact( q, b );    }    } else
552:    "<input type=\"hidden\" name=\"config\" value=\"&form.config;\" />"+    res+"</select><br /><submit-gbutton> "    +LOCALE(251, "Add Module")+" </submit-gbutton><br />" -  +pafeaw(ec->get(),ec->get_warnings())+"</form>", +  +pafeaw(ec->get(),ec->get_warnings(), +  locked_modules)+"</form>",    );   }