summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4bcd0ea)
raw | patch | inline | side by side (parent: 4bcd0ea)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 May 2008 07:25:25 +0000 (07:25 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 May 2008 07:25:25 +0000 (07:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10872 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc | patch | blob | history | |
gosa-plugins/gofon/gofon/phoneaccount/generic.tpl | patch | blob | history |
diff --git a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc
index c725a361717dd2103c081ec4203f884512b3ed3d..e665c36c0a7b7808b5c0c8c8c6ab24ad1450a2ef 100644 (file)
var $init_HomeServer = "0"; // Contains the dn of the server that manage this account
var $goFonHomeServers = array(); // Contains all available server configurations
+ var $context = "default";
+
/* attribute list for save action */
var $CopyPasteVars = array("phoneNumbers","macroarray","macrostillavailable"/*"phoneNumbers" -Reset- */,
"hardware_list","used_hardware");
}
}
+ /* Set parent object to tab object */
+ $this->parent = $parent->parent;
+
/* Set uid */
if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
$this->uid = $this->parent->by_object['user']->uid;
* This means, the PIN in the DB is up to date
*/
// Connect to DB server
- if((is_callable("mysql_pconnect"))&&(isset($cur_cfg))&&(isset($cur_cfg['SERVER']))&&(isset($cur_cfg['LOGIN']))&&(isset($cur_cfg['PASSWORD']))){
+ if( (is_callable("mysql_pconnect"))&&
+ (isset($cur_cfg))&&
+ (isset($cur_cfg['SERVER']))&&
+ (isset($cur_cfg['LOGIN']))&&
+ (isset($cur_cfg['PASSWORD']))){
+
$r_con = @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']);
if($r_con){
$r_db = @mysql_select_db($cur_cfg['DB'],$r_con);
- $query_tmp = "SELECT ".$cur_cfg['VOICE_TABLE'].".password FROM ".$cur_cfg['VOICE_TABLE'].", ".
+ $query_tmp = "SELECT ".$cur_cfg['SIP_TABLE'].".context,".$cur_cfg['VOICE_TABLE'].".password FROM ".$cur_cfg['VOICE_TABLE'].", ".
$cur_cfg['SIP_TABLE']." WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'";
- $vp = mysql_fetch_row(mysql_query($query_tmp));
+ $res = mysql_query($query_tmp);
+ $vp = mysql_fetch_assoc($res);
@DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
- if((isset($vp[0]))&&(!empty($vp[0]))){
- $this->goFonPINVoice = $vp[0];
+ if((isset($vp['password']))&&(!empty($vp['password']))){
+ $this->goFonPINVoice = $vp['password'];
+ }
+ if((isset($vp['context']))&&(!empty($vp['context']))){
+ $this->context = $vp['context'];
}
}
}
$sip_data_array['type'] = $s_type ;
$sip_data_array['username'] = $this->uid;
$sip_data_array['ipaddr'] = $s_ip;
+ $sip_data_array['context'] = $this->context;
/* Remove not changed attributes, to avoid updating table with same values */
foreach($sip_data_array as $name => $value){
$sip_data_array['amaflags'] = NULL;
$sip_data_array['callgroup'] = NULL;
$sip_data_array['canreinvite'] = "no";
- $sip_data_array['context'] = "default";
+ $sip_data_array['context'] = $this->context;
$sip_data_array['defaultip'] = NULL;
$sip_data_array['fromuser'] = NULL;
$sip_data_array['fromdomain'] = NULL;
$smarty->assign("macros",$this->macros);
$smarty->assign("macro", $this->macro);
+ /* Assign contexts */
+ $smarty->assign("contexts",$this->get_asterisk_contexts());
+ $smarty->assign("context" ,$this->context);
+ $smarty->assign("goFonContextACL", $this->getacl("context"));
+
/* check if there is a FON server created */
if(!count($this->goFonHomeServer)){
msg_dialog::display(_("Configuration error"), msgPool::noserver(_("GOfon")), WARNING_DIALOG);
$this->is_modified =true;
}
+ /* Save context */
+ if(isset($_POST['context'])){
+ if($this->context != $_POST['context']){
+ $this->is_modified= TRUE;
+ }
+ $this->context= $_POST['context'];
+ }
+
if(is_array($this->phoneNumbers)){
foreach($this->phoneNumbers as $telenumms) {
$nummsinorder[]=$telenumms;
}
return($ret);
}
+
+
+ /* Return asterisk contexts
+ * Additionaly read contexts from file.
+ */
+ function get_asterisk_contexts()
+ {
+ $contexts = array();
+ $contexts[] = "default";
+ $contexts[] = "parkedcalls";
+ $contexts[] = "from-sip";
+ $contexts[] = "from-capi";
+ $file = "/etc/gosa/asterisk_contexts.conf";
+ if(file_exists($file) && is_readable($file)){
+ foreach(file($file) as $context){
+ $contexts[] = trim($context);
+ }
+ }
+ array_unique($contexts);
+ return($contexts);
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl b/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl
index 07777d8a78fcfcc7030d3fee07dd1ab47b96e7ca..1a61ba1af98e900c5814e3116191772757e2ff2b 100644 (file)
{/render}
</td>
</tr>
+ <tr>
+ <td>{t}Context{/t}
+ </td>
+ <td>
+ <select name='context' title='{t}Select the accounts context{/t}' {$goFonContextACL}>
+ {html_options values=$contexts output=$contexts selected=$context}
+ </select>
+ </td>
+ </tr>
+
<tr>
<td>
<label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>