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

Commit 1de93d0

Browse files
author
Julien Jomier
committed
ENH: CSS improvements
ENH: Added display of metadata in the item view
1 parent fbc21dc commit 1de93d0

File tree

10 files changed

+103
-17
lines changed

10 files changed

+103
-17
lines changed

core/controllers/ItemController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ function viewAction()
102102
$this->view->title .= ' - '.$itemDao->getName();
103103
$this->view->metaDescription = substr($itemDao->getDescription(), 0, 160);
104104

105+
$this->view->metadatavalues = $this->ItemRevision->getMetadata($itemRevision);
106+
105107

106108
$tmp = Zend_Registry::get('notifier')->notify(MIDAS_NOTIFY_CAN_VISUALIZE, array('item' => $itemDao));
107109
if(isset($tmp['visualize']) && $tmp['visualize'] == true)

core/models/base/ItemRevisionModelBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct()
4040
} // end __construct()
4141

4242
abstract function getByUuid($uuid);
43+
abstract function getMetadata($revisiondao);
4344

4445
/** save */
4546
public function save($dao)

core/models/pdo/ItemRevisionModel.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,31 @@ function getByUuid($uuid)
2626
return $dao;
2727
}
2828

29+
/** get the metadata associated with the revision */
30+
function getMetadata($revisiondao)
31+
{
32+
if(!$revisiondao instanceof ItemRevisionDao)
33+
{
34+
throw new Zend_Exception("Error param.");
35+
}
36+
37+
$metadatavalues = array();
38+
$sql = $this->database->select()
39+
->setIntegrityCheck(false)
40+
->from('metadatavalue')
41+
->where('itemrevision_id = ?', $revisiondao->getKey())
42+
->joinLeft('metadata','metadata.metadata_id = metadatavalue.metadata_id');
43+
44+
$rowset = $this->database->fetchAll($sql);
45+
foreach($rowset as $row)
46+
{
47+
$metadata = $this->initDao('Metadata', $row);
48+
$metadatavalues[] = $metadata;
49+
}
50+
51+
return $metadatavalues;
52+
} // end getMetadata
53+
2954
/** delete a revision*/
3055
function delete($revisiondao)
3156
{

core/public/css/community/community.index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ div.communityList span{
1717
padding-left: 15px;
1818
}
1919

20+
div.communityBlock:hover{
21+
background-color: #F6F9FE;
22+
cursor: pointer;
23+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
div.viewSideBar input.globalButton{
22
margin-left: 0px!important;
3+
}
4+
5+
.genericInfo {
6+
margin-top: 5px;
7+
margin-left: 35px;
38
}

core/public/css/item/item.view.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ div.viewInfo{
99

1010
table#browseTable{
1111
display: table!important;
12+
}
13+
14+
table#metadataTable{
15+
display: table!important;
1216
}

core/public/js/community/community.index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
$('a.moreDescription').click(function(){
1818
$(this).parents('div').find('.shortDescription').hide();
1919
$(this).parents('div').find('.fullDescription').show();
20+
return false;
2021
})
2122
$('a.lessDescription').click(function(){
2223
$(this).parents('div').find('.shortDescription').show();
2324
$(this).parents('div').find('.fullDescription').hide();
25+
return false;
2426
})
2527

28+
$('.communityBlock').click(function(){
29+
$(location).attr('href',($('> .communityTitle',this).attr('href')));
30+
})
31+
2632
});
2733

core/views/community/index.phtml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,30 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/community/communi
2121
{
2222
foreach($this->userCommunities as $community)
2323
{
24-
echo "
25-
<div>
26-
<a class='communityTitle' href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a>
24+
?>
25+
<div class="communityBlock">
26+
<a class="communityTitle" href="<?php echo $this->webroot.'/community/'.$community->getKey();?>">
27+
<?php echo $community->getName()?></a>
2728
<br/>
28-
<span class='shortDescription' >
29-
";
30-
if(strlen($community->getDescription())>270)
31-
{
29+
<?php
30+
if(strlen($community->getDescription())>270)
31+
{ ?>
32+
<span class='shortDescription'>
33+
<?php
3234
echo substr($community->getDescription(), 0,270)."... <a class='moreDescription'>{$this->t('more')}</a>";
33-
}
34-
echo "
35+
?>
3536
</span>
36-
<span class='fullDescription' style='display:none;'>
37-
{$community->getDescription()}
38-
<br/>
39-
<a class='lessDescription'>{$this->t('less')}</a>
37+
<span class="fullDescription" style="display:none;">
38+
<?php echo $community->getDescription(); ?>
39+
<a class='lessDescription'><?php echo $this->t('less'); ?></a>
4040
</span>
41+
<?php } else { ?>
42+
<span class='fullDescription'">
43+
<?php echo $community->getDescription(); ?>
44+
</span>
45+
<?php } ?>
4146
</div>
42-
";
47+
<?php
4348
}
4449
}
4550
?>

core/views/element/feed.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ PURPOSE. See the above copyright notices for more information.
7575
$feeds=$this->feeds;
7676
if(!isset($feeds)||empty($feeds))
7777
{
78+
echo $this->t("Feed is currently empty. It could be that the community is not very active
79+
or you may not have the permissions to see the feeds.");
7880
return;
7981
}
8082

core/views/item/view.phtml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,39 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
5353
</tbody>
5454
</table>
5555

56-
<h4 style="margin-bottom: 5px;"><?php echo $this->t('Last revision content')?>:</h4>
56+
<h4 style="margin-bottom: 5px;"><?php echo $this->t('Latest revision metadata')?>:</h4>
57+
58+
<?php if(count($this->metadatavalues) == 0)
59+
{
60+
echo "No metadata for this revision.";
61+
}
62+
else
63+
{
64+
?>
65+
<table id="metadataTable" class="midasTree">
66+
<thead>
67+
<tr>
68+
<th ><?php echo $this->t('Element');?></th>
69+
<th ><?php echo $this->t('Qualifier');?></th>
70+
<th ><?php echo $this->t('Value');?></th>
71+
</tr>
72+
</thead>
73+
<tbody>
74+
<?php
75+
foreach($this->metadatavalues as $metadata)
76+
{
77+
echo "<tr>";
78+
echo " <td>".$metadata->getElement()."</td>";
79+
echo " <td>".$metadata->getQualifier()."</td>";
80+
echo " <td>".$metadata->getValue()."</td>";
81+
echo "</tr>";
82+
}
83+
?>
84+
</tbody>
85+
</table>
86+
<?php } ?>
87+
88+
<h4 style="margin-bottom: 5px;"><?php echo $this->t('Latest revision content')?>:</h4>
5789

5890
<table id="browseTable" class="midasTree">
5991
<thead>
@@ -69,7 +101,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
69101
foreach($bitstreams as $bitstream)
70102
{
71103
echo "<tr>";
72-
echo " <td >{$this->slicename($bitstream->getName(),50)}</td>";
104+
echo " <td>{$this->slicename($bitstream->getName(),50)}</td>";
73105
echo " <td>{$this->Utility->formatSize($bitstream->getSizebytes())} </td>";
74106
echo " <td>{$bitstream->getMimetype()}</td>";
75107
echo "</tr>";
@@ -140,7 +172,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
140172
<td><?php echo $this->itemDao->lastrevision->getRevision()?></td>
141173
</tr>
142174
<tr>
143-
<td><?php echo $this->t('File');?></td>
175+
<td><?php echo $this->t('# files');?></td>
144176
<td><?php echo count($this->itemDao->lastrevision->getBitstreams())?></td>
145177
</tr>
146178
</tbody>

0 commit comments

Comments
 (0)