From 4d5948f1ac80d758728fbd91e2ac04cb780c25b5 Mon Sep 17 00:00:00 2001 From: jerome Date: Thu, 4 Sep 2008 07:03:01 +0000 Subject: [PATCH] MDL-15402: Repository admin: separate operations in three columns, change small icons into bigger icon and texts. Change Create instance link as a Create instance button. --- lang/en_utf8/repository.php | 3 +++ lib/adminlib.php | 21 ++++++++++-------- repository/lib.php | 43 +++++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/lang/en_utf8/repository.php b/lang/en_utf8/repository.php index aeaeeab0b0..355bf85bd2 100644 --- a/lang/en_utf8/repository.php +++ b/lang/en_utf8/repository.php @@ -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 all of its instances - $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'; diff --git a/lib/adminlib.php b/lib/adminlib.php index 098e12241f..a8b342685f 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -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 .= '' . get_string('edit') . '' . "\n"; + $settings .= ''. $settingsstr .'' . "\n"; } - $row .= '' . get_string('delete') . '' . "\n"; - $row .= ' ' . get_string($i->get_visible() ? 'hide' : 'show') . '' . "\n"; + $delete = '' . $deletestr . '' . "\n"; + + $hiddenshow = ' ' . get_string($i->get_visible() ? 'hide' : 'show') . '' . "\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()){ diff --git a/repository/lib.php b/repository/lib.php index 04a6c99f35..73e81aceeb 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -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 .= "

" . get_string('instances', 'repository') . "

"; + + if ($admin) { + $output .= "

" . get_string('siteinstances', 'repository') . " "; + } + $output .= "

"; $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 .= '' . get_string('edit') . '' . "\n"; - $row .= '' . get_string('delete') . '' . "\n"; - //$row .= ' ' . get_string($i->visible ? 'hide' : 'show') . '' . "\n"; + $settings = ''; + $settings .= '' . $settingsstr . '' . "\n"; + $delete = '' . $deletestr . '' . "\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 = '

'; - $addable = 0; - $instancehtml .= get_string('createrepository', 'repository'); - $instancehtml .= '

'; + if ($addable) { $instancehtml .= '
'; -- 2.39.5