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

Show unpublishable group files greyed out

parent 7d73982f
......@@ -200,6 +200,7 @@ function pieform_element_filebrowser_build_filelist($form, $element, $folder, $h
$userid = ($group || $institution) ? null : $USER->get('id');
$editable = (int) $element['config']['edit'];
$selectable = (int) $element['config']['select'];
$publishing = (int) $element['config']['publishing'];
$querybase = $element['page'] . (strpos($element['page'], '?') === false ? '?' : '&');
$prefix = $form->get_name() . '_' . $element['name'];
......@@ -210,6 +211,7 @@ function pieform_element_filebrowser_build_filelist($form, $element, $folder, $h
$smarty->assign('highlight', $highlight);
$smarty->assign('editable', $editable);
$smarty->assign('selectable', $selectable);
$smarty->assign('publishing', $publishing);
$smarty->assign('filelist', $filedata);
$smarty->assign('querybase', $querybase);
$smarty->assign('prefix', $prefix);
......
......@@ -90,6 +90,7 @@ $string['movefailednotowner'] = 'You do not have permission to move the file int
$string['movefailed'] = 'Move failed.';
$string['nametoolong'] = 'That name is too long. Please choose a shorter one.';
$string['nofilesfound'] = 'No files found';
$string['notpublishable'] = 'You do not have permission to publish this file';
$string['overwrite'] = 'Overwrite';
$string['Owner'] = 'Owner';
$string['parentfolder'] = 'Parent folder';
......
......@@ -450,10 +450,10 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
else if ($group) {
global $USER;
$select .= ',
r.can_edit, r.can_view';
r.can_edit, r.can_view, r.can_republish';
$from .= '
LEFT OUTER JOIN (
SELECT ar.artefact, ar.can_edit, ar.can_view
SELECT ar.artefact, ar.can_edit, ar.can_view, ar.can_republish
FROM {artefact_access_role} ar
INNER JOIN {group_member} gm ON ar.role = gm.role
WHERE gm.group = ? AND gm.member = ?
......@@ -463,7 +463,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$where .= '
AND a.group = ? AND a.owner IS NULL AND r.can_view = 1';
$phvals[] = $group;
$groupby .= ', r.can_edit, r.can_view';
$groupby .= ', r.can_edit, r.can_view, r.can_republish';
}
else {
$where .= '
......@@ -760,6 +760,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
'edit' => false,
'select' => true,
'alwaysopen' => true,
'publishing' => true,
),
'tabs' => $instance->get_view()->ownership(),
'selectlistcallback' => array(
......
......@@ -14,7 +14,8 @@
</thead>
<tbody>
{foreach from=$filelist item=file}
<tr id="file:{$file->id}" class="r{cycle values=0,1} directory-item{if $file->isparent} parentfolder{/if}{if $file->artefacttype == 'folder'} folder{/if}{if !empty($highlight) && $highlight == $file->id} highlight-file{/if}{if $edit == $file->id} hidden{/if}">
{if !$publishing || !$file->permissions || $file->can_republish}{assign var=publishable value=1}{else}{assign var=publishable value=0}{/if}
<tr id="file:{$file->id}" class="r{cycle values=0,1} directory-item{if $file->isparent} parentfolder{/if}{if $file->artefacttype == 'folder'} folder{/if}{if !empty($highlight) && $highlight == $file->id} highlight-file{/if}{if $edit == $file->id} hidden{/if}{if !$publishable && $file->artefacttype != 'folder'} disabled{/if}" {if !$publishable && $file->artefacttype != 'folder'} title="{str tag=notpublishable section=artefact.file}"{/if}>
<td>
{if $editable}
<div{if !$file->isparent} class="icon-drag" id="drag:{$file->id}"{/if}>
......@@ -28,6 +29,8 @@
{assign var=displaytitle value=$file->title|str_shorten_text:34|escape}
{if $file->artefacttype == 'folder'}
<a href="{$querybase}folder={$file->id}{if $owner}&owner={$owner}{if $ownerid}&ownerid={$ownerid}{/if}{/if}" class="changefolder" title="{str tag=gotofolder section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>
{elseif !$publishable}
{$displaytitle}
{else}
<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" target="_blank" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>
{/if}
......@@ -40,7 +43,7 @@
{if !isset($file->can_edit) || $file->can_edit !== 0}<button type="submit" name="{$prefix}_edit[{$file->id}]" value="{$file->id}">{str tag=edit}</button>{/if}
{if $file->childcount == 0}<button type="submit" name="{$prefix}_delete[{$file->id}]" value="{$file->id}">{str tag=delete}</button>{/if}
{/if}
{if $selectable && $file->artefacttype != 'folder'}
{if $selectable && $file->artefacttype != 'folder' && $publishable}
<button type="submit" class="select small" name="{$prefix}_select[{$file->id}]" id="{$prefix}_select_{$file->id}" value="{$file->id}">{str tag=select}</button>
{/if}
</td>
......
......@@ -72,7 +72,6 @@
#artefactchooser-body table td {
padding: 0 .25em;
text-align: left;
color: #474220;
}
/* styling the tabs for the artefact chooser */
......
......@@ -531,7 +531,9 @@ select.error {
.error .filebrowser {
color: #333;
}
.disabled {
color: #C3C3C3;
}
.maincontent ul {
margin: .5em 0 1em 0;
......@@ -581,7 +583,6 @@ div.pagination {
.pagination .disabled {
border: 1px solid #d1d1d1;
background-color: #EBEBEB;
color: #C3C3C3;
padding: .5em;
text-decoration: none;
margin: 0 .25em;
......
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