Commit 83c0b4c7 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Show artefacts in group shared views; change display of shared/owned view options

parent 96adee18
......@@ -1505,10 +1505,10 @@ class View {
$ph, $offset, $limit
);
View::get_view_owner_info($viewdata);
View::get_extra_view_info($viewdata);
return (object) array(
'data' => $viewdata,
'data' => array_values($viewdata),
'count' => $count,
);
......@@ -1534,22 +1534,22 @@ class View {
$ph = array($groupid, $userid, $groupid);
$count = count_records_sql('SELECT COUNT(*) ' . $from, $ph);
$viewdata = get_records_sql_array('
$viewdata = get_records_sql_assoc('
SELECT v.id,v.title,v.startdate,v.stopdate,v.description,v.group,v.owner,v.ownerformat ' . $from . '
ORDER BY v.title, v.id',
$ph, $offset, $limit
);
View::get_view_owner_info($viewdata);
View::get_extra_view_info($viewdata);
return (object) array(
'data' => $viewdata,
'data' => array_values($viewdata),
'count' => $count,
);
}
public static function get_view_owner_info(&$viewdata) {
public static function get_extra_view_info(&$viewdata) {
if ($viewdata) {
// Get view owner details for display
$owners = array();
......@@ -1561,6 +1561,27 @@ class View {
$groups[$v->group] = $v->group;
}
}
$artefacts = get_records_sql_array('SELECT va.view, va.artefact, a.title, a.artefacttype, t.plugin
FROM {view_artefact} va
INNER JOIN {artefact} a ON va.artefact = a.id
INNER JOIN {artefact_installed_type} t ON a.artefacttype = t.name
WHERE va.view IN (' . join(',', array_keys($viewdata)) . ')
GROUP BY va.view, va.artefact, a.title, a.artefacttype, t.plugin
ORDER BY a.title, va.artefact', '');
foreach ($artefacts as $artefactrec) {
safe_require('artefact', $artefactrec->plugin);
$classname = generate_artefact_class_name($artefactrec->artefacttype);
$artefactobj = new $classname(0, array('title' => $artefactrec->title));
$artefactobj->set('dirty', false);
if (!$artefactobj->in_view_list()) {
continue;
}
$artname = $artefactobj->display_title(30);
if (strlen($artname)) {
$viewdata[$artefactrec->view]->artefacts[] = array('id' => $artefactrec->artefact,
'title' => $artname);
}
}
if (!empty($owners)) {
$owners = get_records_select_assoc('usr', 'id IN (' . join(',', $owners) . ')', null, '',
'id,username,firstname,lastname,preferredname,admin,staff,studentid');
......
......@@ -1902,6 +1902,27 @@ span.viewicon {
margin: .25em 0 0 65px;
}
/* GROUPS > GROUP VIEWS */
ul#groupviewoptions {
list-style-type: none;
margin: 8px 0 0 10px;
}
#groupviewoptions li {
display: inline;
border: 1px solid #bbb;
margin: 0 0 0 5px;
padding: 2px 5px 2px 5px;
background-color: #ccc;
}
#groupviewoptions li.current {
background-color: #fff;
}
table#myviewstable.groupviews{
margin-top: 1px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
/* GROUPS > MY GROUPS */
#mygroupstable {
border-top: 1px solid #95a8b7;
......
......@@ -9,21 +9,17 @@
{if $groupid}
{include file="group/tabstart.tpl" current="views"}
<ul>
<li>
{if $shared}<a href="groupviews.php?group={$groupid}">{str tag="viewsownedbygroup" section="view"}</a>
{else}{str tag="viewsownedbygroup" section="view"}
{/if}
<ul id="groupviewoptions">
<li{if !$shared} class="current"{/if}>
<a href="groupviews.php?group={$groupid}">{str tag="viewsownedbygroup" section="view"}</a>
</li>
<li>
{if $shared}{str tag="viewssharedtogroup" section="view"}
{else}<a href="groupviews.php?group={$groupid}&shared=1">{str tag="viewssharedtogroup" section="view"}</a>
{/if}
<li{if $shared} class="current"{/if}>
<a href="groupviews.php?group={$groupid}&shared=1">{str tag="viewssharedtogroup" section="view"}</a>
</li>
</ul>
{/if}
{if $views}
<table id="myviewstable">
<table id="myviewstable" class="groupviews">
{foreach from=$views item=view}
<tr class="{cycle values=r0,r1}">
......@@ -91,7 +87,11 @@
<div class="center">{$pagination}</div>
{else}
<div class="message">{str tag="noviews" section="view"}</div>
<table id="myviewstable" class="noviews">
<tr>
<td>{str tag="noviewstosee" section="group"}</td>
</tr>
</table>
{/if}
{if $groupid}{include file="group/tabend.tpl"}{/if}
......
......@@ -11,39 +11,47 @@
{include file="group/tabstart.tpl" current="views"}
{if $member}
<ul>
<li>
{if $shared}<a href="groupviews.php?group={$groupid}">{str tag="viewsownedbygroup" section="view"}</a>
{else}{str tag="viewsownedbygroup" section="view"}
{/if}
<ul id="groupviewoptions">
<li{if !$shared} class="current"{/if}>
<a href="groupviews.php?group={$groupid}">{str tag="viewsownedbygroup" section="view"}</a>
</li>
<li>
{if $shared}{str tag="viewssharedtogroup" section="view"}
{else}<a href="groupviews.php?group={$groupid}&shared=1">{str tag="viewssharedtogroup" section="view"}</a>
{/if}
<li{if $shared} class="current"{/if}>
<a href="groupviews.php?group={$groupid}&shared=1">{str tag="viewssharedtogroup" section="view"}</a>
</li>
</ul>
{/if}
{if $views}
<table id="myviewstable">
{foreach from=$views item=view}
<tr class="{cycle values=r0,r1}">
<td><h3><a href="{$WWWROOT}view/view.php?id={$view.id}">{$view.title|escape}</a></h3></td>
<td>
by <a href="{$WWWROOT}{if $view.group}group{else}user{/if}/view.php?id={if $view.group}{$view.group}{else}{$view.owner}{/if}">{if $view.sharedby}{$view.sharedby}{else}{$groupname}{/if}</a>
</td>
<td>{$view.description}</td>
</tr>
{/foreach}
<table id="myviewstable" class="groupviews">
{foreach from=$views item=view}
<tr>
<td class="r{cycle values=0,1}">
<h5><a href="{$WWWROOT}view/view.php?id={$view.id}">{$view.title|escape}</a> {str tag=by section=view}
<a href="{$WWWROOT}{if $view.group}group{else}user{/if}/view.php?id={if $view.group}{$view.group}{else}{$view.owner}{/if}">{if $view.sharedby}{$view.sharedby}{else}{$groupname}{/if}</a>
</h5>
<span>
{if $view.description}
{$view.description}
{/if}
{if $view.description && $view.artefacts}<br>{/if}
{if $view.artefacts}
<strong>{str tag="artefacts" section="view"}:</strong>
{foreach from=$view.artefacts item=artefact name=artefacts}<a href="{$WWWROOT}view/artefact.php?artefact={$artefact.id}&amp;view={$view.id}" class="link-artefacts">{$artefact.title|escape}</a>{if !$smarty.foreach.artefacts.last}, {/if}{/foreach}
{/if}
</span>
</td>
</tr>
{/foreach}
</table>
<div class="center">{$pagination}</div>
{else}
<table id="myviewstable" class="{if $member}groupviews{else}noviews{/if}">
<tr>
<td>{str tag="noviewstosee" section="group"}</td>
</tr>
</table>
{/if}
<div class="center">{$pagination}</div>
{else}
<div class="message">{str tag="noviews" section="view"}</div>
{/if}
{include file="group/tabend.tpl"}
{include file="columnleftend.tpl"}
......
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