/** * Output the html for an add contact form * * @param int $siteid - the site you want to add the contact to * @param string $mode - whether this is internal or external facing, defaults to internal * @return string $html add contact form html * @author Kieran Hogg */ function show_add_contact($siteid = 0, $mode = 'internal') { global $CONFIG; $returnpage = cleanvar($_REQUEST['return']); if (!empty($_REQUEST['name'])) { $name = explode(' ', cleanvar(urldecode($_REQUEST['name'])), 2); $_SESSION['formdata']['add_contact']['forenames'] = ucfirst($name[0]); $_SESSION['formdata']['add_contact']['surname'] = ucfirst($name[1]); } $html = show_form_errors('add_contact'); clear_form_errors('add_contact'); $html .= "<h2>" . icon('contact', 32) . " "; $html .= "{$GLOBALS['strNewContact']}</h2>"; if ($mode == 'internal') { $html .= "<h5 class='warning'>{$GLOBALS['strAvoidDupes']}</h5>"; } $html .= "<form name='contactform' action='{$_SERVER['PHP_SELF']}' "; $html .= "method='post' onsubmit=\"return confirm_action('{$GLOBALS['strAreYouSureAdd']}')\">"; $html .= "<table align='center' class='vertical'>"; $html .= "<tr><th>{$GLOBALS['strName']}</th>\n"; $html .= "<td>"; $html .= "\n<table><tr><td align='center'>{$GLOBALS['strTitle']}<br />"; $html .= "<input maxlength='50' name='courtesytitle' title=\""; $html .= "{$GLOBALS['strCourtesyTitle']}\" size='7'"; if ($_SESSION['formdata']['add_contact']['courtesytitle'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['courtesytitle']}'"; } $html .= "/></td>\n"; $html .= "<td align='center'>{$GLOBALS['strForenames']}<br />"; $html .= "<input class='required' maxlength='100' name='forenames' "; $html .= "size='15' title=\"{$GLOBALS['strForenames']}\""; if ($_SESSION['formdata']['add_contact']['forenames'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['forenames']}'"; } $html .= "/></td>\n"; $html .= "<td align='center'>{$GLOBALS['strSurname']}<br />"; $html .= "<input class='required' maxlength='100' name='surname' "; $html .= "size='20' title=\"{$GLOBALS['strSurname']}\""; if ($_SESSION['formdata']['add_contact']['surname'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['surname']}'"; } $html .= " /> <span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n"; $html .= "</table>\n</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strJobTitle']}</th><td><input maxlength='255'"; $html .= " name='jobtitle' size='35' title=\"{$GLOBALS['strJobTitle']}\""; if ($_SESSION['formdata']['add_contact']['jobtitle'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['jobtitle']}'"; } $html .= " /></td></tr>\n"; if ($mode == 'internal') { $html .= "<tr><th>{$GLOBALS['strSite']}</th><td>"; $html .= site_drop_down('siteid', $siteid, TRUE) . "<span class='required'>{$GLOBALS['strRequired']}</span></td></tr>\n"; } else { // For external always force the site to be the session site $html .= "<input type='hidden' name='siteid' value='{$_SESSION['siteid']}' />"; } $html .= "<tr><th>{$GLOBALS['strDepartment']}</th><td><input maxlength='255' name='department' size='35'"; if ($_SESSION['formdata']['add_contact']['department'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['department']}'"; } $html .= "/></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strEmail']}</th><td>"; $html .= "<input class='required' maxlength='100' name='email' size='35'"; if ($_SESSION['formdata']['add_contact']['email']) { $html .= "value='{$_SESSION['formdata']['add_contact']['email']}'"; } $html .= "/><span class='required'>{$GLOBALS['strRequired']}</span> "; $html .= "<label>"; $html .= html_checkbox('dataprotection_email', 'No'); $html .= "{$GLOBALS['strEmail']} {$GLOBALS['strDataProtection']}</label>" . help_link("EmailDataProtection"); $html .= "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strTelephone']}</th><td><input maxlength='50' name='phone' size='35'"; if ($_SESSION['formdata']['add_contact']['phone'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['phone']}'"; } $html .= "/> "; $html .= "<label>"; $html .= html_checkbox('dataprotection_phone', 'No'); $html .= "{$GLOBALS['strTelephone']} {$GLOBALS['strDataProtection']}</label>" . help_link("TelephoneDataProtection"); $html .= "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strMobile']}</th><td><input maxlength='100' name='mobile' size='35'"; if ($_SESSION['formdata']['add_contact']['mobile'] != '') { $html .= "value='{$_SESSION['formdata']['add_contact']['mobile']}'"; } $html .= "/></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strFax']}</th><td><input maxlength='50' name='fax' size='35'"; if ($_SESSION['formdata']['add_contact']['fax']) { $html .= "value='{$_SESSION['formdata']['add_contact']['fax']}'"; } $html .= "/></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strAddress']}</th><td><label>"; $html .= html_checkbox('dataprotection_address', 'No'); $html .= " {$GLOBALS['strAddress']} {$GLOBALS['strDataProtection']}</label>"; $html .= help_link("AddressDataProtection") . "</td></tr>\n"; $html .= "<tr><th></th><td><label><input type='checkbox' name='usesiteaddress' value='yes' onclick=\"\$('hidden').toggle();\" /> {$GLOBALS['strSpecifyAddress']}</label></td></tr>\n"; $html .= "<tbody id='hidden' style='display:none'>"; $html .= "<tr><th>{$GLOBALS['strAddress1']}</th>"; $html .= "<td><input maxlength='255' name='address1' size='35' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strAddress2']}</th>"; $html .= "<td><input maxlength='255' name='address2' size='35' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCity']}</th><td><input maxlength='255' name='city' size='35' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCounty']}</th><td><input maxlength='255' name='county' size='35' /></td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strCountry']}</th><td>"; $html .= country_drop_down('country', $CONFIG['home_country']) . "</td></tr>\n"; $html .= "<tr><th>{$GLOBALS['strPostcode']}</th><td><input maxlength='255' name='postcode' size='35' /></td></tr>\n"; $html .= "</tbody>"; if ($mode == 'internal') { $html .= "<tr><th>{$GLOBALS['strNotes']}</th><td><textarea cols='60' rows='5' name='notes'>"; if ($_SESSION['formdata']['add_contact']['notes'] != '') { $html .= $_SESSION['formdata']['add_contact']['notes']; } $html .= "</textarea></td></tr>\n"; } $html .= "<tr><th>{$GLOBALS['strEmailDetails']}</th>"; // Check the box to send portal details, only if portal is enabled $html .= "<td><input type='checkbox' name='emaildetails'"; if ($CONFIG['portal'] == TRUE) { $html .= " checked='checked'"; } else { $html .= " disabled='disabled'"; } $html .= ">"; $html .= "<label for='emaildetails'>{$GLOBALS['strEmailContactLoginDetails']}</td></tr>"; $html .= "</table>\n\n"; if (!empty($returnpage)) { $html .= "<input type='hidden' name='return' value='{$returnpage}' />"; } $html .= "<p><input name='submit' type='submit' value=\"{$GLOBALS['strAddContact']}\" /></p>"; $html .= "</form>\n"; //cleanup form vars clear_form_data('add_contact'); return $html; }
echo "value='{$_SESSION['formdata']['add_site']['department']}' /></td></tr>\n"; echo "<tr><th>{$strAddress1}</th><td>"; echo "<input class='required' maxlength='255' name='address1' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['address1']}' />"; echo " <span class='required'>{$strRequired}</span></td></tr>\n"; echo "<tr><th>{$strAddress2}</th><td><input maxlength='255' name='address2' size='30' "; echo "value='{$_SESSION['formdata']['add_site']['address2']}' /></td></tr>\n"; echo "<tr><th>{$strCity}</th><td><input maxlength='255' name='city' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['city']}' /></td></tr>\n"; echo "<tr><th>{$strCounty}</th><td><input maxlength='255' name='county' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['county']}' /></td></tr>\n"; echo "<tr><th>{$strCountry}</th><td>"; if ($_SESSION['formdata']['add_site']['country'] != '') { echo country_drop_down('country', $_SESSION['formdata']['add_site']['country']) . "</td></tr>\n"; } else { echo country_drop_down('country', $CONFIG['home_country']) . "</td></tr>\n"; } echo "<tr><th>{$strPostcode}</th><td><input maxlength='255' name='postcode' size='30'"; if ($_SESSION['formdata']['add_site']['postcode'] != '') { echo "value='{$_SESSION['formdata']['add_site']['postcode']}'"; } echo " /></td></tr>\n"; echo "<tr><th>{$strTelephone}</th><td><input maxlength='255' name='telephone' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['telephone']}' /></td></tr>\n"; echo "<tr><th>{$strEmail}</th><td>"; echo "<input class='required' maxlength='255' name='email' size='30'"; echo "value='{$_SESSION['formdata']['add_site']['email']}' />"; echo " <span class='required'>{$strRequired}</span></td></tr>\n"; echo "<tr><th></th><td><a href=\"javascript:void(0);\" onclick=\"\$('hidden').toggle();\">{$strMore}</a></td></tr>\n"; echo "<tbody id='hidden' class='hidden' style='display:none'>"; echo "<tr><th>{$strFax}</th><td><input maxlength='255' name='fax' size='30'";
echo "<input maxlength='255' id='address1' name='address1' size='40' value='{$contactrow['address1']}' {$extraattributes} />"; echo "</td></tr>\n"; echo "<tr><th>{$strAddress2}:</th><td>"; echo "<input maxlength='255' id='address2' name='address2' size='40' value='{$contactrow['address2']}' {$extraattributes} />"; echo "</td></tr>\n"; echo "<tr><th>{$strCity}:</th><td>"; echo "<input maxlength='255' id='city' name='city' size='40' value='{$contactrow['city']}' {$extraattributes} />"; echo "</td></tr>\n"; echo "<tr><th>{$strCounty}:</th><td>"; echo "<input maxlength='255' id='county' name='county' size='40' value='{$contactrow['county']}' {$extraattributes} />"; echo "</td></tr>\n"; echo "<tr><th>{$strPostcode}:</th><td>"; echo "<input maxlength='255' id='postcode' name='postcode' size='40' value='{$contactrow['postcode']}' {$extraattributes} />"; echo "</td></tr>\n"; echo "<tr><th>{$strCountry}:</th><td>"; echo country_drop_down('country', $contactrow['country'], $extraattributes); echo "</td></tr>\n"; echo "<tr><th>{$strNotifyContact}:</th><td>"; echo contact_site_drop_down('notify_contactid', $contactrow['notify_contactid'], $contactrow['siteid'], $contact, TRUE, TRUE); echo "</td></tr>\n"; echo "<tr><th>{$strNotes}:</th><td>"; echo "<textarea rows='5' cols='60' name='notes'>{$contactrow['notes']}</textarea></td></tr>\n"; plugin_do('edit_contact_form'); echo "</table>"; echo "<input name='contact' type='hidden' value='{$contact}' />"; echo "<p align='center'><input name='submit' type='submit' value='{$strSave}' /></p>"; echo "</form>\n"; } } else { if ($action == "update") { // External variables