Commit 0779f98a authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1667181: Alter the search box options

Add in the new search by and order options

Change-Id: If0ab8397793a3aad3df4d7fa4e4a69ccd4b908b9
parent 8ddfdb51
......@@ -89,12 +89,12 @@ $string['collectionsubmittedtogroup'] = 'This collection has been submitted to <
$string['collectionsubmittedtogroupon'] = 'This collection was submitted to <a href="%s">%s</a> on %s.';
$string['submittedpendingrelease'] = 'Pending release after archiving.';
$string['nobodycanseethisview2'] = 'Only you can see this page.';
$string['noviews'] = 'No pages.';
$string['noviews1'] = 'No pages or collections.';
$string['nviews'] = array(
'1 page',
'%s pages',
);
$string['youhavenoviews'] = 'You have no pages.';
$string['youhavenoviews1'] = 'You don\'t have any pages or collections.';
$string['youhaventcreatedanyviewsyet'] = "You have not created any pages yet.";
$string['youhaveoneview'] = 'You have 1 page.';
$string['youhaveviews'] = 'You have %s pages.';
......@@ -433,7 +433,7 @@ $string['blockcopypermission'] = 'Block copy permission';
$string['blockcopypermissiondesc'] = 'If you allow other users to copy this page, you may choose how this block will be copied';
// Sort by
$string['defaultsort'] = '';
$string['defaultsort'] = 'Alphabetical';
$string['latestcreated'] = 'Date created';
$string['latestmodified'] = 'Last modified';
$string['latestviewed'] = 'Last viewed';
......@@ -451,8 +451,9 @@ $string['grouphomepagedescription'] = 'The group homepage contains the content t
// Shared views
$string['sharedwithme'] = 'Shared with me';
$string['titleanddescription'] = 'Title, description, tags';
$string['titleanddescriptionnotags'] = 'Title, description';
$string['titleanddescriptionandtagsandowner'] = 'Title, description, tags, owner';
$string['tagsonly'] = 'Tags only';
$string['tagsonly1'] = 'Tags';
$string['sharedviewsdescription'] = 'This page lists the most recently modified or commented on pages that have been shared with you. They may have been shared with you directly, shared with friends of the owner, or shared with one of your groups.';
$string['sharedwith'] = 'Shared with';
$string['sharewith'] = 'Share with';
......
......@@ -243,7 +243,7 @@ function expected_account_preferences() {
'licensedefault' => '',
'viewsperpage' => 20,
'itemsperpage' => 10,
'orderpagesby' => 'atoz',
'orderpagesby' => 'latestmodified',
);
}
......
......@@ -3615,7 +3615,7 @@ class View {
$collwhere .= ' AND v.template != ' . self::SITE_TEMPLATE;
}
$order = $groupby = $emptycollgroupby = '';
$order = $groupby = $collgroupby = $emptycollgroupby = '';
if (!empty($orderby)) {
switch($orderby) {
case 'latestcreated':
......@@ -3640,6 +3640,7 @@ class View {
$from .= $mcfromstr;
$collfrom .= $mcfromstr;
$groupby = ' GROUP BY v.id';
$collgroupby = ' GROUP BY v.id, c.id';
$emptycollgroupby = ' GROUP BY c.id';
$order = 'commentcount DESC,';
break;
......@@ -3708,6 +3709,7 @@ class View {
if (!empty($groupby)) {
$groupby .= ', g.id, h.wwwroot';
$collgroupby .= ', g.id, h.wwwroot';
}
$sort = '
ORDER BY ' . $order . ' vtitle, vid';
......@@ -3723,13 +3725,13 @@ class View {
SELECT COUNT(v.id) ' . $from . $where . $groupby . ') t1
UNION
SELECT COUNT(*) AS count FROM (
SELECT COUNT(v.id) ' . $collfrom . $collwhere . $groupby . ') t2
SELECT COUNT(v.id) ' . $collfrom . $collwhere . $collgroupby . ') t2
UNION
SELECT COUNT(*) AS count FROM (
SELECT COUNT(c.id) ' . $emptycollfrom . $emptycollwhere . $emptycollgroupby . ') t3
) t4', $values);
$viewdata = get_records_sql_array($select . $from . $where . $groupby .
$collselect . $collfrom . $collwhere . $groupby .
$collselect . $collfrom . $collwhere . $collgroupby .
$emptycollselect . $emptycollfrom . $emptycollwhere . $emptycollgroupby .
$sort, $values, $offset, $limit);
}
......@@ -3894,8 +3896,9 @@ class View {
$tag = param_variable('tag', null);
$searchoptions = array(
'titleanddescription' => get_string('titleanddescription', 'view'),
'tagsonly' => get_string('tagsonly', 'view'),
'titleanddescriptionandtags' => get_string('titleanddescription', 'view'),
'titleanddescription' => get_string('titleanddescriptionnotags', 'view'),
'tagsonly' => get_string('tagsonly1', 'view'),
);
if (!empty($tag)) {
......
......@@ -49,6 +49,6 @@
</div>
{else}
<div class="panel-body">
<p class="lead text-small">{str tag=noviews section=view}</p>
<p class="lead text-small">{str tag=noviews1 section=view}</p>
</div>
{/if}
......@@ -12,5 +12,5 @@
{/foreach}
</ul>
{else}
<p>{str tag=youhavenoviews section=view}</p>
<p>{str tag=youhavenoviews1 section=view}</p>
{/if}
{if $viewcount == 0}
<p>{str tag=noviews section=view}</p>
<p>{str tag=noviews1 section=view}</p>
{/if}
{if $blocktypecounts}
<p>{str tag=blockcountsbytype section=admin}:
......
......@@ -12,7 +12,7 @@
{if !$user->views && !$user->collections}
<tr class="{cycle values='r0,r1'}">
<td><a href="{profile_url($user)}">{$user|display_name:null:true:true}</a></td>
<td colspan=3>{str tag=noviews section=view}</td>
<td colspan=3>{str tag=noviews1 section=view}</td>
</tr>
{else}
{foreach from=$user->views item=item}
......
{if $viewcount == 0}
<p class="lead small-text">{str tag=noviews section=view}</p>
<p class="lead small-text">{str tag=noviews1 section=view}</p>
{/if}
{if $blocktypecounts}
<h4>{str tag=blockcountsbytype section=admin}: </h4>
......
......@@ -22,8 +22,11 @@
<div class="no-results">
{if $GROUP}
{str tag="noviewstosee" section="group"}
{elseif $institution}{str tag="noviews" section="view"}
{else}{str tag="youhavenoviews" section="view"}{/if}
{elseif $institution}
{str tag="noviews1" section="view"}
{else}
{str tag="youhavenoviews1" section="view"}
{/if}
</div>
{/if}
......
......@@ -28,7 +28,7 @@ $queryparams = array();
$searchoptions = array(
'titleanddescriptionanduser' => get_string('titleanddescriptionandtagsandowner', 'view'),
'tagsonly' => get_string('tagsonly', 'view'),
'tagsonly' => get_string('tagsonly1', 'view'),
);
if (!empty($tag)) {
$searchtype = 'tagsonly';
......
......@@ -10,6 +10,7 @@ Background:
| Testing page 1 | Admin's page 01 | user | admin |
| Testing page 2 | Admin's page 02 | user | admin |
| Testing page 3 | Admin's page 03 | user | admin |
| A page 4 | Admin's page 04 | user | admin |
Scenario: Creating a collection AND adding pages
# Log in as "Admin" user
......@@ -32,8 +33,12 @@ Scenario: Creating a collection AND adding pages
And I should see "Testing page 1"
And I should see "Testing page 2"
And I should see "Testing page 3"
# Sort pages by Last modified
And I should see "A page 4"
# Sort pages by Last modified
Then I follow "Portfolio"
And I select "Alphabetical" from "Sort by:"
And I press the key "Enter" in the "Search:" field
And "A page 4" "link" should appear before "Testing page 1" "link"
And I select "Last modified" from "Sort by:"
And I press the key "Enter" in the "Search:" field
# Checking they are in the right order
......
@javascript @core @core_view @core_portfolio
Feature: Adjusting the max items limit on the Shared with me page.
Feature: Displaying more pages.
In order to be able to display a set amount of items on the shared with me page
In order to be able to display more pages and collections
As an admin
So I can view only a limited amount of pages at one time.
As a user
So I can view only a limited amount of pages at one time and display
more via the 'Show more' button.
Background:
Scenario: Making sure that the max items per page drop down limits to correct amount of pages (Bug 1409369)
Given the following "users" exist:
| username | password | email | firstname | lastname | institution | authname | role |
| userA | Kupuhipa1 | test01@example.com | Pete | Mc | mahara | internal | member |
| userB | Kupuhipa1 | test02@example.com | Simon | Mc | mahara | internal | member |
And I log in as "userA" with password "Kupuhipa1"
And the following "pages" exist:
| title | description| ownertype | ownername |
| A's Page 01 | UserA's page 01 | user | userA |
| A's Page 02 | UserA's page 02 | user | userA |
| A's Page 03 | UserA's page 03 | user | userA |
| A's Page 04 | UserB's page 04 | user | userA |
| A's Page 05 | UserA's page 05 | user | userA |
| A's Page 06 | UserA's page 06 | user | userA |
| A's Page 07 | UserA's page 07 | user | userA |
| A's Page 08 | UserA's page 08 | user | userA |
| A's Page 09 | UserA's page 01 | user | userA |
| A's Page 10 | UserA's page 02 | user | userA |
| A's Page 11 | UserA's page 01 | user | userA |
| A's Page 12 | UserA's page 02 | user | userA |
| A's Page 13 | UserA's page 03 | user | userA |
| A's Page 14 | UserB's page 04 | user | userA |
| A's Page 15 | UserA's page 05 | user | userA |
| A's Page 16 | UserA's page 06 | user | userA |
| A's Page 17 | UserA's page 07 | user | userA |
| A's Page 18 | UserA's page 08 | user | userA |
| A's Page 19 | UserA's page 01 | user | userA |
| A's Page 20 | UserA's page 02 | user | userA |
| A's Page 21 | UserA's page 01 | user | userA |
| A's Page 22 | UserA's page 02 | user | userA |
| A's Page 23 | UserA's page 03 | user | userA |
| A's Page 24 | UserB's page 04 | user | userA |
| A's Page 25 | UserA's page 05 | user | userA |
| A's Page 26 | UserA's page 06 | user | userA |
| A's Page 27 | UserA's page 07 | user | userA |
| A's Page 28 | UserA's page 08 | user | userA |
| A's Page 29 | UserA's page 01 | user | userA |
| A's Page 30 | UserA's page 02 | user | userA |
| A's Page 31 | UserA's page 01 | user | userA |
| A's Page 32 | UserA's page 02 | user | userA |
| A's Page 33 | UserA's page 03 | user | userA |
| A's Page 34 | UserB's page 04 | user | userA |
| A's Page 35 | UserA's page 05 | user | userA |
| A's Page 36 | UserA's page 06 | user | userA |
| A's Page 37 | UserA's page 07 | user | userA |
| A's Page 38 | UserA's page 08 | user | userA |
| A's Page 39 | UserA's page 01 | user | userA |
| A's Page 40 | UserA's page 02 | user | userA |
| A's Page 41 | UserA's page 01 | user | userA |
| A's Page 42 | UserA's page 02 | user | userA |
| A's Page 43 | UserA's page 03 | user | userA |
| A's Page 44 | UserB's page 04 | user | userA |
| A's Page 45 | UserA's page 05 | user | userA |
| A's Page 46 | UserA's page 06 | user | userA |
| A's Page 47 | UserA's page 07 | user | userA |
| A's Page 48 | UserA's page 08 | user | userA |
| A's Page 49 | UserA's page 01 | user | userA |
| A's Page 50 | UserA's page 02 | user | userA |
| A's Page 51 | UserA's page 01 | user | userA |
When I follow "Portfolio"
And I follow "A's Page 01"
And I follow "Edit this page"
| A's Page 01 | This is my page 01 | user | userA |
| A's Page 02 | This is my page 02 | user | userA |
| A's Page 03 | This is my page 03 | user | userA |
| A's Page 04 | This is my page 04 | user | userA |
| A's Page 05 | This is my page 05 | user | userA |
| A's Page 06 | This is my page 06 | user | userA |
| A's Page 07 | This is my page 07 | user | userA |
| A's Page 08 | This is my page 08 | user | userA |
| A's Page 09 | This is my page 09 | user | userA |
| A's Page 10 | This is my page 10 | user | userA |
| A's Page 11 | This is my page 11 | user | userA |
| A's Page 12 | This is my page 12 | user | userA |
| A's Page 13 | This is my page 13 | user | userA |
| A's Page 14 | This is my page 14 | user | userA |
| A's Page 15 | This is my page 15 | user | userA |
| A's Page 16 | This is my page 16 | user | userA |
| A's Page 17 | This is my page 17 | user | userA |
| A's Page 18 | This is my page 18 | user | userA |
| A's Page 19 | This is my page 19 | user | userA |
| A's Page 20 | This is my page 20 | user | userA |
| A's Page 21 | This is my page 21 | user | userA |
| A's Page 22 | This is my page 22 | user | userA |
| A's Page 23 | This is my page 23 | user | userA |
| A's Page 24 | This is my page 24 | user | userA |
| A's Page 25 | This is my page 25 | user | userA |
| A's Page 26 | This is my page 26 | user | userA |
| A's Page 27 | This is my page 27 | user | userA |
| A's Page 28 | This is my page 28 | user | userA |
| A's Page 29 | This is my page 29 | user | userA |
| A's Page 30 | This is my page 30 | user | userA |
| A's Page 31 | This is my page 31 | user | userA |
| A's Page 32 | This is my page 32 | user | userA |
| A's Page 33 | This is my page 33 | user | userA |
| A's Page 34 | This is my page 34 | user | userA |
| A's Page 35 | This is my page 35 | user | userA |
| A's Page 36 | This is my page 36 | user | userA |
| A's Page 37 | This is my page 37 | user | userA |
| A's Page 38 | This is my page 38 | user | userA |
| A's Page 39 | This is my page 39 | user | userA |
| A's Page 40 | This is my page 40 | user | userA |
| A's Page 41 | This is my page 41 | user | userA |
| A's Page 42 | This is my page 42 | user | userA |
| A's Page 43 | This is my page 43 | user | userA |
| A's Page 44 | This is my page 44 | user | userA |
| A's Page 45 | This is my page 45 | user | userA |
| A's Page 46 | This is my page 46 | user | userA |
| A's Page 47 | This is my page 47 | user | userA |
| A's Page 48 | This is my page 48 | user | userA |
| A's Page 49 | This is my page 49 | user | userA |
| A's Page 50 | This is my page 50 | user | userA |
| A's Page 51 | This is my page 51 | user | userA |
Scenario: Making sure that the max items per page drop down limits to correct amount of pages (Bug 1409369)
Given I log in as "userA" with password "Kupuhipa1"
And I choose "Pages and collections" in "Portfolio"
And I select "atoz" from "orderby"
And I scroll to the base of id "searchviews_submit"
And I press "searchviews_submit"
And I wait "2" seconds
And I click on "A's Page 01" panel menu
And I click on "Edit" in "A's Page 01" panel menu
And I follow "Share page"
And I set the select2 value "A's Page 01, A's Page 02, A's Page 03, A's Page 04, A's Page 05, A's Page 06, A's Page 07, A's Page 08, A's Page 09, A's Page 10, A's Page 11, A's Page 12, A's Page 13, A's Page 14, A's Page 15, A's Page 16, A's Page 17, A's Page 18, A's Page 19, A's Page 20, A's Page 21, A's Page 22, A's Page 23, A's Page 24, A's Page 25, A's Page 26, A's Page 27, A's Page 28, A's Page 29, A's Page 30, A's Page 31, A's Page 32, A's Page 33, A's Page 34, A's Page 35, A's Page 36, A's Page 37, A's Page 38, A's Page 39, A's Page 40, A's Page 41, A's Page 42, A's Page 43, A's Page 44, A's Page 45, A's Page 46, A's Page 47, A's Page 48, A's Page 49, A's Page 50, A's Page 51" for "editaccess_views"
And I select "Public" from "accesslist[0][searchtype]"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment