From 0ca820debd40f23991903498451bcc387386e5e1 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 8 May 2020 23:29:19 +0000 Subject: [PATCH] Added feature to Call Menus to allow copying of previous option Fixed some javascript and PHP7 issues. git-svn-id: svn://192.168.202.10@3244 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/www/vicidial/admin.php | 32 ++- agc_2-X/trunk/www/vicidial/admin_header.php | 231 ++++++++++++++++++- agc_2-X/trunk/www/vicidial/calendar_db.js | 14 +- agc_2-X/trunk/www/vicidial/non_agent_api.php | 92 +++++++- 4 files changed, 349 insertions(+), 20 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 96fc7752..1fd58a83 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -4661,12 +4661,13 @@ else # 200407-1030 - Added browser_call_alerts system setting # 200409-1719 - Reorganized Inbound admin section # 200425-0949 - Added 2nd option for agentcall_manual to disable FAST DIAL +# 200508-1024 - Added feature to Call Menus to allow copying of previous option # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-751a'; -$build = '200425-0949'; +$admin_version = '2.14-752a'; +$build = '200508-1024'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -33142,7 +33143,10 @@ if ($ADD==3511) $modify_url = "$PHP_SELF?ADD=3511&menu_id=$menu_id"; $modify_footer_refresh=1; } - echo "
\n"; + $temp_section_width = $section_width; + if ($temp_section_width < 850) {$temp_section_width = 850;} + $temp_main_section_width = ($temp_section_width + 50); + echo "
\n"; echo ""; $stmt="SELECT menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql,alt_dtmf_log,question from vicidial_call_menu where menu_id='$menu_id' $LOGadmin_viewable_groupsSQL;"; @@ -33169,7 +33173,7 @@ if ($ADD==3511) echo "
"._QXZ("MODIFY A CALL MENU RECORD").": $menu_id
\n"; echo "\n"; echo "\n"; - echo "
\n"; + echo "
\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_header.php b/agc_2-X/trunk/www/vicidial/admin_header.php index 74ba4c76..74bbc946 100644 --- a/agc_2-X/trunk/www/vicidial/admin_header.php +++ b/agc_2-X/trunk/www/vicidial/admin_header.php @@ -83,6 +83,7 @@ # 200206-2314 - Added password length indicator # 200407-1534 - Added play_browser_sound javascript function for campaigns/ingroups # 200409-1720 - Reorganized the Inbound section +# 200508-1052 - Added copy_prev_cm_option() JS function # $stmt="SELECT admin_home_url,enable_tts_integration,callcard_enabled,custom_fields_enabled,allow_emails,level_8_disable_add,allow_chats,enable_languages,admin_row_click,admin_screen_colors,user_new_lead_limit,user_territories_active,qc_features_active,agent_soundboards,enable_drop_lists,allow_ip_lists from system_settings;"; @@ -1105,9 +1106,9 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511 } new_content = ''; - new_content = new_content + ''; + new_content = new_content + ''; new_content = new_content + ": "; - new_content = new_content + '"; new_content = new_content + '' + ingroup_list + "\n" + selected_value + ''; new_content = new_content + "   : '; @@ -1214,14 +1215,238 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511 } if (new_content.length < 1) - {new_content = selected_route} + {new_content = selected_value} span_to_update.innerHTML = new_content; } + function copy_prev_cm_option(item_number,item_height) + { + var prev_item_number = (item_number - 1) + + var temp_option_value = 'option_value_' + item_number; + var temp_option_description = 'option_description_' + item_number; + var temp_option_route = 'option_route_' + item_number; + var temp_option_route_value = 'option_route_value_' + item_number; + var temp_option_route_value_context = 'option_route_value_context_' + item_number; + + var temp_prev_option_value = 'option_value_' + prev_item_number; + var temp_prev_option_description = 'option_description_' + prev_item_number; + var temp_prev_option_route = 'option_route_' + prev_item_number; + var temp_prev_option_route_value = 'option_route_value_' + prev_item_number; + var temp_prev_option_route_value_context = 'option_route_value_context_' + prev_item_number; + + var temp_ValIndex = document.getElementById(temp_prev_option_value).selectedIndex; + var temp_ValLength = document.getElementById(temp_prev_option_value).length; + var temp_ValValue = document.getElementById(temp_prev_option_value).options[temp_ValIndex].value; + var temp_ValNewLength = document.getElementById(temp_option_value).length; + var NEWtemp_ValIndex = (temp_ValIndex + 1); + if (temp_ValNewLength >= 21) + { + if (temp_ValNewLength > temp_ValLength) + { + NEWtemp_ValIndex = (NEWtemp_ValIndex + 1); + } + if (NEWtemp_ValIndex > 21) {NEWtemp_ValIndex=1;} + } + else + { + if (NEWtemp_ValIndex > 20) {NEWtemp_ValIndex=0;} + } + document.getElementById(temp_option_value).selectedIndex = NEWtemp_ValIndex; + + var temp_optionIndex = document.getElementById(temp_prev_option_route).selectedIndex; + var temp_optionValue = document.getElementById(temp_prev_option_route).options[temp_optionIndex].value; + + var rIndex = 0; + if (temp_optionValue == 'CALLMENU') {rIndex = 0;} + if (temp_optionValue == 'INGROUP') {rIndex = 1;} + if (temp_optionValue == 'DID') {rIndex = 2;} + if (temp_optionValue == 'HANGUP') {rIndex = 3;} + if (temp_optionValue == 'EXTENSION') {rIndex = 4;} + if (temp_optionValue == 'PHONE') {rIndex = 5;} + if (temp_optionValue == 'VOICEMAIL') {rIndex = 6;} + if (temp_optionValue == 'VMAIL_NO_INST') {rIndex = 7;} + document.getElementById(temp_option_route).selectedIndex = rIndex; + document.getElementById(temp_option_description).value = document.getElementById(temp_prev_option_description).value; + + call_menu_option(item_number,temp_optionValue,'','',item_height); + + if ( (temp_optionValue == 'CALLMENU') || (temp_optionValue == 'DID') || (temp_optionValue == 'PHONE') ) + { + var temp_prev_optionVal = document.getElementById(temp_prev_option_route_value); + var temp_prev_optionValIndex = temp_prev_optionVal.selectedIndex; + var temp_prev_optionValValue = temp_prev_optionVal.options[temp_prev_optionValIndex].value; + + var temp_optionVal = document.getElementById(temp_option_route_value); + var temp_optionValIndex = 0; + var temp_optionValLength = temp_optionVal.length; + var temp_counter=0; + while (temp_counter < temp_optionValLength) + { + if (temp_prev_optionValValue == temp_optionVal.options[temp_counter].value) + {temp_optionValIndex = temp_counter;} + + temp_counter++; + } + document.getElementById(temp_option_route_value).selectedIndex = temp_optionValIndex; + + if ( (temp_optionValue == 'CALLMENU') || (temp_optionValue == 'DID') ) + { + call_menu_link(item_number,temp_optionValue); + } + } + + if ( (temp_optionValue == 'HANGUP') || (temp_optionValue == 'VOICEMAIL') || (temp_optionValue == 'VMAIL_NO_INST') ) + { + var temp_prev_optionVal = document.getElementById(temp_prev_option_route_value); + var temp_optionVal = document.getElementById(temp_option_route_value); + + temp_optionVal.value = temp_prev_optionVal.value; + } + + if (temp_optionValue == 'EXTENSION') + { + var temp_prev_optionVal = document.getElementById(temp_prev_option_route_value); + var temp_optionVal = document.getElementById(temp_option_route_value); + var temp_prev_optionValContext = document.getElementById(temp_prev_option_route_value_context); + var temp_optionValContext = document.getElementById(temp_option_route_value_context); + + temp_optionVal.value = temp_prev_optionVal.value; + temp_optionValContext.value = temp_prev_optionValContext.value; + } + + if (temp_optionValue == 'INGROUP') + { + // In-Group select list + var temp_prev_optionVal = document.getElementById(temp_prev_option_route_value); + var temp_prev_optionValIndex = temp_prev_optionVal.selectedIndex; + var temp_prev_optionValValue = temp_prev_optionVal.options[temp_prev_optionValIndex].value; + + var temp_optionVal = document.getElementById(temp_option_route_value); + var temp_optionValIndex = 0; + var temp_optionValLength = temp_optionVal.length; + var temp_counter=0; + while (temp_counter < temp_optionValLength) + { + if (temp_prev_optionValValue == temp_optionVal.options[temp_counter].value) + {temp_optionValIndex = temp_counter;} + + temp_counter++; + } + document.getElementById(temp_option_route_value).selectedIndex = temp_optionValIndex; + call_menu_link(item_number,temp_optionValue); + + // In-Group Handle Method + var temp2_option_route_value = 'IGhandle_method_' + item_number; + var temp2_prev_option_route_value = 'IGhandle_method_' + prev_item_number; + + var temp2_prev_optionVal = document.getElementById(temp2_prev_option_route_value); + var temp2_prev_optionValIndex = temp2_prev_optionVal.selectedIndex; + var temp2_prev_optionValValue = temp2_prev_optionVal.options[temp2_prev_optionValIndex].value; + + var temp2_optionVal = document.getElementById(temp2_option_route_value); + var temp2_optionValIndex = 0; + var temp2_optionValLength = temp2_optionVal.length; + var temp2_counter=0; + while (temp2_counter < temp2_optionValLength) + { + if (temp2_prev_optionValValue == temp2_optionVal.options[temp2_counter].value) + {temp2_optionValIndex = temp2_counter;} + + temp2_counter++; + } + document.getElementById(temp2_option_route_value).selectedIndex = temp2_optionValIndex; + + // In-Group Search Method + var temp3_option_route_value = 'IGsearch_method_' + item_number; + var temp3_prev_option_route_value = 'IGsearch_method_' + prev_item_number; + + var temp3_prev_optionVal = document.getElementById(temp3_prev_option_route_value); + var temp3_prev_optionValIndex = temp3_prev_optionVal.selectedIndex; + var temp3_prev_optionValValue = temp3_prev_optionVal.options[temp3_prev_optionValIndex].value; + + var temp3_optionVal = document.getElementById(temp3_option_route_value); + var temp3_optionValIndex = 0; + var temp3_optionValLength = temp3_optionVal.length; + var temp3_counter=0; + while (temp3_counter < temp3_optionValLength) + { + if (temp3_prev_optionValValue == temp3_optionVal.options[temp3_counter].value) + {temp3_optionValIndex = temp3_counter;} + + temp3_counter++; + } + document.getElementById(temp3_option_route_value).selectedIndex = temp3_optionValIndex; + + // In-Group Campaign + var temp4_option_route_value = 'IGcampaign_id_' + item_number; + var temp4_prev_option_route_value = 'IGcampaign_id_' + prev_item_number; + + var temp4_prev_optionVal = document.getElementById(temp4_prev_option_route_value); + var temp4_prev_optionValIndex = temp4_prev_optionVal.selectedIndex; + var temp4_prev_optionValValue = temp4_prev_optionVal.options[temp4_prev_optionValIndex].value; + + var temp4_optionVal = document.getElementById(temp4_option_route_value); + var temp4_optionValIndex = 0; + var temp4_optionValLength = temp4_optionVal.length; + var temp4_counter=0; + while (temp4_counter < temp4_optionValLength) + { + if (temp4_prev_optionValValue == temp4_optionVal.options[temp4_counter].value) + {temp4_optionValIndex = temp4_counter;} + + temp4_counter++; + } + document.getElementById(temp4_option_route_value).selectedIndex = temp4_optionValIndex; + + // In-Group List ID + var temp5 = 'IGlist_id_' + item_number; + var temp5_prev = 'IGlist_id_' + prev_item_number; + var temp5_optionVal = document.getElementById(temp5); + var temp5_prev_optionVal = document.getElementById(temp5_prev); + temp5_optionVal.value = temp5_prev_optionVal.value; + + // In-Group Phone Code + var temp6 = 'IGphone_code_' + item_number; + var temp6_prev = 'IGphone_code_' + prev_item_number; + var temp6_optionVal = document.getElementById(temp6); + var temp6_prev_optionVal = document.getElementById(temp6_prev); + temp6_optionVal.value = temp6_prev_optionVal.value; + + // In-Group VID Enter Filename + var temp7 = 'IGvid_enter_filename_' + item_number; + var temp7_prev = 'IGvid_enter_filename_' + prev_item_number; + var temp7_optionVal = document.getElementById(temp7); + var temp7_prev_optionVal = document.getElementById(temp7_prev); + temp7_optionVal.value = temp7_prev_optionVal.value; + + // In-Group VID ID Number Filename + var temp8 = 'IGvid_id_number_filename_' + item_number; + var temp8_prev = 'IGvid_id_number_filename_' + prev_item_number; + var temp8_optionVal = document.getElementById(temp8); + var temp8_prev_optionVal = document.getElementById(temp8_prev); + temp8_optionVal.value = temp8_prev_optionVal.value; + + // In-Group VID Confirm Filename + var temp9 = 'IGvid_confirm_filename_' + item_number; + var temp9_prev = 'IGvid_confirm_filename_' + prev_item_number; + var temp9_optionVal = document.getElementById(temp9); + var temp9_prev_optionVal = document.getElementById(temp9_prev); + temp9_optionVal.value = temp9_prev_optionVal.value; + + // In-Group VID Digits + var temp10 = 'IGvid_validate_digits_' + item_number; + var temp10_prev = 'IGvid_validate_digits_' + prev_item_number; + var temp10_optionVal = document.getElementById(temp10); + var temp10_prev_optionVal = document.getElementById(temp10_prev); + temp10_optionVal.value = temp10_prev_optionVal.value; + } + } 0) {echo "DEBUG: sounds_list variables - $dirpath|$stage|$format\n";} + + $file_names=array(); + $file_namesPROMPT=array(); + $file_epoch=array(); + $file_dates=array(); + $file_sizes=array(); + $file_sizesPAD=array(); + while (false !== ($file = readdir($dh))) { # Do not list subdirectories @@ -1282,6 +1291,11 @@ if ($function == 'moh_list') echo "\n"; echo "\n"; + $rowx=array(); + $moh_id=array(); + $moh_name=array(); + $random=array(); + $stmt="SELECT moh_id,moh_name,random from vicidial_music_on_hold where active='Y' $LOGadmin_viewable_groupsSQL order by moh_id"; $rslt=mysql_to_mysqli($stmt, $link); $moh_to_print = mysqli_num_rows($rslt); @@ -1322,7 +1336,6 @@ if ($function == 'moh_list') $m++; } - echo "\n"; echo "\n"; @@ -1425,6 +1438,12 @@ if ($function == 'vm_list') echo "\n"; echo "\n"; + $rowx=array(); + $voicemail_id=array(); + $fullname=array(); + $email=array(); + $extension=array(); + $stmt="SELECT voicemail_id,fullname,email from vicidial_voicemail where active='Y' $LOGadmin_viewable_groupsSQL order by voicemail_id"; $rslt=mysql_to_mysqli($stmt, $link); $vm_to_print = mysqli_num_rows($rslt); @@ -1644,6 +1663,8 @@ if ($function == 'agent_ingroup_info') $in_groups = explode(" ",$in_groups_pre); $in_groups_ct = count($in_groups); $k=1; + $closer_select=array(); + while ($k < $closer_groups_ct) { $closer_select[$k]=0; @@ -5183,6 +5204,16 @@ if ($function == 'list_custom_fields') else {$listSQL = "list_id > 0";} } + + $OUTlist_name=array(); + $OUTcampaign_id=array(); + $OUTactive=array(); + $OUTlist_changedate=array(); + $OUTlist_lastcalldate=array(); + $OUTexpiration_date=array(); + $OUTresets_today=array(); + $OUTlist_id=array(); + $stmt="SELECT list_name,campaign_id,active,list_changedate,list_lastcalldate,expiration_date,resets_today,list_id from vicidial_lists where $listSQL $LOGallowed_campaignsSQL order by list_id;"; if ($DB>0) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); @@ -5230,6 +5261,7 @@ if ($function == 'list_custom_fields') $rslt=mysql_to_mysqli($stmtA, $link); if ($DB) {echo "$stmtA\n";} $columns_ct = mysqli_num_rows($rslt); + $column=array(); while ($columns_ct > $cf) { $row=mysqli_fetch_row($rslt); @@ -6860,6 +6892,12 @@ if ($function == 'did_log_export') {$DL='|'; $stage='pipe';} if ($header == 'YES') {$output .= 'did_number' . $DL . 'call_date' . $DL . 'caller_id_number' . $DL . "length_in_sec\n";} + $DLuniqueid=array(); + $DLcall_date=array(); + $DLcaller_id_number=array(); + $DLepoch=array(); + $DLlength_in_sec=array(); + $DLcloser_epoch=array(); while ($rec_recs > $k) { @@ -7015,6 +7053,17 @@ if ($function == 'phone_number_log') if ($DLset < 1) {$DL='|'; $stage='pipe';} + $DLphone_number=array(); + $DLcall_date=array(); + $DLlist_id=array(); + $DLlead_id=array(); + $DLlength_in_sec=array(); + $DLdispo_status=array(); + $DLhangup_reason=array(); + $DLlead_status=array(); + $DLsource_id=array(); + $DLuser=array(); + while($phones_count > $m) { $search_SQL = "phone_number='$phones_ready[$m]'"; @@ -7251,6 +7300,21 @@ if ($function == 'agent_stats_export') if ($header == 'YES') {$output .= 'user' . $DL . 'full_name' . $DL . 'user_group' . $DL . 'calls' . $DL . 'login_time' . $DL . 'total_talk_time' . $DL . 'avg_talk_time' . $DL . 'avg_wait_time' . $DL . 'pct_of_queue' . $DL . 'pause_time' . $DL . 'sessions' . $DL . 'avg_session' . $DL . 'pauses' . $DL . 'avg_pause_time' . $DL . 'pause_pct' . $DL . 'pauses_per_session' . "\n";} + $ASuser=array(); + $ASstart_epoch=array(); + $AScalls=array(); + $ASpauses=array(); + $ASsessions=array(); + $ASpause_sec=array(); + $ASwait_sec=array(); + $AStalk_sec=array(); + $ASdispo_sec=array(); + $ASdead_sec=array(); + $ASend_epoch=array(); + $ASend_sec=array(); + $ASfull_name=array(); + $ASuser_group=array(); + $last_user='998877665544332211328497'; $total_calls=0; $uc=-1; @@ -7498,6 +7562,8 @@ if ($function == 'user_group_status') $total_calls_waiting=0; $call_camps[0]=''; $call_types[0]=''; + $call_camps=array(); + $call_types=array(); $callerids=''; $pausecode=''; @@ -7766,6 +7832,8 @@ if ($function == 'in_group_status') $total_agents_in_dial=0; $total_calls=0; $total_calls_waiting=0; + $call_camps=array(); + $call_types=array(); $call_camps[0]=''; $call_types[0]=''; @@ -9147,6 +9215,7 @@ if ($function == 'lead_status_search') $leads_exist = mysqli_num_rows($rslt); $x=0; $lead_id_list="'0'"; + $export_lead_id=array(); while ($leads_exist > $x) { $row=mysqli_fetch_row($rslt); @@ -10534,6 +10603,9 @@ if ($function == 'update_lead') $rslt=mysql_to_mysqli($stmt, $link); $pc_recs = mysqli_num_rows($rslt); $n=0; + $search_lead_id=array(); + $search_lead_list=array(); + $search_entry_list=array(); while ($pc_recs > $n) { $row=mysqli_fetch_row($rslt); @@ -11779,6 +11851,20 @@ if ($function == 'logged_in_agents') {$header_sub_status = $DL . 'pause_code' . $DL . 'sub_status';} $output .= 'user' . $DL . 'campaign_id' . $DL . 'session_id' . $DL . 'status' . $DL . 'lead_id' . $DL . 'callerid' . $DL . 'calls_today' . $DL . 'full_name' . $DL . 'user_group' . $DL . 'user_level' . $header_sub_status . "\n"; } + $Astatus=array(); + $Acallerid=array(); + $Alead_id=array(); + $Acampaign_id=array(); + $Acalls_today=array(); + $Aagent_log_id=array(); + $Aon_hook_agent=array(); + $Aring_callerid=array(); + $Apreview_lead_id=array(); + $Aconf_exten=array(); + $Auser=array(); + $Acomments=array(); + $Apause_code=array(); + $Artr_status=array(); $stmt="SELECT status,callerid,lead_id,campaign_id,calls_today,agent_log_id,on_hook_agent,ring_callerid,preview_lead_id,conf_exten,user,comments from vicidial_live_agents $whereLOGallowed_campaignsSQL $search_CAMP_SQL;"; $rslt=mysql_to_mysqli($stmt, $link);
"._QXZ("Menu ID").": $menu_id $NWB#call_menu-menu_id$NWE
"._QXZ("Menu Name").": $NWB#call_menu-menu_name$NWE
"._QXZ("Admin User Group").": "; + $dtmf_list = "
"._QXZ("Option").": $dtmf_list   - "._QXZ("Description").": + "._QXZ("Description").": "._QXZ("Route").": $NWB#call_menu-option_value$NWE
+ $NWB#call_menu-option_value$NWE "; + + if ($j > 0) {echo "copy ^ ";} + else {echo "           ";} + echo "
\n"; if ($option_route=='CALLMENU') @@ -33412,7 +33420,7 @@ if ($ADD==3511) while ($j <= 20) { $choose_height = (($j * 100) + 550); - $dtmf_list = ""; $h=0; while ($h <= 20) { @@ -33428,7 +33436,7 @@ if ($ADD==3511) echo "
"._QXZ("Option").": $dtmf_list   - "._QXZ("Description").": + "._QXZ("Description").": "._QXZ("Route").": - $NWB#call_menu-option_value$NWE
+ $NWB#call_menu-option_value$NWE "; + + if ($j > 0) {echo "copy ^ ";} + else {echo "           ";} + echo "
\n"; echo "
 
"._QXZ("Random")."
 Files: $MOHfiles
"._QXZ("Email")."