mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-42299 course: management category expansion improvements
This commit is contained in:
parent
d5de874727
commit
df460b5a23
6 changed files with 73 additions and 8 deletions
|
@ -823,8 +823,8 @@ class helper {
|
|||
$categoryid = $coursecat->id;
|
||||
$path = $coursecat->get_parents();
|
||||
/* @var \cache_session $cache */
|
||||
$cache = \cache::make('core', 'coursecat');
|
||||
$categories = $cache->get('managementexpanded');
|
||||
$cache = \cache::make('core', 'userselections');
|
||||
$categories = $cache->get('categorymanagementexpanded');
|
||||
if (!is_array($categories)) {
|
||||
if (!$expanded) {
|
||||
// No categories recorded, nothing to remove.
|
||||
|
@ -858,7 +858,7 @@ class helper {
|
|||
unset($ref[$categoryid]);
|
||||
}
|
||||
}
|
||||
$cache->set('managementexpanded', $categories);
|
||||
$cache->set('categorymanagementexpanded', $categories);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -870,8 +870,8 @@ class helper {
|
|||
public static function get_expanded_categories($withpath = null) {
|
||||
if (self::$expandedcategories === null) {
|
||||
/* @var \cache_session $cache */
|
||||
$cache = \cache::make('core', 'coursecat');
|
||||
self::$expandedcategories = $cache->get('managementexpanded');
|
||||
$cache = \cache::make('core', 'userselections');
|
||||
self::$expandedcategories = $cache->get('categorymanagementexpanded');
|
||||
if (self::$expandedcategories === false) {
|
||||
self::$expandedcategories = array();
|
||||
}
|
||||
|
|
|
@ -1209,7 +1209,7 @@ class behat_course extends behat_base {
|
|||
throw new ExpectationException("Could not find the actions for $listingtype", $this->getSession());
|
||||
}
|
||||
$actionnode = $actionsnode->find('css', '.action-'.$action);
|
||||
if ($actionnode === null && $this->running_javascript()) {
|
||||
if ($this->running_javascript() && !$actionnode->isVisible()) {
|
||||
$actionsnode->find('css', 'a.toggle-display')->click();
|
||||
if ($actionnode) {
|
||||
$actionnode = $listingnode->find('css', '.action-'.$action);
|
||||
|
|
|
@ -735,6 +735,7 @@ Feature: Course category management interface performs as expected
|
|||
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click on "Cat 1" "link"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
|
@ -743,4 +744,58 @@ Feature: Course category management interface performs as expected
|
|||
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click on "Re-sort subcategories" "link" in the ".category-listing-actions" "css_element"
|
||||
And I click on "By idnumber" "link" in the ".category-listing-actions" "css_element"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Test category expansion after deletion
|
||||
Given the following "categories" exists:
|
||||
| name | category | idnumber |
|
||||
| Cat A (1) | 0 | CAT1 |
|
||||
| Cat B (2) | 0 | CAT2 |
|
||||
| Cat C (1-1) | CAT1 | CAT3 |
|
||||
| Cat D (2-1) | CAT2 | CAT4 |
|
||||
| Cat E (2-1-1) | CAT4 | CAT5 |
|
||||
|
||||
And I log in as "admin"
|
||||
And I go to the courses management page
|
||||
And I should see the "Course categories" management page
|
||||
And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I click to expand category "CAT1" in the management interface
|
||||
And I should see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
# AJAX action - no redirect.
|
||||
And I click to expand category "CAT2" in the management interface
|
||||
And I should see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
# AJAX action - no redirect.
|
||||
And I click to expand category "CAT4" in the management interface
|
||||
And I should see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
# AJAX action - no redirect.
|
||||
And I click on "delete" action for "Cat B (2)" in management category listing
|
||||
# Redirect.
|
||||
And I should see "Delete category: Cat B (2)"
|
||||
And I should see "Contents of Cat B (2)"
|
||||
And I press "Delete"
|
||||
# Redirect
|
||||
And I should see "Delete category: Cat B (2)"
|
||||
And I should see "Deleted course category Cat B (2)"
|
||||
And I press "Continue"
|
||||
# Redirect.
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
|
||||
And I should not see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"
|
|
@ -55,6 +55,7 @@ $string['cachedef_plugin_manager'] = 'Plugin info manager';
|
|||
$string['cachedef_questiondata'] = 'Question definitions';
|
||||
$string['cachedef_repositories'] = 'Repositories instances data';
|
||||
$string['cachedef_string'] = 'Language string cache';
|
||||
$string['cachedef_userselections'] = 'Data used to persist user selections throughout Moodle';
|
||||
$string['cachedef_yuimodules'] = 'YUI Module definitions';
|
||||
$string['cachelock_file_default'] = 'Default file locking';
|
||||
$string['cachestores'] = 'Cache stores';
|
||||
|
|
|
@ -196,4 +196,13 @@ $definitions = array(
|
|||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
),
|
||||
// This is the session user selections cache.
|
||||
// It's a special cache that is used to record user selections that should persist for the lifetime of the session.
|
||||
// Things such as which categories the user has expanded can be stored here.
|
||||
// It uses simple keys and simple data, please ensure all uses conform to those two constraints.
|
||||
'userselections' => array(
|
||||
'mode' => cache_store::MODE_SESSION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true
|
||||
),
|
||||
);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2013101500.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2013101700.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue