Code

Some general fixes, for queues and phone Account
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Aug 2005 13:58:11 +0000 (13:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Aug 2005 13:58:11 +0000 (13:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1092 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/ogroups/class_phonequeue.inc
plugins/admin/ogroups/phonequeue.tpl
plugins/gofon/phoneaccount/class_phoneAccount.inc

index 4603d726eaef0d7df2ebd9e23936e175cad75a6e..8e7f227234d01cfedd8a9f00b43482669717052a 100644 (file)
@@ -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++;
index caeeb15de4e695d3128dabe78714a8308e93581e..b7904d2fc722a05a0b360c3e52e189d3079f0910 100644 (file)
                        {t}Language{/t} 
                </td>
                <td>
-                       <select style="width:380px;" name="goFonLanguage" {$goFonLanguageACL}>
-                       {html_options options=$goFonLanguageOptions selected=$goFonLanguage}
+                       <select style="width:380px;" name="goFonQueueLanguage" {$goFonQueueLanguageACL}>
+                       {html_options options=$goFonQueueLanguageOptions selected=$goFonQueueLanguage}
                        <option disabled>&nbsp;</option>
                        </select>
                </td>
                </tr>
                <tr>
                <td>
-                       {t}Retry{/t}
+                       {t}Timeout{/t}
                </td>
                <td>
                        <input name='goFonTimeOut' value='{$goFonTimeOut}' {$goFonTimeOutACL}>
                </td>
                </tr>
                <tr>
+               <td>
+                       {t}Retry{/t}
+               </td>
+               <td>
+                       <input name='goFonQueueRetry' value='{$goFonQueueRetry}' {$goFonQueueRetryACL}>
+               </td>
+               </tr>
+               <tr>
                <td>
                        {t}Strategy{/t} 
                </td>
                <td>
-                       <select style="width:380px;" name="goFonStrategy" {$goFonStrategyACL}>
-            {html_options options=$goFonStrategyOptions selected=$goFonStrategy}
+                       <select style="width:380px;" name="goFonQueueStrategy" {$goFonQueueStrategyACL}>
+            {html_options options=$goFonQueueStrategyOptions selected=$goFonQueueStrategy}
             <option disabled>&nbsp;</option>
             </select>
        
@@ -76,8 +84,8 @@
                        {t}Announce holdtime{/t}
                </td>
                <td>
-                       <select style="width:380px;" name="goFonAnnounceHoldtime" {$goFonAnnounceHoldtimeACL}>
-            {html_options options=$goFonAnnounceHoldtimeOptions selected=$goFonAnnounceHoldtime}
+                       <select style="width:380px;" name="goFonQueueAnnounceHoldtime" {$goFonQueueAnnounceHoldtimeACL}>
+            {html_options options=$goFonQueueAnnounceHoldtimeOptions selected=$goFonQueueAnnounceHoldtime}
             <option disabled>&nbsp;</option>
             </select>
                </td>
                        {t}Announce message{/t}
                </td>
                <td>
-                       <input type="text" style='width:250px;' name='goFonAnnounce' value='{$goFonAnnounce}' {$goFonAnnounceACL}>
+                       <input type="text" style='width:250px;' name='goFonQueueAnnounce' value='{$goFonQueueAnnounce}' {$goFonQueueAnnounceACL}>
                </td>
                </tr>
                <tr>
index 4dacfe3ca8f44c74a2567d6d8fe071c8317a6e89..451ed7ae61e1b521b235f56015632334f94788fe 100644 (file)
@@ -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="<input name='".$var."' value='".$choosen."' ".chkacl($this->acl, "goFonMacro").">";
+          $str="<input name='".$var."' value='".$choosen."' ".chkacl($this->acl, "goFonMacro").">";
           $macrotab.= "<td>$name</td><td>$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