Changeset 308

Show
Ignore:
Timestamp:
05/08/06 05:21:43 (2 years ago)
Author:
carmartin
Message:

templates: Introduce $CFG->disable_usertemplates to lock down template creation

This prevents users from creating new templates via the web. Existing templates they own are still editable.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/config-dist.php

    r269 r308  
    7979//$CFG->pathtoclam = '/usr/bin/clamscan'; // OR '/usr/bin/clamdscan'; 
    8080 
     81// TEMPLATES HANDLING 
     82//$CFG->disable_usertemplates = true;  // users can only choose from available templates 
     83 
    8184// set up some LMS hosts. 
    8285// -------------------------------------------------- 
  • devel/units/templates/template_actions.php

    r285 r308  
    7474                    $name = optional_param('new_template_name'); 
    7575                    $based_on = optional_param('template_based_on',0,PARAM_INT); 
    76                     if (!empty($name)) { 
     76                    if (empty($CFG->disable_usertemplates) && !empty($name)) { 
    7777                            $t = new StdClass; 
    7878                            $t->name = trim($name); 
  • devel/units/templates/templates_add.php

    r269 r308  
    11<?php 
     2 
    23global $USER; 
     4global $CFG; 
     5 
     6if (empty($CFG->disable_usertemplates)) { 
    37    // Create a new template 
    48        $header = gettext("Create theme"); // gettext variable 
     
    4044            </select> 
    4145END; 
    42                          
    43         $panel .= templates_draw(array( 
    44                                                 'context' => 'databox1', 
    45                                                 'name' => gettext("Based on"), 
    46                                                 'column1' => $column1 
    47                                             ) 
    48                                             ); 
     46 
     47         
     48            $panel .= templates_draw(array( 
     49                                           'context' => 'databox1', 
     50                                           'name' => gettext("Based on"), 
     51                                           'column1' => $column1 
     52                                           ) 
     53                                     ); 
    4954             
    50         $buttonValue = gettext("Create Theme"); // gettext variable 
    51         $panel .= <<< END 
    52              
     55            $buttonValue = gettext("Create Theme"); // gettext variable 
     56            $panel .= <<< END 
     57                 
    5358            <p> 
    5459                <input type="hidden" name="action" value="templates:create" /> 
     
    5661            </p> 
    5762         
    58         </form> 
     63                </form> 
    5964         
    6065END; 
    6166 
    62         $run_result .= $panel; 
     67
     68 
     69$run_result .= $panel; 
    6370 
    6471?>