Example #1
0
 /**
  * Handler for message attachment download
  */
 function get_part($args)
 {
     if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) {
         $rcmail = rcube::get_instance();
         $params = array('documentUrl' => $_SERVER['REQUEST_URI'] . '&_download=1', 'filename' => $args['part']->filename ?: 'file.odt', 'type' => $args['mimetype']);
         // send webODF viewer page
         $html = file_get_contents($this->home . '/odf.html');
         header("Content-Type: text/html; charset=" . RCUBE_CHARSET);
         echo strtr($html, array('%%PARAMS%%' => rcube_output::json_serialize($params), '%%viewer.css%%' => $this->asset_path('viewer.css'), '%%viewer.js%%' => $this->asset_path('viewer.js'), '%%ODFViewerPlugin.js%%' => $this->asset_path('ODFViewerPlugin.js'), '%%webodf.js%%' => $this->asset_path('webodf.js')));
         $args['abort'] = true;
     }
     return $args;
 }
Example #2
0
 public static function quota_display($attrib)
 {
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmquotadisplay';
     }
     $_SESSION['quota_display'] = !empty($attrib['display']) ? $attrib['display'] : 'text';
     $rcmail->output->add_gui_object('quotadisplay', $attrib['id']);
     $quota = $rcmail->quota_content($attrib);
     $rcmail->output->add_script('rcmail.set_quota(' . rcube_output::json_serialize($quota) . ');', 'docready');
     return html::span($attrib, ' ');
 }
 /**
  * Delete all stored env variables and commands
  */
 public function reset()
 {
     parent::reset();
     $this->object_handlers = array();
     $this->pagetitle = '';
 }
Example #4
0
 /**
  * Delete all stored env variables and commands
  */
 public function reset()
 {
     parent::reset();
     $this->js_env = array();
     $this->js_labels = array();
     $this->js_commands = array();
     $this->script_files = array();
     $this->scripts = array();
     $this->header = '';
     $this->footer = '';
     $this->body = '';
 }
Example #5
0
 /**
  * Template object for key generation form
  */
 function tpl_key_create_form($attrib)
 {
     $attrib += array('id' => 'rcmKeyCreateForm');
     $table = new html_table(array('cols' => 2));
     // get user's identities
     $identities = $this->rc->user->list_identities(null, true);
     // Identity
     $select = new html_select(array('name' => 'identity', 'id' => 'key-ident'));
     foreach ((array) $identities as $idx => $ident) {
         $name = empty($ident['name']) ? '<' . $ident['email'] . '>' : $ident['ident'];
         $select->add($name, $idx);
     }
     $table->add('title', html::label('key-name', rcube::Q($this->enigma->gettext('newkeyident'))));
     $table->add(null, $select->show(0));
     // Key size
     $select = new html_select(array('name' => 'size', 'id' => 'key-size'));
     $select->add($this->enigma->gettext('key2048'), '2048');
     $select->add($this->enigma->gettext('key4096'), '4096');
     $table->add('title', html::label('key-size', rcube::Q($this->enigma->gettext('newkeysize'))));
     $table->add(null, $select->show());
     // Password and confirm password
     $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass'))));
     $table->add(null, rcube_output::get_edit_field('password', '', array('id' => 'key-pass', 'size' => $attrib['size'], 'required' => true), 'password'));
     $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm'))));
     $table->add(null, rcube_output::get_edit_field('password-confirm', '', array('id' => 'key-pass-confirm', 'size' => $attrib['size'], 'required' => true), 'password'));
     $this->rc->output->add_gui_object('keyform', $attrib['id']);
     $this->rc->output->add_label('enigma.keygenerating', 'enigma.formerror', 'enigma.passwordsdiffer', 'enigma.keygenerateerror', 'enigma.nonameident', 'enigma.keygennosupport');
     return $this->rc->output->form_tag(array(), $table->show($attrib));
 }
Example #6
0
function rcmail_get_edit_field($col, $value, $attrib, $type = 'text')
{
    return rcube_output::get_edit_field($col, $value, $attrib, $type);
}
 /**
  * Build inline UI elements for iTip messages
  */
 public function mail_itip_inline_ui($event, $method, $mime_id, $task, $message_date = null, $preview_url = null)
 {
     $buttons = array();
     $dom_id = asciiwords($event['uid'], true);
     $rsvp_status = 'unknown';
     // pass some metadata about the event and trigger the asynchronous status check
     $changed = is_object($event['changed']) ? $event['changed'] : $message_date;
     $metadata = array('uid' => $event['uid'], '_instance' => $event['_instance'], 'changed' => $changed ? $changed->format('U') : 0, 'sequence' => intval($event['sequence']), 'method' => $method, 'task' => $task);
     // create buttons to be activated from async request checking existence of this event in local calendars
     $buttons[] = html::div(array('id' => 'loading-' . $dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading'));
     // on iTip REPLY we have two options:
     if ($method == 'REPLY') {
         $title = $this->gettext('itipreply');
         foreach ($event['attendees'] as $attendee) {
             if (!empty($attendee['email']) && $attendee['role'] != 'ORGANIZER' && (empty($event['_sender']) || ($attendee['email'] == $event['_sender'] || $attendee['email'] == $event['_sender_utf']))) {
                 $metadata['attendee'] = $attendee['email'];
                 $rsvp_status = strtoupper($attendee['status']);
                 if ($attendee['delegated-to']) {
                     $metadata['delegated-to'] = $attendee['delegated-to'];
                 }
                 break;
             }
         }
         // 1. update the attendee status on our copy
         $update_button = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('updateattendeestatus')));
         // 2. accept or decline a new or delegate attendee
         $accept_buttons = html::tag('input', array('type' => 'button', 'class' => "button accept", 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('acceptattendee')));
         $accept_buttons .= html::tag('input', array('type' => 'button', 'class' => "button decline", 'onclick' => "rcube_libcalendaring.decline_attendee_reply('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('declineattendee')));
         $buttons[] = html::div(array('id' => 'update-' . $dom_id, 'style' => 'display:none'), $update_button);
         $buttons[] = html::div(array('id' => 'accept-' . $dom_id, 'style' => 'display:none'), $accept_buttons);
     } else {
         if ($method == 'REQUEST') {
             $emails = $this->lib->get_user_emails();
             $title = $event['sequence'] > 0 ? $this->gettext('itipupdate') : $this->gettext('itipinvitation');
             $metadata['rsvp'] = true;
             $metadata['sensitivity'] = $event['sensitivity'];
             if (is_object($event['start'])) {
                 $metadata['date'] = $event['start']->format('U');
             }
             // check for X-KOLAB-INVITATIONTYPE property and only show accept/decline buttons
             if (self::get_custom_property($event, 'X-KOLAB-INVITATIONTYPE') == 'CONFIRMATION') {
                 $this->rsvp_actions = array('accepted', 'declined');
                 $metadata['nosave'] = true;
             }
             // 1. display RSVP buttons (if the user was invited)
             foreach ($this->rsvp_actions as $method) {
                 $rsvp_buttons .= html::tag('input', array('type' => 'button', 'class' => "button {$method}", 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}', '{$method}', '{$dom_id}')", 'value' => $this->gettext('itip' . $method)));
             }
             // add button to open calendar/preview
             if (!empty($preview_url)) {
                 $msgref = $this->lib->ical_message->folder . '/' . $this->lib->ical_message->uid . '#' . $mime_id;
                 $rsvp_buttons .= html::tag('input', array('type' => 'button', 'class' => "button preview", 'onclick' => "rcube_libcalendaring.open_itip_preview('" . rcube::JQ($preview_url) . "', '" . rcube::JQ($msgref) . "')", 'value' => $this->gettext('openpreview')));
             }
             // 2. update the local copy with minor changes
             $update_button = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('updatemycopy')));
             // 3. Simply import the event without replying
             $import_button = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('importtocalendar')));
             // check my status
             foreach ($event['attendees'] as $attendee) {
                 if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
                     $metadata['attendee'] = $attendee['email'];
                     $metadata['rsvp'] = $attendee['rsvp'] || $attendee['role'] != 'NON-PARTICIPANT';
                     $rsvp_status = !empty($attendee['status']) ? strtoupper($attendee['status']) : 'NEEDS-ACTION';
                     break;
                 }
             }
             // add itip reply message controls
             $rsvp_buttons .= html::div('itip-reply-controls', $this->itip_rsvp_options_ui($dom_id, $metadata['nosave']));
             $buttons[] = html::div(array('id' => 'rsvp-' . $dom_id, 'class' => 'rsvp-buttons', 'style' => 'display:none'), $rsvp_buttons);
             $buttons[] = html::div(array('id' => 'update-' . $dom_id, 'style' => 'display:none'), $update_button);
             // prepare autocompletion for delegation dialog
             if (in_array('delegated', $this->rsvp_actions)) {
                 $this->rc->autocomplete_init();
             }
         } else {
             if ($method == 'CANCEL') {
                 $title = $this->gettext('itipcancellation');
                 $event_prop = array_filter(array('uid' => $event['uid'], '_instance' => $event['_instance'], '_savemode' => $event['_savemode']));
                 // 1. remove the event from our calendar
                 $button_remove = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_libcalendaring.remove_from_itip(" . rcube_output::json_serialize($event_prop) . ", '{$task}', '" . rcube::JQ($event['title']) . "')", 'value' => $this->gettext('removefromcalendar')));
                 // 2. update our copy with status=cancelled
                 $button_update = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_libcalendaring.add_from_itip_mail('" . rcube::JQ($mime_id) . "', '{$task}')", 'value' => $this->gettext('updatemycopy')));
                 $buttons[] = html::div(array('id' => 'rsvp-' . $dom_id, 'style' => 'display:none'), $button_remove . $button_update);
                 $rsvp_status = 'CANCELLED';
                 $metadata['rsvp'] = true;
             }
         }
     }
     // append generic import button
     if ($import_button) {
         $buttons[] = html::div(array('id' => 'import-' . $dom_id, 'style' => 'display:none'), $import_button);
     }
     // pass some metadata about the event and trigger the asynchronous status check
     $metadata['fallback'] = $rsvp_status;
     $metadata['rsvp'] = intval($metadata['rsvp']);
     $this->rc->output->add_script("rcube_libcalendaring.fetch_itip_object_status(" . rcube_output::json_serialize($metadata) . ")", 'docready');
     // get localized texts from the right domain
     foreach (array('savingdata', 'deleteobjectconfirm', 'declinedeleteconfirm', 'declineattendee', 'cancel', 'itipdelegated', 'declineattendeeconfirm', 'itipcomment', 'delegateinvitation', 'delegateto', 'delegatersvpme', 'delegateinvalidaddress') as $label) {
         $this->rc->output->command('add_label', "itip.{$label}", $this->gettext($label));
     }
     // show event details with buttons
     return $this->itip_object_details_table($event, $title) . html::div(array('class' => 'itip-buttons', 'id' => 'itip-buttons-' . asciiwords($metadata['uid'], true)), join('', $buttons));
 }
 /**
  * Delete all stored env variables and commands
  */
 public function reset()
 {
     parent::reset();
     $this->texts = array();
     $this->commands = array();
 }
Example #9
0
function rcmail_get_edit_field($col, $value, $attrib, $type = 'text')
{
    _deprecation_warning(__FUNCTION__);
    return rcube_output::get_edit_field($col, $value, $attrib, $type);
}