/// get all the roles identifier
foreach ($roles as $role) {
- $rolesname[] = $role->name;
+ $rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
- $table->data[] = array_merge(array($role->name), $beta);
+ $table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowassign', 'admin'), 'center');
/// get all the roles identifier
foreach ($roles as $role) {
- $rolesname[] = $role->name;
+ $rolesname[] = format_string($role->name);
$roleids[] = $role->id;
$table->align[] = 'center';
$table->wrap[] = 'nowrap';
foreach ($roles as $role) {
$beta = get_box_list($role->id, $roleids);
- $table->data[] = array_merge(array($role->name), $beta);
+ $table->data[] = array_merge(array(format_string($role->name)), $beta);
}
print_simple_box(get_string('configallowoverride', 'admin'), 'center');
print ('<input type="hidden" name="courseid" value="'.$courseid.'" />');
}
?>
-<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
-<input type="hidden" name="contextid" value="<?php echo $contextid ?>" />
-<input type="hidden" name="roleid" value="<?php echo $roleid ?>" />
+<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
+<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
+<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
<table align="center" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
echo '<input type="hidden" name="courseid" value="'.$courseid.'" />';
}
echo '<input type="hidden" name="contextid" value="'.$context->id.'" />'.$strroletoassign.': ';
- choose_from_menu ($assignableroles, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
+ choose_from_menu ($assignableroles, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform.submit()');
echo '</div></form>';
print_simple_box_start("center");
-<form name="rolesform" action="manage.php" method="post">
-<input type="hidden" name="roleid" value="<?php echo $roleid; ?>">
-<input type="hidden" name="sesskey" value="<?php print (sesskey()); ?>">
-<input type="hidden" name="action" value="<?php echo $action; ?>">
-<br/>Role Name: <input type="text" name="name" value="<?php echo $role->name; ?>">
-
-Role short name (ASCII): <input type="text" name="shortname" value="<?php echo $role->shortname; ?>" />
-<br/>Role Description:
+<?php //$Id$
-<?php print_textarea($CFG->htmleditor, 10, 50, 50, 10, 'description', "$role->description"); ?>
+ switch ($action) {
+ case 'add': $submitlabel = get_string('addrole', 'role'); break;
+ case 'edit':
+ default: $submitlabel = get_string('savechanges');
+ }
+?>
+<form name="rolesform" action="manage.php" method="post">
+<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
+<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
+<input type="hidden" name="action" value="<?php p($action) ?>" />
+<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
-<input type="hidden" name="contextid" value="<?php echo $contextid; ?>">
+<br />
+<?php print_string('rolename', 'role'); ?>: <input type="text" name="name" value="<?php p($role->name) ?>" />
+<?php print_string('roleshortname', 'role'); ?>: <input type="text" name="shortname" value="<?php p($role->shortname) ?>" />
+<br />
+<?php print_string('roledescription', 'role'); ?>:
+<?php print_textarea($usehtmleditor, 10, 50, 50, 10, 'description', $role->description); ?>
<p>
<table>
<tr>
foreach ($capabilities as $capability) {
// prints a breaker if component or name or context level
if ($capability->component != $component or $capability->contextlevel != $contextlevel) {
- echo ('<tr><td colspan="4"><b>'.
- get_component_string($capability->component, $capability->contextlevel).'</b></td></tr>');
+ echo ('<tr><td colspan="4"><strong>'.
+ get_component_string($capability->component, $capability->contextlevel).'</strong></td></tr>');
}
// these 2 are used to see to group same mod/core capabilities together
<tr>
<td><span title="<?php echo $capability->name ?>"><?php echo get_capability_string($capability->name); ?></span></td>
- <td><INPUT TYPE=radio NAME="<?php echo $capability->name; ?>" VALUE="0" <?php if (!isset($localoverride->permission) || $localoverride->permission==0){ echo 'checked="checked"'; }?>></td>
- <td><INPUT TYPE=radio NAME="<?php echo $capability->name; ?>" VALUE="1" <?php if (isset($localoverride->permission) && $localoverride->permission==1){ echo 'checked="checked"'; }?>></td>
- <td ><INPUT TYPE=radio NAME="<?php echo $capability->name; ?>" VALUE="-1" <?php if (isset($localoverride->permission) && $localoverride->permission==-1){ echo 'checked="checked"'; }?>></td>
- <td ><INPUT TYPE=radio NAME="<?php echo $capability->name; ?>" VALUE="-1000" <?php if (isset($localoverride->permission) && $localoverride->permission==-1000){ echo 'checked="checked"'; }?>></td>
+ <td><input TYPE="radio" name="<?php echo $capability->name; ?>" value="0" <?php if (!isset($localoverride->permission) || $localoverride->permission==0){ echo 'checked="checked"'; }?> /></td>
+ <td><input TYPE="radio" name="<?php echo $capability->name; ?>" value="1" <?php if (isset($localoverride->permission) && $localoverride->permission==1){ echo 'checked="checked"'; }?> /></td>
+ <td ><input TYPE="radio" name="<?php echo $capability->name; ?>" value="-1" <?php if (isset($localoverride->permission) && $localoverride->permission==-1){ echo 'checked="checked"'; }?> /></td>
+ <td ><input TYPE="radio" name="<?php echo $capability->name; ?>" value="-1000" <?php if (isset($localoverride->permission) && $localoverride->permission==-1000){ echo 'checked="checked"'; }?> /></td>
<td><?php
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
echo "T";
?></td>
</tr>
- <?php } ?>
- </table>
+<?php } ?>
+</table>
</p>
-<br/><input type="submit" value="<?php print_string($action);?>">
+<br />
+<input type="submit" value="<?php p($submitlabel); ?>" />
</form>
$roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role
$name = optional_param('name', '', PARAM_MULTILANG); // new role name
$shortname = optional_param('shortname', '', PARAM_SAFEDIR); // new role shortname
- $description = optional_param('description', '', PARAM_MULTILANG); // new role desc
+ $description = optional_param('description', '', PARAM_CLEAN); // new role desc
$action = optional_param('action', '', PARAM_ALPHA);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
}
foreach ($roles as $rolex) {
- $roleoptions[$rolex->id] = $rolex->name;
+ $roleoptions[$rolex->id] = format_string($rolex->name);
}
// prints a form to swap roles
print ('<form name="rolesform1" action="manage.php" method="post">');
- print ('<div align="center">'.get_string('selectrole').': ');
- choose_from_menu ($roleoptions, 'roleid', $roleid, 'choose', $script='rolesform1.submit()');
+ print ('<div align="center">'.get_string('selectrole', 'role').': ');
+ choose_from_menu ($roleoptions, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform1.submit()');
print ('</div></form>');
// this is the array holding capabilities of this role sorted till this context
// this is the available capabilities assignable in this context
$capabilities = fetch_context_capabilities($sitecontext);
+ $usehtmleditor = can_use_html_editor();
print_simple_box_start();
include_once('manage.html');
print_simple_box_end();
+ if ($usehtmleditor) {
+ use_html_editor('description');
+ }
+
} else {
$table = new object;
foreach ($roles as $role) {
- $table->data[] = array('<a href="manage.php?roleid='.$role->id.'&sesskey='.sesskey().'">'.$role->name.'</a>', $role->description, '<a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">'.$strdelete.'</a>');
+ $table->data[] = array('<a href="manage.php?roleid='.$role->id.'&sesskey='.sesskey().'">'.format_string($role->name).'</a>', format_text($role->description, FORMAT_HTML), '<a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">'.$strdelete.'</a>');
}
print_table($table);
print_single_button('manage.php', $options, get_string('addrole', 'role'), 'POST');
}
- use_html_editor('description');
admin_externalpage_print_footer($adminroot);
?>
<form action="override.php" method="post">
- <input type="hidden" name="contextid" value="<?php echo $contextid; ?>">
- <input type="hidden" name="roleid" value="<?php echo $roleid; ?>">
+ <input type="hidden" name="contextid" value="<?php p($contextid) ?>">
+ <input type="hidden" name="roleid" value="<?php p($roleid) ?>">
<?php
if ($userid) {
print ('<input type="hidden" name="userid" value="'.$userid.'"/>');
<input type="radio" name="<?php echo $capability->name; ?>" value="0"
<?php
if ($localpermission == 0) {echo 'checked="checked"';}
- if ($isdisabled) {echo 'disabled="disabled"';}?>>
+ if ($isdisabled) {echo 'disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isallow) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_ALLOW.'"';
if ($localpermission == CAP_ALLOW) {echo ' checked="checked"';}
- if ($isdisabled) {echo ' disabled="disabled"';}?>>
+ if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isprevent) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PREVENT.'"';
if ($localpermission == CAP_PREVENT) {echo ' checked="checked"';}
- if ($isdisabled) {echo ' disabled="disabled"';}?>>
+ if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td align="center" <?php if ($isprohibit) {echo 'class="capcurrent"';} ?>>
<input type="radio" name="<?php echo $capability->name; ?>"
<?php echo ' value="'.CAP_PROHIBIT.'"';
if ($localpermission == CAP_PROHIBIT) {echo ' checked="checked"';}
- if ($isdisabled) {echo ' disabled="disabled"';}?>>
+ if ($isdisabled) {echo ' disabled="disabled"';}?> />
</td>
<td><?php
if (RISK_MANAGETRUST & (int)$capability->riskbitmask) {
<?php } ?>
</table>
<br />
- <div align="center"><input type="submit" value="<?php print_string('savechanges') ?>"></div>
+ <div align="center"><input type="submit" value="<?php print_string('savechanges') ?>" /></div>
</form>
echo '<input type="hidden" name="courseid" value="'.$courseid.'" />';
}
echo '<input type="hidden" name="contextid" value="'.$context->id.'" />'.$strroletooverride.': ';
- choose_from_menu ($overridableroles, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
+ choose_from_menu ($overridableroles, 'roleid', $roleid, get_string('listallroles', 'role'), $script='rolesform.submit()');
echo '</div></form>';
$r_caps = role_context_capabilities($roleid, $context);
print_simple_box_end();
} else {
notice(get_string('nocapabilitiesincontext', 'role'),
- $CFG->wwwroot.'/admin/roles/override.php?contextid='.$contextid);
+ $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$contextid);
}
} else { // Print overview table
</form>
<form name="rolesform1" action="groups.php" method="get">
<input type="hidden" name="id" value="<?php echo $courseid ?>">
- <div align="center"><?php echo get_string('selectrole') ?>:
+ <div align="center"><?php echo get_string('selectrole', 'role') ?>:
<?php choose_from_menu ($roleoptions, 'roleid', $roleid, 'choose', $script='rolesform1.submit()') ?>
</div></form>
</td>
$string['selectamodule'] = 'Please select an activity module';
$string['selectednowmove'] = '$a files selected for moving. Now go to the destination and press \'Move files to here\'';
$string['selectnos'] = 'Select all \'no\'';
-$string['selectrole'] = 'Select a Role';
$string['senddetails'] = 'Send my details via email';
$string['separateandconnected'] = 'Separate and Connected ways of knowing';
$string['serverlocaltime'] = 'Server\'s local time';
$string['defineroles'] = 'Define roles';
$string['existingusers'] = '$a existing users';
$string['inherit'] = 'Inherit';
+$string['listallroles'] = 'List all roles...';
$string['manageroles'] = 'Manage roles';
$string['nocapabilitiesincontext'] = 'No capabilities available in this context';
$string['overrideroles'] = 'Override roles';
$string['potentialusers'] = '$a potential users';
$string['prevent'] = 'Prevent';
$string['prohibit'] = 'Prohibit';
+$string['risks'] = 'Risks';
+$string['roledescription'] = 'Role description';
+$string['rolename'] = 'Role name';
+$string['roleshortname'] = 'Role short name (ASCII)';
$string['roletoassign'] = 'Role to assign';
$string['roletooverride'] = 'Role to override';
$string['roles'] = 'Roles';
+$string['selectrole'] = 'Select a role';
$string['site:doanything'] = 'Allowed to do everything';
$string['legacy:guest'] = 'LEGACY ROLE: Guest';
$string['site:manageblocks'] = 'Manage site-level blocks';
$string['site:accessallgroups'] = 'Access all groups';
$string['site:viewfullnames'] = 'Always see full names of users';
-$string['site:trustcontent'] = 'Trust content is safe';
+$string['site:trustcontent'] = 'Trust submitted content';
$string['site:doclinks'] = 'Show links to offsite docs';
$string['site:viewreports'] = 'View reports';
$string['user:create'] = 'Create users';