MDL-15402: Repository admin: separate operations in three columns, change small icons...
authorjerome <jerome>
Thu, 4 Sep 2008 07:03:01 +0000 (07:03 +0000)
committerjerome <jerome>
Thu, 4 Sep 2008 07:03:01 +0000 (07:03 +0000)
lang/en_utf8/repository.php
lib/adminlib.php
repository/lib.php

index aeaeeab0b0d112381318e2b73e7028ff1ad352ea..355bf85bd2527883ce152e8f8cbeabccb816265f 100644 (file)
@@ -14,6 +14,7 @@ $string['confirmdelete'] = 'Are you sure you want to delete this repository - $a
 $string['confirmremove'] = 'Are you sure you want to remove this repository plugin and <strong style=color:red>all of its instances</strong> - $a?';
 $string['create'] = 'Create';
 $string['createrepository'] = 'Create a repository instance';
+$string['createinstance'] = 'Create a repository instance';
 $string['date'] = 'Date';
 $string['deleterepository'] = 'Delete this repository';
 $string['deleted'] = 'Repository deleted';
@@ -27,6 +28,7 @@ $string['filename'] = 'Filename';
 $string['filenotnull'] = 'You must select a file to upload.';
 $string['filesaved'] = 'The file has been saved';
 $string['getfile'] = 'Select this file';
+$string['hiddenshow'] = 'Hide/Show';
 $string['instance'] = 'instance';
 $string['instancedeleted'] = 'Instance deleted';
 $string['instances'] = 'Repository instances';
@@ -55,6 +57,7 @@ $string['saving'] = 'Saving';
 $string['settings'] = 'Settings';
 $string['search'] = 'Search ';
 $string['searching'] = 'What are you searching for?';
+$string['siteinstances'] = 'Repositories instances of the site';
 $string['size'] = 'Size';
 $string['submit'] = 'Submit';
 $string['sync'] = 'Sync';
index 098e12241f7d589d776a3a7347277e4153f86c6d..a8b342685f67fa485e4e085c61136bc0e83c4b55 100644 (file)
@@ -5580,27 +5580,30 @@ class admin_setting_managerepository extends admin_setting {
         global $CFG, $USER;
         $output = print_box_start('generalbox','',true);
         $namestr = get_string('name');
-        $stropt = get_string('operation', 'repository');
-        $updown = get_string('updown', 'repository');
+        $settingsstr = get_string('settings');
+        $updownstr = get_string('updown', 'repository');
+        $hiddenstr = get_string('hiddenshow', 'repository');
+        $deletestr = get_string('delete');
         $plugins = get_list_of_plugins('repository');
         $instances = repository_get_types();
         $instancesnumber = count($instances);
         $alreadyplugins = array();
         $table = new StdClass;
-        $table->head = array($namestr, $updown, $stropt);
-        $table->align = array('left', 'center', 'center');
+        $table->head = array($namestr, $updownstr, $hiddenstr, $deletestr, $settingsstr);
+        $table->align = array('left', 'center', 'center','center','center');
         $table->data = array();
         $updowncount=1;
         foreach ($instances as $i) {
-            $row = '';
+            $settings = '';
             //display edit link only if you can config the type or its instances
             if ( repository_static_function($i->get_typename(), 'has_admin_config')
                  || repository_static_function($i->get_typename(), 'has_instance_config')
                  || repository_static_function($i->get_typename(), 'has_multiple_instances')) {
-                $row .= '<a href="' . $this->baseurl . '&amp;edit=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('edit') . '" /></a>' . "\n";
+                $settings .= '<a href="' . $this->baseurl . '&amp;edit=' . $i->get_typename() . '">'. $settingsstr .'</a>' . "\n";
             }
-            $row .= '<a href="' . $this->baseurl . '&amp;delete=' .  $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('delete') . '" /></a>' . "\n";
-            $row .= ' <a href="' . $this->baseurl . '&amp;hide=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/t/' . ($i->get_visible() ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get_visible() ? 'hide' : 'show') . '" /></a>' . "\n";
+            $delete = '<a href="' . $this->baseurl . '&amp;delete=' .  $i->get_typename() . '">' . $deletestr . '</a>' . "\n";
+            
+            $hiddenshow = ' <a href="' . $this->baseurl . '&amp;hide=' . $i->get_typename() . '"><img src="' . $CFG->pixpath . '/i/' . ($i->get_visible() ? 'hide' : 'show') . '.gif" alt="' . get_string($i->get_visible() ? 'hide' : 'show') . '" /></a>' . "\n";
 
              // display up/down link
             $updown = '';
@@ -5622,7 +5625,7 @@ class admin_setting_managerepository extends admin_setting {
 
                 $updowncount++;
 
-            $table->data[] = array($i->get_readablename(), $updown,$row);
+            $table->data[] = array($i->get_readablename(), $updown, $hiddenshow, $delete, $settings);
 
             //display a grey row if the type is defined as not visible
             if (!$i->get_visible()){
index 04a6c99f35e6bdac284dbb69b464700310adeb79..73e81aceeb9d14578c2eea024695c2042f7d8e1e 100644 (file)
@@ -1975,7 +1975,7 @@ final class repository_admin_form extends moodleform {
 
         $mform =& $this->_form;
         $strrequired = get_string('required');
-       
+
         $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->get_typename() : 0);
         $mform->addElement('hidden', 'new',   $this->plugin);
         $mform->addElement('hidden', 'plugin', $this->plugin);
@@ -2027,11 +2027,16 @@ function repository_display_instances_list($context, $admin = false, $typename =
 
         }
         $output = print_simple_box_start(true);
-        $output .= "<div ><h2 style='text-align: center'>" . get_string('instances', 'repository') . "</h2></div>";
+
+        if ($admin) {
+             $output .= "<div ><h2 style='text-align: center'>" . get_string('siteinstances', 'repository') . " ";
+        }
+        $output .= "</h2></div>";
 
         $namestr = get_string('name');
         $pluginstr = get_string('plugin', 'repository');
-        $stropt = get_string('operation', 'repository');
+        $settingsstr = get_string('settings');
+        $deletestr = get_string('delete');
         $updown = get_string('updown', 'repository');
         $plugins = get_list_of_plugins('repository');
         //retrieve list of instances. In administration context we want to display all
@@ -2042,17 +2047,18 @@ function repository_display_instances_list($context, $admin = false, $typename =
         $instancesnumber = count($instances);
         $alreadyplugins = array();
         $table = new StdClass;
-        $table->head = array($namestr, $pluginstr, $stropt);
-        $table->align = array('left', 'left', 'center');
+        $table->head = array($namestr, $pluginstr, $deletestr, $settingsstr);
+        $table->align = array('left', 'left', 'center','center');
         $table->data = array();
         $updowncount=1;
         foreach ($instances as $i) {
-            $row = '';
-            $row .= '<a href="' . $baseurl . '&amp;type='.$typename.'&amp;edit=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('edit') . '" /></a>' . "\n";
-            $row .= '<a href="' . $baseurl . '&amp;type='.$typename.'&amp;delete=' .  $i->id . '"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('delete') . '" /></a>' . "\n";
-            //$row .= ' <a href="' . $baseurl . '&amp;type='.$typename.'&amp;hide=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/' . ($i->visible ? 'hide' : 'show') . '.gif" alt="' . get_string($i->visible ? 'hide' : 'show') . '" /></a>' . "\n";
+            $settings = '';
+            $settings .= '<a href="' . $baseurl . '&amp;type='.$typename.'&amp;edit=' . $i->id . '">' . $settingsstr . '</a>' . "\n";
+            $delete = '<a href="' . $baseurl . '&amp;type='.$typename.'&amp;delete=' .  $i->id . '">' . $deletestr . '</a>' . "\n";
+
+            $table->data[] = array($i->name, $type->get_readablename(), $delete, $settings);
+
 
-            $table->data[] = array($i->name, $type->get_readablename(),$row);
             //display a grey row if the type is defined as not visible
             if (isset($type) && !$type->get_visible()){
                 $table->rowclass[] = 'dimmed_text';
@@ -2065,14 +2071,14 @@ function repository_display_instances_list($context, $admin = false, $typename =
             }
         }
         $output .= print_table($table, true);
-        $instancehtml = '<div><h3>';
-        $addable = 0;
-        $instancehtml .= get_string('createrepository', 'repository');
-        $instancehtml .= '</h3><ul>';
+        $instancehtml = '<div>';
         $addable = 0;
 
         //if no type is set, we can create all type of instance
         if (!$typename) {
+            $instancehtml .= '<h3>';
+            $instancehtml .= get_string('createrepository', 'repository');
+            $instancehtml .= '</h3><ul>';
             foreach ($plugins as $p) {
                 if (!in_array($p, $alreadyplugins)) {
                    if (repository_static_function($p->get_typename(), 'has_multiple_instances')){
@@ -2083,18 +2089,19 @@ function repository_display_instances_list($context, $admin = false, $typename =
                     }
                 }
             }
+             $instancehtml .= '</ul>';
         }
         //create a unique type of instance
         else {
             if (repository_static_function($typename, 'has_multiple_instances')){
                 $addable = 1;
-                $instancehtml .= '<li><a href="'.$baseurl.'&amp;new='.$typename.'">'.get_string('create', 'repository')
-                                  .' "'.get_string('repositoryname', 'repository_'.$typename).'" '
-                                  .get_string('instance', 'repository').'</a></li>';
+                $instancehtml .= "<form action='".$baseurl."&amp;new=".$typename."' method='post'>
+                                  <p style='text-align:center'><input type='submit' value='".get_string('createinstance', 'repository')."'/></p>
+                                  </form>";
             }
         }
 
-        $instancehtml .= '</ul>';
+
 
         if ($addable) {
             $instancehtml .= '</div>';