Fax Server: Added ability to select an existing Contact as the fax Recipient.

Updated jquery.autosize.input.js to latest version.
This commit is contained in:
Nate Jones
2014-09-05 02:29:29 +00:00
parent 92de1d3f6d
commit 7c0d9e440d
3 changed files with 192 additions and 113 deletions

View File

@@ -258,7 +258,7 @@
$text['label-file']['pt-pt'] = "Ficheiro não encontrado.";
$text['label-file']['fr-fr'] = "Fichier non trové";
$text['description-2']['en-us'] = "To send a fax, upload a <strong>PDF</strong> or <strong>TIF</strong> file.";
$text['description-2']['en-us'] = "To send a fax, upload a <strong>PDF</strong> or <strong>TIF</strong> (requires LibreOffice) file.";
$text['description-2']['es-cl'] = "Para enviar un fax puede subir un archivo .tif o si ghost script está instalado entonces también puede enviar un fax subiendo un archivo PDF.";
$text['description-2']['pt-pt'] = "Para enviar um fax pode carregar um ficheiro .tif ou, se o ghost script tiver sido instalado, enviar um fax, carregando um ficheiro .pdf.";
$text['description-2']['fr-fr'] = "Pour envoyer un fax, vous pouvez télécharger un fichier <b>TIF</b>. Si ghost script a été installé, vous pouvez également utiliser un fichier <b>PDF</b>.";

View File

@@ -654,7 +654,78 @@ else {
echo " ".$text['label-fax-recipient']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input type='text' name='fax_recipient' class='formfld' style='' value=''>\n";
//javascript to toggle input/select boxes
echo "<script type='text/javascript'>";
echo " function toggle(field) {";
echo " if (field == 'to') {";
echo " document.getElementById('fax_recipient_select').selectedIndex = 0;";
echo " $('#fax_recipient_select').toggle();";
echo " $('#fax_recipient').toggle();";
echo " if ($('#fax_recipient').is(':visible')) { $('#fax_recipient').focus(); } else { $('#fax_recipient_select').focus(); }";
echo " }";
echo " }";
echo "</script>";
?>
<script>
function contact_load(obj_sel) {
obj_sel.style.display='none';
document.getElementById('fax_recipient').style.display='';
var selected_option_value = obj_sel.options[obj_sel.selectedIndex].value;
var selected_option_values = selected_option_value.split('|', 2);
document.getElementById('fax_recipient').value = selected_option_values[1];
document.getElementById('fax_number').value = selected_option_values[0];
$("#fax_recipient").css({width: '50%'});
$("#fax_number").css({width: '120px'});
}
</script>
<?
echo " <select class='formfld' style='display: none;' id='fax_recipient_select' onchange='contact_load(this);'>\n";
echo " <option value=''></option>\n";
$sql = "select ";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family, ";
$sql .= "c.contact_nickname, ";
$sql .= "cp.phone_number ";
$sql .= "from ";
$sql .= "v_contacts as c, ";
$sql .= "v_contact_phones as cp ";
$sql .= "where ";
$sql .= "c.contact_uuid = cp.contact_uuid and ";
$sql .= "c.domain_uuid = '".$_SESSION['domain_uuid']."' and ";
$sql .= "cp.domain_uuid = '".$_SESSION['domain_uuid']."' and ";
$sql .= "cp.phone_type = 'fax' and ";
$sql .= "cp.phone_number is not null and ";
$sql .= "cp.phone_number <> '' ";
$sql .= "order by ";
$sql .= "c.contact_organization asc, ";
$sql .= "c.contact_name_given asc, ";
$sql .= "c.contact_name_family asc ";
echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement -> execute();
$result_e = $prep_statement -> fetchAll(PDO::FETCH_NAMED);
foreach ($result_e as &$row) {
if ($row['contact_organization'] != '') {
$contact_option_label = $row['contact_organization'];
}
if ($row['contact_name_given'] != '' || $row['contact_name_family'] != '' || $row['contact_nickname'] != '') {
$contact_option_label .= ($row['contact_organization'] != '') ? "," : null;
$contact_option_label .= ($row['contact_name_given'] != '') ? " ".$row['contact_name_given'] : null;
$contact_option_label .= ($row['contact_name_family'] != '') ? " ".$row['contact_name_family'] : null;
$contact_option_label .= ($row['contact_nickname'] != '') ? " (".$row['contact_nickname'].")" : null;
}
$contact_option_value_recipient = $contact_option_label;
$contact_option_value_faxnumber = $row['phone_number'];
$contact_option_label .= ":&nbsp;&nbsp;".format_phone($row['phone_number']);
echo " <option value=\"".$contact_option_value_faxnumber."|".$contact_option_value_recipient."\">".$contact_option_label."</option>\n";
unset($contact_option_label);
}
unset ($prep_statement);
echo " </select>\n";
echo " <input type='text' name='fax_recipient' id='fax_recipient' class='formfld' style='' value=''>\n";
echo " <input type='button' id='btn_toggle_recipient' class='btn' name='' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle('to');\">\n";
echo " <br />\n";
echo " ".$text['description-fax-recipient']."\n";
echo "</td>\n";
@@ -665,7 +736,7 @@ else {
echo " ".$text['label-fax-number']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input type='text' name='fax_number' class='formfld' style='' value=''>\n";
echo " <input type='text' name='fax_number' id='fax_number' class='formfld' style='' value=''>\n";
echo " <br />\n";
echo " ".$text['description-fax-number']."\n";
echo "</td>\n";