From f283b9cfd31236fc13fc5eef8f87265459d3891b Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 9 Aug 2005 13:58:11 +0000 Subject: [PATCH] Some general fixes, for queues and phone Account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1092 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/ogroups/class_phonequeue.inc | 32 ++++++----- plugins/admin/ogroups/phonequeue.tpl | 24 +++++--- .../gofon/phoneaccount/class_phoneAccount.inc | 56 +++++++++---------- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 4603d726e..8e7f22723 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -13,7 +13,7 @@ class phonequeue extends plugin var $goFonDialOption_t ="t"; var $goFonDialOption_T ="T"; var $goFonDialOption_h ="h"; - var $goFonAnnounce ="gonicus-berlin-welcome"; + var $goFonQueueAnnounce ="gonicus-berlin-welcome"; var $goFonDialOption_H ="H"; var $goFonMusiconHold ="default"; var $goFonWelcomeMusic ="gonicus-berlin-welcome"; @@ -24,12 +24,13 @@ class phonequeue extends plugin var $goFonQueueThankYou ="queue-thankyou"; var $goFonQueueMinutes ="queue-minutes"; var $goFonQueueSeconds ="queue-seconds"; - var $goFonLanguage ="queue-holdtime"; - var $goFonStrategy ="rrmemory"; - var $goFonAnnounceHoldtime ="yes"; + var $goFonQueueLanguage ="queue-holdtime"; + var $goFonQueueStrategy ="rrmemory"; + var $goFonQueueAnnounceHoldtime ="yes"; var $telephoneNumber =array(); var $goFonQueueMember =array(); var $goFonDialOption ="tThH"; + var $goFonQueueRetry =5; var $old_phone_numbers =array(); @@ -37,7 +38,7 @@ class phonequeue extends plugin var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOption_t","goFonDialOption_T","goFonDialOption_h", "goFonDialOption_H","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext", "goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds", - "telephoneNumber","goFonLanguage","goFonStrategy","goFonAnnounceHoldtime","goFonAnnounce","goFonDialOption"); + "telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry"); /* ObjectClass */ var $objectclasses= array("goFonQueue"); @@ -127,9 +128,9 @@ class phonequeue extends plugin $smarty= get_smarty(); - $smarty->assign("goFonLanguageOptions",array('de'=>_('German'),'ur'=>_('Uruguai'))); - $smarty->assign("goFonAnnounceHoldtimeOptions",array('no'=>_("No"),'yes'=>_('Yes'))); - $smarty->assign("goFonStrategyOptions",array('ringall' =>_("ring all available channels until one answers"), + $smarty->assign("goFonQueueLanguageOptions",array('de'=>_('German'),'ur'=>_('Uruguai'))); + $smarty->assign("goFonQueueAnnounceHoldtimeOptions",array('no'=>_("No"),'yes'=>_('Yes'))); + $smarty->assign("goFonQueueStrategyOptions",array('ringall' =>_("ring all available channels until one answers"), 'roundrobin' =>_("take turns ringing each available interface"), 'leastrecent'=>_("ring interface which was least recently called by this queue"), 'fewestcalls'=>_("ring the one with fewest completed calls from this queue"), @@ -172,6 +173,9 @@ class phonequeue extends plugin } if(!((is_numeric($this->goFonTimeOut))||(empty($this->goFonTimeOut)))){ + $message[] = _("Timeout must be numeric"); + } + if(!((is_numeric($this->goFonQueueRetry))||(empty($this->goFonQueueRetry)))){ $message[] = _("Retry must be numeric"); } if(!((is_numeric($this->goFonMaxLen))||(empty($this->goFonMaxLen)))){ @@ -299,7 +303,7 @@ class phonequeue extends plugin $a_ext[$i]['exten'] = $num; $a_ext[$i]['priority'] = 2; $a_ext[$i]['app'] = "Set"; - $a_ext[$i]['appdata'] = "LANGUAGE|".$this->goFonLanguage; + $a_ext[$i]['appdata'] = "LANGUAGE|".$this->goFonQueueLanguage; $i ++ ; $a_ext[$i]['context'] = 'GOsa'; $a_ext[$i]['exten'] = $num; @@ -339,10 +343,10 @@ class phonequeue extends plugin $queue["announce"] = ""; $queue["monitor_join"] = ""; $queue["monitor_format"] = ""; - $queue["queue_holdtime"] = $this->goFonAnnounce; + $queue["queue_holdtime"] = $this->goFonQueueAnnounce; $queue["queue_lessthan"] = ""; $queue["announce_round_seconds"]= ""; - $queue["retry"] = $this->goFonTimeOut; + $queue["retry"] = $this->goFonQueueRetry; $queue["wrapuptime"] = ""; $queue["servicelevel"] = ""; $queue["joinempty"] = ""; @@ -356,9 +360,9 @@ class phonequeue extends plugin $queue["context"] = "default"; $queue["name"] = $this->attrs['cn'][0]; - $queue["timeout"] = 20; + $queue["timeout"] = $this->goFonTimeOut; $queue["maxlen"] = $this->goFonMaxLen; - $queue["strategy" ] = $this->goFonStrategy; + $queue["strategy" ] = $this->goFonQueueStrategy; $queue["queue_thankyou"] = $this->goFonQueueThankYou; $queue["queue_reporthold"] = $this->goFonQueueReportHold; $queue["announce_frequency"] = $this->goFonAnnounceFrequency; @@ -367,7 +371,7 @@ class phonequeue extends plugin $queue["queue_callswaiting"] = $this->goFonQueueCallsWaiting; $queue["queue_minutes"] = $this->goFonQueueMinutes; $queue["queue_seconds"] = $this->goFonQueueSeconds; - $queue["announce_holdtime"] = $this->goFonAnnounceHoldtime; + $queue["announce_holdtime"] = $this->goFonQueueAnnounceHoldtime; $queue["musiconhold"] = $this->goFonMusiconHold; $i++; diff --git a/plugins/admin/ogroups/phonequeue.tpl b/plugins/admin/ogroups/phonequeue.tpl index caeeb15de..b7904d2fc 100644 --- a/plugins/admin/ogroups/phonequeue.tpl +++ b/plugins/admin/ogroups/phonequeue.tpl @@ -28,27 +28,35 @@ {t}Language{/t} - + {html_options options=$goFonQueueLanguageOptions selected=$goFonQueueLanguage} - {t}Retry{/t} + {t}Timeout{/t} + + {t}Retry{/t} + + + + + + {t}Strategy{/t} - + {html_options options=$goFonQueueStrategyOptions selected=$goFonQueueStrategy} @@ -76,8 +84,8 @@ {t}Announce holdtime{/t} - + {html_options options=$goFonQueueAnnounceHoldtimeOptions selected=$goFonQueueAnnounceHoldtime} @@ -152,7 +160,7 @@ {t}Announce message{/t} - + diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 4dacfe3ca..451ed7ae6 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -133,9 +133,13 @@ class phoneAccount extends plugin $id = $data[0]; $this->macroarray[$attrs['dn']][$id]['var'] ="var".$id; $string= $data[3]; -// $string = preg_replace("/%uid/",$this->attrs['uid'][0],$data[3]); -// $string = preg_replace("/%telephoneNumber/",$this->attrs['telephoneNumber'][0],$string); -// $string = preg_replace("/%cn/",$this->attrs['cn'][0],$string); + $string = preg_replace("/%uid/",$this->attrs['uid'][0],$data[3]); + for($i = 0 ; $i < 10; $i++){ + if(isset($this->attrs['telephoneNumber'][$i])){ + $string = preg_replace("/%telephoneNumber_".($i+1)."/",$this->attrs['telephoneNumber'][$i],$string); + } + } + $string = preg_replace("/%cn/",$this->attrs['cn'][0],$string); $this->macroarray[$attrs['dn']][$id]['choosen']= $string; $this->macroarray[$attrs['dn']][$id]['id'] = $id; @@ -541,15 +545,7 @@ class phoneAccount extends plugin break; case "string": - $choosen = preg_replace("/%uid/",$this->attrs['uid'][0],$choosen); - foreach($this->phoneNumbers as $phone){ - $tmp_phone[] = $phone; - } - - $choosen = preg_replace("/%telephoneNumber/",$tmp_phone[0],$choosen); - $choosen = preg_replace("/%cn/",$this->attrs['cn'][0],$choosen); - - $str="acl, "goFonMacro").">"; + $str="acl, "goFonMacro").">"; $macrotab.= "$name$str"; break; @@ -721,25 +717,25 @@ class phoneAccount extends plugin if(isset($this->macroarray[$this->macro])){ foreach($this->macroarray[$this->macro] as $key => $paras){ if(isset($_POST[$paras['var']])){ - $par = $this->macroarray[$this->macro][$key]; - $string = ""; - if(preg_match("/.*%telephoneNumber_.*/",$par['default'])){ - $string = $par['default']; - foreach($nummsinorder as $nummsinorderkey=> $nummsinorderval){ - $string = (str_replace("%telephoneNumber_".($nummsinorderkey+1),$nummsinorderval,$string)); - } - } +// $par = $this->macroarray[$this->macro][$key]; +// $string = ""; +// if(preg_match("/.*%telephoneNumber_.*/",$par['default'])){ +// $string = $par['default']; +// foreach($nummsinorder as $nummsinorderkey=> $nummsinorderval){ +// $string = (str_replace("%telephoneNumber_".($nummsinorderkey+1),$nummsinorderval,$string)); +// } +// } - if(preg_match("/.*%uid.*/",$par['default'])){ - if(empty($string)) $string = $par['default']; - $string = str_replace("%uid",$this->uid,$string); - } +// if(preg_match("/.*%uid.*/",$par['default'])){ +// if(empty($string)) $string = $par['default']; +// $string = str_replace("%uid",$this->uid,$string); +// } - if(!empty($string)){ - $this->macroarray[$this->macro][$key]['choosen'] = $string; - }else{ +// if(!empty($string)){ +// $this->macroarray[$this->macro][$key]['choosen'] = $string; +// }else{ $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; - } +// } } /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code @@ -941,7 +937,9 @@ class phoneAccount extends plugin $SQL=""; - + /* If deletion starts from userslist, cn uid are not set */ + $this->uid = $this->parent->by_object['user']->uid; + $this->cn = $this->parent->by_object['user']->cn; $first_num = false; // Delete old entries -- 2.30.2