Commit d9cfcea7 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Replace edit view access link on my views with collection link for views in a collection


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 0ea84b0a
......@@ -41,7 +41,8 @@ $string['add'] = 'Add';
$string['addview'] = 'Add view';
$string['addviews'] = 'Add views to collection';
$string['back'] = 'Back';
$string['collection'] = 'Collection';
$string['collection'] = 'collection';
$string['Collection'] = 'Collection';
$string['collectionaccess'] = 'Collection access';
$string['collectioneditaccess'] = 'You are editing access for %d Views in this Collection';
$string['collectionconfirmdelete'] = 'Are you sure you wish to delete this collection?';
......
......@@ -2160,6 +2160,12 @@ class View {
array()
);
$tags = get_records_select_array('view_tag', '"view" IN (' . $viewidlist . ')');
$collections = get_records_sql_array('
SELECT c.name, c.id, cv.view
FROM {collection} c JOIN {collection_view} cv ON c.id = cv.collection
WHERE cv.view IN (' . $viewidlist . ')',
array()
);
}
$data = array();
......@@ -2261,6 +2267,11 @@ class View {
$data[$index[$tag->view]]['tags'][] = $tag->tag;
}
}
if ($collections) {
foreach ($collections as $c) {
$data[$index[$c->view]]['collection'] = $c;
}
}
}
return (object) array(
......
......@@ -62,33 +62,37 @@
<div class="vi">
{if $view.togglepublic}
{$view.togglepublic|safe}
{elseif $view.collection}
<strong>{str tag=Collection section=collection}:</strong> <a href="{$WWWROOT}collection/views.php?id={$view.collection->id}">{$view.collection->name}</a>
{elseif $view.type != 'profile' && $view.type != 'dashboard' && $view.type != 'grouphomepage'}
<h4><a href="{$WWWROOT}view/access.php?id={$view.id}" id="editviewaccess">{str tag="editaccess" section="view"}</a></h4>
{/if}
{if $view.access}
<div class="videsc">{$view.access}</div>
{/if}
{if $view.accessgroups}
<div class="videsc">{str tag="whocanseethisview" section="view"}:
{foreach from=$view.accessgroups item=accessgroup name=artefacts}{strip}
{if $accessgroup.accesstype == 'loggedin'}
{str tag="loggedinlower" section="view"}
{elseif $accessgroup.accesstype == 'public'}
{str tag="publiclower" section="view"}
{elseif $accessgroup.accesstype == 'friends'}
<a href="{$WWWROOT}user/myfriends.php" id="link-myfriends">{str tag="friendslower" section="view"}</a>
{elseif $accessgroup.accesstype == 'group'}
<a href="{$WWWROOT}group/view.php?id={$accessgroup.id}">{$accessgroup.name}</a>{if $accessgroup.role} ({$accessgroup.roledisplay}){/if}
{elseif $accessgroup.accesstype == 'user'}
<a href="{$WWWROOT}user/view.php?id={$accessgroup.id}">{$accessgroup.id|display_name|escape}</a>
{elseif $accessgroup.accesstype == 'secreturl'}
{str tag="peoplewiththesecreturl" section="view"}
{/if}{/strip}{if !$.foreach.artefacts.last}, {/if}
{/foreach}
{if $view.template}<br>{str tag=thisviewmaybecopied section=view}{/if}
</div>
{else}
<div class="videsc">{str tag="nobodycanseethisview2" section="view"}</div>
{if !$view.collection}
{if $view.accessgroups}
<div class="videsc">{str tag="whocanseethisview" section="view"}:
{foreach from=$view.accessgroups item=accessgroup name=artefacts}{strip}
{if $accessgroup.accesstype == 'loggedin'}
{str tag="loggedinlower" section="view"}
{elseif $accessgroup.accesstype == 'public'}
{str tag="publiclower" section="view"}
{elseif $accessgroup.accesstype == 'friends'}
<a href="{$WWWROOT}user/myfriends.php" id="link-myfriends">{str tag="friendslower" section="view"}</a>
{elseif $accessgroup.accesstype == 'group'}
<a href="{$WWWROOT}group/view.php?id={$accessgroup.id}">{$accessgroup.name}</a>{if $accessgroup.role} ({$accessgroup.roledisplay}){/if}
{elseif $accessgroup.accesstype == 'user'}
<a href="{$WWWROOT}user/view.php?id={$accessgroup.id}">{$accessgroup.id|display_name|escape}</a>
{elseif $accessgroup.accesstype == 'secreturl'}
{str tag="peoplewiththesecreturl" section="view"}
{/if}{/strip}{if !$.foreach.artefacts.last}, {/if}
{/foreach}
{if $view.template}<br>{str tag=thisviewmaybecopied section=view}{/if}
</div>
{else}
<div class="videsc">{str tag="nobodycanseethisview2" section="view"}</div>
{/if}
{/if}
</div>
{if $view.submitto && $view.type != 'profile' && $view.type != 'dashboard'}
......
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