From f94e442469deca30b39f3fa08aade83cbd0ede70 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 16 Dec 2011 18:38:59 +0000 Subject: Add more classes and options to HTML elements for better styleability --- program/steps/mail/attachments.inc | 2 ++ program/steps/mail/compose.inc | 19 +++++++++---------- program/steps/mail/func.inc | 2 ++ program/steps/mail/show.inc | 8 +------- 4 files changed, 14 insertions(+), 17 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc index ed4a81186..52de1c1f8 100644 --- a/program/steps/mail/attachments.inc +++ b/program/steps/mail/attachments.inc @@ -126,6 +126,7 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { 'href' => "#delete", 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id), 'title' => rcube_label('delete'), + 'class' => 'delete', ), $button); $content .= Q($attachment['name']); @@ -134,6 +135,7 @@ if (is_array($_FILES['_attachments']['tmp_name'])) { 'html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], + 'classname' => rcmail_filetype2classname($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid); } else { // upload failed diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 08503227c..76ff31d3c 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1233,16 +1233,16 @@ function rcmail_compose_attachment_list($attrib) else $button = Q(rcube_label('delete')); - foreach ($COMPOSE['attachments'] as $id => $a_prop) - { + foreach ($COMPOSE['attachments'] as $id => $a_prop) { if (empty($a_prop)) continue; - $out .= html::tag('li', array('id' => 'rcmfile'.$id), + $out .= html::tag('li', array('id' => 'rcmfile'.$id, 'class' => rcmail_filetype2classname($a_prop['mimetype'], $a_prop['name'])), html::a(array( 'href' => "#delete", 'title' => rcube_label('delete'), - 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id)), + 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id), + 'class' => 'delete'), $button) . Q($a_prop['name'])); $jslist['rcmfile'.$id] = array('name' => $a_prop['name'], 'complete' => true, 'mimetype' => $a_prop['mimetype']); @@ -1267,9 +1267,8 @@ function rcmail_compose_attachment_form($attrib) { global $RCMAIL, $OUTPUT; - // add ID if not given - if (!$attrib['id']) - $attrib['id'] = 'rcmUploadbox'; + // set defaults + $attrib += array('id' => 'rcmUploadbox', 'buttons' => 'yes'); // Get filesize, enable upload progress bar $max_filesize = rcube_upload_init(); @@ -1280,14 +1279,14 @@ function rcmail_compose_attachment_form($attrib) $OUTPUT->form_tag(array('name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), html::div(null, rcmail_compose_attachment_field(array('size' => $attrib['attachmentfieldsize']))) . html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . - html::div('buttons', + (get_boolean($attrib['buttons']) ? html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)")) - ) + ) : '') ) ); - $OUTPUT->add_gui_object('uploadbox', $attrib['id']); + $OUTPUT->add_gui_object('uploadform', $attrib['id']); return $out; } diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 857ecd3f6..d44e9c3d5 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -379,6 +379,8 @@ function rcmail_message_list_head($attrib, $a_show_cols) // make sort links if (in_array($col, $a_sort_cols)) $col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => rcube_label('sortby')), $col_name); + else if ($col_name[0] != '<') + $col_name = '' . $col_name . ''; $sort_class = $col == $sort_col ? " sorted$sort_order" : ''; $class_name = $col.$sort_class; diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 46a5597d1..aee563d52 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -130,13 +130,7 @@ function rcmail_message_attachments($attrib) $title = ''; } - $classes = array($attach_prop->ctype_primary ? $attach_prop->ctype_primary : 'unknown'); - if ($attach_prop->ctype_secondary) - $classes[] = $attach_prop->ctype_secondary; - if (preg_match('/\.([a-z0-9]+)$/', $attach_prop->filename, $m)) - $classes[] = $m[1]; - - $ol .= html::tag('li', join(' ', $classes), + $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $attach_prop->filename), html::a(array( 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'onclick' => sprintf( -- cgit v1.2.3