diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-12-25 12:11:22 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-12-25 12:11:22 +0100 |
commit | c97625e02a95ebd995af8a06c27229581a071ddd (patch) | |
tree | 4d20bc9facef9e8cb0a9f2d6cdf9dea8fec17e7c /program/steps/addressbook/edit.inc | |
parent | da5fa28d5705ab2b9991f39741f2a8f1751a25ad (diff) |
CS fixes
Diffstat (limited to 'program/steps/addressbook/edit.inc')
-rw-r--r-- | program/steps/addressbook/edit.inc | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index b5f51d883..f7f0c7100 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/edit.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2007, The Roundcube Dev Team | + | Copyright (C) 2005-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -169,37 +169,56 @@ function rcmail_contact_editform($attrib) function rcmail_upload_photo_form($attrib) { - global $RCMAIL, $OUTPUT; - - // set defaults - $attrib += array('id' => 'rcmUploadform', 'buttons' => 'yes'); - - // find max filesize value - $max_filesize = parse_bytes(ini_get('upload_max_filesize')); - $max_postsize = parse_bytes(ini_get('post_max_size')); - if ($max_postsize && $max_postsize < $max_filesize) - $max_filesize = $max_postsize; - $max_filesize = $RCMAIL->show_bytes($max_filesize); - - $hidden = new html_hiddenfield(array('name' => '_cid', 'value' => $GLOBALS['cid'])); - $input = new html_inputfield(array('type' => 'file', 'name' => '_photo', 'size' => $attrib['size'])); - $button = new html_inputfield(array('type' => 'button')); - - $out = html::div($attrib, - $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), - $hidden->show() . - html::div(null, $input->show()) . - html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . - (rcube_utils::get_boolean($attrib['buttons']) ? html::div('buttons', - $button->show($RCMAIL->gettext('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . - $button->show($RCMAIL->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('upload-photo', this.form)")) - ) : '') - ) - ); - - $OUTPUT->add_label('addphoto','replacephoto'); - $OUTPUT->add_gui_object('uploadform', $attrib['id'].'Frm'); - return $out; + global $RCMAIL, $OUTPUT; + + // set defaults + $attrib += array('id' => 'rcmUploadform', 'buttons' => 'yes'); + + // find max filesize value + $max_filesize = parse_bytes(ini_get('upload_max_filesize')); + $max_postsize = parse_bytes(ini_get('post_max_size')); + + if ($max_postsize && $max_postsize < $max_filesize) { + $max_filesize = $max_postsize; + } + $max_filesize = $RCMAIL->show_bytes($max_filesize); + + $hidden = new html_hiddenfield(array('name' => '_cid', 'value' => $GLOBALS['cid'])); + $input = new html_inputfield(array('type' => 'file', 'name' => '_photo', 'size' => $attrib['size'])); + $button = new html_inputfield(array('type' => 'button')); + + $content = $hidden->show() . html::div(null, $input->show()) + . html::div('hint', $RCMAIL->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))); + + if (rcube_utils::get_boolean($attrib['buttons'])) { + $content .= html::div('buttons', + $button->show($RCMAIL->gettext('close'), array( + 'class' => 'button', + 'onclick' => "$('#$attrib[id]').hide()" + )) + . ' ' . + $button->show($RCMAIL->gettext('upload'), array( + 'class' => 'button mainaction', + 'onclick' => rcmail_output::JS_OBJECT_NAME . ".command('upload-photo', this.form)" + )) + ); + } + + $out = html::div($attrib, + $OUTPUT->form_tag(array( + 'id' => $attrib['id'] . 'Frm', + 'name' => 'uploadform', + 'method' => 'post', + 'enctype' => 'multipart/form-data' + ), + $content + ) + ); + + $OUTPUT->add_label('addphoto','replacephoto'); + $OUTPUT->add_gui_object('uploadform', $attrib['id'].'Frm'); + + return $out; } // similar function as in /steps/settings/edit_identity.inc |