Move another common function to libcalendaring

This commit is contained in:
Thomas Bruederli 2014-07-31 19:25:40 +02:00
parent ab49aa88d5
commit b0eeafcc3e
2 changed files with 28 additions and 16 deletions

View file

@ -874,22 +874,7 @@ class calendar_ui
function event_rsvp_buttons($attrib = array())
{
$attrib += array('type' => 'button');
foreach (array('accepted','tentative','declined') as $method) {
$buttons .= html::tag('input', array(
'type' => $attrib['type'],
'name' => $attrib['iname'],
'class' => 'button',
'rel' => $method,
'value' => $this->cal->itip->gettext('itip' . $method),
));
}
$buttons .= html::div('itip-reply-controls', $this->cal->itip->itip_rsvp_options_ui($attrib['id']));
return html::div($attrib,
html::div('label', $this->cal->itip->gettext('acceptinvitation')) .
html::div('rsvp-buttons', $buttons));
return $this->cal->itip->itip_rsvp_buttons($attrib, array('accepted','tentative','declined'));
}
}

View file

@ -526,6 +526,33 @@ class libcalendaring_itip
html::div(array('class' => 'itip-buttons', 'id' => 'itip-buttons-' . asciiwords($metadata['uid'], true)), join('', $buttons));
}
/**
* Render an RSVP UI widget with buttons to respond on iTip invitations
*/
function itip_rsvp_buttons($attrib = array(), $actions = null)
{
$attrib += array('type' => 'button');
if (!$actions)
$actions = $this->rsvp_actions;
foreach ($actions as $method) {
$buttons .= html::tag('input', array(
'type' => $attrib['type'],
'name' => $attrib['iname'],
'class' => 'button',
'rel' => $method,
'value' => $this->gettext('itip' . $method),
));
}
$buttons .= html::div('itip-reply-controls', $this->itip_rsvp_options_ui($attrib['id']));
return html::div($attrib,
html::div('label', $this->gettext('acceptinvitation')) .
html::div('rsvp-buttons', $buttons));
}
/**
* Render UI elements to control iTip reply message sending
*/