Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit ebc4980

Browse files
committed
ENH: refs #0339. Expose statistics link to non admin users
1 parent dc01720 commit ebc4980

File tree

1 file changed

+55
-58
lines changed

1 file changed

+55
-58
lines changed

core/views/item/view.phtml

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php
22
/*=========================================================================
33
MIDAS Server
44
Copyright (c) Kitware SAS. 20 rue de la Villette. All rights reserved.
@@ -30,39 +30,39 @@ if($this->preview) // module visualize
3030
echo "<a href='{$this->webroot}/download/?items={$this->itemDao->getKey()}'><img style='float:left;margin-right:2px;' alt='' src='{$this->coreWebroot}/public/images/icons/download.png'/>";
3131
if($this->itemIsLink)
3232
{
33-
echo $this->t('View as weblink');
33+
echo $this->t('View as weblink');
3434
}
3535
else
3636
{
37-
echo $this->t('Download');
37+
echo $this->t('Download');
3838
}
3939
echo '</a>';
4040
?>
4141
</div>
42-
42+
4343
<?php
4444
if($this->backUploaded)
4545
{
4646
echo '<div style="float:right;margin-right:2px;" class="genericBigButton ">';
4747
echo "<a href='{$this->webroot}/browse/uploaded'><img style='float:left;margin-right:2px;' alt='' src='{$this->coreWebroot}/public/images/icons/back.png'/>";
48-
echo $this->t('Back');
48+
echo $this->t('Back');
4949
echo "</a>";
5050
echo '</div>';
5151
}
5252
else if($this->currentFolder)
5353
{
5454
echo '<div style="float:right;margin-right:2px;" class="genericBigButton ">';
5555
echo "<a href='{$this->webroot}/folder/{$this->currentFolder->getKey()}'><img style='float:left;margin-right:2px;' alt='' src='{$this->coreWebroot}/public/images/icons/back.png'/>";
56-
echo $this->t('Back');
56+
echo $this->t('Back');
5757
echo "</a>";
5858
echo '</div>';
5959
}
6060
?>
61-
61+
6262
<br/>
6363
<div class="itemStats">
64-
<?php echo $this->itemDao->getView()?> <?php echo $this->t('views'); ?>,
65-
<?php echo $this->itemDao->getDownload()?> <?php echo $this->t('downloads');?></div>
64+
<?php echo $this->itemDao->getView()?> <?php echo $this->t('views'); ?>,
65+
<?php echo $this->itemDao->getDownload()?> <?php echo $this->t('downloads');?></div>
6666
</div>
6767
<div style='width:400px;' class="genericInfo">
6868
<div class="genericThumbnail">
@@ -74,7 +74,7 @@ if($this->preview) // module visualize
7474
<div class="genericSubtitle" style="color:grey;"><?php echo $this->itemSize;?></div>
7575

7676
</div>
77-
77+
7878
<table style='display:block;' class="midasTree">
7979
<thead>
8080
<tr>
@@ -94,19 +94,19 @@ if($this->preview) // module visualize
9494
echo " <td>{$revision->getChanges()}</td>";
9595
echo "</tr>";
9696
$node++;
97-
}
98-
?>
97+
}
98+
?>
9999
</tbody>
100100
</table>
101-
101+
102102
<h4 style="margin-bottom: 5px;"><?php echo $this->t('Latest revision metadata')?>:</h4>
103103

104104
<?php if(count($this->metadatavalues) == 0)
105105
{
106-
echo "No metadata for this revision.";
106+
echo "No metadata for this revision.";
107107
}
108-
else
109-
{
108+
else
109+
{
110110
?>
111111
<table style='display:block;' id="metadataTable" class="midasTree">
112112
<thead>
@@ -133,18 +133,18 @@ if($this->preview) // module visualize
133133
}
134134
echo " </td>";
135135
echo "</tr>";
136-
}
137-
?>
136+
}
137+
?>
138138
</tbody>
139139
</table>
140140
<?php } ?>
141141
<br/>
142142
<br/>
143-
143+
144144
<a onclick="$('#revisionContent').show();$(this).remove();"><?php echo $this->t('Show Content')?></a>
145-
145+
146146
<div id="revisionContent">
147-
147+
148148
<h4 style="margin-top: 0px;margin-bottom: 5px;"><?php echo $this->t('Latest revision content')?>:</h4>
149149

150150
<table style='display:block;' id="browseTable" class="midasTree">
@@ -165,92 +165,89 @@ if($this->preview) // module visualize
165165
echo " <td>{$this->Utility->formatSize($bitstream->getSizebytes())} </td>";
166166
echo " <td>{$bitstream->getMimetype()}</td>";
167167
echo "</tr>";
168-
}
169-
?>
168+
}
169+
?>
170170
</tbody>
171171
</table>
172172
</div>
173-
173+
174174
</div>
175175
<div class="viewSideBar">
176-
<?php
177-
if($this->preview || $this->isModerator ||$this->isAdmin)
176+
<?php
177+
$modules = Zend_Registry::get('modulesEnable');
178+
$statisticsEnabled = in_array('statistics', $modules);
179+
if($this->preview || $this->isModerator ||$this->isAdmin || $statisticsEnabled)
178180
{?>
179181
<div class="sideElementFirst viewAction">
180182

181183
<h1>Actions</h1>
182184
<ul>
183-
<?php
185+
<?php
184186
if($this->preview)
185187
{
186-
echo
188+
echo
187189
"<li>
188190
<a id='itemPreviewLink'><img alt='' src='{$this->coreWebroot}/public/images/icons/view.png'/> {$this->t('Preview')}</a>
189-
</li>
191+
</li>
190192
";
191193
}
192194
if($this->isModerator)
193195
{
194-
echo
196+
echo
195197
"<li>
196198
<a href='javascript:;' class='moveCopyLink' ><img alt='' src='{$this->coreWebroot}/public/images/icons/copy.png'/> {$this->t('Copy')}</a>
197-
</li>
199+
</li>
198200
<li>
199201
<a href='javascript:;' class='editItemLink' ><img alt='' src='{$this->coreWebroot}/public/images/icons/edit.png'/> {$this->t('Edit')}</a>
200-
</li>
202+
</li>
201203
<li>
202204
<a href='javascript:;' class='addMetadataLink' ><img alt='' src='{$this->coreWebroot}/public/images/icons/metadata.png'/> {$this->t('Add Metadata')}</a>
203-
</li>
205+
</li>
204206
<li>
205207
<a href='javascript:;' type='item' element='{$this->itemDao->getKey()}' class='sharingLink' ><img alt='' src='{$this->coreWebroot}/public/images/icons/share.png'/> {$this->t('Share')}</a>
206-
</li>
208+
</li>
207209
<li>
208210
<a href='javascript:;' type='item' element='{$this->itemDao->getKey()}' class='uploadRevisionLink' ><img alt='' src='{$this->coreWebroot}/public/images/icons/upload.png'/> {$this->t('Upload new revision')}</a>
209-
</li>
211+
</li>
210212
";
211213
}
212214
if($this->isAdmin)
213215
{
214-
$modules = Zend_Registry::get('modulesEnable');
215-
if(in_array('statistics', $modules))
216-
{
217-
echo
218-
"<li>
219-
<a href='".$this->webroot."/statistics/item?id=".$this->itemDao->getKey()."'><img alt='' src='{$this->coreWebroot}/public/images/icons/metadata.png'/> {$this->t('Statistics')}</a>
220-
</li>
221-
";
222-
}
223-
echo
216+
echo
224217
"
225218
<li>
226219
<a href='javascript:;' id='itemDeleteLink'><img alt='' src='{$this->coreWebroot}/public/images/icons/close.png'/> {$this->t('Delete')}</a>
227-
</li>
228-
";
220+
</li>
221+
";
229222
}
223+
echo
224+
"<li>
225+
<a href='".$this->webroot."/statistics/item?id=".$this->itemDao->getKey()."'><img alt='' src='{$this->coreWebroot}/public/images/icons/metadata.png'/> {$this->t('Statistics')}</a>
226+
</li>";
230227
?>
231228
</ul>
232229
</div>
233230
<?php
234231
}?>
235232
<div class="<?php echo (!$this->preview && !$this->isModerator && !$this->isAdmin)?'sideElementFirst':''; ?>sideElement<?php if(count($this->sameLocation) > 1) echo "Last"?> viewInfo">
236-
<h1>Info</h1>
237-
<table>
233+
<h1>Info</h1>
234+
<table>
238235
<tbody>
239-
<tr>
236+
<tr>
240237
<td><?php echo $this->t('Created')?></td>
241-
<td><?php echo $this->itemDao->creation?></td>
238+
<td><?php echo $this->itemDao->creation?></td>
242239
</tr>
243-
<tr>
244-
<td><?php echo $this->t('Uploaded by');?></td>
240+
<tr>
241+
<td><?php echo $this->t('Uploaded by');?></td>
245242
<td><?php echo $this->linkuser($this->itemDao->lastrevision->getUser())?></td>
246243
</tr>
247-
<tr>
248-
<td>Revision</td>
244+
<tr>
245+
<td>Revision</td>
249246
<td><?php echo $this->itemDao->lastrevision->getRevision()?></td>
250247
</tr>
251-
<tr>
248+
<tr>
252249
<td><?php echo $this->t('Files');?></td>
253-
<td><?php echo count($this->itemDao->lastrevision->getBitstreams())?></td>
250+
<td><?php echo count($this->itemDao->lastrevision->getBitstreams())?></td>
254251
</tr>
255252
</tbody>
256253
</table>
@@ -269,7 +266,7 @@ if($this->preview) // module visualize
269266
if(count($this->sameLocation) > 1)
270267
{?>
271268
<div class='sideElementLast viewSameLocation'>
272-
<h1><?php echo $this->t('In the same location')?></h1>
269+
<h1><?php echo $this->t('In the same location')?></h1>
273270
<ul>
274271
<?php
275272
foreach($this->sameLocation as $item)

0 commit comments

Comments
 (0)