]> git.mjollnir.org Git - moodle.git/commitdiff
some UI change for roles
authortoyomoyo <toyomoyo>
Tue, 8 Aug 2006 08:31:21 +0000 (08:31 +0000)
committertoyomoyo <toyomoyo>
Tue, 8 Aug 2006 08:31:21 +0000 (08:31 +0000)
admin/index.php
admin/roles/assign.php
admin/roles/manage.html
admin/roles/manage.php
admin/roles/tabs.php

index ff563380eb68c126a2e50baccc4d5ce40c27079c..ca1d2051127fcdaa7972e661040ba42b940683d9 100644 (file)
     $testingdata  = '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
                    '</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
                            
+    $testingdata .= '<div class="adminlink"><a href="unittest/index.php">'.get_string('unittests', 'admin').
+                   '</a> - <span class="explanation">'.get_string('adminhelpunittests').'</span></div>';
+
+    $table->data[] = array('<strong><a href="tests.php">'.get_string('tests','admin').'</a></strong>',
+                           $testingdata);
+
+    $testingdata  = '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
+                   '</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
+                           
     $testingdata .= '<div class="adminlink"><a href="report/simpletest/index.php">'.get_string('simpletest', 'admin').
                    '</a> - <span class="explanation">'.get_string('adminhelpsimpletest').'</span></div>';
 
@@ -537,4 +546,4 @@ epository').'</a></strong>',
 
     print_footer($site);
 
-?>
+?>
\ No newline at end of file
index 0d82b8b3499f6b835cae1b5ad385bb19e54b3e5f..5884d0d603670c8edd72def124fd9b3566cb4e4a 100755 (executable)
@@ -61,6 +61,7 @@
        */
        $straction = get_string('roleassignment');
        $context = get_record('context', 'id', $contextid);
+       
        $currenttab = '';
        $tabsmode = 'assign';
        include_once('tabs.php');
index 8338c450467e4c82673d270a09533bc69a20fa12..ca1e0ca5eb41fc90f6914d6c695aa6f81a6c4552 100755 (executable)
@@ -3,7 +3,10 @@
 <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; ?>">
-<br/>Role Description: <input type="text" name="description" value="<?php echo $role->description; ?>">
+<br/>Role Description: 
+
+<?php print_textarea($CFG->htmleditor, 10, 50, 50, 10, 'description', "$role->description"); ?>
+
 <input type="hidden" name="contextid" value="<?php echo $contextid; ?>">
 <p>                    
                        <table>
@@ -57,4 +60,4 @@
                        </table>         
 </p>
 <br/><input type="submit" value="<?php print_string($action);?>">
-</form>
+</form>
\ No newline at end of file
index 146052b2f869039f83f01f45d0f239f7611f145f..8cc53666feba301e79500e92c93c785dcd8d3dd5 100755 (executable)
     
     $stradministration = get_string('administration');
     $strmanageroles = get_string('manageroles');
+
+    if ($roleid && $action!='delete') {
+       $role = get_record('role', 'id', $roleid);
+      
+       $edittingstr = '-> '.get_string('editting', $role->name);  
+    } else {
+       $edittingstr ='';  
+    }
     
     print_header("$site->shortname: $strmanageroles", 
                  "$site->fullname", 
-                 "<a href=\"../index.php\">$stradministration</a> -> $strmanageroles");
+                 "<a href=\"../index.php\">$stradministration</a> -> <a href=\"manage.php\">$strmanageroles</a>
+                                $edittingstr
+                                ");
 
        // form processing, editting a role, adding a role or deleting a role
        if ($action && confirm_sesskey()) {
                
        }
 
-       if ($roleid) { // load the role if id is present
-               $role = get_record('role', 'id', $roleid);
-               $action = 'edit';
-       } else {
-               $role->name='';
-               $role->description='';
-               $action = 'add';  
-       }       
-
        $roles = get_records('role');
 
-    foreach ($roles as $rolex) {
-       $options[$rolex->id] = $rolex->name;
-    }
-    
-    // prints a form to swap roles
-    print ('<form name="rolesform1" action="manage.php" method="post">');
-    print ('<div align="center">Select a Role: ');
-    choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform1.submit()');
-       print ('</div></form>');
-               
-       $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
-       $contextid = $sitecontext->id;
-       
-       // this is the array holding capabilities of this role sorted till this context
-       $r_caps = role_context_capabilities($roleid, $sitecontext->id);
-               
-       // this is the available capabilities assignable in this context
-       $capabilities = fetch_context_capabilities($sitecontext->id);
+       if (($roleid && $action!='delete') || $action=='new') { // load the role if id is present
+                       
+               if ($roleid) {
+                       $action='edit';
+                       $role = get_record('role', 'id', $roleid);
+               } else {        
+                       $action='add';                  
+                       $role->name='';
+                       $role->description='';
+               }
+               
+           foreach ($roles as $rolex) {
+               $options[$rolex->id] = $rolex->name;
+           }
+           
+           // prints a form to swap roles
+           print ('<form name="rolesform1" action="manage.php" method="post">');
+           print ('<div align="center">Select a Role: ');
+           choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform1.submit()');
+               print ('</div></form>');
+                       
+               $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
+               $contextid = $sitecontext->id;
+               
+               // this is the array holding capabilities of this role sorted till this context
+               $r_caps = role_context_capabilities($roleid, $sitecontext->id);
+                       
+               // this is the available capabilities assignable in this context
+               $capabilities = fetch_context_capabilities($sitecontext->id);
+               
+               print_simple_box_start();
+               include_once('manage.html');
+               print_simple_box_end();
        
-       if (!$roleid) {
-               $action='add';  
        } else {
-               $action='edit';  
-       }
-       
-       print_simple_box_start();
-       include_once('manage.html');
-       print_simple_box_end();
-       /*************************************************
-        * List all roles and link them to override page *
-        *************************************************/
-
-       foreach ($roles as $role) {
-               echo ('<br><a href="roleoverride.php?contextid=1&roleid='.$role->id.'">'.$role->name.'</a>&nbsp;<a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">delete</a>');               
+               
+               $table->tablealign = "center";
+       $table->align = array ("middle", "left");
+       $table->wrap = array ("nowrap", "nowrap");
+       $table->cellpadding = 5;
+       $table->cellspacing = 0;
+       $table->width = '40%';
+               /*************************
+               * List all current roles *
+               **************************/
+               
+               $table->data[] = array('roles', 'description', 'delete');
+               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().'">delete</a>');
+         
+               }       
+               print_table($table);
+               
+               echo ('<form action="manage.php" method="POST">');
+               echo ('<input type="hidden" name="sesskey" value="'.sesskey().'">');
+               echo ('<input type="hidden" name="action" value="new">');
+               echo ('<input type="submit" value="add new role">');
        }
 
+       use_html_editor("description");
        print_footer($course);
 ?>
index 04824627e873e20d2aa7ee7d1504b2cede2d6cf1..151d00edfe1f9ee7ee5ea36ae8450beabcbc6842 100755 (executable)
@@ -5,7 +5,8 @@ if ($currenttab != 'update') {
        switch ($context->level) {
          
                case CONTEXT_SYSTEM:
-                       print_header($site->fullname, "$site->fullname","$straction");
+                       $stradministration = get_string('administration');
+                       print_header($site->fullname, "$site->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
            break;
        
            case CONTEXT_PERSONAL:
@@ -110,7 +111,8 @@ if ($currenttab != 'update') {
         $tabs = array($toprow);
     }
     
-    print_tabs($tabs, $currenttab, $inactive);
-
+       if ($context->level != CONTEXT_SYSTEM) { // do not show tabs otherwise
+       print_tabs($tabs, $currenttab, $inactive);
+       }
 
 ?>