]> git.mjollnir.org Git - moodle.git/commitdiff
various minor Role UI fixes
authorskodak <skodak>
Tue, 19 Sep 2006 17:34:29 +0000 (17:34 +0000)
committerskodak <skodak>
Tue, 19 Sep 2006 17:34:29 +0000 (17:34 +0000)
admin/roles/allowassign.php
admin/roles/allowoverride.php
admin/roles/assign.html
admin/roles/assign.php
admin/roles/manage.html
admin/roles/manage.php
admin/roles/override.html
admin/roles/override.php
course/groups-edit.html
lang/en_utf8/moodle.php
lang/en_utf8/role.php

index ebdeca7a7f2d0ae4390ccb83f8f85ad9618d7ca1..b2685a13489a11b7f6f4e8b094329bc3f26d643a 100755 (executable)
@@ -67,7 +67,7 @@
     
 /// 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';
@@ -77,7 +77,7 @@
     
     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');
index 4dcce9dab7482da3dbea7f8a86010c9763f412c2..7904208c62fb86f86a4d1ed0e8fa08e5ec4c9d6c 100755 (executable)
@@ -65,7 +65,7 @@
     
 /// 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';
@@ -75,7 +75,7 @@
     
     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');
index 362560e4de0eb283b710b9964a3b4bcd454129bb..3a7bb7facf9623bccd8ec4972c3461e29a662aaa 100755 (executable)
@@ -9,9 +9,9 @@ if ($courseid) {
     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">
index 6f95aa9d991c19da9d4c6c389a0c633719adbc59..739c8af61c56d401e4f05fa782f5cdde2a6e7408 100755 (executable)
             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");
index bd85713beff88272c00ff22235ef4db6a21952b2..bae0aca93cbb10bdcd6242028bfddbf2443145d8 100755 (executable)
@@ -1,15 +1,23 @@
-<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; ?>">
-&nbsp;
-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) ?>" />&nbsp;
+<?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>
@@ -30,8 +38,8 @@ $component = '';
 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
@@ -47,10 +55,10 @@ foreach ($capabilities as $capability) {
 
         <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";
@@ -70,8 +78,9 @@ foreach ($capabilities as $capability) {
         ?></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>
index 6679ee6f0bf08a488718d3603368718d7ec808be..7106bc49772f218d664d3ccb3d8e650ec9569f50 100755 (executable)
@@ -10,7 +10,7 @@
     $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.'&amp;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.'&amp;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);
 ?>
index a74662736860d3ad5396f064dbaa833197594e16..41f1b8aeee71cb1092684acc771ce3825a4cdb42 100755 (executable)
@@ -1,6 +1,6 @@
             <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.'"/>');
@@ -61,28 +61,28 @@ if ($courseid) {
                  <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) {
@@ -106,5 +106,5 @@ if ($courseid) {
             <?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>
index 1cf0816ff05be862ef70c592dd19d408b0678038..26e1bf6cdde7db3ba9ef4b229aafd2642283c53d 100755 (executable)
             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
index c3356774670ff988a9a553c814f9ffed979c46c2..9c0f3bef324df49bde9cb0fc219759edd8657d71 100755 (executable)
@@ -125,7 +125,7 @@ function groupWindow(selectgroup) {
         </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>
index fe5c49ed83af227bdcdeb32b5c22da907333fe23..1c94d66241554835daad8b3dc61faba5b4b8f261 100644 (file)
@@ -1155,7 +1155,6 @@ $string['selectacountry'] = 'Select a country';
 $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';
index e96ba7580e725dcef37b794c595241cb0c4bfc4e..b9e90e762306f2ba1d47dbcab972f3c99eb8498f 100644 (file)
@@ -13,6 +13,7 @@ $string['currentcontext'] = 'Current context';
 $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';
@@ -21,9 +22,14 @@ $string['permissions'] = 'Permissions';
 $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';
@@ -39,7 +45,7 @@ $string['site:restore'] = 'Restore courses';
 $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';