Code

Added Ogroub queue functionality
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 Aug 2005 11:17:51 +0000 (11:17 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 Aug 2005 11:17:51 +0000 (11:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1068 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_config.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_phonequeue.inc [new file with mode: 0644]
plugins/admin/ogroups/phonequeue.tpl [new file with mode: 0644]
plugins/admin/ogroups/tabs_ogroups.inc

index 8dbf2f3390b62e92a4e1b44c585636a184628147..f79651dd1c84d40af14fce4cf818e616256bed89 100644 (file)
@@ -353,7 +353,9 @@ class config  {
                                                'DB'            => "gophone",
                                                'SIP_TABLE'             => "sip_users",
                                                'EXT_TABLE'     => "extensions",
-                                               'VOICE_TABLE'   => "voicemail_users");
+                                               'VOICE_TABLE'   => "voicemail_users",
+                                               'QUEUE_TABLE'   => "queues",
+                                               'QUEUE_MEMBER_TABLE'    => "queue_members");
        }
        /* Get logdb server */
        $ldap->cd ($this->current['BASE']);
index bbb1ada80b4feacde94928f4fa6b9f93ce13b901..86c96ae95abf749cd163644350b7e4dee8b98b4a 100644 (file)
@@ -344,6 +344,10 @@ class ogroup extends plugin
       } else {
         $this->allobjects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
       }
+      $this->allobjects[$attrs["dn"]]['objectClass']  = $attrs['objectClass'];
+      if(isset($attrs['uid'])){
+        $this->allobjects[$attrs["dn"]]['uid']          = $attrs['uid'];
+      }
     }
     uasort ($this->allobjects, 'sort_list');
     reset ($this->allobjects);
diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc
new file mode 100644 (file)
index 0000000..d524a7b
--- /dev/null
@@ -0,0 +1,548 @@
+<?php
+
+class phonequeue extends plugin
+{
+  /* plugin specific values */
+  var $mail= "";
+  var $cn= "";
+
+
+  var $goFonTimeOut             =""; 
+  var $goFonMaxLen              ="";
+  var $goFonAnnounceFrequency   ="";
+  var $goFonDialOption_t        ="";
+  var $goFonDialOption_T        ="";
+  var $goFonDialOption_h        ="";
+  var $goFonAnnounce            ="";
+  var $goFonDialOption_H        ="";
+  var $goFonMusiconHold         ="";
+  var $goFonWelcomeMusic        ="";
+  var $goFonQueueReportHold     ="";
+  var $goFonQueueYouAreNext     ="";
+  var $goFonQueueThereAre       ="";
+  var $goFonQueueCallsWaiting   ="";
+  var $goFonQueueThankYou       ="";
+  var $goFonQueueMinutes        =""; 
+  var $goFonQueueSeconds        ="";
+  var $goFonLanguage            ="";
+  var $goFonStrategy            ="";
+  var $goFonAnnounceHoldtime    ="";
+  var $telephoneNumber          =array();
+  var $goFonQueueMember         =array(); 
+  var $goFonDialOption          ="";
+
+  var $old_phone_numbers        =array();
+
+  /* attribute list for save action */
+  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");
+  /* ObjectClass */
+  var $objectclasses= array("goFonQueue");
+
+  function phonequeue ($config, $dn= NULL)
+  {
+    plugin::plugin($config, $dn);
+
+    /* Include config object */
+    $this->config= $config;
+
+    /* Save initial account state */
+    $this->initially_was_account= $this->is_account;
+
+    $this->telephoneNumber=$this->attrs['telephoneNumber'];
+    unset($this->telephoneNumber['count']); 
+
+
+    for($i = 0; $i < strlen($this->goFonDialOption); $i++){
+      $name = "goFonDialOption_".$this->goFonDialOption[$i];
+      $this->$name=$this->goFonDialOption[$i];
+    }
+    
+    $this->old_phone_numbers = $this->telephoneNumber;
+  }
+
+
+  function execute()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Show tab dialog headers */
+    if ($this->parent != NULL){
+      if ($this->is_account){
+        $display= $this->show_header(_("Remove the phone queue from this Account"),
+            _("Phone queue is enabled for this group. You can disable it by clicking below."));
+      } else {
+        $display= $this->show_header(_("Create phone queue"), _("For this group the phone queues are disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+
+    /* Add queue number */ 
+    if(isset($_POST['add_phonenumber'])&&(isset($_POST['phonenumber']))&&(!empty($_POST['phonenumber']))){
+      if((!in_array($_POST['phonenumber'],$this->telephoneNumber))&&(is_numeric($_POST['phonenumber']))){
+        $this->telephoneNumber[]=$_POST['phonenumber'];
+      }
+    }
+
+    /* Delete queue number */ 
+    if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+      unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
+    }
+  
+    $tmp = array();
+    foreach($this->telephoneNumber as $val){
+      if(!empty($val)){
+        $tmp[]= $val;
+      }
+    }  
+    $this->telephoneNumber=$tmp;
+
+    /* queue number up */ 
+    if(isset($_POST['up_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+      if($_POST['goFonQueueNumber_List']>0){
+        $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
+        $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1];
+        $this->telephoneNumber[$_POST['goFonQueueNumber_List']]    = $down; 
+        $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1]  = $up;
+      }
+    }
+
+    /* Queuenumber down */ 
+    if(isset($_POST['down_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+      if(isset($this->telephoneNumber[($_POST['goFonQueueNumber_List']+1)])){
+        $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1];
+        $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
+        $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1]    = $down; 
+        $this->telephoneNumber[$_POST['goFonQueueNumber_List']]  = $up;
+      }
+    }
+
+
+    $smarty= get_smarty();
+
+    $smarty->assign("goFonLanguageOptions",array('de'=>_('Germany'),'ur'=>_('Uruguai')));
+    $smarty->assign("goFonAnnounceHoldtimeOptions",array('no'=>_("No"),'yes'=>_('Yes')));
+    $smarty->assign("goFonStrategyOptions",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"),
+          'random'     =>_("ring random interface"),
+          'rrmemory'   =>_("round robin with memory, remember where we left off last ring pass")));
+
+    foreach($this->attributes as $key => $val){
+      $smarty->assign($val,$this->$val);  
+
+      if($this->$val == false){
+        $smarty->assign($val."CHK","");
+      }else{
+        $smarty->assign($val."CHK"," checked ");
+      }
+
+      if(chkacl($this->acl,$key)==""){
+        $smarty->assign($val."ACL","");
+      }else{
+        $smarty->assign($val."ACL"," disabled ");
+      }
+    }
+    return ($display.$smarty->fetch (get_template_path('phonequeue.tpl', TRUE)));
+  }
+
+
+  /* Check formular input */
+  function check()
+  {
+    $message= array();
+
+    if($this->is_number_used()){
+      $message[] = $this->is_number_used();
+    }
+
+    if($this->generate_mysql_entension_entries()){
+      $message[] = $this->generate_mysql_entension_entries();
+    }
+
+    if(!is_numeric($this->goFonTimeOut)){
+      $message[] = _("Timeout must be numeric");
+    }
+    if(!is_numeric($this->goFonMaxLen)){
+      $message[] = _("Queue length must be numeric");
+    }
+    if(!is_numeric($this->goFonAnnounceFrequency)){
+      $message[] = _("Announce frequency must be numeric");
+    }
+    if(count($this->telephoneNumber)==0){
+      $message[] = _("There must be least one queue number defined.");
+    }
+
+    return $message;
+  }
+
+
+
+  function generate_mysql_entension_entries($save = false)
+  {
+
+    $SQL = array();
+    // Get Configuration for Mysql database Server
+    $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
+    $s_parameter  ="";
+
+    // Connect to DB server
+    $r_con =  @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+
+    // Check if we are  connected correctly
+    if(!$r_con){
+      gosa_log(mysql_error());
+      return (sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+          $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
+    }
+
+    // Select database for Extensions
+    $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
+
+    // Test if we have the database selected correctly
+    if(!$db){
+      gosa_log(mysql_error());
+      return( sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+    }
+
+
+
+    if($save){
+      $i = 0;
+      $prio = 11; 
+
+      if(empty($this->cn)){
+        $this->cn = $this->parent->by_object['ogroup']->cn;
+        $this->attrs['cn'][0] = $this->parent->by_object['ogroup']->cn;
+      }
+
+      if(empty($this->description)){
+        $this->description = $this->parent->by_object['ogroup']->description;
+        $this->attrs['description'][0] = $this->parent->by_object['ogroup']->description;
+      }
+      
+      // Delete old Entries 
+      $delete = array();
+      foreach($this->old_phone_numbers as $phone){
+        $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
+      }
+      $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
+      $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";
+
+      /* Perform queries to delte old entries */
+      foreach($delete as $query){
+        if(!mysql_query($query)){
+          gosa_log(mysql_error());
+          return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+        }
+      }
+
+      /* Append new Member for this queue */ 
+      $i = 0;
+      foreach($this->parent->by_object['ogroup']->memberList as $member){
+        if(in_array("goFonAccount",$member['objectClass'])){
+          $i ++ ;
+          $queueuser[$i]['queue_name']  = $this->attrs['cn'][0]; 
+          $queueuser[$i]['interface']   = "SIP/".$member['uid'][0]; 
+          $queueuser[$i]['penalty']     = 1; 
+        }
+      }
+
+      /* Parse and Add members to query Array */
+      foreach($queueuser as $user){
+        $entries = "";
+        $values  = "";
+        foreach($user as $attr => $val){
+          $entries.= "`".$attr."`,"; 
+          $values .= "'".$val."',";
+        }
+        $values  = preg_replace("/,$/","",$values);
+        $entries = preg_replace("/,$/","",$entries );
+        
+        $SQL[]="INSERT INTO ".$a_SETUP['QUEUE_MEMBER_TABLE']." (".$entries.") VALUES (".$values.")"; 
+      }
+      
+
+      /* generate Extension entries, with priority  */
+      $i = 0;
+      foreach($this->telephoneNumber as $num){
+        $prio --;
+        $a_ext[$i]['context']  = 'GOsa';
+        $a_ext[$i]['exten']    = $num;
+        $a_ext[$i]['priority'] = 1;
+        $a_ext[$i]['app']      = "SetLanguage";
+        $a_ext[$i]['appdata']  = $this->goFonLanguage;
+        $i ++ ; 
+        $a_ext[$i]['context']  = 'GOsa';
+        $a_ext[$i]['exten']    = $num;
+        $a_ext[$i]['priority'] = 2;
+        $a_ext[$i]['app']      = "Playback";
+        $a_ext[$i]['appdata']  = $this->goFonWelcomeMusic;
+        $i ++ ; 
+        $a_ext[$i]['context']  = 'GOsa';
+        $a_ext[$i]['exten']    = $num;
+        $a_ext[$i]['priority'] = 3;
+        $a_ext[$i]['app']      = "SetCIDName";
+        $a_ext[$i]['appdata']  = $this->attrs['description'][0];
+        $i ++ ; 
+        $a_ext[$i]['context']  = 'GOsa';
+        $a_ext[$i]['exten']    = $num;
+        $a_ext[$i]['priority'] = 4;
+        $a_ext[$i]['app']      = "Queue";
+        $a_ext[$i]['appdata']  =  $this->attrs['cn'][0].
+          "|".
+          $this->goFonDialOption_t.
+          $this->goFonDialOption_T.
+          $this->goFonDialOption_h.
+          $this->goFonDialOption_H.
+          "|".  // Optionalurl egal
+          "|".  // announceoverride
+          "|".  // Timeout
+          $this->goFonTimeOut;     
+
+        $i ++ ; 
+        $a_ext[$i]['context']  = 'GOsa';
+        $a_ext[$i]['exten']    = $num;
+        $a_ext[$i]['priority'] = 5;
+        $a_ext[$i]['app']      = "SetVar";
+        $a_ext[$i]['appdata']  = "Queue_Prio=".$prio;
+        $i ++ ;
+
+        /* Generate Priority Entry */
+        $queue["announce"]              = "";
+        $queue["monitor_join"]          = "";
+        $queue["monitor_format"]        = "";
+        $queue["queue_holdtime"]        = $this->goFonAnnounce;
+        $queue["queue_lessthan"]        = "";   
+        $queue["announce_round_seconds"]= "";   
+        $queue["retry"]                 = "";
+        $queue["wrapuptime"]            = "";
+        $queue["servicelevel"]          = "";
+        $queue["joinempty"]             = "";
+        $queue["leavewhenempty"]        = "";   
+        $queue["eventmemberstatus"]     = "";
+        $queue["eventwhencalled"]       = "";
+        $queue["reportholdtime"]        = "";
+        $queue["memberdelay"]           = "";
+        $queue["weight"]                = "";
+        $queue["timeoutrestart"]        = "";
+
+        $queue["context"]               = "default";
+        $queue["name"]                  = $this->attrs['cn'][0];  
+        $queue["timeout"]               = $this->goFonTimeOut;
+        $queue["maxlen"]                = $this->goFonMaxLen;
+        $queue["strategy" ]             = $this->goFonStrategy;
+        $queue["queue_thankyou"]        = $this->goFonQueueThankYou;   
+        $queue["queue_reporthold"]      = $this->goFonQueueReportHold; 
+        $queue["announce_frequency"]    = $this->goFonAnnounceFrequency;
+        $queue["queue_youarenext"]      = $this->goFonQueueYouAreNext;   
+        $queue["queue_thereare"]        = $this->goFonQueueThereAre;   
+        $queue["queue_callswaiting"]    = $this->goFonQueueCallsWaiting;
+        $queue["queue_minutes"]         = $this->goFonQueueMinutes;
+        $queue["queue_seconds"]         = $this->goFonQueueSeconds;   
+        $queue["announce_holdtime"]     = $this->goFonAnnounceHoldtime;   
+        $queue["musiconhold"]           = $this->goFonMusiconHold;
+
+        $i++;
+      }
+
+      /* Parse and Add Extension entries */
+      foreach($a_ext as $ext){
+        $entries = "";
+        $values  = "";
+        foreach($ext as $attr => $val){
+          $entries.= "`".$attr."`,";
+          $values .= "'".$val."',";
+        }
+        $values  = preg_replace("/,$/","",$values);
+        $entries = preg_replace("/,$/","",$entries );
+        $SQL[]="INSERT INTO ".$a_SETUP['EXT_TABLE']." (".$entries.") VALUES (".$values.")";
+      }
+
+
+      /* Parse and Add Queue */
+      $entries = "";
+      $values  = "";
+      foreach($queue as $attr=>$val){
+        if($val == "") continue;
+        $entries.= "`".$attr."`,";
+        $values .= "'".$val."',";
+      }
+      $values  = preg_replace("/,$/","",$values);
+      $entries = preg_replace("/,$/","",$entries );
+      $SQL[]="INSERT INTO ".$a_SETUP['QUEUE_TABLE']." (".$entries.") VALUES (".$values.")";
+
+      foreach($SQL as $query){
+         if(!mysql_query($query)){
+          gosa_log(mysql_error());
+          print_red(mysql_error());
+          return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+        }
+      }
+
+    }
+    return(false);
+  }
+
+
+  function is_number_used()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->search("(objectClass=goFonAccount)", array("telephoneNumber","uid","cn"));
+    while($attrs = $ldap->fetch()) {
+      unset($attrs['telephoneNumber']['count']);
+      $usednumber[$attrs['uid'][0]]= $attrs['telephoneNumber'];
+      foreach($attrs['telephoneNumber'] as $tele){
+        $numbers[$tele]=$attrs;
+      }
+    }
+
+
+    foreach($this->telephoneNumber as $num){
+      if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!= $this->cn)||($numbers[$num]['uid'][0]!=$this->uid))){
+        if(isset($numbers[$num]['uid'][0])){
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
+        }else{
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
+        }
+      }
+    }
+  }
+
+
+
+
+
+  function save_object()
+  {
+    plugin::save_object();  
+    if(isset($_POST['phonenumber'])){
+      foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_H","goFonMusiconHold") as $val){
+        if(isset($_POST[$val])){
+          $this->$val = $_POST[$val];
+        }else{
+          $this->$val = false;
+        }
+      }
+    }
+
+  }
+
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    plugin::save();
+    $this->attrs['goFonDialOption'] = "";
+    foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_H") as $val){
+      $this->attrs['goFonDialOption'].=$this->$val; 
+      unset($this->attrs[$val]); 
+    }
+    $this->generate_mysql_entension_entries(true);
+    if($this->attrs['goFonDialOption']=="") $this->attrs['goFonDialOption']=array();
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    if ($this->initially_was_account == $this->is_account){
+      if ($this->is_modified){
+        $this->handle_post_events("mofify");
+      }
+    } else {
+      $this->handle_post_events("add");
+    }
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    $SQL = array();
+
+    // Get Configuration for Mysql database Server
+    $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
+    $s_parameter  ="";
+
+    // Connect to DB server
+    $r_con =  @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+
+    // Check if we are  connected correctly
+    if(!$r_con){
+      gosa_log(mysql_error());
+      return (sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+            $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
+    }
+
+    // Select database for Extensions
+    $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
+
+    // Test if we have the database selected correctly
+    if(!$db){
+      gosa_log(mysql_error());
+      return( sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+    }
+
+    $i = 0;
+    $prio = 11;
+
+    if(empty($this->cn)){
+      $this->cn = $this->parent->by_object['ogroup']->cn;
+      $this->attrs['cn'][0] = $this->parent->by_object['ogroup']->cn;
+    }
+
+    if(empty($this->description)){
+      $this->description = $this->parent->by_object['ogroup']->description;
+      $this->attrs['description'][0] = $this->parent->by_object['ogroup']->description;
+    }
+
+    // Delete old Entries
+    $delete = array();
+    foreach($this->old_phone_numbers as $phone){
+      $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
+    }
+    $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
+    $delete[]=    "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";
+
+    /* Perform queries to delte old entries */
+    foreach($delete as $query){
+      if(!mysql_query($query)){
+        gosa_log(mysql_error());
+        return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+      }
+    }
+
+
+
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/ogroups/phonequeue.tpl b/plugins/admin/ogroups/phonequeue.tpl
new file mode 100644 (file)
index 0000000..ede9924
--- /dev/null
@@ -0,0 +1,221 @@
+<table summary="{t}Queue Settings{/t}" style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="4">
+<tr>
+<td valign='top'>
+       <h2>
+       <img alt="" src="images/select_phone.png" align="middle">
+       {t}Generic queue setup{/t}
+       </h2>
+               <table summary="{t}Generic queue Settings{/t}" cellspacing="0" cellpadding="5">
+               <tr>
+               <td>
+                       {t}Phone Number{/t}
+               </td>
+               <td>
+                       <select style="width:380px; height:60px;" name="goFonQueueNumber_List" size=6 {$telephoneNumberACL}>
+                       {html_options options=$telephoneNumber}
+                       <option disabled>&nbsp;</option>
+                       </select>
+                       <br>
+                       <input name="phonenumber" size=20 align=middle maxlength=60                     {$telephoneNumberACL} value="">
+                       <input type="submit" value="{t}Add{/t}"         name="add_phonenumber"          {$telephoneNumberACL}>&nbsp;
+                       <input type="submit" value="{t}Delete{/t}"      name="delete_phonenumber"       {$telephoneNumberACL}>
+                       <input type="submit" value="{t}Up{/t}"          name="up_phonenumber"           {$telephoneNumberACL}>
+                       <input type="submit" value="{t}Down{/t}"        name="down_phonenumber"         {$telephoneNumberACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Language{/t} 
+               </td>
+               <td>
+                       <select style="width:380px;" name="goFonLanguage" {$goFonLanguageACL}>
+                       {html_options options=$goFonLanguageOptions selected=$goFonLanguage}
+                       <option disabled>&nbsp;</option>
+                       </select>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Timeout{/t}
+               </td>
+               <td>
+                       <input name='goFonTimeOut' value='{$goFonTimeOut}' {$goFonTimeOutACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Strategy{/t} 
+               </td>
+               <td>
+                       <select style="width:380px;" name="goFonStrategy" {$goFonStrategyACL}>
+            {html_options options=$goFonStrategyOptions selected=$goFonStrategy}
+            <option disabled>&nbsp;</option>
+            </select>
+       
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Max queue length{/t}
+               </td>
+               <td>
+                       <input name='goFonMaxLen' value='{$goFonMaxLen}' {$goFonMaxLenACL}>     
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Announce frequency{/t}
+               </td>
+               <td>
+                       <input name='goFonAnnounceFrequency' value='{$goFonAnnounceFrequency}' {$goFonAnnounceFrequencyACL}>
+                       {t}(in seconds){/t}     
+               </td>
+               </tr>
+               <tr>    
+               <td>    
+                       {t}Announce holdtime{/t}
+               </td>
+               <td>
+                       <select style="width:380px;" name="goFonAnnounceHoldtime" {$goFonAnnounceHoldtimeACL}>
+            {html_options options=$goFonAnnounceHoldtimeOptions selected=$goFonAnnounceHoldtime}
+            <option disabled>&nbsp;</option>
+            </select>
+               </td>
+               </tr>
+               <tr>
+               <td>
+               </td>
+               <td>
+                       <input type="checkbox" name='goFonDialOption_t' value='t'  {$goFonDialOption_tCHK} {$goFonDialOption_tACL}>
+                       {t}Allow the called user to transfer his call{/t}
+               </td>
+               </tr>
+               <tr>
+               <td>
+               </td>
+               <td>
+                       <input type="checkbox" name='goFonDialOption_T' value='T' {$goFonDialOption_TCHK} {$goFonDialOption_TACL}>
+                       {t}Allows calling user to transfer call{/t}
+               </td>
+               </tr>
+               <tr>
+               <td>
+               </td>
+               <td>
+                       <input type="checkbox" name='goFonDialOption_h' value='h' {$goFonDialOption_hCHK} {$goFonDialOption_hACL}>
+                       {t}Allow the called to hangup by pressing *{/t}
+               </td>
+               </tr>
+               <tr>
+               <td>
+               </td>
+               <td>
+                       <input type="checkbox" name='goFonDialOption_H' value='H' {$goFonDialOption_HCHK} {$goFonDialOption_HACL}>
+                       {t}Allows calling to hangup by pressing *{/t}
+               </td>
+               </tr>
+               </table>
+</td>
+<td valign='top' style="border-left: 1px solid rgb(160, 160, 160);">
+       <h2>
+    <img alt="" src="images/select_phone.png" align="middle">
+    {t}Queue sound file setup{/t}
+    </h2>
+       <table summary="{t}Generic queue Settings{/t}"  cellspacing="0" cellpadding="5">
+               <!--<tr>
+               <td>
+                       {t}Use music on hold instead of ringing{/t}
+               </td>
+               <td>
+                       <input type="checkbox" name='goFonMusiconHold' value='1' {$goFonMusiconHoldCHK} {$goFonMusiconHoldACL}>
+               </td>
+               </tr>
+               -->
+               <tr>
+               <td>
+                       {t}Music on hold{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonMusiconHold' value='{$goFonMusiconHold}' {$goFonMusiconHoldACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Welcome sound file{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonWelcomeMusic' value='{$goFonWelcomeMusic}' {$goFonWelcomeMusicACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Announce message{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonAnnounce' value='{$goFonAnnounce}' {$goFonAnnounceACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Sound file for 'You are next ...'{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueYouAreNext' value='{$goFonQueueYouAreNext}' {$goFonQueueYouAreNextACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'There are ...'{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueThereAre' value='{$goFonQueueThereAre}' {$goFonQueueThereAreACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'... calls waiting'{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueCallsWaiting' value='{$goFonQueueCallsWaiting}' {goFonQueueCallsWaitingACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'Thank you' message{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueThankYou' value='{$goFonQueueThankYou}' {$goFonQueueThankYouACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'minutes' sound file{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueMinutes' value='{$goFonQueueMinutes}' {$goFonQueueMinutesACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'seconds' sound file{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueSeconds' value='{$goFonQueueSeconds}' {$goFonQueueSecondsACL}>
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Hold sound file{/t}
+               </td>
+               <td>
+                       <input type="text" style='width:250px;' name='goFonQueueReportHold' value='{$goFonQueueReportHold}' {$goFonQueueReportHoldACL}>
+               </td>
+               </tr>
+
+               </table>
+</td>
+
+</tr>
+
+</table>
+                       
index a3007bda90ccb241378a9016da197c2b4a6d179a..e14f2be9636a547b870b6f17d89fe884be29b230 100644 (file)
@@ -23,6 +23,23 @@ class ogrouptabs extends tabs
           break;
 
         case "U":
+          /* Append a PhoneQueue, if objectClass = goFonAccount */
+          $use = false;
+          foreach($this->by_object['ogroup']->memberList as $dn => $val){
+            if(in_array("goFonAccount",$val['objectClass'])){
+              $use = true; 
+            }
+          }
+    
+          /* We found goFonAccount in users objectClasses*/
+          if($use){
+            require_once("class_phonequeue.inc");
+            $this->by_name['phonequeue']= _("Phone queue");
+            $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
+            $this->by_object['phonequeue']->parent= &$this;
+
+          } 
           /* Add a user tab used for mail distribution lists */
           if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
             require_once("class_mailogroup.inc");