diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc
index 960647288773089fad6fe98e9fe1fe31f0ef6d4f..0b3ec303e9e235a4f5fbdcedfd276ba11ebea2db 100644 (file)
var $goFonTimeOut ="20";
var $goFonMaxLen ="20"; //
var $goFonAnnounceFrequency ="60"; // Annouce Frequency in seconds
var $goFonTimeOut ="20";
var $goFonMaxLen ="20"; //
var $goFonAnnounceFrequency ="60"; // Annouce Frequency in seconds
- var $goFonDialOption_t ="";
- var $goFonDialOption_T ="";
- var $goFonDialOption_h ="";
- var $goFonDialOption_r ="";
+ var $goFonDialOptiont ="";
+ var $goFonDialOptionT ="";
+ var $goFonDialOptionh ="";
+ var $goFonDialOptionr ="";
var $goFonQueueAnnounce ="gonicus-berlin-welcome";
var $goFonQueueAnnounce ="gonicus-berlin-welcome";
- var $goFonDialOption_H ="";
+ var $goFonDialOptionH ="";
var $goFonMusiconHold ="default";
var $goFonWelcomeMusic ="gonicus-berlin-welcome";
var $goFonQueueReportHold ="yes";
var $goFonMusiconHold ="default";
var $goFonWelcomeMusic ="gonicus-berlin-welcome";
var $goFonQueueReportHold ="yes";
var $old_phone_numbers =array();
/* attribute list for save action */
var $old_phone_numbers =array();
/* attribute list for save action */
- var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOption_t","goFonDialOption_T",
- "goFonDialOption_h","goFonDialOption_r","cn",
- "goFonDialOption_H","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext",
+ var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOptiont","goFonDialOptionT",
+ "goFonDialOptionh","goFonDialOptionr","cn",
+ "goFonDialOptionH","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext",
"goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds","goFonQueueLessThan",
"telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry");
/* ObjectClass */
"goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds","goFonQueueLessThan",
"telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry");
/* ObjectClass */
}
for($i = 0; $i < strlen($this->goFonDialOption); $i++){
}
for($i = 0; $i < strlen($this->goFonDialOption); $i++){
- $name = "goFonDialOption_".$this->goFonDialOption[$i];
+ $name = "goFonDialOption".$this->goFonDialOption[$i];
$this->$name=$this->goFonDialOption[$i];
}
}
$this->$name=$this->goFonDialOption[$i];
}
}
function execute()
{
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Do we need to flip is_account state? */
/* Do we need to flip is_account state? */
- if (isset($_POST['modify_state'])){
- $this->is_account= !$this->is_account;
+ if(isset($_POST['modify_state'])){
+ if($this->is_account && $this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }elseif(!$this->is_account && $this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
}
/* Show tab dialog headers */
if ($this->parent != NULL){
if ($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"),
+ $display= $this->show_disable_header(_("Remove the phone queue from this Account"),
_("Phone queue is enabled for this group. You can disable it by clicking below."));
} else {
_("Phone queue is enabled for this group. You can disable it by clicking below."));
} else {
- $display= $this->show_header(_("Create phone queue"),
+ $display= $this->show_enable_header(_("Create phone queue"),
_("For this group the phone queues are disabled. You can enable them by clicking below."));
return ($display);
}
}
/* Add queue number */
_("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'];
+ if($this->acl_is_writeable("telephoneNumber")){
+ 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 */
}
}
/* Delete queue number */
- if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
- unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
+ if($this->acl_is_writeable("telephoneNumber")){
+ if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+ unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
+ }
}
$tmp = array();
}
$tmp = array();
$this->telephoneNumber=$tmp;
/* queue number up */
$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;
+ if($this->acl_is_writeable("telephoneNumber")){
+ 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;
+ /* 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= get_smarty();
+ /* Set acls */
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
$smarty->assign("goFonQueueLanguageOptions",array('de'=>_('German')));
$smarty->assign("goFonQueueStrategyOptions", $this->goFonQueueStrategyOptions);
$smarty->assign("goFonQueueLanguageOptions",array('de'=>_('German')));
$smarty->assign("goFonQueueStrategyOptions", $this->goFonQueueStrategyOptions);
}else{
$smarty->assign($val."CHK"," checked ");
}
}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)));
}
}
return ($display.$smarty->fetch (get_template_path('phonequeue.tpl', TRUE)));
}
/* Check formular input */
function check()
{
/* Check formular input */
function check()
{
- $message= array();
- #fixme workaround : Tab is not initialised correct
- if(!$this->is_account) return($message);
+ /* Call common method to give check the hook */
+ $message= plugin::check();
if($this->is_number_used()){
$message[] = $this->is_number_used();
if($this->is_number_used()){
$message[] = $this->is_number_used();
if(!isset($_SESSION['config']->data['SERVERS']['FON'])){
return(_("There is currently no asterisk server defined. Your settings can't be saved."));
if(!isset($_SESSION['config']->data['SERVERS']['FON'])){
return(_("There is currently no asterisk server defined. Your settings can't be saved."));
- return(false);
}
// Get Configuration for Mysql database Server
}
// Get Configuration for Mysql database Server
$a_ext[$i]['app'] = "Queue";
$a_ext[$i]['appdata'] = $this->attrs['cn'][0].
"|".
$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.
- $this->goFonDialOption_r;
+ $this->goFonDialOptiont.
+ $this->goFonDialOptionT.
+ $this->goFonDialOptionh.
+ $this->goFonDialOptionH.
+ $this->goFonDialOptionr;
}
if($this->goFonQueueAnnounceHoldtime != false) {
}
if($this->goFonQueueAnnounceHoldtime != false) {
{
plugin::save_object();
if(isset($_POST['phonenumber'])){
{
plugin::save_object();
if(isset($_POST['phonenumber'])){
- foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_r","goFonDialOption_H","goFonMusiconHold") as $val){
+ foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionh","goFonDialOptionr","goFonDialOptionH","goFonMusiconHold") as $val){
if(isset($_POST[$val])){
$this->$val = $_POST[$val];
}else{
if(isset($_POST[$val])){
$this->$val = $_POST[$val];
}else{
plugin::save();
$this->attrs['goFonDialOption'] = "";
plugin::save();
$this->attrs['goFonDialOption'] = "";
- foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_r","goFonDialOption_h","goFonDialOption_H","cn") as $val){
+ foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
$this->attrs['goFonDialOption'].=$this->$val;
unset($this->attrs[$val]);
}
$this->attrs['goFonDialOption'].=$this->$val;
unset($this->attrs[$val]);
}
/* Save data to LDAP */
$ldap->cd($this->dn);
/* Save data to LDAP */
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/phone queue with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
/* 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");
+ $this->handle_post_events("modify");
}
} else {
$this->handle_post_events("add");
}
} else {
$this->handle_post_events("add");
/* Remove all temporary attributes */
$tmp = array_flip($this->attributes);
/* Remove all temporary attributes */
$tmp = array_flip($this->attributes);
- foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_r","goFonDialOption_h","goFonDialOption_H","cn") as $val){
+ foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
unset($this->$val);
unset($this->attrs[$val]);
unset($tmp[$val]);
unset($this->$val);
unset($this->attrs[$val]);
unset($tmp[$val]);
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
$this->attributes, "Save");
$ldap->cd($this->dn);
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
$this->attributes, "Save");
$ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error());
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/phone queue with dn '%s' failed."),$this->dn));
}
}
+
+ function getCopyDialog()
+ {
+ $str = "";
+ $str .= _("Phone number");
+ $str .= " <input type='text' name='telephoneNumber' value='".$this->telephoneNumber."'>";
+ return($str);
+ }
+
+
+ function saveCopyDialog()
+ {
+ if(isset($_POST['telephoneNumber'])){
+ $this->telephoneNumber = $_POST['telephoneNumber'];
+ }
+ }
+
+
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Phone"),
+ "plDescription" => _("Phone group"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 3,
+ "plSection" => array("administration"),
+ "plCategory" => array("ogroups"),
+ "plProvidedAcls"=> array(
+
+ "goFonTimeOut" => _("Timeout"),
+ "goFonMaxLen" => _("Max queue length"),
+ "goFonAnnounceFrequency" => _("Announce frequency"),
+ "goFonDialOptiont" => _("Allow the called user to transfer his call"),
+ "goFonDialOptionT" => _("Allows calling user to transfer call"),
+ "goFonDialOptionh" => _("Allow the called to hangup by pressing *"),
+ "goFonDialOptionr" => _("Ring instead of playing background music"),
+ "goFonDialOptionH" => _("Allows calling to hangup by pressing *"),
+
+ "goFonMusiconHold" => _("Music on hold"),
+ "goFonWelcomeMusic" => _("Welcome music"),
+ "goFonQueueReportHold" => _("Report hold time"),
+ "goFonQueueYouAreNext" => _("'You are next' sound"),
+ "goFonQueueThereAre" => _("'There are' sound"),
+ "goFonQueueCallsWaiting" => _("'Call waiting' sound"),
+ "goFonQueueThankYou" => _("'Thank you' sound"),
+ "goFonQueueMinutes" => _("'Minutes' sound"),
+ "goFonQueueSeconds" => _("'Seconds' sound"),
+ "goFonQueueLessThan" => _("'Less than' sound"),
+ "telephoneNumber" => _("Queue phone number"),
+ "goFonQueueLanguage" => _("Language"),
+ "goFonQueueStrategy" => _("Method"),
+ "goFonQueueAnnounceHoldtime"=> _("Announce holdtime"),
+ "goFonQueueAnnounce" => _("Announce"),
+ "goFonQueueRetry" => _("Retry"))
+ ));
+ }
+
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: