Added a page to allow Editing existing Lead Loader Templates.

git-svn-id: svn://192.168.202.10@3377 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-03-13 00:44:36 +00:00
parent 11e2ad38b3
commit 515d4a9051
4 changed files with 367 additions and 21 deletions
+2
View File
@@ -594,6 +594,8 @@ OTHER CHANGES:
until the user logs out. For more information, read the
2FA_TWO_FACTOR_AUTHENTICATION.txt document.
167. Added a page to allow Editing existing Lead Loader Templates.
@@ -1,7 +1,7 @@
<?php
# AST_admin_template_maker.php - version 2.14
#
# Copyright (C) 2018 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 120402-2132 - First Build
@@ -17,6 +17,7 @@
# 180324-0942 - Enforce User Group campaign permissions for templates based on list_id
# 180503-2215 - Added new help display
# 180927-0633 - Fix for deleted template function in alternate language, issue #1127
# 210312-1700 - Added layout editing functionality
#
require("dbconnect_mysqli.php");
@@ -48,6 +49,12 @@ if (isset($_GET["custom_fields_layout"])) {$custom_fields_layout=$_GET["custo
elseif (isset($_POST["custom_fields_layout"])) {$custom_fields_layout=$_POST["custom_fields_layout"];}
if (isset($_GET["submit_template"])) {$submit_template=$_GET["submit_template"];}
elseif (isset($_POST["submit_template"])) {$submit_template=$_POST["submit_template"];}
if (isset($_GET["submit_edited_template"])) {$submit_edited_template=$_GET["submit_edited_template"];}
elseif (isset($_POST["submit_edited_template"])) {$submit_edited_template=$_POST["submit_edited_template"];}
if (isset($_GET["edit_standard_fields_layout"])) {$edit_standard_fields_layout=$_GET["edit_standard_fields_layout"];}
elseif (isset($_POST["edit_standard_fields_layout"])) {$edit_standard_fields_layout=$_POST["edit_standard_fields_layout"];}
if (isset($_GET["edit_custom_fields_layout"])) {$edit_custom_fields_layout=$_GET["edit_custom_fields_layout"];}
elseif (isset($_POST["edit_custom_fields_layout"])) {$edit_custom_fields_layout=$_POST["edit_custom_fields_layout"];}
if (isset($_GET["delete_template"])) {$delete_template=$_GET["delete_template"];}
elseif (isset($_POST["delete_template"])) {$delete_template=$_POST["delete_template"];}
@@ -98,6 +105,30 @@ $template_description = preg_replace("/'|\"|\\\\|;/","",$template_description);
$standard_fields_layout = preg_replace("/'|\"|\\\\|;/","",$standard_fields_layout);
$custom_table = preg_replace("/'|\"|\\\\|;/","",$custom_table);
$custom_fields_layout = preg_replace("/'|\"|\\\\|;/","",$custom_fields_layout);
$edit_standard_fields_layout = preg_replace("/'|\"|\\\\|;/","",$edit_standard_fields_layout);
$edit_custom_fields_layout = preg_replace("/'|\"|\\\\|;/","",$edit_custom_fields_layout);
if ($submit_edited_template)
{
$upd_stmt="update vicidial_custom_leadloader_templates set template_name='$template_name', template_description='$template_description', standard_variables='$edit_standard_fields_layout', custom_variables='$edit_custom_fields_layout' where template_id='$template_id' limit 1";
$upd_rslt=mysql_to_mysqli($upd_stmt, $link);
if (mysqli_affected_rows($link)>0)
{
$success_msg=_QXZ("TEMPLATE UPDATED");
if (!$edit_custom_fields_layout)
{
$success_msg.="<BR/>**"._QXZ("NO CUSTOM FIELDS ASSIGNED")."**";
}
}
else
{
$errno = mysqli_errno($link);
if ($errno > 0)
{$error = mysqli_error($link);}
$error_msg=_QXZ("TEMPLATE UPDATE FAILED")."<br>\n$errno - $error<br>\n[$upd_stmt]";
}
}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
@@ -311,6 +342,77 @@ function DisplayTemplateFields(list_id) {
}
function EditTemplate(template_id) {
if (!template_id || template_id=="")
{
return false;
}
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp) {
var vs_query = "&template_id="+template_id+"&form_action=update_template";
// alert(vs_query);
xmlhttp.open('POST', 'leadloader_template_display.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(vs_query);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var StatSpanText = null;
StatSpanText = xmlhttp.responseText;
// alert(StatSpanText);
var output_array=StatSpanText.split("\|\|\|");
document.getElementById("statuses_display").innerHTML = output_array[0];
document.getElementById("field_display").innerHTML = output_array[1];
if (output_array[1]=="") {
document.getElementById('edit_data_display').style.display = 'none';
document.getElementById('edit_data_display').style.visibility = 'hidden';
} else {
document.getElementById('list_data_display').style.display = 'none';
document.getElementById('list_data_display').style.visibility = 'hidden';
document.getElementById('edit_data_display').style.display = 'block';
document.getElementById('edit_data_display').style.visibility = 'visible';
}
}
}
delete xmlhttp;
}
}
function EditTemplateStrings() {
var vicidial_string="<?php echo $vicidial_listloader_fields; ?>";
var standard_string = '';
var custom_string = '';
for (var i = 0; i<document.listloader_template_edit_form.elements.length; i++) {
if (document.listloader_template_edit_form.elements[i].type == 'text' && document.listloader_template_edit_form.elements[i].value!="" && document.listloader_template_edit_form.elements[i].name!="template_list_id" && document.listloader_template_edit_form.elements[i].name!="template_id" && document.listloader_template_edit_form.elements[i].name!="template_name" && document.listloader_template_edit_form.elements[i].name!="template_description" && document.listloader_template_edit_form.elements[i].name!="edit_standard_fields_layout" && document.listloader_template_edit_form.elements[i].name!="edit_custom_fields_layout")
{
var field_name=document.listloader_template_edit_form.elements[i].name.replace("_field", "");
var field_value=document.listloader_template_edit_form.elements[i].value.replace(/\D/g,'');
var ptn="/\|"+field_name+"\|/gi";
if (vicidial_string.match(ptn))
{
standard_string += field_name +","+ field_value + '|';
}
else
{
custom_string += field_name +","+ field_value + '|';
}
}
}
document.getElementById("edit_standard_fields_layout").value=standard_string;
document.getElementById("edit_custom_fields_layout").value=custom_string;
}
function DrawTemplateStrings() {
var vicidial_string="<?php echo $vicidial_listloader_fields; ?>";
var standard_string = '';
@@ -342,6 +444,8 @@ function loadIFrame(form_action, field_value) {
} else {
document.getElementById('list_data_display').style.display = 'block';
document.getElementById('list_data_display').style.visibility = 'visible';
document.getElementById('edit_data_display').style.display = 'none';
document.getElementById('edit_data_display').style.visibility = 'hidden';
}
document.forms[0].action="leadloader_template_display.php?form_action="+form_action;
}
@@ -352,8 +456,18 @@ function checkForm(form_name) {
if (form_name.template_name.value=="") {error_msg += " - <?php echo _QXZ("Template name is missing"); ?>\n";}
if (form_name.template_list_id.value=="") {error_msg += " - <?php echo _QXZ("List ID is missing"); ?>\n";}
if (form_name.standard_fields_layout.value=="" && form_name.custom_fields_layout.value=="") {error_msg += " - <?php echo _QXZ("There does not seem to be a layout"); ?>\n";}
return false;
if (error_msg.length>=80) {alert(error_msg); return false;} else {return true;}
}
function checkEditedForm(form_name) {
var error_msg = "";
if (form_name.template_id.value=="") {error_msg += " - <?php echo _QXZ("Template ID is missing"); ?>\n";}
else if (form_name.template_id.value.length<2) {error_msg += " - <?php echo _QXZ("Template ID needs to be at least 2 characters long"); ?>\n";}
if (form_name.template_name.value=="") {error_msg += " - <?php echo _QXZ("Template name is missing"); ?>\n";}
if (form_name.edit_standard_fields_layout.value=="" && form_name.edit_custom_fields_layout.value=="") {error_msg += " - <?php echo _QXZ("There does not seem to be a layout"); ?>\n";}
if (error_msg.length>0) {alert("<?php echo _QXZ("The form cannot be submitted for the following reasons"); ?>: \n"+error_msg); return false;} else {form_name.submit();}
}
</script>
</script>
<?php
@@ -400,7 +514,7 @@ $short_header=1;
require("admin_header.php");
?>
<BR/>
<table border="2" bordercolor="#<?php echo $SSmenu_background; ?>" cellpadding="10" width="800" align="left">
<table border="2" bordercolor="#<?php echo $SSmenu_background; ?>" cellpadding="10" width="900" align="left">
<tr height="20"><th bgcolor="#<?php echo $SSmenu_background; ?>"><font class="standard_bold" color="#FFFFFF"><?php echo _QXZ("Listloader Custom Template Maker"); ?><?php echo "$NWB#vicidial_template_maker$NWE"; ?></font></th></tr>
<tr><td align="center" bgcolor="#<?php echo $SSstd_row4_background; ?>">
<table border=0 cellpadding=15 cellspacing=0 width="90%" align="center" bgcolor="#<?php echo $SSframe_background; ?>">
@@ -420,14 +534,14 @@ if ($success_msg)
?>
<tr>
<th width="50%"><font class="standard_bold"><?php echo _QXZ("Create a new template"); ?></font></th>
<th width="50%"><font class="standard_bold"><?php echo _QXZ("Delete an existing template"); ?></font></th>
<th width="50%"><font class="standard_bold"><?php echo _QXZ("Edit / delete an existing template"); ?></font></th>
<tr valign="top">
<td align="left" width='50%'>
<form id="listloader_file_primer" action="leadloader_template_display.php?form_action=prime_file" method="post" enctype="multipart/form-data" target="file_holder">
<font class="standard"><?php echo _QXZ("Sample file fitting template"); ?>:<BR><font size="-2">(<?php echo _QXZ("needed for field assignation"); ?>)</font></font><?php echo "$NWB#template_maker-create_template$NWE"; ?><BR><BR><input type=file name="sample_template_file" value="<?php echo $sample_template_file; ?>" onChange="loadIFrame('prime_file', this.value); this.form.submit();">
</form>
</td>
<td align="left" width='50%'><form action="<?php echo $PHP_SELF; ?>" method="post"><font class="standard"><?php echo _QXZ("Select template to delete"); ?>:</font><?php echo "$NWB#template_maker-delete_template$NWE"; ?><BR><select name="template_id" onChange="loadIFrame('hide_new_template_form', '')">
<td align="left" width='50%'><form action="<?php echo $PHP_SELF; ?>" method="post"><font class="standard"><?php echo _QXZ("Select template to edit/delete"); ?>:</font><?php echo "$NWB#template_maker-delete_template$NWE"; ?><BR><select name="template_id" onChange="loadIFrame('hide_new_template_form', '')">
<?php
$template_stmt="SELECT template_id, template_name FROM vicidial_custom_leadloader_templates WHERE list_id IN (SELECT list_id FROM vicidial_lists $whereLOGallowed_campaignsSQL) ORDER BY template_id asc;";
$template_rslt=mysql_to_mysqli($template_stmt, $link);
@@ -440,7 +554,7 @@ if (mysqli_num_rows($template_rslt)>0) {
echo "<option value='' selected>--"._QXZ("No templates exist")."--</option>\n";
}
?>
</select><BR/><BR/><input type="submit" value="<?php echo _QXZ("DELETE TEMPLATE"); ?>" class="red_btn" name="delete_template">
</select><BR/><BR/><input type="button" value="<?php echo _QXZ("EDIT TEMPLATE"); ?>" style='background-color:#<?php echo $SSbutton_color; ?>' name="edit_template" style="align:right; width: 150px" onClick="EditTemplate(this.form.template_id.value)">&nbsp;&nbsp;<input type="submit" value="<?php echo _QXZ("DELETE TEMPLATE"); ?>" style='background-color:#<?php echo $SSbutton_color; ?>' name="delete_template" style="align:center; width: 150px">
</form></td>
</tr>
<tr>
@@ -451,11 +565,34 @@ if (mysqli_num_rows($template_rslt)>0) {
</form>
<BR/>
<iframe id="file_holder" style="visibility:hidden;display:none" name="file_holder"></iframe>
<span id="edit_data_display" style="visibility:hidden;display:none">
<form id="listloader_template_edit_form" name="listloader_template_edit_form" action="<?php echo $PHP_SELF; ?>" onSubmit="return false;" method="post" enctype="multipart/form-data">
<table border=0 cellpadding=3 cellspacing=0 width="100%" align="center">
<tr>
<th colspan="2" bgcolor="#<?php echo $SSmenu_background; ?>"><font class="standard" color="white"><?php echo _QXZ("Edit template form"); ?></font><?php echo "$NWB#template_maker-editing_columns$NWE"; ?>
</th>
</tr>
<tr valign="top">
<td border="1" align="center" bgcolor="#<?php echo $SSframe_background; ?>" width="50%"><font class="standard"><?php echo _QXZ("Standard Field"); ?></font></td>
<td border="0" align="center" bgcolor="#<?php echo $SSalt_row1_background; ?>" width="50%"><font class="standard"><?php echo _QXZ("Custom Field"); ?></font></td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
<span id="field_display" name="field_display"><font class="standard_bold" color='red'>**<?php echo _QXZ("Select a template from the drop down menu above to show columns"); ?>**</font></span>
</td>
</tr>
</table>
<input type="hidden" id="edit_standard_fields_layout" name="edit_standard_fields_layout">
<input type="hidden" id="edit_custom_fields_layout" name="edit_custom_fields_layout">
<input type="hidden" id="submit_edited_template" name="submit_edited_template" value="1">
</form>
</span>
<span id="list_data_display" style="visibility:hidden;display:none">
<form id="listloader_template_form" name="listloader_template_form" action="<?php echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data">
<table border=0 cellpadding=3 cellspacing=0 width="100%" align="center">
<tr>
<th colspan="2" bgcolor="#330099"><font class="standard" color="white"><?php echo _QXZ("New template form"); ?></font></th>
<th colspan="2" bgcolor="#<?php echo $SSmenu_background; ?>"><font class="standard" color="white"><?php echo _QXZ("New template form"); ?></font></th>
</tr>
<tr bgcolor="#<?php echo $SSframe_background; ?>">
<td align="right" width='25%'><font class="standard"><?php echo _QXZ("Template ID"); ?>:</font></td>
@@ -519,11 +656,11 @@ if (mysqli_num_rows($template_rslt)>0) {
<tr bgcolor="#<?php echo $SSframe_background; ?>"><td align="center" colspan=2>
<table border=0 cellpadding=3 cellspacing=1 width="100%" align="center">
<tr>
<th colspan="2" bgcolor="#330099"><font class="standard" color="white"><?php echo _QXZ("Assign columns to file fields"); ?><BR/><font size='-2'>(<?php echo _QXZ("selecting a different list will reset columns"); ?>)</font></font><?php echo "$NWB#template_maker-assign_columns$NWE"; ?></th>
<th colspan="2" bgcolor="#<?php echo $SSmenu_background; ?>"><font class="standard" color="white"><?php echo _QXZ("Assign columns to file fields"); ?><BR/><font size='-2'>(<?php echo _QXZ("selecting a different list will reset columns"); ?>)</font></font><?php echo "$NWB#template_maker-assign_columns$NWE"; ?></th>
</tr>
<tr valign="top">
<td border="1" align="center" bgcolor="#<?php echo $SSframe_background; ?>" width="50%"><font class="standard"><?php echo _QXZ("Standard Field"); ?></font></td>
<td border="0" align="center" bgcolor="#FED9D9" width="50%"><font class="standard"><?php echo _QXZ("Custom Field"); ?></font></td>
<td border="0" align="center" bgcolor="#<?php echo $SSalt_row1_background; ?>" width="50%"><font class="standard"><?php echo _QXZ("Custom Field"); ?></font></td>
</tr>
<tr valign="top">
<td colspan="2" align="center">
@@ -1,4 +1,4 @@
# version: 20210311104801
# version: 20210312191801
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -689,7 +689,7 @@ call_menu-option_description Option Description <QXZ>This field is where you can
call_menu-option_route Option Route <QXZ>This menu contains the options for where to send the call if this option is selected: CALLMENU,INGROUP,DID,HANGUP,EXTENSION,PHONE. For CALLMENU, the Route Value should be the Menu ID of the Call Menu that you want the call sent to. For INGROUP, the In-Group that you want the call to be sent to needs to be selected as well as the other 5 options that need to be set to properly route a call to an Inbound Group. For DID, the Route Value needs to be the DID pattern that you want to send the call to. For HANGUP, the Route Value can be the name of an audio file to play before hanging up the call. For EXTENSION, the Route Value needs to be the dialplan extension you want to send the call to, and the Route Value Context is the context that extension is located in, if left blank the context will default to default. For PHONE, the Route Value needs to be the phone login value for the phones entry that you want to send the call to. For VOICEMAIL, the Route Value needs to be the voicemail box number, the unavailable message will be played. For AGI, the Route Value needs to be the agi script and any values that need to be passed to it. VMAIL_NO_INST will send the call to the voicemail box that you have defined below and will not play instructions after the voicemail message.</QXZ>
call_menu-option_route_value Option Route Value <QXZ>This field is where you enter the value that defines where in the selected Option Route that the call is to be directed to.</QXZ>
call_menu-option_route_value_context Option Route Value Context <QXZ>This field is optional and only used for EXTENSION Option Routes.</QXZ>
call_menu-ingroup_settings Call Menu In-Group Settings <QXZ>If the route is set to INGROUP then there are many options that you can set to define how the call is sent to into the queue. In-Group is the inbound group that you want the call to go to. Handle Method is the way you want the call to be handled,</QXZ> <a href='#inbound_dids-call_handle_method'><QXZ>Click here to see a list of the available handle methods</QXZ></a>. <QXZ>Search Method defines how the queue will find the next agent, recommend leave this on LB. List ID is the list that the new lead is inserted into, also if the Method is not a LOOKUP method and the lead is not found. Campaign ID is the campaign to search lists through if one of the RC methods is used. Phone Code is the phone_code field entry for the lead that is inserted with. VID Enter Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played to ask the customer to enter their ID. VID ID Number Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played after customer enters their ID, something like YOU HAVE ENTERED. VID Confirm Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played to confirm their ID, something like PRESS 1 TO CONFIRM AND 2 TO REENTER. VID Digits is used if the Method is set to one of the VIDPROMPT methods, if it is set to a number it is the number of digits that must be entered by the customer when prompted for their ID, if set to empty or X then the customer will have to press pound or hash to finish their entry of their ID.</QXZ> <QXZ>If you are using the cm_phonesearch.agi in this Call Menu, you can set the B option to use the special DYNAMIC_INGROUP_VAR in-group for that script to work properly.</QXZ>
call_menu-ingroup_settings Call Menu In-Group Settings <QXZ>If the route is set to INGROUP then there are many options that you can set to define how the call is sent to into the queue. In-Group is the inbound group that you want the call to go to. Handle Method is the way you want the call to be handled,</QXZ> <a href='#' onClick="FillAndShowHelpDiv(event, 'inbound_dids-call_handle_method')"><QXZ>Click here to see a list of the available handle methods</QXZ></a>. <QXZ>Search Method defines how the queue will find the next agent, recommend leave this on LB. List ID is the list that the new lead is inserted into, also if the Method is not a LOOKUP method and the lead is not found. Campaign ID is the campaign to search lists through if one of the RC methods is used. Phone Code is the phone_code field entry for the lead that is inserted with. VID Enter Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played to ask the customer to enter their ID. VID ID Number Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played after customer enters their ID, something like YOU HAVE ENTERED. VID Confirm Filename is used if the Method is set to one of the VIDPROMPT methods, it is the audio prompt played to confirm their ID, something like PRESS 1 TO CONFIRM AND 2 TO REENTER. VID Digits is used if the Method is set to one of the VIDPROMPT methods, if it is set to a number it is the number of digits that must be entered by the customer when prompted for their ID, if set to empty or X then the customer will have to press pound or hash to finish their entry of their ID.</QXZ> <QXZ>If you are using the cm_phonesearch.agi in this Call Menu, you can set the B option to use the special DYNAMIC_INGROUP_VAR in-group for that script to work properly.</QXZ>
call_menu-custom_dialplan_entry Custom Dialplan Entry <QXZ>This field allows you to enter in any dialplan elements that you want for the Call Menu.</QXZ>
call_menu-qualify_sql Qualify SQL <QXZ>This field allows you to input SQL - Structured Query Language - database fragments, like with Filters, to determine whether this call menu should play for the caller or not. This feature only works if the call has the callerIDname set prior to being sent to this call menu, either as an outbound survey transfer, or through the use of a drop call menu for an In-Group call. If there is a match, the call will proceed as normal. If there is no match, the call will go to the D option or the invalid option if no D option is set. You cannot use single-quotes in this field, only double-quotes if they are needed. Default is empty for disabled.</QXZ>
filter_phone_groups-filter_phone_group_id Filter Phone Group ID <QXZ>This is the ID of the Filter Phone Group that is the container for a group of phone numbers that you can have automatically searched through when a call comes into a DID and send to an alternate route if there is a match. This field should be between 2 and 20 characters and have no punctuation except for underscore.</QXZ>
@@ -1262,12 +1262,14 @@ email_accounts-ingroup_campaign_id In-Group Campaign ID <QXZ>This is the Campaig
template_maker The custom template maker allows you to define your own file layouts for use with the list loader and also delete them, if necessary. If you frequently upload files that are in a consistent layout other than the standard layout, you may find this tool helpful. The saved layout will work on any uploaded file it matches, regardless of file type or delimiter. <QXZ>The custom template maker allows you to define your own file layouts for use with the list loader and also delete them, if necessary. If you frequently upload files that are in a consistent layout other than the standard layout, you may find this tool helpful. The saved layout will work on any uploaded file it matches, regardless of file type or delimiter.</QXZ>
template_maker-create_template Create a new template <QXZ>In order to begin creating your new listloader template, you must first load a lead file that has the layout you wish to create the template for. Click Choose file, and open the file on your computer you wish to use. This will upload a copy to your server and process it to determine the file type and delimiter (for TXT files).</QXZ>
vicidial_template_maker Listloader Custom Template Maker <QXZ>Create your own file loading template with this tool. Useful when you load files in a consistent format or layout other than the vicidial standard format, as it allows you to predefine field locations in lead files to bypass the steps to assign them otherwise</QXZ>
template_maker-delete_template Delete template <QXZ>If you have a template you no longer use or you mis-entered information on it and would like to re-enter it, select the template from the drop-down menu and click DELETE TEMPLATE.</QXZ>
template_maker-delete_template Edit/delete template <QXZ>If you have a template you wish to edit or delete, select the template from the drop-down menu and click the appropriate button, either EDIT TEMPLATE or DELETE TEMPLATE. EDIT TEMPLATE will load the template information and allow you to edit the name, description, and file layout. DELETE TEMPLATE will simply delete the template.</QXZ>
template_maker-template_id Template ID <QXZ>This field is where you enter an arbitrary ID for your new custom template. It must be between 2 and 20 characters and consist of alphanumeric characters and underscores.</QXZ>
template_maker-template_name Template Name <QXZ>This field is where you enter the name for your new custom template. Can be up to 30 characters long.</QXZ>
template_maker-template_description Template Description <QXZ>This field is where you enter the description for your new custom template. It can be up to 255 characters long.</QXZ>
template_maker-template_name Template Name <QXZ>This field is where you enter the name for your custom template. Can be up to 30 characters long.</QXZ>
template_maker-template_description Template Description <QXZ>This field is where you enter the description for your custom template. It can be up to 255 characters long.</QXZ>
template_maker-list_id List ID <QXZ>All templates must load their records into a list. Select a list ID to load leads into from this drop-down list, which will display any lists available to you given your user settings.</QXZ>
template_maker-assign_columns Assigning columns <QXZ>Once you have loaded a sample lead file matching the layout you want to make into a template and select a list ID to load leads into, all of the available columns from the list table and the custom table for the list you selected (if any) will be displayed here. Columns highlighted in blue are standard columns from the list table. Columns highlighted in pink belong to the custom table for the selected list. Each column listed has a drop-down menu, which should be populated with the fields from the first row of the sample lead file you uploaded. Assign the appropriate fields to the appropriate columns and press SUBMIT TEMPLATE to create your template. You do not need to assign every field to a column, and you do not need to assign every column a field. For details on the standard list columns, click</QXZ> <a href='#list_loader'><QXZ>HERE</QXZ></a>.
template_maker-assign_columns Assigning columns <QXZ>Once you have loaded a sample lead file matching the layout you want to make into a template and select a list ID to load leads into, all of the available columns from the list table and the custom table for the list you selected (if any) will be displayed here. Columns highlighted in blue are standard columns from the list table. Columns highlighted in pink belong to the custom table for the selected list. Each column listed has a drop-down menu, which should be populated with the fields from the first row of the sample lead file you uploaded. Assign the appropriate fields to the appropriate columns and press SUBMIT TEMPLATE to create your template. You do not need to assign every field to a column, and you do not need to assign every column a field. For details on the standard list columns, click</QXZ> <a href='#' onClick="FillAndShowHelpDiv(event, 'list_loader')"><QXZ>HERE</QXZ></a>.
template_maker-editing_columns Editing columns <QXZ>If you need to change the file layout the template expects from your uploaded files, you must enter the field number for each piece of data that appears in the base file. <B>Since this feature is based on index values, the first field in the file row uses 0 as the index, not 1</B>. Index values can be repeated, and data fields that share the same index will appear the -current file layout- above separated by the -pipe- character. Additionally, any non-numeric characters will be removed from the index value fields upon submission. For details on the standard list columns, click</QXZ> <a href='#' onClick="FillAndShowHelpDiv(event, 'list_loader')"><QXZ>HERE</QXZ></a>.
template_maker-current_file_layout Current File Layout <QXZ>This is simply a quote-comma-delimited approximation of the layout of the file your template is based on, going by the current template settings. Fields in the file that are not used in your template are shown as -unused- here.</QXZ>
max_stats Maximum System Stats <QXZ>These statistics are cached totals that are stored throughout each day in real-time through back-end processes. For inbound calls, the total calls per in-group are calculated for each call that enters the process that calculates. For the whole system counts, the totals are generated from log entries as well as other in-group and campaign totals. These totals may not add up due to the settings that you have in your system as well as when the call is hung up.</QXZ>
qc_status_codes The Quality Control <QXZ>QC function has its own set of status codes separate from those within the call handling functions of the system. QC status codes must be between 2 and 8 characters in length and contain no special characters like a space or colon. The QC status code description must be between 2 and 30 characters in length. For these functions to work, you must have QC enabled in the System Settings.</QXZ>
agent_time_detail Agent Time Detail <QXZ>In this report you can view how much time agents spent on what.</QXZ><BR><QXZ><U>TIME CLOCK</U> = Time the agent been logged in to the time clock.</QXZ><BR><QXZ><U>AGENT TIME</U> = Total time on the system (<U>WAIT</U> + <U>TALK</U> + <U>DISPO</U> + <U>PAUSE</U>).</QXZ><BR><QXZ><U>WAIT</U> = Time the agent waits for a call.</QXZ><BR><QXZ><U>TALK</U> = Time the agent talks to a customer or is in dead state (<U>DEAD</U> + <U>CUSTOMER</U>).</QXZ><BR><QXZ><U>DISPO</U> = Time the agent uses at the disposition screen (where the agent picks NI, SALE etc).</QXZ><BR><QXZ><U>PAUSE</U> = Time the agent is in pause mode (<U>LOGIN</U> + <U>LAGGED</U> + ...).</QXZ><BR><QXZ><U>DEAD</U> = Time the agent is in a call after the customer has hung up.</QXZ><BR><QXZ><U>CUSTOMER</U> = Time the agent is in a live call with a customer.</QXZ><BR><QXZ><U>CONNECTED</U> = Time the agent is waiting for a live call plus time in a live call with a customer.</QXZ><BR><QXZ>- The next table is pause codes and their time.</QXZ><BR><QXZ><U>LOGIN</U> = The pause code when going from login directly to pause.</QXZ><BR><QXZ><U>LAGGED</U> = The time the agent had some network problem or similar.</QXZ><BR><QXZ><U>ANDIAL</U> = This pause code triggers if the agent been on dispo screen for longer than 1000 seconds.</QXZ><BR><QXZ>and empty is undefined pause code.</QXZ>
@@ -1,7 +1,7 @@
<?php
# leadloader_template_display.php - version 2.14
#
# Copyright (C) 2017 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 120402-2238 - First Build
@@ -17,6 +17,7 @@
# 150210-0619 - Fixed small display issue
# 170409-1534 - Added IP List validation code
# 171204-1518 - Fix for custom field duplicate issue, removed link to old lead loader
# 210312-1700 - Added layout editing functionality
#
require("dbconnect_mysqli.php");
@@ -122,6 +123,10 @@ $rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGload_leads = $row[0];
$NWB = "<IMG SRC=\"help.png\" onClick=\"FillAndShowHelpDiv(event, '";
$NWE = "')\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP>";
require("screen_colors.php");
if ($LOGload_leads < 1)
{
Header ("Content-type: text/html; charset=utf-8");
@@ -140,7 +145,7 @@ if ( (preg_match("/;|:|\/|\^|\[|\]|\"|\'|\*/",$LF_orig)) or (preg_match("/;|:|\/
exit;
}
if ($template_id) {
if ($template_id && $form_action!="update_template") {
$stmt="select * from vicidial_custom_leadloader_templates where template_id='$template_id'";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_array($rslt);
@@ -231,9 +236,209 @@ else if ($list_id>=0 && $form_action=="no_template")
}
echo "</select>\n";
}
else if ($form_action=="update_template")
else if ($form_action=="update_template" && $template_id)
{
echo "Hi";
$template_stmt="select * from vicidial_custom_leadloader_templates where template_id='$template_id'";
$template_rslt=mysql_to_mysqli($template_stmt, $link);
if (mysqli_num_rows($template_rslt)!=1)
{
echo "Error: ".mysqli_num_rows($template_rslt)." templates found";
exit;
}
else
{
$template_row=mysqli_fetch_array($template_rslt);
$template_name=$template_row["template_name"];
$template_description=$template_row["template_description"];
$list_id=$template_row["list_id"];
$standard_variables=$template_row["standard_variables"];
$custom_table=$template_row["custom_table"];
$custom_variables=$template_row["custom_variables"];
$template_statuses=$template_row["template_statuses"];
$campaign_stmt="select campaign_id from vicidial_lists where list_id='$list_id'";
$campaign_rslt=mysql_to_mysqli($campaign_stmt, $link);
if (mysqli_num_rows($campaign_rslt)>0)
{
$campaign_row=mysqli_fetch_row($campaign_rslt);
$campaign_id=$campaign_row[0];
}
$stmt="select status, status_name from vicidial_statuses UNION select status, status_name from vicidial_campaign_statuses where campaign_id='$campaign_id' order by status, status_name asc";
$rslt=mysql_to_mysqli($stmt, $link);
echo "<select id='template_statuses' name='template_statuses[]' size=5 multiple>\n";
echo "\t<option value='--ALL--' selected>--"._QXZ("ALL DISPOSITIONS")."--</option>\n";
while ($row=mysqli_fetch_array($rslt))
{
echo "\t<option value='$row[status]'>$row[status] - $row[status_name]</option>\n";
}
echo "</select>\n";
echo "|||";
$svar_array=explode("|", $standard_variables);
$standard_array=array();
for($i=0; $i<count($svar_array); $i++)
{
if (preg_match('/,/', $svar_array[$i]))
{
$field_array=explode(",", $svar_array[$i]);
$standard_array["$field_array[0]"]=($field_array[1]!="" ? $field_array[1] : "-1");
}
}
$cvar_array=explode("|", $custom_variables);
$custom_array=array();
for($i=0; $i<count($cvar_array); $i++)
{
if (preg_match('/,/', $cvar_array[$i]))
{
$field_array=explode(",", $cvar_array[$i]);
$standard_array["$field_array[0]"]=($field_array[1]!="" ? $field_array[1] : "-1");
$custom_array["$field_array[0]"]=($field_array[1]!="" ? $field_array[1] : "-1");
}
}
asort($custom_array);
asort($standard_array);
# print_r($standard_array);
# exit;
/*
*************************** 1. row ***************************
template_id: Dans1
template_name: tpDB1
template_description: Dans first template
list_id: 100
standard_variables: vendor_lead_code,0|source_id,6|phone_code,10|phone_number,11|title,12|first_name,13|middle_initial,14|last_name,15|address1,16|address2,17|address3,18|city,19|state,20|province,20|postal_code,10|country_code,23|gender,24|date_of_birth,25|alt_phone,26|email,27|security_phrase,28|comments,29|rank,32|owner,33|
custom_table: custom_100
custom_variables: question,38|answer,39|favorite_color,40|
template_statuses:
*/
$fields_stmt = "SELECT list_id, vendor_lead_code, source_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner from vicidial_list limit 1";
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|entry_list_id|';
$vl_fields_count=substr_count($vicidial_listloader_fields, "|")-1;
##### BEGIN custom fields columns list ###
if ($custom_fields_enabled > 0)
{
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$tablecount_to_print = mysqli_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id' and field_duplicate!='Y';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$fieldscount_to_print = mysqli_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysqli_fetch_row($rslt);
$custom_records_count = $rowx[0];
$custom_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' and field_duplicate!='Y' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$fields_to_print = mysqli_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysqli_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='SWITCH') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$custom_SQL .= ",$A_field_label[$o]";
}
}
$o++;
}
$fields_stmt = "SELECT list_id, vendor_lead_code, source_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner $custom_SQL from vicidial_list, custom_$list_id limit 1";
}
}
}
##### END custom fields columns list ###
}
echo "<table border=0 width='100%' cellpadding=3 cellspacing=0>";
echo " <tr bgcolor=\"#".$SSframe_background."\">";
echo " <td align=\"right\" width='50%' class=\"standard\"><font>"._QXZ("Template ID").":</td>";
echo " <td align=\"left\" width='50%' class=\"standard_bold\"><input type='hidden' name='template_id' value='$template_id'>$template_id</td>";
echo " </tr>";
echo " <tr bgcolor=\"#".$SSframe_background."\">";
echo " <td align=\"right\" width='50%'><font class=\"standard\">"._QXZ("Template Name").":</font></td>";
echo " <td align=\"left\" width='50%'><input type='text' name='template_name' value='$template_name' size='15' maxlength='30'>$NWB#template_maker-template_name$NWE</td>";
echo " </tr>";
echo " <tr bgcolor=\"#".$SSframe_background."\">";
echo " <td align=\"right\" width='50%'><font class=\"standard\">"._QXZ("Template Description").":</font></td>";
echo " <td align=\"left\" width='50%'><input type='text' name='template_description' value='$template_description' size='50' maxlength='255'>$NWB#template_maker-template_description$NWE</td>";
echo " </tr>";
echo "<tr bgcolor=\"#".$SSframe_background."\">";
echo " <th colspan='2'><input style='background-color:#$SSbutton_color' type='button' name='submit_edited_template' onClick=\"return checkEditedForm(this.form)\" value='"._QXZ("SUBMIT CHANGES")."'></th>";
echo "</tr>";
echo " <tr bgcolor='#".$SSalt_row1_background."'>\r\n";
echo " <td align=right width='50%' valign='top' class='standard_bold' nowrap>CURRENT FILE LAYOUT:&nbsp;&nbsp;&nbsp;</td>";
echo " <td align=left width='50%' valign='top' class='standard'>";
for ($i=0; $i<=end($standard_array); $i++)
{
if (in_array($i, $standard_array))
{
echo "<B>\"".implode("|", array_keys($standard_array, $i))."\"</B>";
}
else
{
echo "\"(unused)\"";
}
if ($i<end($standard_array)) {echo ",&nbsp;";}
}
echo "</font>$NWB#template_maker-current_file_layout$NWE</td>\r\n";
echo " </tr>\r\n";
echo "</table>";
echo "<table border=0 width='100%' cellpadding=0 cellspacing=0>";
# echo " <tr bgcolor='#".$SSframe_background."'>\r\n";
# echo " <td align=center width=\"50%\"><font class='standard_bold'>&nbsp;</font></td>\r\n";
# echo " <td align=left width=\"50%\"><font class='standard_bold'><BR><BR><BR>INDEX</font></td>\r\n";
# echo " </tr>\r\n";
$rslt=mysql_to_mysqli("$fields_stmt", $link);
$custom_fields_count=mysqli_num_fields($rslt)-$vl_fields_count;
while ($fieldinfo=mysqli_fetch_field($rslt))
{
$rslt_field_name=$fieldinfo->name;
if (preg_match("/$rslt_field_name/", $vicidial_list_fields)) {$bgcolor="#".$SSframe_background;} else {$bgcolor="#".$SSalt_row1_background;}
echo " <tr bgcolor='$bgcolor'>\r\n";
echo " <td align=right nowrap width=\"50%\"><font class=standard>".strtoupper(preg_replace('/_/i', ' ', $rslt_field_name)).": </font></td>\r\n";
if ($rslt_field_name!="list_id")
{
# $standard_array["$rslt_field_name"]+=0;
$value=($standard_array["$rslt_field_name"]>=0 ? $standard_array["$rslt_field_name"] : "");
echo " <td align=left width=\"50%\"><input type='text' name='$field_prefix".$rslt_field_name."_field' id='$field_prefix".$rslt_field_name."_field' value='$value' size='2' maxlength='3' onBlur='EditTemplateStrings()'>\r\n";
echo " </td>\r\n";
}
else
{
echo " <td align=left>&nbsp;<font class='standard_bold'>$list_id<input type='hidden' name='".$field_prefix.$list_id."' value='$list_id'></font></td>\r\n";
}
echo " </tr>\r\n";
}
echo "</table>";
}
else
{
@@ -305,7 +510,7 @@ else
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') and ($A_field_type[$o]!='SWITCH') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
@@ -335,7 +540,7 @@ else
while ($fieldinfo=mysqli_fetch_field($rslt))
{
$rslt_field_name=$fieldinfo->name;
if (preg_match("/$rslt_field_name/", $vicidial_list_fields)) {$bgcolor="#D9E6FE";} else {$bgcolor="#FED9D9";}
if (preg_match("/$rslt_field_name/", $vicidial_list_fields)) {$bgcolor="#".$SSframe_background;} else {$bgcolor="#".$SSalt_row1_background;}
echo " <tr bgcolor='$bgcolor'>\r\n";
echo " <td align=right nowrap><font class=standard>".strtoupper(preg_replace('/_/i', ' ', $rslt_field_name)).": </font></td>\r\n";
@@ -358,6 +563,6 @@ else
}
echo " </tr>\r\n";
}
echo "</table>";
echo "</table>";
}
?>