Cleanup attachment viewer: show filename, size and download button

This commit is contained in:
Thomas 2011-07-06 09:43:42 +02:00
parent 631f19ca5e
commit e25891ffa6
5 changed files with 78 additions and 76 deletions

View file

@ -993,7 +993,9 @@ class calendar extends rcube_plugin
// show part page
if (!empty($_GET['_frame'])) {
$this->rc->output->add_handlers(array('attachmentframe' => array($this, 'attachment_frame')));
$this->attachment = $attachment;
$this->register_handler('plugin.attachmentframe', array($this, 'attachment_frame'));
$this->register_handler('plugin.attachmentcontrols', array($this->ui, 'attachment_controls'));
$this->rc->output->send('calendar.attachment');
exit;
}

View file

@ -664,6 +664,7 @@ class database_driver extends calendar_driver
$event['allday'] = intval($event['all_day']);
$event['free_busy'] = $free_busy_map[$event['free_busy']];
$event['calendar'] = $event['calendar_id'];
$event['recurrence_id'] = intval($event['recurrence_id']);
// parse recurrence rule
if ($event['recurrence'] && preg_match_all('/([A-Z]+)=([^;]+);?/', $event['recurrence'], $m, PREG_SET_ORDER)) {

View file

@ -520,4 +520,22 @@ class calendar_ui
return html::tag('ul', $attrib, '', html::$common_attrib);
}
function attachment_controls($attrib = array())
{
$table = new html_table(array('cols' => 3));
if (!empty($this->calendar->attachment['name'])) {
$table->add('title', Q(rcube_label('filename')));
$table->add(null, Q($this->calendar->attachment['name']));
$table->add(null, '[' . html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q(rcube_label('download'))) . ']');
}
if (!empty($this->calendar->attachment['size'])) {
$table->add('title', Q(rcube_label('filesize')));
$table->add(null, Q(show_bytes($this->calendar->attachment['size'])));
}
return $table->show($attrib);
}
}

View file

@ -247,68 +247,75 @@ a.miniColors-trigger {
margin-top: -3px;
}
#attachmentcontainer
{
position: absolute;
top: 80px;
left: 20px;
right: 20px;
bottom: 20px;
#attachmentcontainer {
position: absolute;
top: 80px;
left: 20px;
right: 20px;
bottom: 20px;
}
#attachmentframe
{
width: 100%;
height: 100%;
border: 1px solid #999999;
background-color: #F9F9F9;
#attachmentframe {
width: 100%;
height: 100%;
border: 1px solid #999999;
background-color: #F9F9F9;
}
.attachments-list ul
{
margin: 0px;
padding: 0px;
list-style-image: none;
list-style-type: none;
#partheader {
position: absolute;
top: 20px;
left: 220px;
right: 20px;
height: 40px;
}
.attachments-list ul li
{
height: 18px;
font-size: 12px;
padding-left: 2px;
padding-top: 2px;
padding-right: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
#partheader table td {
padding-left: 2px;
padding-right: 4px;
vertical-align: middle;
font-size: 11px;
}
.attachments-list ul li img
{
padding-right: 2px;
vertical-align: middle;
.attachments-list ul {
margin: 0px;
padding: 0px;
list-style-image: none;
list-style-type: none;
}
.attachments-list ul li a
{
text-decoration: none;
.attachments-list ul li {
height: 18px;
font-size: 12px;
padding-left: 2px;
padding-top: 2px;
padding-right: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.attachments-list ul li a:hover
{
text-decoration: underline;
.attachments-list ul li img {
padding-right: 2px;
vertical-align: middle;
}
#eventshow .attachments-list ul
{
display: block;
.attachments-list ul li a {
text-decoration: none;
}
#eventshow .attachments-list ul li
{
float: left;
.attachments-list ul li a:hover {
text-decoration: underline;
}
#eventshow .attachments-list ul {
display: block;
}
#eventshow .attachments-list ul li {
float: left;
}

View file

@ -9,9 +9,8 @@
<roundcube:include file="/includes/header.html" />
<div id="partheader">
<!--
<roundcube:object name="attachmentControls" cellpadding="2" cellspacing="0" />
-->
<roundcube:object name="plugin.attachmentcontrols" cellpadding="2" cellspacing="0" />
<div style="position:absolute; top:2px; right:0; width:12em; text-align:right">
[<a href="#close" class="closelink" onclick="self.close()"><roundcube:label name="close" /></a>]
</div>
@ -19,34 +18,9 @@
<div id="attachmentcontainer">
<roundcube:object name="attachmentFrame" id="attachmentframe" width="100%" height="100%" />
<roundcube:object name="plugin.attachmentframe" id="attachmentframe" width="100%" height="100%" />
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
</head>
<body class="extwin">
<roundcube:include file="/includes/header.html" />
<div id="partheader">
<!--
<roundcube:object name="attachmentControls" cellpadding="2" cellspacing="0" />
-->
<div style="position:absolute; top:2px; right:0; width:12em; text-align:right">
[<a href="#close" class="closelink" onclick="self.close()"><roundcube:label name="close" /></a>]
</div>
</div>
<div id="attachmentcontainer">
<roundcube:object name="attachmentFrame" id="attachmentframe" width="100%" height="100%" />
</div>
</body>
</html>