From 7a95b148f87c6866988194225bb25c1ad09e1ef5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 27 Oct 2017 10:25:11 +0200 Subject: [PATCH] Add option to use "Personal" instead of "Personal Information" label in contact form We want short labels so tabs aren't wrapped on mobile --- program/steps/addressbook/edit.inc | 14 ++++++++------ program/steps/addressbook/show.inc | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc index 5847f54f0..5fcdcd1c6 100644 --- a/program/steps/addressbook/edit.inc +++ b/program/steps/addressbook/edit.inc @@ -140,12 +140,14 @@ function rcmail_contact_editform($attrib) $record = rcmail_get_edit_record(); // copy (parsed) address template to client - if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER)) - $RCMAIL->output->set_env('address_template', $templ); + if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER)) { + $RCMAIL->output->set_env('address_template', $templ); + } - $i_size = $attrib['size'] ?: 40; - $t_rows = $attrib['textarearows'] ?: 10; - $t_cols = $attrib['textareacols'] ?: 40; + $i_size = $attrib['size'] ?: 40; + $t_rows = $attrib['textarearows'] ?: 10; + $t_cols = $attrib['textareacols'] ?: 40; + $short_labels = rcube_utils::get_boolean($attrib['short-legend-labels']); $form = array( 'contact' => array( @@ -159,7 +161,7 @@ function rcmail_contact_editform($attrib) ), ), 'personal' => array( - 'name' => $RCMAIL->gettext('personalinfo'), + 'name' => $RCMAIL->gettext($short_labels ? 'personal' : 'personalinfo'), 'content' => array( 'gender' => array('visible' => true), 'maidenname' => array('size' => $i_size), diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc index 516646fec..24990ac48 100644 --- a/program/steps/addressbook/show.inc +++ b/program/steps/addressbook/show.inc @@ -98,7 +98,8 @@ function rcmail_contact_details($attrib) return false; } - $i_size = $attrib['size'] ?: 40; + $i_size = $attrib['size'] ?: 40; + $short_labels = rcube_utils::get_boolean($attrib['short-legend-labels']); $form = array( 'contact' => array( @@ -112,7 +113,7 @@ function rcmail_contact_details($attrib) ), ), 'personal' => array( - 'name' => $RCMAIL->gettext('personalinfo'), + 'name' => $RCMAIL->gettext($short_labels ? 'personal' : 'personalinfo'), 'content' => array( 'gender' => array('size' => $i_size), 'maidenname' => array('size' => $i_size),