1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Issue #4372 Extra fields.

This commit is contained in:
Cameron
2021-02-16 09:22:12 -08:00
parent f8cc691941
commit 5b9ecd2200
4 changed files with 36 additions and 19 deletions

View File

@@ -506,21 +506,24 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
</colgroup>
<tr>";
$text .= "<td>Company</td>
<td>".$frm->text('contact_info[company]', varset($pref['contact_info']['company']), 200, ['size'=>'block-level', 'placeholder'=>'My Company'])."</td>
$text .= "<td>Organization</td>
<td>".$frm->text('contact_info[organization]', varset($pref['contact_info']['organization']), 200, ['size'=>'block-level', 'placeholder'=>'eg. My Company Inc.'])."</td>
</tr>";
$text .= "<td>Address</td>
<td>".$frm->textarea('contact_info[address]', varset($pref['contact_info']['address']), 2, 80, ['size'=>'block-level', 'placeholder'=>'123 address st. city, state, zip/postal, country'])."</td>
<td>".$frm->textarea('contact_info[address]', varset($pref['contact_info']['address']), 2, 80, ['size'=>'block-level', 'placeholder'=>"eg. 123 Address St.\nCity, State, Zip/postal\nCountry"])."</td>
</tr>";
$contactFields = [
'phone1' => ['label'=>'Phone', 'placeholder'=>'+1-555-555-5555'],
'phone2' => ['label'=>'Phone', 'placeholder'=>'+1-444-444-4444'],
'phone3' => ['label'=>'Phone', 'placeholder'=>'+1-333-333-3333'],
'fax' => ['label'=>'Fax', 'placeholder'=>'+1-555-555-5555'],
'email1' => ['label'=>LAN_EMAIL, 'placeholder'=>'info@mycompany.com'],
'email2' => ['label'=>LAN_EMAIL, 'placeholder'=>'sales@mycompany.com']
'email1' => ['label'=>LAN_EMAIL, 'placeholder'=>'info@myorganization.com'],
'email2' => ['label'=>LAN_EMAIL, 'placeholder'=>'sales@myorganization.com'],
'coordinates' => ['label'=>"Map Coordinates", 'placeholder'=>'eg. 36.169941,-115.139832 or leave blank to use address'],
];
foreach($contactFields as $type => $var)
@@ -531,7 +534,13 @@ $text .= "<fieldset class='e-hideme' id='core-prefs-email'>
";
}
$text .= "<td>Hours</td>
<td>".$frm->textarea('contact_info[hours]', varset($pref['contact_info']['hours']), 2, 80, ['size'=>'block-level', 'placeholder'=>"eg. Mon - Fri (9am-5pm)\nSat (closed)\nSun (closed)"])."</td>
</tr>";
$text .= "<td>Custom message</td>
<td>".$frm->textarea('contact_info[message]', varset($pref['contact_info']['message']), 2, 80, ['size'=>'block-level', 'placeholder'=>"(Optional) Custom text message."])."</td>
</tr>";
$text .= "</table>";

View File

@@ -107,12 +107,14 @@ class contact_shortcodes extends e_shortcode
{
$pref = e107::getPref('contact_info');
if(empty($pref['address']))
if(empty($pref['address']) && empty($pref['coordinates']))
{
return null;
}
$address = trim($pref['address']);
$address = !empty($pref['coordinates']) ? $pref['coordinates'] : $pref['address'];
$address = trim($address);
$address = str_replace("\n", " ", $address);
$zoom = varset($parm['zoom'], 'street');
@@ -127,7 +129,7 @@ class contact_shortcodes extends e_shortcode
// &z='.$zoom.'
return '<iframe class="sc-contact-map" src="https://maps.google.com/maps?q='.$address.'&output=embed&z='.$zoom.'"></iframe>';
return '<iframe class="sc-contact-map" src="https://www.google.com/maps?q='.$address.'&output=embed&z='.$zoom.'"></iframe>';
}
@@ -146,7 +148,7 @@ class contact_shortcodes extends e_shortcode
switch($type)
{
case "company":
case "organization":
$ret = $tp->toHTML($ipref[$type], true, 'TITLE');
break;
@@ -195,7 +197,7 @@ class contact_shortcodes extends e_shortcode
{
$class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
$placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : '';
$value = !empty($_POST['subject']) ? e107::getParser()->filter($_POST['subject'], 'str') : '';
$value = !empty($_POST['subject']) ? e107::getParser()->filter($_POST['subject']) : '';
return "<input type='text' id='contactSubject' title='".LANCONTACT_19."' name='subject' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
}
@@ -249,11 +251,12 @@ class contact_shortcodes extends e_shortcode
$pp = e107::getParser()->replaceConstants($pp, 'full');
$class = (!empty($parm['class'])) ? $parm['class'] : '';
$link = sprintf('<span class="%s"><a href="%s" target="_blank">%s</a></span>', $class, $pp, LANCONTACT_22);
$text = e107::getParser()->lanVars(LANCONTACT_23, $link);
return $text;
return e107::getParser()->lanVars(LANCONTACT_23, $link);
}
}
?>

View File

@@ -13,7 +13,8 @@
if (!defined('e107_INIT')) { exit; }
$CONTACT_WRAPPER['info']['CONTACT_INFO'] = "<div>{---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=company'] = "<h4>{---}</h4>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=organization'] = "<h4>{---}</h4>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=message'] = "<p>{---}</p>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=address'] = "<address>{GLYPH=fa-map-marker} {---}</address>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email1'] = "<div>{GLYPH=fa-envelope} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email2'] = "<div>{GLYPH=fa-envelope} {---}</div>";
@@ -21,6 +22,7 @@ $CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "<div>{GLYPH=fas-phone-a
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=fax'] = "<div>{GLYPH=fa-fax} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=hours'] = "<div>{GLYPH=fa-clock} {---}</div>";
$CONTACT_TEMPLATE['info'] = "
@@ -29,9 +31,10 @@ $CONTACT_TEMPLATE['info'] = "
<!-- Backward Compat. Contact Info -->
{SITECONTACTINFO}
<!-- New Contact Info -->
{CONTACT_INFO: type=company}
{CONTACT_INFO: type=organization}
{CONTACT_INFO: type=message}
<div class='row'>
<div class ='col-md-6 col-lg-4 h=100'>
<div class ='col-md-6 col-lg-4'>
{CONTACT_INFO: type=address}
<div class='form-group'>
{CONTACT_INFO: type=phone1}
@@ -41,8 +44,10 @@ $CONTACT_TEMPLATE['info'] = "
</div>
{CONTACT_INFO: type=email1}
{CONTACT_INFO: type=email2}
<br />
{CONTACT_INFO: type=hours}
</div>
<div class ='col-md-6 col-lg-8 h=100'>
<div class ='col-md-6 col-lg-8 flex-row'>
{CONTACT_MAP: zoom=city}
</div>
</div>

View File

@@ -381,8 +381,8 @@ cursor: pointer;
#uiAlert { z-index: 10001 }
#uiAlert .alert { z-index:10000; box-shadow:1px 4px 5px rgba(0,0,0,0.4) }
#uiAlert.notifications { top: 48%; left: 0; width: 100%; }
#contactInfo iframe.sc-contact-map { width:100%; min-height:195px }
#contactInfo .row { display: flex }
#contactInfo iframe.sc-contact-map { width:100%; height:100%; }
#login-template { max-width: 330px; margin-right: auto; margin-left: auto; }