Commit 56c7f911 authored by Robert Lyon's avatar Robert Lyon

Bug 1667181: Changing the navigation to Pages and collections

Change-Id: Ib68c1b57bf8910702678b43b4499456ed88b53dc
parent 143ac528
......@@ -19,7 +19,7 @@ define('SECTION_PAGE', 'siteviews');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'view.php');
$title = get_string('siteviews', 'admin');
$title = get_string('siteviewscollections', 'admin');
define('TITLE', $title);
$offset = param_integer('offset', 0);
......
......@@ -27,28 +27,31 @@ $groupid = $collection->get('group');
$institutionname = $collection->get('institution');
$urlparams = array();
if (!empty($groupid)) {
define('MENUITEM', 'groups/collections');
define('MENUITEM', 'groups/views');
define('GROUP', $groupid);
define('SUBSECTIONHEADING', get_string('Collections', 'collection'));
$baseurl = get_config('wwwroot') . 'view/groupviews.php';
$urlparams['group'] = $groupid;
}
else if (!empty($institutionname)) {
if ($institutionname == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', 'configsite/collections');
define('MENUITEM', 'configsite/views');
$baseurl = get_config('wwwroot') . 'admin/site/views.php';
}
else {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/institutioncollections');
define('MENUITEM', 'manageinstitutions/institutionviews');
$baseurl = get_config('wwwroot') . 'view/institutionviews.php';
}
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/collection');
define('MENUITEM', 'myportfolio/views');
$baseurl = get_config('wwwroot') . 'view/index.php';
}
define('TITLE', $collection->get('name'));
$baseurl = get_config('wwwroot') . 'collection/index.php';
if ($urlparams) {
$baseurl .= '?' . http_build_query($urlparams);
}
......
......@@ -49,34 +49,37 @@ if ($collection->is_submitted()) {
$urlparams = array();
if (!empty($groupid)) {
require_once('group.php');
define('MENUITEM', 'groups/collections');
define('MENUITEM', 'groups/views');
define('GROUP', $groupid);
$group = group_current_group();
define('TITLE', $group->name . ' - ' . get_string('editcollection', 'collection'));
$baseurl = get_config('wwwroot') . 'view/groupviews.php';
$urlparams['group'] = $groupid;
}
else if (!empty($institutionname)) {
if ($institutionname == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', 'configsite/collections');
define('MENUITEM', 'configsite/views');
$baseurl = get_config('wwwroot') . 'admin/site/views.php';
}
else {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/institutioncollections');
define('MENUITEM', 'manageinstitutions/institutionviews');
$baseurl = get_config('wwwroot') . 'view/institutionviews.php';
}
define('TITLE', get_string('editcollection', 'collection'));
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/collection');
define('MENUITEM', 'myportfolio/views');
define('TITLE', get_string('editcollection', 'collection'));
$baseurl = get_config('wwwroot') . 'view/index.php';
}
if (!$USER->can_edit_collection($collection)) {
throw new AccessDeniedException(get_string('canteditcollection', 'collection'));
}
$baseurl = get_config('wwwroot') . 'collection/index.php';
if ($urlparams) {
$baseurl .= '?' . http_build_query($urlparams);
}
......
......@@ -56,30 +56,34 @@ $groupid = $collection->get('group');
$institutionname = $collection->get('institution');
$urlparams = array();
if (!empty($groupid)) {
define('MENUITEM', 'groups/collections');
define('MENUITEM', 'groups/views');
define('GROUP', $groupid);
$group = group_current_group();
define('TITLE', $group->name . ' - ' . get_string('editviews', 'collection'));
$baseurl = get_config('wwwroot') . 'view/groupviews.php';
$urlparams['group'] = $groupid;
}
else if (!empty($institutionname)) {
if ($institutionname == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', 'configsite/collections');
define('MENUITEM', 'configsite/views');
$baseurl = get_config('wwwroot') . 'admin/site/views.php';
}
else {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/institutioncollections');
define('MENUITEM', 'manageinstitutions/institutionviews');
$baseurl = get_config('wwwroot') . 'view/institutionviews.php';
}
define('TITLE', get_string('editviews', 'collection'));
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'myportfolio/collection');
define('MENUITEM', 'myportfolio/views');
define('TITLE', get_string('editviews', 'collection'));
$baseurl = get_config('wwwroot') . 'view/index.php';
}
define('SUBSECTIONHEADING', $collection->get('name'));
$baseurl = get_config('wwwroot') . 'collection/index.php';
if ($urlparams) {
$baseurl .= '?' . http_build_query($urlparams);
}
......
......@@ -102,6 +102,7 @@ $string['sitefilesdescription'] = 'Upload and administer files that can be put i
$string['siteskins'] = 'Site skins';
$string['siteskinsdescription'] = 'Create and administer page skins usable by all users on the site';
$string['siteviews'] = 'Site pages';
$string['siteviewscollections'] = 'Site pages and collections';
$string['siteviewsdescription'] = 'Create and administer pages and page templates for the entire site';
$string['networking'] = 'Networking';
$string['networkingdescription'] = 'Configure networking for Mahara';
......
......@@ -294,6 +294,7 @@ $string['backtofriendslist'] = 'Back to friends list';
$string['findnewfriends'] = 'Find new friends';
$string['Collections'] = 'Collections';
$string['Views'] = 'Pages';
$string['Viewscollections'] = 'Pages and collections';
$string['Files'] = 'Files';
$string['noviewstosee'] = 'None that you can see';
$string['whymakemeyourfriend'] = 'This is why you should make me your friend:';
......
......@@ -57,6 +57,7 @@ $string['templateportfoliodescription'] = 'Set up the default layout for the pag
$string['artefacts'] = 'Artefacts';
$string['groupviews'] = 'Group pages';
$string['institutionviews'] = 'Institution pages';
$string['institutionviewscollections'] = 'Institution pages and collections';
$string['reallyaddaccesstoemptyview'] = 'Your page contains no blocks. Do you really want to give these users access to the page?';
$string['viewdeleted'] = 'Page deleted';
$string['viewsubmitted'] = 'Page submitted';
......@@ -75,6 +76,7 @@ $string['views'] = 'pages';
$string['viewsandcollections'] = 'pages and collections';
$string['View'] = 'Page';
$string['Views'] = 'Pages';
$string['Viewscollections'] = 'Pages and collections';
$string['viewsubmittedtogroup'] = 'This page has been submitted to <a href="%s">%s</a>.';
$string['viewsubmittedtogroupon'] = 'This page was submitted to <a href="%s">%s</a> on %s.';
$string['collectionsubmittedtogroup'] = 'This collection has been submitted to <a href="%s">%s</a>.';
......@@ -242,6 +244,8 @@ $string['editblockspagedescription'] = '<p>Drag and drop content blocks from the
$string['displayview'] = 'Display page';
$string['editthisview'] = 'Edit this page';
$string['expandcontract'] = 'Expand / Contract list of block types';
$string['returntoinstitutionpages'] = 'Return to institution pages';
$string['returntositepages'] = 'Return to site pages';
$string['success.addblocktype'] = 'Added block successfully';
$string['err.addblocktype'] = 'Could not add the block to your page';
......
......@@ -966,7 +966,24 @@ class Collection {
$redirecturl = '/collection/views.php';
}
else {
$redirecturl = '/collection/index.php';
if ($this->get('group')) {
// Group owned collection
$redirecturl = '/view/groupviews.php';
}
else if ($this->get('institution')) {
if ($this->get('institution') == 'mahara') {
// Site owned collection
$redirecturl = '/admin/site/views.php';
}
else {
// Institution owned collection
$redirecturl = '/view/institutionviews.php';
}
}
else {
// User owned collection
$redirecturl = '/view/index.php';
}
}
if ($urlparams) {
$redirecturl .= '?' . http_build_query($urlparams);
......
......@@ -4954,5 +4954,10 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2017031600) {
log_debug('Clear menu cache for new menu items');
clear_menu_cache();
}
return $status;
}
......@@ -1908,15 +1908,9 @@ function group_get_menu_tabs() {
$menu['views'] = array(
'path' => 'groups/views',
'url' => 'view/groupviews.php?group='.$group->id,
'title' => get_string('Views', 'group'),
'title' => get_string('Viewscollections', 'group'),
'weight' => 50,
);
$menu['collections'] = array(
'path' => 'groups/collections',
'url' => 'collection/index.php?group='.$group->id,
'title' => get_string('Collections', 'group'),
'weight' => 60,
);
if (group_role_can_edit_views($group, $role)) {
$menu['share'] = array(
'path' => 'groups/share',
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2017030200;
$config->version = 2017031600;
$config->series = '17.04';
$config->release = '17.04dev';
$config->minupgradefrom = 2012080604;
......
......@@ -2322,15 +2322,9 @@ function admin_nav() {
'configsite/siteviews' => array(
'path' => 'configsite/siteviews',
'url' => 'admin/site/views.php',
'title' => get_string('Views', 'view'),
'title' => get_string('Viewscollections', 'view'),
'weight' => 50,
),
'configsite/collections' => array(
'path' => 'configsite/collections',
'url' => 'collection/index.php?institution=mahara',
'title' => get_string('Collections', 'collection'),
'weight' => 60,
),
'configsite/share' => array(
'path' => 'configsite/share',
'url' => 'admin/site/shareviews.php',
......@@ -2488,15 +2482,9 @@ function admin_nav() {
'manageinstitutions/institutionviews' => array(
'path' => 'manageinstitutions/institutionviews',
'url' => 'view/institutionviews.php',
'title' => get_string('Views', 'view'),
'title' => get_string('Viewscollections', 'view'),
'weight' => 60,
),
'manageinstitutions/institutioncollections' => array(
'path' => 'manageinstitutions/institutioncollections',
'url' => 'collection/index.php?institution=1',
'title' => get_string('Collections', 'collection'),
'weight' => 70,
),
'manageinstitutions/share' => array(
'path' => 'manageinstitutions/share',
'url' => 'view/institutionshare.php',
......@@ -2706,15 +2694,9 @@ function institutional_admin_nav() {
'manageinstitutions/institutionviews' => array(
'path' => 'manageinstitutions/institutionviews',
'url' => 'view/institutionviews.php',
'title' => get_string('Views', 'view'),
'title' => get_string('Viewscollections', 'view'),
'weight' => 60,
),
'manageinstitutions/institutioncollections' => array(
'path' => 'manageinstitutions/institutioncollections',
'url' => 'collection/index.php?institution=1',
'title' => get_string('Collections', 'collection'),
'weight' => 70,
),
'manageinstitutions/share' => array(
'path' => 'manageinstitutions/share',
'url' => 'view/institutionshare.php',
......@@ -2884,7 +2866,7 @@ function mahara_standard_nav() {
'myportfolio/views' => array(
'path' => 'myportfolio/views',
'url' => 'view/index.php',
'title' => get_string('Views', 'view'),
'title' => get_string('Viewscollections', 'view'),
'weight' => 10,
),
'myportfolio/share' => array(
......@@ -2912,12 +2894,6 @@ function mahara_standard_nav() {
'title' => get_string('Import', 'import'),
'weight' => 80,
),
'myportfolio/collection' => array(
'path' => 'myportfolio/collection',
'url' => 'collection/index.php',
'title' => get_string('Collections', 'collection'),
'weight' => 20,
),
'groups' => array(
'path' => 'groups',
'url' => 'group/mygroups.php',
......
......@@ -56,6 +56,17 @@
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $institution}
{if $institution == 'mahara'}
<a class="btn btn-default" href="{$WWWROOT}admin/site/views.php">
{str tag=returntositepages section=view}
{else}
<a class="btn btn-default" href="{$WWWROOT}view/institutionviews.php?institution={$institution}">
{str tag=returntoinstitutionpages section=view}
{/if}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
</div>
{elseif $block}
......
......@@ -48,12 +48,17 @@ if ($collection) {
}
}
else {
$goto = 'collection/index.php';
$goto = 'view/index.php';
if ($groupid) {
$goto .= '?group=' . $groupid;
$goto = 'view/groupviews.php?group=' . $groupid;
}
else if ($institution) {
$goto .= '?institution=' . $institution;
if ($institution == 'mahara') {
$goto = 'admin/site/views.php';
}
else {
$goto .= 'view/institutionviews.php?institution=' . $institution;
}
}
}
}
......@@ -61,7 +66,12 @@ else if ($groupid) {
$goto = 'view/groupviews.php?group=' . $groupid;
}
else if ($institution) {
$goto = 'view/institutionviews.php?institution=' . $institution;
if ($institution == 'mahara') {
$goto = 'admin/site/views.php';
}
else {
$goto = 'view/institutionviews.php?institution=' . $institution;
}
}
else {
$query = get_querystring();
......
......@@ -24,7 +24,7 @@ require_once(get_config('libroot') . 'group.php');
$offset = param_integer('offset', 0);
define('GROUP', param_integer('group'));
define('SUBSECTIONHEADING', get_string('Views', 'view'));
define('SUBSECTIONHEADING', get_string('Viewscollections', 'view'));
$group = group_current_group();
if (!is_logged_in() && !$group->public) {
throw new AccessDeniedException();
......
......@@ -18,7 +18,7 @@ define('SECTION_PAGE', 'index');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('libroot') . 'view.php');
define('TITLE', get_string('Views', 'view'));
define('TITLE', get_string('Viewscollections', 'view'));
$offset = param_integer('offset', 0);
......
......@@ -32,7 +32,7 @@ $s = institution_selector_for_page($institution,
$institution = $s['institution'];
define('TITLE', get_string('institutionviews', 'view'));
define('TITLE', get_string('institutionviewscollections', 'view'));
if ($institution === false) {
$smarty = smarty();
......
......@@ -19,7 +19,7 @@ Scenario: Enable/disable external resources in mahara pages
# Upload an image
And I choose "Files" in "Content"
And I attach the file "Image2.png" to "files_filebrowser_userfile"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Page 1"
And I follow "Edit this page"
......@@ -56,7 +56,7 @@ Scenario: Enable/disable external resources in mahara pages
And I press "Update site options"
And I log out
And I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Page 1"
Then I should see images in the block "Text block with an internal image"
And I should not see images in the block "Text block with an external image"
\ No newline at end of file
......@@ -34,7 +34,7 @@ Scenario: Clicking randomly around Mahara (Bug: 1426983)
# Checking Notes submenu
And I choose "Notes" in "Content"
# Checking Portfolio Menu and submenu
And I choose "Collections" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I choose "Shared by me" in "Portfolio"
And I choose "Shared with me" in "Portfolio"
And I choose "Export" in "Portfolio"
......@@ -65,8 +65,7 @@ Scenario: Clicking randomly around Mahara (Bug: 1426983)
And I choose "Menus" in "Configure site"
And I choose "Networking" in "Configure site"
And I choose "Licenses" in "Configure site"
And I choose "Pages" in "Configure site"
And I choose "Collections" in "Configure site"
And I choose "Pages and collections" in "Configure site"
And I choose "Share" in "Configure site"
And I choose "Files" in "Configure site"
And I choose "Cookie Consent" in "Configure site"
......@@ -91,8 +90,7 @@ Scenario: Clicking randomly around Mahara (Bug: 1426983)
And I choose "Administrators" in "Institutions"
And I choose "Admin notifications" in "Institutions"
And I choose "Profile completion" in "Institutions"
And I choose "Pages" in "Institutions"
And I choose "Collections" in "Institutions"
And I choose "Pages and collections" in "Institutions"
And I choose "Share" in "Institutions"
And I choose "Files" in "Institutions"
And I choose "Statistics" in "Institutions"
......
......@@ -12,7 +12,7 @@ Scenario: Making adjustments to the mathslate plugin for mahara (Bug 1472446)
And I enable the switch "Enable MathJax"
And I press "Update site options"
And I should see "Site options have been updated."
And I choose "Pages" in "Configure site"
And I choose "Pages and collections" in "Configure site"
And I press "Create page"
And I set the following fields to these values:
| Page title | test |
......@@ -20,7 +20,7 @@ Scenario: Making adjustments to the mathslate plugin for mahara (Bug 1472446)
And I press "Save"
And I should see "Page saved successfully"
And I wait "1" seconds
And I choose "Pages" in "Configure site"
And I choose "Pages and collections" in "Configure site"
And I follow "test"
# Tinymce field adding a math equation
And I fill in "\\[\\alpha A\\beta B\\]" in editor "Message"
......
......@@ -33,7 +33,7 @@ Feature: Mahara users can create their blogs
And I scroll to the base of id "editpost_tags_container"
And I fill in select2 input "editpost_tags" with "blogentry" and select "blogentry"
And I press "Save entry"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I press "Create page"
And I press "Save"
And I expand "Journals" node in the "div#content-editor-foldable" "css_element"
......
......@@ -100,7 +100,7 @@ Scenario: Newly created user can get a copy of the journal (Bug 1472467)
And I should see "Journal entry saved"
And I should see "Spongebob"
# Creating a site page
And I choose "Pages" in "Configure site"
And I choose "Pages and collections" in "Configure site"
And I press "Create"
And I set the following fields to these values:
| Page title | Square pants |
......
......@@ -37,7 +37,7 @@ Feature: Mahara users can allow their tagged blogs tags to be copied
And I press "Save entry"
# Add a taggedblogs block to a page
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 01\""
And I expand "Journals" node in the "div#content-editor-foldable" "css_element"
And I wait "1" seconds
......
......@@ -75,7 +75,7 @@ Scenario: Creating a Journal entry
And I press "Save entry"
# Adding journal blocks to a page
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Page 01"
And I follow "Edit this page"
And I expand "Journals" node in the "div#content-editor-foldable" "css_element"
......
......@@ -88,7 +88,7 @@ Scenario: Creating a plan with 11 tasks (Bug #1503036)
And I follow "Next page"
Then I should see "Alien invasion"
# Add the plan to a page
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I press "Create page"
And I press "Save"
And I wait "5" seconds
......
......@@ -15,7 +15,7 @@ Given the following "users" exist:
# Logging in as a user
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 1\""
# Configuring the block
And I expand "General" node
......
......@@ -15,7 +15,7 @@ Background:
Scenario: Create Image block
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 1\""
And I follow "Image"
And I wait "1" seconds
......
......@@ -16,7 +16,7 @@ Scenario: Add some externalfeed blocks
# Externalfeed block should be added in a page from several feed sources in
# RSS or Atom format
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 1\""
And I expand "External" node
And I wait "1" seconds
......
......@@ -15,7 +15,7 @@ Background:
Scenario: Create Text block
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 1\""
And I follow "Text"
And I wait "1" seconds
......
......@@ -17,7 +17,7 @@ Scenario: Open badges block
# party site we can't currently test that part and ship the details in this test
# So all we can do is check that the block exists and saves to a page
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I follow "Edit \"Page 1\""
And I expand "External" node
And I wait "1" seconds
......
......@@ -17,7 +17,8 @@ Scenario: Creating a collection AND adding pages
# Verifying log in was successful
And I should see "Admin User"
# Create Test collection
And I choose "Collections" in "Portfolio"
# And I choose "Pages and collections" in "Portfolio"
And I go to "collection/index.php"
And I follow "New collection"
And I fill in the following:
| Collection name | Test Collection |
......@@ -45,13 +46,14 @@ Scenario: Creating a collection AND adding pages
And I follow "Edit access"
And I select "Registered users" from "accesslist[0][searchtype]"
And I press "Save"
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I press "Create page"
And I set the following fields to these values:
| Page title | New page |
| Page description | testing |
And I press "Save"
And I choose "Collections" in "Portfolio"
# And I choose "Pages and collections" in "Portfolio"
And I go to "collection/index.php"
And I follow "Manage pages"
And I follow "All"
And I wait "1" seconds
......
......@@ -7,7 +7,7 @@ Feature: Annotation block is off by default
Scenario: Accessing annotation block (Bug 1443730)
Given I log in as "admin" with password "Kupuhipa1"
# Creating a page
And I choose "Pages" in "Portfolio"
And I choose "Pages and collections" in "Portfolio"
And I press "Create page"
And I fill in "My page is amazing" for "Page title *"
And I press "Save"
......
......@@ -16,7 +16,8 @@ Scenario: Adding collection to group (Bug 1448807)
| title | description| ownertype | ownername |
| Site Page 01 | This is the page 01 of the site | group 01 | userA |
When I log in as "userA" with password "Kupuhipa1"
And I choose "Collections" in "Portfolio"
# And I choose "Pages and collections" in "Portfolio"
And I go to "collection/index.php"
And I follow "New collection"
And I set the following fields to these values:
| Collection name * | The A team |
......
......@@ -181,7 +181,7 @@ These list must take into account the sort option choosen in the block config (B
And I should see "Group Z"
And I follow "Group Z (Administrator)"
And I should see "Page userB_01"
And I follow "Pages" in the "ul.nav-inpage" "css_element"
And I follow "Pages and collections (tab)"
And I click on "Edit \"Group homepage\""
And I scroll to the id "column-container"
And I configure the block "Group pages"
......@@ -192,7 +192,7 @@ These list must take into account the sort option choosen in the block config (B
And I press "Save"
And I display the page
# Update the group page "Page Group Z_06"
And I follow "Pages" in the "ul.nav-inpage" "css_element"
And I follow "Pages and collections (tab)"
And I click on "Edit \"Page Group Z_06\""
And I follow "Edit title and description"