Commit 5ec2df50 authored by Hugh Davenport's avatar Hugh Davenport
Browse files

Fix copy collections to not show on group/institution pages



This fixes the strings and links on group and institution
pages to not show the copy collections, as collections do
not exist in groups/institutions.

Change-Id: I1aee3c64a09bddcea892a6eefd19e0eca2ba11d8
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent c73b9ee8
......@@ -57,6 +57,7 @@ $string['collectiondescription'] = 'A Collection is a set of pages that are link
$string['collectiontitle'] = 'Collection Title';
$string['confirmcancelcreatingcollection'] = 'This Collection has not been completed. Do you really want to cancel?';
$string['collectionsaved'] = 'Collection saved successfully.';
$string['copyacollection'] = 'Copy a collection';
$string['created'] = 'Created';
$string['deletecollection'] = 'Delete collection';
$string['deletespecifiedcollection'] = 'Delete collection \'%s\'';
......
......@@ -280,7 +280,8 @@ $string['templatedescription'] = 'Check this box if you would like the people wh
$string['templatedescriptionplural'] = 'Check this box if you would like the people who can see your pages to be able to make their own copies of them, along with any files and folders they contain.';
$string['retainviewrightsdescription'] = 'Check this box if you would like to add access for you to view copies of this page or collection that are copied by other users. Those users can revoke this access after they copy it if they wish. Pages that are copied from a copy of this page or collection will not have this same access.';
$string['retainviewrightsgroupdescription'] = 'Check this box if you would like to add access for members of this group to view copies of this page that are copied by other users. Those users can revoke this access after they copy it if they wish. Pages that are copied from a copy of this page will not have this same access.';
$string['choosetemplatepagedescription'] = '<p>Here you can search through the pages that you are allowed to copy as a starting point for making a new page. You can see a preview of each page by clicking on its name. Once you have found the page you wish to copy, click the corresponding "Copy Page" button to make a copy and begin customising it. You may also choose to copy the entire collection that the page belongs to by clicking the corresponding "Copy Collection" button.</p>';
$string['choosetemplatepagedescription'] = '<p>Here you can search through the pages that you are allowed to copy as a starting point for making a new page. You can see a preview of each page by clicking on its name. Once you have found the page you wish to copy, click the corresponding "Copy Page" button to make a copy and begin customising it.</p>';
$string['choosetemplatepageandcollectiondescription'] = '<p>Here you can search through the pages that you are allowed to copy as a starting point for making a new page. You can see a preview of each page by clicking on its name. Once you have found the page you wish to copy, click the corresponding "Copy Page" button to make a copy and begin customising it. You may also choose to copy the entire collection that the page belongs to by clicking the corresponding "Copy Collection" button.</p>';
$string['choosetemplategrouppagedescription'] = '<p>Here you can search through the pages that this group is allowed to copy as a starting point for making a new page. You can see a preview of each page by clicking on its name. Once you have found the page you wish to copy, click the corresponding "Copy Page" button to make a copy and begin customising it.</p><p><strong>Note:</strong> Groups cannot currently make copies of Journals or Journal Entriess.</p>';
$string['choosetemplateinstitutionpagedescription'] = '<p>Here you can search through the pages that this institution is allowed to copy as a starting point for making a new page. You can see a preview of each page by clicking on its name. Once you have found the page you wish to copy, click the corresponding "Copy Page" button to make a copy and begin customising it.</p><p><strong>Note:</strong> Institutions cannot currently make copies of Journals or Journal Entries.</p>';
$string['copiedblocksandartefactsfromtemplate'] = 'Copied %d blocks and %d artefacts from %s';
......@@ -291,7 +292,7 @@ $string['thisviewmaybecopied'] = 'Copying is allowed';
$string['copythisview'] = 'Copy this page';
$string['copyview'] = 'Copy page';
$string['createemptyview'] = 'Create empty page';
$string['copyaview'] = 'Copy a page or collection';
$string['copyaview'] = 'Copy a page';
$string['Untitled'] = 'Untitled';
$string['copyfornewusers'] = 'Copy for new users';
$string['copyfornewusersdescription'] = 'Whenever a new user is created, automatically make a personal copy of this page in the user\'s portfolio.';
......
......@@ -3247,9 +3247,13 @@ class View {
public static function get_templatesearch_data(&$search) {
require_once(get_config('libroot') . 'pieforms/pieform.php');
$results = self::view_search($search->query, $search->ownerquery, null, $search->copyableby, $search->limit, $search->offset, true, null, null, true);
$isstandalone = isset($search->copyableby->owner) && $search->copyableby->owner;
$results = self::view_search($search->query, $search->ownerquery, null, $search->copyableby, $search->limit, $search->offset, true, null, null, $isstandalone);
foreach ($results->data as &$r) {
if (!$isstandalone) {
$r['collid'] = null;
}
$r['form'] = pieform(create_view_form($search->copyableby->group, $search->copyableby->institution, $r['id'], $r['collid']));
}
......@@ -3270,6 +3274,7 @@ class View {
$smarty = smarty_core();
$smarty->assign_by_ref('results', $results->data);
$smarty->assign('showcollection', $isstandalone ? 1 : 0);
$search->html = $smarty->fetch('view/templatesearchresults.tpl');
$search->count = $results->count;
......
{include file="header.tpl"}
<div class="rbuttons">
<a class="btn" href="{$WWWROOT}collection/edit.php?new=1">{str section=collection tag=newcollection}</a>
<a class="btn" href="{$WWWROOT}view/choosetemplate.php">{str section=view tag=copyaview}</a>
<a class="btn" href="{$WWWROOT}view/choosetemplate.php">{str section=collection tag=copyacollection}</a>
</div>
<p class="intro">{str tag=collectiondescription section=collection}</p>
{if $collections}
......
......@@ -2,7 +2,9 @@
<thead>
<tr>
<th>{str tag=viewname section=view}</th>
{if $showcollection}
<th>{str tag=collectiontitle section=collection}</th>
{/if}
<th>{str tag=Owner section=view}</th>
<th></th>
</tr>
......@@ -14,11 +16,13 @@
<td>
<strong><a class="viewlink" href="{$WWWROOT}view/view.php?id={$row.id}" target="_blank">{$row.title}</a></strong>
</td>
{if $showcollection}
<td>
{if $row.collid}
<strong><a class="collectionlink" href="{$WWWROOT}view/view.php?id={$row.id}" target="_blank">{$row.name}</a></strong>
{/if}
</td>
{/if}
{if $row.institution}
<td class="owner s">{$row.sharedby}</td>
{elseif $row.group}
......
......@@ -63,7 +63,7 @@ else if ($institution) {
}
else {
$views->copyableby->owner = $USER->get('id');
$helptext = get_string('choosetemplatepagedescription', 'view');
$helptext = get_string('choosetemplatepageandcollectiondescription', 'view');
}
View::get_templatesearch_data($views);
......
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