Embed ACL plugin as iframe for calendar sharing in Kolab
This commit is contained in:
parent
be8f50c464
commit
6f940a2ef8
8 changed files with 99 additions and 32 deletions
|
@ -307,7 +307,7 @@ function rcube_calendar_ui(settings)
|
|||
dispname = '<a href="mailto:' + data.email + '" title="' + Q(data.email) + '" class="mailtolink">' + dispname + '</a>';
|
||||
if (data.role == 'ORGANIZER')
|
||||
organizer = true;
|
||||
else if ((data.status == 'NEEDS-ACTION' || data.status == 'TENTATIVE') && data.email && settings.identity.emails.indexOf(';'+data.email) >= 0)
|
||||
else if ((data.status == 'NEEDS-ACTION' || data.status == 'TENTATIVE') && settings.identity.emails.indexOf(';'+data.email) >= 0)
|
||||
rsvp = data.status.toLowerCase();
|
||||
}
|
||||
html += '<span class="attendee ' + String(data.role == 'ORGANIZER' ? 'organizer' : data.status).toLowerCase() + '">' + dispname + '</span> ';
|
||||
|
@ -1655,6 +1655,7 @@ function rcube_calendar_ui(settings)
|
|||
$dialog.dialog({
|
||||
modal: true,
|
||||
resizable: true,
|
||||
closeOnEscape: false,
|
||||
title: rcmail.gettext((calendar.id ? 'editcalendar' : 'createcalendar'), 'calendar'),
|
||||
close: function() {
|
||||
$dialog.dialog("destroy").hide();
|
||||
|
|
|
@ -50,6 +50,7 @@ class kolab_driver extends calendar_driver
|
|||
$this->_read_calendars();
|
||||
|
||||
$this->cal->register_action('push-freebusy', array($this, 'push_freebusy'));
|
||||
$this->cal->register_action('calendar-acl', array($this, 'calendar_acl'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -947,26 +948,6 @@ class kolab_driver extends calendar_driver
|
|||
* @return string HTML content of the form
|
||||
*/
|
||||
public function calendar_form($action, $calendar, $formfields)
|
||||
{
|
||||
// Remove any scripts/css/js
|
||||
$this->rc->output->reset();
|
||||
|
||||
// Produce form content
|
||||
$content = $this->calendar_form_content($calendar, $formfields);
|
||||
|
||||
// Parse form template for skin-dependent stuff
|
||||
// TODO: copy scripts and styles added by other plugins (e.g. acl) from $this->rc->output
|
||||
$html = $this->rc->output->parse('calendar.calendarform-kolab', false, false);
|
||||
|
||||
return str_replace('%FORM_CONTENT%', $content, $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces calendar edit/create form content
|
||||
*
|
||||
* @return string HTML content of the form
|
||||
*/
|
||||
private function calendar_form_content($calendar, $formfields)
|
||||
{
|
||||
if ($calendar['id'] && ($cal = $this->calendars[$calendar['id']])) {
|
||||
$folder = $cal->get_realname(); // UTF7
|
||||
|
@ -1034,18 +1015,26 @@ class kolab_driver extends calendar_driver
|
|||
'showalarms' => $formfields['showalarms'],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
if ($action != 'form-new') {
|
||||
$form['sharing'] = array(
|
||||
'name' => Q($this->cal->gettext('tabsharing')),
|
||||
'content' => html::tag('iframe', array(
|
||||
'src' => $this->cal->rc->url(array('_action' => 'calendar-acl', 'id' => $calendar['id'], 'framed' => 1)),
|
||||
'width' => '100%',
|
||||
'height' => 350,
|
||||
'border' => 0,
|
||||
'style' => 'border:0'),
|
||||
''),
|
||||
);
|
||||
}
|
||||
|
||||
// Allow plugins to modify the form content (e.g. with ACL form)
|
||||
$plugin = $this->rc->plugins->exec_hook('calendar_form_kolab',
|
||||
array('form' => $form, 'options' => $options, 'name' => $folder));
|
||||
|
||||
$form = $plugin['form'];
|
||||
$out = '';
|
||||
|
||||
$this->form_html = '';
|
||||
if (is_array($hidden_fields)) {
|
||||
foreach ($hidden_fields as $field) {
|
||||
$hiddenfield = new html_hiddenfield($field);
|
||||
$out .= $hiddenfield->show() . "\n";
|
||||
$this->form_html .= $hiddenfield->show() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1065,11 +1054,21 @@ class kolab_driver extends calendar_driver
|
|||
}
|
||||
|
||||
if ($content) {
|
||||
$out .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n";
|
||||
$this->form_html .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
// Parse form template for skin-dependent stuff
|
||||
$this->rc->output->add_handler('calendarform', array($this, 'calendar_form_html'));
|
||||
return $this->rc->output->parse('calendar.kolabform', false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for template object
|
||||
*/
|
||||
public function calendar_form_html()
|
||||
{
|
||||
return $this->form_html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1097,4 +1096,50 @@ class kolab_driver extends calendar_driver
|
|||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handler to render ACL form for a calendar folder
|
||||
*/
|
||||
public function calendar_acl()
|
||||
{
|
||||
$this->rc->output->add_handler('folderacl', array($this, 'calendar_acl_form'));
|
||||
$this->rc->output->send('calendar.kolabacl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for ACL form template object
|
||||
*/
|
||||
public function calendar_acl_form()
|
||||
{
|
||||
$calid = get_input_value('_id', RCUBE_INPUT_GPC);
|
||||
if ($calid && ($cal = $this->calendars[$calid])) {
|
||||
$folder = $cal->get_realname(); // UTF7
|
||||
$color = $cal->get_color();
|
||||
}
|
||||
else {
|
||||
$folder = '';
|
||||
$color = '';
|
||||
}
|
||||
|
||||
$hidden_fields[] = array('name' => 'oldname', 'value' => $folder);
|
||||
|
||||
$delim = $_SESSION['imap_delimiter'];
|
||||
$form = array();
|
||||
|
||||
if (strlen($folder)) {
|
||||
$path_imap = explode($delim, $folder);
|
||||
array_pop($path_imap); // pop off name part
|
||||
$path_imap = implode($path_imap, $delim);
|
||||
|
||||
$this->rc->imap_connect();
|
||||
$options = $this->rc->imap->mailbox_info($folder);
|
||||
|
||||
// Allow plugins to modify the form content (e.g. with ACL form)
|
||||
$plugin = $this->rc->plugins->exec_hook('calendar_form_kolab',
|
||||
array('form' => $form, 'options' => $options, 'name' => $folder));
|
||||
}
|
||||
|
||||
return $plugin['form']['sharing']['content'];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,6 +148,7 @@ $labels['tabsummary'] = 'Übersicht';
|
|||
$labels['tabrecurrence'] = 'Wiederholung';
|
||||
$labels['tabattendees'] = 'Teilnehmer';
|
||||
$labels['tabattachments'] = 'Anhänge';
|
||||
$labels['tabsharing'] = 'Freigabe';
|
||||
|
||||
// messages
|
||||
$labels['deleteventconfirm'] = 'Möchten Sie diesen Termin wirklich löschen?';
|
||||
|
|
|
@ -147,6 +147,7 @@ $labels['tabsummary'] = 'Übersicht';
|
|||
$labels['tabrecurrence'] = 'Wiederholung';
|
||||
$labels['tabattendees'] = 'Teilnehmer';
|
||||
$labels['tabattachments'] = 'Anhänge';
|
||||
$labels['tabsharing'] = 'Freigabe';
|
||||
|
||||
// messages
|
||||
$labels['deleteventconfirm'] = 'Möchten Sie diesen Termin wirklich löschen?';
|
||||
|
|
|
@ -148,6 +148,7 @@ $labels['tabsummary'] = 'Summary';
|
|||
$labels['tabrecurrence'] = 'Recurrence';
|
||||
$labels['tabattendees'] = 'Participants';
|
||||
$labels['tabattachments'] = 'Attachments';
|
||||
$labels['tabsharing'] = 'Sharing';
|
||||
|
||||
// messages
|
||||
$labels['deleteventconfirm'] = 'Do you really want to delete this event?';
|
||||
|
|
|
@ -927,6 +927,8 @@ a.alarm-action-snooze:after {
|
|||
position: relative;
|
||||
padding-top: 22px;
|
||||
margin: 0 -8px;
|
||||
min-width: 660px;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
#calendar-kolabform div.tabsbar {
|
||||
|
|
13
plugins/calendar/skins/default/templates/kolabacl.html
Normal file
13
plugins/calendar/skins/default/templates/kolabacl.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!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" />
|
||||
<script type="text/javascript" src="/functions.js"></script>
|
||||
</head>
|
||||
<body class="iframe" style="background:#fff; margin:0">
|
||||
|
||||
<roundcube:object name="folderacl" />
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,7 @@
|
|||
<div id="calendar-kolabform">
|
||||
%FORM_CONTENT%
|
||||
<roundcube:object name="calendarform" />
|
||||
</div>
|
||||
<script type="text/javascript">rcube_init_tabs('calendar-kolabform');</script>
|
||||
<style type="text/css">
|
||||
#calendarpropform { min-width:680px }
|
||||
</style>
|
Loading…
Add table
Reference in a new issue