Add php files
This commit is contained in:
28
include/asterisk/ast_metadata.php
Executable file
28
include/asterisk/ast_metadata.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
function astPatch($ast_number, $ast_id, $ast_location)
|
||||
{
|
||||
require_once('data/SugarBean.php');
|
||||
require_once('include/asterisk/asterisk_inc.php');
|
||||
|
||||
global $system_config;
|
||||
global $current_user;
|
||||
|
||||
if(isset($system_config->settings['system_asterisk_on']) && $system_config->settings['system_asterisk_on'] == 1 && $current_user->asterisk_extension !="")
|
||||
{
|
||||
$ast_links = new asterisk_popup_link($ast_location, $ast_id);
|
||||
/*
|
||||
* Check which type of link is selected and apply code
|
||||
*/
|
||||
|
||||
if(isset($system_config->settings['system_asterisk_phoneicon_on']) && $system_config->settings['system_asterisk_phoneicon_on'] == 1 )
|
||||
return '<script type="text/javascript"> var number = "'.$ast_number.'"; if(number.length > 2) document.write("'.addslashes($ast_links->create_icon_link($ast_number)).'");</script>';
|
||||
|
||||
|
||||
else
|
||||
return '<script type="text/javascript"> var number = "'.$ast_number.'"; if(number.length > 2) document.write("'.addslashes($ast_links->create_phone_link($ast_number)).'");</script>';
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
136
include/asterisk/asterisk_inc.php
Executable file
136
include/asterisk/asterisk_inc.php
Executable file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
class asterisk_popup_link
|
||||
{
|
||||
var $popup_height;
|
||||
var $popup_width;
|
||||
var $addr_suffix;
|
||||
var $cur_user;
|
||||
var $focus;
|
||||
|
||||
var $type;
|
||||
var $record;
|
||||
var $theme;
|
||||
|
||||
function asterisk_popup_link($type, $id, $height="330", $width="450")
|
||||
{
|
||||
$this->popup_height="350";
|
||||
$this->popup_width="550";
|
||||
$this->setRecordType($type);
|
||||
$this->setRecord($id);
|
||||
$this->addr_suffix="&type=".$this->type."&record=".$this->record;
|
||||
}
|
||||
|
||||
function setRecord($id)
|
||||
{
|
||||
$this->record = $id;
|
||||
}
|
||||
|
||||
function setRecordType($id_type)
|
||||
{
|
||||
$this->type = $id_type;
|
||||
}
|
||||
|
||||
function Addr_String($string)
|
||||
{
|
||||
$this->addr_suffix=$this->addr_suffix.$string;
|
||||
}
|
||||
|
||||
function getAddr()
|
||||
{
|
||||
return $this->addr_suffix;
|
||||
}
|
||||
|
||||
function getLayoutDefs(){
|
||||
return array(
|
||||
|
||||
// list of what Subpanels to show in the DetailView
|
||||
|
||||
'subpanel_setup' => array(
|
||||
'activities' => array(
|
||||
'order' => 10,
|
||||
'sort_order' => 'desc',
|
||||
'sort_by' => 'date_start',
|
||||
'title_key' => 'LBL_ACTIVITIES_SUBPANEL_TITLE',
|
||||
'type' => 'collection',
|
||||
'subpanel_name' => 'activities', //this values is not associated with a physical file.
|
||||
'module'=>'Activities',
|
||||
|
||||
'top_buttons' => array(
|
||||
array('widget_class' => 'SubPanelTopCreateTaskButton'),
|
||||
array('widget_class' => 'SubPanelTopScheduleMeetingButton'),
|
||||
array('widget_class' => 'SubPanelTopScheduleCallButton'),
|
||||
//array('widget_class' =>'SubPanelTopCreateNoteButton'),
|
||||
//array('widget_class' => 'SubPanelTopComposeEmailButton'),
|
||||
),
|
||||
'collection_list' => array(
|
||||
'meetings' => array(
|
||||
'module' => 'Meetings',
|
||||
'subpanel_name' => 'ForActivities',
|
||||
'get_subpanel_data' => 'meetings',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
'history' => array(
|
||||
'order' => 20,
|
||||
'sort_order' => 'desc',
|
||||
'sort_by' => 'date_modified',
|
||||
'title_key' => 'LBL_HISTORY_SUBPANEL_TITLE',
|
||||
'type' => 'collection',
|
||||
'subpanel_name' => 'history', //this values is not associated with a physical file.
|
||||
'module'=>'History',
|
||||
|
||||
'top_buttons' => array(
|
||||
array('widget_class' => 'SubPanelTopCreateNoteButton'),
|
||||
//array('widget_class' => 'SubPanelTopArchiveEmailButton'),
|
||||
//array('widget_class' => 'SubPanelTopSummaryButton'),
|
||||
),
|
||||
|
||||
'collection_list' => array(
|
||||
'meetings' => array(
|
||||
'module' => 'Meetings',
|
||||
'subpanel_name' => 'ForHistory',
|
||||
'get_subpanel_data' => 'meetings',
|
||||
),
|
||||
'tasks' => array(
|
||||
'module' => 'Tasks',
|
||||
'subpanel_name' => 'ForHistory',
|
||||
'get_subpanel_data' => 'tasks',
|
||||
),
|
||||
'calls' => array(
|
||||
'module' => 'Calls',
|
||||
'subpanel_name' => 'ForHistory',
|
||||
'get_subpanel_data' => 'calls',
|
||||
),
|
||||
'notes' => array(
|
||||
'module' => 'Notes',
|
||||
'subpanel_name' => 'ForHistory',
|
||||
'get_subpanel_data' => 'notes',
|
||||
),
|
||||
'emails' => array(
|
||||
'module' => 'Emails',
|
||||
'subpanel_name' => 'ForHistory',
|
||||
'get_subpanel_data' => 'emails',
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function create_icon_link($phone_num)
|
||||
{
|
||||
return "<a href='#' onclick='window.open(\"index.php?module=Contacts&action=AS_Popup&html=Dial&form=Dial&number=".$phone_num."&to_pdf=1&dialed=1&type=".$this->type."&record=".$this->record."\",\"Dialing\",\"width=".$this->popup_width.",height=".$this->popup_height.",resizable=0,scrollbars=1\")'><img src=\"include/images/phone_icon.png\" width=10 height=10 border=0></a><img src=\"include/images/spacer.png\" width=5 border=0>".$phone_num;
|
||||
}
|
||||
|
||||
function create_phone_link($phone_num)
|
||||
{
|
||||
return "<img src=\"include/images/spacer.png\" width=5 border=0><a href='#' onclick='window.open(\"index.php?module=Contacts&action=AS_Popup&html=Dial&form=Dial&number=".$phone_num."&to_pdf=1&dialed=1&type=".$this->type."&record=".$this->record."\",\"Dialing\",\"width=".$this->popup_width.",height=".$this->popup_height.",resizable=0,scrollbars=1\")'>".$phone_num."</a>";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
////////END ASTERISK PATCH////////
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user