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

Commit

Permalink
ENH: Item page
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Marion committed Mar 16, 2011
1 parent 25062d8 commit 6e98425
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 10 deletions.
7 changes: 6 additions & 1 deletion application/controllers/ItemController.php
Expand Up @@ -4,7 +4,7 @@ class ItemController extends AppController
{
public $_models=array('Item');
public $_daos=array();
public $_components=array();
public $_components=array('Date');
public $_forms=array();

/** Init Controller */
Expand All @@ -24,6 +24,7 @@ function viewAction()
{
//TODO: add policy check
$this->view->header=$this->t("Item");
$this->view->Date=$this->Component->Date;
$itemId=$this->_getParam("itemId");
if(!isset($itemId)||!is_numeric($itemId))
{
Expand Down Expand Up @@ -60,6 +61,10 @@ function viewAction()
$recentItems[]=$itemDao;

setcookie("recentItems", serialize($recentItems), time()+60*60*24*30,'/'); //30 days
$itemRevision=$this->Item->getLastRevision($itemDao);
$itemDao->lastrevision=$itemRevision;
$itemDao->revisions=$itemDao->getRevisions();
$itemDao->creation=$this->Component->Date->formatDate(strtotime($itemRevision->getDate()));
$this->view->itemDao=$itemDao;
}//end index

Expand Down
75 changes: 69 additions & 6 deletions application/views/item/view.phtml
@@ -1,25 +1,88 @@
<link type="text/css" rel="stylesheet" href="<?php echo $this->webroot?>/public/css/common/common.genericPage.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->webroot?>/public/css/item/item.view.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->webroot?>/public/css/common/common.browser.css" />

<div class="viewMain">
<?php
echo $this->itemDao->getName();
<div class="genericThumbnail">
<?php
echo "<img src='{$this->webroot}/public/images/icons/document-big.png' alt=''/>";
?>

</div>
<div class="genericInfo">
<div class="genericName"><?php echo $this->itemDao->getName(); ?></div>
</div>


<table id="browseTable" class="midasTree">
<thead>
<tr>
<th ><?php echo $this->t('Revision');?></th>
<th ><?php echo $this->t('Uploaded');?></th>
<th ><?php echo $this->t('Changes');?></th>
</tr>
</thead>
<tbody>
<?php
$node=1;
foreach($this->itemDao->revisions as $revision)
{
echo "<tr>";
echo " <td ><a href='{$this->webroot}/download/?items={$this->itemDao->getKey()},{$revision->getRevision()}'>Revision {$revision->getRevision()}</a></td>";
echo " <td>{$this->Date->ago($revision->getDate(),false)} {$this->t('by')} <a href='{$this->webroot}/user/{$revision->getUserId()}'>{$revision->getUser()->getFullName()}</a></td>";
echo " <td>{$revision->getChanges()}</td>";
echo "</tr>";
$node++;
}
?>
</tbody>
</table>
</div>
<div class="viewSideBar">
<div class="sideElementFirst viewAction">
<h1>Actions</h1>
<ul>
<?php
echo
"<li>
"
<li>
<a href='{$this->webroot}/download/?items={$this->itemDao->getKey()}'>{$this->t('Download')}</a>
</li>";
</li>
";
?>
</ul>
</div>
<div class="sideElementLast viewInfo">
<h1>Info</h1>
bla
<table>
<tbody>
<tr>
<td><?php echo $this->t('Created')?></td>
<td><?php echo $this->itemDao->creation?></td>
</tr>
<tr>
<td><?php echo $this->t('Uploaded by');?></td>
<td><a href="/Midas/MIDAS3/user/<?php echo $this->itemDao->lastrevision->getUser()->getKey()?>"><?php echo $this->itemDao->lastrevision->getUser()->getFullName()?></a></td>
</tr>
<tr>
<td>Revision</td>
<td><?php echo $this->itemDao->lastrevision->getRevision()?></td>
</tr>
<tr>
<td><?php echo $this->t('File');?></td>
<td><?php echo count($this->itemDao->lastrevision->getBitstreams())?></td>
</tr>
</tbody>
</table>
<?php
$path=$this->itemDao->getThumbnail();
if(!empty($path)&& file_exists(BASE_PATH.'/'.$path))
{
echo "
<h1>{$this->t('Preview')}</h1>
<img class='infoLogo' alt='' src='{$this->webroot}/{$path}'/>
";
}
?>
</div>
</div>

Expand Down
12 changes: 12 additions & 0 deletions public/css/item/item.view.css
@@ -0,0 +1,12 @@

div.viewAction{
display:block!important;
}

div.viewInfo{
display:block!important;
}

table#browseTable{
display: table!important;
}
2 changes: 1 addition & 1 deletion public/js/common/common.browser.js
Expand Up @@ -205,7 +205,7 @@

if(arrayElement['thumbnail']!=undefined&&arrayElement['thumbnail']!='')
{
html+='<h1>'+json.browse.preview+'</h1><a href="'+json.global.webroot+'/item/'+arrayElement['item_id']+'"><img class="infoLogo alt="Data Type" src="'+json.global.webroot+'/'+arrayElement['thumbnail']+'" /></a>';
html+='<h1>'+json.browse.preview+'</h1><a href="'+json.global.webroot+'/item/'+arrayElement['item_id']+'"><img class="infoLogo" alt="" src="'+json.global.webroot+'/'+arrayElement['thumbnail']+'" /></a>';
}

$('div.ajaxInfoElement').html(html);
Expand Down
7 changes: 5 additions & 2 deletions translation/fr-main.csv
Expand Up @@ -45,7 +45,7 @@ Private;Priv
Public;Publique
Semi-private;Semi-priv�e
Description;Description
Created:Cr��e;
Created;Cr�e
View;Voir
Edit;Editer
Delete;Effacer
Expand Down Expand Up @@ -100,4 +100,7 @@ Selected;S
element;�lement
No communty available;Pas de communaut� disponible
Create your own community;Cr�ez la votre
This folder is empty;Ce r�pertoire est vide
This folder is empty;Ce r�pertoire est vide
by;par
Uploaded;Upload�
Changes;Changements

0 comments on commit 6e98425

Please sign in to comment.