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

Commit

Permalink
ENH: CSS improvements
Browse files Browse the repository at this point in the history
ENH: Added display of metadata in the item view
  • Loading branch information
Julien Jomier committed May 26, 2011
1 parent fbc21dc commit 1de93d0
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 17 deletions.
2 changes: 2 additions & 0 deletions core/controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ function viewAction()
$this->view->title .= ' - '.$itemDao->getName();
$this->view->metaDescription = substr($itemDao->getDescription(), 0, 160);

$this->view->metadatavalues = $this->ItemRevision->getMetadata($itemRevision);


$tmp = Zend_Registry::get('notifier')->notify(MIDAS_NOTIFY_CAN_VISUALIZE, array('item' => $itemDao));
if(isset($tmp['visualize']) && $tmp['visualize'] == true)
Expand Down
1 change: 1 addition & 0 deletions core/models/base/ItemRevisionModelBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct()
} // end __construct()

abstract function getByUuid($uuid);
abstract function getMetadata($revisiondao);

/** save */
public function save($dao)
Expand Down
25 changes: 25 additions & 0 deletions core/models/pdo/ItemRevisionModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@ function getByUuid($uuid)
return $dao;
}

/** get the metadata associated with the revision */
function getMetadata($revisiondao)
{
if(!$revisiondao instanceof ItemRevisionDao)
{
throw new Zend_Exception("Error param.");
}

$metadatavalues = array();
$sql = $this->database->select()
->setIntegrityCheck(false)
->from('metadatavalue')
->where('itemrevision_id = ?', $revisiondao->getKey())
->joinLeft('metadata','metadata.metadata_id = metadatavalue.metadata_id');

$rowset = $this->database->fetchAll($sql);
foreach($rowset as $row)
{
$metadata = $this->initDao('Metadata', $row);
$metadatavalues[] = $metadata;
}

return $metadatavalues;
} // end getMetadata

/** delete a revision*/
function delete($revisiondao)
{
Expand Down
4 changes: 4 additions & 0 deletions core/public/css/community/community.index.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ div.communityList span{
padding-left: 15px;
}

div.communityBlock:hover{
background-color: #F6F9FE;
cursor: pointer;
}
5 changes: 5 additions & 0 deletions core/public/css/community/community.view.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
div.viewSideBar input.globalButton{
margin-left: 0px!important;
}

.genericInfo {
margin-top: 5px;
margin-left: 35px;
}
4 changes: 4 additions & 0 deletions core/public/css/item/item.view.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ div.viewInfo{

table#browseTable{
display: table!important;
}

table#metadataTable{
display: table!important;
}
6 changes: 6 additions & 0 deletions core/public/js/community/community.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
$('a.moreDescription').click(function(){
$(this).parents('div').find('.shortDescription').hide();
$(this).parents('div').find('.fullDescription').show();
return false;
})
$('a.lessDescription').click(function(){
$(this).parents('div').find('.shortDescription').show();
$(this).parents('div').find('.fullDescription').hide();
return false;
})

$('.communityBlock').click(function(){
$(location).attr('href',($('> .communityTitle',this).attr('href')));
})

});

33 changes: 19 additions & 14 deletions core/views/community/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,30 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/community/communi
{
foreach($this->userCommunities as $community)
{
echo "
<div>
<a class='communityTitle' href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a>
?>
<div class="communityBlock">
<a class="communityTitle" href="<?php echo $this->webroot.'/community/'.$community->getKey();?>">
<?php echo $community->getName()?></a>
<br/>
<span class='shortDescription' >
";
if(strlen($community->getDescription())>270)
{
<?php
if(strlen($community->getDescription())>270)
{ ?>
<span class='shortDescription'>
<?php
echo substr($community->getDescription(), 0,270)."... <a class='moreDescription'>{$this->t('more')}</a>";
}
echo "
?>
</span>
<span class='fullDescription' style='display:none;'>
{$community->getDescription()}
<br/>
<a class='lessDescription'>{$this->t('less')}</a>
<span class="fullDescription" style="display:none;">
<?php echo $community->getDescription(); ?>
<a class='lessDescription'><?php echo $this->t('less'); ?></a>
</span>
<?php } else { ?>
<span class='fullDescription'">
<?php echo $community->getDescription(); ?>
</span>
<?php } ?>
</div>
";
<?php
}
}
?>
Expand Down
2 changes: 2 additions & 0 deletions core/views/element/feed.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ PURPOSE. See the above copyright notices for more information.
$feeds=$this->feeds;
if(!isset($feeds)||empty($feeds))
{
echo $this->t("Feed is currently empty. It could be that the community is not very active
or you may not have the permissions to see the feeds.");
return;
}

Expand Down
38 changes: 35 additions & 3 deletions core/views/item/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,39 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
</tbody>
</table>

<h4 style="margin-bottom: 5px;"><?php echo $this->t('Last revision content')?>:</h4>
<h4 style="margin-bottom: 5px;"><?php echo $this->t('Latest revision metadata')?>:</h4>

<?php if(count($this->metadatavalues) == 0)
{
echo "No metadata for this revision.";
}
else
{
?>
<table id="metadataTable" class="midasTree">
<thead>
<tr>
<th ><?php echo $this->t('Element');?></th>
<th ><?php echo $this->t('Qualifier');?></th>
<th ><?php echo $this->t('Value');?></th>
</tr>
</thead>
<tbody>
<?php
foreach($this->metadatavalues as $metadata)
{
echo "<tr>";
echo " <td>".$metadata->getElement()."</td>";
echo " <td>".$metadata->getQualifier()."</td>";
echo " <td>".$metadata->getValue()."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<?php } ?>

<h4 style="margin-bottom: 5px;"><?php echo $this->t('Latest revision content')?>:</h4>

<table id="browseTable" class="midasTree">
<thead>
Expand All @@ -69,7 +101,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
foreach($bitstreams as $bitstream)
{
echo "<tr>";
echo " <td >{$this->slicename($bitstream->getName(),50)}</td>";
echo " <td>{$this->slicename($bitstream->getName(),50)}</td>";
echo " <td>{$this->Utility->formatSize($bitstream->getSizebytes())} </td>";
echo " <td>{$bitstream->getMimetype()}</td>";
echo "</tr>";
Expand Down Expand Up @@ -140,7 +172,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
<td><?php echo $this->itemDao->lastrevision->getRevision()?></td>
</tr>
<tr>
<td><?php echo $this->t('File');?></td>
<td><?php echo $this->t('# files');?></td>
<td><?php echo count($this->itemDao->lastrevision->getBitstreams())?></td>
</tr>
</tbody>
Expand Down

0 comments on commit 1de93d0

Please sign in to comment.