tag
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style'));
$out = '\n";
if (is_array($_SESSION['compose']['attachments']))
{
if ($attrib['deleteicon'])
$button = sprintf(' ',
$CONFIG['skin_path'],
$attrib['deleteicon'],
rcube_label('delete'));
else
$button = rcube_label('delete');
foreach ($_SESSION['compose']['attachments'] as $id => $a_prop)
$out .= sprintf('%s %s ',
$id,
JS_OBJECT_NAME,
$id,
Q(rcube_label('delete')),
$button,
Q($a_prop['name']));
}
$OUTPUT->add_gui_object('attachmentlist', $attrib['id']);
$out .= ' ';
return $out;
}
function rcmail_compose_attachment_form($attrib)
{
global $OUTPUT, $SESS_HIDDEN_FIELD;
// add ID if not given
if (!$attrib['id'])
$attrib['id'] = 'rcmUploadbox';
// allow the following attributes to be added to the tag
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style'));
$input_field = rcmail_compose_attachment_field(array());
$label_send = rcube_label('upload');
$label_close = rcube_label('close');
$js_instance = JS_OBJECT_NAME;
$out = <<
EOF;
$OUTPUT->add_gui_object('uploadbox', $attrib['id']);
return $out;
}
function rcmail_compose_attachment_field($attrib)
{
// allow the following attributes to be added to the tag
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size'));
$out = ' ";
return $out;
}
function rcmail_priority_selector($attrib)
{
list($form_start, $form_end) = get_form_tags($attrib);
unset($attrib['form']);
$attrib['name'] = '_priority';
$selector = new select($attrib);
$selector->add(array(rcube_label('lowest'),
rcube_label('low'),
rcube_label('normal'),
rcube_label('high'),
rcube_label('highest')),
array(5, 4, 0, 2, 1));
$sel = isset($_POST['_priority']) ? $_POST['_priority'] : 0;
$out = $form_start ? "$form_start\n" : '';
$out .= $selector->show($sel);
$out .= $form_end ? "\n$form_end" : '';
return $out;
}
function rcmail_receipt_checkbox($attrib)
{
list($form_start, $form_end) = get_form_tags($attrib);
unset($attrib['form']);
if (!isset($attrib['id']))
$attrib['id'] = 'receipt';
$attrib['name'] = '_receipt';
$attrib['value'] = '1';
$checkbox = new checkbox($attrib);
$out = $form_start ? "$form_start\n" : '';
$out .= $checkbox->show(0);
$out .= $form_end ? "\n$form_end" : '';
return $out;
}
function rcmail_editor_selector($attrib)
{
global $CONFIG, $MESSAGE, $compose_mode;
if (!$CONFIG['enable_htmleditor'])
return '';
$choices = array(
'html' => 'htmltoggle',
'plain' => 'plaintoggle'
);
// determine whether HTML or plain text should be checked
if ($CONFIG['htmleditor'])
$useHtml = true;
else
$useHtml = false;
if ($compose_mode == RCUBE_COMPOSE_REPLY ||
$compose_mode == RCUBE_COMPOSE_FORWARD ||
$compose_mode == RCUBE_COMPOSE_DRAFT)
{
$hasHtml = rcmail_has_html_part($MESSAGE['parts']);
$useHtml = ($hasHtml && $CONFIG['htmleditor']);
}
$selector = '';
$attrib['name'] = '_editorSelect';
$attrib['onchange'] = 'return rcmail_toggle_editor(this)';
foreach ($choices as $value => $text)
{
$checked = '';
if ((($value == 'html') && $useHtml) ||
(($value != 'html') && !$useHtml))
$attrib['checked'] = 'true';
else
unset($attrib['checked']);
$attrib['id'] = '_' . $value;
$rb = new radiobutton($attrib);
$selector .= sprintf("%s%s ",
$rb->show($value),
$attrib['id'],
rcube_label($text));
}
return $selector;
}
function get_form_tags($attrib)
{
global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD;
$form_start = '';
if (!strlen($MESSAGE_FORM))
{
$hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
$hiddenfields->add(array('name' => '_action', 'value' => 'send'));
$form_start = empty($attrib['form']) ? '