X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fgofon%2Fconference%2Fclass_phoneConferenceManagment.inc;h=57de90f6136a82f870359fd55c19744718a36c69;hb=2c0515a09cbb244ec32757b8372f7e55830a67e3;hp=239e76605c6376556af0cc56b989ac742c8b7ada;hpb=72a8082692a8618ae50b19711d7606b68efe4ec9;p=gosa.git
diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc
index 239e76605..57de90f61 100644
--- a/plugins/gofon/conference/class_phoneConferenceManagment.inc
+++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc
@@ -21,32 +21,35 @@ require "tabs_conference.inc";
class phoneConferenceManagment extends plugin
{
- /* Definitions */
- var $plHeadline = "Phone conference";
- var $plDescription = "Managment ";
+ /* Definitions */
+ var $plHeadline = "Phone conferences";
+ var $plDescription = "Management";
- /* CLI vars */
- var $cli_summary = "Handling of LDAP subtrees";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+ /* CLI vars */
+ var $cli_summary = "Handling of LDAP subtrees";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
- /* Headpage attributes */
- var $conferences = array();
+ /* Headpage attributes */
+ var $conferences = array();
- /* attribute list for save action */
- var $attributes = array();
- var $objectclasses = array();
+ /* attribute list for save action */
+ var $attributes = array();
+ var $objectclasses = array();
var $conftab = false;
var $departments =array();
- /* Initialise Class */
- function phoneConferenceManagment ($config, $ui)
- {
- $this->ui = $ui;
- $this->dn = "";
- $this->config = $config;
-
+ /* Initialise Class */
+ function phoneConferenceManagment ($config, $ui)
+ {
+ $this->ui = $ui;
+ $this->dn = "";
+ $this->config = $config;
+
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "conference", $ui->dn);
+
/* Get global filter config */
if (!isset($_SESSION["conferencefilter"])){
$base= get_base_from_people($ui->dn);
@@ -55,21 +58,37 @@ class phoneConferenceManagment extends plugin
"regex" => "*");
$_SESSION["conferencefilter"] = $conferencefilter;
}
+ }
+
+ /* Execute class and display something */
+ function execute()
+ {
+
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Reload departments */
+ $this->config->departments = get_departments();
+ $smarty = get_smarty();
+ $display = "";
+ $s_action = ""; // Will contain an action, like del or edit
+ $s_entry = ""; // The entry name for edit delete -...
+ $conferencefilter = $_SESSION["conferencefilter"];
+
+ if(isset($_POST['regexit'])){
+ $conferencefilter['regex']=$_POST['regexit'];
+ }
+
+ if(isset($_GET['search'])){
+ if($_GET['search']=="*"){
+ $conferencefilter['regex']=$_GET['search'];
+ }else{
+ $conferencefilter['regex']=$_GET['search']."*";
+ }
+ }
+
+ $smarty->assign("regex",$conferencefilter['regex']);
-
- }
-
- /* Execute class and display something */
- function execute()
- {
- /* Reload departments */
- $this->config->departments = get_departments();
- $smarty = get_smarty();
- $display = "";
- $s_action = ""; // Will contain an action, like del or edit
- $s_entry = ""; // The entry name for edit delete -...
- $conferencefilter = $_SESSION["conferencefilter"];
-
/* Start for New List Managment */
if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
$s_action="open";
@@ -80,7 +99,7 @@ class phoneConferenceManagment extends plugin
foreach($_POST as $key => $post){
if(preg_match("/.*new.*/i",$key)){
$s_action = "new";
- // Post for delete
+ // Post for delete
}elseif(preg_match("/conf_del.*/",$key)){
$s_action = "del";
$s_entry = preg_replace("/conf_".$s_action."_/i","",$key);
@@ -99,6 +118,7 @@ class phoneConferenceManagment extends plugin
}
}
+ /* Edit Entry */
if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
$s_action = "edit";
$s_entry = $_GET['id'];
@@ -108,13 +128,14 @@ class phoneConferenceManagment extends plugin
if(isset($_POST['depselect']) && $_POST['depselect']){
$conferencefilter['depselect']= $_POST['depselect'];
}
-
+
/* Homebutton is posted */
if($s_action=="home"){
$conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
$conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$conferencefilter['depselect']));
}
-
+
+ /* back to root */
if($s_action=="root"){
$conferencefilter['depselect']=($this->config->current['BASE']);
}
@@ -168,9 +189,7 @@ class phoneConferenceManagment extends plugin
* Finally delete department
*/
if (isset($_POST['delete_department_confirm'])){
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $acl= get_module_permission($acl, "goFonConference", $this->dn);
- if (chkacl($acl, "all") == ""){
+ if (chkacl($this->acl, "delete") == ""){
$this->remove_from_parent();
gosa_log ("Department object'".$this->dn."' has been removed");
$this->reload ();
@@ -193,23 +212,22 @@ class phoneConferenceManagment extends plugin
/* Lock the current entry, so everyone will get the above dialog */
add_lock ($this->dn, $this->ui->dn);
- /* Set up the users ACL's for this 'dn' */
- $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-
/* Register conftab to trigger edit dialog */
$this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
- $this->conftab->set_acl(array(":all"));
$_SESSION['objectinfo']= $this->dn;
}
+ /* Insert new entry*/
if($s_action == "new"){
+ $this->dn= "new";
+ /* Set up the users ACL's for this 'dn' */
$this->dn= "new";
$this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn);
- $this->conftab->set_acl(array(':all'));
+ unset($_SESSION['objectinfo']);//
}
+ /* Edit finished, check and save changes */
if (isset($_POST['edit_finish'])){
-
/* Check tabs, will feed message array */
$this->conftab->last= $this->conftab->current;
$this->conftab->save_object();
@@ -227,74 +245,74 @@ class phoneConferenceManagment extends plugin
}
$this->conftab->save ();
+ del_lock ($this->conftab->dn);;
unset ($this->conftab);
$this->conftab= NULL;
unset ($_SESSION['objectinfo']);
} else {
show_errors($message);
}
+
+ $this->reload();
}
-
+
/* if edit or new, show dialog */
- if($this->conftab){
+ if($this->conftab){
$display= $this->conftab->execute();
/* Don't show buttons if tab dialog requests this */
if (!$this->conftab->by_object[$this->conftab->current]->dialog){
$display.= "
".
- "
".
- "
".
- "
".
- "
![](images/list_seperator.png)
".
- "
".
- "
![](images/list_seperator.png)
".
- _("Current base")."
".
- "
".
+ $listhead = "
";
-
- $actions = "
";
- $actions.= "
";
- $linkopen= "
%s";
+ /* Images for delete / edit */
+ $actions = "
";
+ $actions.= "
";
+
+ $actions2= "
";
+ /* open an entry */
+ $linkopen= "
%s";
/* Set Header */
- $divlist = new divlist("conferenceTabs");
- $divlist->SetSummary(_("This table displays all available conference rooms."));
- $divlist->SetEntriesPerPage(20);
- $divlist->SetHeader(array(
- array("string" => " "),
- array("string" =>_("Name / nummer")),
- array("string" =>_("Actions"), "attach" => "style='text-align: right;border:none'")));
-
- /* Insert departments in divlist*/
+ $divlist = new divlist("conferenceTabs");
+ $divlist->SetSummary(_("This table displays all available conference rooms."));
+ $divlist->SetEntriesPerPage(0);
+ $divlist->SetHeader(array(
+ array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
+ array("string" =>_("Name - Number"), "attach" => "style=''"),
+ array("string" => _("Owner"), "attach" => "style='width:200px;'"),
+ array("string" => _("PIN"), "attach" => "style='width:50px;'"),
+ array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")));
+
+ /* Insert departments in divlist*/
foreach($this->departments as $key=> $val){
-
if(!isset($this->config->departments[trim($key)])){
$this->config->departments[trim($key)]="";
}
@@ -307,58 +325,93 @@ class phoneConferenceManagment extends plugin
}
}
- $field1 = array("string" => "
![department](images/".$non_empty."folder.png)
","attach"=>"style='width:22px;'");
- $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
- $field3 = array("string" => " ", "attach" => "style='border:none;width:60px;'");
-
+ /* Prepare and insert fields*/
+ $a_field1 = array("string" => "
![department](images/".$non_empty."folder.png)
", "attach" => "style='text-align:center;width:20px;'");
+ $a_field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
+ $a_field3 = array("string" => " ", "attach" => "style='width:200px;'");
+ $a_field4 = array("string" => " ", "attach" => "style='width:50px;'");
+ $a_field5 = array("string" => " ", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
- $divlist->AddEntry(array($field1,$field2,$field3));
+ /* Add entries */
+ $divlist->AddEntry(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
}
-
- $userimg = "
![%s User](images/select_user.png)
";
+
+ /* Image shown in divlist */
+ $userimg = "
![%s User](images/select_conference.png)
";
+
+ /* Edit entry link*/
$editlink = "
%s";
+ /* Insert conferneces*/
foreach($this->conferences as $conferencekey => $conference ){
- $field1 = array("string"=>sprintf($userimg,_("Conference")));
- $field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0]));
- $field3 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions));
- $divlist->AddEntry(array($field1,$field2,$field3));
+
+ if((isset($conference['goFonPIN'][0]))&&(($this->ui->dn==$conference['goFonConferenceOwner'][0])||($this->acl=="#all#"))){
+ $pin = "
![PIN : ".$conference[ PIN](images/list_password.png)
";
+ }else{
+ $pin = " ";
+ }
+
+ if(isset($conference['telephoneNumber'][0])){
+ $number = " - ".$conference['telephoneNumber'][0];
+ }else{
+ $number = " - ?";
+ }
+
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ($conference['goFonConferenceOwner'][0]);
+ $data = $ldap->fetch($ldap->cat($conference['goFonConferenceOwner'][0]));
+ $cn = $data['cn'][0];
+
+ $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => "style='text-align:center;width:20px;'");
+
+ if(($this->acl=="#all#")||(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")==""))){
+ $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$conference['cn'][0].$number), "attach" => "style=''");
+ }else{
+ $a_field2 = array("string"=>$conference['cn'][0].$number, "attach" => "style=''");
+ }
+ $a_field3 = array("string"=> $cn, "attach" => "style='width:200px;'");
+ $a_field4 = array("string"=> $pin, "attach" => "style='width:50px;'");
+
+ if(($this->ui->dn==$conference['goFonConferenceOwner'][0])&&(chkacl($this->acl,"goFonConferenceOwner")=="")){
+ $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+ }elseif(chkacl($this->acl,"goFonConferenceOwner")==""){
+ $a_field5 = array("string"=>preg_replace("/%KEY%/",$conferencekey,$actions2), "attach" => "style='width:52px;border-right:0px;text-align:right;'");
+ }else{
+ $a_field5 = array("string"=>" ", "attach" => "style='width:52px;border-right:0px;text-align:right;'");
+ }
+
+ $divlist->AddEntry(array($a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
}
- $smarty->assign("search_image", get_template_path('images/search.png'));
- $smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("infoimage", get_template_path('images/info.png'));
- $smarty->assign("launchimage", get_template_path('images/launch.png'));
+ $smarty->assign("search_image", get_template_path('images/search.png'));
+ $smarty->assign("tree_image", get_template_path('images/tree.png'));
+ $smarty->assign("infoimage", get_template_path('images/info.png'));
+ $smarty->assign("launchimage", get_template_path('images/launch.png'));
$smarty->assign("conferences", $divlist->DrawList());
$smarty->assign("conferencehead", $listhead);
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("apply", apply_filter());
- $smarty->assign("alphabet", generate_alphabet());
- $smarty->assign("hint", print_sizelimit_warning());
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("apply", apply_filter());
+ $smarty->assign("alphabet", generate_alphabet());
+ $smarty->assign("hint", print_sizelimit_warning());
- $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE));
- return($display);
- }
+ $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE));
+ return($display);
+ }
- function reload()
- {
- $base = "dc=gonicus,dc=de";
-
+ /* Reload entries for divlist.
+ * First, reload all conferences for the current base, with the given regex
+ * Second, get all departments for the given base and regex
+ * Convert departments dn
+ */
+ function reload()
+ {
$conferencefilter = $_SESSION["conferencefilter"];
$base = $conferencefilter['depselect'];
$regex = $conferencefilter['regex'];
-
- $this->conferences= get_list($this->ui->subtreeACL, "(objectClass=goFonConference)",TRUE, $base, array("*"), TRUE);
-
- /* NEW LIST MANAGMENT
- * We also need to search for the departments
- * So we are able to navigate like in konquerer
- */
- $base2 = preg_replace("/ou=people,/i","",$base);
- $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
- TRUE, $base2, array("ou", "description"), TRUE);
+ $this->conferences=get_list($this->ui->subtreeACL, "(&(|(cn=$regex)(description=$regex))(objectClass=goFonConference))",FALSE, $base, array("*"), TRUE);
+ $res3=get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",TRUE, $base, array("ou", "description"), TRUE);
$this->departments= array();
@@ -368,45 +421,43 @@ class phoneConferenceManagment extends plugin
}
ksort($tmp);
foreach($tmp as $value){
- if($value["description"][0]!=".."){
+ if(isset($value["description"][0])){
$this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
}else{
- $this->departments[$value['dn']]=$value["description"][0];
+ $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
}
}
- /* END NEW LIST MANAGMENT
- */
+ }
+ function remove_from_parent()
+ {
+ $cfg = new conference($this->config, $this->dn);
+
+ $cfg->remove_from_parent();
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ($this->dn);
+ $ldap->recursive_remove();
+
+ /* Optionally execute a command after we're done */
+ $this->postremove();
+
+ /* Delete references to object groups */
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+ while ($ldap->fetch()){
+ $og= new conftab($this->config, $ldap->getDN());
+ unset($og->member[$this->dn]);
+ $og->save ();
+ }
-
}
- function remove_from_parent()
- {
- $ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
- $ldap->recursive_remove();
-
- /* Optionally execute a command after we're done */
- $this->postremove();
-
- /* Delete references to object groups */
- $ldap->cd ($this->config->current['BASE']);
- $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
- while ($ldap->fetch()){
- $og= new conftab($this->config, $ldap->getDN());
- unset($og->member[$this->dn]);
- $og->save ();
- }
-
- }
-
- function remove_lock()
- {
- if (isset($this->dn)){
- del_lock ($this->dn);
- }
- }
+ function remove_lock()
+ {
+ if (isset($this->dn)){
+ del_lock ($this->dn);
+ }
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: